commit
stringlengths
40
40
old_file
stringlengths
4
236
new_file
stringlengths
4
236
old_contents
stringlengths
1
3.26k
new_contents
stringlengths
16
4.43k
subject
stringlengths
16
624
message
stringlengths
17
3.29k
lang
stringclasses
5 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
73457f6c4a0dde5b5eb2c35992cd0f4d221cea06
machete/issues/models.py
machete/issues/models.py
import thunderdome from machete.base import BaseVertex, BaseEdge class Issue(BaseVertex): description = thunderdome.String() class Severity(BaseVertex): name = thunderdome.String() class AssignedTo(BaseEdge): pass
import thunderdome from machete.base import BaseVertex, BaseEdge class Issue(BaseVertex): """Represents an issue in machete and associated information.""" description = thunderdome.String() @property def severity(self): """ Returns the severity associated with this issue :rty...
Add Properties and Caliber Relationship Between Issue and Severity
Add Properties and Caliber Relationship Between Issue and Severity
Python
bsd-3-clause
rustyrazorblade/machete,rustyrazorblade/machete,rustyrazorblade/machete
e22aee1c56289a81ca3d4b5fdf0f97cc8235d870
twitter_feed/templatetags/twitter_tags.py
twitter_feed/templatetags/twitter_tags.py
from django import template from twitter.models import Tweet register = template.Library() @register.assignment_tag def latest_tweets(number_of_tweets=2): try: tweets = Tweet.objects.filter( user__active=True).order_by('-time')[:number_of_tweets] except (ValueError, AssertionError): ...
from django import template from twitter.models import Tweet register = template.Library() @register.assignment_tag def latest_tweets(number_of_tweets=2): try: tweets = Tweet.objects.filter( user__active=True).order_by('-time')[:number_of_tweets] except (ValueError, AssertionError, TypeEr...
Handle TypeError for python 3.4.
Handle TypeError for python 3.4.
Python
mit
CIGIHub/wagtail-twitter-feed
478afbc2178850d209d5d5d4c0626581b601f208
cutepaste/tests/conftest.py
cutepaste/tests/conftest.py
import os import pytest from pyvirtualdisplay import Display from selenium.webdriver import Chrome from selenium.webdriver.chrome.options import Options REPORTS_DIR = "reports" @pytest.fixture(scope='function') def webdriver(request): display = Display(visible=0, size=(800, 600), use_xauth=True) display.sta...
import os import pytest from pyvirtualdisplay import Display from selenium.webdriver import Chrome from selenium.webdriver.chrome.options import Options REPORTS_DIR = "reports" @pytest.fixture(scope='function') def webdriver(request): display = Display(visible=0, size=(800, 600), use_xauth=True) display.sta...
Add an implicit wait of 1 second
Add an implicit wait of 1 second
Python
apache-2.0
msurdi/cutepaste,msurdi/cutepaste,msurdi/cutepaste
8c3782e676e27bf6b3512ea390ad789698ba331c
memegen/routes/_cache.py
memegen/routes/_cache.py
import logging import yorm from yorm.types import List, Object log = logging.getLogger(__name__) @yorm.attr(items=List.of_type(Object)) @yorm.sync("data/images/cache.yml") class Cache: SIZE = 9 def __init__(self): self.items = [] def add(self, **kwargs): if kwargs['key'] == 'custom':...
import logging import yorm from yorm.types import List, Object log = logging.getLogger(__name__) @yorm.attr(items=List.of_type(Object)) @yorm.sync("data/images/cache.yml") class Cache: SIZE = 9 def __init__(self): self.items = [] def add(self, **kwargs): if kwargs['key'] == 'custom' ...
Disable caching of identical images
Disable caching of identical images
Python
mit
DanLindeman/memegen,DanLindeman/memegen,DanLindeman/memegen,DanLindeman/memegen
839bd6c7d9f4247d4717fb97a3d18d480dc678f4
chemfiles/find_chemfiles.py
chemfiles/find_chemfiles.py
# -* coding: utf-8 -* import os from ctypes import cdll from ctypes.util import find_library from chemfiles import ffi ROOT = os.path.dirname(__file__) def load_clib(): ''' Load chemfiles C++ library, and set the environment as needed. ''' os.environ['CHEMFILES_PLUGINS'] = os.path.join(ROOT, "molfil...
# -* coding: utf-8 -* import os from ctypes import cdll from ctypes.util import find_library from chemfiles import ffi ROOT = os.path.dirname(__file__) def load_clib(): '''Load chemfiles C++ library''' libpath = find_library("chemfiles") if not libpath: # Rely on the library built by the setup.p...
Remove all reference to molfiles plugins
Remove all reference to molfiles plugins
Python
mpl-2.0
Luthaf/Chemharp-python
2c0407d85c54c64d4b619bbae5add1f1da1574d0
scripts/merge_benchmarks.py
scripts/merge_benchmarks.py
import pandas as pd import argparse import os if __name__=='__main__': """ Merge benchmark output for all scenarios, methods and settings """ parser = argparse.ArgumentParser(description='Collect all benchmarks') parser.add_argument('-o', '--output', required=True, help='output file') parser....
import pandas as pd import argparse import os if __name__=='__main__': """ Merge benchmark output for all scenarios, methods and settings """ parser = argparse.ArgumentParser(description='Collect all benchmarks') parser.add_argument('-o', '--output', required=True, help='output file') parser....
Check for empty files when merging benchmarks
Check for empty files when merging benchmarks
Python
mit
theislab/scib,theislab/scib
c1cfef3cd92b60c3f8db2e5aae8a57c201dd27c7
main.py
main.py
# -*- coding: utf-8 -*- # traitement global des fichiers wav import os,numpy,octaveIO,string,subprocess def createDataFiles(): if not os.path.exists('data'): os.makedirs('data') print "Please add some data, I don't work for free" else: res = [] for root, dirs, files in os.walk...
# -*- coding: utf-8 -*- # traitement global des fichiers wav import os,numpy,octaveIO,string,subprocess def createDataFiles(): if not os.path.exists('data'): os.makedirs('data') print "Please add some data, I don't work for free" else: res = [] for root, dirs, files in os.walk...
Call au lieu de Popen pour synchroniser
Call au lieu de Popen pour synchroniser
Python
mit
tomsib2001/speaker-recognition,tomsib2001/speaker-recognition
5549af8fd6213fbe849e3d2578290bc8616360ab
standup/wsgi.py
standup/wsgi.py
""" WSGI config for standup project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application from raven.contrib.django.raven_com...
""" WSGI config for standup project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/ """ import os from django.core.cache.backends.memcached import BaseMemcachedCache from django.core.w...
Add monkeypatch to prevent connection closing for memcachier
Add monkeypatch to prevent connection closing for memcachier
Python
bsd-3-clause
mozilla/standup,mozilla/standup,mozilla/standup,mozilla/standup
5e66b10c3f99e683ffbab1c074583436dd791901
tests/test_runner.py
tests/test_runner.py
import asyncio from pytest import mark, raises from oshino.run import main from mock import patch def create_loop(): loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) return loop @mark.integration @patch("oshino.core.heart.forever", lambda: False) @patch("oshino.core.heart.create_loop", crea...
import asyncio from pytest import mark, raises from oshino.run import main from mock import patch def create_loop(): loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) return loop def error_stub(): raise RuntimeError("Simply failing") @mark.integration @patch("oshino.core.heart.forever",...
Use normal function instead of lambda for this
Use normal function instead of lambda for this
Python
mit
CodersOfTheNight/oshino
192c92fba3836f2073576674495faa42799cdb95
tests/test_sqlite.py
tests/test_sqlite.py
import testinfra.utils.ansible_runner testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( '.molecule/ansible_inventory').get_hosts('sqlite') def test_package(Package): p = Package('pdns-backend-sqlite3') assert p.is_installed def test_database_exists(File): f = File('/var/lib/powerdns/p...
import testinfra.utils.ansible_runner testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( '.molecule/ansible_inventory').get_hosts('sqlite') debian_os = ['debian', 'ubuntu'] rhel_os = ['redhat', 'centos'] def test_package(Package, SystemInfo): p = None if SystemInfo.distribution in debian_os...
Fix sqlite test on CentOS
Fix sqlite test on CentOS
Python
mit
PowerDNS/pdns-ansible
b6978852775bb48e400a31a1e464d7b596db13f2
fsictools.py
fsictools.py
# -*- coding: utf-8 -*- """ fsictools ========= Supporting tools for FSIC-based economic models. See the individual docstrings for dependencies additional to those of `fsic`. """ # Version number keeps track with the main `fsic` module from fsic import __version__ import re from typing import List from fsic import B...
# -*- coding: utf-8 -*- """ fsictools ========= Supporting tools for FSIC-based economic models. See the individual docstrings for dependencies additional to those of `fsic`. """ # Version number keeps track with the main `fsic` module from fsic import __version__ import re from typing import List from fsic import B...
Update type annotations to reference package names in full
TYP: Update type annotations to reference package names in full
Python
mit
ChrisThoung/fsic
4e78179d81f5e3da6d9981f60133089347a81caf
txsni/snimap.py
txsni/snimap.py
from OpenSSL.SSL import Context, TLSv1_METHOD from twisted.internet.ssl import ContextFactory from txsni.only_noticed_pypi_pem_after_i_wrote_this import ( certificateOptionsFromPileOfPEM ) class SNIMap(ContextFactory, object): def __init__(self, mapping): self.mapping = mapping try: ...
from twisted.internet.ssl import CertificateOptions, ContextFactory from txsni.only_noticed_pypi_pem_after_i_wrote_this import ( certificateOptionsFromPileOfPEM ) class SNIMap(ContextFactory, object): def __init__(self, mapping): self.mapping = mapping try: self.context = self.mapp...
Create a properly configured SSL Context
Create a properly configured SSL Context
Python
mit
glyph/txsni
2a0326f4fa379ee74e548b0d3701092caf28e0b4
examples/tsa/ex_arma2.py
examples/tsa/ex_arma2.py
""" Autoregressive Moving Average (ARMA) Model """ import numpy as np import statsmodels.api as sm # Generate some data from an ARMA process from statsmodels.tsa.arima_process import arma_generate_sample arparams = np.array([.75, -.25]) maparams = np.array([.65, .35]) # The conventions of the arma_generate function ...
""" Autoregressive Moving Average (ARMA) Model """ import numpy as np import statsmodels.api as sm # Generate some data from an ARMA process from statsmodels.tsa.arima_process import arma_generate_sample np.random.seed(12345) arparams = np.array([.75, -.25]) maparams = np.array([.65, .35]) # The conventions of the a...
Add seed to example and use stationary coefs
EX: Add seed to example and use stationary coefs
Python
bsd-3-clause
pprett/statsmodels,wdurhamh/statsmodels,bashtage/statsmodels,YihaoLu/statsmodels,cbmoore/statsmodels,wzbozon/statsmodels,musically-ut/statsmodels,wzbozon/statsmodels,pprett/statsmodels,josef-pkt/statsmodels,ChadFulton/statsmodels,jstoxrocky/statsmodels,jstoxrocky/statsmodels,musically-ut/statsmodels,edhuckle/statsmodel...
fd5e21705d8f7757cf345c8c98af260203c44517
malcolm/modules/__init__.py
malcolm/modules/__init__.py
class Importer(object): def __init__(self): self.update_dict = {} self.ignore = ["docs"] def import_subpackages(self, path): import os dirname = os.path.join(os.path.dirname(__file__), *path) for f in os.listdir(dirname): if f not in self.ignore and os.path.i...
class Importer(object): def __init__(self): self.update_dict = {} self.dirnames = [ "vmetas", "infos", "controllers", "parts", "includes", "blocks"] def import_subpackages(self, path, filter=()): import os dirname = os.path.join(os.path.dirname(__file__), *path) ...
Improve import logic for clearer error messages
Improve import logic for clearer error messages
Python
apache-2.0
dls-controls/pymalcolm,dls-controls/pymalcolm,dls-controls/pymalcolm
74ea104c81908976dfe0c708d2dfd8d7eb10f0cc
mayatools/transforms.py
mayatools/transforms.py
import re from maya import cmds from . import context def transfer_global_transforms(dst_to_src, time_range=None): """Bake global transform from one node onto another. :param dict dst_to_src: Mapping nodes to transfer transformations onto, to the nodes to source those transformations from. :par...
import re from maya import cmds from . import context def transfer_global_transforms(dst_to_src, time_range=None): """Bake global transform from one node onto another. :param dict dst_to_src: Mapping nodes to transfer transformations onto, to the nodes to source those transformations from. :par...
Fix angle flips with a Euler filter
Locators: Fix angle flips with a Euler filter
Python
bsd-3-clause
westernx/mayatools,westernx/mayatools
a73a4b3373ad032ac2ad02426fef8a23314d5826
test/test_external_libs.py
test/test_external_libs.py
import unittest from test.util import ykman_cli class TestExternalLibraries(unittest.TestCase): def test_ykman_version(self): output = ykman_cli('-v') # Test that major version is 1 on all libs self.assertIn('libykpers 1', output) self.assertIn('libu2f-host 1', output) sel...
import unittest import os from test.util import ykman_cli @unittest.skipIf( os.environ.get('INTEGRATION_TESTS') != 'TRUE', 'INTEGRATION_TESTS != TRUE') class TestExternalLibraries(unittest.TestCase): def test_ykman_version(self): output = ykman_cli('-v') # Test that major version is 1 on all ...
Revert "Don't check INTEGRATION_TESTS env var in external libs test"
Revert "Don't check INTEGRATION_TESTS env var in external libs test" This reverts commit 648d02fbfca79241a65902f6dd9a7a767a0f633d.
Python
bsd-2-clause
Yubico/yubikey-manager,Yubico/yubikey-manager
14a7ce543192dc5104af370a0b3d08301241ad8b
ord_hackday/search/views.py
ord_hackday/search/views.py
from django.shortcuts import render from ord_hackday.search.models import Portal import requests import json def search(request): c = {} if 'query' in request.GET: query = request.GET['query'] if len(query) > 0: portals = Portal.objects.all() c['portals'] = portals ...
from django.shortcuts import render from ord_hackday.search.models import Portal import requests import json def search(request): c = {} if 'query' in request.GET: query = request.GET['query'] if len(query) > 0: portals = Portal.objects.all() c['portals'] = portals ...
Return constructed URL for each result.
Return constructed URL for each result.
Python
mit
bellisk/opendata-multisearch,bellisk/opendata-multisearch
a2762922b98c3733f103a631cd3ef346ab5bb54f
examples/pax_mininet_node.py
examples/pax_mininet_node.py
# coding: latin-1 """ pax_mininet_node.py: Defines PaxNode which allows Pax to behave as the sole packet hander on a node. """ from mininet.node import Node from mininet.log import info, warn class PaxNode( Node ): "PaxNode: A node which allows Pax to behave as the sole packet hander on that node." def __in...
# coding: latin-1 """ pax_mininet_node.py: Defines PaxNode which allows Pax to behave as the sole packet hander on a node. """ from mininet.node import Node from mininet.log import info, warn class PaxNode( Node ): "PaxNode: A node which allows Pax to behave as the sole packet hander on that node." def __in...
Remove print statement from PaxNode config method
Remove print statement from PaxNode config method
Python
apache-2.0
TMVector/pax,TMVector/pax,niksu/pax,niksu/pax,niksu/pax
92d23c145c450f8ff0345aa6a5ea000c856e764d
indra/sources/tas/__init__.py
indra/sources/tas/__init__.py
"""This module provides and API and processor to the Target Affinity Spectrum data set compiled by N. Moret in the Laboratory of Systems Pharmacology at HMS. This data set is based on experiments as opposed to the manually curated drug-target relationships provided in the LINCS small molecule dataset.""" from .api imp...
"""This module provides and API and processor to the Target Affinity Spectrum data set compiled by N. Moret in the Laboratory of Systems Pharmacology at HMS. This data set is based on experiments as opposed to the manually curated drug-target relationships provided in the LINCS small molecule dataset. Moret, N., et al...
Add citation to TAS docs
Add citation to TAS docs
Python
bsd-2-clause
johnbachman/belpy,johnbachman/belpy,sorgerlab/belpy,sorgerlab/indra,pvtodorov/indra,pvtodorov/indra,johnbachman/indra,bgyori/indra,pvtodorov/indra,pvtodorov/indra,bgyori/indra,bgyori/indra,sorgerlab/indra,sorgerlab/indra,johnbachman/indra,johnbachman/indra,sorgerlab/belpy,sorgerlab/belpy,johnbachman/belpy
f77b17cca1686ea082a5a71d18dfe4ca01699b3e
raxcli/utils.py
raxcli/utils.py
# Copyright 2013 Rackspace # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the...
# Copyright 2013 Rackspace # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the...
Add 'reverse' argument to get_enum_as_dict.
Add 'reverse' argument to get_enum_as_dict.
Python
apache-2.0
racker/python-raxcli
1ba14774b1ed483f512562ab83f91fab8b843db7
nazs/web/core/blocks.py
nazs/web/core/blocks.py
from django.utils.translation import ugettext as _ from achilles import blocks, tables import nazs register = blocks.Library('core') @register.block(template_name='web/core/welcome.html') def home(): return {'version': nazs.__version__} @register.block(template_name='web/core/apply_button.html') def apply_but...
from django.utils.translation import ugettext as _ from achilles import blocks, tables import nazs register = blocks.Library('core') @register.block(template_name='web/core/welcome.html') def home(): return {'version': nazs.__version__} @register.block(template_name='web/core/apply_button.html') def apply_but...
Add proper css classes to action buttons
Add proper css classes to action buttons
Python
agpl-3.0
exekias/droplet,exekias/droplet,exekias/droplet
fc9339307e2e9ef97c59d4512e4de5ff5a43bca0
falcon_hateoas/middleware.py
falcon_hateoas/middleware.py
import json import decimal import sqlalchemy class AlchemyJSONEncoder(json.JSONEncoder): def default(self, o): # if isinstance(getattr(o, 'metadata'), sqlalchemy.schema.MetaData): if issubclass(o.__class__, sqlalchemy.ext.declarative.DeclarativeMeta.__class__): d ...
import json import decimal import sqlalchemy class AlchemyJSONEncoder(json.JSONEncoder): def default(self, o): # if isinstance(getattr(o, 'metadata'), sqlalchemy.schema.MetaData): if issubclass(o.__class__, sqlalchemy.ext.declarative.DeclarativeMeta): d = {} ...
Fix comparing with __class__ of class
Fix comparing with __class__ of class Signed-off-by: Michal Juranyi <29976087921aeab920eafb9b583221faa738f3f4@vnet.eu>
Python
mit
Vnet-as/falcon-hateoas
c0c73dd73f13e8d1d677cc2d7cad5c2f63217751
python/tests/test_rmm.py
python/tests/test_rmm.py
import pytest import functools from itertools import product import numpy as np from numba import cuda from libgdf_cffi import libgdf from librmm_cffi import ffi, librmm from .utils import new_column, unwrap_devary, get_dtype, gen_rand, fix_zeros from .utils import buffer_as_bits _dtypes = [np.int32] _nelems = [12...
import pytest import functools from itertools import product import numpy as np from numba import cuda from librmm_cffi import librmm as rmm from .utils import gen_rand _dtypes = [np.int32] _nelems = [1, 2, 7, 8, 9, 32, 128] @pytest.mark.parametrize('dtype,nelem', list(product(_dtypes, _nelems))) def test_rmm_allo...
Improve librmm python API and convert all pytests to use RMM to create device_arrays.
Improve librmm python API and convert all pytests to use RMM to create device_arrays.
Python
apache-2.0
gpuopenanalytics/libgdf,gpuopenanalytics/libgdf,gpuopenanalytics/libgdf,gpuopenanalytics/libgdf
46aecccbf543619342dca65a777292ccacbed970
src/map_data.py
src/map_data.py
from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import numpy as np from config import ul, lr from get_data import get_dataset def draw_map(file, map=None, show=True): '''Use Matplotlib's basemap to generate a map of a given BIOCLIM data file. You can supply a Basemap object (in ...
from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import numpy as np from config import ul, lr from read_headers import variable_names from get_data import get_dataset def draw_map(file, map=None, show=True, title=None): '''Use Matplotlib's basemap to generate a map of a given BIOCLIM data ...
Use human-readable variable name in map figure title.
Use human-readable variable name in map figure title.
Python
mit
bendmorris/pybioclim,bendmorris/pybioclim,xguse/pybioclim
1351e9ddd8416d35695a2ebb573fc4570d0efe06
coveralls.py
coveralls.py
#!/bin/env/python import os import sys from subprocess import call if __name__ == '__main__': if 'TRAVIS' in os.environ: rc = call('coveralls') raise SystemExit(rc)
#!/bin/env/python import os from contextlib import suppress from distutils.sysconfig import get_python_lib from subprocess import call if __name__ == '__main__': # chdir to the site-packages directory so the report lists relative paths dot_coverage_path = os.path.join(os.getcwd(), '.coverage') os.chdir(...
Create coverage reports with relative paths
Create coverage reports with relative paths
Python
bsd-2-clause
jayvdb/citeproc-py
c9ecacdb04f3f8df4f85057ad0d3c69df9481122
core/utils/check_sanity.py
core/utils/check_sanity.py
import os from core.exceptions.Exceptions import OPAMConfigurationExeception def check_environment() -> bool: __opam_env__ = [ 'CAML_LD_LIBRARY_PATH', 'MANPATH', 'PERL5LIB', 'OCAML_TOPLEVEL_PATH', 'PATH' ] for var in __opam_env__: if not os.environ.get(var...
import os from core.utils.Executor import _convert_subprocess_cmd import subprocess from core.exceptions.Exceptions import OPAMConfigurationExeception def check_environment() -> bool: __opam_env__ = [ 'CAML_LD_LIBRARY_PATH', 'MANPATH', 'PERL5LIB', 'OCAML_TOPLEVEL_PATH', 'P...
Check if mirage is installed
Check if mirage is installed
Python
apache-2.0
onyb/dune,adyasha/dune,adyasha/dune,adyasha/dune
f72a40ef9f757d162a54706ff90b3f5cb10452ab
csdms/dakota/bmi_dakota.py
csdms/dakota/bmi_dakota.py
#!/usr/bin/env python """Basic Model Interface for the Dakota iterative systems analysis toolkit.""" from basic_modeling_interface import Bmi from .core import Dakota class BmiDakota(Bmi): """Perform a Dakota experiment on a component.""" _name = 'Dakota' def __init__(self): """Create a BmiDak...
#!/usr/bin/env python """Basic Model Interface for the Dakota iterative systems analysis toolkit.""" from basic_modeling_interface import Bmi from .core import Dakota class BmiDakota(Bmi): """Perform a Dakota experiment on a component.""" _name = 'Dakota' def __init__(self): """Create a BmiDak...
Add time methods to BmiDakota
Add time methods to BmiDakota
Python
mit
csdms/dakota,csdms/dakota
514e41f8cb3717f3fcd0c1283e60e9f202b79598
saddle-points/saddle_points.py
saddle-points/saddle_points.py
def saddle_points(m): mt = transpose(m) if not m == transpose(mt): raise ValueError return set((i, j) for i, row in enumerate(m) for j, col in enumerate(mt) if (row[j] == min(row) and col[i] == max(col)) or (row[j] == max(row) and col[i] == min(col))) def transpose(...
def saddle_points(m): mt = transpose(m) if not m == transpose(mt): raise ValueError return set((i, j) for i, row in enumerate(m) for j, col in enumerate(mt) if (row[j] == max(row) and col[i] == min(col))) def transpose(m): return [list(col) for col in zip(*m)]
Correct it to actually follow the README...
Correct it to actually follow the README...
Python
agpl-3.0
CubicComet/exercism-python-solutions
6bc68fa898083a696c931ca4fff82984eeec3131
acquisition/tomviz/acquisition/__init__.py
acquisition/tomviz/acquisition/__init__.py
from abc import abstractmethod, ABCMeta class AbstractSource(object): __metaclass__ = ABCMeta @abstractmethod def set_tilt_angle(self, angle): pass @abstractmethod def preview_scan(self): pass @abstractmethod def stem_acquire(self): pass
from abc import abstractmethod, ABCMeta class AbstractSource(object): """ Abstract interface implemented to define an acquistion source. """ __metaclass__ = ABCMeta @abstractmethod def set_tilt_angle(self, angle): """ Set the tilt angle. :param angle: The title angle t...
Add doc strings to AbstractSource
Add doc strings to AbstractSource
Python
bsd-3-clause
mathturtle/tomviz,mathturtle/tomviz,OpenChemistry/tomviz,mathturtle/tomviz,cjh1/tomviz,OpenChemistry/tomviz,thewtex/tomviz,cryos/tomviz,cjh1/tomviz,cryos/tomviz,OpenChemistry/tomviz,thewtex/tomviz,thewtex/tomviz,cryos/tomviz,OpenChemistry/tomviz,cjh1/tomviz
ce4a588f0104498f5cd2491d85ef39806eb2ba7f
tests/filter_integration_tests/test_filters_with_mongo_storage.py
tests/filter_integration_tests/test_filters_with_mongo_storage.py
from tests.base_case import ChatBotMongoTestCase class RepetitiveResponseFilterTestCase(ChatBotMongoTestCase): """ Test case for the RepetitiveResponseFilter class. """ def test_filter_selection(self): """ Test that repetitive responses are filtered out of the results. """ ...
from tests.base_case import ChatBotMongoTestCase class RepetitiveResponseFilterTestCase(ChatBotMongoTestCase): """ Test case for the RepetitiveResponseFilter class. """ def test_filter_selection(self): """ Test that repetitive responses are filtered out of the results. """ ...
Put the calculated value on the right
Put the calculated value on the right
Python
bsd-3-clause
gunthercox/ChatterBot,vkosuri/ChatterBot
7abfa8d52565855cfa1c55c0622b5d599cd04c2f
spiff/subscription/management/commands/process_subscriptions.py
spiff/subscription/management/commands/process_subscriptions.py
from django.core.management import BaseCommand from spiff.payment.models import Invoice from spiff.subscription.models import SubscriptionPlan from spiff.api.plugins import find_api_classes from spiff.membership.utils import monthRange from spiff.membership.models import Member, RankLineItem class Command(BaseCommand)...
from django.core.management import BaseCommand from spiff.payment.models import Invoice from spiff.subscription.models import SubscriptionPlan from spiff.api.plugins import find_api_classes from spiff.membership.utils import monthRange from spiff.membership.models import Member, RankLineItem import stripe class Comman...
Set invoices to non-draft when done
Set invoices to non-draft when done
Python
agpl-3.0
SYNHAK/spiff,SYNHAK/spiff,SYNHAK/spiff
2621e71926942113e8c9c85fe48d7448a790f916
bluebottle/bb_organizations/serializers.py
bluebottle/bb_organizations/serializers.py
from rest_framework import serializers from bluebottle.utils.model_dispatcher import get_organization_model, get_organizationmember_model ORGANIZATION_MODEL = get_organization_model() MEMBER_MODEL = get_organizationmember_model() ORGANIZATION_FIELDS = ( 'id', 'name', 'slug', 'address_line1', 'address_line2', ...
from rest_framework import serializers from bluebottle.utils.model_dispatcher import get_organization_model, get_organizationmember_model ORGANIZATION_MODEL = get_organization_model() MEMBER_MODEL = get_organizationmember_model() ORGANIZATION_FIELDS = ( 'id', 'name', 'slug', 'address_line1', 'address_line2', ...
Remove person from organization serializer
Remove person from organization serializer
Python
bsd-3-clause
onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle
a8066d91dc0d1e37514de0623bf382b55abcf4c7
esridump/cli.py
esridump/cli.py
import argparse import simplejson as json from esridump.dumper import EsriDumper def main(): parser = argparse.ArgumentParser() parser.add_argument("url") parser.add_argument("outfile", type=argparse.FileType('w')) parser.add_argument("--jsonlines", action='store_true', default=False) args = parse...
import argparse import simplejson as json from esridump.dumper import EsriDumper def main(): parser = argparse.ArgumentParser() parser.add_argument("url") parser.add_argument("outfile", type=argparse.FileType('w')) parser.add_argument("--jsonlines", action='store_true', default=False) args = parse...
Remove the extra comma at the end.
Remove the extra comma at the end. Fixes #7
Python
mit
iandees/esri-dump,openaddresses/pyesridump
eb0714767cf5c0fd89ff4e50e22445a5e436f94c
iopath/tabular/tabular_io.py
iopath/tabular/tabular_io.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from typing import Any, Iterable from iopath.common.file_io import PathHandler class TabularUriParser: def parse_uri(self, uri: str) -> None: pass class TabularPathHandler(PathHandler): def _opent( self, path: str, mod...
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from typing import Any from iopath.common.file_io import PathHandler, TabularIO class TabularUriParser: def parse_uri(self, uri: str) -> None: pass class TabularPathHandler(PathHandler): def _opent( self, path: str, mo...
Update type signature of AIRStorePathHandler.opent()
Update type signature of AIRStorePathHandler.opent() Summary: The previous diff updated the type signature of the `PathHandler.opent()` method to return a custom context manager. Here, we update the return type of the overriden `AIRStorePathHandler.opent()` method to return an implementation of the `PathHandlerContext...
Python
mit
facebookresearch/iopath,facebookresearch/iopath
6aad731cd3808e784530e8632cf778c2b9e19543
gcsa/util/date_time_util.py
gcsa/util/date_time_util.py
from datetime import datetime, timedelta, date import pytz from tzlocal import get_localzone def get_utc_datetime(dt, *args, **kwargs): if isinstance(dt, datetime): return dt.isoformat() else: return datetime(dt, *args, **kwargs).isoformat() def date_range(start_date, day_count): for n ...
from datetime import datetime, date import pytz from tzlocal import get_localzone def insure_localisation(dt, timezone=str(get_localzone())): """Insures localisation with provided timezone on "datetime" object. Does nothing to object of type "date".""" if isinstance(dt, datetime): tz = pytz.tim...
Remove unused functions from util
Remove unused functions from util
Python
mit
kuzmoyev/Google-Calendar-Simple-API
a95f6806ab4e591cfb404624631306932fd69e85
ninja/__init__.py
ninja/__init__.py
import os import platform import subprocess import sys from ._version import get_versions __version__ = get_versions()['version'] del get_versions DATA = os.path.join(os.path.dirname(__file__), 'data') # Support running tests from the source tree if not os.path.exists(DATA): _data = os.path.abspath(os.path.join...
import os import platform import subprocess import sys from ._version import get_versions __version__ = get_versions()['version'] del get_versions DATA = os.path.join(os.path.dirname(__file__), 'data') # Support running tests from the source tree if not os.path.exists(DATA): _data = os.path.abspath(os.path.join...
Fix lookup of ninja executable on MacOSX
ninja: Fix lookup of ninja executable on MacOSX
Python
apache-2.0
scikit-build/ninja-python-distributions
db9afab144c12391c9c54174b8973ec187455b9c
webpack/conf.py
webpack/conf.py
import os from optional_django import conf class Conf(conf.Conf): # Environment configuration STATIC_ROOT = None STATIC_URL = None BUILD_SERVER_URL = 'http://127.0.0.1:9009' OUTPUT_DIR = 'webpack_assets' CONFIG_DIRS = None CONTEXT = None # Watching WATCH = True # TODO: should def...
import os from optional_django import conf class Conf(conf.Conf): # Environment configuration STATIC_ROOT = None STATIC_URL = None BUILD_SERVER_URL = 'http://127.0.0.1:9009' OUTPUT_DIR = 'webpack_assets' CONFIG_DIRS = None CONTEXT = None # Watching WATCH = False AGGREGATE_TIME...
WATCH now defaults to False
WATCH now defaults to False
Python
mit
markfinger/python-webpack,markfinger/python-webpack
46816c4d8470192e76e730969ddcedeb8391fdcf
setup.py
setup.py
#!/usr/bin/env python from distutils.core import setup setup(name="Neighborhoodize", version='0.9', description='Utility for translating lat, long coordinates into ' 'neighborhoods in various cities', author='Brian Lange', author_email='brian.lange@datascopeanalytics.com', ...
#!/usr/bin/env python from distutils.core import setup setup(name="Neighborhoodize", version='0.9', description='Utility for translating lat, long coordinates into ' 'neighborhoods in various cities', author='Brian Lange', author_email='brian.lange@datascopeanalytics.com', ...
Add download url for pypi
Add download url for pypi
Python
mit
bjlange/neighborhoodize
bd7035cbb762d93494e55db56e06d6dbccf3c7e1
setup.py
setup.py
from distutils.core import setup setup(name="stellar-magnate", version="0.1", description="A space-themed commodity trading game", long_description=""" Stellar Magnate is a space-themed trading game in the spirit of Planetary Travel, a trading game for the Apple IIe by Brian Winn. """, ...
from distutils.core import setup setup(name="stellar-magnate", version="0.1", description="A space-themed commodity trading game", long_description=""" Stellar Magnate is a space-themed trading game in the spirit of Planetary Travel by Brian Winn. """, author="Toshio Kuratomi", ...
Correct classifiers from the pypi trove entries
Correct classifiers from the pypi trove entries
Python
agpl-3.0
abadger/stellarmagnate
2d052b49151ea4fb8e0a422d8d743f49de593a04
filter_plugins/filterciscohash.py
filter_plugins/filterciscohash.py
#!/usr/bin/env python import passlib.hash class FilterModule(object): def filters(self): return { 'ciscohash5': self.ciscohash5, 'ciscohash7': self.ciscohash7, 'ciscohashpix': self.ciscohashpix, 'ciscohashasa': self.ciscohashasa } def ciscohash5...
#!/usr/bin/env python import passlib.hash # Version 1.7.0 introduced `passlib.hash.md5_crypt.using(salt_size=...)`. try: md5_crypt = passlib.hash.md5_crypt.using except AttributeError: md5_crypt = passlib.hash.md5_crypt class FilterModule(object): def filters(self): return { 'ciscohas...
Add support for Passlib versions prior to 1.7
Add support for Passlib versions prior to 1.7
Python
bsd-2-clause
mjuenema/ansible-filter-cisco-hash
2be2b71dbd3aba4d7aee2c54102eeac45252c5ed
drftutorial/catalog/views.py
drftutorial/catalog/views.py
from django.http import HttpResponse from rest_framework.response import Response from rest_framework.views import APIView from .models import Product from .serializers import ProductSerializer class ProductList(APIView): def get(self, request, format=None): products = Product.objects.all() serial...
from django.http import HttpResponse from rest_framework.response import Response from rest_framework.views import APIView from rest_framework import status from .models import Product from .serializers import ProductSerializer class ProductList(APIView): def get(self, request, format=None): products = Pr...
Add POST method to ProductList class
Add POST method to ProductList class
Python
mit
andreagrandi/drf-tutorial
cbfa5d916585524212193f476db4affa38eed5a8
pythymiodw/pyro/__init__.py
pythymiodw/pyro/__init__.py
import os import Pyro4 import subprocess import signal from pythymiodw import ThymioSimMR class ThymioMR(): def __init__(self): self.pyro4daemon_proc=subprocess.Popen(['python -m pythymiodw.pyro.__main__'], stdout=subprocess.PIPE, shell=True, preexec_fn=os.setsid) self.robot = Pyro4.Proxy('PYRONAME:pythymiod...
import os import Pyro4 import subprocess import signal from pythymiodw import ThymioSimMR import time from pythymiodw.io import ProxGround class ThymioMR(): def __init__(self): self.pyro4daemon_proc=subprocess.Popen(['python -m pythymiodw.pyro.__main__'], stdout=subprocess.PIPE, shell=True, preexec_fn=os.setsid) ...
Add sleep, and prox_ground, prox_horizontal.
Add sleep, and prox_ground, prox_horizontal.
Python
mit
kurniawano/pythymiodw
bc7c389ac00348792fd3346a454704cdf9f48416
django_lightweight_queue/backends/redis.py
django_lightweight_queue/backends/redis.py
from __future__ import absolute_import # For 'redis' import redis from ..job import Job from .. import app_settings class RedisBackend(object): KEY = 'django_lightweight_queue' def __init__(self): self.client = redis.Redis( host=app_settings.REDIS_HOST, port=app_settings.REDI...
from __future__ import absolute_import # For 'redis' import redis from ..job import Job from .. import app_settings class RedisBackend(object): KEY = 'django_lightweight_queue' def __init__(self): self.client = redis.Redis( host=app_settings.REDIS_HOST, port=app_settings.REDI...
Fix Redis backend; BLPOP takes multiple lists.
Fix Redis backend; BLPOP takes multiple lists. Signed-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@thread.com>
Python
bsd-3-clause
thread/django-lightweight-queue,thread/django-lightweight-queue,prophile/django-lightweight-queue,lamby/django-lightweight-queue,prophile/django-lightweight-queue
ab5edd504789e8fad3dcf0f30b0fbec8608e2abe
django_nyt/urls.py
django_nyt/urls.py
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import unicode_literals from django.conf.urls import patterns, url urlpatterns = patterns( '', url('^json/get/$', 'django_nyt.views.get_notifications', name='json_get'), url('^json/get/(?P<latest_id>\d+)/$', ...
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import unicode_literals from django import VERSION as DJANGO_VERSION from django.conf.urls import url urlpatterns = [ url('^json/get/$', 'django_nyt.views.get_notifications', name='json_get'), url('^json/get/(?P<latest_id>\d+)/$', ...
Use list instead of patterns()
Use list instead of patterns()
Python
apache-2.0
benjaoming/django-nyt,benjaoming/django-nyt
f6f6ae78a865a3c8bcb28c16157168470264e59b
tasks.py
tasks.py
from invocations.docs import docs, www, sites, watch_docs from invocations.testing import test, integration, coverage, watch_tests from invocations import packaging from invoke import Collection from invoke.util import LOG_FORMAT ns = Collection( docs, www, test, coverage, integration, sites, watch_docs, wat...
from invocations.docs import docs, www, sites, watch_docs from invocations.testing import test, integration, coverage, watch_tests, count_errors from invocations import packaging from invoke import Collection from invoke.util import LOG_FORMAT ns = Collection( docs, www, test, coverage, integration, sites, watch...
Use new invocations error counter for testing thread sleeps etc
Use new invocations error counter for testing thread sleeps etc
Python
bsd-2-clause
fabric/fabric
847143cd60986c6558167a8ad28a778b09330a7c
gocd/server.py
gocd/server.py
import urllib2 from urlparse import urljoin from gocd.api import Pipeline class Server(object): def __init__(self, host, user=None, password=None): self.host = host self.user = user self.password = password if self.user and self.password: self._add_basic_auth() ...
import urllib2 from urlparse import urljoin from gocd.api import Pipeline class Server(object): def __init__(self, host, user=None, password=None): self.host = host self.user = user self.password = password if self.user and self.password: self._add_basic_auth() ...
Remove hard coded realm and assume any is fine
Remove hard coded realm and assume any is fine
Python
mit
henriquegemignani/py-gocd,gaqzi/py-gocd
9088d706e08317241ab8238020780d6140507589
colour/adaptation/__init__.py
colour/adaptation/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from .dataset import * from . import dataset from .vonkries import ( chromatic_adaptation_matrix_VonKries, chromatic_adaptation_VonKries) from .fairchild1990 import chromatic_adaptation_Fairchild1990 from .cmccat2000 import (...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from .dataset import * from . import dataset from .vonkries import ( chromatic_adaptation_matrix_VonKries, chromatic_adaptation_VonKries) from .fairchild1990 import chromatic_adaptation_Fairchild1990 from .cmccat2000 import (...
Fix various documentation related warnings.
Fix various documentation related warnings.
Python
bsd-3-clause
colour-science/colour
56661432ea78f193346fe8bcf33bd19a2e1787bc
tests/test_manager.py
tests/test_manager.py
def test_ensure_authority(manager_transaction): authority = manager_transaction.ensure_authority( name='Test Authority', rank=0, cardinality=1234 ) assert authority.name == 'Test Authority' assert authority.rank == 0 assert authority.cardinality == 1234
def test_ensure_authority(manager_transaction): authority1 = manager_transaction.ensure_authority( name='Test Authority', rank=0, cardinality=1234 ) assert authority1.name == 'Test Authority' assert authority1.rank == 0 assert authority1.cardinality == 1234 authority2 = ...
Test ensure_authority for both nonexistent and already existing Authority records.
Test ensure_authority for both nonexistent and already existing Authority records.
Python
mit
scolby33/OCSPdash,scolby33/OCSPdash,scolby33/OCSPdash
462fafa047b05d0e11b9a730ecfb8e1be9dc675a
pattern_matcher/regex.py
pattern_matcher/regex.py
import re class RegexFactory(object): """Generates a regex pattern.""" WORD_GROUP = '({0}|\*)' SEP = '/' def _generate_pattern(self, path): """Generates a regex pattern.""" # Split the path up into a list using the forward slash as a # delimiter. words = (word for word...
import re class RegexFactory(object): """Generates a regex pattern.""" WORD_GROUP = '({0}|\*)' SEP = '/' def _generate_pattern(self, path): """Generates a regex pattern.""" # Split the path up into a list using the forward slash as a # delimiter. words = (word for word...
Make create a class method.
Make create a class method.
Python
mit
damonkelley/pattern-matcher
0e471ed468c0f43f8f8b562ca9cc7d44869f53b2
hermes/views.py
hermes/views.py
from django.views.generic import ListView, DetailView from .models import Post class PostListView(ListView): context_object_name = 'posts' model = Post template_name = 'hermes/post_list.html' class CategoryPostListView(PostListView): def get_queryset(self): category_slug = self.kwargs.get('...
from django.views.generic import ListView, DetailView from .models import Post class PostListView(ListView): context_object_name = 'posts' model = Post template_name = 'hermes/post_list.html' def get_queryset(self): return self.model.objects.order_by('-created_on') class CategoryPostLi...
Order posts by the creation date
Order posts by the creation date
Python
mit
emilian/django-hermes
d9c2a7112ba239fb64ecc76ce844caed9146a5dc
nova/db/sqlalchemy/migrate_repo/versions/023_add_vm_mode_to_instances.py
nova/db/sqlalchemy/migrate_repo/versions/023_add_vm_mode_to_instances.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2011 OpenStack 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 # ...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2011 OpenStack 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 # ...
Load table schema automatically instead of stubbing out
Load table schema automatically instead of stubbing out
Python
apache-2.0
barnsnake351/nova,NeCTAR-RC/nova,zaina/nova,NewpTone/stacklab-nova,russellb/nova,Juniper/nova,tangfeixiong/nova,JioCloud/nova,affo/nova,NewpTone/stacklab-nova,gspilio/nova,maoy/zknova,SUSE-Cloud/nova,josephsuh/extra-specs,vmturbo/nova,usc-isi/nova,russellb/nova,psiwczak/openstack,ewindisch/nova,TieWei/nova,dstroppa/ope...
332dbcb5eb0badccb843cdbdd167dcfa4b446352
rpmlint.conf.py
rpmlint.conf.py
from Config import * # Not sure what this number does, but we need some threshold that we'd like to # avoid crossing. setOption("BadnessThreshold", 42) # Ignore all lint warnings in submodules: addFilter('third_party/submodules/') # Ignore all lint warnings in symlinks from submodules. addFilter('SPECS/cmake.spec') a...
from Config import * # Not sure what this number does, but we need some threshold that we'd like to # avoid crossing. setOption("BadnessThreshold", 42) # Ignore all lint warnings in submodules: addFilter('third_party/submodules/') # Ignore all lint warnings in symlinks from submodules. addFilter('SPECS/cmake.spec') a...
Allow mixed-use-of-spaces-and-tabs in specific line of the spec file.
vim: Allow mixed-use-of-spaces-and-tabs in specific line of the spec file.
Python
apache-2.0
vrusinov/copr-sundry,google/copr-sundry,google/copr-sundry,vrusinov/copr-sundry
fa54689fada175aa10ee1b096e73a0cd33aa702b
pmxbot/buffer.py
pmxbot/buffer.py
import logging import irc.buffer log = logging.getLogger(__name__) class ErrorReportingBuffer(irc.buffer.LineBuffer): encoding = 'utf-8' def lines(self): lines = super().lines() for line in lines: try: yield line.decode(self.encoding) except UnicodeDecodeError: log.error("Unable to decode line:...
import logging import irc.buffer import irc.client log = logging.getLogger(__name__) class ErrorReportingBuffer(irc.buffer.LineBuffer): encoding = 'utf-8' def lines(self): lines = super().lines() for line in lines: try: yield line.decode(self.encoding) except UnicodeDecodeError: log.error("Unab...
Correct AttributeError when client isn't explicitly imported.
Correct AttributeError when client isn't explicitly imported.
Python
mit
yougov/pmxbot,yougov/pmxbot,yougov/pmxbot
01d95de1a2fc9bc7283f72e4225d49a5d65af15b
poyo/patterns.py
poyo/patterns.py
# -*- coding: utf-8 -*- INDENT = r"(?P<indent>^ *)" VARIABLE = r"(?P<variable>.+):" VALUE = r"(?P<value>(?:(?P<q2>['\"]).*?(?P=q2))|[^#]+?)" NEWLINE = r"$\n" BLANK = r" +" INLINE_COMMENT = r"(?: +#.*)?" COMMENT = r"^ *#.*" + NEWLINE BLANK_LINE = r"^[ \t]*" + NEWLINE DASHES = r"^---" + NEWLINE SECTION = INDENT + VARI...
# -*- coding: utf-8 -*- INDENT = r"(?P<indent>^ *)" VARIABLE = r"(?P<variable>.+):" VALUE = r"(?P<value>(?:(?P<q2>['\"]).*?(?P=q2))|[^#]+?)" NEWLINE = r"$\n" BLANK = r" +" INLINE_COMMENT = r"(?: +#.*)?" COMMENT = r"^ *#.*" + NEWLINE BLANK_LINE = r"^[ \t]*" + NEWLINE DASHES = r"^---" + NEWLINE SECTION = INDENT + VARI...
Implement regex pattern for list values
Implement regex pattern for list values
Python
mit
hackebrot/poyo
a4efdb71c2c067af52d871711632eba0c06dc811
django_extensions/jobs/daily/daily_cleanup.py
django_extensions/jobs/daily/daily_cleanup.py
""" Daily cleanup job. Can be run as a cronjob to clean out old data from the database (only expired sessions at the moment). """ from django_extensions.management.jobs import DailyJob class Job(DailyJob): help = "Django Daily Cleanup Job" def execute(self): from django.core import management ...
""" Daily cleanup job. Can be run as a cronjob to clean out old data from the database (only expired sessions at the moment). """ from django_extensions.management.jobs import DailyJob class Job(DailyJob): help = "Django Daily Cleanup Job" def execute(self): from django.core import management ...
Use Django's VERSION to determine which cleanup command to call
Use Django's VERSION to determine which cleanup command to call
Python
mit
marctc/django-extensions,jpadilla/django-extensions,frewsxcv/django-extensions,gvangool/django-extensions,nikolas/django-extensions,haakenlid/django-extensions,ctrl-alt-d/django-extensions,django-extensions/django-extensions,helenst/django-extensions,helenst/django-extensions,github-account-because-they-want-it/django-...
db1ded6aa53b41f8b6e90fb45236560d492eed47
addie/utilities/__init__.py
addie/utilities/__init__.py
import os from qtpy.uic import loadUi def load_ui(ui_filename, baseinstance): cwd = os.getcwd() ui_filename = os.path.split(ui_filename)[-1] # get the location of the designer directory # this function assumes that all ui files are there filename = os.path.join(cwd, 'designer', ui_filename) r...
import os from qtpy.uic import loadUi import addie addie_path = os.path.dirname(os.path.abspath(addie.__file__)) designer_path = os.path.join(addie_path, '../designer') def load_ui(ui_filename, baseinstance): ui_filename = os.path.split(ui_filename)[-1] # get the location of the designer directory # thi...
Fix ui designer dir location
Fix ui designer dir location
Python
mit
neutrons/FastGR,neutrons/FastGR,neutrons/FastGR
713da17448f7d6c23c8527c737b9c9c03dea5d80
adhocracy4/emails/mixins.py
adhocracy4/emails/mixins.py
from email.mime.image import MIMEImage from django.contrib.staticfiles import finders from .base import EmailBase class PlatformEmailMixin: """ Attaches the static file images/logo.png so it can be used in an html email. """ def get_attachments(self): attachments = super().get_attachments...
from email.mime.image import MIMEImage from django.contrib.staticfiles import finders from .base import EmailBase class PlatformEmailMixin: """ Attaches the static file images/logo.png so it can be used in an html email. """ def get_attachments(self): attachments = super().get_attachments...
Fix missing close for email logo file handle
Fix missing close for email logo file handle
Python
agpl-3.0
liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4
bf853b3e215f1a9018007cb6efc5cc027c447a33
examples/books_collection/collection/forms.py
examples/books_collection/collection/forms.py
from flaskext import wtf from collection.documents import Book class BookForm(wtf.Form): document_class = Book title = wtf.TextField(validators=[wtf.Required()]) year = wtf.IntegerField(validators=[wtf.Required()]) _instance = None def __init__(self, document=None, *args, **kwargs): super(...
from flaskext import wtf from collection.documents import Book class BookForm(wtf.Form): document_class = Book title = wtf.TextField(validators=[wtf.Required()]) year = wtf.IntegerField(validators=[wtf.Required()]) instance = None def __init__(self, document=None, *args, **kwargs): super(B...
Document instance made acessible on form
Document instance made acessible on form
Python
bsd-2-clause
cobrateam/flask-mongoalchemy
9608e32ded51ce87e890fd880044f252c6574ea5
examples/aiohttp_server.py
examples/aiohttp_server.py
from aiohttp import web from jsonrpcserver.aio import methods @methods.add async def ping(): return 'pong' async def handle(request): request = await request.text() response = await methods.dispatch(request) if response.is_notification: return web.Response() else: return web.json_r...
from aiohttp import web from jsonrpcserver.aio import methods @methods.add async def ping(): return 'pong' async def handle(request): request = await request.text() response = await methods.dispatch(request) if response.is_notification: return web.Response() else: return web.json_r...
Return http status in aiohttp example
Return http status in aiohttp example
Python
mit
bcb/jsonrpcserver
0fa1370d7ee04f373f11b844295f1706686a0cc5
account_bank_reconciliation_summary_xlsx/__manifest__.py
account_bank_reconciliation_summary_xlsx/__manifest__.py
# -*- coding: utf-8 -*- # © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'Account Bank Statement Reconciliation Summary', 'version': '10.0.1.0.0', 'license': 'AGPL-3', 'author': "Akretion,Odoo Community Associa...
# -*- coding: utf-8 -*- # © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'Bank Reconciliation Report', 'version': '10.0.1.0.0', 'license': 'AGPL-3', 'author': "Akretion,Odoo Community Association (OCA)", 'w...
Update module name and summary
Update module name and summary
Python
agpl-3.0
OCA/account-financial-reporting,OCA/account-financial-reporting,OCA/account-financial-reporting
6ee60074bfcf9fcd0e1b1f36b4c0324f41532d6d
integrationtests/mayavi/test_mlab_envisage.py
integrationtests/mayavi/test_mlab_envisage.py
from mayavi import mlab from pyface.api import GUI def close(): """Close the scene.""" f = mlab.gcf() e = mlab.get_engine() e.window.workbench.prompt_on_exit = False e.window.close() def test_mlab_envisage(): """Test if mlab runs correctly when the backend is set to 'envisage'.""" @mla...
from mayavi import mlab from pyface.api import GUI def close(): """Close the scene.""" f = mlab.gcf() e = mlab.get_engine() e.window.workbench.prompt_on_exit = False e.window.close() # Hack: on Linux the splash screen does not go away so we force it. GUI.invoke_after(500, e.window.workbench...
Stop event loop after test completes.
BUG: Stop event loop after test completes.
Python
bsd-3-clause
alexandreleroux/mayavi,dmsurti/mayavi,alexandreleroux/mayavi,liulion/mayavi,dmsurti/mayavi,liulion/mayavi
ff2d82744d1dc268a901c7d3458463bf04c1a6e8
saleor/plugins/migrations/0004_drop_support_for_env_vatlayer_access_key.py
saleor/plugins/migrations/0004_drop_support_for_env_vatlayer_access_key.py
from django.db import migrations def assign_access_key(apps, schema): vatlayer_configuration = ( apps.get_model("plugins", "PluginConfiguration") .objects.filter(identifier="mirumee.taxes.vatlayer") .first() ) if vatlayer_configuration: vatlayer_configuration.active = Fals...
from django.db import migrations def deactivate_vatlayer(apps, schema): vatlayer_configuration = ( apps.get_model("plugins", "PluginConfiguration") .objects.filter(identifier="mirumee.taxes.vatlayer") .first() ) if vatlayer_configuration: vatlayer_configuration.active = Fa...
Change migration name to more proper
Change migration name to more proper
Python
bsd-3-clause
mociepka/saleor,mociepka/saleor,mociepka/saleor
ec30e6355fd9ea9cc22217ece7c9dab2640f6786
filmfest/settings/pytest.py
filmfest/settings/pytest.py
from .base import * # noqa SECRET_KEY = 'test' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'test_db.sqlite3'), } }
from .base import * # noqa SECRET_KEY = 'test' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'test_db.sqlite3'), } } WAGTAILSEARCH_BACKENDS = { 'default': { 'BACKEND': 'wagtail.wagtailsearch.backends.db', } }
Use db search backend instead of elastic in tests
Use db search backend instead of elastic in tests
Python
unlicense
nott/next.filmfest.by,kinaklub/next.filmfest.by,kinaklub/next.filmfest.by,kinaklub/next.filmfest.by,kinaklub/next.filmfest.by,nott/next.filmfest.by,nott/next.filmfest.by,nott/next.filmfest.by
0fbd7c2f68f9f751642fd0e618dfcb6726d79f44
fireplace/cards/wog/mage.py
fireplace/cards/wog/mage.py
from ..utils import * ## # Minions
from ..utils import * ## # Minions class OG_083: "Twilight Flamecaller" play = Hit(ENEMY_MINIONS, 1) class OG_120: "Anomalus" deathrattle = Hit(ALL_MINIONS, 8) class OG_207: "Faceless Summoner" play = Summon(CONTROLLER, RandomMinion(cost=3))
Implement Twilight Flamecaller, Anomalus, Faceless Summoner
Implement Twilight Flamecaller, Anomalus, Faceless Summoner
Python
agpl-3.0
NightKev/fireplace,jleclanche/fireplace,beheh/fireplace
ba0f726ff1a777adc028110dfa94524399adb4ab
imager/ImagerProfile/admin.py
imager/ImagerProfile/admin.py
from django.contrib import admin from imagerprofile.models import ImagerProfile from django.contrib.auth.admin import UserAdmin from django.contrib.auth.models import User # admin.site.unregister(User) class ImagerUserInline(admin.StackedInline): model = ImagerProfile can_delete = False verbose_name_plur...
from django.contrib import admin from imagerprofile.models import ImagerProfile from django.contrib.auth.admin import UserAdmin from django.contrib.auth.models import User class ImagerUserInline(admin.StackedInline): model = ImagerProfile can_delete = False verbose_name_plural = 'imager user' extra = ...
Remove Imager Profile form when creating new user, only displays when editing existing user to prevent Integrity Error
Remove Imager Profile form when creating new user, only displays when editing existing user to prevent Integrity Error
Python
mit
nbeck90/django-imager,nbeck90/django-imager
92d9e9885e241e0bb7df64d3cd696db09cdfc74d
utils.py
utils.py
#!/usr/bin/env python # -*- coding: utf-8 -*- def fix_str(value): try: return unicode(value) except UnicodeDecodeError: return unicode(value.decode('latin1')) def pandas_to_dict(df): return [{colname: (fix_str(row[i]) if type(row[i]) is str else row[i]) for i, colname in enume...
#!/usr/bin/env python # -*- coding: utf-8 -*- def fix_str(value): try: return unicode(value) except UnicodeDecodeError: return unicode(value.decode('latin1')) def pandas_to_dict(df): return [{colname: (fix_str(row[i]) if type(row[i]) is str else row[i]) for i, colname in enume...
Remove columns filter on pandas_to_dict
Remove columns filter on pandas_to_dict
Python
mit
mlgruby/mining,mlgruby/mining,mining/mining,chrisdamba/mining,jgabriellima/mining,chrisdamba/mining,AndrzejR/mining,seagoat/mining,jgabriellima/mining,mining/mining,avelino/mining,AndrzejR/mining,seagoat/mining,mlgruby/mining,avelino/mining
e39fadc6fead884fc3457fa7629fc8d1c72f5240
views.py
views.py
from django.http import HttpResponse from django.core.cache import cache from mixcloud.utils.decorators import staff_only from mixcloud.speedbar.utils import DETAILS_PREFIX, TRACE_PREFIX from gargoyle.decorators import switch_is_active import json @staff_only @switch_is_active('speedbar:panel') def panel(request, tra...
from django.http import HttpResponse from django.core.cache import cache from mixcloud.utils.decorators import staff_only from mixcloud.speedbar.utils import DETAILS_PREFIX, TRACE_PREFIX from mixcloud.utils.decorators import json_response from gargoyle.decorators import switch_is_active import json @staff_only @switc...
Use json decorator where appropriate
Use json decorator where appropriate
Python
mit
theospears/django-speedbar,mixcloud/django-speedbar,mixcloud/django-speedbar,theospears/django-speedbar,mixcloud/django-speedbar,theospears/django-speedbar
64671712fb465a9e940484a5f2f4b8d673aaee75
words.py
words.py
"""Function to fetch words.""" import random WORDLIST = 'wordlist.txt' def get_random_word(min_word_length): """Get a random word from the wordlist using no extra memory.""" num_words_processed = 0 curr_word = None with open(WORDLIST, 'r') as f: for word in f: if len(word) < min_...
"""Function to fetch words.""" import random WORDLIST = 'wordlist.txt' def get_random_word(min_word_length): """Get a random word from the wordlist using no extra memory.""" num_words_processed = 0 curr_word = None with open(WORDLIST, 'r') as f: for word in f: word = word.strip()...
Enforce lowercase on word selection
Enforce lowercase on word selection
Python
mit
andrewyang96/HangmanGame
2f98576b4b4fe5ec55c4125e2b9105dbef4e5900
hedonist/config.py
hedonist/config.py
"""Configuration data for training or evaluating a reinforcement learning agent. """ import agents def get_config(): config = { 'game': 'BreakoutDeterministic-v3', 'agent_type': agents.DeepQLearner, 'history_length': 4, 'training_steps': 50000000, 'training_freq': 4, ...
"""Configuration data for training or evaluating a reinforcement learning agent. """ import agents def get_config(): config = { 'game': 'BreakoutDeterministic-v3', 'agent_type': agents.DoubleDeepQLearner, 'history_length': 4, 'training_steps': 50000000, 'training_freq': 4, ...
Switch to Double DQN as the default algorithm.
Switch to Double DQN as the default algorithm.
Python
mit
nerdoid/hedonist
9ae4ebf7e95cb301321911886cbb4041fae1eff6
bookmarks/search_indexes.py
bookmarks/search_indexes.py
from haystack.indexes import CharField, DateTimeField, RealTimeSearchIndex, Indexable from models import Bookmark class BookmarkIndex(RealTimeSearchIndex, Indexable): text = CharField(document=True, use_template=True) title = CharField(model_attr='description') author = CharField(model_attr='adder') ...
from haystack.indexes import CharField, DateTimeField, SearchIndex, Indexable from models import Bookmark class BookmarkIndex(SearchIndex, Indexable): text = CharField(document=True, use_template=True) title = CharField(model_attr='description') author = CharField(model_attr='adder') pub_date = DateT...
Use `SearchIndex` instead of deprecated `RealTimeSearchIndex`.
Use `SearchIndex` instead of deprecated `RealTimeSearchIndex`.
Python
mit
incuna/incuna-bookmarks,incuna/incuna-bookmarks
8efd4b8661f5be47c04130de6d47c8b80c39454c
selvbetjening/core/events/management/commands/recalculate_attend_columns.py
selvbetjening/core/events/management/commands/recalculate_attend_columns.py
from django.core.management.base import NoArgsCommand from selvbetjening.core.events.models import Attend class Command(NoArgsCommand): def handle_noargs(self, **options): attendees = Attend.objects.select_related().prefetch_related('selection_set') for attendee in attendees: atten...
from django.core.management.base import NoArgsCommand class Command(NoArgsCommand): def handle_noargs(self, **options): from selvbetjening.core.events.models import Attend attendees = Attend.objects.select_related().prefetch_related('selection_set') for attendee in attendees: ...
Fix import that crashed the system under certain conditions
Fix import that crashed the system under certain conditions
Python
mit
animekita/selvbetjening,animekita/selvbetjening,animekita/selvbetjening,animekita/selvbetjening
e4dd3e6c260ab446ca15b203dd5628f3b300887e
submit_awcy.py
submit_awcy.py
#!/usr/bin/env python from __future__ import print_function import requests import argparse import os import subprocess import sys if 'DAALA_ROOT' not in os.environ: print("Please specify the DAALA_ROOT environment variable to use this tool.") sys.exit(1) keyfile = open('secret_key','r') key = keyfile.read(...
#!/usr/bin/env python from __future__ import print_function import requests import argparse import os import subprocess import sys if 'DAALA_ROOT' not in os.environ: print("Please specify the DAALA_ROOT environment variable to use this tool.") sys.exit(1) keyfile = open('secret_key','r') key = keyfile.read(...
Use branch name instead of username
Use branch name instead of username
Python
mit
mdinger/awcy,mdinger/awcy,tdaede/awcy,mdinger/awcy,tdaede/awcy,mdinger/awcy,tdaede/awcy,tdaede/awcy,tdaede/awcy,mdinger/awcy,tdaede/awcy
95ef52b3c80d6f639ddd988ecd209057250fef1b
tags/fields.py
tags/fields.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.db.models.fields import CharField from django.utils.translation import ugettext_lazy as _ from django.utils.encoding import python_2_unicode_compatible from tags.models import Tag @python_2_unicode_compatible class TagField(CharField): def __init__(self, ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.db.models.fields import CharField from django.utils.translation import ugettext_lazy as _ from django.utils.encoding import python_2_unicode_compatible from tags.models import Tag @python_2_unicode_compatible class TagField(CharField): def __init__(self, ...
Make the TagField be instropectable by South
Make the TagField be instropectable by South
Python
mit
avelino/django-tags
9177ffa65ac50026078610193b67fdfd6ac8358b
tests/app/utils/test_pagination.py
tests/app/utils/test_pagination.py
from app.utils.pagination import generate_next_dict, generate_previous_dict def test_generate_previous_dict(client): ret = generate_previous_dict('main.view_jobs', 'foo', 2, {}) assert 'page=1' in ret['url'] assert ret['title'] == 'Previous page' assert ret['label'] == 'page 1' def test_generate_nex...
from app.utils.pagination import generate_next_dict, generate_previous_dict def test_generate_previous_dict(client): result = generate_previous_dict('main.view_jobs', 'foo', 2, {}) assert 'page=1' in result['url'] assert result['title'] == 'Previous page' assert result['label'] == 'page 1' def test_...
Clarify variable name in pagination tests
Clarify variable name in pagination tests We should avoid using abbreviations, as they aren't universally understood i.e. they're not worth the small saving in typing.
Python
mit
alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin
2e8f42c0b5eb018309d965b01659c496bc08a08b
quickstart/python/understand/example-1/update_initial_intent.6.x.py
quickstart/python/understand/example-1/update_initial_intent.6.x.py
# Download the helper library from https://www.twilio.com/docs/python/install from twilio.rest import Client # Your Account Sid and Auth Token from twilio.com/console account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' auth_token = 'your_auth_token' client = Client(account_sid, auth_token) assistant_sid = 'UAXXXXXXXXX...
# Download the helper library from https://www.twilio.com/docs/python/install from twilio.rest import Client # Your Account Sid and Auth Token from twilio.com/console account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' auth_token = 'your_auth_token' client = Client(account_sid, auth_token) # Provide actions for your a...
Update intent actions to use assistant SID inline
Update intent actions to use assistant SID inline Maintaining consistency with the auto-generated code samples for Understand, which don't allow for our variable-named placeholder values
Python
mit
TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets,TwilioDevEd/api-snippets
af42a9c9983dbaab80945d481570d9bf11a22d3a
tweetGenerator/webserver.py
tweetGenerator/webserver.py
from http.server import BaseHTTPRequestHandler, HTTPServer import response # HTTPRequestHandler class ret = "" class ServerHandler(BaseHTTPRequestHandler): def do_GET(self): global ret # Send response status code self.send_response(200) # Send headers self.send_header(...
from http.server import BaseHTTPRequestHandler, HTTPServer import response ret = "" class ServerHandler(BaseHTTPRequestHandler): def do_GET(self): global ret # Send response status code self.send_response(200) # Send headers self.send_header('Content-type', 'application...
Add Connection: close to header
Add Connection: close to header
Python
mit
ratorx/hc-2,ratorx/hc-2,ratorx/hc-2,ratorx/hc-2
ff272cffbe70f2e306c841fd33424bb009e79ccf
conf_site/proposals/urls.py
conf_site/proposals/urls.py
from django.conf.urls import include from django.contrib.admin.views.decorators import staff_member_required from django.urls import path from conf_site.proposals.views import ExportProposalSubmittersView urlpatterns = [ path( "export/", staff_member_required(ExportProposalSubmittersView.as_view(...
from django.conf.urls import include from django.contrib.admin.views.decorators import staff_member_required from django.urls import path from conf_site.proposals.views import ExportProposalSubmittersView urlpatterns = [ path( "submitters/export/", staff_member_required(ExportProposalSubmittersVi...
Change location of proposal submitters CSV export.
Change location of proposal submitters CSV export. "/proposals/submitters/export/" is a more accurate URL than /proposals/export/", since the CSV file contains information about the people submitting proposals and not the proposals themselves.
Python
mit
pydata/conf_site,pydata/conf_site,pydata/conf_site
c254bf20bc8b4b7c73e3361d3666fb3733dbc09f
pycroscopy/processing/__init__.py
pycroscopy/processing/__init__.py
import fft import gmode_utils import cluster import proc_utils import decomposition def no_impl(*args,**kwargs): raise NotImplementedError("You need to install Multiprocess package (pip,github) to do a parallel Computation.\n" "Switching to the serial version. ") # from .feature_extr...
import fft import gmode_utils import cluster import proc_utils import decomposition def no_impl(*args,**kwargs): raise NotImplementedError("You need to install Multiprocess package (pip,github) to do a parallel Computation.\n" "Switching to the serial version. ") from .feature_extrac...
Revert "Commented out unimplemented imports"
Revert "Commented out unimplemented imports" This reverts commit f6b76db8f963d28c0a9f2875139d5e286e3bd01b.
Python
mit
pycroscopy/pycroscopy,anugrah-saxena/pycroscopy
be1b1de45b93b5c72d6d76667430a6be4c56fb75
vsmomi/_service_instance.py
vsmomi/_service_instance.py
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) from builtins import * from future.builtins.disabled import * import base64 import atexit import requests # disable warnings try: requests.packages.urllib3.disable_warnings() except AttributeErro...
# -*- coding: utf-8 -*- from __future__ import (absolute_import, division, print_function, unicode_literals) from builtins import * from future.builtins.disabled import * import base64 import atexit import requests # disable warnings try: requests.packages.urllib3.disable_warnings() except AttributeErro...
Disable SSL verification in requests.get
Disable SSL verification in requests.get
Python
apache-2.0
dahuebi/vsmomi,dahuebi/vsmomi
b2482545448f36880ca444f2604812e285bc67da
tests/plots.py
tests/plots.py
import numpy as np from pyquante2 import basisset,rhf,h2 from pyquante2.graphics.vtk import vtk_orbital from pyquante.graphics.lineplot import test_plot_orbs,test_plot_bfs def lineplot_orbs(): return test_plot_orbs() def lineplot_bfs(): return test_plot_bfs() def plot_h2(): bfs = basisset(h2,'sto3g') solv...
import numpy as np from pyquante2 import basisset,rhf,h2 from pyquante2.graphics.vtk import vtk_orbital from pyquante.graphics.lineplot import test_plot_orbs,test_plot_bfs from pyquante.graphics.contourplot import test_contour def lineplot_orbs(): return test_plot_orbs() def lineplot_bfs(): return test_plot_bfs() def ...
Test routine for contour plotting
Test routine for contour plotting
Python
bsd-3-clause
Konjkov/pyquante2,Konjkov/pyquante2,Konjkov/pyquante2
3d95d4e69e927e6f21ebad1b9730142df19eeef7
my_button.py
my_button.py
from kivy.uix.button import Button import audio as a_m class MyButton(Button): def on_touch_up(self, *args, **kwargs): a_m.instance.click() super(MyButton, self).on_touch_up(*args, **kwargs) def sim_press(self): self.state = "down" def sim_release(self): self.state = "nor...
from kivy.uix.button import Button import audio as a_m class MyButton(Button): def on_touch_up(self, *args, **kwargs): if not hasattr(self, "silent"): a_m.instance.click() super(MyButton, self).on_touch_up(*args, **kwargs) def sim_press(self): self.state = "down" def ...
Allow buttons to be silenced
Allow buttons to be silenced
Python
mit
cropleyb/pentai,cropleyb/pentai,cropleyb/pentai
b849219c476db73e11ba40900d5a558a7b3e7759
net/utils.py
net/utils.py
def looping_retry(func, *args): while True: try: return func(*args) except Exception: pass
import time def looping_retry(func, *args): while True: try: return func(*args) except Exception: time.sleep(0.5) pass
Add pause during looping retry
Add pause during looping retry
Python
mit
OpenBazaar/Network,tyler-smith/OpenBazaar-Server,tyler-smith/OpenBazaar-Server,OpenBazaar/Network,tomgalloway/OpenBazaar-Server,cpacia/OpenBazaar-Server,cpacia/OpenBazaar-Server,OpenBazaar/OpenBazaar-Server,saltduck/OpenBazaar-Server,saltduck/OpenBazaar-Server,tyler-smith/OpenBazaar-Server,saltduck/OpenBazaar-Server,cp...
3b8a54f2ce220de26741aa329ebb45ceeb3b99c5
external_file_location/__manifest__.py
external_file_location/__manifest__.py
# coding: utf-8 # @ 2016 florian DA COSTA @ Akretion # © 2016 @author Mourad EL HADJ MIMOUNE <mourad.elhadj.mimoune@akretion.com> # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { 'name': 'External File Location', 'version': '10.0.1.0.0', 'author': 'Akretion,Odoo Community Association ...
# coding: utf-8 # @ 2016 florian DA COSTA @ Akretion # © 2016 @author Mourad EL HADJ MIMOUNE <mourad.elhadj.mimoune@akretion.com> # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { 'name': 'External File Location', 'version': '10.0.1.0.0', 'author': 'Akretion,Odoo Community Association ...
Fix line lenght in manifest
Fix line lenght in manifest
Python
agpl-3.0
thinkopensolutions/server-tools,thinkopensolutions/server-tools
6ac67683c1aea8578d1b9b5ad9d41280d6789f58
schematics/types/temporal.py
schematics/types/temporal.py
from __future__ import absolute_import import datetime from time import mktime try: from dateutil.tz import tzutc, tzlocal except ImportError: raise ImportError( 'Using the datetime fields requires the dateutil library. ' 'You can obtain dateutil from http://labix.org/python-dateutil' ) f...
from __future__ import absolute_import import datetime from time import mktime try: from dateutil.tz import tzutc, tzlocal except ImportError: raise ImportError( 'Using the datetime fields requires the dateutil library. ' 'You can obtain dateutil from http://labix.org/python-dateutil' ) f...
Fix TimeStampType to use convert method
Fix TimeStampType to use convert method
Python
bsd-3-clause
nKey/schematics
ec775abe37ee6d7965e7a30ff36accec5a8dc73c
python/misc/functions.py
python/misc/functions.py
#!/usr/bin/env python def convert_filetime_to_epoch(filetime): return (filetime / 10000000) - 11644473600
#!/usr/bin/env python import socket def convert_filetime_to_epoch(filetime): return (filetime / 10000000) - 11644473600 # Can be used to test connectivity if telnet isn't installed (https://stackoverflow.com/a/33117579/399105) def test_connectivity(host, port, timeout=3): try: socket.setdefaulttimeou...
Add function to test network connectivity
Add function to test network connectivity
Python
mit
bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile
2f4365d1d8c54f4ced852ffe9824fc530ac14862
{{cookiecutter.repo_name}}/tests/test_{{cookiecutter.repo_name}}.py
{{cookiecutter.repo_name}}/tests/test_{{cookiecutter.repo_name}}.py
# -*- coding: utf-8 -*- import pytest def test_app_title(app): """Simply tests if the default app title meets the expectations. Args: app (:class:`{{cookiecutter.app_class_name}}`): Default app instance Raises: AssertionError: If the title does not match """ assert app.title == '{{c...
# -*- coding: utf-8 -*- def test_app_title(app): """Simply tests if the default app title meets the expectations. Args: app (:class:`{{cookiecutter.app_class_name}}`): Default app instance Raises: AssertionError: If the title does not match """ assert app.title == '{{cookiecutter.app...
Fix flake8 in app test
Fix flake8 in app test
Python
mit
hackebrot/cookiedozer,hackebrot/cookiedozer
319af7294f85ec8476a0cd1bda0095b59b0b0324
dpam/backends.py
dpam/backends.py
import pam from django.conf import settings from django.contrib.auth.models import User from django.contrib.auth.backends import ModelBackend class PAMBackend(ModelBackend): def authenticate(self, username=None, password=None): if pam.authenticate(username, password): try: user...
import pam from django.conf import settings from django.contrib.auth.models import User from django.contrib.auth.backends import ModelBackend class PAMBackend(ModelBackend): SERVICE = getattr(settings, 'PAM_SERVICE', 'login') def authenticate(self, username=None, password=None): if pam.authenticate(...
Add the PAM_SERVICE setting to select a custom pam service for authentication
Add the PAM_SERVICE setting to select a custom pam service for authentication
Python
bsd-2-clause
JustinAzoff/django-pam,tehmaze/django-pam,keobox/django-pam,kurojishi/django-pam
9e47c145c705351748399eb64a7686efc9e24b0a
tests/basics/memoryview2.py
tests/basics/memoryview2.py
# test memoryview accessing maximum values for signed/unsigned elements from array import array print(list(memoryview(b'\x7f\x80\x81\xff'))) print(list(memoryview(array('b', [0x7f, -0x80])))) print(list(memoryview(array('B', [0x7f, 0x80, 0x81, 0xff])))) print(list(memoryview(array('h', [0x7f00, -0x8000])))) print(lis...
# test memoryview accessing maximum values for signed/unsigned elements from array import array print(list(memoryview(b'\x7f\x80\x81\xff'))) print(list(memoryview(array('b', [0x7f, -0x80])))) print(list(memoryview(array('B', [0x7f, 0x80, 0x81, 0xff])))) print(list(memoryview(array('h', [0x7f00, -0x8000])))) print(lis...
Disable memoryview tests that overflow int conversion.
tests: Disable memoryview tests that overflow int conversion. They fail on builds with 32-bit word size.
Python
mit
SHA2017-badge/micropython-esp32,deshipu/micropython,pozetroninc/micropython,hosaka/micropython,pozetroninc/micropython,blazewicz/micropython,drrk/micropython,Peetz0r/micropython-esp32,Timmenem/micropython,blazewicz/micropython,pramasoul/micropython,alex-robbins/micropython,swegener/micropython,ryannathans/micropython,a...
729f02949842d4d5a5722a2b9b35c204748c00f7
turbosms/lib.py
turbosms/lib.py
from django.apps import apps from django.template.loader import render_to_string from turbosms.settings import IS_SMS_ENABLED, SMS_RECIPIENTS from turbosms.models import SMS def get_recipients(): if apps.is_installed('site_config'): from site_config import config if hasattr(config, 'SMS_RECIP...
from django.apps import apps from django.template.loader import render_to_string from turbosms.settings import IS_SMS_ENABLED, SMS_RECIPIENTS from turbosms.models import SMS def get_default_sms_recipients(): if apps.is_installed('site_config'): from site_config import config if hasattr(config...
Add recipients param to send_sms method.
Add recipients param to send_sms method.
Python
isc
pmaigutyak/mp-turbosms
e22d62d84e9fe518a04cb0af89c589be3c3f01a2
app/env_settings_example.py
app/env_settings_example.py
import os # ***************************** # Environment specific settings # ***************************** # The settings below can (and should) be over-ruled by OS environment variable settings # Flask settings # Generated with: import os; os.urandom(24) SECRET_KEY = '\xb9\x8d\xb5\xc2\xc4Q\xe7\x8...
import os # ***************************** # Environment specific settings # ***************************** # The settings below can (and should) be over-ruled by OS environment variable settings # Flask settings # Generated with: import os; os.urandom(24) SECRET_KEY = '\x9d|*\xbb\x82T\x83\xeb\xf52...
Set environment settings to suit localhost
Set environment settings to suit localhost
Python
bsd-2-clause
UCL-CS35/incdb-user,UCL-CS35/incdb-user,UCL-CS35/incdb-user
3bdc7250f7a40ef4b3ad5f431c6b6e3e92ccacc8
app.py
app.py
from flask import Flask, render_template, request, redirect import requests import pandas as pd from datetime import datetime from bokeh.plotting import figure, output_notebook, output_file, save app = Flask(__name__) # @app.route('/') # def main(): # return redirect('/index') @app.route('/', methods=['GET', 'PO...
from flask import Flask, render_template, request, redirect import requests import pandas as pd from datetime import datetime from bokeh.plotting import figure, output_notebook, output_file, save app = Flask(__name__) @app.route('/') def main(): return redirect('/index') @app.route('/index', methods=['GET', 'POS...
Revert "Remove redirect to avoid Chrome privacy error"
Revert "Remove redirect to avoid Chrome privacy error" This reverts commit e5322958f14b2428b74de726476fd98adae8c454.
Python
mit
gsganden/pitcher-reports,gsganden/pitcher-reports
2d6a5a494b42519a1ec849e1fa508f93653e5d33
rango/forms.py
rango/forms.py
from django import forms from rango.models import Category, Page class CategoryForm(forms.ModelForm): name = forms.CharField(max_length=128, help_text="Please enter a category name") views = forms.IntegerField(widget=forms.HiddenInput(), initial = 0) likes = forms.IntegerField(widget=forms.HiddenInput(), initial...
from django import forms from django.contrib.auth.models import User from rango.models import Category, Page, UserProfile class CategoryForm(forms.ModelForm): name = forms.CharField(max_length=128, help_text="Please enter a category name") views = forms.IntegerField(widget=forms.HiddenInput(), initial = 0) likes...
Add form classes for User and UserProfile
Add form classes for User and UserProfile
Python
mit
dnestoff/Tango-With-Django,dnestoff/Tango-With-Django
36623cddfd41e3ff7a19e83f0235300a2dfd83f8
zerver/webhooks/dialogflow/view.py
zerver/webhooks/dialogflow/view.py
# Webhooks for external integrations. from typing import Any, Dict from django.http import HttpRequest, HttpResponse from zerver.decorator import api_key_only_webhook_view from zerver.lib.actions import check_send_private_message from zerver.lib.request import REQ, has_request_variables from zerver.lib.response impor...
# Webhooks for external integrations. from typing import Any, Dict from django.http import HttpRequest, HttpResponse from zerver.decorator import api_key_only_webhook_view from zerver.lib.actions import check_send_private_message from zerver.lib.request import REQ, has_request_variables from zerver.lib.response impor...
Remove default value for email parameter.
webhooks/dialogflow: Remove default value for email parameter. The webhook view used a default value for the email, which gave non-informative errors when the webhook is incorrectly configured without the email parameter.
Python
apache-2.0
shubhamdhama/zulip,showell/zulip,showell/zulip,hackerkid/zulip,synicalsyntax/zulip,zulip/zulip,punchagan/zulip,andersk/zulip,andersk/zulip,shubhamdhama/zulip,rht/zulip,timabbott/zulip,rht/zulip,shubhamdhama/zulip,zulip/zulip,andersk/zulip,rht/zulip,synicalsyntax/zulip,punchagan/zulip,hackerkid/zulip,andersk/zulip,punch...
ee65c8783db3c305914d19e6a39e4d02fdc4a1f2
lms/djangoapps/certificates/signals.py
lms/djangoapps/certificates/signals.py
""" Signal handler for enabling self-generated certificates by default for self-paced courses. """ from celery.task import task from django.dispatch.dispatcher import receiver from certificates.models import CertificateGenerationCourseSetting from opaque_keys.edx.keys import CourseKey from xmodule.modulestore.django i...
""" Signal handler for enabling self-generated certificates by default for self-paced courses. """ from celery.task import task from django.dispatch.dispatcher import receiver from certificates.models import CertificateGenerationCourseSetting from opaque_keys.edx.keys import CourseKey from openedx.core.djangoapps.cont...
Use CourseOverview instead of modulestore.
Use CourseOverview instead of modulestore.
Python
agpl-3.0
jolyonb/edx-platform,deepsrijit1105/edx-platform,synergeticsedx/deployment-wipro,romain-li/edx-platform,amir-qayyum-khan/edx-platform,gymnasium/edx-platform,shabab12/edx-platform,longmen21/edx-platform,synergeticsedx/deployment-wipro,marcore/edx-platform,gsehub/edx-platform,waheedahmed/edx-platform,TeachAtTUM/edx-platf...
a89b6ec1bda46c63c0ff0e0a8bb44eb3eda41c1b
repo_health/gh_issues/serializers/GhIssueStatsSerializer.py
repo_health/gh_issues/serializers/GhIssueStatsSerializer.py
""" serializers.py - (C) Copyright - 2017 This software is copyrighted to contributors listed in CONTRIBUTIONS.md. SPDX-License-Identifier: MIT Author(s) of this file: J. Harding Serializer for issue stats of a GitHub repo. """ from rest_framework import serializers as s from ..models import GhIssueEvent from rep...
""" serializers.py - (C) Copyright - 2017 This software is copyrighted to contributors listed in CONTRIBUTIONS.md. SPDX-License-Identifier: MIT Author(s) of this file: J. Harding Serializer for issue stats of a GitHub repo. """ from rest_framework import serializers as s from ..models import GhIssueEvent from rep...
Add get merged count method.
Add get merged count method.
Python
mit
jakeharding/repo-health,jakeharding/repo-health,jakeharding/repo-health,jakeharding/repo-health
c43a677e19ba1d2603dd4b7907fe053561c4fa06
neutron/objects/__init__.py
neutron/objects/__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 # d...
# 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 # d...
Use dirname in object recursive import
Use dirname in object recursive import __file__ just returns the init file which there was nothing under. TrivialFix Change-Id: I39da8a50c0b9197b7a5cb3d5ca4fd95f8d739eaa
Python
apache-2.0
openstack/neutron,huntxu/neutron,openstack/neutron,eayunstack/neutron,eayunstack/neutron,huntxu/neutron,mahak/neutron,openstack/neutron,mahak/neutron,mahak/neutron,noironetworks/neutron,noironetworks/neutron
5a7f34323ce4db192f588cab503dab4f21bcb0bf
youtube_dl_server/server.py
youtube_dl_server/server.py
from paste import httpserver import argparse from .app import app """ A server for providing the app anywhere, no need for GAE """ def main(): desc=""" The youtube-dl API server. """ default_port = 9191 parser = argparse.ArgumentParser(description=desc) parser.add_argument('-p'...
from paste import httpserver import argparse from .app import app from .version import __version__ """ A server for providing the app anywhere, no need for GAE """ def main(): desc=""" The youtube-dl API server. """ default_port = 9191 parser = argparse.ArgumentParser(description=d...
Add version option to the command line arguments
Add version option to the command line arguments
Python
unlicense
jaimeMF/youtube-dl-api-server,apllicationCOM/youtube-dl-api-server,jaimeMF/youtube-dl-api-server,jaimeMF/youtube-dl-api-server,apllicationCOM/youtube-dl-api-server,apllicationCOM/youtube-dl-api-server
02c0b4d62242f9297fc945bb6fd7f86d73492c59
azure_cli/container_task.py
azure_cli/container_task.py
""" usage: azure-cli container list azure-cli container content <name> commands: list list available containers content list content of given container """ # project from cli_task import CliTask from storage_account import StorageAccount from data_collector import DataCollector from logger import ...
""" usage: azure-cli container list azure-cli container content <name> commands: list list available containers content list content of given container """ # project from cli_task import CliTask from storage_account import StorageAccount from data_collector import DataCollector from logger import ...
Add used storage account name in container info
Add used storage account name in container info When calling e.g 'container list' you get all container names but you don't know from which storage account name was used One would need to look at the config file to check which storage account name was configured which could be avoided by just adding this information t...
Python
apache-2.0
SUSE/azurectl,SUSE/azurectl,SUSE/azurectl
e16e2a669f883480329f41acbd0955920dfc83e2
Tools/send2server/s2s.py
Tools/send2server/s2s.py
# -*- coding: utf-8 -*- """ File Name: Description: s2s sets up sending files to servers via public SSH keys. Author: S. Hutchins Date Created: Tue Apr 11 12:31:17 2017 Project Name: Orthologs Project """ #import os #import logging as log #import pandas as pd #from datetime import datetime as d ##import zipfile #impo...
# -*- coding: utf-8 -*- """ File Name: Description: s2s sets up sending files to servers via public SSH keys. Author: S. Hutchins Date Created: Tue Apr 11 12:31:17 2017 Project Name: Orthologs Project """ #import os #import logging as log #import pandas as pd #from datetime import datetime as d ##import zipfile #impo...
Update description. Module needs testing.
Update description. Module needs testing.
Python
mit
datasnakes/Datasnakes-Scripts,datasnakes/Datasnakes-Scripts,datasnakes/Datasnakes-Scripts,datasnakes/Datasnakes-Scripts,datasnakes/Datasnakes-Scripts,datasnakes/Datasnakes-Scripts
28f59d245d4695de5dbcfc0302f34c46234fd116
blackgate/executor_pools.py
blackgate/executor_pools.py
# -*- coding: utf-8 -*- from blackgate.executor import QueueExecutor from tornado.ioloop import IOLoop class ExecutorPools(object): class PoolFull(Exception): pass class ExecutionTimeout(Exception): pass class ExecutionFailure(Exception): pass def __init__(self): s...
# -*- coding: utf-8 -*- from blackgate.executor import QueueExecutor from tornado.ioloop import IOLoop class ExecutorPools(object): class PoolFull(Exception): pass class ExecutionTimeout(Exception): pass class ExecutionFailure(Exception): pass def __init__(self): s...
Set max_workers the same as max_size.
Set max_workers the same as max_size.
Python
mit
soasme/blackgate