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 |
|---|---|---|---|---|---|---|---|---|
b6657b78bce4cf43f611753d766f72a789b1d081 | rename kwarg for call_every | diogo149/treeano,jagill/treeano,diogo149/treeano,nsauder/treeano,diogo149/treeano,nsauder/treeano,jagill/treeano,jagill/treeano,nsauder/treeano | canopy/handlers/conditional.py | canopy/handlers/conditional.py | from . import base
class CallAfterEvery(base.NetworkHandlerImpl):
"""
handler that calls a callback with the result of a function every few
calls
"""
def __init__(self, iters, callback):
self.iters = iters
self.callback = callback
self.count = 0
def call(self, fn, *a... | from . import base
class CallAfterEvery(base.NetworkHandlerImpl):
"""
handler that calls a callback with the result of a function every few
calls
"""
def __init__(self, frequency, callback):
self.frequency = frequency
self.callback = callback
self.count = 0
def call(... | apache-2.0 | Python |
cd9433455e729a6436873e2ede76de73e479addb | fix ontospy query calls, more PEP8 stuff | duke-lungmap-team/ihc-image-analysis,duke-lungmap-team/ihc-image-analysis,duke-lungmap-team/ihc-image-analysis,duke-lungmap-team/ihc-image-analysis | scrape_cells_structures_from_ontology.py | scrape_cells_structures_from_ontology.py | # noinspection PyPackageRequirements
import ontospy
SPARQL_CELL_PROBE = """
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX : <http://www.semanticweb.org/am175/ontologies/2017/1/untitled-ontology-79#>
SELECT ?c ?p ?p_label WHERE {
?c rdfs:subClassOf* :cell .... | import ontospy
SPARQL_CELL_PROBE = """
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX : <http://www.semanticweb.org/am175/ontologies/2017/1/untitled-ontology-79#>
SELECT ?c ?p ?p_label WHERE {
?c rdfs:subClassOf* :cell .
?p rdfs:subClassOf :macromolecu... | bsd-2-clause | Python |
1e6fbbd44ba420e686fc90ed09c83a70a291ae24 | Debug output added to evaluation.py | fmaschler/networkit,fmaschler/networkit,fmaschler/networkit,fmaschler/networkit,fmaschler/networkit,fmaschler/networkit | scripts/BackboneEvaluation/evaluation.py | scripts/BackboneEvaluation/evaluation.py | from NetworKit import *
import time
import parameterization
# -----------------------------------------------------------------------
# The purpose of the following script is to automatically apply a set
# of backbone algorithms to a set of input graphs and to determine
# certain graph properties for evaluation.
# ---... | from NetworKit import *
import time
import parameterization
# -----------------------------------------------------------------------
# The purpose of the following script is to automatically apply a set
# of backbone algorithms to a set of input graphs and to determine
# certain graph properties for evaluation.
# ---... | mit | Python |
a4f96f4ded6e741c2516c57ae3e6f426da6aef50 | Fix message | julianghionoiu/tdl-client-python,julianghionoiu/tdl-client-python | src/tdl/queue/processing_rules.py | src/tdl/queue/processing_rules.py | from tdl.queue.abstractions.processing_rule import ProcessingRule
from tdl.queue.abstractions.response.fatal_error_response import FatalErrorResponse
from tdl.queue.abstractions.response.valid_response import ValidResponse
class ProcessingRules:
def __init__(self):
self._rules = {}
def add(self, met... | from tdl.queue.abstractions.processing_rule import ProcessingRule
from tdl.queue.abstractions.response.fatal_error_response import FatalErrorResponse
from tdl.queue.abstractions.response.valid_response import ValidResponse
class ProcessingRules:
def __init__(self):
self._rules = {}
def add(self, met... | apache-2.0 | Python |
218201ff63361b85b6aaafddd99fa9ad1fc87bba | Bump version | LeadPages/gcloud_requests | gcloud_requests/__init__.py | gcloud_requests/__init__.py | import logging
logger = logging.getLogger("gcloud_requests")
__version__ = "0.13.6"
| import logging
logger = logging.getLogger("gcloud_requests")
__version__ = "0.13.5"
| mit | Python |
195792b099378cfc281869842cf6e6128546bc8f | Prepare v0.33.0 for a release | genestack/python-client | genestack_client/version.py | genestack_client/version.py | __version__ = '0.33.0'
| __version__ = '0.33.0a5'
| mit | Python |
d40b42be93f8daaa6b2d389df5e00fc42822429f | Change emailer to check for hdx smtp | ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata,ViderumGlobal/ckanext-requestdata | ckanext/requestdata/emailer.py | ckanext/requestdata/emailer.py | import logging
import smtplib
import cgi
import ckanext.hdx_users.controllers.mailer as hdx_mailer
import paste.deploy.converters
from socket import error as socket_error
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email import Encoders
f... | import logging
import smtplib
import cgi
from socket import error as socket_error
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email import Encoders
from pylons import config
log = logging.getLogger(__name__)
SMTP_SERVER = config.get('... | agpl-3.0 | Python |
945a3f655822510d9c1d5ab5eeffe1461e6aaa0f | Make the dashboard view available only for superusers | synw/django-chartflo,synw/django-chartflo,synw/django-chartflo | chartflo/views.py | chartflo/views.py | # -*- coding: utf-8 -*-
from django.views.generic import TemplateView
from django.http.response import Http404
from .conf import ENGINE
class DashboardView(TemplateView):
"""
Generic dashboard view
"""
def dispatch(self, request, *args, **kwargs):
self.slug = kwargs["slug"]
if not re... | # -*- coding: utf-8 -*-
from django.views.generic import TemplateView
from .conf import ENGINE
class DashboardView(TemplateView):
"""
Generic dashboard view
"""
def dispatch(self, request, *args, **kwargs):
self.slug = kwargs["slug"]
return super(DashboardView, self).dispatch(request... | mit | Python |
6f4af31452e56d6497330e7e2eeb6a307f17788d | use better required_login | zhy0216/pillar,zhy0216/pillar | web/util/__init__.py | web/util/__init__.py | # -*- coding: utf-8 -*-
from functools import wraps
from flask import session, request, redirect, url_for
#http://flask.pocoo.org/docs/patterns/viewdecorators/
def login_required(f):
from web.model import User
from web.app import app
@wraps(f)
def decorated_function(*args, **kwargs):
r = re... | # -*- coding: utf-8 -*-
from functools import wraps
from flask import session, request, redirect, url_for
#http://flask.pocoo.org/docs/patterns/viewdecorators/
def login_required(f):
from model import User
@wraps(f)
def decorated_function(*args, **kwargs):
r = request.path
if "user" no... | mit | Python |
690542860a598c04c5d50f2bfcee155b98fbf97c | bump the version for release | alfredodeza/pecan-mount | pecan_mount/__init__.py | pecan_mount/__init__.py | from pecan_mount import _tree
__version__ = '0.0.2'
tree = _tree.Tree()
| from pecan_mount import _tree
__version__ = '0.0.1'
tree = _tree.Tree()
| bsd-3-clause | Python |
3e572413bec73bc8307e6ff079656f6ac5826f4a | Use dev ESI until latest is fixed | randomic/antinub-gregbot | utils/esicog.py | utils/esicog.py | import asyncio
import esipy
from discord.ext import commands
from requests.adapters import DEFAULT_POOLSIZE
from utils.log import get_logger
ESI_SWAGGER_JSON = 'https://esi.evetech.net/dev/swagger.json'
ESI_APP: esipy.App = None
ESI_CLIENT: esipy.EsiClient = None
ESI_CLIENT_SEMAPHORE = asyncio.Semaphore(DEFAULT_POOL... | import asyncio
import esipy
from discord.ext import commands
from requests.adapters import DEFAULT_POOLSIZE
from utils.log import get_logger
ESI_SWAGGER_JSON = 'https://esi.evetech.net/latest/swagger.json'
ESI_APP: esipy.App = None
ESI_CLIENT: esipy.EsiClient = None
ESI_CLIENT_SEMAPHORE = asyncio.Semaphore(DEFAULT_P... | mit | Python |
92e9b3ae2c6e348fe53eb9a2be807d73e58ac331 | fix doc | yuyu2172/chainercv,pfnet/chainercv,chainer/chainercv,yuyu2172/chainercv,chainer/chainercv | chainercv/chainer_experimental/training/extensions/make_shift.py | chainercv/chainer_experimental/training/extensions/make_shift.py | from chainer.training import Extension
def make_shift(attr, optimizer=None):
"""Decorator to make shift extensions.
This decorator wraps a function and makes a shift extension.
Base function should take :obj:`trainer` and return a new value of
:obj:`attr`.
Here is an example.
>>> @make_shif... | from chainer.training import Extension
def make_shift(attr, optimizer=None):
"""Decorator to make shift extensions.
This decorator wraps a function and makes a shift extension.
Base function should takes :obj:`trainer` and returns a new value of
:obj:`attr`.
Here is an example.
>>> @make_sh... | mit | Python |
0a5af42de7aa90e5eb1db5800d22efc4f2872cf3 | Add missing channel ID argument to render public news item body | homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps | byceps/blueprints/news/views.py | byceps/blueprints/news/views.py | """
byceps.blueprints.news.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import dataclasses
from flask import abort, g
from ...services.news import service as news_service
from ...services.site import settings_service as site_setti... | """
byceps.blueprints.news.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import dataclasses
from flask import abort, g
from ...services.news import service as news_service
from ...services.site import settings_service as site_setti... | bsd-3-clause | Python |
8dc89c01a19a600929623ba8e41233e19eb8b00a | Fix typos | byt3bl33d3r/CrackMapExec | cme/modules/webdav.py | cme/modules/webdav.py | from cme.protocols.smb.remotefile import RemoteFile
from impacket import nt_errors
from impacket.smb3structs import FILE_READ_DATA
from impacket.smbconnection import SessionError
class CMEModule:
'''
Enumerate whether the WebClient service is running on the target by looking for the
DAV RPC Service pipe. T... | from cme.protocols.smb.remotefile import RemoteFile
from impacket import nt_errors
from impacket.smb3structs import FILE_READ_DATA
from impacket.smbconnection import SessionError
class CMEModule:
'''
Enumerate whether the WebClient service is running on the target host by looking for the
DAV RPC Service pi... | bsd-2-clause | Python |
a9563d9b91fea58d2ef106bbae67f2df3aa4b10f | add small sleep | houqp/rumrunner,etdub/rumrunner | rumrunner.py | rumrunner.py | import time
import ujson
import zmq
class Rumrunner(object):
def __init__(self, metric_socket, app_name):
self.metric_socket = metric_socket
self.app_name = app_name
self.context = zmq.Context()
# Send metrics
self.send_socket = self.context.socket(zmq.PUSH)
self.s... | import time
import ujson
import zmq
class Rumrunner(object):
def __init__(self, metric_socket, app_name):
self.metric_socket = metric_socket
self.app_name = app_name
self.context = zmq.Context()
# Send metrics
self.send_socket = self.context.socket(zmq.PUSH)
self.s... | apache-2.0 | Python |
39770d6a48d8e017d4d8fc803544e51d352b9f7d | Fix Python 3 compatibility issue | imitrichev/cantera,imitrichev/cantera,Heathckliff/cantera,imitrichev/cantera,Heathckliff/cantera,Heathckliff/cantera,imitrichev/cantera,imitrichev/cantera,imitrichev/cantera,Heathckliff/cantera,Heathckliff/cantera,Heathckliff/cantera | interfaces/cython/cantera/examples/reaction_path.py | interfaces/cython/cantera/examples/reaction_path.py | """
Viewing a reaction path diagram.
This script uses Graphviz to generate an image. You must have Graphviz installed
and the program 'dot' must be on your path for this example to work.
Graphviz can be obtained from http://www.graphviz.org/ or (possibly) installed
using your operating system's package manager.
"""
i... | """
Viewing a reaction path diagram.
This script uses Graphviz to generate an image. You must have Graphviz installed
and the program 'dot' must be on your path for this example to work.
Graphviz can be obtained from http://www.graphviz.org/ or (possibly) installed
using your operating system's package manager.
"""
i... | bsd-3-clause | Python |
b03b95189bbe62111d421f7a7448634c27cfff21 | Add some basic functions | vbkaisetsu/clopure | clopure/basics.py | clopure/basics.py | import sys
import itertools
import operator
from functools import reduce
from fractions import Fraction
def clopure_div(s, *args):
s = Fraction(s) if isinstance(s, int) else s
if len(args) == 0:
return Fraction(1) / s
for x in args:
s /= x
return s
def clopure_unzip(g, n):
gs = ... | import sys
import itertools
import operator
from functools import reduce
from fractions import Fraction
def clopure_div(s, *args):
s = Fraction(s) if isinstance(s, int) else s
if len(args) == 0:
return Fraction(1) / s
for x in args:
s /= x
return s
def clopure_unzip(g, n):
gs = ... | mit | Python |
de553d6df3738c50b63891a1174a625788373dda | tweak in gcp | probml/pyprobml,probml/pyprobml,probml/pyprobml,probml/pyprobml | scripts/iris_sklearn.py | scripts/iris_sklearn.py | import numpy as np
import matplotlib.pyplot as plt
import os
#figdir = os.path.join(os.environ["PYPROBML"], "figures")
#def save_fig(fname): plt.savefig(os.path.join(figdir, fname))
def save_fig(fname):
root = os.getenv('PYPROBML') # None if key does not exist
if root:
plt.savefig(os.path.join(root, 'f... | import numpy as np
import matplotlib.pyplot as plt
import os
#figdir = os.path.join(os.environ["PYPROBML"], "figures")
#def save_fig(fname): plt.savefig(os.path.join(figdir, fname))
def save_fig(fname):
root = os.getenv('PYPROBML') # None if key does not exist
if root:
plt.savefig(os.path.join(root, 'f... | mit | Python |
49d87230dffa32e987da1f54d4626c93197f3977 | allow access of Exceptions | untitaker/python-webuntis,maphy-psd/python-webuntis | webuntis/__init__.py | webuntis/__init__.py | """
This file is part of python-webuntis
:copyright: (c) 2012 by Markus Unterwaditzer.
:license: BSD, see LICENSE for more details.
"""
__version__ = '0.1.9'
from webuntis.session import Session
from webuntis import errors
| """
This file is part of python-webuntis
:copyright: (c) 2012 by Markus Unterwaditzer.
:license: BSD, see LICENSE for more details.
"""
__version__ = '0.1.9'
from webuntis.session import Session
| bsd-3-clause | Python |
cf69bc92c0d7b885a389b5835d1a70309658886f | Update magpieluck crawler to use feed instead of web site front page | klette/comics,jodal/comics,klette/comics,jodal/comics,jodal/comics,jodal/comics,datagutten/comics,datagutten/comics,klette/comics,datagutten/comics,datagutten/comics | comics/comics/magpieluck.py | comics/comics/magpieluck.py | from comics.aggregator.crawler import CrawlerBase, CrawlerImage
from comics.meta.base import MetaBase
class Meta(MetaBase):
name = 'Magpie Luck'
language = 'en'
url = 'http://magpieluck.com/'
start_date = '2009-07-30'
rights = 'Katie Sekelsky, CC BY-NC-SA 3.0'
class Crawler(CrawlerBase):
histo... | from comics.aggregator.crawler import CrawlerBase, CrawlerImage
from comics.meta.base import MetaBase
class Meta(MetaBase):
name = 'Magpie Luck'
language = 'en'
url = 'http://magpieluck.com/'
start_date = '2009-07-30'
rights = 'Katie Sekelsky, CC BY-NC-SA 3.0'
class Crawler(CrawlerBase):
histo... | agpl-3.0 | Python |
1d8944c314c77fe34edbbd5cd12784807d2b58c7 | Fix comparison to blank string via 'is' | RudolfCardinal/pythonlib,RudolfCardinal/pythonlib | cardinal_pythonlib/typetests.py | cardinal_pythonlib/typetests.py | #!/usr/bin/env python
# cardinal_pythonlib/typetests.py
"""
===============================================================================
Original code copyright (C) 2009-2021 Rudolf Cardinal (rudolf@pobox.com).
This file is part of cardinal_pythonlib.
Licensed under the Apache License, Version 2.0 (t... | #!/usr/bin/env python
# cardinal_pythonlib/typetests.py
"""
===============================================================================
Original code copyright (C) 2009-2021 Rudolf Cardinal (rudolf@pobox.com).
This file is part of cardinal_pythonlib.
Licensed under the Apache License, Version 2.0 (t... | apache-2.0 | Python |
8b3a79a5ff0845c92fe2e6b30d0999be9ac70bbe | fix default path in poll script | jeffleary00/greenery,jeffleary00/greenery,jeffleary00/greenery,jeffleary00/greenery | greenery/lib/sensors.py | greenery/lib/sensors.py | import os
import re
"""
class used to read temp information from a dallas 1-wire temp sensor, like
the DS18B20
"""
class OneWireTemp(object):
def __init__(self, id):
# default path
self.path = '/sys/bus/w1/devices'
if os.path.exists(id):
self.path = id
self.id = o... | import os
import re
"""
class used to read temp information from a dallas 1-wire temp sensor, like
the DS18B20
"""
class OneWireTemp(object):
def __init__(self, id):
# default path
self.path = '/sys/bus/w1/devices/'
if os.path.exists(id):
self.path = id
self.id = ... | bsd-2-clause | Python |
df225799254788fd714485901b9dba214653daca | Use setup() / close() construct in file_logger sample | MonsieurV/PiPocketGeiger | examples/file_logger.py | examples/file_logger.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Log radiation levels to a CSV file.
Released under MIT License. See LICENSE file.
By Yoan Tournade <yoan@ytotech.com>
"""
from PiPocketGeiger import RadiationWatch
import datetime
import time
import csv
FILENAME = "radiation.csv"
LOGGING_PERIOD = 30
if __name__ == "... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Log radiation levels to a CSV file.
Released under MIT License. See LICENSE file.
By Yoan Tournade <yoan@ytotech.com>
"""
from PiPocketGeiger import RadiationWatch
import datetime
import time
import csv
FILENAME = "radiation.csv"
LOGGING_PERIOD = 30
if __name__ == "... | mit | Python |
7043e82165b34444ce34607a0e4c7214775c610a | Disable celery for now | beijingren/roche-website,beijingren/roche-website,beijingren/roche-website,beijingren/roche-website | roche/__init__.py | roche/__init__.py | from __future__ import absolute_import
#from .celery import app
| from __future__ import absolute_import
from .celery import app
| mit | Python |
dad38c399c4687c93c69255df0f9d69d1bb386c4 | Add missing parent for WorkflowAwareModel | freevoid/yawf | yawf/models.py | yawf/models.py | from django.db import models
from django.utils.translation import ugettext_lazy as _
from yawf.config import INITIAL_STATE
from yawf.base_model import WorkflowAwareModelBase
class WorkflowAwareModel(WorkflowAwareModelBase, models.Model):
class Meta:
abstract = True
state = models.CharField(default=... | from django.db import models
from django.utils.translation import ugettext_lazy as _
from yawf.config import INITIAL_STATE
from yawf.base_model import WorkflowAwareModelBase
class WorkflowAwareModel(WorkflowAwareModelBase):
class Meta:
abstract = True
state = models.CharField(default=INITIAL_STATE,... | mit | Python |
d400bec946ab1ec747c9855f9996aaf8ee58ad81 | Make chunks smaller for testing. | alexrudy/Zeeko,alexrudy/Zeeko | zeeko/telemetry/tests/conftest.py | zeeko/telemetry/tests/conftest.py | import pytest
import numpy as np
@pytest.fixture
def array(shape, dtype):
"""An array to send over the wire"""
return (np.random.rand(*shape)).astype(dtype)
@pytest.fixture
def chunksize():
"""The size of chunks."""
return 20
@pytest.fixture
def lastindex():
"""The last index filled in.""... | import pytest
import numpy as np
@pytest.fixture
def array(shape, dtype):
"""An array to send over the wire"""
return (np.random.rand(*shape)).astype(dtype)
@pytest.fixture
def chunksize():
"""The size of chunks."""
return 1024
@pytest.fixture
def lastindex():
"""The last index filled in.... | bsd-3-clause | Python |
10aefdd1bf7dbd75f2c9914fea170e4f0aaadb92 | Rewrite the foo.py to be a better example (subclassing of the ScoutBasicModule) | openSUSE/scout,sleep-walker/scout,sleep-walker/scout,openSUSE/scout | scout/foo.py | scout/foo.py | # Copyright (c) 2008 Pavol Rusnak, Michal Vyskocil
# see __init__.py for license details
import scout
class ScoutModule(object.BasicScoutModule):
name = "foo"
desc = "- template module -"
sql = 'SELECT package, @@FOO@@, @@BAR@@ FROM @@BAR@@s LEFT JOIN @@FOO@@s ON @@BAR@@s.id_@@FOO@@=@@FOO@@s.id_@@FOO@@ L... | # Copyright (c) 2008 Pavol Rusnak
# see __init__.py for license details
import scout
class ScoutModule(object):
name = "foo"
desc = "- template module -"
@classmethod
def main(cls):
p = scout.Parser(cls.name)
if not p.parse():
return None
print p.get_repos()
... | mit | Python |
54987d6f6f7aeaa2f92739bedba2a9f6cb887b27 | change user registration url | puttarajubr/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,SEL-Columbia/commcare-hq,puttara... | corehq/apps/registration/urls.py | corehq/apps/registration/urls.py | from django.conf.urls.defaults import *
urlpatterns = patterns('corehq.apps.registration.views',
url(r'^user/(?P<domain_type>\w+)?$', 'register_user', name='register_user'),
url(r'^domain/(?P<domain_type>\w+)?$', 'register_domain', name='registration_domain'),
url(r'^organization/$', 'register_org', name='... | from django.conf.urls.defaults import *
urlpatterns = patterns('corehq.apps.registration.views',
url(r'^(?P<domain_type>\w+)?$', 'register_user', name='register_user'),
url(r'^domain/(?P<domain_type>\w+)?$', 'register_domain', name='registration_domain'),
url(r'^organization/$', 'register_org', name='regis... | bsd-3-clause | Python |
41d331f990d661f71275758335a912059442ef92 | fix whitespaces | kubernetes-client/python,kubernetes-client/python | examples/node_labels.py | examples/node_labels.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 |
9fefeddb475206c4f640e272ab57abda032724ad | Develop ConversionPlusMapper to process data with Executions | google/megalista,google/megalista | megalist_dataflow/mappers/conversion_plus_mapper.py | megalist_dataflow/mappers/conversion_plus_mapper.py | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2019 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 |
54191ee521cee57f40c912f4f2fa460773ecee2a | use default authentication for wq.db.rest | wq/django-data-wizard,wq/django-data-wizard,wq/django-data-wizard,wq/django-data-wizard | data_wizard/rest.py | data_wizard/rest.py | from rest_framework import serializers
from wq.db import rest
from wq.db.rest.views import ModelViewSet
from wq.db.rest.serializers import ModelSerializer
from wq.db.rest.renderers import HTMLRenderer, JSONRenderer
from wq.db.rest.context_processors import get_base_url
from .models import Run
from . import views as wiz... | from rest_framework import serializers
from wq.db import rest
from wq.db.rest.views import ModelViewSet
from wq.db.rest.serializers import ModelSerializer
from wq.db.rest.renderers import HTMLRenderer, JSONRenderer
from wq.db.rest.context_processors import get_base_url
from .models import Run
from . import views as wiz... | mit | Python |
17b21261df11ed848df4a207da74b83b5ac3aa2d | fix imports | mcara/wiimatch | wiimatch/__init__.py | wiimatch/__init__.py | """wiimatch"""
from __future__ import (absolute_import, division, unicode_literals,
print_function)
import os
__docformat__ = 'restructuredtext en'
__version__ = '0.1.0'
__version_date__ = '09-May-2017'
__author__ = 'Mihai Cara'
from .version import *
from . import match
from . import lsq_... | """wiimatch"""
from __future__ import (absolute_import, division, unicode_literals,
print_function)
import os
__docformat__ = 'restructuredtext en'
__version__ = '0.1.0'
__version_date__ = '09-May-2017'
__author__ = 'Mihai Cara'
from .version import *
from . import match
| bsd-3-clause | Python |
2e145bf60d3df829cfeb8ed850153683d0f4afb4 | Combine generate_acceptable_answers and is_acceptable_answer | dpeters19/webassign2 | science_utils.py | science_utils.py | def is_hyper_scientific(number):
""" Determines if an answer is hyper-scientific
Args:
number (String)
Returns:
bool: True if is hyper-scientific, False otherwise
Example:
>>> is_hyper_scientific("1.00e2")
True
>>> is_hyper_scientific("100")
False
>>> is_hyper_scienti... | def is_hyper_scientific(number):
""" Determines if an answer is hyper-scientific
Args:
number (String)
Returns:
bool: True if is hyper-scientific, False otherwise
Example:
>>> is_hyper_scientific("1.00e2")
True
>>> is_hyper_scientific("100")
False
>>> is_hyper_scienti... | mit | Python |
c2a547137f18bf431b1329ba1df08681254d47f1 | Update eveapi_simple.py | nyrocron/eve-corplist | eveapi_simple.py | eveapi_simple.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""eveapi_simple.py: simple eve api query helper"""
from httplib import HTTPSConnection
from urllib.parse import urluns... | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""eveapi_simple.py: simple eve api query helper"""
from httplib import HTTPSConnection
from lxml import objectify
cl... | mpl-2.0 | Python |
e4552d1fdecfa62413d8590f0df9456cf88e1698 | Fix missing user.name will raise exception | SkygearIO/chat,SkygearIO/chat | chat/user.py | chat/user.py | # Copyright 2017 Oursky Ltd.
#
# 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 2017 Oursky Ltd.
#
# 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 |
8464583402ef7b35497b0f8427ef0c87b7ee9be4 | fix harmless typo: supdoc precedes doc, not itself (does not change component assignment) | sassoftware/conary,sassoftware/conary,sassoftware/conary,sassoftware/conary,sassoftware/conary | config/components/base/supdoc.py | config/components/base/supdoc.py | #
# Copyright (c) 2004-2006 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.opensource.org/... | #
# Copyright (c) 2004-2006 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.opensource.org/... | apache-2.0 | Python |
2aeb3d6584cf2678965f781e39a16457cf932338 | Change signature of find-text command | mnieber/dodo_commands | dodo_commands/extra/dodo_standard_commands/find-text.py | dodo_commands/extra/dodo_standard_commands/find-text.py | from argparse import ArgumentParser
from dodo_commands.framework import Dodo
import os
import glob
def _args():
parser = ArgumentParser()
parser.add_argument('where')
parser.add_argument('what')
parser.add_argument('--pattern', default='*')
parser.add_argument('--replace')
args = Dodo.parse_ar... | from argparse import ArgumentParser
from dodo_commands.framework import Dodo
def _args():
parser = ArgumentParser()
parser.add_argument('what')
parser.add_argument('where')
args = Dodo.parse_args(parser)
return args
if Dodo.is_main(__name__):
args = _args()
Dodo.run(['grep', '-rnw', args... | mit | Python |
63a4090ab85b9656e077d5aeda5e4858952e0b47 | update version to 0.7.4 | ibamacsr/sentinelsat | sentinelsat/__init__.py | sentinelsat/__init__.py | __version__ = '0.7.4'
| __version__ = '0.7.3'
| agpl-3.0 | Python |
b2d2bc3e57572df21cc0a11b1ad01c2dd76529f9 | Fix import style. | joyxu/kernelci-backend,joyxu/kernelci-backend,kernelci/kernelci-backend,joyxu/kernelci-backend,kernelci/kernelci-backend | app/urls.py | app/urls.py | # 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 distributed in the hope that it will be usefu... | # 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 distributed in the hope that it will be usefu... | agpl-3.0 | Python |
7c48bc5aa1cc4d0df5e6ab476218cefe9bfe085d | bump version | Akuli/porcupine,Akuli/editor,PurpleMyst/porcupine,Akuli/porcupine,PurpleMyst/porcupine,Akuli/porcupine | porcupine/__init__.py | porcupine/__init__.py | # this docstring doesn't contain a one-line summary because editor.py
# uses it as a welcome message
"""
Porcupine is a simple, beginner-friendly editor for writing Python code.
If you ever used anything like Notepad, Microsoft Word or LibreOffice
Writer before, you will feel right at home.
You can create a new file b... | # this docstring doesn't contain a one-line summary because editor.py
# uses it as a welcome message
"""
Porcupine is a simple, beginner-friendly editor for writing Python code.
If you ever used anything like Notepad, Microsoft Word or LibreOffice
Writer before, you will feel right at home.
You can create a new file b... | mit | Python |
ca8af712ad8609c3b82bf94b10543c3644f7c719 | Add Acoustical Plus channel | tangledhelix/focusatwill-in-google-chrome,tangledhelix/focusatwill-in-google-chrome | script_filter.py | script_filter.py | import re
import sys
genre_list = {
# "Classical": 6,
"Classical Plus": 503,
# Old name for Electro Bach
"Einstein's Genius": 493,
"Electro Bach": 493,
"Neuro Space": 483,
"Focus Spa": 473,
"Uptempo": 443,
"Alpha Chill": 153,
"Classical Piano": 393,
"Acoustical": 8,
"Cin... | import re
import sys
genre_list = {
# "Classical": 6,
"Classical Plus": 503,
# Old name for Electro Bach
"Einstein's Genius": 493,
"Electro Bach": 493,
"Neuro Space": 483,
"Focus Spa": 473,
"Uptempo": 443,
"Alpha Chill": 153,
"Classical Piano": 393,
"Acoustical": 8,
"Cin... | mit | Python |
e0fa60394f4a76835bacc147cbd9d1ae6320e608 | Fix typo in docstring | Ge0/chattymarkov | chattymarkov/database/memory.py | chattymarkov/database/memory.py | """Memory database class for chattimarkov.
This is just a volatile, in-memory database which is built either from a
pre-existing dictionary or from scratch. Upon object destruction, the database
is not saved.
"""
import random
from .base import AbstractDatabase
class MemoryDatabase(AbstractDatabase):
def __ini... | """emory database class for chattimarkov.
This is just a volatile, in-memory database which is built either from a
pre-existing dictionary or from scratch. Upon object destruction, the database
is not saved.
"""
import random
from .base import AbstractDatabase
class MemoryDatabase(AbstractDatabase):
def __init... | mit | Python |
7a1168ed94c69780db0911d21a5fa4af55c4e6f7 | Set version number to 1.0.0. Ooooh... | shaurz/devo | app_info.py | app_info.py | # coding=UTF8
name = "Devo"
version = (1, 0, 0)
version_string = ".".join(str(x) for x in version)
identifier = "com.iogopro.devo"
copyright = u"Copyright © 2010-2012 Luke McCarthy"
developer = "Developed by Luke McCarthy <luke@iogopro.co.uk>"
company_name = "Iogopro Software"
url = "http://iogopro.com/devo"
| # coding=UTF8
name = "Devo"
version = (0, 1)
version_string = ".".join(str(x) for x in version)
identifier = "com.iogopro.devo"
copyright = u"Copyright © 2010-2012 Luke McCarthy"
developer = "Developed by Luke McCarthy <luke@iogopro.co.uk>"
company_name = "Iogopro Software"
url = "http://iogopro.com/devo"
| mit | Python |
179a61bf9a00b3002ab498ace982eb8adaf374d5 | Fix flake8 warnings in invalidtxrequest | DigitalPandacoin/pandacoin,peercoin/peercoin,peercoin/peercoin,peercoin/peercoin,peercoin/peercoin,DigitalPandacoin/pandacoin,DigitalPandacoin/pandacoin,DigitalPandacoin/pandacoin,DigitalPandacoin/pandacoin,peercoin/peercoin,peercoin/peercoin,DigitalPandacoin/pandacoin | test/functional/p2p_invalid_tx.py | test/functional/p2p_invalid_tx.py | #!/usr/bin/env python3
# Copyright (c) 2015-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test node responses to invalid transactions.
In this test we connect to one node over p2p, and test tx... | #!/usr/bin/env python3
# Copyright (c) 2015-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test node responses to invalid transactions.
In this test we connect to one node over p2p, and test tx... | mit | Python |
6abf89748ccf92b24c1b3021f742a15fbb1f4e5e | Increment version. | vmlaker/coils | coils/__init__.py | coils/__init__.py | __version__ = '1.1.0'
from .Averager import Averager
from .Config import Config
from .MapSock import MapSockServer, MapSockClient, MapSockRequest
from .RateTicker import RateTicker
from .Ring import Ring
from .SocketTalk import SocketTalk
from .SortedList import SortedList
from .String import string2time, time2string, ... | __version__ = '1.0.9'
from .Averager import Averager
from .Config import Config
from .MapSock import MapSockServer, MapSockClient, MapSockRequest
from .RateTicker import RateTicker
from .Ring import Ring
from .SocketTalk import SocketTalk
from .SortedList import SortedList
from .String import string2time, time2string, ... | mit | Python |
0a6de07aaea89e04b9e7d2a71b627d0c7d24ba8e | Add more convenient widget to site admin form | c4all/c4all,c4all/c4all,c4all/c4all | comments/admin.py | comments/admin.py | from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from .models import CustomUser, Site, Thread, Comment
from .forms import CustomUserChangeForm, CustomUserCreationForm, SiteForm
class CustomUserAdmin(UserAdmin):
# Set the add/modify forms
add_form = CustomUserCreationForm
f... | from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from .models import CustomUser, Site, Thread, Comment
from .forms import CustomUserChangeForm, CustomUserCreationForm, SiteForm
class CustomUserAdmin(UserAdmin):
# Set the add/modify forms
add_form = CustomUserCreationForm
f... | mit | Python |
4d40f6db810266ab4a04325e5be11874b3d1960c | use encoder only for dtype, supported int64 and float64 | zgbjgg/jun,zgbjgg/jun,zgbjgg/jun | priv/jun_dataframe.py | priv/jun_dataframe.py | import pandas as pd
import numpy as np
from erlport.erlterms import Atom
from erlport.erlang import set_encoder
def setup_dtype():
set_encoder(dtype_encoder)
return Atom("ok")
def dtype_encoder(value):
if isinstance(value, np.int64):
return np.asscalar(value)
elif isinstance(value, np.float64)... | import pandas
import numpy
from erlport.erlterms import Atom
from erlport.erlang import set_encoder, set_decoder
def setup_dict_type():
set_decoder(dict_decoder)
set_encoder(dict_encoder)
return Atom("ok")
def dict_encoder(value):
if isinstance(value, pandas.core.frame.DataFrame):
dt = value.t... | mit | Python |
a403c88ecd3fe604e5978d1d995d9839e4f51dc7 | fix artwork population. | MikeiLL/appension,Rosuav/appension,Rosuav/appension,Rosuav/appension,MikeiLL/appension,MikeiLL/appension,Rosuav/appension,MikeiLL/appension | id3info.py | id3info.py | '''
Extract MP3 metadata from MP3 file ID3 tags
'''
usage = '''
python id3info.py
'''
from mutagen.mp3 import MP3
import glob
import time
import psycopg2
def dbactions(track, cur):
pic=next((k for k in track if k.startswith("APIC:")), None)
pic = pic and track[pic].data
print("length of pic: {}".format(len(pic)))... | '''
Extract MP3 metadata from MP3 file ID3 tags
'''
usage = '''
python id3info.py
'''
from mutagen.mp3 import MP3
import glob
import time
import psycopg2
def dbactions(track, cur):
pic=next((k for k in track if k.startswith("APIC:")), None)
pic = pic and track[pic].data
print("length of pic: {}".format(len(pic)))... | artistic-2.0 | Python |
0fc8bb5e4b59c1431ab24b43aa7d6a6c3c76b45e | Add more tests of the new round() | mitocw/edx-platform,appsembler/edx-platform,msegado/edx-platform,EDUlib/edx-platform,EDUlib/edx-platform,EDUlib/edx-platform,eduNEXT/edunext-platform,eduNEXT/edx-platform,msegado/edx-platform,angelapper/edx-platform,appsembler/edx-platform,arbrandes/edx-platform,mitocw/edx-platform,msegado/edx-platform,edx-solutions/ed... | openedx/core/lib/tests/test_grade_utils.py | openedx/core/lib/tests/test_grade_utils.py | """
Tests for graph traversal generator functions.
"""
from __future__ import absolute_import
from unittest import TestCase
import ddt
from ..grade_utils import compare_scores, round_away_from_zero
@ddt.ddt
class TestGradeUtils(TestCase):
""" Tests for the grade_utils module. """
@ddt.data(
(1, 2, ... | """
Tests for graph traversal generator functions.
"""
from __future__ import absolute_import
from unittest import TestCase
import ddt
from ..grade_utils import compare_scores, round_away_from_zero
@ddt.ddt
class TestGradeUtils(TestCase):
""" Tests for the grade_utils module. """
@ddt.data(
(1, 2, ... | agpl-3.0 | Python |
cd2ac2a62d78da8fa7e5e05281977d7f96b841a2 | Clarify mail body parameter name. | trombonehero/nerf-herder,trombonehero/nerf-herder,trombonehero/nerf-herder | mail.py | mail.py | # Copyright 2013, 2017 Jonathan Anderson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaim... | # Copyright 2013, 2017 Jonathan Anderson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaim... | bsd-2-clause | Python |
68bf6d7f589a772b7b9a3ec51fc237825b584943 | Fix formatting | parkrrr/skybot,rmmh/skybot | plugins/wolframalpha.py | plugins/wolframalpha.py | from __future__ import unicode_literals
from builtins import chr
import re
import urllib.parse
from util import hook, http
@hook.api_key("wolframalpha")
@hook.command("what")
@hook.command
def ask(inp, say=None, nick=None, api_key=None):
".ask <query> -- ask wolfram a question, get an answer"
if not inp:
... | from __future__ import unicode_literals
from builtins import chr
import re
import urllib.parse
from util import hook, http
@hook.api_key("wolframalpha")
@hook.command("what")
@hook.command
def ask(inp, msg=None, nick=None, api_key=None):
".ask <query> -- ask wolfram a question, get an answer"
if not inp:
... | unlicense | Python |
0858060ac13c4581c3d13a4ee1a6b62636fb9076 | Print sheet name. Change first_non_header_row | beepscore/excely,beepscore/excely | excely/excely.py | excely/excely.py | #!/usr/bin/env python
import sys, os
# read
from openpyxl import load_workbook
# write
from openpyxl import Workbook
from openpyxl.compat import range
from openpyxl.cell import get_column_letter
#sys.path.append(os.path.abspath(os.path.join('..', 'excely')))
#from excely import blah
# http://stackoverflow.com/ques... | #!/usr/bin/env python
import sys, os
# read
from openpyxl import load_workbook
# write
from openpyxl import Workbook
from openpyxl.compat import range
from openpyxl.cell import get_column_letter
#sys.path.append(os.path.abspath(os.path.join('..', 'excely')))
#from excely import blah
# http://stackoverflow.com/ques... | mit | Python |
d4f5163e433f873c48b9a541bfa1afcf5bee59c4 | Fix size argument to np.zeros | stgl/scarplet,rmsare/scarplet | dem.py | dem.py | """ Classes for loading digital elevation models as numeric grids """
import os, sys
import numpy as np
from osgeo import gdal, gdal_const
class CalculationMixin(object):
def _caclulate_slope(self):
PAD_DX = 2
PAD_DY = 2
z_pad = self._pad_boundary(PAD_DX, PAD_DY)
slope_x = (z_pad[... | """ Classes for loading digital elevation models as numeric grids """
import os, sys
import numpy as np
from osgeo import gdal, gdal_const
class CalculationMixin(object):
def _caclulate_slope(self):
PAD_DX = 2
PAD_DY = 2
z_pad = self._pad_boundary(PAD_DX, PAD_DY)
slope_x = (z_pad[... | mit | Python |
25b0d4d67b71d977d711c404a65b62d6aa01c8f7 | increase timeout on non-native | kaspar030/RIOT,x3ro/RIOT,kaspar030/RIOT,RIOT-OS/RIOT,authmillenon/RIOT,toonst/RIOT,OlegHahm/RIOT,smlng/RIOT,OTAkeys/RIOT,yogo1212/RIOT,cladmi/RIOT,OlegHahm/RIOT,authmillenon/RIOT,rfuentess/RIOT,OlegHahm/RIOT,RIOT-OS/RIOT,x3ro/RIOT,ant9000/RIOT,basilfx/RIOT,aeneby/RIOT,OlegHahm/RIOT,toonst/RIOT,smlng/RIOT,mtausig/RIOT,x... | tests/pkg_c25519/tests/01-run.py | tests/pkg_c25519/tests/01-run.py | #!/usr/bin/env python3
# Copyright (C) 2016 Kaspar Schleiser <kaspar@schleiser.de>
# Copyright (C) 2016 Takuo Yonezawa <Yonezawa-T2@mail.dnp.co.jp>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
... | #!/usr/bin/env python3
# Copyright (C) 2016 Kaspar Schleiser <kaspar@schleiser.de>
# Copyright (C) 2016 Takuo Yonezawa <Yonezawa-T2@mail.dnp.co.jp>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
... | lgpl-2.1 | Python |
e5abf8272df326c332ef34005c3b67b84f3e60c2 | add insert() and pass test | jefimenko/data-structures | dll.py | dll.py | class ListItem(object):
def __init__(self, data, next=None, prev=None):
self.data = data
self.next = next
self.prev = prev
class DoublyLinkedList(object):
def __init__(self):
self.head = None
self.tail = None
def insert(self, val):
if self.head == None:
... | class ListItem(object):
def __init__(self, data, next=None, prev=None):
self.data = data
self.next = next
self.prev = prev
class DoublyLinkedList(object):
def __init__(self):
self.head = None
self.tail = None
| mit | Python |
5d118c5b1243275245f27f758366b87ebc7cab10 | Apply PEP8 to factory.py | johnraz/faker,GLMeece/faker,beetleman/faker,joke2k/faker,thedrow/faker,xfxf/faker-python,joke2k/faker,venmo/faker,MaryanMorel/faker,jaredculp/faker,danhuss/faker,yiliaofan/faker,ericchaves/faker,HAYASAKA-Ryosuke/faker,trtd/faker,xfxf/faker-1,meganlkm/faker | faker/factory.py | faker/factory.py | # coding=utf-8
from __future__ import unicode_literals
from __future__ import absolute_import
import locale as pylocale
import sys
from faker import DEFAULT_LOCALE, DEFAULT_PROVIDERS, AVAILABLE_LOCALES
from faker import Generator
from faker import providers as providers_mod
class Factory(object):
@classmethod... | # coding=utf-8
from __future__ import unicode_literals
from __future__ import absolute_import
import locale as pylocale
import sys
from faker import DEFAULT_LOCALE, DEFAULT_PROVIDERS, AVAILABLE_LOCALES
from faker import Generator
from faker import providers as providers_mod
class Factory(object):
@classmethod
... | mit | Python |
9557ba87a2b609cbb47cd52472bab9fff87a1037 | Fix wrong import | mchelem/cref2,mchelem/cref2,mchelem/cref2 | tests/sequence/test_alignment.py | tests/sequence/test_alignment.py | import unittest
from unittest import mock
from io import StringIO
from cref.sequence.alignment import Blast
class AlignmentTestCase(unittest.TestCase):
def test_blast_local(self):
blast = Blast('tests/blastdb/pdbseqres')
results = blast.align('AASSF')
pdbs = {result.pdb_code for result in... | import unittest
import mock
from io import StringIO
from cref.sequence.alignment import Blast
class AlignmentTestCase(unittest.TestCase):
def test_blast_local(self):
blast = Blast('tests/blastdb/pdbseqres')
results = blast.align('AASSF')
pdbs = {result.pdb_code for result in results}
... | mit | Python |
45fcd3f56c1b40e1ff06ac2fc102220f93e255dc | add b58decode | p1tt/A2MX,p1tt/A2MX | ecc.py | ecc.py | import pyelliptic
import hashlib
b58chars = b'123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
class ECC(pyelliptic.ECC):
def __init__(self, pubkey=None, privkey=None, pubkey_x=None, pubkey_y=None):
pyelliptic.ECC.__init__(self, curve='secp521r1', pubkey=pubkey, privkey=privkey, pubkey_x=pubkey_x, pubke... | import pyelliptic
import hashlib
class ECC(pyelliptic.ECC):
def __init__(self, pubkey=None, privkey=None, pubkey_x=None, pubkey_y=None):
pyelliptic.ECC.__init__(self, curve='secp521r1', pubkey=pubkey, privkey=privkey, pubkey_x=pubkey_x, pubkey_y=pubkey_y)
def pubkey_c(self):
x, ybit = self.point_compress(self.p... | agpl-3.0 | Python |
8d2541fd16b6480fa0f21cdb0dcd9f2a25405d5e | Bump to 0.3.2 | DataCanvasIO/screwjack,DataCanvasIO/screwjack | screwjack/__init__.py | screwjack/__init__.py |
__version__ = "0.3.2"
|
__version__ = "0.3.1"
| bsd-3-clause | Python |
ebb9bac6802136486edcf5558ea9d8cb00b9a924 | Update stack.py | mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-interview,mre/the-coding-inter... | problems/stack/stack.py | problems/stack/stack.py | """
This is a simple implementation of the Stack data structure
Use it as you please ^_^
"""
class Stack():
"""
Simple LIFO Stack data structure
"""
def __init__(self):
"""Constructor declaring the private variable"""
self._items = []
def is_empty(self):
"""Check the e... | """
This is a simple implementation of the Stack data structure
Use it as you please ^_^
"""
class Stack():
"""
Simple LIFO Stack data structure
"""
def __init__(self):
"""Constructor declaring the private variable"""
self._items = []
def is_empty(self):
"""Check the e... | mit | Python |
84d0331f0f390cb1e776277231d21aa381d04a9e | Add `url_to_human` and `human_to_url` Jinja filters | ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public,ministryofjustice/cla_public | cla_public/apps/base/filters.py | cla_public/apps/base/filters.py | # -*- coding: utf-8 -*-
"Jinja custom filters"
import re
from cla_public.apps.base import base
from babel.dates import format_datetime
@base.app_template_filter()
def datetime(dt, format='medium', locale='en_GB'):
if format == 'full':
format = "EEEE, d MMMM y 'at' HH:mm"
elif format == 'medium':
... | # -*- coding: utf-8 -*-
"Datetime formatting jinja filter"
from cla_public.apps.base import base
from babel.dates import format_datetime
@base.app_template_filter()
def datetime(dt, format='medium', locale='en_GB'):
if format == 'full':
format = "EEEE, d MMMM y 'at' HH:mm"
elif format == 'medium':
... | mit | Python |
3183efd6b718c13f3437027bfb085978fcf60e47 | remove import from settings_local_staging - fix build | AllanNozomu/tecsaladeaula,AllanNozomu/tecsaladeaula,AllanNozomu/tecsaladeaula,mupi/tecsaladeaula,AllanNozomu/tecsaladeaula,mupi/tecsaladeaula,mupi/tecsaladeaula,mupi/tecsaladeaula | timtec/settings_local_staging.py | timtec/settings_local_staging.py | # -*- coding: utf-8 -*-
# configurations for the staging server
# https://docs.djangoproject.com/en/dev/ref/settings/
DEBUG = False
TEMPLATE_DEBUG = DEBUG
TIMTEC_THEME = 'timtec'
SITE_ID = 1
ALLOWED_HOSTS = [
'timtec-staging.hacklab.com.br',
'.timtec.com.br',
]
DATABASES = {
'default': {
'ENGINE... | # -*- coding: utf-8 -*-
# configurations for the staging server
# https://docs.djangoproject.com/en/dev/ref/settings/
DEBUG = False
TEMPLATE_DEBUG = DEBUG
TIMTEC_THEME = 'timtec'
SITE_ID = 1
ALLOWED_HOSTS = [
'timtec-staging.hacklab.com.br',
'.timtec.com.br',
]
DATABASES = {
'default': {
'ENGINE... | agpl-3.0 | Python |
dac8472b8d4f2b5419629c29b3a0c132e44bdc86 | add several unit tests for GraphiteEncoder | zillow/aiographite | tests/test_graphite_encoder.py | tests/test_graphite_encoder.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import pytest
from aiographite.graphite_encoder import GraphiteEncoder
@pytest.mark.parametrize("name", [
'abc_edf',
'abc @edf#',
'abc.@edf#',
'abc_ @ e_df#',
'a.b.c_ @ e_df#',
'a.b.___c d _feg',
'_ . .fda',
'_.',
'汉 字.汉*字',
'%2D%2Ea b... | #!/usr/bin/python
# -*- coding: utf-8 -*-
import pytest
from aiographite.graphite_encoder import GraphiteEncoder
@pytest.mark.parametrize("name", [
'abc_edf',
'abc @edf#',
'abc.@edf#',
'abc_ @ e_df#',
'a.b.c_ @ e_df#',
'a.b.___c d _feg',
'_ . .fda',
'_.',
'汉 字.汉*字'
])
def test_con... | mit | Python |
2f0fb712907fde352216258cdaf974518d2ce758 | remove unneccessary function | gasvaktin/gasvaktin-cron,gasvaktin/gasvaktin-cron | slack_msg.py | slack_msg.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import argparse
import updater_utils
CONFIG = updater_utils.load_config('gasvaktin.config')
if __name__ == '__main__':
parser = argparse.ArgumentParser()
help_txt = 'The text to send to Slack.'
parser.add_argument('text', action='store', type=str, help=help_txt)
... | #!/usr/bin/python
# -*- coding: utf-8 -*-
import argparse
import updater_utils
CONFIG = updater_utils.load_config('gasvaktin.config')
def main():
parser = argparse.ArgumentParser()
help_txt = 'The text to send to Slack.'
parser.add_argument('text', action='store', type=str, help=help_txt)
arguments ... | mit | Python |
12867ceb3eac36ebe255ffc0ec5e19b104902a35 | improve admin interface for zip codes | philipkimmey/django-geo | django_geo/admin.py | django_geo/admin.py | from django.contrib import admin
from models import ZipCode
class ZipCodeAdmin(admin.ModelAdmin):
list_display = ('zip_code', 'latitude', 'longitude', 'state', 'city')
list_filter = ('state',)
search_fields = ('zip_code', 'state', 'city')
admin.site.register(ZipCode, ZipCodeAdmin)
| from django.contrib import admin
from models import ZipCode
admin.site.register(ZipCode)
| mit | Python |
45b0f282c6d0d10603983d9fb9adc06ed208ce98 | Add GSM class | ericmdev/gsm | gsm.py | gsm.py | import sys
from os import path
from subprocess import call
import json
from pprint import pprint
" Terminal Colors "
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'... | mit | Python | |
2fd70c1f094eecea33f26dc1dd03f7f3ef41ba66 | rename img preprocessing method | anarchih/MCML_HW2 | main.py | main.py | from os import listdir
import numpy as np
from PIL import Image
from sklearn.svm import SVC
# from sklearn.metrics import precision_score, recall_score
class ImageItem(object):
def __init__(self):
pass
def method_1(im):
# rgb to grey
new_im = im.convert("L")
# downsize
new_size = (int(ne... | from os import listdir
import numpy as np
from PIL import Image
from sklearn.svm import SVC
# from sklearn.metrics import precision_score, recall_score
class ImageItem(object):
def __init__(self):
pass
def test(im):
# rgb to grey
new_im = im.convert("L")
# downsize
new_size = (int(new_im... | mit | Python |
7e26f2b1c6278275e9188b40b88782297af22f48 | initialize function | fpsluozi/CSE5525HW2 | main.py | main.py | # CSE5525 NLP Homework 2 Group 1
import nltk
from nltk.corpus import treebank
full_training_set = nltk.corpus.treebank.tagged_sents()[0:3500]
training_set1 = full_training_set[0:1750]
training_set2 = full_training_set[1750:]
test_set = nltk.corpus.treebank.tagged_sents()[3500:]
print full_training_set
dict_words = {... | # CSE5525 NLP Homework 2 Group 1
import nltk
from nltk.corpus import treebank
full_training_set = nltk.corpus.treebank.tagged_sents()[0:3500]
training_set1 = full_training_set[0:1750]
training_set2 = full_training_set[1750:]
test_set = nltk.corpus.treebank.tagged_sents()[3500:]
print full_training_set | mit | Python |
544f8312869e94c2bcb49f2630cac2e218312082 | Write tests for puplation script | trimailov/finance,trimailov/finance,trimailov/finance | finance/tests.py | finance/tests.py | from django.contrib.auth.models import User
from django.core.management import call_command
from django.core.urlresolvers import reverse
from django.test import Client
from django.test import TestCase
from accounts.factories import UserFactory
from books.models import Transaction
class HomePageTests(TestCase):
d... | from django.core.urlresolvers import reverse
from django.test import Client
from django.test import TestCase
from accounts.factories import UserFactory
class HomePageTests(TestCase):
def setUp(self):
self.user = UserFactory()
def test_home_not_logged_in(self):
c = Client()
response =... | mit | Python |
df47ff426b73745da5a64512c99ed1a3712e3f24 | revert self | rchui/Eunomia | main.py | main.py | from src.Utilities import Utilities
from src.Autoencoder import InputLayer
from src.Autoencoder import HiddenLayer
inputArray = Utilities.readData()
iLayer = InputLayer(len(inputArray[1]))
iLayer.printLayerShape()
hidden1 = HiddenLayer(100, iLayer.input)
hidden1.printLayerShape()
hidden2 = HiddenLayer(50, hidden1.z2)... | from src.Utilities import Utilities
from src.Autoencoder import InputLayer
from src.Autoencoder import HiddenLayer
inputArray = Utilities.readData()
iLayer = InputLayer(len(inputArray[1]))
iLayer.printLayerShape()
hidden1 = HiddenLayer(100, iLayer.self.input)
hidden1.printLayerShape()
hidden2 = HiddenLayer(50, hidden... | apache-2.0 | Python |
fe071ba9ff07b5c60ebec2fe45518c082a2cfde9 | Fix admin panel for Flag model | caffeinehit/django-flaggit | flaggit/admin.py | flaggit/admin.py | from django.contrib import admin
from flaggit.models import Flag, FlagInstance, CONTENT_APPROVED, \
CONTENT_REJECTED
from datetime import datetime
class FlagAdmin(admin.ModelAdmin):
list_filter = ('status',)
list_display = ('status', 'created',
'reviewer', 'reviewed', 'num_flags')
actions ... | from django.contrib import admin
from flaggit.models import Flag, FlagInstance, CONTENT_APPROVED, \
CONTENT_REJECTED
from datetime import datetime
class FlagAdmin(admin.ModelAdmin):
list_filter = ('status',)
list_display = ('status', 'link', 'created',
'reviewer', 'reviewed', 'num_flags')
... | mit | Python |
2bcbc469476ed940b432986935e52b13b07b00ea | Add query tests | trevor/calendarserver,trevor/calendarserver,trevor/calendarserver | twext/who/test/test_aggregate.py | twext/who/test/test_aggregate.py | ##
# Copyright (c) 2013 Apple 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 by applicable law or... | ##
# Copyright (c) 2013 Apple 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 by applicable law or... | apache-2.0 | Python |
c613c9463597f91de41b48633b229d89284d0d8e | fix rdm visualization | njchiang/task-fmri-utils,njchiang/task-fmri-utils,njchiang/task-fmri-utils | fmri_core/vis.py | fmri_core/vis.py | # TODO : populate after development is done
from nilearn import plotting as nplt
from .utils import unmask_img
from numpy import allclose
from scipy.spatial.distance import squareform
from scipy.stats import rankdata
from matplotlib.pyplot import colorbar, imshow
from sklearn.preprocessing import minmax_scale
def plot... | # TODO : populate after development is done
from nilearn import plotting as nplt
from .utils import unmask_img
from numpy import allclose
from scipy.spatial.distance import squareform
from scipy.stats import rankdata
from matplotlib.pyplot import colorbar, imshow
from sklearn.preprocessing import minmax_scale
def plot... | mit | Python |
dfd20ffc14d1d82e3aea81ea2b076109b2b53ab0 | print description, and pressure from API | Upper-Polo/weather-app | lib.py | lib.py | # weather-app
# lib.py
# Classes and functions for weather-app.
# Function definitions.
# ---------------------
# Prompt for user input. Accepts a prompt message we want to show.
def prompt(msg):
return input(msg)
def print_data(data_in):
print("Date: {}".format(data_in['dt']))
print("Description: {}".fo... | # weather-app
# lib.py
# Classes and functions for weather-app.
# Function definitions.
# ---------------------
# Prompt for user input. Accepts a prompt message we want to show.
def prompt(msg):
return input(msg)
def print_data(data_in):
print("Temp: {}".format(data_in["main"]["temp"]))
#print("Sky: {}... | mit | Python |
9120b84bfd3a76f0df35a3be12ad25e1bec8a3ec | Exit on failed login | jzf2101/release,datamicroscopes/release,jzf2101/release,datamicroscopes/release | build.py | build.py | #!/usr/bin/env python
import sys
import os
import socket
from argparse import ArgumentParser
from subprocess import check_call, check_output
from binstar_client.utils import get_config, get_binstar, store_token
def ensure_tool(name):
check_call(['which', name])
def build_and_publish(path, username):
binfi... | #!/usr/bin/env python
import sys
import os
import socket
from argparse import ArgumentParser
from subprocess import check_call, check_output
from binstar_client.utils import get_config, get_binstar, store_token
def ensure_tool(name):
check_call(['which', name])
def build_and_publish(path, username):
binfile... | bsd-3-clause | Python |
aee4e433c2dfc1b2fecabb5b1c4df375b118668e | return JSON with phone number and list of media urls | smcoll/photobomb,code-for-nashville/photobomb | run.py | run.py | import logging
import json
from flask import Flask, request
app = Flask(__name__)
logger = logging.getLogger(__name__)
MYSTORE = []
@app.route("/", methods=['GET', 'POST'])
def hello():
if request.method == 'POST':
num_media = int(request.values.get('NumMedia', 0))
data = {
'phone_n... | import datetime
import logging
import json
from flask import Flask, request
app = Flask(__name__)
logger = logging.getLogger(__name__)
MYSTORE = []
@app.route("/", methods=['GET', 'POST'])
def hello():
msg = 'Request keys: {}'.format(u', '.join(list(request.values.keys())))
if request.method == 'POST':
... | mit | Python |
ee36709f119a9657cc1d266d28bd2ee6a3c4d952 | support running behind proxy | hsmade/triangulator,hsmade/triangulator,hsmade/triangulator | run.py | run.py | #!python
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from app import app, db, models
from hashlib import md5
import sys
import os
def upgrade():
api.upgrade(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
v = api.db_version(SQLALCHE... | #!python
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from app import app, db, models
from hashlib import md5
import sys
import os
def upgrade():
api.upgrade(SQLALCHEMY_DATABASE_URI, SQLALCHEMY_MIGRATE_REPO)
v = api.db_version(SQLALCHE... | apache-2.0 | Python |
bbdd5de2e6ec59afafd6f2e78d31cb80df1df109 | Reduce regularization strength | wiseodd/hipsternet,wiseodd/hipsternet | run.py | run.py | import numpy as np
import hipsternet.input_data as input_data
from hipsternet.solver import *
from hipsternet.neuralnet import NeuralNet
n_iter = 5000
alpha = 1e-3
mb_size = 100
n_experiment = 1
reg = 1e-5
print_after = 100
p_dropout = 0.8
loss = 'cross_ent'
nonlin = 'relu'
solver = 'adam'
def prepro(X_train, X_val... | import numpy as np
import hipsternet.input_data as input_data
from hipsternet.solver import *
from hipsternet.neuralnet import NeuralNet
n_iter = 1000
alpha = 1e-3
mb_size = 100
n_experiment = 1
reg = 1e-3
print_after = 100
p_dropout = 0.8
loss = 'cross_ent'
nonlin = 'relu'
solver = 'adam'
def prepro(X_train, X_val... | unlicense | Python |
7e2f2ba630ee8369c432792b74ba9fd560078241 | Update run.py | NekodRider/test-site,NekodRider/test-site,NekodRider/test-site | run.py | run.py | #!flask/bin/python
from app import app
app.run(host='0.0.0.0',debug = True,port = '80')
| #!flask/bin/python
from app import app
app.run(host='0.0.0.0',debug = True) | mit | Python |
be365bd89bee1b6dadb48d92357f32bc2b0fd57d | make cert and key locations a config option | rpanah/centinel-server,iclab/centinel-server,ben-jones/centinel-server,iclab/centinel-server,lianke123321/centinel-server,rpanah/centinel-server,lianke123321/centinel-server,lianke123321/centinel-server,ben-jones/centinel-server,ben-jones/centinel-server,rpanah/centinel-server,iclab/centinel-server | run.py | run.py | import centinel
import centinel.models
import centinel.views
import config
import os
if __name__ == "__main__":
db = centinel.db
app = centinel.app
sql_dir = os.path.dirname(config.sqlite_db)
if not os.path.exists(sql_dir):
os.makedirs(sql_dir)
if not os.path.exists(config.sqlite_db):
... | import centinel
import centinel.models
import centinel.views
import config
import os
if __name__ == "__main__":
db = centinel.db
app = centinel.app
sql_dir = os.path.dirname(config.sqlite_db)
if not os.path.exists(sql_dir):
os.makedirs(sql_dir)
if not os.path.exists(config.sqlite_db):
... | mit | Python |
d9e16513ccd2cd867d792e3dc7f43f6ed87c677d | Update tea times - from the Master | john-pettigrew/tea_timer_cli | tea_timer.py | tea_timer.py | #!/usr/bin/env python3
# A quick app to help brew tea
import argparse
import sys
import time
import curses
import shutil
parser = argparse.ArgumentParser()
parser.add_argument("action", help="The action you want to take", type=str, choices=["instruct", "brew"])
parser.add_argument("-t", "--type", help="The type of t... | #!/usr/bin/env python3
# A quick app to help brew tea
import argparse
import sys
import time
import curses
import shutil
parser = argparse.ArgumentParser()
parser.add_argument("action", help="The action you want to take", type=str, choices=["instruct", "brew"])
parser.add_argument("-t", "--type", help="The type of t... | mit | Python |
4036d5169ae52c1792fea9d7a250b4ff4a3d55d2 | fix typo | glatard/nipype,pearsonlab/nipype,FCP-INDI/nipype,blakedewey/nipype,pearsonlab/nipype,wanderine/nipype,glatard/nipype,mick-d/nipype,dgellis90/nipype,carolFrohlich/nipype,arokem/nipype,blakedewey/nipype,glatard/nipype,blakedewey/nipype,grlee77/nipype,mick-d/nipype,FCP-INDI/nipype,dgellis90/nipype,JohnGriffiths/nipype,pea... | nipype/algorithms/tests/test_mesh_ops.py | nipype/algorithms/tests/test_mesh_ops.py | # coding: utf-8
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import os
from shutil import rmtree
from tempfile import mkdtemp
from nipype.testing import (assert_equal, assert_raises,
assert_almost_equal, example_data)
im... | # coding: utf-8
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import os
from shutil import rmtree
from tempfile import mkdtemp
from nipype.testing import (assert_equal, assert_raises,
assert_almost_equal, example_data)
im... | bsd-3-clause | Python |
52a06155eed6b9b49e90415f80157ce17c029183 | include invocation stack in Task exception | tek/amino | tryp/task.py | tryp/task.py | from typing import Callable, TypeVar, Generic, Any
from tryp import Either, Right, Left, Maybe
from tryp.tc.monad import Monad
from tryp.tc.base import ImplicitInstances, Implicits
from tryp.lazy import lazy
A = TypeVar('A')
B = TypeVar('B')
class TaskInstances(ImplicitInstances):
@lazy
def _instances(self... | from typing import Callable, TypeVar, Generic, Any
from tryp import Either, Right, Left, Maybe
from tryp.tc.monad import Monad
from tryp.tc.base import ImplicitInstances, Implicits
from tryp.lazy import lazy
A = TypeVar('A')
B = TypeVar('B')
class TaskInstances(ImplicitInstances):
@lazy
def _instances(self... | mit | Python |
43d829a7107f5516641dcdf6cbafee5a7b3f9a7b | Drop unneeded extra join | quattor/aquilon,guillaume-philippon/aquilon,quattor/aquilon,quattor/aquilon,guillaume-philippon/aquilon,guillaume-philippon/aquilon | lib/aquilon/worker/commands/search_parameter_definition_feature.py | lib/aquilon/worker/commands/search_parameter_definition_feature.py | # -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2015 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... | # -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2011,2012,2013,2014,2015 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... | apache-2.0 | Python |
65c86d2c09322d28b03bda18ed03d0201f7d5125 | Fix python3 compatibility | gsong/djorm-ext-pgfulltext,pombredanne/djorm-ext-pgfulltext,megahall/djorm-ext-pgfulltext,ministryofjustice/djorm-ext-pgfulltext,asmedeus/djorm-ext-pgfulltext,barseghyanartur/djorm-ext-pgfulltext,linuxlewis/djorm-ext-pgfulltext | djorm_pgfulltext/management/commands/update_search_field.py | djorm_pgfulltext/management/commands/update_search_field.py | """
Update search fields.
"""
from __future__ import print_function
from django.core.management.base import BaseCommand, CommandError
from django.core.exceptions import ImproperlyConfigured
from django.db import models
class Command(BaseCommand):
help = 'Update search fields'
args = "appname [model]"
def... | """
Update search fields.
"""
from django.core.management.base import BaseCommand, CommandError
from django.core.exceptions import ImproperlyConfigured
from django.db import models
class Command(BaseCommand):
help = 'Update search fields'
args = "appname [model]"
def handle(self, app=None, model=None, **... | bsd-3-clause | Python |
644945082a6b712e58d51cac39c3d4898094760b | add debuging certfile | SLAPaper/TRPG_bot | Bot.py | Bot.py | import urllib.request, urllib.parse, json, ssl, select, threading, socket, sys
from http.server import BaseHTTPRequestHandler, HTTPServer
from socketserver import ThreadingMixIn
if len(sys.argv) < 2:
DEBUG = False
else:
DEBUG = True
TOKEN = "119827757:AAFTo0ezhROp-0Ria-zkjkGHfJeHtik8-Ow"
PORT = 8443
WEB_HOOK_HOST ... | import urllib.request, urllib.parse, json, ssl, select, threading, socket, sys
from http.server import BaseHTTPRequestHandler, HTTPServer
from socketserver import ThreadingMixIn
if len(sys.argv) < 2:
DEBUG = False
else:
DEBUG = True
TOKEN = "119827757:AAFTo0ezhROp-0Ria-zkjkGHfJeHtik8-Ow"
PORT = 8443
WEB_HOOK_HOST ... | mit | Python |
0ef79e5d888800d70d2f4680751254df61ab01e6 | Secure dashboard page; add 401 page | alanplotko/CoRE-Manager,alanplotko/CoREdash,alanplotko/CoRE-Manager,alanplotko/CoREdash | app.py | app.py | import os
from flask import Flask, render_template, request, redirect, url_for, session, abort
from flask.ext.session import Session
from pymongo import MongoClient
import logging
import json
tmpl_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates')
app = Flask(__name__)
# MongoDB Setup
client ... | import os
from flask import Flask, render_template, request, redirect, url_for, session
from flask.ext.session import Session
from pymongo import MongoClient
import logging
import json
tmpl_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates')
app = Flask(__name__)
# MongoDB Setup
client = Mongo... | unknown | Python |
ed28828e500a32530324840611713858851ca608 | Add POST support. | duffj/eventbot-web-api,duffj/eventbot-web-api | app.py | app.py | #!/usr/bin/env python
from flask import Flask
import flask
import logging
app = Flask(__name__)
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
@app.route("/")
def hello():
return "Hello World!"
@app.route("/webhook/application_form", methods=['POST', 'GET'])
def web_hook_applica... | #!/usr/bin/env python
from flask import Flask
import flask
import logging
app = Flask(__name__)
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
@app.route("/")
def hello():
return "Hello World!"
@app.route("/webhook/application_form")
def web_hook_application_form():
logger.i... | mit | Python |
c5bb67a121ecf757cef391ab723bad25e9cb4351 | Return response | pranavrc/imojo-webhook | app.py | app.py | #!/usr/bin/env python
from flask import Flask, request, Response, render_template
import twitter
from twitter_keys import consumer_key, consumer_secret, oauth_token, oauth_secret
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def index():
if request.method == 'GET':
return 'OK'
if re... | #!/usr/bin/env python
from flask import Flask, request, Response, render_template
import twitter
from twitter_keys import consumer_key, consumer_secret, oauth_token, oauth_secret
app = Flask(__name__)
@app.route('/')
def index():
if request.method == 'GET':
return 'OK'
if request.method == 'POST':
... | mit | Python |
19ed72a965c6d323a0babd0f0b13096a28c533cd | Update app.py | vug/personalwebapp,vug/personalwebapp | app.py | app.py | from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hi, I am Ugur!"
if __name__ == "__main__":
app.run(host='0.0.0.0', port=8080)
| from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hi, I am Ugur!"
if __name__ == "__main__":
app.run()
| mit | Python |
11ff7cf2bc5bb3fc169e9fa5f6c931f1604827b6 | drop context in 3 minites | ledmonster/nishiki | app.py | app.py | # -*- coding: utf-8 -*-
import datetime
import json
import os
import requests
from flask import Flask, request, abort, jsonify
app = Flask(__name__)
BOT_NAME = os.environ.get('BOT_NAME', 'chat-bot')
API_URL = 'https://api.apigw.smt.docomo.ne.jp/dialogue/v1/dialogue'
API_KEY = os.environ['DOCOMO_API_KEY']
TOKEN = os... | # -*- coding: utf-8 -*-
import json
import os
import requests
from flask import Flask, request, abort, jsonify
app = Flask(__name__)
BOT_NAME = os.environ.get('BOT_NAME', 'chat-bot')
API_URL = 'https://api.apigw.smt.docomo.ne.jp/dialogue/v1/dialogue'
API_KEY = os.environ['DOCOMO_API_KEY']
TOKEN = os.environ['SLACK_... | mit | Python |
56e8d43ba52229ce0eae98a80ac0c1c6f7682377 | Add response code to redirect, to stop browser caching. | DoubleDoorDevelopment/MultiStream | app.py | app.py | # Copyright 2016 Richard Campen
# All rights reserved
# This software is released under the Modified BSD license
# See LICENSE.txt for the full license documentation
"""Flask app for fetching if selected Twitch streams are live, and redirecting to multistre.am for the live streams.
MulstiStream version 1.0b1
========... | # Copyright 2016 Richard Campen
# All rights reserved
# This software is released under the Modified BSD license
# See LICENSE.txt for the full license documentation
"""Flask app for fetching if selected Twitch streams are live, and redirecting to multistre.am for the live streams.
MulstiStream version 1.0b1
========... | bsd-3-clause | Python |
80397df080119b1740b71fded90f6dc587b3c325 | add fib calc | DevOps-with-Kubernetes/my-app,DevOps-with-Kubernetes/my-app | app.py | app.py | import os
import signal
import time
import threading
from http.server import (
BaseHTTPRequestHandler,
HTTPServer
)
def fib(n):
a, b = 0, 1
for _ in range(n):
a, b = b, a + b
return a
class MyMsgHandler(BaseHTTPRequestHandler):
def do_GET(self):
try:
message = st... | import os
import signal
import time
import threading
from http.server import (
BaseHTTPRequestHandler,
HTTPServer
)
class MyMsgHandler(BaseHTTPRequestHandler):
def do_GET(self):
message = "OK"
self.send_response(200)
self.end_headers()
self.wfile.write(message.encode())
... | apache-2.0 | Python |
92423dee1793e3c442b3aab321b88ab5a48aa43b | Add handle message. | drakeet/DrakeetLoveBot | app.py | app.py | # coding: utf-8
from datetime import datetime
from flask import Flask
from flask import render_template, request
import logging
import telegram
# from views.todos import todos_view
app = Flask(__name__)
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(m... | # coding: utf-8
from datetime import datetime
from flask import Flask
from flask import render_template, request
import logging
import telegram
# from views.todos import todos_view
app = Flask(__name__)
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(m... | mit | Python |
69db73a3532bfc690d4cee43490094f38eba74a3 | update help text | Windfarer/bot | bot.py | bot.py | import wxpy
import jinja2
from roll import roll
from weather import get_weather_forecast_msg, get_aqi_msg
bot = wxpy.Bot(console_qr=True, cache_path='/data/wxpy.pkl')
group = bot.groups()
HELP_TEXT = "使用说明:\n" \
"【.r 骰子个数d面数】" \
"如 .r 2d6 即为掷2个6面骰子\n" \
"【.tq 城市】查询天气\n" \
... | import wxpy
import jinja2
from roll import roll
from weather import get_weather_forecast_msg, get_aqi_msg
bot = wxpy.Bot(console_qr=True, cache_path='/data/wxpy.pkl')
group = bot.groups()
HELP_TEXT = "使用说明:\n" \
".r 骰子个数d面数,\n" \
"如「 .r 2d6 」即为掷2个6面的骰子"
def help(msg):
return HELP_TEXT
de... | mit | Python |
8d367ba55f682621d5b3d5f9594ae0ce2661486d | exit and help commands, documentation for currently supported commands | litvinchuck/python-scripts,litvinchuck/python-workout | ftp.py | ftp.py | from ftplib import FTP, error_perm, all_errors
from getpass import getpass
import sys
description = '''
A minimalistic FTP util. A shell for Python ftplib
getwelcome - Return the welcome message sent by the server in reply to the initial connection. (This message sometimes contains disclaimers or help informa... | from ftplib import FTP, error_perm
from getpass import getpass
import sys
print("FTP util\n")
host = input("Enter FTP hostname: ").replace('http://', '').replace('ftp://', '')
user = input("Enter username: ")
password = getpass("Enter password: ")
try:
ftp = FTP(host)
except:
print("Error, Host not found")
... | mit | Python |
bf1ed7a82638592622f31ef415a3328bf5a386b0 | remove reference to O | quintopia/Seriously,quintopia/Seriously,Mego/Seriously,quintopia/Seriously,Sherlock9/Seriously | ide.py | ide.py | from flask import Flask, render_template, url_for, request
from subprocess import Popen, PIPE, check_call
import os, string
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def index():
url_for('static', filename='logo.ico')
if request.method == 'POST':
code = request.form['code']
... | from flask import Flask, render_template, url_for, request
from subprocess import Popen, PIPE, check_call
import os, string
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def index():
url_for('static', filename='logo.ico')
if request.method == 'POST':
code = request.form['code']
... | mit | Python |
008ce4dd82a79edd1d2ff255db1e68e39b51f00a | send sigint to omxplayer on interrupt | caleblloyd/rpi-xmas-lights-music | mp3.py | mp3.py | from config import is_rpi
import time
import pexpect
def player(mp3_file, interface, mp3_ready_event, sigint_event, gpio_queues, stop_events):
process = ["omxplayer"]
if interface:
process.append("-o")
process.append(interface)
process.append('"'+mp3_file+'"')
if is_rpi:
p = p... | from config import is_rpi
import time
import pexpect
def player(mp3_file, interface, mp3_ready_event, sigint_event, gpio_queues, stop_events):
process = ["omxplayer"]
if interface:
process.append("-o")
process.append(interface)
process.append('"'+mp3_file+'"')
if is_rpi:
p = p... | mit | Python |
efc7539407a3fb5dfc103035969c786d7859ac60 | set shebang line | legoktm/pywikipedia-rewrite | pwb.py | pwb.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""wrapper script to use rewrite in 'directory' mode - run scripts using
python pwb.py <name_of_script> <options>
and it will use the package directory to store all user files, will fix up
search paths so the package does not need to be installed, etc.
"""
# (C) Pywikiped... | # -*- coding: utf-8 -*-
"""wrapper script to use rewrite in 'directory' mode - run scripts using
python pwb.py <name_of_script> <options>
and it will use the package directory to store all user files, will fix up
search paths so the package does not need to be installed, etc.
"""
# (C) Pywikipedia team, 2012
#
__vers... | mit | Python |
21b9714bcf04e834298439393cd573000cc8dc5b | reorganize a bit | x89/botologist,anlutro/botologist,moopie/botologist,x89/botologist,x89/ircbot | run.py | run.py | #!/usr/bin/env python3
import os.path
from sys import argv
from ircbot import run_bot
def main():
if len(argv) < 4:
print('Usage: ./run.py <server> <channel> <nick>')
return
cwd = os.path.dirname(os.path.realpath(__file__))
storage_path = os.path.join(cwd, 'storage')
run_bot(
server=argv[1],
port=6667,... | #!/usr/bin/env python3
import os.path
from ircbot import run_bot
if __name__ == '__main__':
cwd = os.path.dirname(os.path.realpath(__file__))
storage_path = os.path.join(cwd, 'storage')
run_bot(
server='irc.quakenet.org',
port=6667,
channel='#rzbot',
nick='rzbot',
storage_path=storage_path
)
| mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.