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
5d8ea747bd5f34b382cc9fef91105f3ed434c0db
pylearn2/datasets/hdf5.py
pylearn2/datasets/hdf5.py
"""Objects for datasets serialized in HDF5 format (.h5).""" import h5py from pylearn2.datasets.dense_design_matrix import DenseDesignMatrix class HDF5Dataset(DenseDesignMatrix): """Dense dataset loaded from an HDF5 file.""" def __init__(self, filename, X=None, topo_view=None, y=None, **kwargs): """ ...
"""Objects for datasets serialized in HDF5 format (.h5).""" import warnings try: import h5py except ImportError: warnings.warn("Could not import h5py") from pylearn2.datasets.dense_design_matrix import DenseDesignMatrix class HDF5Dataset(DenseDesignMatrix): """Dense dataset loaded from an HDF5 file.""" ...
Fix import issue in h5py.py
Fix import issue in h5py.py
Python
bsd-3-clause
fulmicoton/pylearn2,caidongyun/pylearn2,ddboline/pylearn2,chrish42/pylearn,CIFASIS/pylearn2,sandeepkbhat/pylearn2,aalmah/pylearn2,goodfeli/pylearn2,junbochen/pylearn2,jamessergeant/pylearn2,nouiz/pylearn2,mclaughlin6464/pylearn2,pombredanne/pylearn2,JesseLivezey/plankton,msingh172/pylearn2,w1kke/pylearn2,shiquanwang/py...
9b8cbfcf33ba644670a42490db7de4249e5ff080
invocations/docs.py
invocations/docs.py
import os from invoke.tasks import task from invoke.runner import run docs_dir = 'docs' build = os.path.join(docs_dir, '_build') @task def clean_docs(): run("rm -rf %s" % build) @task def browse_docs(): run("open %s" % os.path.join(build, 'index.html')) @task def docs(clean=False, browse=False): if...
import os from invoke.tasks import task from invoke.runner import run docs_dir = 'docs' build = os.path.join(docs_dir, '_build') @task def clean_docs(): run("rm -rf %s" % build) @task def browse_docs(): run("open %s" % os.path.join(build, 'index.html')) @task def docs(clean=False, browse=False): if...
Leverage __call__ on task downstream
Leverage __call__ on task downstream
Python
bsd-2-clause
mrjmad/invocations,alex/invocations,pyinvoke/invocations,singingwolfboy/invocations
153360072096d4a3cef783d371fbfabcd75bcf98
script/lib/config.py
script/lib/config.py
#!/usr/bin/env python import platform import sys NODE_VERSION = 'v0.11.13' BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' LIBCHROMIUMCONTENT_COMMIT = '432720d4613e3aac939f127fe55b9d44fea349e5' ARCH = { 'cygwin': '32bit', 'darwin': '64bit', 'linux2': platform.architecture()[...
#!/usr/bin/env python import platform import sys NODE_VERSION = 'v0.11.13' BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent' LIBCHROMIUMCONTENT_COMMIT = 'afb4570ceee2ad10f3caf5a81335a2ee11ec68a5' ARCH = { 'cygwin': '32bit', 'darwin': '64bit', 'linux2': platform.architecture()[...
Upgrade libchromiumcontent to loose iframe sandbox.
Upgrade libchromiumcontent to loose iframe sandbox.
Python
mit
rreimann/electron,dongjoon-hyun/electron,brave/muon,trankmichael/electron,kokdemo/electron,robinvandernoord/electron,tonyganch/electron,tylergibson/electron,natgolov/electron,sircharleswatson/electron,matiasinsaurralde/electron,vaginessa/electron,fritx/electron,benweissmann/electron,xiruibing/electron,cos2004/electron,...
5c0ace537a073f3d851ad4e490a7f2b5a0062c62
tfr/features.py
tfr/features.py
import numpy as np def mean_power(x_blocks): return np.sqrt(np.mean(x_blocks**2, axis=-1)) def power(x_blocks): return np.sqrt(np.sum(x_blocks**2, axis=-1)) def mean_energy(x_blocks): return np.mean(x_blocks**2, axis=-1) def energy(x_blocks): return np.sum(x_blocks**2, axis=-1) if __name__ == '__ma...
""" Example usage: import matplotlib.pyplot as plt from files import load_wav from analysis import split_to_blocks def analyze_mean_energy(file, block_size=1024): x, fs = load_wav(file) blocks, t = split_to_blocks(x, block_size) y = mean_energy(blocks) plt.semilogy(t, y) plt.ylim(0, 1) """ import...
Put the code into a comment as an example usage.
Put the code into a comment as an example usage.
Python
mit
bzamecnik/tfr,bzamecnik/tfr
e3c53133b71d7426695fbf24cac5b8e82311c037
seeker/middleware.py
seeker/middleware.py
from .utils import index, delete from django.db import models import logging logger = logging.getLogger(__name__) class ModelIndexingMiddleware (object): """ Middleware class that automatically indexes any new or deleted model objects. """ def __init__(self): models.signals.post_save.connect(...
from .utils import index, delete from django.db import models import logging logger = logging.getLogger(__name__) class ModelIndexingMiddleware (object): """ Middleware class that automatically indexes any new or deleted model objects. """ def __init__(self): models.signals.post_save.connect(...
Make signal dispatch_uid values more specific
Make signal dispatch_uid values more specific
Python
bsd-2-clause
imsweb/django-seeker,imsweb/django-seeker
56d92af9ba0a9b81dd0e802d05717ec6e4f511d3
seven23/api/views.py
seven23/api/views.py
""" Root views of api """ import json import os import markdown2 from django.http import HttpResponse from django.db import models from rest_framework.decorators import api_view from seven23 import settings from seven23.models.terms.models import TermsAndConditions @api_view(["GET"]) def api_init(request): ...
""" Root views of api """ import json import os import markdown2 from django.http import HttpResponse from django.db import models from rest_framework.decorators import api_view from seven23 import settings from seven23.models.terms.models import TermsAndConditions @api_view(["GET"]) def api_init(request): ...
Fix bug on API with date in Terms and Conditions not serializable
Fix bug on API with date in Terms and Conditions not serializable
Python
mit
sebastienbarbier/723e_server,sebastienbarbier/723e,sebastienbarbier/723e_server,sebastienbarbier/723e
fecf53c0c4414f50a9c3937b05d27de8c1387c45
src/hireme/tasks/task2.py
src/hireme/tasks/task2.py
# -*- coding: utf-8 -*- from . import render_task @render_task def solve(): return dict( solution='42', title='task2' )
# -*- coding: utf-8 -*- import re from flask import request from werkzeug import exceptions import numpy as np from . import render_task @render_task def solve(): input_data = request.form.get('input') method = request.method title = 'task2' if method == 'GET': return dict( titl...
Implement rudimentary task 2 solution
Implement rudimentary task 2 solution
Python
bsd-2-clause
cutoffthetop/hireme
84041a2bb517841d725781bdd72b1daf4f8e603d
spacy/ja/__init__.py
spacy/ja/__init__.py
# encoding: utf8 from __future__ import unicode_literals, print_function from os import path from ..language import Language from ..attrs import LANG from ..tokens import Doc from .language_data import * class Japanese(Language): lang = 'ja' def make_doc(self, text): try: from janome.t...
# encoding: utf8 from __future__ import unicode_literals, print_function from os import path from ..language import Language, BaseDefaults from ..tokenizer import Tokenizer from ..attrs import LANG from ..tokens import Doc from .language_data import * class JapaneseTokenizer(object): def __init__(self, cls, nlp...
Make create_tokenizer work with Japanese
Make create_tokenizer work with Japanese
Python
mit
spacy-io/spaCy,aikramer2/spaCy,recognai/spaCy,aikramer2/spaCy,raphael0202/spaCy,aikramer2/spaCy,honnibal/spaCy,spacy-io/spaCy,raphael0202/spaCy,raphael0202/spaCy,raphael0202/spaCy,spacy-io/spaCy,spacy-io/spaCy,explosion/spaCy,raphael0202/spaCy,honnibal/spaCy,explosion/spaCy,spacy-io/spaCy,explosion/spaCy,explosion/spaC...
cec423c4a1e633193ef3e639a1cb202bddc27e18
api/base/content_negotiation.py
api/base/content_negotiation.py
from rest_framework.negotiation import DefaultContentNegotiation class JSONAPIContentNegotiation(DefaultContentNegotiation): def select_renderer(self, request, renderers, format_suffix=None): """ If 'application/json' in acceptable media types, use the first renderer in DEFAULT_RENDERER_...
from rest_framework.negotiation import DefaultContentNegotiation class JSONAPIContentNegotiation(DefaultContentNegotiation): def select_renderer(self, request, renderers, format_suffix=None): """ Returns appropriate tuple (renderer, media type). If 'application/json' in acceptable media...
Add one-line summary to docstring.
Add one-line summary to docstring.
Python
apache-2.0
hmoco/osf.io,doublebits/osf.io,leb2dg/osf.io,doublebits/osf.io,erinspace/osf.io,billyhunt/osf.io,jnayak1/osf.io,felliott/osf.io,sbt9uc/osf.io,MerlinZhang/osf.io,caneruguz/osf.io,ZobairAlijan/osf.io,RomanZWang/osf.io,pattisdr/osf.io,RomanZWang/osf.io,zachjanicki/osf.io,kwierman/osf.io,ticklemepierce/osf.io,icereval/osf....
2604d759bfd9a18e5e594cfa5b50e83c73fbc2d8
devito/interfaces.py
devito/interfaces.py
import numpy as np from sympy import IndexedBase class MatrixData(IndexedBase): def __init__(self, name, shape, dtype): self.name = name self.shape = shape self.dtype = dtype self.pointer = None self.initializer = None def set_initializer(self, lambda_initializer): ...
import numpy as np from sympy import IndexedBase class DenseData(IndexedBase): def __init__(self, name, shape, dtype): self.name = name self.shape = shape self.dtype = dtype self.pointer = None self.initializer = None def set_initializer(self, lambda_initializer): ...
Change name from MatrixData to DenseData
Change name from MatrixData to DenseData
Python
mit
opesci/devito,opesci/devito
840d80c543c4688ebd1bda41b8689cf404bf755c
edit_spectide.py
edit_spectide.py
""" Edits the spectide amplitude values to some factor of their original value. WARNING: When using this on FVCOM input files, it will change the format of the variables. changeNC presumes each variable has a value and unit associated with it, whereas some of the variables in the FVCOM inputs are in fact not that so...
""" Edits the spectide amplitude values to some factor of their original value. WARNING: When using this on FVCOM input files, it will change the format of the variables. changeNC presumes each variable has a value and unit associated with it, whereas some of the variables in the FVCOM inputs are in fact not that so...
Update help to indicate where the necessary script lives
Update help to indicate where the necessary script lives
Python
mit
pwcazenave/PyFVCOM
127b90c88d1362e7b10e7bf36dff56b96a5c4f0b
simpegEM/FDEM/__init__.py
simpegEM/FDEM/__init__.py
from SurveyFDEM import * from FDEM import ProblemFDEM_e, ProblemFDEM_b, ProblemFDEM_j, ProblemFDEM_h
from SurveyFDEM import * from FDEM import BaseFDEMProblem, ProblemFDEM_e, ProblemFDEM_b, ProblemFDEM_j, ProblemFDEM_h, omega
Add more files to export on the init.
Add more files to export on the init.
Python
mit
simpeg/discretize,lheagy/simpegem,simpeg/discretize,simpeg/discretize,simpeg/simpeg,simpeg/simpegem
8ef4ca2166167f6370dd8c2f724e752210adf067
sirius/SI_V07/__init__.py
sirius/SI_V07/__init__.py
from . import lattice as _lattice from . import accelerator as _accelerator from . import family_data as _family_data from . import record_names create_accelerator = _accelerator.create_accelerator get_family_data = _family_data.get_family_data # -- default accelerator values for SI_V07 -- energy = _la...
from . import lattice as _lattice from . import accelerator as _accelerator from . import record_names create_accelerator = _accelerator.create_accelerator # -- default accelerator values for SI_V07 -- energy = _lattice._energy harmonic_number = _lattice._harmonic_number default_cavity_on = _ac...
Fix bug when family_data.py was deleted
Fix bug when family_data.py was deleted
Python
mit
lnls-fac/sirius
55072134b8053ac126213e580fcc59977cfb7a02
scikits/image/setup.py
scikits/image/setup.py
import os def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('image', parent_package, top_path) config.add_subpackage('opencv') config.add_subpackage('graph') config.add_subpackage('io') config.add_subpackage('morpho...
import os def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('image', parent_package, top_path) config.add_subpackage('opencv') config.add_subpackage('graph') config.add_subpackage('io') config.add_subpackage('morpho...
Add 'draw' and 'feature' sub-modules.
BUG: Add 'draw' and 'feature' sub-modules.
Python
bsd-3-clause
paalge/scikit-image,michaelaye/scikit-image,bennlich/scikit-image,chintak/scikit-image,paalge/scikit-image,ClinicalGraphics/scikit-image,warmspringwinds/scikit-image,michaelaye/scikit-image,chriscrosscutler/scikit-image,ClinicalGraphics/scikit-image,WarrenWeckesser/scikits-image,emmanuelle/scikits.image,Midafi/scikit-i...
7eadc9e514b1311409356f4c6c40ef8cdb2de809
manager/__init__.py
manager/__init__.py
import os from flask import Flask from flask.ext.assets import Bundle, Environment from flask.ext.bcrypt import Bcrypt from flask.ext.login import LoginManager, current_user from flask.ext.migrate import Migrate from flask.ext.sqlalchemy import SQLAlchemy app = Flask(__name__) # Load the app config app.config.from_o...
import os from flask import Flask from flask.ext.assets import Bundle, Environment from flask.ext.bcrypt import Bcrypt from flask.ext.login import LoginManager, current_user from flask.ext.migrate import Migrate from flask.ext.sqlalchemy import SQLAlchemy app = Flask(__name__) # Load the app config app.config.from_o...
Add new stuff to the css bundle
Add new stuff to the css bundle
Python
mit
hreeder/ignition,hreeder/ignition,hreeder/ignition
29ac3073b747d5bafaec240df25844d6d27c049a
marshmallow/base.py
marshmallow/base.py
# -*- coding: utf-8 -*- """Abstract base classes. These are necessary to avoid circular imports between core.py and fields.py. """ import copy class FieldABC(object): """Abstract base class from which all Field classes inherit. """ parent = None name = None def serialize(self, attr, obj, accesso...
# -*- coding: utf-8 -*- """Abstract base classes. These are necessary to avoid circular imports between core.py and fields.py. """ import copy class FieldABC(object): """Abstract base class from which all Field classes inherit. """ parent = None name = None def serialize(self, attr, obj, accesso...
Update signatures of FieldABC methods
Update signatures of FieldABC methods
Python
mit
marshmallow-code/marshmallow,mwstobo/marshmallow
9da01f39c8d9b73025d85be72b71399b6930b6fb
src/encoded/cache.py
src/encoded/cache.py
from pyramid.threadlocal import manager from sqlalchemy.util import LRUCache class ManagerLRUCache(object): """ Override capacity in settings. """ def __init__(self, name, default_capacity=100, threshold=.5): self.name = name self.default_capacity = default_capacity self.threshold ...
from pyramid.threadlocal import manager from sqlalchemy.util import LRUCache class ManagerLRUCache(object): """ Override capacity in settings. """ def __init__(self, name, default_capacity=100, threshold=.5): self.name = name self.default_capacity = default_capacity self.threshold ...
Use LRUCache correctly (minimal improvement)
Use LRUCache correctly (minimal improvement)
Python
mit
ENCODE-DCC/encoded,kidaa/encoded,hms-dbmi/fourfront,philiptzou/clincoded,ENCODE-DCC/snovault,ENCODE-DCC/snovault,hms-dbmi/fourfront,philiptzou/clincoded,ENCODE-DCC/snovault,4dn-dcic/fourfront,ClinGen/clincoded,ClinGen/clincoded,4dn-dcic/fourfront,ENCODE-DCC/snovault,4dn-dcic/fourfront,ENCODE-DCC/encoded,T2DREAM/t2dream...
0438825672a407eb30bff49e03dac89a0534f28a
minimax.py
minimax.py
class Heuristic: def __init__(self, color): self.color = color def heuristic(self, board, color): raise NotImplementedError('Dont override this class') def eval(self, vector): pass class Minimax: def __init__(self, me, challenger): self.me = me self.challenger = challenger def heurist...
class Heuristic: def __init__(self, color): self.color = color def heuristic(self, board, color): raise NotImplementedError('Dont override this class') def eval(self, vector): raise NotImplementedError('Dont override this class') class Minimax: def __init__(self, me, challenger): self.m...
Create in MinMax the calculate_min_max
Create in MinMax the calculate_min_max
Python
apache-2.0
frila/agente-minimax
3b3a8dc6aa0b38cfbb68105eb5ef31e8e73ff3a4
gcm_flask/application/models.py
gcm_flask/application/models.py
""" models.py App Engine datastore models """ from google.appengine.ext import db class ExampleModel(db.Model): """Example Model""" example_name = db.StringProperty(required=True) example_description = db.TextProperty(required=True) added_by = db.UserProperty() timestamp = db.DateTimeProperty(...
""" models.py App Engine datastore models """ from google.appengine.ext import db class ExampleModel(db.Model): """Example Model""" example_name = db.StringProperty(required=True) example_description = db.TextProperty(required=True) added_by = db.UserProperty() timestamp = db.DateTimeProperty(...
Update user who sent the message
Update user who sent the message
Python
apache-2.0
BarcampBangalore/Barcamp-Bangalore-Android-App,BarcampBangalore/Barcamp-Bangalore-Android-App,rajeefmk/Barcamp-Bangalore-Android-App,rajeefmk/Barcamp-Bangalore-Android-App,BarcampBangalore/Barcamp-Bangalore-Android-App,rajeefmk/Barcamp-Bangalore-Android-App,BarcampBangalore/Barcamp-Bangalore-Android-App,rajeefmk/Barcam...
c04b8932ec65480ba90dd4578d5f6bb8c3baa690
demosys/project/default.py
demosys/project/default.py
from demosys.project.base import BaseProject from demosys.effects.registry import effects, parse_package_string class Project(BaseProject): """ The project what will be assigned when no project are specified. This is mainly used when the ``runeffect`` command is used """ def __init__(self...
from demosys.project.base import BaseProject from demosys.effects.registry import effects, parse_package_string class Project(BaseProject): """ The project what will be assigned when no project are specified. This is mainly used when the ``runeffect`` command is used """ def __init__(self...
Improve errors when effect packages or effects are not found
Improve errors when effect packages or effects are not found
Python
isc
Contraz/demosys-py
891e8afe5deff5fe7d620abfe8189689d47ec4f8
djangocms_inherit/forms.py
djangocms_inherit/forms.py
from django import forms from django.forms.models import ModelForm from django.forms.utils import ErrorList from django.utils.translation import ugettext_lazy as _ from cms.models import Page from .models import InheritPagePlaceholder class InheritForm(ModelForm): from_page = forms.ModelChoiceField( lab...
from django import forms from django.forms.models import ModelForm try: from django.forms.utils import ErrorList except ImportError: # Django<1.7 (deprecated in Django 1.8, removed in 1.9) from django.forms.util import ErrorList from django.utils.translation import ugettext_lazy as _ from cms.models import...
Make import backward compatible (Django<1.7)
Make import backward compatible (Django<1.7)
Python
bsd-3-clause
bittner/djangocms-inherit,bittner/djangocms-inherit,divio/djangocms-inherit,divio/djangocms-inherit,divio/djangocms-inherit
db59332e3d522c68c3eeef77fe4393fe137e5059
inspectors/registration/util.py
inspectors/registration/util.py
import requests API_URL = 'https://opendata.miamidade.gov/resource/vvjq-pfmc.json' def is_valid_permit(id): # checks if the ID is a valid Miami-Dade Permit or Process Number API = API_URL + '?$where=permit_number=%27' + id + '%27%20or%20process_number=%27' + id + '%27' response = requests.get(API) js...
import requests API_URL = 'https://opendata.miamidade.gov/resource/vvjq-pfmc.json' def is_valid_permit(id): # checks if the ID is a valid Miami-Dade Permit or Process Number API = API_URL + '?$where=permit_number=%27' + id + '%27%20or%20process_number=%27' + id + '%27' response = requests.get(API) js...
Fix logic bug for API result
Fix logic bug for API result
Python
bsd-3-clause
codeforamerica/mdc-inspectors,codeforamerica/mdc-inspectors,codeforamerica/mdc-inspectors
09fa23adfb76f052473ee38de94ce4bdfdcc48e1
src/nodeconductor_assembly_waldur/packages/perms.py
src/nodeconductor_assembly_waldur/packages/perms.py
from nodeconductor.core.permissions import StaffPermissionLogic PERMISSION_LOGICS = ( ('packages.PackageTemplate', StaffPermissionLogic(any_permission=True)), ('packages.PackageComponent', StaffPermissionLogic(any_permission=True)), ('packages.OpenStackPackage', StaffPermissionLogic(any_permission=True)),...
from nodeconductor.core.permissions import StaffPermissionLogic, FilteredCollaboratorsPermissionLogic from nodeconductor.structure import models as structure_models PERMISSION_LOGICS = ( ('packages.PackageTemplate', StaffPermissionLogic(any_permission=True)), ('packages.PackageComponent', StaffPermissionLogic(...
Allow customer owner to create packages
Allow customer owner to create packages - wal-26
Python
mit
opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur
cc2b579377abde262d76e2484a6488e254b315fc
judge/caching.py
judge/caching.py
from django.core.cache import cache from django.core.cache.utils import make_template_fragment_key def update_submission(id): key = 'version:submission-%d' % id cache.add(key, 0, None) cache.incr(key) def update_stats(): cache.delete('sub_stats_table') cache.delete('sub_stats_data') def point_...
from django.core.cache import cache from django.core.cache.utils import make_template_fragment_key def update_submission(id): key = 'version:submission-%d' % id cache.add(key, 0, None) cache.incr(key) def update_stats(): cache.delete_many(('sub_stats_table', 'sub_stats_data')) def point_update(pro...
Delete many to reduce round trips to the cache.
Delete many to reduce round trips to the cache.
Python
agpl-3.0
Minkov/site,Minkov/site,DMOJ/site,Minkov/site,DMOJ/site,DMOJ/site,Phoenix1369/site,Phoenix1369/site,Minkov/site,monouno/site,Phoenix1369/site,monouno/site,monouno/site,monouno/site,monouno/site,DMOJ/site,Phoenix1369/site
05adb44cdec74256fa44ce3a3df61c6525ce7fac
dryscrape/xvfb.py
dryscrape/xvfb.py
import atexit import os _xvfb = None def start_xvfb(): from xvfbwrapper import Xvfb global _xvfb if "DISPLAY" in os.environ: del os.environ["DISPLAY"] _xvfb = Xvfb() _xvfb.start() atexit.register(_xvfb.stop) def stop_xvfb(): global _xvfb _xvfb.stop()
import atexit import os _xvfb = None def start_xvfb(): from xvfbwrapper import Xvfb global _xvfb _xvfb = Xvfb() _xvfb.start() atexit.register(_xvfb.stop) def stop_xvfb(): global _xvfb _xvfb.stop()
Remove removal of DISPLAY environment variable
Remove removal of DISPLAY environment variable The issue has to do with the two lines: ` if "DISPLAY" in os.environ: del os.environ["DISPLAY"]` This seems to remove the DISPLAY environment variable unnecessarily, as on line 50 of xvfbwrapper.py, self.orig_display is set to the value of DISPLAY. self.orig_di...
Python
mit
niklasb/dryscrape
4613daea5d9d603b5f092005627fabd805de8a45
example/app/utils.py
example/app/utils.py
from django.contrib.auth import get_user_model def disable_admin_login(): """ Disable admin login, but allow editing. amended from: https://stackoverflow.com/a/40008282/517560 """ User = get_user_model() user, created = User.objects.update_or_create( id=1, defaults=dict( ...
from django.contrib.auth import get_user_model from django.db.utils import ProgrammingError def disable_admin_login(): """ Disable admin login, but allow editing. amended from: https://stackoverflow.com/a/40008282/517560 """ User = get_user_model() try: user, created = User.objects.u...
Make initial ./manage.py migrate work in example
Make initial ./manage.py migrate work in example
Python
bsd-3-clause
zostera/django-modeltrans,zostera/django-modeltrans
118aa612ef088dba90328f1775d8603ee12e5e5b
main.py
main.py
import logging import numpy as np import settings from models import Robby def evolve(): population = np.array([Robby() for i in range(0, settings.POPULATION)]) for gen in range(0, settings.GENERATIONS): for individual in population: individual.live() new_population = list() ...
import logging import numpy as np import settings from models import Robby def evolve(): population = np.array([Robby() for i in range(0, settings.POPULATION)]) for gen in range(0, settings.GENERATIONS): for individual in population: individual.live() new_population = list() ...
Set log level to info, fixed bug with map object
Set log level to info, fixed bug with map object
Python
mit
ray-dino/robby-genetic-algorithm
351bfe236f183c069314f5df7d3c4b8f9d8699b4
final/problem6.py
final/problem6.py
# Problem 6-1 # 10.0 points possible (graded) class Person(object): def __init__(self, name): self.name = name def say(self, stuff): return self.name + ' says: ' + stuff def __str__(self): return self.name class Lecturer(Person): def lecture(self, stuff): return 'I bel...
# Problem 6-1 # 10.0 points possible (graded) class Person(object): def __init__(self, name): self.name = name def say(self, stuff): return self.name + ' says: ' + stuff def __str__(self): return self.name class Lecturer(Person): def lecture(self, stuff): return 'I bel...
Modify lecture method in ArrogantProfessor class using inheritance
Modify lecture method in ArrogantProfessor class using inheritance
Python
mit
Kunal57/MIT_6.00.1x
ff8aa2725001dbd1281357ccd5e0877257b5975d
hackernews_scrapy/items.py
hackernews_scrapy/items.py
# -*- coding: utf-8 -*- import scrapy class HackernewsScrapyItem(scrapy.Item): title = scrapy.Field()
# -*- coding: utf-8 -*- import scrapy class HackernewsScrapyItem(scrapy.Item): title = scrapy.Field() crawled_at = scrapy.Field()
Add crawled_at field to HackernewsScrapyItem
Add crawled_at field to HackernewsScrapyItem
Python
mit
mdsrosa/hackernews_scrapy
c147629b4a0a5b405f7568b9278f288fa09fd97b
tests/aggregation/models.py
tests/aggregation/models.py
# coding: utf-8 from django.db import models class Author(models.Model): name = models.CharField(max_length=100) age = models.IntegerField() friends = models.ManyToManyField('self', blank=True) def __unicode__(self): return self.name class Publisher(models.Model): name = models.CharField...
# coding: utf-8 from django.db import models class Author(models.Model): name = models.CharField(max_length=100) age = models.IntegerField() friends = models.ManyToManyField('self', blank=True) def __unicode__(self): return self.name class Publisher(models.Model): name = models.CharField...
Add a boolean field to Store model (store.has_coffee)
Add a boolean field to Store model (store.has_coffee)
Python
mit
henriquebastos/django-aggregate-if
9f6ade7fab83f15b49e37e28ac2d044a41846809
tests/test_create.py
tests/test_create.py
import globals as gbl from matador.commands import CreateTicket, CreatePackage from dulwich.repo import Repo def test_add_to_git(project_repo): pass def test_create_ticket(project_repo): CreateTicket(ticket='test-ticket') def test_create_package(project_repo): CreatePackage(package='test-package')
from matador.commands import CreateTicket, CreatePackage from dulwich.repo import Repo from pathlib import Path def test_add_to_git(project_repo): pass def test_create_ticket(session, project_repo): test_ticket = 'test-ticket' CreateTicket(ticket=test_ticket) ticket_folder = Path(project_repo, 'depl...
Add test for git commit
Add test for git commit
Python
mit
Empiria/matador
179df740725c0d3c9e256629e4718afcfa3b0cec
terminal_notifier.py
terminal_notifier.py
# This weechat plugin sends OS X notifications for weechat messages # # Install terminal-notifier, no other configuration needed. # # History: # 10-04-2015 # Version 1.0.0: initial release import distutils.spawn import os import pipes import weechat def notify(data, signal, signal_data): command = ("terminal-not...
# This weechat plugin sends OS X notifications for weechat messages # # Install terminal-notifier, no other configuration needed. # # History: # # Version 1.0.0: initial release # Version 1.0.1: fix escape characters which broke terminal-notifier import distutils.spawn import os import pipes import weechat def notif...
Fix characters which break terminal-notifier
Fix characters which break terminal-notifier If your message starts with either a [ or - (and probably more I haven't found yet) terminal-notifier blows up because of the way it parses its arguments
Python
mit
keith/terminal-notifier-weechat
b2d9234ff6353191afc434556f9cfdea2448f726
test/test_regexes.py
test/test_regexes.py
from findspam import FindSpam import pytest @pytest.mark.parametrize("text, match", [ ('18669786819 gmail customer service number 1866978-6819 gmail support number', True), ('Is there any http://www.hindawi.com/ template for Cloud-Oriented Data Center Networking?', True), ('bagprada', True), ...
from findspam import FindSpam import pytest @pytest.mark.parametrize("title, username, match", [ ('18669786819 gmail customer service number 1866978-6819 gmail support number', '', True), ('Is there any http://www.hindawi.com/ template for Cloud-Oriented Data Center Networking?', '', True), ('', '...
Update tests + add username field
Update tests + add username field
Python
apache-2.0
Charcoal-SE/SmokeDetector,NickVolynkin/SmokeDetector,ArtOfCode-/SmokeDetector,ArtOfCode-/SmokeDetector,Charcoal-SE/SmokeDetector,NickVolynkin/SmokeDetector
38c17bbafb1b193d49003cad5fb4e627625150c1
pyfibot/modules/module_geoip.py
pyfibot/modules/module_geoip.py
from __future__ import unicode_literals, print_function, division import pygeoip import os.path import sys import socket DATAFILE = os.path.join(sys.path[0], "GeoIP.dat") # STANDARD = reload from disk # MEMORY_CACHE = load to memory # MMAP_CACHE = memory using mmap gi4 = pygeoip.GeoIP(DATAFILE, pygeoip.MEMORY_CACHE) ...
from __future__ import unicode_literals, print_function, division import pygeoip import os.path import sys import socket # http://dev.maxmind.com/geoip/legacy/geolite/ DATAFILE = os.path.join(sys.path[0], "GeoIP.dat") # STANDARD = reload from disk # MEMORY_CACHE = load to memory # MMAP_CACHE = memory using mmap gi4 =...
Add comment telling where to get updated geoip database
Add comment telling where to get updated geoip database
Python
bsd-3-clause
lepinkainen/pyfibot,huqa/pyfibot,rnyberg/pyfibot,huqa/pyfibot,lepinkainen/pyfibot,aapa/pyfibot,aapa/pyfibot,EArmour/pyfibot,rnyberg/pyfibot,EArmour/pyfibot
3ccdd5e6c52b9c46f9245df647b7b9703424eb74
pyramda/iterable/reject_test.py
pyramda/iterable/reject_test.py
from . import reject def test_reject_filters_out_unwanted_items_in_iterable(): assert reject(lambda x: x % 2 == 1, [1, 2, 3, 4]) == [2, 4] def test_curry_reject_filters_out_unwanted_items_in_iterable(): assert reject(lambda x: x % 2 == 1)([1, 2, 3, 4]) == [2, 4]
from . import reject def test_reject_filters_out_unwanted_items_in_iterable(): assert reject(lambda x: x % 2 == 1, [1, 2, 3, 4]) == [2, 4] def test_curry_reject_filters_out_unwanted_items_in_iterable(): assert reject(lambda x: x % 2 == 1)([1, 2, 3, 4]) == [2, 4] def test_reject_does_not_remove_duplicates(...
Add test to ensure reject does not remove duplicates
Add test to ensure reject does not remove duplicates
Python
mit
jackfirth/pyramda
8c2a138057301821c2370e3d26b3921db2ed79a4
bluebottle/organizations/serializers.py
bluebottle/organizations/serializers.py
from rest_framework import serializers from bluebottle.organizations.models import Organization from bluebottle.utils.serializers import URLField class OrganizationSerializer(serializers.ModelSerializer): class Meta: model = Organization fields = ('id', 'name', 'slug', 'address_line1', 'address_l...
from rest_framework import serializers from bluebottle.organizations.models import Organization from bluebottle.utils.serializers import URLField class OrganizationSerializer(serializers.ModelSerializer): class Meta: model = Organization fields = ('id', 'name', 'slug', 'address_line1', 'address_l...
Make the name of an organization required
Make the name of an organization required
Python
bsd-3-clause
jfterpstra/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle
b7559972bc28532108027784a05e8ffc43cb398a
tests/test_models.py
tests/test_models.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_djangocms-responsive-wrapper ------------ Tests for `djangocms-responsive-wrapper` models module. """ import os import shutil import unittest from responsive_wrapper import models class TestResponsive_wrapper(unittest.TestCase): def setUp(self): ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_djangocms-responsive-wrapper ------------ Tests for `djangocms-responsive-wrapper` models module. """ from django.conf import settings from django.test import TestCase from responsive_wrapper import models class TestResponsive_wrapper(TestCase): def setU...
Replace unittest.TestCase with Django’s own TestCase.
Replace unittest.TestCase with Django’s own TestCase.
Python
bsd-3-clause
mishbahr/djangocms-responsive-wrapper,mishbahr/djangocms-responsive-wrapper,mishbahr/djangocms-responsive-wrapper
a5cf50da81460ab68063689f3e2cadb5db18a3d8
common/candle_keras/__init__.py
common/candle_keras/__init__.py
from __future__ import absolute_import #__version__ = '0.0.0' #import from data_utils from data_utils import load_csv_data from data_utils import load_Xy_one_hot_data2 from data_utils import load_Xy_data_noheader #import from file_utils from file_utils import get_file #import from default_utils from default_utils i...
from __future__ import absolute_import #__version__ = '0.0.0' #import from data_utils from data_utils import load_csv_data from data_utils import load_Xy_one_hot_data2 from data_utils import load_Xy_data_noheader #import from file_utils from file_utils import get_file #import from default_utils from default_utils i...
Split multiple arguments for consistency
Split multiple arguments for consistency
Python
mit
ECP-CANDLE/Benchmarks,ECP-CANDLE/Benchmarks,ECP-CANDLE/Benchmarks
e4a799d96ad80a8f7960824e7b9ec1192e81deeb
turbasen/__init__.py
turbasen/__init__.py
# encoding: utf-8 from __future__ import absolute_import, division, print_function, unicode_literals # Import the models we want directly available through the root module from .models import \ Omrade, \ Sted # Make configure directly available through the root module from .settings import configure # Make h...
# encoding: utf-8 from __future__ import absolute_import, division, print_function, unicode_literals # Import the models we want directly available through the root module from .models import \ Gruppe, \ Omrade, \ Sted # Make configure directly available through the root module from .settings import confi...
Add Gruppe to Turbasen import __inti
Add Gruppe to Turbasen import __inti
Python
mit
Turbasen/turbasen.py
5b3aa82b73d0794d5c3935968c79adbffd47e33f
product_images.py
product_images.py
from openerp.osv import osv, fields class product_image(osv.Model): _name = 'product.image' _columns = { 'name': fields.char('Name'), 'description': fields.text('Description'), 'image': fields.binary('Image'), 'image_small': fields.binary('Small Image'), 'product_tmpl_i...
from openerp.osv import osv, fields class product_image(osv.Model): _name = 'product.image' _columns = { 'name': fields.char('Name'), 'description': fields.text('Description'), 'image_alt': fields.text('Image Label'), 'image': fields.binary('Image'), 'image_small': fiel...
Add image_alt for adding Alt attribute to img tags
Add image_alt for adding Alt attribute to img tags Added image_alt for adding alt attribute to img tags for SEO
Python
mit
yelizariev/website_multi_image,yelizariev/website_multi_image,luistorresm/website_multi_image,vauxoo-dev/website_multi_image,OdooCommunityWidgets/website_multi_image,lukebranch/website_multi_image,lukebranch/website_multi_image,Vauxoo/website_multi_image,Vauxoo/website_multi_image,luistorresm/website_multi_image,vauxoo...
57d1053293424a23f3a74691d743e043f379b1e8
ludo/ludo_test.py
ludo/ludo_test.py
from move_manager import MoveManager from board import Board, Field import unittest class TestMoves(unittest.TestCase): def test_valid_moves(self): pass if __name__ == '__main__': unittest.main()
from move_manager import MoveManager, Move from board import Board, Field from common_definitions import BoardFieldType, BOARD_FIELD_COUNT,\ PAWN_COUNT, Players, MAX_DICE_NUMBER_OF_POINTS import unittest class TestMoves(unittest.TestCase): def test_valid_moves_in_finish(self): ...
Add test case for no valid move in finish bug
Add test case for no valid move in finish bug
Python
mit
risteon/ludo_python
9931e71dc3af859388c9c19ed29a1705f7af0b4a
mos/light_data.py
mos/light_data.py
import bpy import json from .common import * def light_data_path(blender_object): path = library_path(blender_object) + "light_data/" + blender_object.name + ".light_data" return path.strip('/') def write(report, directory): blender_lamps = bpy.data.lights for blender_lamp in blender_lamps: ...
import bpy import json from .common import * def light_data_path(blender_object): path = library_path(blender_object) + "light_data/" + blender_object.name + ".light_data" return path.strip('/') def write(report, directory): blender_lamps = bpy.data.lights for blender_lamp in blender_lamps: ...
Use nodes check for light export.
Use nodes check for light export.
Python
mit
morganbengtsson/io_mos
6515d159ab3d09f4ac6157b0f825157c4ed1f5c9
botbot/checks.py
botbot/checks.py
"""Functions for checking files""" import os import stat from .checker import is_link def file_exists(path): try: with open(path, mode='r') as test: pass except FileNotFoundError: if is_link(path): return 'PROB_BROKEN_LINK' except OSError: return 'PROB_UNKNO...
"""Functions for checking files""" import os import stat from .checker import is_link def is_fastq(path): """Check whether a given file is a fastq file.""" if os.path.splitext(path)[1] == ".fastq": if not is_link(path): return 'PROB_FILE_IS_FASTQ' def sam_should_compress(path): """Che...
Clean up some loose ends
Clean up some loose ends
Python
mit
jackstanek/BotBot,jackstanek/BotBot
0dffa6879415ebd1750c264d49e84a4d1d9a1bb0
sequere/models.py
sequere/models.py
from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.db.models.query import QuerySet class FollowQuerySet(QuerySet): pass class FollowManager(models.Manager): def get_query_set(self): return FollowQuerySet(self.model) @python_2_unicode_compatible c...
from django.db import models from django.utils.encoding import python_2_unicode_compatible from django.db.models.query import QuerySet from .backends import get_backend class FollowQuerySet(QuerySet): pass class FollowManager(models.Manager): def get_query_set(self): return FollowQuerySet(self.mode...
Use get_backend in proxy methods
Use get_backend in proxy methods
Python
mit
thoas/django-sequere
8ad8fcfb7d89fa485a3c79161af5733da6bc1462
gvi/budgets/models.py
gvi/budgets/models.py
from django.db import models class Budget(models.Model): number = models.CharField(max_length=100, unique=True) initial_date = models.DateTimeField() final_date = models.DateTimeField(blank=True) hub = models.ForeignKey('hubs.Hubs') def __str__(self): return self.number class BudgetElemen...
from django.db import models class Budget(models.Model): number = models.CharField(max_length=100, unique=True) initial_date = models.DateTimeField() final_date = models.DateTimeField(blank=True) hub = models.ForeignKey('hubs.Hubs') def __str__(self): return self.number class BudgetElemen...
Add type of variable budget
Add type of variable budget
Python
mit
m1k3r/gvi-accounts,m1k3r/gvi-accounts,m1k3r/gvi-accounts
2107a8c161d8a9fe13977a0997defb35297821c2
certbot/tests/helpers.py
certbot/tests/helpers.py
import json import testtools from testtools.twistedsupport import AsynchronousDeferredRunTest from uritools import urisplit class TestCase(testtools.TestCase): """ TestCase class for use with Twisted asynchornous tests. """ run_tests_with = AsynchronousDeferredRunTest def parse_query(uri): """ Pa...
import json import testtools from testtools.twistedsupport import AsynchronousDeferredRunTest from uritools import urisplit class TestCase(testtools.TestCase): """ TestCase class for use with Twisted asynchornous tests. """ run_tests_with = AsynchronousDeferredRunTest.make_factory(timeout=0.01) def parse...
Increase default test timeout value
Increase default test timeout value
Python
mit
praekeltfoundation/certbot,praekeltfoundation/certbot
e8e00b0bc9c9552858f364526803eb9edcaf52c3
01/test_directions.py
01/test_directions.py
from directions import load_directions, turn, follow_directions def test_load_directions(): with open("directions.txt") as f: directions = [direction.strip(',') for direction in f.readline().strip().split()] assert load_directions("directions.txt") == direct...
from directions import load_directions, turn, follow_directions, expand_path import unittest class TestDirections(unittest.TestCase): def test_load_directions(self): with open("directions.txt") as f: directions = [direction.strip(',') for direction ...
Convert to unittest and add test for expand_path.
Convert to unittest and add test for expand_path.
Python
mit
machinelearningdeveloper/aoc_2016
dc83fd7a77cab31b264d19984ac996bf64356fba
malcolm/core/meta.py
malcolm/core/meta.py
from collections import OrderedDict from malcolm.core.serializable import Serializable @Serializable.register("malcolm:core/Meta:1.0") class Meta(Serializable): """Meta class for describing Blocks""" def __init__(self, name, description): super(Meta, self).__init__(name) self.description = d...
from collections import OrderedDict from malcolm.core.serializable import Serializable @Serializable.register("malcolm:core/Meta:1.0") class Meta(Serializable): """Meta class for describing Blocks""" def __init__(self, name, description, *args): super(Meta, self).__init__(name, *args) self.d...
Fix Meta init and from_dict
Fix Meta init and from_dict
Python
apache-2.0
dls-controls/pymalcolm,dls-controls/pymalcolm,dls-controls/pymalcolm
9f3947c3454f02a393d22ff7672598e627246ed4
condor_data_collectors/redis_condor_info_consumer.py
condor_data_collectors/redis_condor_info_consumer.py
import htcondor import redis import time import json import classad def setup_redis_connection(): r = redis.StrictRedis(host="htcs-master.heprc.uvic.ca", port=6379, db=0, password=~NEED THE PW HERE~) return r def import_condor_info(): try: redis_con = setup_redis_connection() condor_reso...
import htcondor import redis import time import json import classad def setup_redis_connection(): r = redis.StrictRedis(host="htcs-master.heprc.uvic.ca", port=6379, db=0, password=~NEED THE PW HERE~) return r def import_condor_info(): try: redis_con = setup_redis_connection() condor_reso...
Update consumer to rebuild 'Start' expression tree for condor resources
Update consumer to rebuild 'Start' expression tree for condor resources This code is untested.
Python
apache-2.0
hep-gc/cloudscheduler,hep-gc/cloudscheduler,hep-gc/cloudscheduler,hep-gc/cloudscheduler
ac83a231b393ab8212b76a2887991cd128d48345
contact/test_settings.py
contact/test_settings.py
# Only used for running the tests import os CONTACT_EMAILS = ['charlie@example.com'] DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3'}} INSTALLED_APPS = ['contact', 'django.contrib.staticfiles'] ROOT_URLCONF = 'contact.test_urls' SECRET_KEY = 'whatever' STATIC_URL = '/static/' TEMPLATE_DIRS = [os...
# Only used for running the tests import os CONTACT_EMAILS = ['charlie@example.com'] DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3'}} INSTALLED_APPS = ['contact', 'django.contrib.staticfiles'] MIDDLEWARE_CLASSES = [] ROOT_URLCONF = 'contact.test_urls' SECRET_KEY = 'whatever' STATIC_URL = '/stat...
Make tests pass on Django 1.7 without warnings.
Make tests pass on Django 1.7 without warnings.
Python
bsd-3-clause
aaugustin/myks-contact,aaugustin/myks-contact
13866af8073a35c3731a208af662422788d53b19
telegramcalendar.py
telegramcalendar.py
# This file copied from https://github.com/unmonoqueteclea/calendar-telegram from telebot import types import calendar def create_calendar(year,month): markup = types.InlineKeyboardMarkup() #First row - Month and Year row=[] row.append(types.InlineKeyboardButton(calendar.month_name[month]+" "+str(year...
# This file copied from https://github.com/unmonoqueteclea/calendar-telegram from telebot import types import calendar def create_calendar(year,month): markup = types.InlineKeyboardMarkup() #First row - Month and Year row=[] row.append(types.InlineKeyboardButton(calendar.month_name[month]+" "+str(year...
Remove day of the week row
Remove day of the week row
Python
mit
myxo/remu,myxo/remu,myxo/remu
ce4dbf4d0ac3ed91c54302ec81e6838d7bf04da2
tests/test_compound.py
tests/test_compound.py
import pytest from katana.utils import Node, Pair, prepare from katana.compound import sequence, group, repeat, option, maybe from katana.term import term Ta, Tb, Tc = [term(k) for k in 'abc'] Na, Nb, Nc = [Node(k, 'data') for k in 'abc'] def test_sequence(): s = sequence(Ta, Tb) given = prepare([Na, Nb]) ...
import pytest from pyrsistent import v from katana.utils import Node, Pair, prepare from katana.compound import sequence, group, repeat, option, maybe from katana.term import term Ta, Tb, Tc = [term(k) for k in 'abc'] Na, Nb, Nc = [Node(k, 'data') for k in 'abc'] def test_sequence(): s = sequence(Ta, Tb) g...
Test grouping with matched nodes
Test grouping with matched nodes
Python
mit
eugene-eeo/katana
6498d61ba18699a93689a52a43963e034b14ed84
diecutter/utils/files.py
diecutter/utils/files.py
# -*- coding: utf-8 -*- """Manage temporary directories.""" import os import shutil import tempfile class temporary_directory(object): """Create, yield, and finally delete a temporary directory. >>> with temporary_directory() as directory: ... os.path.isdir(directory) True >>> os.path.exists(...
# -*- coding: utf-8 -*- """Manage temporary directories.""" import os import shutil import tempfile class temporary_directory(object): """Create, yield, and finally delete a temporary directory. >>> with temporary_directory() as directory: ... os.path.isdir(directory) True >>> os.path.exists(...
Fix tests on travis ci.
Fix tests on travis ci.
Python
bsd-3-clause
diecutter/diecutter,diecutter/diecutter
155fca9e7e2c8cfee8d2600268ebae8d94b2e7fe
wagtail/search/apps.py
wagtail/search/apps.py
from django.apps import AppConfig from django.core.checks import Tags, Warning, register from django.db import connection from django.utils.translation import gettext_lazy as _ from wagtail.search.signal_handlers import register_signal_handlers from . import checks # NOQA class WagtailSearchAppConfig(AppConfig): ...
from django.apps import AppConfig from django.core.checks import Tags, Warning, register from django.db import connection from django.utils.translation import gettext_lazy as _ from wagtail.search.signal_handlers import register_signal_handlers from . import checks # NOQA class WagtailSearchAppConfig(AppConfig): ...
Add alternative warning if sqlite is >=3.19 but is missing fts5 support
Add alternative warning if sqlite is >=3.19 but is missing fts5 support
Python
bsd-3-clause
wagtail/wagtail,thenewguy/wagtail,mixxorz/wagtail,rsalmaso/wagtail,zerolab/wagtail,wagtail/wagtail,mixxorz/wagtail,mixxorz/wagtail,zerolab/wagtail,thenewguy/wagtail,jnns/wagtail,jnns/wagtail,zerolab/wagtail,zerolab/wagtail,thenewguy/wagtail,wagtail/wagtail,jnns/wagtail,rsalmaso/wagtail,mixxorz/wagtail,rsalmaso/wagtail,...
1dd863336641b3e9172c9a08018386bb133960bf
whitenoise/__init__.py
whitenoise/__init__.py
from .base import WhiteNoise __version__ = '2.0.6' __all__ = ['WhiteNoise']
from .base import WhiteNoise __version__ = 'development' __all__ = ['WhiteNoise']
Change version until ready for release
Change version until ready for release
Python
mit
evansd/whitenoise,evansd/whitenoise,evansd/whitenoise
fdee121f435128ada3065e2edc08b4ae6edde2d3
exgrep.py
exgrep.py
#!/usr/bin/env python3 # -*- coding: utf8 -*- """ Usage: exgrep TERM [options] EXCEL_FILE... Options: TERM The term to grep for. Can be any valid (python) regular expression. EXCEL_FILE The list of files to search through -c COL Only search in the column specified by COL. -o Only output the match...
#!/usr/bin/env python3 # -*- coding: utf8 -*- """ Usage: exgrep TERM [options] EXCEL_FILE... Options: TERM The term to grep for. Can be any valid (python) regular expression. EXCEL_FILE The list of files to search through -c COL Only search in the column specified by COL. -r ROW Only search in the ro...
Add support for single row checking
Add support for single row checking
Python
mit
Sakartu/excel-toolkit
0c25bef5514913239db942d96a00a499144282c0
tests/test_config.py
tests/test_config.py
from pytest import fixture from oshino.config import Config, RiemannConfig @fixture def base_config(): return Config({"riemann": {"host": "localhost", "port": 5555 }, "interval": 5 }) @fixture def incomplete_con...
from pytest import fixture from oshino.config import Config, RiemannConfig @fixture def base_config(): return Config({"riemann": {"host": "localhost", "port": 5555 }, "interval": 5 }) @fixture def incomplete_con...
Check more data about riemann
Check more data about riemann
Python
mit
CodersOfTheNight/oshino
06bc49a066958390d423294730debe75466eff1f
tests/test_models.py
tests/test_models.py
from pysagec import models def test_auth_info(): values = [ ('mrw:CodigoFranquicia', 'franchise_code', '123456'), ('mrw:CodigoAbonado', 'subscriber_code', 'subscriber_code'), ('mrw:CodigoDepartamento', 'departament_code', 'departament_code'), ('mrw:UserName', 'username', 'username'...
from pysagec import models def test_field(): f = models.Field('tag') assert f.__get__(None, None) is f assert 'Field' in repr(f) def test_model_as_dict(): class MyModel(models.Model): root_tag = 'root' prop1 = models.Field('tag1') prop2 = models.Field('tag2') model = MyM...
Make test models self contained specific defining Model classes
Make test models self contained specific defining Model classes
Python
mit
migonzalvar/pysagec
e5cf121651051ca904ccdb9409908ad43be32dc2
tests/test_resize.py
tests/test_resize.py
import webview from .util import run_test from time import sleep def test_resize(): window = webview.create_window('Set Window Size Test', 'https://www.example.org', width=800, height=600) run_test(webview, window, resize) def resize(window): assert window.width == 800 assert window.height == 600 ...
import webview from .util import run_test from time import sleep def test_resize(): window = webview.create_window('Set Window Size Test', 'https://www.example.org', width=800, height=600) run_test(webview, window, resize) def resize(window): assert window.width == 800 assert window.height == 600 ...
Add delay to resize test
Add delay to resize test
Python
bsd-3-clause
r0x0r/pywebview,r0x0r/pywebview,r0x0r/pywebview,r0x0r/pywebview,r0x0r/pywebview
2462595312ca7ddf38ffb6d4bcdf7515401fe7ee
tests/test_hooks.py
tests/test_hooks.py
import json from jazzband.projects.tasks import update_project_by_hook from jazzband.tasks import JazzbandSpinach def post(client, hook, data, guid="abc"): headers = {"X-GitHub-Event": hook, "X-GitHub-Delivery": guid} return client.post( "/hooks", content_type="application/json", data...
import json from jazzband.projects.tasks import update_project_by_hook from jazzband.tasks import JazzbandSpinach def post(client, hook, data, guid="abc"): headers = {"X-GitHub-Event": hook, "X-GitHub-Delivery": guid} return client.post( "/hooks", content_type="application/json", data...
Fix more of the test.
Fix more of the test.
Python
mit
jazzband/website,jazzband/jazzband-site,jazzband/website,jazzband/website,jazzband/site,jazzband/jazzband-site,jazzband/website,jazzband/site
057cdbdb0cd3edb18201ca090f57908681512c76
openupgradelib/__init__.py
openupgradelib/__init__.py
# -*- coding: utf-8 -*- import sys __author__ = 'Odoo Community Association (OCA)' __email__ = 'support@odoo-community.org' __doc__ = """A library with support functions to be called from Odoo \ migration scripts.""" __license__ = "AGPL-3" if sys.version_info >= (3, 8): from importlib.metadata import version, Pa...
# -*- coding: utf-8 -*- import sys __author__ = 'Odoo Community Association (OCA)' __email__ = 'support@odoo-community.org' __doc__ = """A library with support functions to be called from Odoo \ migration scripts.""" __license__ = "AGPL-3" try: if sys.version_info >= (3, 8): from importlib.metadata impor...
Fix issue when running setup.py on python<3.8
Fix issue when running setup.py on python<3.8
Python
agpl-3.0
OCA/openupgradelib
f742f5ce52738da51a3adce35bad1e852691d7be
tests/__init__.py
tests/__init__.py
""" gargoyle.tests ~~~~~~~~~~~~~~ :copyright: (c) 2010 DISQUS. :license: Apache License 2.0, see LICENSE for more details. """ from tests import *
""" gargoyle.tests ~~~~~~~~~~~~~~ :copyright: (c) 2010 DISQUS. :license: Apache License 2.0, see LICENSE for more details. """ class fixture(object): """ Works like the built in @property decorator, except that it caches the return value for each instance. This allows you to lazy-load the fixture on...
Add fixture decorator to make tests better
Add fixture decorator to make tests better
Python
apache-2.0
disqus/gutter,kalail/gutter,kalail/gutter,disqus/gutter,kalail/gutter
dc43be8d6b34de47b5bcb900e7d055372c2e28cc
parseBowtieOutput.py
parseBowtieOutput.py
#!python # Load libraries import sys, getopt import libPipeline # Set constants helpMsg =''' SYNOPSIS parseBowtieOutput parseBowtieOutput [OPTIONS] [FILE] # DESCRIPTION parseBowtieOutput.py Parses Bowtie alignments into paired-end read summaries. Prints results to stdout. OPTIONS -h/--he...
#!python # Load libraries import sys, getopt import libPipeline # Set constants helpMsg =''' SYNOPSIS parseBowtieOutput parseBowtieOutput [OPTIONS] [FILE] # DESCRIPTION parseBowtieOutput.py Parses Bowtie alignments into paired-end read summaries. Required if not using SAM output. However,...
Add note on advantages of SAM format.
Add note on advantages of SAM format.
Python
apache-2.0
awblocker/paired-end-pipeline,awblocker/paired-end-pipeline
811263573aa35361da8a8ddde03b333914e156c5
web_utils.py
web_utils.py
"""Collection of HTTP helpers.""" from functools import partial, wraps from inspect import iscoroutine from aiohttp.web import json_response def async_json_out(orig_method=None, *, content_type='application/json', **kwargs): """Turn dict output of an HTTP handler into JSON response. Decorates aiohttp reque...
"""Collection of HTTP helpers.""" from functools import partial, wraps from inspect import iscoroutine from aiohttp.web import json_response def async_json_out(orig_method=None, *, status=200, content_type='application/json', **kwargs): """Turn dict output of an HTTP handler into JSON response. Decorates a...
Add default status=200 to async_json_out decorator
Add default status=200 to async_json_out decorator
Python
mit
open-craft-guild/aio-feature-flags
6a74d267c83f887aae9539417b7a13a00afbcd14
sms_auth_service/client.py
sms_auth_service/client.py
import json import requests SMS_AUTH_ENDPOINT = 'http://localhost:5000' class SMSAuthClient(object): def __init__(self, endpoint=SMS_AUTH_ENDPOINT): self.endpoint = endpoint def create_auth(self, auth_id, recipient): payload = {'auth_id': auth_id, 'recipient': recipient...
import json import requests SMS_AUTH_ENDPOINT = 'http://localhost:5000' class SMSAuthClient(object): def __init__(self, endpoint=SMS_AUTH_ENDPOINT): self.endpoint = endpoint def create_auth(self, auth_id, recipient): payload = {'auth_id': auth_id, 'recipient': recipient...
Add 'attempts_left' to the http exception.
Add 'attempts_left' to the http exception.
Python
mit
flowroute/sms-verification,flowroute/sms-verification,flowroute/sms-verification
50dd73443a2bcb0e973162afab6849078e68ac51
account_banking_payment_export/migrations/7.0.0.1.165/pre-migration.py
account_banking_payment_export/migrations/7.0.0.1.165/pre-migration.py
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2014 Akretion (http://www.akretion.com/) # @author: Alexis de Lattre <alexis.delattre@akretion.com> # # This program is free software: you can redistribute it and/or modify # it under the...
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2014 Akretion (http://www.akretion.com/) # @author: Alexis de Lattre <alexis.delattre@akretion.com> # # This program is free software: you can redistribute it and/or modify # it under the...
Update SQL query with "and communication is null"
Update SQL query with "and communication is null"
Python
agpl-3.0
syci/bank-payment,ndtran/bank-payment,yvaucher/bank-payment,vrenaville/bank-payment,Antiun/bank-payment,rlizana/bank-payment,rschnapka/bank-payment,open-synergy/bank-payment,ndtran/bank-payment,sergio-incaser/bank-payment,hbrunn/bank-payment,rlizana/bank-payment,rschnapka/bank-payment,David-Amaro/bank-payment,yvaucher/...
696a166e039220a5431a554db3a0cb379f9a59de
djlint/analyzers/template_loaders.py
djlint/analyzers/template_loaders.py
import ast from .base import BaseAnalyzer, Result class TemplateLoadersVisitor(ast.NodeVisitor): def __init__(self): self.found = [] deprecated_items = { 'django.template.loaders.app_directories.load_template_source': 'django.template.loaders.app_directories.Loader', 'dj...
import ast from .base import BaseAnalyzer, Result class TemplateLoadersVisitor(ast.NodeVisitor): def __init__(self): self.found = [] removed_items = { 'django.template.loaders.app_directories.load_template_source': 'django.template.loaders.app_directories.Loader', 'djang...
Update template loaders analyzer to target Django 1.5
Update template loaders analyzer to target Django 1.5
Python
isc
alfredhq/djlint
88d1274638e1f4d0341c5e55bdb729ae52c2b607
accounts/models.py
accounts/models.py
from github import Github from django.contrib.auth.models import User from tools.decorators import extend @extend(User) class Profile(object): """Add shortcuts to user""" @property def github(self): """Github api instance with access from user""" token = self.social_auth.get().extra_data[...
from github import Github from django.contrib.auth.models import User from tools.decorators import extend @extend(User) class Profile(object): """Add shortcuts to user""" @property def github(self): """Github api instance with access from user""" return Github(self.github_token) @pro...
Add ability to get github token from user model
Add ability to get github token from user model
Python
mit
nvbn/coviolations_web,nvbn/coviolations_web
9fa3775c78b8c44b503ce1565e2e990644a61da6
Lib/test/test_lib2to3.py
Lib/test/test_lib2to3.py
# Skipping test_parser and test_all_fixers # because of running from lib2to3.tests import test_fixers, test_pytree, test_util import unittest from test.test_support import run_unittest def suite(): tests = unittest.TestSuite() loader = unittest.TestLoader() for m in (test_fixers,test_pytree,test_util): ...
# Skipping test_parser and test_all_fixers # because of running from lib2to3.tests import test_fixers, test_pytree, test_util import unittest from test.test_support import run_unittest, requires # Don't run lib2to3 tests by default since they take too long if __name__ != '__main__': requires('lib2to3') def suite(...
Disable lib2to3 by default, unless run explicitly.
Disable lib2to3 by default, unless run explicitly.
Python
mit
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
8efde6f0fee26a2e83a0191bd21f78061ff92e8c
fedora.py
fedora.py
from fedora.template.fedora import FedoraTemplate from fedora.manager.manager import FedoraConnectionManager if '__main__' == __name__: fedoraTemplate = FedoraTemplate() a = FedoraConnectionManager("http://localhost:8080/rest/hand/english/fcr:metadata", templates=[FedoraTemplate()]); print a.__dict__
from fedora.template.fedora import FedoraTemplate from fedora.manager.manager import FedoraConnectionManager if '__main__' == __name__: fedoraTemplate = FedoraTemplate() parser = FedoraConnectionManager("http://localhost:8080/rest/hand/english/fcr:metadata", templates=[FedoraTemplate()]); data = parser.ret...
Update code for support new methodology
Update code for support new methodology
Python
mit
sitdh/fedora-parser
84dee56df90d9181d1e79c3246ef389462f0ca17
configure_console_session.py
configure_console_session.py
import sys PYTHONPATH = '/home/nick/PycharmProjs/tl_cycling/caar' sys.path.append(PYTHONPATH) PYTHONPATH = '/home/nick/PycharmProjs/tl_cycling/backports' sys.path.append(PYTHONPATH) PYTHONPATH = '/home/nick/PycharmProjs/tl_cycling/backports/configparser' sys.path.append(PYTHONPATH) from comfort import cleanthermostat a...
import sys PYTHONPATH = '/home/nick/PycharmProjs/tl_cycling/caar' sys.path.append(PYTHONPATH) PYTHONPATH = '/home/nick/PycharmProjs/tl_cycling/backports' sys.path.append(PYTHONPATH) PYTHONPATH = '/home/nick/PycharmProjs/tl_cycling/backports/configparser' sys.path.append(PYTHONPATH) from caar.cleanthermostat import dict...
Put imports as they are in init
Put imports as they are in init
Python
bsd-3-clause
nickpowersys/CaaR
30259313a817f2d5f147dc37ebf5ebd2c2edf943
configurator/__init__.py
configurator/__init__.py
"""Adaptive configuration dialogs. Attributes: __version__: The current version string. """ import os import subprocess def _get_version(version=None): # overwritten by setup.py if version is None: pkg_dir = os.path.dirname(__file__) src_dir = os.path.abspath(os.path.join(pkg_dir, os.pardir...
"""Adaptive configuration dialogs. Attributes: __version__: The current version string. """ import os import subprocess def _get_version(version=None): # overwritten by setup.py if version is None: pkg_dir = os.path.dirname(__file__) src_dir = os.path.abspath(os.path.join(pkg_dir, os.pardir...
Disable redirecting git output in _get_version
Disable redirecting git output in _get_version
Python
apache-2.0
yasserglez/configurator,yasserglez/configurator
8e7f793abc012e136fa5ec0f2c003704ab98f751
src/nodeconductor_assembly_waldur/experts/filters.py
src/nodeconductor_assembly_waldur/experts/filters.py
import django_filters from nodeconductor.core import filters as core_filters from . import models class ExpertProviderFilter(django_filters.FilterSet): customer = core_filters.URLFilter(view_name='customer-detail', name='customer__uuid') customer_uuid = django_filters.UUIDFilter(name='customer__uuid') ...
import django_filters from nodeconductor.core import filters as core_filters from . import models class ExpertProviderFilter(django_filters.FilterSet): customer = core_filters.URLFilter(view_name='customer-detail', name='customer__uuid') customer_uuid = django_filters.UUIDFilter(name='customer__uuid') ...
Allow to filter expert bids by a customer
Allow to filter expert bids by a customer [WAL-1169]
Python
mit
opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/waldur-mastermind
f41adb3b11a572251949778ed3fa49cd0c3901c7
AFQ/tests/test_csd.py
AFQ/tests/test_csd.py
import os.path as op import numpy as np import numpy.testing as npt import nibabel as nib import nibabel.tmpdirs as nbtmp import dipy.data as dpd from dipy.reconst.shm import calculate_max_order from AFQ import csd def test_fit_csd(): fdata, fbval, fbvec = dpd.get_data() with nbtmp.InTemporaryDirectory() ...
import os.path as op import numpy as np import numpy.testing as npt import nibabel as nib import nibabel.tmpdirs as nbtmp import dipy.data as dpd from dipy.reconst.shm import calculate_max_order from AFQ import csd def test_fit_csd(): fdata, fbval, fbvec = dpd.get_data('small_64D') with nbtmp.InTemporaryD...
Replace the test data set with this one.
Replace the test data set with this one.
Python
bsd-2-clause
arokem/pyAFQ,arokem/pyAFQ,yeatmanlab/pyAFQ,yeatmanlab/pyAFQ
164c70386191f0761923c1344447b8fac0e0795c
pelican/settings.py
pelican/settings.py
import os _DEFAULT_THEME = os.sep.join([os.path.dirname(os.path.abspath(__file__)), "themes/notmyidea"]) _DEFAULT_CONFIG = {'PATH': None, 'THEME': _DEFAULT_THEME, 'OUTPUT_PATH': 'output/', 'MARKUP': ('rst', 'md'), ...
import os _DEFAULT_THEME = os.sep.join([os.path.dirname(os.path.abspath(__file__)), "themes/notmyidea"]) _DEFAULT_CONFIG = {'PATH': None, 'THEME': _DEFAULT_THEME, 'OUTPUT_PATH': 'output/', 'MARKUP': ('rst', 'md'), ...
Add a default for JINJA_EXTENSIONS (default is no extensions)
Add a default for JINJA_EXTENSIONS (default is no extensions)
Python
agpl-3.0
treyhunner/pelican,joetboole/pelican,janaurka/git-debug-presentiation,goerz/pelican,JeremyMorgan/pelican,Polyconseil/pelican,deved69/pelican-1,JeremyMorgan/pelican,douglaskastle/pelican,farseerfc/pelican,51itclub/pelican,florianjacob/pelican,liyonghelpme/myBlog,levanhien8/pelican,lucasplus/pelican,btnpushnmunky/pelican...
1e6fcb420c0cd3c41afd8a91ec020b6e15cf1973
client/views.py
client/views.py
from django.shortcuts import render # Create your views here.
from django.shortcuts import render from django.http import HttpResponse, Http404 from .models import Message from django.contrib.auth.decorators import login_required # Create your views here. @login_required def chatroom(request): messages = Message.objects.order_by('date') context = {'messages': messages} ...
Add login restrictions to chatroom
Add login restrictions to chatroom
Python
apache-2.0
jason-feng/chatroom,jason-feng/chatroom,jason-feng/chatroom,jason-feng/chatroom
429738972be911f6b05358c918f822270eb94da7
botbot/checks.py
botbot/checks.py
"""Functions for checking files""" import os import stat import mimetypes from .checker import is_link from .config import CONFIG def is_fastq(fi): """Check whether a given file is a fastq file.""" path = fi['path'] if os.path.splitext(path)[1] == ".fastq": if not is_link(path): return...
"""Functions for checking files""" import os import stat import mimetypes from .checker import is_link from .config import CONFIG def is_fastq(fi): """Check whether a given file is a fastq file.""" path = fi['path'] if os.path.splitext(path)[1] == ".fastq": if not is_link(path): return...
Fix SAM checker to for better coverage
Fix SAM checker to for better coverage
Python
mit
jackstanek/BotBot,jackstanek/BotBot
af8d25d74dbbfcb25bcdfb454125d834644bc1bc
bin/app_setup.py
bin/app_setup.py
#!/usr/bin/python # -*- coding: utf-8 -*- import hook_system_variables as hook import os_operations as op import os def setup(): home_dir = op.get_home() app_tree = home_dir + op.separator() + hook.data_storage_path if not os.path.exists(app_tree): op.create_tree(app_tree) else: pri...
#!/usr/bin/python # -*- coding: utf-8 -*- import hook_system_variables as hook import os_operations as op import os def setup(): home_dir = op.get_home() app_tree = home_dir + op.separator() + hook.data_storage_path if not os.path.exists(app_tree): op.create_tree(app_tree) file_absolute_...
Append G(app) to os $PATH
Append G(app) to os $PATH
Python
mit
adnane1deev/Hook
f12120dd9a7660277b52cd25f8cfa48b3783eece
rest_framework_friendly_errors/handlers.py
rest_framework_friendly_errors/handlers.py
from rest_framework.views import exception_handler from rest_framework.exceptions import APIException from rest_framework_friendly_errors import settings from rest_framework_friendly_errors.utils import is_pretty def friendly_exception_handler(exc, context): response = exception_handler(exc, context) if not...
from rest_framework.views import exception_handler from rest_framework.exceptions import APIException from rest_framework_friendly_errors import settings from rest_framework_friendly_errors.utils import is_pretty def friendly_exception_handler(exc, context): response = exception_handler(exc, context) if not...
Create new exception to catch APIException
Create new exception to catch APIException
Python
mit
oasiswork/drf-friendly-errors,FutureMind/drf-friendly-errors
d8a7abd16e115e142299a4c1ed01b18b15a5b806
tests/test_hashring.py
tests/test_hashring.py
from hashring import HashRing def test_basic_ring(): hr = HashRing(range(3)) actual = hr.get_node('howdy') expected = 1 assert expected == actual
from hashring import HashRing def test_basic_ring(): hr = HashRing(range(3)) actual = hr.get_node('howdy') expected = 1 assert expected == actual def test_server_ring(): memcache_servers = ['192.168.0.246:11212', '192.168.0.247:11212', '192.168.0.24...
Add additional test for strings
Add additional test for strings
Python
bsd-2-clause
goller/hashring
ab247f37b72bf833dfb32c93d01e6889642b109e
cfr/game_tree.py
cfr/game_tree.py
from cfr.constants import NUM_ACTIONS class Node: def __init__(self, parent): super().__init__() self.parent = parent self.children = {} def set_child(self, key, child): self.children[key] = child class TerminalNode(Node): def __init__(self, parent, pot_commitment): ...
from cfr.constants import NUM_ACTIONS class Node: def __init__(self, parent): super().__init__() self.parent = parent self.children = {} def set_child(self, key, child): self.children[key] = child def __str__(self): if not self.parent: return '' ...
Add str method for debugging to node
Add str method for debugging to node
Python
mit
JakubPetriska/poker-cfr,JakubPetriska/poker-cfr
16c5c9e89a6cf565070ab58d55a7796ea3183ced
coltrane/managers.py
coltrane/managers.py
from comment_utils.managers import CommentedObjectManager from django.db import models class LiveEntryManager(CommentedObjectManager): """ Custom manager for the Entry model, providing shortcuts for filtering by entry status. """ def featured(self): """ Returns a ``QuerySet`` ...
from comment_utils.managers import CommentedObjectManager from django.db import models class LiveEntryManager(CommentedObjectManager): """ Custom manager for the Entry model, providing shortcuts for filtering by entry status. """ def featured(self): """ Returns a ``QuerySet`` ...
Add the support for the new module constants to the LiveEntryManager
Add the support for the new module constants to the LiveEntryManager git-svn-id: 9770886a22906f523ce26b0ad22db0fc46e41232@71 5f8205a5-902a-0410-8b63-8f478ce83d95
Python
bsd-3-clause
mafix/coltrane-blog,clones/django-coltrane
1a511f23acc873c95ed60e8a918bff5c6ba68ebc
deployment/websocket_wsgi.py
deployment/websocket_wsgi.py
import os import gevent.socket import redis.connection from manage import _set_source_root_parent, _set_source_root os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") _set_source_root_parent('submodules') _set_source_root(os.path.join('corehq', 'ex-submodules')) _set_source_root(os.path.join('custom', '_lega...
import os import gevent.socket import redis.connection from manage import init_hq_python_path, run_patches os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") init_hq_python_path() run_patches() redis.connection.socket = gevent.socket from ws4redis.uwsgi_runserver import uWSGIWebsocketServer application = uW...
Fix websockets process after celery upgrade
Fix websockets process after celery upgrade make it do the same patching that manage.py does
Python
bsd-3-clause
dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq
44e1b892716b74a3730da92365669f1353eb267e
cyder/cydhcp/validation.py
cyder/cydhcp/validation.py
from django.core.exceptions import ValidationError import re mac_pattern = re.compile(r'^([0-9a-f]{2}:){5}[0-9a-f]{2}$') def validate_mac(mac): if not isinstance(mac, basestring) or not mac_pattern.match(mac): raise ValidationError('Invalid MAC address')
from django.core.exceptions import ValidationError import re mac_pattern = re.compile(r'^([0-9a-f]{2}:){5}[0-9a-f]{2}$') def validate_mac(mac): if not isinstance(mac, basestring) or not mac_pattern.match(mac) \ or mac == '00:00:00:00:00:00': raise ValidationError('Invalid MAC address')
Make 00:00:00:00:00:00 an invalid MAC address
Make 00:00:00:00:00:00 an invalid MAC address
Python
bsd-3-clause
OSU-Net/cyder,OSU-Net/cyder,zeeman/cyder,drkitty/cyder,murrown/cyder,zeeman/cyder,OSU-Net/cyder,zeeman/cyder,murrown/cyder,zeeman/cyder,murrown/cyder,OSU-Net/cyder,akeym/cyder,murrown/cyder,drkitty/cyder,drkitty/cyder,akeym/cyder,akeym/cyder,akeym/cyder,drkitty/cyder
3ac4264b9242e0261735e35401a4a750489a6f0e
test/__init__.py
test/__init__.py
# Copyright 2010 10gen, Inc. # # 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, soft...
# Copyright 2010 10gen, Inc. # # 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, soft...
Clean up all test dbs after test run.
Clean up all test dbs after test run.
Python
apache-2.0
develf/mongo-python-driver,ultrabug/mongo-python-driver,aherlihy/mongo-python-driver,jbenet/mongo-python-driver,aherlihy/mongo-python-driver,ShaneHarvey/mongo-python-driver,jbenet/mongo-python-driver,felixonmars/mongo-python-driver,felixonmars/mongo-python-driver,pigate/mongo-python-driver,WingGao/mongo-python-driver,b...
5255a72c266f8ab092a02b6d87f7006f2149560e
vortaro/admin.py
vortaro/admin.py
from bonvortaro.vortaro.models import Root, Word, Definition #, Translation from django.contrib import admin class RootAdmin(admin.ModelAdmin): list_display = ["root", "kind", "begining", "ending", "ofc"] list_filter = ["begining", "ending", "kind", "ofc"] admin.site.register(Root, RootAdmin) class WordAdmin...
from bonvortaro.vortaro.models import Root, Word, Definition #, Translation from django.contrib import admin class RootAdmin(admin.ModelAdmin): list_display = ["root", "kind", "begining", "ending", "ofc"] list_filter = ["begining", "ending", "kind", "ofc"] admin.site.register(Root, RootAdmin) class WordAdmin...
Reorder filters to make the easier to use.
Reorder filters to make the easier to use.
Python
agpl-3.0
pupeno/bonvortaro
4f8c653f877067703acf7146bc3732152b3f8f62
dax/constants.py
dax/constants.py
import os from os.path import expanduser USER_HOME = expanduser("~") #MASIMATLAB dir: if 'MASIMATLAB_PATH' not in os.environ: MASIMATLAB_PATH = os.path.join(USER_HOME,'masimatlab') else: MASIMATLAB_PATH = os.environ['MASIMATLAB'] #Result dir if 'UPLOAD_SPIDER_DIR' not in os.environ: RESULTS_DIR=os.path.join(US...
import os from os.path import expanduser USER_HOME = expanduser("~") #MASIMATLAB dir: if 'MASIMATLAB_PATH' not in os.environ: MASIMATLAB_PATH = os.path.join(USER_HOME,'masimatlab') else: MASIMATLAB_PATH = os.environ['MASIMATLAB_PATH'] #Result dir if 'UPLOAD_SPIDER_DIR' not in os.environ: RESULTS_DIR=os.p...
Fix bug and correct indentation
Fix bug and correct indentation
Python
mit
MattVUIIS/dax,MattVUIIS/dax,MattVUIIS/dax,MattVUIIS/dax,VUIIS/dax,VUIIS/dax
e289f1d604245e48954c09b39091a80beff39e34
django_remote_forms/utils.py
django_remote_forms/utils.py
from django.utils.functional import Promise from django.utils.translation import force_unicode def resolve_promise(o): if isinstance(o, dict): for k, v in o.items(): o[k] = resolve_promise(v) elif isinstance(o, (list, tuple)): o = [resolve_promise(x) for x in o] elif isinstance...
from django.utils.functional import Promise from django.utils.encoding import force_unicode def resolve_promise(o): if isinstance(o, dict): for k, v in o.items(): o[k] = resolve_promise(v) elif isinstance(o, (list, tuple)): o = [resolve_promise(x) for x in o] elif isinstance(o, ...
Update import to correct path for Django 1.4->1.6 compatibility
Update import to correct path for Django 1.4->1.6 compatibility
Python
mit
gadventures/django-remote-forms
fb5117e653b7a47f4af35d2c19ada9da15458ae3
tmpl/Platform.py
tmpl/Platform.py
#--coding:utf-8-- #Platform class BasePlatform(object): """ A template for codes which are dependent on platform, whatever shell type or system type. Redefine members to modify the function. """ def __init__(self, shell = False): if shell: if os.name == 'posix': ...
#--coding:utf-8-- #Platform class BasePlatform(object): """ A template for codes which are dependent on platform, whatever shell type or system type. Redefine members to modify the function. """ def __init__(self, shell = False): if shell: if os.name == 'posix': ...
Fix the compile error of define classes which derivate from other classes in class.
Fix the compile error of define classes which derivate from other classes in class.
Python
mit
nday-dev/Spider-Framework
ba48cd45c56646497bcda70d9a475a40ea44c874
dbaas/workflow/steps/mysql/resize/change_config.py
dbaas/workflow/steps/mysql/resize/change_config.py
# -*- coding: utf-8 -*- import logging from . import run_vm_script from ...util.base import BaseStep LOG = logging.getLogger(__name__) class ChangeDatabaseConfigFile(BaseStep): def __unicode__(self): return "Changing database config file..." def do(self, workflow_dict): context_dict = { ...
# -*- coding: utf-8 -*- import logging from workflow.steps.mysql.resize import run_vm_script from workflow.steps.util.base import BaseStep LOG = logging.getLogger(__name__) class ChangeDatabaseConfigFile(BaseStep): def __unicode__(self): return "Changing database config file..." def do(self, workfl...
Add is_ha variable to change config rollback
Add is_ha variable to change config rollback
Python
bsd-3-clause
globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service
d56ffde056a7758539ce834943ceb0f656e795a8
CI/syntaxCheck.py
CI/syntaxCheck.py
import sys from CITests import CITests # Libs in Application Examples appExamples = { "KundurSMIB":"/ApplicationExamples/KundurSMIB/package.mo", "TwoAreas":"/ApplicationExamples/TwoAreas/package.mo", "SevenBus":"/ApplicationExamples/SevenBus/package.mo", "IEEE9":"/ApplicationExamples/IEEE9/package.mo", "IEEE14":"/Appl...
import sys from CITests import CITests # Libs in Application Examples appExamples = { "KundurSMIB":"/ApplicationExamples/KundurSMIB/package.mo", "TwoAreas":"/ApplicationExamples/TwoAreas/package.mo", "SevenBus":"/ApplicationExamples/SevenBus/package.mo", "IEEE9":"/ApplicationExamples/IEEE9/package.mo", "IEEE14":"/Appl...
Fix missing test probably got removed in my clumsy merge
Fix missing test probably got removed in my clumsy merge
Python
bsd-3-clause
fran-jo/OpenIPSL,tinrabuzin/OpenIPSL,SmarTS-Lab/OpenIPSL,SmarTS-Lab/OpenIPSL,MaximeBaudette/OpenIPSL,OpenIPSL/OpenIPSL
3a2d2934f61c496654281da7144f74713a9dea6f
devicehive/api.py
devicehive/api.py
from devicehive.transport import Request from devicehive.transport import Response class Api(object): """Api class.""" def __init__(self, transport): self._transport = transport def is_http_transport(self): return self._transport.name == 'http' def is_websocket_transport(self): ...
class Request(object): """Request class.""" def __init__(self, url, action, request, **params): self.action = action self.request = request self.params = params self.params['url'] = url class Response(object): """Response class.""" def __init__(self, response): ...
Add Request, Response and ApiObject and Token classes
Add Request, Response and ApiObject and Token classes
Python
apache-2.0
devicehive/devicehive-python
a303756c2e2735f5eb14b525b98894e985b40baf
csunplugged/general/management/commands/updatedata.py
csunplugged/general/management/commands/updatedata.py
"""Module for the custom Django updatedata command.""" from django.core import management class Command(management.base.BaseCommand): """Required command class for the custom Django updatedata command.""" help = "Update all data from content folders for all applications" def add_arguments(self, parser)...
"""Module for the custom Django updatedata command.""" from django.core import management class Command(management.base.BaseCommand): """Required command class for the custom Django updatedata command.""" help = "Update all data from content folders for all applications" def add_arguments(self, parser)...
Remove invalid argument for load command
Remove invalid argument for load command
Python
mit
uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged
35c643aef0cb6b194e62cd5f2fcf7df98bf46870
django_lightweight_queue/management/commands/queue_deduplicate.py
django_lightweight_queue/management/commands/queue_deduplicate.py
from django.core.management.base import BaseCommand, CommandError from ...utils import get_backend class Command(BaseCommand): help = "Command to deduplicate tasks in a redis-backed queue" def add_arguments(self, parser): parser.add_argument( 'queue', action='store', ...
from django.core.management.base import BaseCommand, CommandError from ...utils import get_backend class Command(BaseCommand): help = "Command to deduplicate tasks in a redis-backed queue" def add_arguments(self, parser): parser.add_argument( 'queue', action='store', ...
Improve output when no deduplication happened
Improve output when no deduplication happened
Python
bsd-3-clause
thread/django-lightweight-queue,thread/django-lightweight-queue
2cd634d22c74c742b0feb2aceef06c610a0fa378
test/test_featurecounts.py
test/test_featurecounts.py
import sequana.featurecounts as fc from sequana import sequana_data def test_featurecounts(): RNASEQ_DIR_0 = sequana_data("featurecounts") + "/rnaseq_0" RNASEQ_DIR_1 = sequana_data("featurecounts") + "/rnaseq_1" RNASEQ_DIR_2 = sequana_data("featurecounts") + "/rnaseq_2" RNASEQ_DIR_undef = sequana_data...
import sequana.featurecounts as fc from sequana import sequana_data def test_featurecounts(): RNASEQ_DIR_0 = sequana_data("featurecounts") + "/rnaseq_0" RNASEQ_DIR_1 = sequana_data("featurecounts") + "/rnaseq_1" RNASEQ_DIR_2 = sequana_data("featurecounts") + "/rnaseq_2" RNASEQ_DIR_undef = sequana_data...
Fix featureCounts test following change in consensus nomenclature in FeatureCounts obj
Fix featureCounts test following change in consensus nomenclature in FeatureCounts obj
Python
bsd-3-clause
sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana
a0556156651b6c8f5dd230ba99998efa890e1506
test/unit/test_template.py
test/unit/test_template.py
# Copyright (c) 2013, Sascha Peilicke <saschpe@gmx.de> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHO...
# Copyright (c) 2013, Sascha Peilicke <saschpe@gmx.de> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHO...
Adjust template path after change
Adjust template path after change
Python
apache-2.0
saschpe/rapport
de907a982f172a43e9997b5f41e53bb5ee89a5eb
Functions/Join.py
Functions/Join.py
''' Created on Dec 20, 2011 @author: Tyranic-Moron ''' from IRCMessage import IRCMessage from IRCResponse import IRCResponse, ResponseType from Function import Function from GlobalVars import * import re class Instantiate(Function): Help = 'join <channel> - makes the bot join the specified channel(s)' def ...
''' Created on Dec 20, 2011 @author: Tyranic-Moron ''' from IRCMessage import IRCMessage from IRCResponse import IRCResponse, ResponseType from Function import Function from GlobalVars import * import re class Instantiate(Function): Help = 'join <channel> - makes the bot join the specified channel(s)' def ...
Update list of channels when joining a new one
Update list of channels when joining a new one
Python
mit
HubbeKing/Hubbot_Twisted
eb1c913a0800e2d5eabf34e7abce96c8f4096d79
marble/tests/test_neighbourhoods.py
marble/tests/test_neighbourhoods.py
""" Tests for the extraction of neighbourhoods """ from nose.tools import * import marble as mb # Test that for a grid, corners are not neighbours (.touch might have to go) # Test clustering on a situation
""" Tests for the extraction of neighbourhoods """ from nose.tools import * import itertools from shapely.geometry import Polygon import marble as mb from marble.neighbourhoods import _adjacency # # Synthetic data for tests # def grid(): au = [i*3+j for i,j in itertools.product(range(3), repeat=2)] units = ...
Test the adjacency matrix finder
Test the adjacency matrix finder
Python
bsd-3-clause
scities/marble,walkerke/marble
bc021f416530375066c67c117995bd44c2bac7d5
timezone_field/__init__.py
timezone_field/__init__.py
from .fields import TimeZoneField # noqa from .forms import TimeZoneFormField # noqa __version__ = '1.0'
__version__ = '1.0' __all__ = ['TimeZoneField', 'TimeZoneFormField'] from timezone_field.fields import TimeZoneField from timezone_field.forms import TimeZoneFormField
Add and __all__ designator to top-level
Add and __all__ designator to top-level
Python
bsd-2-clause
mfogel/django-timezone-field
c998588fcc990f077a4f6d34f7d078c54aca1b3b
modules/google-earth-engine/docker/sepal-ee/sepal/drive/__init__.py
modules/google-earth-engine/docker/sepal-ee/sepal/drive/__init__.py
from threading import local from apiclient import discovery _local = local() def get_service(credentials): service = getattr(_local, 'service', None) if not service: service = discovery.build(serviceName='drive', version='v3', cache_discovery=False, credentials=credentials) _local.service = ...
import logging from threading import local from apiclient import discovery _local = local() logging.getLogger('googleapiclient').setLevel(logging.WARNING) def get_service(credentials): service = getattr(_local, 'service', None) if not service: service = discovery.build(serviceName='drive', version='...
Set googleapiclient logging level to WARNING.
Set googleapiclient logging level to WARNING.
Python
mit
openforis/sepal,openforis/sepal,openforis/sepal,openforis/sepal,openforis/sepal,openforis/sepal