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 |
|---|---|---|---|---|---|---|---|---|
7a898c48d445744fa8074697f96c1a6b173e5401 | Fix server issue by setting the API worker thread to be a daemon | cyanfish/heltour,cyanfish/heltour,cyanfish/heltour,cyanfish/heltour | heltour/api_worker/worker.py | heltour/api_worker/worker.py | import Queue
import threading
def _run_worker():
while True:
_, fn, args = _work_queue.get()
fn(*args)
_work_queue = Queue.PriorityQueue()
_worker_thread = threading.Thread(target=_run_worker)
_worker_thread.daemon = True
_worker_thread.start()
def queue_work(priority, fn, *args):
_work_queue... | import Queue
import threading
def _run_worker():
while True:
_, fn, args = _work_queue.get()
fn(*args)
_work_queue = Queue.PriorityQueue()
_worker_thread = threading.Thread(target=_run_worker)
_worker_thread.start()
def queue_work(priority, fn, *args):
_work_queue.put((-priority, fn, args))
| mit | Python |
c8ecda58567446e8858ececb701945832bf47658 | refresh cache on update | adityahase/frappe,frappe/frappe,yashodhank/frappe,adityahase/frappe,yashodhank/frappe,mhbu50/frappe,frappe/frappe,almeidapaulopt/frappe,saurabh6790/frappe,adityahase/frappe,yashodhank/frappe,adityahase/frappe,yashodhank/frappe,saurabh6790/frappe,mhbu50/frappe,saurabh6790/frappe,StrellaGroup/frappe,StrellaGroup/frappe,m... | frappe/desk/doctype/list_view_settings/list_view_settings.py | frappe/desk/doctype/list_view_settings/list_view_settings.py | # -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class ListViewSettings(Document):
def on_update(self):
frappe.clear_document_cache(s... | # -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class ListViewSettings(Document):
def on_update(self):
frappe.clear_document_cache(s... | mit | Python |
ca9e888151f0066c2aa49b0ddfd2d5600452fefa | use @io_kythe// instead of @// in bazel build file template (#4711) | kythe/kythe,kythe/kythe,kythe/kythe,kythe/kythe,kythe/kythe,kythe/kythe,kythe/kythe,kythe/kythe,kythe/kythe,kythe/kythe,kythe/kythe | tools/build_rules/external_tools/external_tools_configure.bzl | tools/build_rules/external_tools/external_tools_configure.bzl | """Repository rules for automagically configuring the host toolchain."""
_BUILD_TEMPLATE = """
package(default_visibility=["//visibility:public"])
load("@io_kythe//tools/build_rules/external_tools:external_tools_toolchain.bzl", "external_tools_toolchain")
external_tools_toolchain(
name = "host_toolchain_impl",
a... | """Repository rules for automagically configuring the host toolchain."""
_BUILD_TEMPLATE = """
package(default_visibility=["//visibility:public"])
load("@//tools/build_rules/external_tools:external_tools_toolchain.bzl", "external_tools_toolchain")
external_tools_toolchain(
name = "host_toolchain_impl",
asciidoc ... | apache-2.0 | Python |
652b6de9ef16480b1bb2d451281646593e6f9a1d | Bump version to 0.4.0 | hsd315/pystock-crawler,eliangcs/pystock-crawler | pystock_crawler/__init__.py | pystock_crawler/__init__.py | __version__ = '0.4.0'
| __version__ = '0.3.3'
| mit | Python |
756526acdc904420c1c92dbb593cb8750d88aed3 | fix bug from file renaming | rdeits/cryptics,rdeits/cryptics,rdeits/cryptics,rdeits/cryptics,rdeits/cryptics,rdeits/cryptics,rdeits/cryptics | python/crypticweb/server.py | python/crypticweb/server.py | import web
from web import form
from solve_clue import CrypticClueSolver, split_clue_text
import threading
class index:
def GET(self):
# form = myform()
answers = solver.answers_with_clues
if answers == []:
answers = ["Sorry, I couldn't find any answers"]
elif answers i... | import web
from web import form
from solve_clue import CrypticClueSolver, split_clue_text
import threading
class index:
def GET(self):
# form = myform()
answers = solver.answers_with_clues
if answers == []:
answers = ["Sorry, I couldn't find any answers"]
elif answers i... | mit | Python |
b434a3c3776e98cb19682d9759d40deb58c965af | Update `test_error_bars.py`. | plotly/plotly.py,plotly/python-api,plotly/python-api,plotly/python-api,plotly/plotly.py,plotly/plotly.py | plotly/tests/test_core/test_graph_objs/test_error_bars.py | plotly/tests/test_core/test_graph_objs/test_error_bars.py | """
test_error_bars:
================
A module intended for use with Nose.
"""
from __future__ import absolute_import
from nose.tools import raises
from plotly.graph_objs import ErrorX, ErrorY
from plotly.exceptions import PlotlyDictKeyError
def test_instantiate_error_x():
ErrorX()
ErrorX(array=[1, 2, 3],
... | """
test_error_bars:
================
A module intended for use with Nose.
"""
from __future__ import absolute_import
from nose.tools import raises
from plotly.graph_objs import ErrorX, ErrorY
from plotly.exceptions import PlotlyDictKeyError
def test_instantiate_error_x():
ErrorX()
ErrorX(array=[1, 2, 3],
... | mit | Python |
88773c6757540c9f1d4dfca2a287512e74bdbc24 | Read the defaults config file and merge it with mediawords.yml | berkmancenter/mediacloud,AchyuthIIIT/mediacloud,berkmancenter/mediacloud,AchyuthIIIT/mediacloud,berkmancenter/mediacloud,berkmancenter/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,berkmancenter/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT/mediacloud,AchyuthIIIT... | python_scripts/mc_config.py | python_scripts/mc_config.py | #!/usr/bin/python
import yaml
import os.path
_config_file_base_name = 'mediawords.yml'
_config_file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'mediawords.yml'))
_defaults_config_file_base_name = 'defaults.yml'
_defaults_config_file_name = os.path.abspath(os.path.join(os.path.dirname(__fil... | #!/usr/bin/python
import yaml
import os.path
_config_file_base_name = 'mediawords.yml'
_config_file_name = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'mediawords.yml'))
def read_config():
yml_file = open(_config_file_name, 'rb')
config_file = yaml.load( yml_file )
return config_file
| agpl-3.0 | Python |
b9121524862adba9ae2ce9dc2669d480a20e97e7 | fix MEGNetMolecule | materialsvirtuallab/megnet,materialsvirtuallab/megnet,materialsvirtuallab/megnet,materialsvirtuallab/megnet,materialsvirtuallab/megnet | megnet/utils/molecule.py | megnet/utils/molecule.py | from pymatgen import Molecule
import numpy as np
from pymatgen.io.babel import BabelMolAdaptor
import logging
try:
import pybel as pb
except:
logging.warning("Openbabel is needed for molecule models, try 'conda install -c openbabel openbabel' to install it")
pb = None
class MEGNetMolecule(Molecule):
d... | from pymatgen import Molecule
import numpy as np
from pymatgen.io.babel import BabelMolAdaptor
import logging
try:
import pybel as pb
except:
logging.warning("Openbabel is needed for molecule models, try 'conda install -c openbabel openbabel' to install it")
pb = None
class MEGNetMolecule(Molecule):
d... | bsd-3-clause | Python |
889e754059db81dbbf7e16608f2dce6769028db5 | Remove unused imports in dialogue vumi_app.py | praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go | go/apps/dialogue/vumi_app.py | go/apps/dialogue/vumi_app.py | # -*- test-case-name: go.apps.dialogue.tests.test_vumi_app -*-
import pkg_resources
import json
from vumi.application.sandbox import SandboxResource
from go.apps.jsbox.vumi_app import JsBoxConfig, JsBoxApplication
class PollConfigResource(SandboxResource):
"""Resource that provides access to dialogue conversat... | # -*- test-case-name: go.apps.dialogue.tests.test_vumi_app -*-
import pkg_resources
import json
import logging
from vumi.application.sandbox import SandboxResource
from twisted.internet.defer import inlineCallbacks
from go.apps.jsbox.vumi_app import JsBoxConfig, JsBoxApplication
class PollConfigResource(SandboxRes... | bsd-3-clause | Python |
7c02e31a3c572ade3a466581c292c3b263236b44 | 更新 API ELOs, 新增 version, parent_elo 及 parent_elo_version 資訊 | yrchen/CommonRepo,yrchen/CommonRepo,yrchen/CommonRepo,yrchen/CommonRepo | commonrepo/elos_api/serializers.py | commonrepo/elos_api/serializers.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from rest_framework import serializers
from commonrepo.elos.models import ELO
from commonrepo.users.models import User as User
from .models import ELOFileUpload
class ELOSerializer(serializers.HyperlinkedModelSerializer):
class Met... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from rest_framework import serializers
from commonrepo.elos.models import ELO
from commonrepo.users.models import User as User
from .models import ELOFileUpload
class ELOSerializer(serializers.HyperlinkedModelSerializer):
class Met... | apache-2.0 | Python |
b37778ec904b5053e654b26fabc0e2832546d62c | switch from get_images -> get_data | NSLS-II-XPD/ipython_ophyd,NSLS-II-XPD/ipython_ophyd | profile_collection/startup/99-subtracted-tiff-exporter.py | profile_collection/startup/99-subtracted-tiff-exporter.py | from bluesky.callbacks.broker import LiveTiffExporter
class SubtractedTiffExporter(LiveTiffExporter):
"Intercept images before saving and subtract dark image"
def start(self, doc):
# The metadata refers to the scan uid of the dark scan.
if 'dark_frame' not in doc:
raise ValueError... | from bluesky.callbacks.broker import LiveTiffExporter
class SubtractedTiffExporter(LiveTiffExporter):
"Intercept images before saving and subtract dark image"
def start(self, doc):
# The metadata refers to the scan uid of the dark scan.
if 'dark_frame' not in doc:
raise ValueError... | bsd-2-clause | Python |
ae6d797991c599cc4ffd79f96540b7f85473067d | Update jupyterhub_config.py | luisfdez/oauthenticator,luisfdez/oauthenticator | example/jupyterhub_config.py | example/jupyterhub_config.py | # Configuration file for Jupyter Hub
import os
c = get_config()
c.JupyterHub.log_level = 10
c.JupyterHub.authenticator_class = 'oauthenticator.openshift.OpenShiftOAuthenticator'
c.JupyterHub.spawner_class = 'kubespawner.KubeSpawner'
c.JupyterHub.ip = '0.0.0.0'
c.JupyterHub.hub_ip = '0.0.0.0'
# Don't try to cleanup... | # Configuration file for Jupyter Hub
import os
c = get_config()
c.JupyterHub.log_level = 10
c.JupyterHub.authenticator_class = 'oauthenticator.openshift.OpenShiftOAuthenticator'
c.JupyterHub.spawner_class = 'kubespawner.KubeSpawner'
c.JupyterHub.ip = '0.0.0.0'
c.JupyterHub.hub_ip = '0.0.0.0'
# Don't try to cleanup... | bsd-3-clause | Python |
372d99792d6321eb071dfd0ac1a06f209e8e1615 | remove useless statement in V8; | acsone/margin-analysis,bmya/margin-analysis,Endika/margin-analysis,Antiun/margin-analysis | product_replenishment_cost/models/product_product.py | product_replenishment_cost/models/product_product.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Alexandre Fayolle
# Copyright 2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# p... | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Alexandre Fayolle
# Copyright 2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# p... | agpl-3.0 | Python |
bb76cbfa63b1012652304b24b00ec6c890b696a7 | test gamma with complex-valued inputs | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | tests/cupyx_tests/scipy_tests/special_tests/test_gamma.py | tests/cupyx_tests/scipy_tests/special_tests/test_gamma.py | import unittest
from cupy import testing
import cupyx.scipy.special # NOQA
import numpy
@testing.gpu
@testing.with_requires('scipy')
class TestGamma(unittest.TestCase):
@testing.for_all_dtypes(no_complex=True)
@testing.numpy_cupy_allclose(atol=1e-5, scipy_name='scp')
def test_arange(self, xp, scp, dtyp... | import unittest
from cupy import testing
import cupyx.scipy.special # NOQA
import numpy
@testing.gpu
@testing.with_requires('scipy')
class TestGamma(unittest.TestCase):
@testing.for_all_dtypes(no_complex=True)
@testing.numpy_cupy_allclose(atol=1e-5, scipy_name='scp')
def test_arange(self, xp, scp, dtyp... | mit | Python |
4e3fd2687ad0c36ac569551deb99fa4def323ec2 | update config.guess reusing logic from autotools (#18917) | iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/r-rpostgresql/package.py | var/spack/repos/builtin/packages/r-rpostgresql/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RRpostgresql(RPackage):
"""Database interface and PostgreSQL driver for R This package pro... | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RRpostgresql(RPackage):
"""Database interface and PostgreSQL driver for R This package pro... | lgpl-2.1 | Python |
ca163b91e34b65c719e2dddf7f0a1dc1c155349f | fix small | peastman/deepchem,lilleswing/deepchem,lilleswing/deepchem,deepchem/deepchem,lilleswing/deepchem,peastman/deepchem,deepchem/deepchem | deepchem/feat/molecule_featurizers/pubchem_fingerprint.py | deepchem/feat/molecule_featurizers/pubchem_fingerprint.py | import numpy as np
from deepchem.utils.typing import RDKitMol
from deepchem.feat.base_classes import MolecularFeaturizer
class PubChemFingerpint(MolecularFeaturizer):
"""PubChem Fingerprint.
The PubChem fingerprint is a 881 bit structural key,
which is used by PubChem for similarity searching.
Please confir... | import numpy as np
from deepchem.utils.typing import RDKitMol
from deepchem.feat.base_classes import MolecularFeaturizer
class PubChemFingerpint(MolecularFeaturizer):
"""PubChem Fingerprint.
The PubChem fingerprint is a 881 bit structural key,
which is used by PubChem for similarity searching.
Please confir... | mit | Python |
d3bd14ad3f9a714a73599bcc7153a4b55e4931ec | add default value to reduce | WebArchivCZ/Seeder,WebArchivCZ/Seeder,WebArchivCZ/Seeder,WebArchivCZ/Seeder,WebArchivCZ/Seeder | Seeder/blacklists/models.py | Seeder/blacklists/models.py | import operator
from functools import reduce
from django.db import models
from django.utils.translation import ugettext_lazy as _
from reversion import revisions
@revisions.register
class Blacklist(models.Model):
"""
General model for control lists
There are two types of blacklists
- blacklist that ... | import operator
from functools import reduce
from django.db import models
from django.utils.translation import ugettext_lazy as _
from reversion import revisions
@revisions.register
class Blacklist(models.Model):
"""
General model for control lists
There are two types of blacklists
- blacklist that ... | mit | Python |
34c68deb89deb082052c566887bc320548ce0204 | change annotation reference to global file | YeoLab/gscripts,YeoLab/gscripts,YeoLab/gscripts,YeoLab/gscripts | gscripts/rnaseq/count_bam.py | gscripts/rnaseq/count_bam.py | from glob import glob
from gscripts.qtools._Submitter import Submitter
import sys
orientation = sys.argv[1]
species = sys.argv[2]
try:
name = sys.argv[3]+"_count_bam"
except IndexError:
name = 'count_bam'
if species == 'hg19':
annot_file = '/projects/ps-yeolab/genomes/hg19/gencode_v17/gencode.v17.annotation.... | from glob import glob
from gscripts.qtools._Submitter import Submitter
import sys
orientation = sys.argv[1]
species = sys.argv[2]
try:
name = sys.argv[3]+"_count_bam"
except IndexError:
name = 'count_bam'
if species == 'hg19':
annot_file = '/home/gpratt/gencode.v17.exons.bed'
elif species == 'mm9':
annot_fi... | mit | Python |
b261cfad6e22ff40f36f4777d2f7a69964c8d47b | Fix pandabox example | dls-controls/pymalcolm,dls-controls/pymalcolm,dls-controls/pymalcolm | examples/pandabox_onboard.py | examples/pandabox_onboard.py | #!/bin/env dls-python
import os
import sys
import code
from pkg_resources import require
require("tornado", "numpy")
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from malcolm.core import Process, call_with_params
from malcolm.modules.web.controllers import HTTPServerComms
from malcolm.modules.web.p... | #!/bin/env dls-python
import os
import sys
from pkg_resources import require
require("tornado", "numpy")
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
from malcolm.core import Process, call_with_params
from malcolm.controllers import ManagerController
from malcolm.controllers.web.websocketservercomm... | apache-2.0 | Python |
b75c2371a4689116eab340dba3b7d9630c7fbb74 | add LOCK_ROOT for lock_handler | ilblackdragon/django-misc | misc/management/utils.py | misc/management/utils.py | """
A decorator for management commands (or any class method) to ensure that there is
only ever one process running the method at any one time.
Requires lockfile - (pip install lockfile)
Author: Ross Lawley
"""
import logging
import os
import time
from lockfile import FileLock, AlreadyLocked, LockTimeout
from djang... | """
A decorator for management commands (or any class method) to ensure that there is
only ever one process running the method at any one time.
Requires lockfile - (pip install lockfile)
Author: Ross Lawley
"""
import time
import logging
from lockfile import FileLock, AlreadyLocked, LockTimeout
from django.conf imp... | mit | Python |
af971c87b211448f304c33e3d5be787c59bb9b65 | Complete multiply n-digits integers | bowen0701/algorithms_data_structures | alg_multiply_n_digits_integers.py | alg_multiply_n_digits_integers.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
def multiply_n_digits_integers(x, y):
"""Multiply 2 n-bits integers by divide-and-conquer algorithm.
We would like to multiply two long n-bits integers, where
x = x_L * 10^(n/2) +... | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
def multiply_n_digits_integers(x, y):
"""Multiply 2 n-bits integers by divide-and-conquer algorithm.
We would like to multiply two long n-bits integers, where
x = x_L * 10^(n/2) +... | bsd-2-clause | Python |
1abe46c015981b4e459e8002ed33a3723337df3e | Disable TraceBufferDataLossException on CrOS. | catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult | telemetry/telemetry/web_perf/timeline_based_measurement_unittest.py | telemetry/telemetry/web_perf/timeline_based_measurement_unittest.py | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import shutil
import tempfile
import unittest
from telemetry import benchmark
from telemetry import decorators
from telemetry.internal.results import result... | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import shutil
import tempfile
import unittest
from telemetry import benchmark
from telemetry import decorators
from telemetry.internal.results import result... | bsd-3-clause | Python |
e861eb3927e62307fd6c5118a4bdc029d920e242 | Handle invalid kill calls. | moccu/django-livewatch | livewatch/tests/conftest.py | livewatch/tests/conftest.py | from __future__ import absolute_import
import os
import signal
import pytest
import time
import django_rq
from celery.signals import worker_ready
from django.core.cache import cache
from .celery import celery
CELERY_WORKER_READY = list()
@worker_ready.connect
def on_worker_ready(**kwargs):
"""Called when the... | from __future__ import absolute_import
import os
import signal
import pytest
import time
import django_rq
from celery.signals import worker_ready
from django.core.cache import cache
from .celery import celery
CELERY_WORKER_READY = list()
@worker_ready.connect
def on_worker_ready(**kwargs):
"""Called when the... | bsd-3-clause | Python |
b034eb25ef2277be4b60ecb770f9963e7cbaaec7 | add ability to create idp with fake certs for tests | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/sso/tests/generator.py | corehq/apps/sso/tests/generator.py | from corehq.apps.sso import certificates
from dimagi.utils.data import generator as data_gen
from corehq.apps.accounting.tests import generator as accounting_gen
from corehq.util.test_utils import unit_testing_only
from corehq.apps.sso.models import (
IdentityProvider,
)
@unit_testing_only
def create_idp(account... | from dimagi.utils.data import generator as data_gen
from corehq.apps.accounting.tests import generator as accounting_gen
from corehq.util.test_utils import unit_testing_only
from corehq.apps.sso.models import (
IdentityProvider,
)
@unit_testing_only
def create_idp(account=None):
if not account:
accou... | bsd-3-clause | Python |
b6cc0dba39dd6a3fc957073863694f55b16e0db0 | add callback support to timercallback.py | openhumanoids/director,edowson/director,rdeits/director,manuelli/director,mithrandir123/director,empireryan/director,mithrandir123/director,patmarion/director,mithrandir123/director,gizatt/director,mitdrc/director,gizatt/director,empireryan/director,empireryan/director,edowson/director,RussTedrake/director,mitdrc/direc... | src/python/ddapp/timercallback.py | src/python/ddapp/timercallback.py | import time
from PythonQt import QtCore
import traceback
class TimerCallback(object):
def __init__(self, targetFps=30):
'''
Construct TimerCallback. The targetFps defines frames per second, the
frequency for the ticks() callback method.
'''
self.targetFps = targetFps
... | import time
from PythonQt import QtCore
class TimerCallback(object):
def __init__(self, targetFps=30):
'''
Construct TimerCallback. The targetFps defines frames per second, the
frequency for the ticks() callback method.
'''
self.targetFps = targetFps
self.timer = ... | bsd-3-clause | Python |
c30f3010d9048d0353614afb923b82fbe58f2ee6 | call setupLocalServer() on the pydrake planner | manuelli/director,manuelli/director,manuelli/director,openhumanoids/director,openhumanoids/director,openhumanoids/director,patmarion/director,manuelli/director,patmarion/director,patmarion/director,mitdrc/director,mitdrc/director,mitdrc/director,openhumanoids/director,patmarion/director,mitdrc/director,openhumanoids/di... | src/python/tests/testPyDrakeIk.py | src/python/tests/testPyDrakeIk.py | from director import mainwindowapp
from director import robotsystem
from director import applogic
from PythonQt import QtCore
def makeRobotSystem(view):
factory = robotsystem.RobotSystemFactory()
options = factory.getDisabledOptions()
factory.setDependentOptions(options, usePlannerPublisher=True, useTeleop... | from director import mainwindowapp
from director import robotsystem
from director import applogic
from PythonQt import QtCore
def makeRobotSystem(view):
factory = robotsystem.RobotSystemFactory()
options = factory.getDisabledOptions()
factory.setDependentOptions(options, usePlannerPublisher=True, useTeleop... | bsd-3-clause | Python |
89fde7af74a8d14c429a91246ae88222c8cfec75 | change file field to plain FK #42 | amboycharlie/Child-Friendly-LCMS,amboycharlie/Child-Friendly-LCMS,django-leonardo/django-leonardo,django-leonardo/django-leonardo,amboycharlie/Child-Friendly-LCMS,amboycharlie/Child-Friendly-LCMS,django-leonardo/django-leonardo,django-leonardo/django-leonardo | leonardo/module/web/widget/siteheading/models.py | leonardo/module/web/widget/siteheading/models.py | # -#- coding: utf-8 -#-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from filer.fields.image import FilerImageField
from leonardo.module.web.models import Widget
class SiteHeadingWidget(Widget):
site_title = models.CharField(max_length=255, verbose_name=_("Site Title"))
... | # -#- coding: utf-8 -#-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from filer.fields.image import FilerImageField
from leonardo.module.web.models import Widget
class SiteHeadingWidget(Widget):
site_title = models.CharField(max_length=255, verbose_name=_("Site Title"))
... | apache-2.0 | Python |
042e74e8f2ed7031aebb8648561bd4608ef2f1a3 | update naughty DRF internal references to DRF3 api | CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend | api/serializers/projects_field.py | api/serializers/projects_field.py | from django.contrib.auth.models import AnonymousUser
from core.models.group import get_user_group
from core.models.project import Project
from rest_framework import serializers
class ProjectsField(serializers.Field):
def to_representation(self, project_mgr):
request_user = self.parent.request_user
... | from django.contrib.auth.models import AnonymousUser
from core.models.group import get_user_group
from core.models.project import Project
from rest_framework import serializers
class ProjectsField(serializers.Field):
def to_representation(self, project_mgr):
request_user = self.root.request_user
i... | apache-2.0 | Python |
7c1bd813add34d0580548fb392d943c9feaff27e | Disable debugging | avengerpenguin/rdflib-django,publysher/rdflib-django | src/rdflib_django/testsettings.py | src/rdflib_django/testsettings.py | """
Settings for testing the application.
"""
import os
DEBUG = True
DJANGO_RDFLIB_DEVELOP = True
DB_PATH = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'rdflib_django.db'))
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': DB_PATH,
'USER': '',
... | """
Settings for testing the application.
"""
DEBUG = True
DJANGO_RDFLIB_DEVELOP = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'rdflib_django.db',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
SITE_ID = 1
STATI... | mit | Python |
b790d32260a08f61be59ee5783bdbf07ed3e1c66 | Use new-style classes, following the same fix in the curriculum. | google/cssi-labs,google/cssi-labs | python/labs/quick-banking-app/starter-code/banking.py | python/labs/quick-banking-app/starter-code/banking.py | #!/usr/bin/python
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | #!/usr/bin/python
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | apache-2.0 | Python |
a06f8e46152bf158e13ca3c8109d4bed315c6745 | Remove temporary path | hawkeyexp/plugin.video.netflix,asciidisco/plugin.video.netflix | addon.py | addon.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Module: default
# Created on: 13.01.2017
# import local classes
if __package__ is None:
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from resources.lib.NetflixSession import NetflixSession
from reso... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Module: default
# Created on: 13.01.2017
# import local classes
if __package__ is None:
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from resources.lib.NetflixSession import NetflixSession
from reso... | mit | Python |
af8036a1b499e7186b9e730833d61faf96fbfe71 | write only warning logs to file | lakewik/storj-gui-client | UI/utilities/log_manager.py | UI/utilities/log_manager.py | import logging
import os
import sys
# Submodule. Necessary explicit import
from logging import handlers
LOGGER_NAME = 'storj-python-gui-log'
LOG_FILENAME = 'test.log'
PATH = os.path.join(os.getcwd(), LOG_FILENAME)
logger = logging.getLogger(LOGGER_NAME)
logger.addHandler(logging.StreamHandler(sys.stdout))
logger.set... | import logging
import os
import sys
# Submodule. Necessary explicit import
from logging import handlers
LOGGER_NAME = 'storj-python-gui-log'
LOG_FILENAME = 'test.log'
PATH = os.path.join(os.getcwd(), LOG_FILENAME)
logger = logging.getLogger(LOGGER_NAME)
logger.addHandler(logging.StreamHandler(sys.stdout))
logger.set... | mit | Python |
f51162070c61fe9d3906c7d741432356a08a4ce6 | Make end-user modules accessible from top level | dtroyer/python-openstacksdk,stackforge/python-openstacksdk,openstack/python-openstacksdk,openstack/python-openstacksdk,briancurtin/python-openstacksdk,dtroyer/python-openstacksdk,stackforge/python-openstacksdk,briancurtin/python-openstacksdk | openstack/__init__.py | openstack/__init__.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
# distributed under t... | apache-2.0 | Python | |
1dbc20b23f7bde982640cf425c0d3bae5fd35b13 | fix typo | incuna/django-orderable,incuna/django-orderable | orderable/managers.py | orderable/managers.py | from django.db import models
class OrderableManager(models.Manager):
'''
Adds additional functionality to `Orderable.objects` providing access to the next and
previous ordered object within the queryset.
'''
def before(self, orderable):
return self.filter(sort_order__lt=orderable.sort_orde... | from django.db import models
class OrderableManager(models.Manager):
'''
Adds additional functionality to `Orderable.objects` allow access to the next and
previous ordered object within the queryset.
'''
def before(self, orderable):
return self.filter(sort_order__lt=orderable.sort_order).l... | bsd-2-clause | Python |
91511dfdc4f8ce70f49c7b85039a32eda2176033 | allow import in python 2 | mkorpela/overrides,mkorpela/overrides | overrides/__init__.py | overrides/__init__.py | import sys
if sys.version < '3':
from overrides import overrides
from overrides import __VERSION__
else:
from overrides.overrides import overrides
from overrides.overrides import __VERSION__
| import sys
if sys.version < 3:
from overrides import overrides
from overrides import __VERSION__
else:
from overrides.overrides import overrides
from overrides.overrides import __VERSION__
| apache-2.0 | Python |
1185a87fd6cdcfac1173c333d9fcaba882706be4 | Include container leak fix | BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild,mono/bockbuild,mono/bockbuild,BansheeMediaPlayer/bockbuild | packages/gtk-sharp.py | packages/gtk-sharp.py | class GtkSharpPackage (Package):
def __init__ (self):
Package.__init__ (self, 'gtk-sharp', '2-12-branch')
self.commit = 'b078aacaf263af84605812d778b62afbdf3e1b59'
self.source_dir_name = 'mono-gtk-sharp-%s' % self.commit[:7]
self.configure = './bootstrap-2.12 --prefix="%{prefix}"'
self.sources = [
'http://... | class GtkSharpPackage (Package):
def __init__ (self):
Package.__init__ (self, 'gtk-sharp', '2-12-branch')
self.commit = 'b078aacaf263af84605812d778b62afbdf3e1b59'
self.source_dir_name = 'mono-gtk-sharp-%s' % self.commit[:7]
self.configure = './bootstrap-2.12 --prefix="%{prefix}"'
self.sources = [
'http://... | mit | Python |
675afea202a75f79560f9b7edc04b1d3eb3c2132 | add printing and profiling to parallel_tempering | michaelpacer/pybasicbayes,fivejjs/pybasicbayes,mattjj/pybasicbayes | parallel_tempering.py | parallel_tempering.py | from __future__ import division
import numpy as np
from collections import defaultdict
from copy import deepcopy
from util.text import progprint_xrange
from pyhsmm.util.profiling import line_profiled
PROFILING = True
PRINTING = True
class ParallelTempering(object):
def __init__(self,model,temperatures):
... | from __future__ import division
import numpy as np
from collections import defaultdict
from copy import deepcopy
from util.text import progprint_xrange
class ParallelTempering(object):
def __init__(self,model,temperatures):
temperatures = [1.] + list(sorted(temperatures))
self.models = [deepcopy(m... | mit | Python |
b217fcff73518c07bb902baf57f6b61083a211c5 | Change default beta parameters | neuro-lyon/multiglom-model,neuro-lyon/multiglom-model | paramsets/std_beta.py | paramsets/std_beta.py | from brian.stdunits import *
from brian.units import *
F = 1
N_SUBPOP = 2
INTERCO_RATE = 0
INTERCO_STRENGTH = 0
PARAMETERS = {
'Common':
{'simu_dt' : 0.05*msecond,
'simu_length' : 2000*msecond,
'N_subpop' : N_SUBPOP,
'N_mitral' : N_SUBPOP*100*F,
'inter_conn_rate' : {0: {1: INTERCO_RAT... | from brian.stdunits import *
from brian.units import *
F = 1
N_SUBPOP = 2
INTERCO_RATE = 0
INTERCO_STRENGTH = 0
PARAMETERS = {
'Common':
{'simu_dt' : 0.05*msecond,
'simu_length' : 2000*msecond,
'N_subpop' : N_SUBPOP,
'N_mitral' : N_SUBPOP*50*F,
'inter_conn_rate' : {0: {1: INTERCO_RATE... | mit | Python |
e5a9756905c5c2d0a157d4aea346c249b51581bf | format index | perrygeo/mapbox-sdk-py,mapbox/mapbox-sdk-py | mapbox/services/distance.py | mapbox/services/distance.py | from uritemplate import URITemplate
from mapbox.encoding import encode_coordinates_json
from mapbox.services.base import Service
from mapbox.validation import InvalidProfileError
class Distance(Service):
def __init__(self, access_token=None):
self.baseuri = 'https://api.mapbox.com/distances/v1/mapbox'
... | from uritemplate import URITemplate
from mapbox.encoding import encode_coordinates_json
from mapbox.services.base import Service
from mapbox.validation import InvalidProfileError
class Distance(Service):
def __init__(self, access_token=None):
self.baseuri = 'https://api.mapbox.com/distances/v1/mapbox'
... | mit | Python |
2fed494710bff3463308602abb111af0d9998f4b | test luigi | SANDAG/pydefm,SANDAG/pydefm,SANDAG/pydefm,SANDAG/defm | defm_luigi.py | defm_luigi.py | import luigi
import inspect, os
import pandas as pd
import time
from db import extract
from db import log
from forecast import compute
from forecast import util
import shutil
class Population(luigi.Task):
def requires(self):
return None
def output(self):
return luigi.LocalTarget('temp/data.h5... | import luigi
import inspect, os
import pandas as pd
import time
from db import extract
from db import log
from forecast import compute
from forecast import util
import shutil
class Population(luigi.Task):
def requires(self):
return None
def output(self):
return luigi.LocalTarget('temp/data.h5... | unknown | Python |
e026f3e7d725c07cdb9d5182571065df99ee9f4f | Fix error compat. | Lenddo/python-lenddo | lenddo_api_client/errors.py | lenddo_api_client/errors.py | from lenddo_api_client.compat import is_py2, is_py3
if is_py2:
from urllib2 import HTTPError, URLError
elif is_py3:
from urllib.error import HTTPError, URLError
| from urllib2 import HTTPError
| mit | Python |
b81ee54aaf90e9774d9a3a2095a3b42382733549 | remove unused imports | dials/dials,dials/dials,dials/dials,dials/dials,dials/dials | test/command_line/test_export_mosflm.py | test/command_line/test_export_mosflm.py | from __future__ import absolute_import, division, print_function
import os
def test_export_mosflm(dials_regression, tmpdir):
from libtbx import easy_run
with open(os.path.join(dials_regression, "experiment_test_data/experiment_1.json"), 'r') as fi:
with (tmpdir / 'experiments.json').open('w') as fo:
fo... | from __future__ import absolute_import, division, print_function
import os
def test_export_mosflm(dials_regression, tmpdir):
import shutil
import fileinput
from libtbx import easy_run
with open(os.path.join(dials_regression, "experiment_test_data/experiment_1.json"), 'r') as fi:
with (tmpdir / 'experimen... | bsd-3-clause | Python |
5b69dd3815331a02249f379e859f878450e86ed2 | Add a function translating GO terms in ChEBI. | ArnaudBelcour/Workflow_GeneList_Analysis,ArnaudBelcour/Workflow_GeneList_Analysis | pathway_extraction.py | pathway_extraction.py | #!/usr/bin/env python3
import math
import os
import pandas as pa
import re
import subprocess
from ast import literal_eval
temporary_directory = 'temporaryFiles/'
temporary_directory_database = 'temporaryFiles/databases/'
def ipr_extraction(df_genome):
ipr_expression = r"IPR[\d]{6}[^0-9]"
df_genome = df_geno... | #!/usr/bin/env python3
import math
import os
import pandas as pa
import re
import subprocess
from ast import literal_eval
temporary_directory = 'temporaryFiles/'
temporary_directory_database = 'temporaryFiles/databases/'
def ipr_extraction(df_genome):
ipr_expression = r"IPR[\d]{6}[^0-9]"
df_genome = df_geno... | agpl-3.0 | Python |
86932e8fed53732dada58c7989dcb415b8d465fc | fix is_voting_phase when no phase is active, fixes #3988 | liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin | meinberlin/apps/budgeting/templatetags/react_proposals.py | meinberlin/apps/budgeting/templatetags/react_proposals.py | import json
from django import template
from django.urls import reverse
from django.utils.html import format_html
from adhocracy4.phases.predicates import has_feature_active
from meinberlin.apps.budgeting.models import Proposal
register = template.Library()
@register.simple_tag(takes_context=True)
def react_propos... | import json
from django import template
from django.urls import reverse
from django.utils.html import format_html
register = template.Library()
@register.simple_tag(takes_context=True)
def react_proposals(context, obj):
proposals_api_url = reverse('proposals-list', kwargs={'module_pk': obj.pk})
attributes =... | agpl-3.0 | Python |
cbafefe47578260e4172917058f706260fc51143 | Add noise to opt/test1.py example. | ron-rivest/2017-bayes-audit,ron-rivest/2017-bayes-audit | 2017-code/opt/test1.py | 2017-code/opt/test1.py | # test1.py
# Ronald L. Rivest and Karim Husayn Karimi
# August 17, 2017
# Routine to experiment with scipy.optimize.minimize
import scipy.optimize
from scipy.stats import norm
# function to minimize:
def g(xy):
(x,y) = xy
print("g({},{})".format(x,y))
return x + y + 0.00000005 * norm.rvs(0)
# constraints... | # test1.py
# Ronald L. Rivest and Karim Husayn Karimi
# August 17, 2017
# Routine to experiment with scipy.optimize.minimize
import scipy.optimize
# function to minimize:
def g(xy):
(x,y) = xy
return x+y
# constraints
# constraint 1: y <= x/2
def f1(xy):
(x,y) = xy
return x/2 - y
# constraint 2: y ... | mit | Python |
5d435e566c49d4d63517869bc63c30b35b3b2b10 | Update statsd connector | upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift,upfluence/thrift | lib/py/src/metrics.py | lib/py/src/metrics.py | import os
import datetime
import tornado.gen
import statsd
if os.environ.get("STATSD_URL", None):
ip, port = os.environ.get("STATSD_URL").split(':')
statsd_client = statsd.StatsClient(host=ip, port=int(port),
prefix=os.environ.get('STATSD_PREFIX',
... | import os
import datetime
import tornado.gen
import statsd
if os.environ.get("STATSD_URL", None):
ip, port = os.environ.get("STATSD_URL").split(':')
statsd_client = statsd.Client(ip, int(port))
else:
statsd_client = None
def instrument(name):
def instrument_wrapper(fn):
@tornado.gen.coroutine... | apache-2.0 | Python |
84ef948e473f5d544629a0dfdbb58237a95374d1 | Allow config file to have //-style comments | blitzrk/sublime_libsass,blitzrk/sublime_libsass | libsass/project.py | libsass/project.py | import json
from libsass.pathutils import subpaths, mkdir_p
import os
import re
default_opts = {
"output_dir": "{0}".format(os.path.join('build','css')),
"options": {
"line-comments": True,
"line-numbers": True,
"style": "nested"
}
}
def find_config(top):
'''Search u... | import json
from libsass.pathutils import subpaths, mkdir_p
import os
default_opts = {
"output_dir": "build/css",
"options": {
"line-comments": True,
"line-numbers": True,
"style": "nested"
}
}
def find_config(top):
'''Search up parent tree for libsass config file'''... | mit | Python |
25ba4aea17d869022682fd70d4c3ccbade19955f | Add encoding to open file | openfisca/country-template,openfisca/country-template | openfisca_country_template/situation_examples/__init__.py | openfisca_country_template/situation_examples/__init__.py | """This file provides a function to load json example situations."""
import json
import os
DIR_PATH = os.path.dirname(os.path.abspath(__file__))
def parse(file_name):
"""Load json example situations."""
file_path = os.path.join(DIR_PATH, file_name)
with open(file_path, "r", encoding="utf8") as file:
... | """This file provides a function to load json example situations."""
import json
import os
DIR_PATH = os.path.dirname(os.path.abspath(__file__))
def parse(file_name):
"""Load json example situations."""
file_path = os.path.join(DIR_PATH, file_name)
with open(file_path, "r") as file:
return json... | agpl-3.0 | Python |
4573364d09a18894ce87ac7b2b74bca5cc0f880f | Fix lint | clever-crow-consulting/otm-core,maurizi/otm-core,clever-crow-consulting/otm-core,recklessromeo/otm-core,RickMohr/otm-core,clever-crow-consulting/otm-core,maurizi/otm-core,RickMohr/otm-core,recklessromeo/otm-core,clever-crow-consulting/otm-core,recklessromeo/otm-core,maurizi/otm-core,RickMohr/otm-core,maurizi/otm-core,r... | opentreemap/otm1_migrator/migration_rules/philadelphia.py | opentreemap/otm1_migrator/migration_rules/philadelphia.py | from otm1_migrator.migration_rules.standard_otm1 import MIGRATION_RULES
SORT_ORDER_INDEX = {
'Bucks': 3,
'Burlington': 4,
'Camden': 5,
'Chester': 6,
'Delaware': 7,
'Gloucester': 8,
'Kent': 9,
'Mercer': 10,
'Montgomery': 11,
'New Castle': 12,
'Salem': 13,
'Sussex': 14,
}
... | from otm1_migrator.migration_rules.standard_otm1 import MIGRATION_RULES
SORT_ORDER_INDEX = {
'Bucks': 3,
'Burlington': 4,
'Camden': 5,
'Chester': 6,
'Delaware': 7,
'Gloucester': 8,
'Kent': 9,
'Mercer': 10,
'Montgomery': 11,
'New Castle': 12,
'Salem': 13,
'Sussex': 14,
}
... | agpl-3.0 | Python |
bc763d324631595c35f67f7f96ec9d8d978c5907 | fix regex to strip ansi color codes | nvictus/SublimeIPython | run_cell.py | run_cell.py | #! /usr/bin/env python
import sys
def connect_to_kernel(file_name):
from IPython.kernel import find_connection_file, KernelManager
cf = find_connection_file(file_name)
km = KernelManager(connection_file=cf)
km.load_connection_file()
return km.client()
if __name__=='__main__':
code = sys.argv[... | #! /usr/bin/env python
import sys
from IPython.kernel import find_connection_file, KernelManager
def connect_to_kernel(file_name):
cf = find_connection_file(file_name)
km = KernelManager(connection_file=cf)
km.load_connection_file()
return km.client()
if __name__=='__main__':
code = sys.argv[1]
... | mit | Python |
c8b410161a19f0edbaedefd80d860ddc0cab326d | Use the write var on return | MISP/misp-modules,VirusTotal/misp-modules,MISP/misp-modules,VirusTotal/misp-modules,amuehlem/misp-modules,MISP/misp-modules,amuehlem/misp-modules,amuehlem/misp-modules,VirusTotal/misp-modules | misp_modules/modules/expansion/backscatter_io.py | misp_modules/modules/expansion/backscatter_io.py | # -*- coding: utf-8 -*-
"""Backscatter.io Module."""
import json
try:
from backscatter import Backscatter
except ImportError:
print("Backscatter.io library not installed.")
misperrors = {'error': 'Error'}
mispattributes = {'input': ['ip-src', 'ip-dst'], 'output': ['freetext']}
moduleinfo = {'version': '1', 'au... | # -*- coding: utf-8 -*-
"""Backscatter.io Module."""
import json
try:
from backscatter import Backscatter
except ImportError:
print("Backscatter.io library not installed.")
misperrors = {'error': 'Error'}
mispattributes = {'input': ['ip-src', 'ip-dst'], 'output': ['freetext']}
moduleinfo = {'version': '1', 'au... | agpl-3.0 | Python |
eb1921615cd9070564d09c934d2c687897619c3a | Add tags of campaign to user | stefanw/froide,stefanw/froide,stefanw/froide,fin/froide,fin/froide,fin/froide,stefanw/froide,fin/froide,stefanw/froide | froide/campaign/listeners.py | froide/campaign/listeners.py | from .models import Campaign
def connect_campaign(sender, **kwargs):
reference = kwargs.get('reference')
if not reference:
return
parts = reference.split(':', 1)
if len(parts) != 2:
return
namespace = parts[0]
try:
campaign = Campaign.objects.get(ident=namespace)
ex... | from .models import Campaign
def connect_campaign(sender, **kwargs):
reference = kwargs.get('reference')
if not reference:
return
parts = reference.split(':', 1)
if len(parts) != 2:
return
namespace = parts[0]
try:
campaign = Campaign.objects.get(ident=namespace)
ex... | mit | Python |
e090fa6a03930d592219d5ab6c6395f33deb08a7 | Fix settings for travis | ttyS15/django-celery-rpc,tumb1er/django-celery-rpc,bourivouh/django-celery-rpc | runtests.py | runtests.py | #!/usr/bin/env python
import sys
from optparse import OptionParser
from django.conf import settings
if not settings.configured:
from celery_rpc.runtests import settings as test_settings
kwargs = {k: getattr(test_settings, k) for k in dir(test_settings)
if not k.startswith('_')}
settings.con... | #!/usr/bin/env python
import sys
from optparse import OptionParser
from django.conf import settings
if not settings.configured:
settings.configure(
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
'USER': '',... | unlicense | Python |
d8834b1d2f60b56b0b9663ff4d48bd60058c95bf | make repeat work with iterables | aureooms/sak,aureooms/sak | sak/iter.py | sak/iter.py | import lib.args, lib.sys, fileinput, itertools, getpass, lib.file
# polyfill for generator zip function
if hasattr( itertools , "izip" ) :
_zip = itertools.izip
else :
_zip = zip
def directories ( callable = None , iterable = None ) :
iterable = lib.args.listify( iterable )
callable = lib.args.listify( callab... | import lib.args, lib.sys, fileinput, itertools, getpass, lib.file
# polyfill for generator zip function
if hasattr( itertools , "izip" ) :
_zip = itertools.izip
else :
_zip = zip
def directories ( callable = None , iterable = None ) :
iterable = lib.args.listify( iterable )
callable = lib.args.listify( callab... | agpl-3.0 | Python |
eb5ea9b91894d2ab76afdaa7efaf760a483385d6 | clean up | Fuchida/gibson,Fuchida/gibson,Fuchida/gibson | src/config.py | src/config.py | import os
# Accepted file formats regex
# markdown accepted
# reStructuredText not accepted for now
ACCEPTED_FILE_FORMATS = "^.*\.md$" # .md
POSTS_GIT_REPO = None
POSTS_GIT_REPO_SECRET = None
# Git Repo Config
# Fetched via environmental variables
GIT_REPO_URL = os.environ.get('POSTS_GIT_REPO', POSTS_GIT_REPO)
POS... | import os
# Accepted file formats regex
# markdown accepted
# reStructuredText not accepted for now
ACCEPTED_FILE_FORMATS = "^.*\.md$" # .md
POSTS_GIT_REPO = 'https://github.com/Fuchida/posts.git'
POSTS_GIT_REPO_SECRET = '1qaz@WSX'
# Git Repo Config
# Fetched via environmental variables
GIT_REPO_URL = os.environ.ge... | mit | Python |
09699c162480a8b735783b7a3cc297daac9c9aa7 | Write to json | kocsenc/natural-language-to-software-model | src/driver.py | src/driver.py | #!usr/bin/env python3
__author__ = 'David Kisluk'
import argparse
import json
import nltk
def main():
# parse args
input_file = ''
output_file = ''
args = parse_args()
input_file = args.infile
output_file = args.outfile
# In comes the text (filename)
with open(input_file, 'r') as f:... | #!usr/bin/env python3
__author__ = 'David Kisluk'
import argparse
import json
import nltk
def main():
# parse args
input_file = ''
output_file = ''
args = parse_args()
input_file = args.infile
output_file = args.outfile
# In comes the text (filename)
with open(input_file, 'r') as f:... | bsd-2-clause | Python |
cd21102ac4977d28b6f58a50a2cc51f0820c56df | Fix description | ZDroid/XDroid | XDroid.py | XDroid.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# Potentially good IRC bot
#
import socket
from time import ctime
import feedparser
# Configuration
# -------------
server = "irc.freenode.net"
channel = "#zdroid"
nick = "XDroid"
# Connect to server
# -----------------
irc = socket.socket(socket.AF_INET, socket.SOCK... | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# The most stupid IRC bot
#
import socket
from time import ctime
import feedparser
# Configuration
# -------------
server = "irc.freenode.net"
channel = "#zdroid"
nick = "XDroid"
# Connect to server
# -----------------
irc = socket.socket(socket.AF_INET, socket.SOCK_... | mit | Python |
133ad8f46abb1636810df012afde4e1d12e88b1c | bump version to 0.9.0.dev0 (#855) | mbeacom/locust,heyman/locust,mbeacom/locust,locustio/locust,locustio/locust,locustio/locust,mbeacom/locust,mbeacom/locust,locustio/locust | locust/__init__.py | locust/__init__.py | from .core import HttpLocust, Locust, TaskSet, TaskSequence, task, seq_task
from .exception import InterruptTaskSet, ResponseError, RescheduleTaskImmediately
__version__ = "0.9.0.dev0"
| from .core import HttpLocust, Locust, TaskSet, TaskSequence, task, seq_task
from .exception import InterruptTaskSet, ResponseError, RescheduleTaskImmediately
__version__ = "0.8.1"
| mit | Python |
06a831d6cebbac6ad589cc5df01e78f56f1c3a93 | tidy up | melvon22/weather-station,raspberrypi/weather-station,raspberrypi/weather-station | log_all_sensors.py | log_all_sensors.py | #!/usr/bin/python
import interrupt_client, MCP342X, wind_direction, HTU21D, bmp085, tgs2600, ds18b20_therm
import database # requires MySQLdb python 2 library which is not ported to python 3 yet
pressure = bmp085.BMP085()
temp_probe = ds18b20_therm.DS18B20()
air_qual = tgs2600.TGS2600(adc_channel = 0)
humidity = HTU21... | #!/usr/bin/python
import interrupt_client, database, MCP342X, wind_direction, HTU21D, bmp085, tgs2600, ds18b20_therm
pressure = bmp085.BMP085()
temp_probe = ds18b20_therm.DS18B20()
air_qual = tgs2600.TGS2600(adc_channel = 0)
humidity = HTU21D.HTU21D()
wind_dir = wind_direction.wind_direction(adc_channel = 0, margin = ... | bsd-3-clause | Python |
0612278c69d45290d8fac3e62fe28b4945217fa8 | Update local.py | 20tab/twentytab_project,20tab/twentytab_project,20tab/twentytab_project | project_name/settings/local.py | project_name/settings/local.py | from {{ project_name }}.settings.base import *
import socket
ALLOWED_HOSTS = ('localhost', '127.0.0.1')
DEBUG = True
TEMPLATES[0]['OPTIONS']['debug'] = True
USE_DEBUG_TOOLBAR = True
INTERNAL_IPS = ('127.0.0.1', socket.gethostbyname(socket.gethostname()))
DATABASES = {
'default': {
'ENGINE': 'django.db.ba... | from {{ project_name }}.settings.base import *
ALLOWED_HOSTS = ('localhost', '127.0.0.1')
DEBUG = True
TEMPLATES[0]['OPTIONS']['debug'] = True
USE_DEBUG_TOOLBAR = True
INTERNAL_IPS = ('127.0.0.1', socket.gethostbyname(socket.gethostname()))
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgre... | mit | Python |
85bd53e4e09bdca054c10acdf21e3a1182bc0226 | fix User model: remove comma in monthly_words_count function | jupiny/EnglishDiary,jupiny/EnglishDiary,jupiny/EnglishDiary | english_diary/users/models/user.py | english_diary/users/models/user.py | from django.contrib.auth.models import AbstractUser
from django.contrib.auth.models import UserManager
from django.db import models
from datetime import datetime
class CustomUserManager(UserManager):
def agree_email_notification(self):
return self.filter(email_notification=True)
class User(AbstractUser... | from django.contrib.auth.models import AbstractUser
from django.contrib.auth.models import UserManager
from django.db import models
from datetime import datetime
class CustomUserManager(UserManager):
def agree_email_notification(self):
return self.filter(email_notification=True)
class User(AbstractUser... | mit | Python |
4489bcedfa57141d49886e4154cc4e72750eecb4 | prueba del comit y pull :) | Karimx/SGBDR | Testing.py | Testing.py | Learning how to make commit github
#hola karimito :) prueba del push del git | Learning how to make commit github | apache-2.0 | Python |
b8a5655520449148e5f71790f85dfafd84faebec | Remove header added to gold file | nuclear-wizard/moose,YaqiWang/moose,harterj/moose,milljm/moose,sapitts/moose,dschwen/moose,jessecarterMOOSE/moose,sapitts/moose,andrsd/moose,sapitts/moose,lindsayad/moose,andrsd/moose,harterj/moose,jessecarterMOOSE/moose,idaholab/moose,jessecarterMOOSE/moose,dschwen/moose,lindsayad/moose,dschwen/moose,SudiptaBiswas/moo... | python/peacock/tests/postprocessor_tab/gold/TestPostprocessorPluginManager_test_script.py | python/peacock/tests/postprocessor_tab/gold/TestPostprocessorPluginManager_test_script.py | """
python TestPostprocessorPluginManager_test_script.py
"""
import matplotlib.pyplot as plt
import mooseutils
# Create Figure and Axes
figure = plt.figure(facecolor='white')
axes0 = figure.add_subplot(111)
axes1 = axes0.twinx()
# Read Postprocessor Data
data = mooseutils.PostprocessorReader('../input/white_elephant_... | #* This file is part of the MOOSE framework
#* https://www.mooseframework.org
#*
#* All rights reserved, see COPYRIGHT for full restrictions
#* https://github.com/idaholab/moose/blob/master/COPYRIGHT
#*
#* Licensed under LGPL 2.1, please see LICENSE for details
#* https://www.gnu.org/licenses/lgpl-2.1.html
"""
python ... | lgpl-2.1 | Python |
d8ce75466e4a6728cccfc7696a65a399e9cf23f1 | fix rte translator timeout | ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo | odoo/addons/base/wizard/base_language_install.py | odoo/addons/base/wizard/base_language_install.py | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
class BaseLanguageInstall(models.TransientModel):
_name = "base.language.install"
_description = "Install Language"
@api.model
def _default_language(self):
... | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
class BaseLanguageInstall(models.TransientModel):
_name = "base.language.install"
_description = "Install Language"
@api.model
def _default_language(self):
... | agpl-3.0 | Python |
55788468804b2f4ec17d7a99a656930a3f14c32f | Use the native `assertIsNone()` http://docs.python.org/2.7/library/unittest.html#unittest.TestCase.assertIsNone | armstrong/armstrong.dev | armstrong/dev/tests/utils/base.py | armstrong/dev/tests/utils/base.py | from django.test import TestCase as DjangoTestCase
import fudge
from django.db import models
# Backport override_settings from Django 1.4
try:
from django.test.utils import override_settings
except ImportError:
from .backports import override_settings
class ArmstrongTestCase(DjangoTestCase):
def setUp(se... | from django.test import TestCase as DjangoTestCase
import fudge
from django.db import models
# Backport override_settings from Django 1.4
try:
from django.test.utils import override_settings
except ImportError:
from .backports import override_settings
class ArmstrongTestCase(DjangoTestCase):
def setUp(se... | apache-2.0 | Python |
f1fcbebb501f62abf6237963b04647bf6c61d63b | Update BatchGiftEntryPageObject.py | SalesforceFoundation/Cumulus,SalesforceFoundation/Cumulus,SalesforceFoundation/Cumulus,SalesforceFoundation/Cumulus | robot/Cumulus/resources/BatchGiftEntryPageObject.py | robot/Cumulus/resources/BatchGiftEntryPageObject.py | import time
from cumulusci.robotframework.pageobjects import ListingPage
from cumulusci.robotframework.pageobjects import DetailPage
from cumulusci.robotframework.pageobjects import pageobject
from BaseObjects import BaseNPSPPage
from NPSP import npsp_lex_locators
from logging import exception
@pageobject("Listing", "... | import time
from cumulusci.robotframework.pageobjects import ListingPage
from cumulusci.robotframework.pageobjects import pageobject
from BaseObjects import BaseNPSPPage
from NPSP import npsp_lex_locators
from logging import exception
@pageobject("Listing", "Batch_Gift_Entry")
class BatchGiftEntryPage(BaseNPSPPage, Li... | bsd-3-clause | Python |
bd11fd93bb0e16b81fdc53ab2aa799f3bd3b27bc | Fix vulnerability_ticket sample plugin. | rbaumg/trac,rbaumg/trac,rbaumg/trac,rbaumg/trac | sample-plugins/permissions/vulnerability_tickets.py | sample-plugins/permissions/vulnerability_tickets.py | from trac.core import *
from trac.perm import IPermissionPolicy, IPermissionRequestor
revision = "$Rev$"
url = "$URL$"
class SecurityTicketsPolicy(Component):
"""Prevent public access to security sensitive tickets.
Add the VULNERABILITY_VIEW permission as a pre-requisite for any
other permission chec... | from trac.core import *
from trac.perm import IPermissionPolicy, IPermissionRequestor
revision = "$Rev$"
url = "$URL$"
class SecurityTicketsPolicy(Component):
"""Prevent public access to security sensitive tickets.
Add the VULNERABILITY_VIEW permission as a pre-requisite for any
other permission chec... | bsd-3-clause | Python |
ce9f5e523d719ebdc967529fc12bb60e57e6eefc | Bump major version number | pnpnpn/retry-decorator | retry_decorator/__init__.py | retry_decorator/__init__.py | # -*- coding: utf-8 -*-
#
# License: MIT
# Copyright: Patrick Ng - 2012
#
from .retry_decorator import *
__title__ = 'retry_decorator'
__version__ = "2.0.0"
| # -*- coding: utf-8 -*-
#
# License: MIT
# Copyright: Patrick Ng - 2012
#
from .retry_decorator import *
__title__ = 'retry_decorator'
__version__ = "1.1.0"
| mit | Python |
195884c0d21ed3742766e904029901a205a90940 | Comment typo | all-umass/metric-learn,terrytangyuan/metric-learn | metric_learn/base_metric.py | metric_learn/base_metric.py | from numpy.linalg import inv,cholesky
class BaseMetricLearner(object):
def __init__(self):
raise NotImplementedError('BaseMetricLearner should not be instantiated')
def metric(self):
"""Computes the Mahalanobis matrix from the transformation matrix.
.. math:: M = L^{\\top} L
Returns
-------... | from numpy.linalg import inv,cholesky
class BaseMetricLearner(object):
def __init__(self):
raise NotImplementedError('BaseMetricLearner should not be instantiated')
def metric(self):
"""Computes the Mahalanobis matrix from the transformation matrix.
.. math:: M = L^{\\top} L
Returns
-------... | mit | Python |
44369f7a786ad997cf32bbf11872ff1b066025de | Update courselist.py | fomhko/courseHunter | src/courselist.py | src/courselist.py | courselist = [{'department': 'MATH', 'number': 417, 'crn': 65075},
{'department': 'MATH', 'number': 484, 'crn': 30809},
{'department': 'MATH', 'number': 347, 'crn': 34395},
{'department': 'MATH', 'number': 124, 'crn': 45900},
]
| courselist = [{'department': 'MATH', 'number': 417, 'crn': 65075},
{'department': 'MATH', 'number': 484, 'crn': 30809},
{'department': 'MATH', 'number': 347, 'crn': 34395},
]
| bsd-2-clause | Python |
2a31c4542cec4c46d22ec6cd905bb60813810cef | Remove WKPB from geosearch - also change test | DatapuntAmsterdam/datapunt_geosearch,DatapuntAmsterdam/datapunt_geosearch | web/geosearch/tests/test_bag_dataset.py | web/geosearch/tests/test_bag_dataset.py | import unittest
from datapunt_geosearch import config
from datapunt_geosearch import datasource
class TestBAGDataset(unittest.TestCase):
def test_query(self):
x = 120993
y = 485919
ds = datasource.BagDataSource(dsn=config.DSN_BAG)
results = ds.query(x, y)
self.assertEqua... | import unittest
from datapunt_geosearch import config
from datapunt_geosearch import datasource
class TestBAGDataset(unittest.TestCase):
def test_query(self):
x = 120993
y = 485919
ds = datasource.BagDataSource(dsn=config.DSN_BAG)
results = ds.query(x, y)
self.assertEqua... | mpl-2.0 | Python |
54244bb271c910f0a862640b0efbcc5f4497c13c | remove empty line | DataKind-SG/healthcare_ASEAN | src/data/download/ID_malaria.py | src/data/download/ID_malaria.py | # This script downloads yearly malaria statistics from data.go.id
# It uses urllib and is compatible with both Python 2 and 3
import os
import sys
import logging #logs what goes on
DIRECTORY = '../../data/raw/disease_ID'
OUTFILE = "yearly-malaria.csv"
OUTFILE2015 = "malaria-2015.xlsx"
URL = "http://data.go.id/dataset... | # This script downloads yearly malaria statistics from data.go.id
# It uses urllib and is compatible with both Python 2 and 3
import os
import sys
import logging #logs what goes on
DIRECTORY = '../../data/raw/disease_ID'
OUTFILE = "yearly-malaria.csv"
OUTFILE2015 = "malaria-2015.xlsx"
URL = "http://data.go.id/dataset... | mit | Python |
c0190b0443ad8fa67cfa80322511c277fd51ed4f | Fix dict syntax typo | thaim/ansible,thaim/ansible | lib/ansible/modules/cloud/openstack/os_client_config.py | lib/ansible/modules/cloud/openstack/os_client_config.py | #!/usr/bin/python
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# This module is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any late... | #!/usr/bin/python
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
#
# This module is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any late... | mit | Python |
62e866abcc9c9e6e8e5468504d2619883f4d4078 | use period of voucher date when no period is found (lp:c2c-financial-addons/6.1 rev 24.1.45) | Endika/bank-statement-reconcile,VitalPet/bank-statement-reconcile,BT-fgarbely/bank-statement-reconcile,BT-jmichaud/bank-statement-reconcile,Antiun/bank-statement-reconcile,OpenPymeMx/bank-statement-reconcile,damdam-s/bank-statement-reconcile,BT-ojossen/bank-statement-reconcile,raycarnes/bank-statement-reconcile,StefanR... | account_statement_ext_voucher/statement_voucher.py | account_statement_ext_voucher/statement_voucher.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Joel Grand-Guillaume
# Copyright 2011-2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Joel Grand-Guillaume
# Copyright 2011-2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... | agpl-3.0 | Python |
5a07235fd2073a1297c6d23a22dd1e2711696f08 | fix testcase | yosida95/python-jsmapper | jsmapper/tests/test_types.py | jsmapper/tests/test_types.py | # -*- coding: utf-8 -*-
import unittest
from . import product_request
from ..examples import product
from ..types import Object
class TestPrimitiveType(unittest.TestCase):
def test_object(self):
obj = Object(properties=product.Product)
inst = obj.bind(product_request)
self.assertIsInst... | # -*- coding: utf-8 -*-
import unittest
from . import address_request
from ..examples import address
from ..types import Object
class TestPrimitiveType(unittest.TestCase):
def test_object(self):
obj = Object(properties=address.Address)
inst = obj.bind(address_request)
self.assertIsInst... | mit | Python |
fffc61794c11d620bc6cfee264c1e3e0a618c778 | print docker logs on timeout (#2743) | linkedin/WhereHows,linkedin/WhereHows,linkedin/WhereHows,linkedin/WhereHows,linkedin/WhereHows,linkedin/WhereHows | metadata-ingestion/tests/test_helpers/docker_helpers.py | metadata-ingestion/tests/test_helpers/docker_helpers.py | import contextlib
import subprocess
import pytest
import pytest_docker.plugin
def is_responsive(container_name: str, port: int) -> bool:
ret = subprocess.run(
f"docker exec {container_name} /bin/bash -c 'echo -n > /dev/tcp/localhost/{port}'",
shell=True,
)
return ret.returncode == 0
def... | import contextlib
import subprocess
import pytest
import pytest_docker.plugin
def is_responsive(container_name: str, port: int) -> bool:
ret = subprocess.run(
f"docker exec {container_name} /bin/bash -c 'echo -n > /dev/tcp/localhost/{port}'",
shell=True,
)
return ret.returncode == 0
def... | apache-2.0 | Python |
82383093ee4c6a652f8592113b380621e6d1bdd9 | bump version number to 0.16.0 | LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack | lib/spack/spack/__init__.py | lib/spack/spack/__init__.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
#: major, minor, patch version for Spack, in a tuple
spack_version_info = (0, 16, 0)
#: String containing Spack version ... | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
#: major, minor, patch version for Spack, in a tuple
spack_version_info = (0, 15, 4)
#: String containing Spack version ... | lgpl-2.1 | Python |
7f2b0d1c857ef97b49b10fc2ca22e3439f7ab5de | stop Qt warnings | OpenMineMods/OpenMineMods,OpenMineMods/OpenMineMods | GUI/DownloadDialogWrapper.py | GUI/DownloadDialogWrapper.py | from PyQt5.QtWidgets import *
from PyQt5.QtCore import QThread
from functools import partial
from API.CurseAPI import CurseFile, CurseAPI
from API.MultiMC import MultiMCInstance
from Utils.Downloader import DownloaderThread
from GUI.ProgressDialog import Ui_ProgressDialog
class DownloadDialog:
def __init__(se... | from PyQt5.QtWidgets import *
from PyQt5.QtCore import QThread
from functools import partial
from API.CurseAPI import CurseFile, CurseAPI
from API.MultiMC import MultiMCInstance
from Utils.Downloader import DownloaderThread
from GUI.ProgressDialog import Ui_ProgressDialog
class DownloadDialog:
def __init__(se... | agpl-3.0 | Python |
a91527a67047664d5f13bbb1ae7533b9f85e2b14 | Add __contains__ implementation to avoid a race in __get_item__. | crosswalk-project/chromium-crosswalk-efl,hgl888/chromium-crosswalk,dushu1203/chromium.src,Jonekee/chromium.src,jaruba/chromium.src,Pluto-tv/chromium-crosswalk,Chilledheart/chromium,axinging/chromium-crosswalk,Jonekee/chromium.src,krieger-od/nwjs_chromium.src,Fireblend/chromium-crosswalk,hgl888/chromium-crosswalk-efl,hg... | tools/telemetry/telemetry/core/backends/chrome/extension_backend.py | tools/telemetry/telemetry/core/backends/chrome/extension_backend.py | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import collections
from telemetry.core import extension_page
from telemetry.core.backends.chrome import inspector_backend_list
class ExtensionBackendList(... | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import collections
from telemetry.core import extension_page
from telemetry.core.backends.chrome import inspector_backend_list
class ExtensionBackendList(... | bsd-3-clause | Python |
6b3a562cb0e3cff380dad391ba5adf8c19329e2d | Add experience replay | davidrobles/mlnd-capstone-code | capstone/rl/learners/qlearning.py | capstone/rl/learners/qlearning.py | import random
from ..learner import Learner
from ..utils import max_qvalue
class QLearning(Learner):
'''Tabular Q-learning'''
def __init__(self, env, policy, qfunction, learning_rate=0.1,
discount_factor=0.99, **kwargs):
super(QLearning, self).__init__(env, **kwargs)
self.pol... | from ..learner import Learner
from ..utils import max_qvalue
class QLearning(Learner):
'''Tabular Q-learning'''
def __init__(self, env, policy, qfunction, learning_rate=0.1,
discount_factor=0.99, **kwargs):
super(QLearning, self).__init__(env, **kwargs)
self.policy = policy
... | mit | Python |
752859aa3f343b08ef255eb71fc5da6da3095d12 | Fix cookies test | meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-u... | chrome/test/functional/cookies.py | chrome/test/functional/cookies.py | #!/usr/bin/python
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import pyauto_functional # Must be imported before pyauto
import pyauto
class CookiesTest(pyauto.PyUITest):
"""Tests fo... | #!/usr/bin/python
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import pyauto_functional # Must be imported before pyauto
import pyauto
class CookiesTest(pyauto.PyUITest):
"""Tests fo... | bsd-3-clause | Python |
18584ce5408ef39a0d9ce7250d3419a33b3639d9 | Fix script to alter temperature | nanoporetech/scrappie,nanoporetech/scrappie,nanoporetech/scrappie | misc/alter_temperature.py | misc/alter_temperature.py | #!/usr/bin/env python3
import argparse
import numpy as np
import pickle
import sys
from sloika.cmdargs import AutoBool, FileExists, Positive
import sloika.layers as layers
from sloika.helpers import objwalk, set_at_path
parser = argparse.ArgumentParser('Hack temperature into sloika model')
parser.add_argument('--tem... | #!/usr/bin/env python3
import argparse
import numpy as np
import pickle
import sys
from sloika.cmdargs import AutoBool, FileExists, Positive
import sloika.layers as layers
from sloika.helpers import objwalk, set_at_path
parser = argparse.ArgumentParser('Hack temperature into sloika model')
parser.add_argument('--tem... | mpl-2.0 | Python |
e57847939613ed2350eb1d51fec39c6a03a9f509 | Add a vi mode line to common.py. | bpsinc-native/src_third_party_pywebsocket_src,bpsinc-native/src_third_party_pywebsocket_src,bpsinc-native/src_third_party_pywebsocket_src,bpsinc-native/src_third_party_pywebsocket_src | mod_pywebsocket/common.py | mod_pywebsocket/common.py | # Copyright 2011, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | # Copyright 2011, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | bsd-3-clause | Python |
e53c66f9ab12fe0c90c447176b083513cd3a4cf5 | Move products:review URLConf above product:detail | kevgathuku/compshop,andela-kndungu/compshop,kevgathuku/compshop,kevgathuku/compshop,andela-kndungu/compshop,andela-kndungu/compshop,kevgathuku/compshop,andela-kndungu/compshop | store/urls.py | store/urls.py | from django.conf.urls import url
from .views import ProductCatalogue, ProductDetail, product_review
urlpatterns = [
url(r'^catalogue/$', ProductCatalogue.as_view(), name='catalogue'),
url(r'^review/$', product_review, name='review'),
url(r'^(?P<slug>[\w\-]+)/$', ProductDetail.as_view(), name='detail'),
]... | from django.conf.urls import url
from .views import ProductCatalogue, ProductDetail, product_review
urlpatterns = [
url(r'^catalogue/$', ProductCatalogue.as_view(), name='catalogue'),
url(r'^(?P<slug>[\w\-]+)/$', ProductDetail.as_view(), name='detail'),
url(r'^review/$', product_review, name='review')
]
| bsd-3-clause | Python |
2136829c54be986db9df848e97fa295b9998b26e | Add Run class | ouroboros8/dollar_auction | auction.py | auction.py | '''
Genetic approach to dollar auction problem. Individuals compete against
each other, and the individuals who make the lowest loss win.
'''
import numpy
import random
class Run():
'''
Object representing a run of the problem
'''
def __init__(self, pop_size, mem_len, gen_len):
self.mem_len = ... | '''
Genetic approach to dollar auction problem. Individuals compete against
each other, and the individuals who make the lowest loss win.
'''
import numpy
import random
GENOME_LENGTH = 1000
MEMORY_LENGTH = 1000
def random_genome():
genome = [None]*GENOME_LENGTH
genome = [(random.choice(['i', 'd',
... | mit | Python |
ad1b679c5d3062746b3a51fb44fbc8de9408882f | Drop keyword arg | bwc126/MLND-Subvocal | svr_record.py | svr_record.py | from tkinter import *
from pcf8591read import *
import threading
root = Tk()
def testytesty():
print ('oh look we used a callback')
# words from https://www.randomlists.com/random-words
words = ['dusty','march','direful','complete','superb','poised','wait','quaint','save','copy','interest','separate','bright','ut... | from tkinter import *
from pcf8591read import *
import threading
root = Tk()
def testytesty():
print ('oh look we used a callback')
# words from https://www.randomlists.com/random-words
words = ['dusty','march','direful','complete','superb','poised','wait','quaint','save','copy','interest','separate','bright','ut... | mit | Python |
485ba196013b72197bf255b748cdcb01e05e1d66 | Add package requirements for PIO Plus | platformio/platformio,platformio/platformio-core,platformio/platformio-core | platformio/pioplus.py | platformio/pioplus.py | # Copyright 2014-present PlatformIO <contact@platformio.org>
#
# 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 applicabl... | # Copyright 2014-present PlatformIO <contact@platformio.org>
#
# 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 applicabl... | apache-2.0 | Python |
e60846329c084cd55d4e105aecf93108b2abcbe9 | Remove duplicate lines automatically | HactarCE/The-Zebra-Project,HactarCE/The-Zebra-Project | sort.py | sort.py | #!/usr/bin/env python3
zebra_lines = []
with open('zebra.txt') as f:
zebra_lines = sorted(set(f), key=lambda s: s.casefold())
with open('zebra.txt', 'w') as f:
for line in zebra_lines:
f.write(line)
| #!/usr/bin/env python3
zebra_lines = []
with open('zebra.txt') as f:
zebra_lines = sorted(f, key=lambda s: s.casefold())
with open('zebra.txt', 'w') as f:
for line in zebra_lines:
f.write(line)
| mit | Python |
70f5b28dff54804a1faa0cd8871c2a0132f5c375 | Bump version number to 0.1.3. | wearehoods/django-model-publisher-ai,wearehoods/django-model-publisher-ai,jp74/django-model-publisher,jp74/django-model-publisher,jp74/django-model-publisher,wearehoods/django-model-publisher-ai | publisher/__init__.py | publisher/__init__.py | __version__ = '0.1.3'
| __version__ = '0.1.2'
| bsd-3-clause | Python |
b29003f519ecd2fe7e8c0c316c91fc43cdac2225 | add tripplanner - fail #16 timeout #19 | aliciawyy/dmining | puzzle/tripplanner.py | puzzle/tripplanner.py | import collections
def read_line_to_list(as_type=int):
lst = raw_input().strip().split(' ')
if as_type is None:
return lst
return map(as_type, lst)
class TripPlanner(object):
hours_per_day = 8
def __init__(self, budget, price_per_day, num_attr, attractions):
self.budget = budget... | import collections
def read_line_to_list(as_type=int):
lst = raw_input().strip().split(' ')
if as_type is None:
return lst
return map(as_type, lst)
class TripPlanner(object):
hours_per_day = 8
def __init__(self, budget, price_per_day, num_attr, attractions):
self.budget = budget... | apache-2.0 | Python |
af9af6da967cb62adcfc2368eb4c1054367833b6 | update for g_word without punctuation | 47rooks/puzzles | puzzles/core/etcbc.py | puzzles/core/etcbc.py | '''
Created on Jan 18, 2017
@author: Daniel
'''
from tf.fabric import Fabric, Locality as L, Text as T
from bibleutils.versification import Identifier
from inspect import currentframe
class __Corpus(Identifier):
'''Defines the corpus identifiers. Essentially this is just Hebrew or Greek
right.
... | '''
Created on Jan 18, 2017
@author: Daniel
'''
from tf.fabric import Fabric, Locality as L, Text as T
from bibleutils.versification import Identifier
from inspect import currentframe
class __Corpus(Identifier):
'''Defines the corpus identifiers. Essentially this is just Hebrew or Greek
right.
... | mit | Python |
ebbc05362e558f4cd8f37f692ac0ca95a0515766 | Update HashFilter | Parsely/python-bloomfilter | pybloom/hashfilter.py | pybloom/hashfilter.py | import time
class HashFilter(object):
'''
Plain Temporal Hash Filter for testing purposes
'''
def __init__(self, expiration):
self.expiration = expiration
self.unique_items = {}
def add(self, key, timestamp = None):
if key in self.unique_items:
if not timestamp:... | import time
class HashFilter(object):
'''
Plain Hash Filter for testing purposes
'''
def __init__(self, expiration):
self.expiration = expiration
self.unique_items = {}
def add(self, key):
if key in self.unique_items:
timestamp = time.time()
self.uni... | mit | Python |
50f768aa01048a8c5737b1efb09d678e1707e8c3 | bump version | ansrivas/pylogging,ansrivas/pylogging | pylogging/__init__.py | pylogging/__init__.py | # !/usr/bin/env python
# -*- coding: utf-8 -*-
"""Initialize module utils."""
__all__ = ['setup_logger', 'HandlerType', 'Formatters']
from ._create_logger import setup_logger
from .handler_types import HandlerType
from .formatters import Formatters
__version__ = '0.2.5'
| # !/usr/bin/env python
# -*- coding: utf-8 -*-
"""Initialize module utils."""
__all__ = ['setup_logger', 'HandlerType', 'Formatters']
from ._create_logger import setup_logger
from .handler_types import HandlerType
from .formatters import Formatters
__version__ = '0.2.3'
| mit | Python |
0ee8ae8ca4e0c748dae6890d7a3c3cf95e9094d0 | add cuhf | Konjkov/pyquante2,Konjkov/pyquante2,Konjkov/pyquante2 | pyquante2/__init__.py | pyquante2/__init__.py | from pyquante2.basis.basisset import basisset
from pyquante2.basis.cgbf import cgbf
from pyquante2.basis.pgbf import pgbf
from pyquante2.geo.molecule import molecule
from pyquante2.geo.samples import *
from pyquante2.graphics.vtkplot import vtk_orbs
from pyquante2.grid.grid import grid
from pyquante2.ints.one import S,... | from pyquante2.basis.basisset import basisset
from pyquante2.basis.cgbf import cgbf
from pyquante2.basis.pgbf import pgbf
from pyquante2.geo.molecule import molecule
from pyquante2.geo.samples import *
from pyquante2.graphics.vtkplot import vtk_orbs
from pyquante2.grid.grid import grid
from pyquante2.ints.one import S,... | bsd-3-clause | Python |
3cc81f4b7a7f81006bb234f22fd19fe47a121246 | Bump version | cool-RR/PySnooper,cool-RR/PySnooper | pysnooper/__init__.py | pysnooper/__init__.py | # Copyright 2019 Ram Rachum and collaborators.
# This program is distributed under the MIT license.
'''
PySnooper - Never use print for debugging again
Usage:
import pysnooper
@pysnooper.snoop()
def your_function(x):
...
A log will be written to stderr showing the lines executed and variables
ch... | # Copyright 2019 Ram Rachum and collaborators.
# This program is distributed under the MIT license.
'''
PySnooper - Never use print for debugging again
Usage:
import pysnooper
@pysnooper.snoop()
def your_function(x):
...
A log will be written to stderr showing the lines executed and variables
ch... | mit | Python |
1c322fdecf1adeb52feb477b10fb5b39a68a436d | update setup | vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa,vespa-engine/vespa | python/vespa/setup.py | python/vespa/setup.py | import os
import setuptools
licenses = {
"apache2": (
"Apache Software License 2.0",
"OSI Approved :: Apache Software License",
),
}
statuses = [
"1 - Planning",
"2 - Pre-Alpha",
"3 - Alpha",
"4 - Beta",
"5 - Production/Stable",
"6 - Mature",
"7 - Inactive",
]
py_ve... | import os
import setuptools
licenses = {
"apache2": (
"Apache Software License 2.0",
"OSI Approved :: Apache Software License",
),
}
statuses = [
"1 - Planning",
"2 - Pre-Alpha",
"3 - Alpha",
"4 - Beta",
"5 - Production/Stable",
"6 - Mature",
"7 - Inactive",
]
py_ve... | apache-2.0 | Python |
1f1745f3148c4d3049e9421f1d85e516294ca8d4 | Improve package level docstring | scottza/PyTOPKAPI,sahg/PyTOPKAPI | pytopkapi/__init__.py | pytopkapi/__init__.py | """
PyTOPKAPI is a BSD licensed Python package implementing the TOPKAPI
Hydrological model (Liu and Todini, 2002). The model is a
physically-based and fully distributed hydrological model, which has
already been successfully applied in several countries around the
world (Liu and Todini, 2002; Bartholomes and Todini, 20... | """Package providing an implementation of the TOPKAPI model and some utilities.
The interface isn't stable yet so be prepared to update your code
on a regular basis...
"""
try:
from __dev_version import version as __version__
from __dev_version import git_revision as __git_revision__
except ImportError:
... | bsd-3-clause | Python |
723bd0bd018f725f41e9df5534e7711d6d3510df | fix for csv url | seantis/seantis-questionnaire,JanOosting/ed-questionnaire,n3storm/seantis-questionnaire,eugena/ed-questionnaire,trantu/seantis-questionnaire,daniboy/seantis-questionnaire,eugena/seantis-questionnaire,trantu/seantis-questionnaire,affan2/ed-questionnaire,seantis/seantis-questionnaire,eugena/seantis-questionnaire,n3storm/... | questionnaire/urls.py | questionnaire/urls.py | # vim: set fileencoding=utf-8
from django.conf.urls.defaults import *
from views import *
urlpatterns = patterns('',
url(r'^$',
questionnaire, name='questionnaire_noargs'),
url(r'^csv/(?P<qid>\d+)/',
export_csv, name='export_csv'),
url(r'^(?P<runcode>[^/]+)/(?P<qs>\d+)/$',
... | # vim: set fileencoding=utf-8
from django.conf.urls.defaults import *
from views import *
urlpatterns = patterns('',
url(r'^$',
questionnaire, name='questionnaire_noargs'),
url(r'^(?P<runcode>[^/]+)/(?P<qs>\d+)/$',
questionnaire, name='questionset'),
url(r'^(?P<runcode>[^/]+)/',
... | bsd-3-clause | Python |
4078fb49acedcf5c72865053e160d33e96619bad | Reduce reporting of weather string shortening | kevinkahn/softconsole,kevinkahn/softconsole | stores/weathprov/providerutils.py | stores/weathprov/providerutils.py | import logsupport
import config
import json
from logsupport import ConsoleWarning, ConsoleDetail
WeathProvs = {}
TermShortener = {}
GenericShortener = {
'moderate': 'mdrt',
'patchy': 'pchy',
'chance': 'chc',
'freezing': 'frzing',
'light': 'lt',
'heavy': 'hvy',
'shower': 'shwr',
'showers': 'shwrs',
'drizzle'... | import logsupport
import config
import json
from logsupport import ConsoleWarning
WeathProvs = {}
TermShortener = {}
GenericShortener = {
'moderate': 'mdrt',
'patchy': 'pchy',
'chance': 'chc',
'freezing': 'frzing',
'light': 'lt',
'heavy': 'hvy',
'shower': 'shwr',
'drizzle': 'drzl',
'rain': 'rn',
'snow': 's... | apache-2.0 | Python |
b68bf4c1b2ff2e152311adeb0b88e1192d5c4093 | Update version for local development | willkg/douglas,willkg/douglas | Pyblosxom/_version.py | Pyblosxom/_version.py | #######################################################################
# This file is part of Pyblosxom.
#
# Copyright (C) 2003-2011 by the Pyblosxom team. See AUTHORS.
#
# Pyblosxom is distributed under the MIT license. See the file
# LICENSE for distribution details.
###############################################... | #######################################################################
# This file is part of Pyblosxom.
#
# Copyright (C) 2003-2011 by the Pyblosxom team. See AUTHORS.
#
# Pyblosxom is distributed under the MIT license. See the file
# LICENSE for distribution details.
###############################################... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.