commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
228b20aed3ba9e6e730a98a3931d53d9d3fd98af | add test for issue #14 | wolverdude/genson,wolverdude/GenSON | test/test_add_single.py | test/test_add_single.py | from . import base
class TestType(base.SchemaTestCase):
def test_no_schema(self):
schema = {}
self.add_schema(schema)
self.assertResult(schema)
def test_single_type(self):
schema = {'type': 'string'}
self.add_schema(schema)
self.assertResult(schema)
def t... | from . import base
class TestType(base.SchemaTestCase):
def test_no_schema(self):
schema = {}
self.add_schema(schema)
self.assertResult(schema)
def test_single_type(self):
schema = {'type': 'string'}
self.add_schema(schema)
self.assertResult(schema)
def t... | mit | Python |
6533b1bcb52a1e638c8c9f751515c2ec0c618b85 | Remove broken import | hammerlab/cohorts,hammerlab/cohorts | test/test_df_loading.py | test/test_df_loading.py | # Copyright (c) 2016. Mount Sinai School of Medicine
#
# 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 o... | # Copyright (c) 2016. Mount Sinai School of Medicine
#
# 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 o... | apache-2.0 | Python |
14563262238be868592d7c6c8c6c572218776e21 | Create model | jeremykid/swjblog,jeremykid/swjblog,jeremykid/swjblog | swjblog/polls/models.py | swjblog/polls/models.py | from __future__ import unicode_literals
from django.db import models
# Create your models here.
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=m... | from __future__ import unicode_literals
from django.db import models
# Create your models here.
| mit | Python |
16b0e03552189a031108e779cf90cafb0f7cc65e | Bump to 0.0.5-dev | axiom-data-science/epic2cf | epic2cf/__init__.py | epic2cf/__init__.py | #!python
# coding=utf-8
__version__ = '0.0.5-dev'
import logging
logger = logging.getLogger("epic2cf")
logger.addHandler(logging.NullHandler())
logger.addHandler(logging.StreamHandler())
from epic2cf.data import epic_map
class DotDict(object):
def __init__(self, *args, **kwargs):
for k, v in kwargs.ite... | #!python
# coding=utf-8
__version__ = '0.0.4'
import logging
logger = logging.getLogger("epic2cf")
logger.addHandler(logging.NullHandler())
logger.addHandler(logging.StreamHandler())
from epic2cf.data import epic_map
class DotDict(object):
def __init__(self, *args, **kwargs):
for k, v in kwargs.items()... | mit | Python |
5cd2a9642eed7b9ccfe9f847d12275f2355ca2d7 | Update indicators.py | gisce/esios | esios/indicators.py | esios/indicators.py | from datetime import datetime
from libsaas import http, parsers
from libsaas.services import base
class Indicator(base.RESTResource):
path = 'indicators'
class ProfilePVPC(Indicator):
@base.apimethod
def get(self, start_date, end_date):
assert isinstance(start_date, datetime)
assert is... | from datetime import datetime
from libsaas import http, parsers
from libsaas.services import base
class Indicator(base.RESTResource):
path = 'indicators'
class ProfilePVPC(Indicator):
@base.apimethod
def get(self, start_date, end_date):
assert isinstance(start_date, datetime)
assert is... | mit | Python |
1aa41aa0f4fdf176defc4ae9c652ef7458f6af6a | fix typo and refactor in examples/fcis/demo.py | yuyu2172/chainercv,yuyu2172/chainercv,pfnet/chainercv,chainer/chainercv,chainer/chainercv | examples/fcis/demo.py | examples/fcis/demo.py | import argparse
import chainer
import matplotlib.pyplot as plt
from chainercv.datasets import sbd_instance_segmentation_label_names
from chainercv.experimental.links import FCISResNet101
from chainercv.utils import mask_to_bbox
from chainercv.utils import read_image
from chainercv.visualizations.colormap import voc_c... | import argparse
import chainer
import matplotlib.pyplot as plt
from chainercv.datasets import sbd_instance_segmentation_label_names
from chainercv.experimental.links import FCISResNet101
from chainercv import utils
from chainercv.visualizations.colormap import voc_colormap
from chainercv.visualizations import vis_ins... | mit | Python |
9dbd1495fcc7460099d57a978f52586b4c6dbab7 | add first tests for cli.main | titusz/epubcheck | tests/test_epubcheck.py | tests/test_epubcheck.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import epubcheck
from epubcheck import samples
from epubcheck.cli import main
def test_valid():
assert epubcheck.validate(samples.EPUB3_VALID)
def test_invalid():
assert not epubcheck.validate(samples.EPUB3_INVALID)
def test_main_valid(capsys... | # -*- coding: utf-8 -*-
import epubcheck
from epubcheck import samples
from epubcheck.cli import main
def test_main():
assert main([]) == 0
def test_valid():
assert epubcheck.validate(samples.EPUB3_VALID)
def test_invalid():
assert not epubcheck.validate(samples.EPUB3_INVALID)
| bsd-2-clause | Python |
c23869691982c0962cda80a31dcf38ebaaea224e | increase coverage | jschnurr/scrapyscript | tests/test_processor.py | tests/test_processor.py | import pytest
from scrapy.settings import Settings
from scrapyscript import Job, Processor, ScrapyScriptException
from spiders import BadSpider, BigSpider, ItemSpider, ParamReturnSpider, TitleSpider
def test_item_scraped_appends_items():
p = Processor()
p._item_scraped("test")
assert p.items[0] == "test"... | import pytest
from scrapy.settings import Settings
from scrapyscript import Job, Processor, ScrapyScriptException
from spiders import BadSpider, BigSpider, ItemSpider, ParamReturnSpider, TitleSpider
def test_item_scraped_appends_items():
p = Processor()
p._item_scraped("test")
assert p.items[0] == "test"... | mit | Python |
8ce6c0f460f90561cf2e846c1b3fa281d11fba62 | Add additional test of recorders when a return is captured | jstutters/Plumbium | tests/test_recorders.py | tests/test_recorders.py | import pytest
from plumbium.processresult import record, pipeline, call
from plumbium.recorders import CSVFile, StdOut
from collections import OrderedDict
@pytest.fixture
def simple_pipeline():
@record()
def recorded_function():
call(['echo', '6.35'])
def a_pipeline():
recorded_function()... | import pytest
from plumbium.processresult import record, pipeline, call
from plumbium.recorders import CSVFile, StdOut
from collections import OrderedDict
@pytest.fixture
def simple_pipeline():
@record()
def recorded_function():
call(['echo', '6.35'])
def a_pipeline():
recorded_function()... | mit | Python |
7f93f3a8b8fb703588b7f1b5fee9856d0a597636 | Add test make sure rtpevent inside rtp parses | vodik/aiortp | tests/test_serialize.py | tests/test_serialize.py | from hypothesis import given
from hypothesis.strategies import binary
from aiortp.packet import rtphdr, pack_rtp, parse_rtp
from aiortp.packet import rtpevent, pack_rtpevent, parse_rtpevent
@given(binary(min_size=rtphdr.size, max_size=rtphdr.size + 1000))
def test_rtp_decode_inverts_encode(pkt):
assert pack_rtp(p... | from hypothesis import given
from hypothesis.strategies import binary
from aiortp.packet import rtphdr, pack_rtp, parse_rtp
from aiortp.packet import rtpevent, pack_rtpevent, parse_rtpevent
@given(binary(min_size=rtphdr.size, max_size=rtphdr.size + 1000))
def test_rtp_decode_inverts_encode(pkt):
assert pack_rtp(p... | apache-2.0 | Python |
a31bd13b4d8e635beb64ac7cf91f13b37cb0a63e | Fix bug extracting tarfile | mozilla/spicedham,mozilla/spicedham | tests/test_spicedham.py | tests/test_spicedham.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_spicedham
----------------------------------
Tests for `spicedham` module.
"""
import os
import json
import tarfile
import unittest
from spicedham import SpicedHam
class TestSpicedham(unittest.TestCase):
def setUp(self, tarball='corpus.tar.gz', test_data_... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_spicedham
----------------------------------
Tests for `spicedham` module.
"""
import os
import json
import tarfile
import unittest
from spicedham import SpicedHam
class TestSpicedham(unittest.TestCase):
def setUp(self, tarball='corpus.tar.gz', test_data_... | mpl-2.0 | Python |
b171ea6b459029f8475d947d39b12dbfb66310a7 | add test for plots | DigitalGlobe/gbdxtools,DigitalGlobe/gbdxtools | tests/unit/test_plot.py | tests/unit/test_plot.py | import unittest
import numpy as np
from gbdxtools.images.mixins.geo import PlotMixin
class PlotMock(np.ndarray, PlotMixin):
@property
def _rgb_bands(self):
return [3,1,2]
@property
def _ndvi_bands(self):
return [6,3]
def _read(self, arr, **kwargs):
return arr
class Plo... | import unittest
from numpy import zeros
from gbdxtools.images.mixins.geo import PlotMixin
class PlotMock(np.ndarray, PlotMixin):
@property
def _rgb_bands(self):
return [3,1,2]
@property
def _ndvi_bands(self):
return [6,3]
def _read(self, arr):
return arr
class PlotTest... | mit | Python |
c371d3663fc1de7d99246d97ec054c7da865e4cf | Address model testing coverage: 100% | jrief/django-shop,khchine5/django-shop,khchine5/django-shop,rfleschenberg/django-shop,rfleschenberg/django-shop,divio/django-shop,khchine5/django-shop,awesto/django-shop,awesto/django-shop,jrief/django-shop,rfleschenberg/django-shop,nimbis/django-shop,nimbis/django-shop,rfleschenberg/django-shop,khchine5/django-shop,aw... | testshop/test_models.py | testshop/test_models.py | # -*- coding: utf-8
from __future__ import unicode_literals
from django.test import TestCase
from django.contrib.auth import get_user_model
from shop.models.defaults.address import ShippingAddress
from shop.models.defaults.customer import Customer
class AddressTest(TestCase):
def setUp(self):
super(Addre... | # -*- coding: utf-8
from __future__ import unicode_literals
from django.test import TestCase
from django.contrib.auth import get_user_model
from shop.models.defaults.address import ShippingAddress, BillingAddress # noqa
from shop.models.defaults.customer import Customer
class AddressTest(TestCase):
def setUp(se... | bsd-3-clause | Python |
2d2a42c8e1ada41c4e96c3a68a894f6624be6816 | Fix broken test. | COMBINE-lab/piquant,lweasel/piquant,lweasel/piquant | test/test_parameters.py | test/test_parameters.py | import piquant.parameters as parameters
import os.path
def _get_test_parameter(
name="name", title="The Name", is_numeric=False,
value_namer=None, file_namer=None):
return parameters._Parameter(name, title, is_numeric,
value_namer, file_namer)
def test_get_parame... | import piquant.parameters as parameters
import os.path
def _get_test_parameter(
name="name", title="The Name", is_numeric=False,
value_namer=None, file_namer=None):
return parameters._Parameter(name, title, is_numeric,
value_namer, file_namer)
def test_get_parame... | mit | Python |
12ed1581225f70c7c8777b6ce31710453fda7f51 | fix typo in test argument | rflamary/POT,rflamary/POT | test/test_unbalanced.py | test/test_unbalanced.py | """Tests for module Unbalanced OT with entropy regularization"""
# Author: Hicham Janati <hicham.janati@inria.fr>
#
# License: MIT License
import numpy as np
import ot
import pytest
@pytest.mark.parametrize("method", ["sinkhorn"])
def test_unbalanced_convergence(method):
# test generalized sinkhorn for unbalanc... | """Tests for module Unbalanced OT with entropy regularization"""
# Author: Hicham Janati <hicham.janati@inria.fr>
#
# License: MIT License
import numpy as np
import ot
import pytest
@pytest.mark.parametrize("metric", ["sinkhorn"])
def test_unbalanced_convergence(method):
# test generalized sinkhorn for unbalanc... | mit | Python |
c596e7cf49fb2818218d17ed47d802c0f01591c0 | Add logging functionality to the server script | opentrv/iotlaunchpad,opentrv/iotlaunchpad | iotlaunchpad/scripts/start_server.py | iotlaunchpad/scripts/start_server.py | import os
import argparse
import json
import logging
import datetime
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
from pymongo import MongoClient
logger = logging.getLogger(__name__)
class Echo(DatagramProtocol):
def __init__(self, log_file=None, *args, **kwargs):
... | import json
import logging
import datetime
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
from pymongo import MongoClient
logger = logging.getLogger(__name__)
class Echo(DatagramProtocol):
def datagramReceived(self, data, (host, port)):
try:
json_ ... | apache-2.0 | Python |
58c3d0cc76a21e5df861e8f760780ae156bf6ac0 | Use spacing consistent with other linters. | zenlambda/SublimeLinter-pylint,SublimeLinter/SublimeLinter-pylint | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by NotSqrt
# Copyright (c) 2013 NotSqrt
#
# License: MIT
#
"""This module exports the Pylint plugin class."""
from SublimeLinter.lint import PythonLinter, util
class Pylint(PythonLinter):
"""Provides an interfa... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by NotSqrt
# Copyright (c) 2013 NotSqrt
#
# License: MIT
#
"""This module exports the Pylint plugin class."""
from SublimeLinter.lint import PythonLinter, util
class Pylint(PythonLinter):
"""Provides an interfa... | mit | Python |
b96bcc26596995e7ffbf15cf908d1c52b6e469b9 | Add literate bird style to the file extensions list | SublimeLinter/SublimeLinter-ghc | linter.py | linter.py | from SublimeLinter.lint import Linter, util
from os.path import basename
class Ghc(Linter):
cmd = ('ghc', '-fno-code', '-Wall', '-Wwarn', '-fno-helpful-errors',
'$temp_file')
regex = (
r'\s*(?P<filename>.+):'
r'\s*(?P<line>\d+):(?P<col>\d+):'
r'\s*(?:(?P<warning>[Ww]arning):... | from SublimeLinter.lint import Linter, util
from os.path import basename
class Ghc(Linter):
cmd = ('ghc', '-fno-code', '-Wall', '-Wwarn', '-fno-helpful-errors',
'$temp_file')
regex = (
r'\s*(?P<filename>.+):'
r'\s*(?P<line>\d+):(?P<col>\d+):'
r'\s*(?:(?P<warning>[Ww]arning):... | mit | Python |
c6a674729378fee2a876d1e500a8e6c99bfdc60e | Make linter executable for python/changed epages6 sublime plugin | ePages-rnd/SublimeLinter-contrib-perl-epages6 | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jonas Gratz
# Copyright (c) 2015 Jonas Gratz
#
# License: MIT
#
"""This module exports the PerlEpages6 plugin class."""
import sublime
from SublimeLinter.lint import Linter, util
class PerlEpages6(Linter):
"""... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jonas Gratz
# Copyright (c) 2015 Jonas Gratz
#
# License: MIT
#
"""This module exports the PerlEpages6 plugin class."""
import sublime
from SublimeLinter.lint import Linter, util
class PerlEpages6(Linter):
"""... | mit | Python |
dd45d095bdee89d7261310c5e3df223fff704872 | Use constant in render.py script | mcinglis/libpp,mcinglis/libpp,mcinglis/libpp,mcinglis/libpp | templates/render.py | templates/render.py | #!/bin/env python3
from argparse import ArgumentParser, Namespace
TEMPLATE_SEPARATOR = '#####'
CONTEXT_FUNC_NAME = 'context'
OUTPUT_PREFIX = '''
// This file is the result of rendering `{filepath}`.
// You should make changes to this code by editing that template; not
// this file.
// I'm storing the template rend... | #!/bin/env python3
from argparse import ArgumentParser, Namespace
TEMPLATE_SEPARATOR = '#####'
CONTEXT_FUNC_NAME = 'context'
OUTPUT_PREFIX = '''
// This file is the result of rendering `{filepath}`.
// You should make changes to this code by editing that template; not
// this file.
// I'm storing the template rend... | agpl-3.0 | Python |
86d0302dbfefb749e282249b945a7af180a3aa2b | Set the cache back off for development, my current machine is fast enough again, and the cache slows me when trying to debug the landing page. | 1flow/1flow,WillianPaiva/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow,1flow/1flow,1flow/1flow,1flow/1flow,WillianPaiva/1flow,WillianPaiva/1flow | oneflow/settings/snippets/cache.py | oneflow/settings/snippets/cache.py | # -*- coding: utf-8 -*-
"""
Copyright 2013 Olivier Cortès <oc@1flow.io>
This file is part of the 1flow project.
1flow is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 o... | # -*- coding: utf-8 -*-
"""
Copyright 2013 Olivier Cortès <oc@1flow.io>
This file is part of the 1flow project.
1flow is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 o... | agpl-3.0 | Python |
32a093a95bb1b94fba3ea36dc10b6e81086d9a5b | Check if service is working | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | dbaas/dbaas_services/analyzing/tasks/analyze.py | dbaas/dbaas_services/analyzing/tasks/analyze.py | # -*- coding: utf-8 -*-
import logging
from dbaas.celery import app
from account.models import User
from logical.models import Database
from util.decorators import only_one
from simple_audit.models import AuditRequest
from dbaas_services.analyzing.integration import AnalyzeService
from dbaas_services.analyzing.exceptio... | # -*- coding: utf-8 -*-
from dbaas.celery import app
from account.models import User
from logical.models import Database
from util.decorators import only_one
from simple_audit.models import AuditRequest
from dbaas_services.analyzing.integration import AnalyzeService
@app.task
@only_one(key="analyze_databases_service_... | bsd-3-clause | Python |
8fc6ba648347a48065ab2fb26f940dc92919feeb | Implement new python-based menu format | magfest/bands,magfest/bands | bands/__init__.py | bands/__init__.py | import shutil
from cherrypy.lib.static import serve_file
from uber.common import *
from panels import *
from bands._version import __version__
from bands.config import *
from bands.models import *
import bands.model_checks
import bands.automated_emails
static_overrides(join(bands_config['module_root'], 'static'))
te... | import shutil
from cherrypy.lib.static import serve_file
from uber.common import *
from panels import *
from bands._version import __version__
from bands.config import *
from bands.models import *
import bands.model_checks
import bands.automated_emails
static_overrides(join(bands_config['module_root'], 'static'))
te... | agpl-3.0 | Python |
66ae15ecf21c08493ca3cffcd745abc10ecd15d3 | 删除 debug 信息 | greatghoul/upzone,greatghoul/upzone,greatghoul/upzone,greatghoul/upzone | site/main.py | site/main.py | # coding: utf-8
import os
import datetime
from functools import wraps
from flask import Flask
from flask import session
from flask import request
from flask import Response
from flask import jsonify
from flask import render_template
from tags import js_tag
from tags import css_tag
from upyun import UpYun
from shor... | # coding: utf-8
import os
import datetime
from functools import wraps
from flask import Flask
from flask import session
from flask import request
from flask import Response
from flask import jsonify
from flask import render_template
from tags import js_tag
from tags import css_tag
from upyun import UpYun
from shor... | mit | Python |
c0ca049892b2370da32b95c15a64bad80c401867 | test output | polymonster/pmtech,polymonster/pmtech,polymonster/pmtech,polymonster/pmtech,polymonster/pmtech,polymonster/pmtech | examples/run_tests.py | examples/run_tests.py | import sys
import os
p = os.path.normpath(os.path.join(os.getcwd(), "..", "tools", "build_scripts"))
sys.path.append(p)
import platform
import subprocess
import util
if __name__ == "__main__":
print("--------------------------------------------------------------------------------")
print("pmtech tests -------... | import sys
import os
p = os.path.normpath(os.path.join(os.getcwd(), "..", "tools", "build_scripts"))
sys.path.append(p)
import platform
import subprocess
import util
if __name__ == "__main__":
print("--------------------------------------------------------------------------------")
print("pmtech tests -------... | mit | Python |
3d1cf016bc44742bd501c4dd08373ba18a1932cd | Add outdoor course form test with no rating | makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin | geotrek/outdoor/tests/test_forms.py | geotrek/outdoor/tests/test_forms.py | from django.test import TestCase
from geotrek.authent.factories import UserFactory
from geotrek.outdoor.factories import SiteFactory, RatingFactory, CourseFactory
from geotrek.outdoor.forms import SiteForm, CourseForm
class SiteFormTest(TestCase):
def test_ratings_save(self):
user = UserFactory()
... | from django.test import TestCase
from geotrek.authent.factories import UserFactory
from geotrek.outdoor.factories import SiteFactory, RatingFactory, CourseFactory
from geotrek.outdoor.forms import SiteForm, CourseForm
class SiteFormTest(TestCase):
def test_ratings_save(self):
user = UserFactory()
... | bsd-2-clause | Python |
693bcd599bbeaa6384b21095ec5d27a31c6edaed | Add alternateRegisters to yaml | csquaredphd/ipyxact,olofk/ipyxact,csquaredphd/ipyxact,csquaredphd/ipyxact,olofk/ipyxact | ipyxact/ipxact_yaml.py | ipyxact/ipxact_yaml.py | description = """
---
abstractionType:
ATTRIBS:
vendor: str
library: str
name: str
version: str
addressBlock:
MEMBERS:
name: str
description: str
baseAddress: IpxactInt
range: IpxactInt
width: IpxactInt
CHILDREN:
- register
alternateRegister:
MEMBERS:
name: str
... | description = """
---
abstractionType:
ATTRIBS:
vendor: str
library: str
name: str
version: str
addressBlock:
MEMBERS:
name: str
description: str
baseAddress: IpxactInt
range: IpxactInt
width: IpxactInt
CHILDREN:
- register
busInterface:
MEMBERS:
name: s... | mit | Python |
ba649e4bce746f19712f127ac15e77345a5ec837 | Improve parking area statistics performance | tuomas777/parkkihubi | parkings/api/public/parking_area_statistics.py | parkings/api/public/parking_area_statistics.py | from django.db.models import Case, Count, When
from django.utils import timezone
from rest_framework import serializers, viewsets
from parkings.models import ParkingArea
from ..common import WGS84InBBoxFilter
class ParkingAreaStatisticsSerializer(serializers.ModelSerializer):
current_parking_count = serializers... | from django.utils import timezone
from rest_framework import serializers, viewsets
from parkings.models import Parking, ParkingArea
from ..common import WGS84InBBoxFilter
class ParkingAreaStatisticsSerializer(serializers.ModelSerializer):
current_parking_count = serializers.SerializerMethodField()
def get_... | mit | Python |
7b254be3fbfd0aaf5d02d7c3da2e0ca5bf062c27 | Declare USE_TZ in test settings | SmileyChris/django-countries | django_countries/tests/settings.py | django_countries/tests/settings.py | SECRET_KEY = "test"
INSTALLED_APPS = (
"django.contrib.contenttypes",
"django.contrib.auth",
"django_countries",
"django_countries.tests",
)
DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3"}}
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
STATIC_URL = "/static-assets/"
MIDDLEWAR... | SECRET_KEY = "test"
INSTALLED_APPS = (
"django.contrib.contenttypes",
"django.contrib.auth",
"django_countries",
"django_countries.tests",
)
DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3"}}
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
STATIC_URL = "/static-assets/"
MIDDLEWAR... | mit | Python |
45c9d82bb5c8bf816781ae2834a90e0d3e981797 | print GURLs as strings | meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-ux/meego-app-browser,meego-tablet-u... | tools/gdb/gdb_chrome.py | tools/gdb/gdb_chrome.py | #!/usr/bin/python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""GDB support for Chrome types.
Add this to your gdb by amending your ~/.gdbinit as follows:
python
import sys
sys.path.insert(... | #!/usr/bin/python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""GDB support for Chrome types.
Add this to your gdb by amending your ~/.gdbinit as follows:
python
import sys
sys.path.insert(... | bsd-3-clause | Python |
4d85219734c35dd966a3448b699608b234413be3 | Fix direct assignment of a many-to-many set | melinath/django-graph-api,melinath/django-graph-api | django_graph_api/tests/conftest.py | django_graph_api/tests/conftest.py | import pytest
from test_app.models import (
Droid,
Episode,
Human,
)
@pytest.fixture
def starwars_data(transactional_db):
luke = Human.objects.create(
id=1000,
name='Luke Skywalker',
)
darth_vader = Human.objects.create(
id=1001,
name='Darth Vader',
)
h... | import pytest
from test_app.models import (
Droid,
Episode,
Human,
)
@pytest.fixture
def starwars_data(transactional_db):
luke = Human.objects.create(
id=1000,
name='Luke Skywalker',
)
darth_vader = Human.objects.create(
id=1001,
name='Darth Vader',
)
h... | mit | Python |
508c5be9d8e6bbd668db003f04551bf0ba00178c | set default locale | JKO/nsearch,JKO/nsearch | helper.py | helper.py | import dbmodule
import os
import re
import i18n
currentLocale = re.sub('[_].*','',os.environ['LANG'])
i18n.load_path.append('i18n')
i18n.set('locale',currentLocale) if True else i18n.set('fallback','en')
class Helper:
def __init__(self,args="",):
self.args = args
def process(self):
if not self.args:
... | import dbmodule
import os
import re
import i18n
currentLocale = re.sub('[_].*','',os.environ['LANG'])
i18n.load_path.append('i18n')
i18n.set('locale',currentLocale)
class Helper:
def __init__(self,args="",):
self.args = args
def process(self):
if not self.args:
dbmodule.lastresults = dbmodule.se... | apache-2.0 | Python |
8755a6fc76576e1600eb117015186472a1eb66b4 | fix getmtime calc | VerstandInvictus/LeadVsGold,VerstandInvictus/LeadVsGold,VerstandInvictus/LeadVsGold,VerstandInvictus/LeadVsGold | initdb.py | initdb.py | import re
import os
import config
import pymongo
import arrow
client = pymongo.MongoClient()
db = client.leadvsgold
initdb = db.init
fl = db.fileList
outf = os.path.join(os.getcwdu(), "webapp", "output")
inf = os.path.join(os.getcwdu(), "webapp", config.inputfolder)
stackFiles = list()
fileList = [x for x in os.listdi... | import re
import os
import config
import pymongo
import arrow
client = pymongo.MongoClient()
db = client.leadvsgold
initdb = db.init
fl = db.fileList
outf = os.path.join(os.getcwdu(), "webapp", "output")
inf = os.path.join(os.getcwdu(), "webapp", config.inputfolder)
stackFiles = list()
fileList = [x for x in os.listdi... | mit | Python |
d0e31190b5f3ed1f28deb8faa48fd0a641ee9a21 | Use OwnedObjectAuthorization on subscriptions | SYNHAK/spiff,SYNHAK/spiff,SYNHAK/spiff | spiff/subscription/v1_api.py | spiff/subscription/v1_api.py | from tastypie import fields
from tastypie.resources import ModelResource
from spiff.api import SpiffAuthorization, OwnedObjectAuthorization
from django.contrib.auth.models import User
import models
class SubscriptionPeriodResource(ModelResource):
name = fields.CharField('name')
dayOfMonth = fields.IntegerField('da... | from tastypie import fields
from tastypie.resources import ModelResource
from spiff.api import SpiffAuthorization
from django.contrib.auth.models import User
import models
class SubscriptionPeriodResource(ModelResource):
name = fields.CharField('name')
dayOfMonth = fields.IntegerField('dayOfMonth')
monthOfYear =... | agpl-3.0 | Python |
e35f9ad576317cdc2cb1564984a0807f75b61d14 | comment on the call to test.sh | mark-in/securedrop-app-code,mark-in/securedrop-app-code,mark-in/securedrop-app-code,mark-in/securedrop-app-code | manage.py | manage.py | #!/usr/bin/env python
import sys
import os
import shutil
import subprocess
import unittest
def start():
subprocess.Popen(['python', 'source.py'])
subprocess.Popen(['python', 'journalist.py'])
print "The web application is running, and available on your Vagrant host at the following addresses:"
print ... | #!/usr/bin/env python
import sys
import os
import shutil
import subprocess
import unittest
def start():
subprocess.Popen(['python', 'source.py'])
subprocess.Popen(['python', 'journalist.py'])
print "The web application is running, and available on your Vagrant host at the following addresses:"
print ... | agpl-3.0 | Python |
94a84ffbcb7ef2c52777b53abc97b6d679ad93da | fix CS | missionpinball/mpf,missionpinball/mpf | mpf/tests/test_PlayfieldTransfer.py | mpf/tests/test_PlayfieldTransfer.py | from mpf.tests.MpfTestCase import MpfTestCase
class TestPlayfieldTransfer(MpfTestCase):
def getConfigFile(self):
return 'config.yaml'
def getMachinePath(self):
return 'tests/machine_files/playfield_transfer/'
def testBallPassThrough(self):
# test pass from pf1 to pf2
pf1... | from mpf.tests.MpfTestCase import MpfTestCase
class TestPlayfieldTransfer(MpfTestCase):
def getConfigFile(self):
return 'config.yaml'
def getMachinePath(self):
return 'tests/machine_files/playfield_transfer/'
def testBallPassThrough(self):
pf1 = self.machine.ball_devices['playfi... | mit | Python |
17fc399fb288245fa6966bcf39c3c6e9070daae9 | Undo change manage.py | alper/volunteer_planner,coders4help/volunteer_planner,christophmeissner/volunteer_planner,klinger/volunteer_planner,coders4help/volunteer_planner,coders4help/volunteer_planner,pitpalme/volunteer_planner,volunteer-planner/volunteer_planner,christophmeissner/volunteer_planner,pitpalme/volunteer_planner,klinger/volunteer_... | manage.py | manage.py | #!/usr/bin/env python
# coding=utf-8
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "volunteer_planner.settings.local")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| #!/usr/bin/env python
# coding=utf-8
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "volunteer_planner.settings.local_postgres")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| agpl-3.0 | Python |
26bb48ca0e7fe6b378a4986ba015b250d056a4fa | Fix import | fernando24164/flask_api,fernando24164/flask_api | manage.py | manage.py | #!/usr/bin/env python
from app import create_app, db
from flask_script import Manager, Shell, Server
from flask_migrate import Migrate, MigrateCommand
from app.api.models import User, Weather_Station
app = create_app('default')
manager = Manager(app)
migrate = Migrate(app, db)
def make_shell_context():
return di... | #!/usr/bin/env python
from app import create_app, db
from flask_script import Manager, Shell, Server
from flask_migrate import Migrate, MigrateCommand
from app.api.models import User, Weather_Station
app = create_app('default')
manager = Manager(app)
migrate = Migrate(app, db)
def make_shell_context():
return di... | mit | Python |
7b14890c6f3c2c9e182b6bd4ff267fe8c75b8307 | revert manage.py change | Affirm/cabot,Affirm/cabot,Affirm/cabot,Affirm/cabot | manage.py | manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cabot.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cabot.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| mit | Python |
537c2bae0f70838cae5af155fc04a1d983a64cbe | Change manage.py | voer-platform/vp.web,voer-platform/vp.web,voer-platform/vp.web,voer-platform/vp.web | manage.py | manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "voer.settings.dev")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "voer.settings.local")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| agpl-3.0 | Python |
47606f7469ff6949c54ae4a2d7941cb0eac67675 | add debug mode to manage.py | catatnight/docker-secureproxy,catatnight/docker-secureproxy | manage.py | manage.py | #!/usr/bin/python
import sys
import os
import shlex
import subprocess
import argparse
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
app_name = 'secureproxy'
parser = argparse.ArgumentParser(description='Manage %s container' ... | #!/usr/bin/python
import sys
import os
import shlex
import subprocess
import argparse
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
app_name = 'secureproxy'
parser = argparse.ArgumentParser(description='Manage %s container' ... | mit | Python |
646948c0305778cf3a8656a954744acdd7610404 | Update BasicForeGroundCapture.py | sstocker46/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,mecax/pyrobotlab,MyRobotLab/pyrobotlab,sstocker46/pyrobotlab,MyRobotLab/pyrobotlab,sstocker46/pyrobotlab,mecax/pyrobotlab,MyRobotLab/pyrobotlab | home/GroG/BasicForeGroundCapture.py | home/GroG/BasicForeGroundCapture.py |
def onOpenCVData(data):
if data != None:
boxes = data.getBoundingBoxArray()
if boxes != None:
print "found", boxes.size(), " boxes"
opencv = Runtime.start("uv","OpenCV")
opencv.capture()
python.subscribe("uv","publishOpenCVData", "onOpenCVData")
opencv.addFilter("Detector")
opencv.setDisplay... | opencv = Runtime.start("uv","OpenCV")
opencv.capture()
opencv.addFilter("Detector")
opencv.setDisplayFilter("Detector")
detector = opencv.getFilter("Detector")
opencv.addFilter("FindContours")
contours = opencv.getFilter("FindContours")
detector.learn()
sleep(4)
detector.search()
sleep(20)
opencv.stopCapture(... | apache-2.0 | Python |
23df1ed7a02f3c120a0d5075b27cc92f3e1b6429 | Fix nav at top of window. Use dark theme to distinguish from content. | CodeForPhilly/chime,CodeForPhilly/chime,CodeForPhilly/chime | src/chime_dash/app/components/navbar.py | src/chime_dash/app/components/navbar.py | """Navigation bar view
"""
from typing import List
import dash_html_components as html
import dash_bootstrap_components as dbc
from dash.development.base_component import ComponentMeta
from penn_chime.defaults import Constants
from penn_chime.settings import DEFAULTS
from chime_dash.app.components.base import Compon... | """Navigation bar view
"""
from typing import List
import dash_html_components as html
import dash_bootstrap_components as dbc
from dash.development.base_component import ComponentMeta
from penn_chime.defaults import Constants
from penn_chime.settings import DEFAULTS
from chime_dash.app.components.base import Compon... | mit | Python |
314804e9925e1a9b9f7f661a1129c249a1724d22 | Update jimbob.py | JaneBob/Demo-Video | jimbob.py | jimbob.py | def three_times(x):
if isinstance(x, (int, float, complex)):
return 3*x
else:
return None
| def three_times(x):
return 3*x
| mit | Python |
38f30a581a02c434e5d2e6e77e6ed61657d77c45 | check for modeInheritance | ClinGen/clincoded,ClinGen/clincoded,ClinGen/clincoded,ClinGen/clincoded,ClinGen/clincoded | src/clincoded/upgrade/interpretation.py | src/clincoded/upgrade/interpretation.py | from contentbase.upgrader import upgrade_step
@upgrade_step('interpretation', '1', '2')
def interpretation_1_2(value, system):
# https://github.com/ClinGen/clincoded/issues/1103
if 'modeInheritance' in value:
if value['modeInheritance'] == 'X-linked recessive inheritance (HP:0001419)':
val... | from contentbase.upgrader import upgrade_step
@upgrade_step('interpretation', '1', '2')
def interpretation_1_2(value, system):
# https://github.com/ClinGen/clincoded/issues/1103
if value['modeInheritance'] == 'X-linked recessive inheritance (HP:0001419)':
value['modeInheritance'] = 'X-linked inheritan... | mit | Python |
b0f1f994edf412902a954addf126bc8f9c7a994b | disable auto-install of MarGo | dlclark/GoSublime,nathany/GoSublime,justinfx/GoSublime,anacrolix/GoSublime,alexmullins/GoSublime,DisposaBoy/GoSublime,cdht/GoSublime,FWennerdahl/GoSublime,Mistobaan/GoSublime,anacrolix/GoSublime,cdht/GoSublime,simman/GoSublime,allgeek/GoSublime,simman/GoSublime,nathany/GoSublime,alexmullins/GoSublime,simman/GoSublime,F... | gsinit.py | gsinit.py | import os
import gscommon as gs
import margo
import sublime
def margo_dep(try_install):
motd = "hello world"
resp, err = margo.hello(motd)
m = resp.get('motd')
att_msg = 'Attempting to install MarGo'
if (not 'motd' in resp or not 'actions' in resp) and try_install:
gs.notice('GoSublime', att_msg)
def cb():
... | import os
import gscommon as gs
import margo
import sublime
def margo_dep(try_install):
motd = "hello world"
resp, err = margo.hello(motd)
m = resp.get('motd')
att_msg = 'Attempting to install MarGo'
if (not 'motd' in resp or not 'actions' in resp) and try_install:
gs.notice('GoSublime', att_msg)
def cb():
... | mit | Python |
77818bd13a3bcab3f34e614e0ba79affe3dee891 | Add album to np | xthexder/znc-lastfm | lastfm.py | lastfm.py | import znc, lxml.etree, urllib.request
class lastfm(znc.Module):
description = "Last.fm now playing command for ZNC"
has_args = True
args_help_text = "Last.fm username"
module_types = [znc.CModInfo.UserModule]
username = ""
def OnLoad(self, args, message):
self.username = args
... | import znc, lxml.etree, urllib.request
class lastfm(znc.Module):
description = "Last.fm now playing command for ZNC"
has_args = True
args_help_text = "Last.fm username"
module_types = [znc.CModInfo.UserModule]
username = ""
def OnLoad(self, args, message):
self.username = args
... | mit | Python |
b3c45884cdc9fbc7fbd002dc0f10305e0508f606 | fix lint problems (line length | SublimeLinter/SublimeLinter-ghc,alexbiehl/SublimeLinter-stack-ghc | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jon Surrell
# Copyright (c) 2013 Jon Surrell
#
# License: MIT
#
"""This module exports the Ghc plugin class."""
from SublimeLinter.lint import Linter, util
from os.path import basename
class Ghc(Linter):
"""P... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jon Surrell
# Copyright (c) 2013 Jon Surrell
#
# License: MIT
#
"""This module exports the Ghc plugin class."""
from SublimeLinter.lint import Linter, util
from os.path import basename
class Ghc(Linter):
"""Pr... | mit | Python |
b788712b47664c4737cb11e76166c4833bfccc67 | bump copyright year | SublimeLinter/SublimeLinter-html-tidy | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Aparajita Fishman
# Copyright (c) 2015-2017 The SublimeLinter Community
# Copyright (c) 2013-2014 Aparajita Fishman
#
# License: MIT
#
"""This module exports the HtmlTidy plugin class."""
from SublimeLinter.lint imp... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Aparajita Fishman
# Copyright (c) 2015-2016 The SublimeLinter Community
# Copyright (c) 2013-2014 Aparajita Fishman
#
# License: MIT
#
"""This module exports the HtmlTidy plugin class."""
from SublimeLinter.lint imp... | mit | Python |
c1fff2ae86f03158cd9e29440c523ff262f6f713 | Add custom GOPATH setting | sirreal/SublimeLinter-contrib-gotype | linter.py | linter.py | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jon Surrell
# Copyright (c) 2014 Jon Surrell
#
# License: MIT
#
"""This module exports the Gotype plugin class."""
from os import listdir
from os.path import dirname
from SublimeLinter.lint import Linter, util
cla... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jon Surrell
# Copyright (c) 2014 Jon Surrell
#
# License: MIT
#
"""This module exports the Gotype plugin class."""
from os import listdir
from os.path import dirname
from SublimeLinter.lint import Linter, util
cla... | mit | Python |
4e8bab55d5d0931fdda66b574da37c96dc0e279f | return formatted time on format_value instead of timedelta object (#3657) | maxtorete/frappe,StrellaGroup/frappe,tundebabzy/frappe,maxtorete/frappe,manassolanki/frappe,bohlian/frappe,vjFaLk/frappe,mhbu50/frappe,mhbu50/frappe,bcornwellmott/frappe,chdecultot/frappe,tundebabzy/frappe,vjFaLk/frappe,almeidapaulopt/frappe,rmehta/frappe,chdecultot/frappe,bohlian/frappe,maxtorete/frappe,yashodhank/fra... | frappe/utils/formatters.py | frappe/utils/formatters.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
import datetime
from frappe.utils import formatdate, fmt_money, flt, cstr, cint, format_datetime, format_time
from frappe.model.meta import get_field_currency, get_f... | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
import datetime
from frappe.utils import formatdate, fmt_money, flt, cstr, cint, format_datetime
from frappe.model.meta import get_field_currency, get_field_precisio... | mit | Python |
fdd40b751222d0e0bb91524d7a2698af2cd52276 | Repair badly encoded queries in requests URLs. | Gentux/etalage,Gentux/etalage,Gentux/etalage | etalage/application.py | etalage/application.py | # -*- coding: utf-8 -*-
# Etalage -- Open Data POIs portal
# By: Emmanuel Raviart <eraviart@easter-eggs.com>
#
# Copyright (C) 2011, 2012 Easter-eggs
# http://gitorious.org/infos-pratiques/etalage
#
# This file is part of Etalage.
#
# Etalage is free software; you can redistribute it and/or modify
# it under the term... | # -*- coding: utf-8 -*-
# Etalage -- Open Data POIs portal
# By: Emmanuel Raviart <eraviart@easter-eggs.com>
#
# Copyright (C) 2011, 2012 Easter-eggs
# http://gitorious.org/infos-pratiques/etalage
#
# This file is part of Etalage.
#
# Etalage is free software; you can redistribute it and/or modify
# it under the term... | agpl-3.0 | Python |
c431167af4bb4415787c7b6193838cfb85f2a2d2 | fix processing multi-includes | thingswise/tw-etcdstat | etcdstat/complexini.py | etcdstat/complexini.py | import os.path
import ConfigParser
class ComplexIniFile(object):
def __init__(self, root_dir=None):
self.root_dir = root_dir
self.root = None
self.parsers = []
def read(self, file):
self.root = ConfigParser.ConfigParser()
self.root.optionxform = str # preserve case
... | import os.path
import ConfigParser
class ComplexIniFile(object):
def __init__(self, root_dir=None):
self.root_dir = root_dir
self.root = None
self.parsers = []
def read(self, file):
self.root = ConfigParser.ConfigParser()
self.root.optionxform = str # preserve case
... | apache-2.0 | Python |
9dab1046d086517131dd456f659eac286ba4b5b4 | change from utils import PathTransform to from utils import g_ptransform and use the global variable g_ptransform instead of create a new PathTransform. This resolve a bug when open EventEditor to set an item_move action or an item_req requirement | develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms | trunk/editor/itemslistwidget.py | trunk/editor/itemslistwidget.py | #!/usr/bin/env python
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from structdata import g_project
from roomitemlistwidget import RoomItemListWidget
from utils import g_ptransform
class ItemsListWidget(RoomItemListWidget):
"""
Classe che eredita da RoomsListWidget, serve per mostrare gli ITEMS nel... | #!/usr/bin/env python
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from structdata import g_project
from roomitemlistwidget import RoomItemListWidget
from utils import PathTransform
class ItemsListWidget(RoomItemListWidget):
"""
Classe che eredita da RoomsListWidget, serve per mostrare gli ITEMS ne... | mit | Python |
18bba0f5ce899c20943c4a143202ba376dbe8971 | Remove dead code | MITRECND/multiscanner,awest1339/multiscanner,awest1339/multiscanner,mitre/multiscanner,MITRECND/multiscanner,awest1339/multiscanner,jmlong1027/multiscanner,mitre/multiscanner,jmlong1027/multiscanner,jmlong1027/multiscanner,awest1339/multiscanner,jmlong1027/multiscanner,mitre/multiscanner | storage/test_driver.py | storage/test_driver.py | #!/usr/bin/env python
from storage import Storage
from sqlite_driver import Database
NEW_REPORT = {'foo': 'bar', 'boo': 'baz'}
REPORTS = {
"/tmp/example.log": {"MD5": "53f43f9591749b8cae536ff13e48d6de", "SHA256": "815d310bdbc8684c1163b62f583dbaffb2df74b9104e2aadabf8f8491bafab66", "libmagic": "ASCII text"},
"/op... | #!/usr/bin/env python
from storage import Storage
from sqlite_driver import Database
NEW_REPORT = {'foo': 'bar', 'boo': 'baz'}
REPORTS = {
"/tmp/example.log": {"MD5": "53f43f9591749b8cae536ff13e48d6de", "SHA256": "815d310bdbc8684c1163b62f583dbaffb2df74b9104e2aadabf8f8491bafab66", "libmagic": "ASCII text"},
"/op... | mpl-2.0 | Python |
bd7b5d17222e2ef305ddd79e566406179edbfa2a | Add various test cases in test_bulkresize.py file | sukeesh/Jarvis,sukeesh/Jarvis,sukeesh/Jarvis,sukeesh/Jarvis | jarviscli/plugins/test_bulkresize.py | jarviscli/plugins/test_bulkresize.py | from unittest import mock
import unittest
import os
from Jarvis import Jarvis
from plugins.bulkresize import spin
from plugins import bulkresize
from tests import PluginTest
CURRENT_PATH = os.path.dirname(os.path.abspath(__file__))
DATA_PATH = os.path.join(CURRENT_PATH, '..', 'data/')
class Bulkresize(PluginTest):... | from unittest import mock
import unittest
import os
from Jarvis import Jarvis
from plugins.bulkresize import spin
from plugins import bulkresize
from tests import PluginTest
CURRENT_PATH = os.path.dirname(os.path.abspath(__file__))
DATA_PATH = os.path.join(CURRENT_PATH, '..', 'data/')
class Bulkresize(PluginTest):... | mit | Python |
31657937394f87e2777a06b1c76764864d0bc0ce | extend imager profile model | gatita/django-imager,gatita/django-imager,gatita/django-imager | imagersite/imager_profile/models.py | imagersite/imager_profile/models.py | from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.contrib.auth.models import User
@python_2_unicode_compatible
class ImagerProfile(models.Model):
user = models.OneToOneField(
User,
related_name='profile',
null=False
)
camera = mo... | from django.db import models
from django.contrib.auth.models import User
# @python_2_unicode_compatible
class ImagerProfile(models.Model):
user = models.OneToOneField(
User,
related_name='profile',
null=False
)
camera = models.CharField()
address = models.TextField()
websit... | mit | Python |
28dd1c47542e9d8e15be75b49557d75d249b3f43 | remove verbose info | test1943/ShadowVPN,sunclx/ShadowVPN,noikiy/ShadowVPN,froggatt/ShadowVPN,froggatt/ShadowVPN,bjrara/ShadowVPN,test1943/ShadowVPN,bjrara/ShadowVPN,noikiy/ShadowVPN,sunclx/ShadowVPN | tools/negate_network.py | tools/negate_network.py | #!/usr/bin/env python3
#
# Copyright (c) 2014 clowwindy
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, ... | #!/usr/bin/env python3
#
# Copyright (c) 2014 clowwindy
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, ... | mit | Python |
c056ca6c31615b89f0c94640d24f8ebb7da334f9 | Add urlname when building list of custom view on admin index | drdaeman/django-adminplus,drdaeman/django-adminplus,deannariddlespur/django-adminplus,deannariddlespur/django-adminplus,happylyang/django-adminplus,drdaeman/django-adminplus,deannariddlespur/django-adminplus,happylyang/django-adminplus,happylyang/django-adminplus | adminplus/__init__.py | adminplus/__init__.py | from django.contrib.admin.sites import AdminSite
from django.utils.text import capfirst
VERSION = (0, 1, 5)
__version__ = '.'.join([str(x) for x in VERSION])
class AdminSitePlus(AdminSite):
"""Extend AdminSite to allow registering custom admin views."""
index_template = 'adminplus/index.html' # That was ea... | from django.contrib.admin.sites import AdminSite
from django.utils.text import capfirst
VERSION = (0, 1, 5)
__version__ = '.'.join([str(x) for x in VERSION])
class AdminSitePlus(AdminSite):
"""Extend AdminSite to allow registering custom admin views."""
index_template = 'adminplus/index.html' # That was ea... | bsd-3-clause | Python |
eb519f3162c66e52637e9f1ae081fd05308c461b | declare connstants and add 'rotate' option | btimby/fulltext,btimby/fulltext | fulltext/backends/__ocr.py | fulltext/backends/__ocr.py | # sudo apt-get install tesseract-ocr
# sudo pip3 install pytesseract
# sudo apt-get install tesseract-ocr-[lang]
from fulltext.util import which
import pytesseract
from PIL import Image
import logging
LOGGER = logging.getLogger(__name__)
EXTENSIONS = ('jpg', 'jpeg', 'bmp', 'png', 'gif')
ORIENTATION_KEY = 274 # cf ... | # sudo apt-get install tesseract-ocr
# sudo pip3 install pytesseract
# sudo apt-get install tesseract-ocr-[lang]
from fulltext.util import which
import pytesseract
from PIL import Image
import logging
LOGGER = logging.getLogger(__name__)
EXTENSIONS = ('jpg', 'jpeg', 'bmp', 'png', 'gif')
if which('tesseract') is Non... | mit | Python |
01bce9e334fe33efa1d8242cc9fe16b5d241abe4 | Fix example | methane/minefield,methane/minefield,methane/minefield,methane/minefield | example/static_file.py | example/static_file.py | import meinheld
class FileWrapper(object):
def __init__(self, file, buffer_size=8192):
self.file = file
self.buffer_size = buffer_size
def close(self):
if hasattr(self.file, 'close'):
self.file.close()
def __iter__(self):
return self
def next(self):
... | import meinheld
class FileWrapper(object):
def __init__(self, file, buffer_size=8192):
self.file = file
self.buffer_size = buffer_size
def close(self):
if hasattr(self.file, 'close'):
self.file.close()
def __iter__(self):
return self
def next(self):
... | bsd-3-clause | Python |
517bce306b530e1598293f7c8d30d09097c08752 | FIX SGD split | mlindauer/GenericWrapper4AC,mlindauer/GenericWrapper4AC,mlindauer/GenericWrapper4AC | examples/SGD/sgd_ta.py | examples/SGD/sgd_ta.py | import sys
from sklearn.linear_model import SGDClassifier
from sklearn.datasets import load_iris
from sklearn import cross_validation
iris = load_iris()
X_train_f, X_test, y_train_f, y_test = cross_validation.train_test_split(iris.data, iris.target, test_size=0.25, random_state=0)
X_train, X_valid, y_train, y_valid ... | import sys
from sklearn.linear_model import SGDClassifier
from sklearn.datasets import load_iris
from sklearn import cross_validation
iris = load_iris()
X_train, X_test, y_train, y_test = cross_validation.train_test_split(iris.data, iris.target, test_size=0.25, random_state=0)
X_train, X_valid, y_train, y_valid = cr... | bsd-2-clause | Python |
7ba9f27f2b9cf87ef071f98223dc06c30b4df215 | Set CHECKOUT_SOURCE_ROOT environment variable for Android test wrapper. | ShiftMediaProject/libilbc,TimothyGu/libilbc,TimothyGu/libilbc,ShiftMediaProject/libilbc,TimothyGu/libilbc,ShiftMediaProject/libilbc,TimothyGu/libilbc,ShiftMediaProject/libilbc,TimothyGu/libilbc,ShiftMediaProject/libilbc | webrtc/build/android/test_runner.py | webrtc/build/android/test_runner.py | #!/usr/bin/env python
# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All c... | #!/usr/bin/env python
# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All c... | bsd-3-clause | Python |
e889161ded9e959582ece2e56b01d43f6a8d6db8 | change from call()/check_call to Popen() in log_exec. This will raise and log an exception when spawned processes barf. nm.daemon should now be empty :-D | planetlab/NodeManager,dreibh/planetlab-lxc-nodemanager,planetlab/NodeManager,dreibh/planetlab-lxc-nodemanager,planetlab/NodeManager,planetlab/NodeManager,dreibh/planetlab-lxc-nodemanager | logger.py | logger.py | #
# Something relevant
#
"""A very simple logger that tries to be concurrency-safe."""
import os, sys
import subprocess
import time
import traceback
LOG_FILE = '/var/log/nm'
LOG_SLIVERS = '/var/log/getslivers.txt'
# Thierry - trying to debug this for 4.2
# basically define 3 levels
LOG_NONE=0
LOG_NODE=1
LOG_VERBOSE... | #
# Something relevant
#
"""A very simple logger that tries to be concurrency-safe."""
import os, sys
import subprocess
import time
import traceback
LOG_FILE = '/var/log/nm'
LOG_SLIVERS = '/var/log/getslivers.txt'
# Thierry - trying to debug this for 4.2
# basically define 3 levels
LOG_NONE=0
LOG_NODE=1
LOG_VERBOSE... | bsd-3-clause | Python |
a3a303eca8e99b44d5750770bb469add4e10b19a | Remove links from warning messags for now | SSJohns/osf.io,zachjanicki/osf.io,reinaH/osf.io,adlius/osf.io,brianjgeiger/osf.io,brianjgeiger/osf.io,crcresearch/osf.io,KAsante95/osf.io,doublebits/osf.io,KAsante95/osf.io,amyshi188/osf.io,jmcarp/osf.io,acshi/osf.io,CenterForOpenScience/osf.io,wearpants/osf.io,leb2dg/osf.io,mluo613/osf.io,chennan47/osf.io,emetsger/osf... | website/addons/figshare/messages.py | website/addons/figshare/messages.py | # MODEL MESSAGES :model.py
BEFORE_PAGE_LOAD_PRIVATE_NODE_MIXED_FS = 'Warning: This OSF {category} is private but figshare project {project_id} may contain some public files or filesets.'
BEFORE_PAGE_LOAD_PUBLIC_NODE_MIXED_FS = 'Warning: This OSF {category} is public but figshare project {project_id} may contain some p... | # MODEL MESSAGES :model.py
BEFORE_PAGE_LOAD_PRIVATE_NODE_MIXED_FS = 'Warning: This OSF {category} is private but figshare project {project_id} may contain some public files or filesets. The files in this figshare project can be viewed <a href="https://http://figshare.com/articles/{project_id}/{figshare_id}">here</a>'
... | apache-2.0 | Python |
f99114c6f8824c297711369fea4088b16d2e19df | Fix data loading name | davidgasquez/kaggle-airbnb | scripts/holidays_distance.py | scripts/holidays_distance.py | #!/usr/bin/env python
import pandas as pd
from datetime import date
import holidays
def sanitize_holiday_name(name):
new_name = [c for c in name if c.isalpha() or c.isdigit() or c == ' ']
new_name = "".join(new_name).lower().replace(" ", "_")
return new_name
def process_holidays(df):
# Create a dat... | #!/usr/bin/env python
import pandas as pd
from datetime import date
import holidays
def sanitize_holiday_name(name):
new_name = [c for c in name if c.isalpha() or c.isdigit() or c == ' ']
new_name = "".join(new_name).lower().replace(" ", "_")
return new_name
def process_holidays(df):
# Create a dat... | mit | Python |
3bc271ff241e1908385935a76d0b00c533baee4b | add Python 3 friendliness to the session example | ddbeck/oraide | examples/session.py | examples/session.py | """A demonstration of the ``Session`` API."""
from __future__ import print_function
import oraide
EARNESTNESS = """\
ALGERNON: Well, that is exactly what dentists always do. Now, go on!
Tell me the whole thing. I may mention that I have always
suspected you of being a confirmed and secret Bunbur... | """A demonstration of the ``Session`` API."""
import oraide
EARNESTNESS = """\
ALGERNON: Well, that is exactly what dentists always do. Now, go on!
Tell me the whole thing. I may mention that I have always
suspected you of being a confirmed and secret Bunburyist; and
I am quite sure of ... | bsd-3-clause | Python |
7ec28d5b8be40b505a20a4670857278ad41f760b | Allow "threshold" to be specified during parse(...). | PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge,PhilHarnish/forge | src/puzzle/puzzlepedia/puzzlepedia.py | src/puzzle/puzzlepedia/puzzlepedia.py | from IPython import display
from puzzle.puzzlepedia import prod_config, puzzle, puzzle_widget
_INITIALIZED = False
def parse(source, hint=None, threshold=None):
_init()
result = puzzle.Puzzle('first stage', source, hint=hint, threshold=threshold)
interact_with(result)
return result
def interact_with(puzzl... | from IPython import display
from puzzle.puzzlepedia import prod_config, puzzle, puzzle_widget
_INITIALIZED = False
def parse(source, hint=None):
_init()
result = puzzle.Puzzle('first stage', source, hint=hint)
interact_with(result)
return result
def interact_with(puzzle):
_init()
display.display(puzzl... | mit | Python |
b26c73a5237d1e659274d77c2aef6b2526ea81c8 | update test | gbrammer/grizli | grizli/tests/test_utils.py | grizli/tests/test_utils.py | import unittest
import numpy as np
from .. import utils
class UtilsTester(unittest.TestCase):
def test_log_zgrid(self):
"""
Logarithmic-spaced grid
"""
value = np.array([0.1, 0.21568801, 0.34354303,
0.48484469, 0.64100717, 0.8135934])
... | import unittest
import numpy as np
from .. import utils
class UtilsTester(unittest.TestCase):
def test_log_zgrid(self):
"""
Logarithmic-spaced grid
"""
value = np.array([0.1, 0.21568801, 0.34354303,
0.48484469, 0.64100717, 0.8135934])
... | mit | Python |
d5473e43f99047bb73bf61d5aa2816a8faf416d4 | fix python test runner | jangorecki/h2o-3,h2oai/h2o-3,YzPaul3/h2o-3,brightchen/h2o-3,printedheart/h2o-3,brightchen/h2o-3,michalkurka/h2o-3,michalkurka/h2o-3,mathemage/h2o-3,h2oai/h2o-3,brightchen/h2o-3,kyoren/https-github.com-h2oai-h2o-3,mathemage/h2o-3,pchmieli/h2o-3,h2oai/h2o-3,kyoren/https-github.com-h2oai-h2o-3,printedheart/h2o-3,madmax983... | h2o-py/tests/h2o_pyunit.py | h2o-py/tests/h2o_pyunit.py | import urllib2
import sys
sys.path.insert(1, "..")
import h2o
from tests import utils
"""
Here is some testing infrastructure for running the pyunit tests in conjunction with run.py.
run.py issues an ip and port as a string: "<ip>:<port>".
The expected value of sys_args[1] is "<ip>:<port>"
All tests MUST have the f... | import urllib2
import sys
sys.path.insert(1, "..")
import h2o
from tests import utils
"""
Here is some testing infrastructure for running the pyunit tests in conjunction with run.py.
run.py issues an ip and port as a string: "<ip>:<port>".
The expected value of sys_args[1] is "<ip>:<port>"
All tests MUST have the f... | apache-2.0 | Python |
4a004e0eaee5b69571abcd845d68f0c5bbda7deb | Bump version to 0.0.9 | jbbarth/aws-status,jbbarth/aws-status | aws_status/__init__.py | aws_status/__init__.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
__version__ = '0.0.9'
| # -*- coding: utf-8 -*-
from __future__ import absolute_import
__version__ = '0.0.8'
| mit | Python |
5301c8fc27a405c530eab73ceba54ad03303dc9d | Update _highcharts.py | oscar6echo/ezhc,oscar6echo/ezhc,oscar6echo/ezhc | ezhc/_highcharts.py | ezhc/_highcharts.py |
from ._wrapper import Wrapper
from ._plot import plot, html, opt_to_dict, opt_to_json
class Highcharts(Wrapper):
"""
Main Highcharts Object
API: https://api.highcharts.com/highcharts
Demos: https://www.highcharts.com/demo
"""
def __init__(self):
Wrapper.__init__(self, lib='highchart... |
from ._wrapper import Wrapper
from ._plot import plot, html, opt_to_dict, opt_to_json
class Highcharts(Wrapper):
"""
Main Highcharts Object
API: http://api.highcharts.com/highcharts
Demos: http://www.highcharts.com/demo
"""
def __init__(self):
Wrapper.__init__(self, lib='highcharts'... | mit | Python |
5d034f7ba6489d0a2393fc4ef7ea4193175b4e9e | add parentheses to comparison | xflr6/features | features/_compat.py | features/_compat.py | # _compat.py - Python 2/3 compatibility
import sys
PY2 = (sys.version_info.major == 2)
if PY2:
string_types = basestring
from itertools import imap as map, izip as zip
def py2_bool_to_nonzero(cls):
cls.__nonzero__ = cls.__bool__
del cls.__bool__
return cls
import copy_reg ... | # _compat.py - Python 2/3 compatibility
import sys
PY2 = sys.version_info.major == 2
if PY2:
string_types = basestring
from itertools import imap as map, izip as zip
def py2_bool_to_nonzero(cls):
cls.__nonzero__ = cls.__bool__
del cls.__bool__
return cls
import copy_reg as... | mit | Python |
735ca509f063612f5bb958ba44f8200df508703c | update __init__.py | Archman/felapps,Archman/felapps,Archman/felapps | felapps/__init__.py | felapps/__init__.py | from .utils import felutils, funutils, resutils
from .physics import felcalc, felbase
from .facilities import dcls
from .apps.imageviewer import imageviewer
from .apps.cornalyzer import cornalyzer
from .apps.felformula import felformula
#__all__ = [imageviewer]
| from .utils import felutils, funutils, resutils
from .physics import felcalc, felbase
from .facilities import dcls
from .apps.imageviewer import imageviewer
from .apps.cornalyzer import cornalyzer
from .apps.felformula import felformula
from .tests import test_felbase
#__all__ = [imageviewer]
| mit | Python |
3b7cd5385585962fe640e2d8223368dc721a1520 | Modify set_config to take a config rather than initialize one | theherk/figgypy | figgypy/__init__.py | figgypy/__init__.py | """figgypy is a simple configuration manager"""
__title__ = 'figgypy'
__author__ = 'Herkermer Sherwood'
from figgypy.config import Config
_config = None
def get_config():
"""Get the global configuration.
For this to work you must first call figgypy.set_config. See set_config for help.
The only purpos... | """figgypy is a simple configuration manager"""
__title__ = 'figgypy'
__author__ = 'Herkermer Sherwood'
from figgypy.config import Config
_config = None
def get_config():
"""Get the global configuration.
For this to work you must first call figgypy.set_config. See set_config for help.
The only purpos... | mit | Python |
55149d1a999113fa967f9b125d9165fe80e88e69 | remove leftover debug print | SiLab-Bonn/basil,SiLab-Bonn/basil | basil/HL/SussProber.py | basil/HL/SussProber.py | #
# ------------------------------------------------------------
# Copyright (c) All rights reserved
# SiLab, Institute of Physics, University of Bonn
# ------------------------------------------------------------
#
from basil.HL.RegisterHardwareLayer import HardwareLayer
class SussProber(HardwareLayer):
'''Imp... | #
# ------------------------------------------------------------
# Copyright (c) All rights reserved
# SiLab, Institute of Physics, University of Bonn
# ------------------------------------------------------------
#
from basil.HL.RegisterHardwareLayer import HardwareLayer
class SussProber(HardwareLayer):
'''Imp... | bsd-3-clause | Python |
2d80fe9ca952b61843e1b6f40d921df21b703b02 | Leverage get_server_hostname within LostPasswordHash | gencer/sentry,ifduyue/sentry,JamesMura/sentry,nicholasserra/sentry,daevaorn/sentry,alexm92/sentry,fotinakis/sentry,beeftornado/sentry,ifduyue/sentry,daevaorn/sentry,looker/sentry,zenefits/sentry,fotinakis/sentry,nicholasserra/sentry,ifduyue/sentry,mvaled/sentry,jean/sentry,JamesMura/sentry,gencer/sentry,fotinakis/sentr... | src/sentry/models/lostpasswordhash.py | src/sentry/models/lostpasswordhash.py | """
sentry.models.useroption
~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from datetime import timedelta
from django.conf import settings
from django.core.urlresolvers import... | """
sentry.models.useroption
~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from datetime import timedelta
from django.conf import settings
from django.core.urlresolvers import... | bsd-3-clause | Python |
cea103fa17a03efa4857dea3d8aaea708f0982a2 | Bump version | theonion/betty-cropper,theonion/betty-cropper,theonion/betty-cropper,theonion/betty-cropper | betty/__init__.py | betty/__init__.py | from __future__ import absolute_import
from .celery import app as celery_app # noqa
__version__ = "0.3.6"
| from __future__ import absolute_import
from .celery import app as celery_app # noqa
__version__ = "0.3.5"
| mit | Python |
ef1e6f9029f8a9ed980e72e9cd71308c40a92ab3 | fix showing user in admin | praekelt/jmbo-your-words,praekelt/jmbo-your-words | jmboyourwords/admin.py | jmboyourwords/admin.py | from django.contrib import admin
from jmboyourwords.models import YourStoryCompetition, YourStoryEntry
from ckeditor.widgets import CKEditorWidget
from django.db import models
class YourStoryCompetitionAdmin(admin.ModelAdmin):
list_filter = ('created', 'publish_on', 'retract_on')
list_display = ('title', 'pub... | from django.contrib import admin
from jmboyourwords.models import YourStoryCompetition, YourStoryEntry
from ckeditor.widgets import CKEditorWidget
from django.db import models
class YourStoryCompetitionAdmin(admin.ModelAdmin):
list_filter = ('created', 'publish_on', 'retract_on')
list_display = ('title', 'pub... | bsd-3-clause | Python |
830de70510a9608c11d20f7ae66ec7f3c72eca6a | Make modules uninstallable | OCA/l10n-brazil,OCA/l10n-brazil,OCA/l10n-brazil | l10n_br_stock_account/__openerp__.py | l10n_br_stock_account/__openerp__.py | # -*- coding: utf-8 -*-
# Copyright (C) 2014 Renato Lima - Akretion
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
'name': 'Brazilian Localization WMS Accounting',
'category': 'Localisation',
'license': 'AGPL-3',
'author': 'Akretion, Odoo Community Association (OCA)',
'website'... | # -*- coding: utf-8 -*-
# Copyright (C) 2014 Renato Lima - Akretion
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
'name': 'Brazilian Localization WMS Accounting',
'category': 'Localisation',
'license': 'AGPL-3',
'author': 'Akretion, Odoo Community Association (OCA)',
'website'... | agpl-3.0 | Python |
f561954247bd2cbc878f5ffdcea91b95e80d1a96 | Modify softmax | raviqqe/tensorflow-extenteten,raviqqe/tensorflow-extenteten | extenteten/softmax.py | extenteten/softmax.py | import tensorflow as tf
from . import batch
from .util import static_rank, func_scope, dtype_min, dtype_epsilon
from .mask import mask
__all__ = ['softmax']
@func_scope()
def softmax(vector, sequence_length=None):
assert static_rank(vector) == 2
return (tf.nn.softmax(vector)
if sequence_length... | import tensorflow as tf
from . import batch
from .util import static_rank, func_scope, dtype_min, dtype_epsilon
from .mask import mask
@func_scope()
def softmax(vector, sequence_length=None):
assert static_rank(vector) == 2
return tf.nn.softmax(vector) if sequence_length is None else \
_dynamic_soft... | unlicense | Python |
265e414b6f871b5903fcd8b92ac74b20e116a145 | Improve examples/odop_solar.py visual & comments (#1253) | yuanming-hu/taichi,yuanming-hu/taichi,yuanming-hu/taichi,yuanming-hu/taichi | examples/odop_solar.py | examples/odop_solar.py | import taichi as ti
import math
@ti.data_oriented
class SolarSystem:
def __init__(self, n, dt):
# initializer of the solar system simulator
self.n = n
self.dt = dt
self.x = ti.Vector(2, dt=ti.f32, shape=n)
self.v = ti.Vector(2, dt=ti.f32, shape=n)
self.center = ti.V... | import taichi as ti
@ti.data_oriented
class SolarSystem:
def __init__(self, n, dt):
self.n = n
self.dt = dt
self.x = ti.Vector(2, dt=ti.f32, shape=n)
self.v = ti.Vector(2, dt=ti.f32, shape=n)
self.center = ti.Vector(2, dt=ti.f32, shape=())
@staticmethod
@ti.func
... | apache-2.0 | Python |
e1b862931359b953dcc225bce0cd5cfb0f17d514 | Fix setup wiz test (#11640) | gsnbng/erpnext,indictranstech/erpnext,indictranstech/erpnext,gsnbng/erpnext,indictranstech/erpnext,gsnbng/erpnext,indictranstech/erpnext,gsnbng/erpnext | erpnext/setup/setup_wizard/test_setup_wizard.py | erpnext/setup/setup_wizard/test_setup_wizard.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe, time
from frappe.utils.selenium_testdriver import TestDriver
def run_setup_wizard_test():
driver = TestDriver()
frappe.db.set_default... | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe, time
from frappe.utils.selenium_testdriver import TestDriver
def run_setup_wizard_test():
driver = TestDriver()
frappe.db.set_default... | agpl-3.0 | Python |
3cca67655cb418c42a91d6b2d275581f5823412d | Rework adder tests | Mause/circuitry | tests/alu/test_adder.py | tests/alu/test_adder.py | import unittest
from itertools import product, tee
from ..utils import get_graph, build_pins, as_bin
adder_cir = get_graph('alu/adder.cir')
HalfAdder = adder_cir.get('half_adder')
FullAdder = adder_cir.get('full_adder')
EightBitAdder = adder_cir.get('eight_bit_adder')
def half(a, b):
return HalfAdder('ha').set_... | import unittest
from os.path import dirname, join
HERE = dirname(__file__)
from circuitry.graph import load_graph
from circuitry.connectable_impls import CustomComponentImplementation
with open(join(HERE, 'adder.cir')) as fh:
SAMPLE_GRAPH = load_graph(fh.read())
customcomponent = {t.ttype: t for t in SAMPLE_GRAP... | mit | Python |
d94a14344845a8fc2b4055c70932fc6ff17302c3 | Fix typo | pinax/pinax-calendars,eldarion/kairios,eldarion/kairios | kairios/templatetags/kairios_tags.py | kairios/templatetags/kairios_tags.py | import calendar as cal
import datetime
from django import template
from django.utils import timezone
import pytz
register = template.Library()
def delta(year, month, d):
mm = month + d
yy = year
if mm > 12:
mm, yy = mm % 12, year + mm / 12
elif mm < 1:
mm, yy = 12 + mm, year - 1
... | import calendar as cal
import datetime
from django import template
from django.util import timezone
import pytz
register = template.Library()
def delta(year, month, d):
mm = month + d
yy = year
if mm > 12:
mm, yy = mm % 12, year + mm / 12
elif mm < 1:
mm, yy = 12 + mm, year - 1
... | unknown | Python |
675a64681ca04ceca1aad2ba393ffd94aaef84a9 | Remove debug code. | AGoodId/begood-sites | begood_sites/fields.py | begood_sites/fields.py | from django.db import models
from django.contrib.sites.models import Site
class MultiSiteField(models.ManyToManyField):
def __init__(self, **kwargs):
defaults = {
'blank': False,
}
defaults.update(kwargs)
if 'to' in defaults:
del defaults['to']
super(MultiSiteField, self).__in... | from django.db import models
from django.contrib.sites.models import Site
class MultiSiteField(models.ManyToManyField):
def __init__(self, **kwargs):
defaults = {
'blank': False,
}
defaults.update(kwargs)
if 'to' in defaults:
del defaults['to']
super(MultiSiteField, self).__in... | mit | Python |
6c852a89022792daf13e788eb21128ec7671a8ea | Update _release.py | bjodah/finitediff,bjodah/finitediff,bjodah/finitediff,bjodah/finitediff,bjodah/finitediff | finitediff/_release.py | finitediff/_release.py | __version__ = '0.7.0.dev0+git'
| __version__ = '0.6.0.dev0+git'
| bsd-2-clause | Python |
78739cb8627f97cb849b05ea18e8666c3d26d903 | Make get_filename more robust | xesscorp/skidl,xesscorp/skidl | tests/setup_teardown.py | tests/setup_teardown.py | import os
from skidl import *
files_at_start = set([])
def setup_function(f):
global files_at_start
files_at_start = set(os.listdir('.'))
# Make this test directory the library search paths for all ECAD tools
for tool_lib_path in lib_search_paths:
tool_lib_path = [os.path.dirname(os.path.abs... | import os
from skidl import *
files_at_start = set([])
def setup_function(f):
global files_at_start
files_at_start = set(os.listdir('.'))
# Make this test directory the library search paths for all ECAD tools
for tool_lib_path in lib_search_paths:
tool_lib_path = [os.path.dirname(os.path.abs... | mit | Python |
e51ea7632ec18130a65d8f905a1bb82d40e3d06f | reduce test target in test_apiserver | braveghz/cobra,wufeifei/cobra,wufeifei/cobra,LiGhT1EsS/cobra,wufeifei/cobra,braveghz/cobra,40huo/cobra,wufeifei/cobra,wufeifei/cobra,40huo/cobra,LiGhT1EsS/cobra,40huo/cobra,40huo/cobra,LiGhT1EsS/cobra,40huo/cobra,braveghz/cobra,LiGhT1EsS/cobra,braveghz/cobra,braveghz/cobra,LiGhT1EsS/cobra,braveghz/cobra,wufeifei/cobra,... | tests/test_apiserver.py | tests/test_apiserver.py | # -*- coding: utf-8 -*-
"""
tests.apiserver
~~~~~~~~~~~~
Tests cobra.api
:author: 40huo <git@40huo.cn>
:homepage: https://github.com/wufeifei/cobra
:license: MIT, see LICENSE for more details.
:copyright: Copyright (c) 2017 Feei. All rights reserved
"""
import requests
import json
... | # -*- coding: utf-8 -*-
"""
tests.apiserver
~~~~~~~~~~~~
Tests cobra.api
:author: 40huo <git@40huo.cn>
:homepage: https://github.com/wufeifei/cobra
:license: MIT, see LICENSE for more details.
:copyright: Copyright (c) 2017 Feei. All rights reserved
"""
import requests
import json
... | mit | Python |
275ae5edcfaa42ebcca287e61f26b89aa34d9702 | cover remote broker shutdown | drzaeus77/pyroute2,tomislacker/python-iproute2,roolebo/pyroute2,mtiny/pyroute2,simudream/pyroute2,nazarewk/pyroute2,tomislacker/python-iproute2,vodik/pyroute2,little-dude/pyroute2,nazarewk/pyroute2,drzaeus77/pyroute2,mtiny/pyroute2,roolebo/pyroute2,simudream/pyroute2,little-dude/pyroute2,nazarewk/pyroute2,little-dude/p... | tests/test_messaging.py | tests/test_messaging.py | from pyroute2.netlink import IPRCMD_STOP
from pyroute2.iocore import NLT_DGRAM
from pyroute2.rpc import public
from pyroute2.rpc import Node
from pyroute2 import IOCore
class TestIOBroker(object):
def test_stop(self):
ioc1 = IOCore()
ioc1.iobroker.secret = 'bala'
ioc1.serve('tcp://localho... | from pyroute2.iocore import NLT_DGRAM
from pyroute2.rpc import public
from pyroute2.rpc import Node
class Namespace(object):
@public
def echo(self, msg):
return '%s passed' % (msg)
@public
def error(self):
raise RuntimeError('test exception')
class TestPush(object):
def setup(... | apache-2.0 | Python |
f2aa552f3a70465acdc429fd78e6d6dfa5f88dbe | Bump version | raviqqe/tensorflow-extenteten,raviqqe/tensorflow-extenteten | extenteten/__init__.py | extenteten/__init__.py | from .assertion import *
from .attention import *
from .batch import *
from .cnn import *
from .classification import *
from .control import *
from .dynamic_length import *
from .embedding import *
from .initializers import *
from .invertible import *
from .layer import *
from .mask import *
from .math import *
from .m... | from .assertion import *
from .attention import *
from .batch import *
from .cnn import *
from .classification import *
from .control import *
from .dynamic_length import *
from .embedding import *
from .initializers import *
from .invertible import *
from .layer import *
from .mask import *
from .math import *
from .m... | unlicense | Python |
5e62f06e8490a3f7a6a1c07722ff9633a3bb7d86 | Add tests for WikiWatcher | leviroth/bernard | test/test_actors.py | test/test_actors.py | from .helper import BJOTest
from bernard import actors
from mock import patch
class TestBanner(BJOTest):
@patch('time.sleep', return_value=None)
def test_action(self, _):
actor = actors.Banner("You banned", "testing purposes", 4,
self.db, self.cur, self.subreddit)
... | from .helper import BJOTest
from bernard import actors
from mock import patch
class TestNotifier(BJOTest):
@patch('time.sleep', return_value=None)
def test_action(self, _):
actor = actors.Notifier("sample_text", self.db, self.cur,
self.subreddit)
post = self.r.s... | mit | Python |
20d660ba9da17352762b0be3999dbafc26c2dc9f | Add delay after cqlsh query is successful before we can start querying keyspaces | oaeproject/oae-fabric | fabfile/db/__init__.py | fabfile/db/__init__.py | from time import sleep
from fabric.api import env, task
from fabric.operations import run, sudo
@task
def start():
"""Start the database service."""
sudo("service dse start")
@task
def stop():
"""Stop the database service."""
sudo("service dse stop", warn_only=True)
@task
def kill():
"""Kill -... | from time import sleep
from fabric.api import env, task
from fabric.operations import run, sudo
@task
def start():
"""Start the database service."""
sudo("service dse start")
@task
def stop():
"""Stop the database service."""
sudo("service dse stop", warn_only=True)
@task
def kill():
"""Kill -... | apache-2.0 | Python |
a6bb41e802159b86aface966454ffb5928005708 | Fix Win32 get_key (#819) | SimenB/thefuck,scorphus/thefuck,nvbn/thefuck,scorphus/thefuck,SimenB/thefuck,nvbn/thefuck | thefuck/system/win32.py | thefuck/system/win32.py | import os
import msvcrt
import win_unicode_console
from .. import const
def init_output():
import colorama
win_unicode_console.enable()
colorama.init()
def get_key():
ch = msvcrt.getwch()
if ch in ('\x00', '\xe0'): # arrow or function key prefix?
ch = msvcrt.getwch() # second call retu... | import os
import sys
import msvcrt
import win_unicode_console
from .. import const
def init_output():
import colorama
win_unicode_console.enable()
colorama.init()
def get_key():
ch = msvcrt.getch()
if ch in (b'\x00', b'\xe0'): # arrow or function key prefix?
ch = msvcrt.getch() # secon... | mit | Python |
88109d55d4316dabd2b5768d4719e06b657fc601 | Fix missing import | spacy-io/thinc,explosion/thinc,explosion/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc | thinc/layers/sumpool.py | thinc/layers/sumpool.py | from typing import Callable, TypeVar, Tuple
from ..data import Ragged
from ..model import Model
from ..types import Array
InputType = TypeVar("InputType", bound=Ragged)
OutputType = TypeVar("OutputType", bound=Array)
def SumPool() -> Model:
return Model("sum_pool", forward)
def forward(
model: Model, Xr:... | from typing import Callable, TypeVar
from ..data import Ragged
from ..model import Model
from ..types import Array
InputType = TypeVar("InputType", bound=Ragged)
OutputType = TypeVar("OutputType", bound=Array)
def SumPool() -> Model:
return Model("sum_pool", forward)
def forward(
model: Model, Xr: InputT... | mit | Python |
59f690a53a2ec2e72ba6973bf35041ba6af47cf3 | add whitelist support | instagrambot/instapro,misisnik/testinsta,ohld/instabot,rasperepodvipodvert/instabot,vkgrd/instabot,misisnik/testinsta,AlexBGoode/instabot,Diapostrofo/instabot,instagrambot/instabot,instagrambot/instabot,sudoguy/instabot | instabot/bot/bot_filter.py | instabot/bot/bot_filter.py | """
Work with
whitelist, blacklist,
seleb account,
"""
import os
def read_list(file_path):
"""
Reads whitelist/blacklist users from input file.
Returns the list if file items
"""
try:
if not os.path.exists(file_path):
print ("file %s does not exist."... | """
Work with
whitelist, blacklist,
seleb account,
"""
import os
def read_list(file_path):
"""
Reads whitelist/blacklist users from input file.
Returns the list if file items
"""
if not os.path.exists(file_path):
print ("file %s does not exist." % file_path)
... | apache-2.0 | Python |
b71b9857476ca09155a164907d92a5d74a2c8be2 | add midpoint | PinkInk/esp32 | lib/d2.py | lib/d2.py | def intersection(line1, line2):
xd = line1[0][0] - line1[1][0], line2[0][0] - line2[1][0]
yd = line1[0][1] - line1[1][1], line2[0][1] - line2[1][1]
det = lambda a, b: a[0] * b[1] - a[1] * b[0]
div = det(xd, yd)
if div == 0:
return False
d = det(*line1), det(*line2)
x = det(d, xd) / d... | def intersection(line1, line2):
xd = line1[0][0] - line1[1][0], line2[0][0] - line2[1][0]
yd = line1[0][1] - line1[1][1], line2[0][1] - line2[1][1]
det = lambda a, b: a[0] * b[1] - a[1] * b[0]
div = det(xd, yd)
if div == 0:
return False
d = det(*line1), det(*line2)
x = det(d, xd) / d... | mit | Python |
d75bced056a07b273a131b6aa6b8901b795a9451 | Update for ghc 8 | SublimeLinter/SublimeLinter-ghc | linter.py | linter.py | from SublimeLinter.lint import Linter, util
from os.path import basename
class Ghc(Linter):
cmd = ('ghc', '-fno-code', '-Wall', '-Wwarn', '-fno-helpful-errors',
'$temp_file')
regex = (
r'\s*(?P<filename>.+):'
r'\s*(?P<line>\d+):(?P<col>\d+):'
r'\s*(?:(?P<warning>[Ww]arning):... | from SublimeLinter.lint import Linter, util
from os.path import basename
class Ghc(Linter):
cmd = ('ghc', '-fno-code', '-Wall', '-Wwarn', '-fno-helpful-errors',
'$temp_file')
regex = (
r'^(?P<filename>.+):'
r'(?P<line>\d+):(?P<col>\d+):'
r'\s+(?P<warning>Warning:\s+)?(?P<mes... | mit | Python |
408612c7ccc13526537e10ec164017e2b083da18 | Remove path modification in manage.py, not needed when running tests now | microcosm-cc/microweb,microcosm-cc/microweb,microcosm-cc/microweb,microcosm-cc/microweb,microcosm-cc/microweb,microcosm-cc/microweb | manage.py | manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "microweb.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
# Project is named microweb and contains a module called microweb (created by django).
# This is not on sys.path when runserver is started, so add microweb.microweb to path.
project_package = os.path.join(os.path.dirname(os.path.abspath(... | agpl-3.0 | Python |
836d9903fcf504772e7f7258dbe3d1dc7e354159 | make manage run with either dev or default | dmartin35/pronosfoot,dmartin35/pronosfoot,dmartin35/pronosfoot | manage.py | manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
dev_found = os.path.exists(os.path.join(os.path.dirname(__file__), 'pronosfoot', 'settings', 'dev.py'))
settings_mod = "pronosfoot.settings.dev" if dev_found else "pronosfoot.settings"
os.environ.setdefault("DJANGO_SETTINGS_MODULE", sett... | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pronosfoot.settings.dev")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure th... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.