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 |
|---|---|---|---|---|---|---|---|---|
4ce6792829174e7df4614e5caeddf5b280d59822 | Change history capability for "Dark Legacy" | datagutten/comics,jodal/comics,datagutten/comics,datagutten/comics,jodal/comics,jodal/comics,jodal/comics,datagutten/comics | comics/comics/darklegacy.py | comics/comics/darklegacy.py | from comics.aggregator.crawler import CrawlerBase, CrawlerImage
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = "Dark Legacy"
language = "en"
url = "http://www.darklegacycomics.com/"
start_date = "2006-01-01"
rights = "Arad Kedar"
class Crawler(CrawlerBase... | from comics.aggregator.crawler import CrawlerBase, CrawlerImage
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = "Dark Legacy"
language = "en"
url = "http://www.darklegacycomics.com/"
start_date = "2006-01-01"
rights = "Arad Kedar"
class Crawler(CrawlerBase... | agpl-3.0 | Python |
ce9b75de70ab1ba95fd0df81b4ad96cfa0a459c8 | update expected output files in test | xia2/xia2,xia2/xia2 | Test/regression/test_multi_crystal_scale.py | Test/regression/test_multi_crystal_scale.py | from __future__ import absolute_import, division, print_function
import glob
import os
import procrunner
expected_data_files = [
'scaled.mtz',
'scaled_unmerged.mtz',
'xia2-multi-crystal-report.html'
]
def test_proteinase_k(regression_data, run_in_tmpdir, ccp4):
data_dir = regression_data('multi_crystal_prote... | from __future__ import absolute_import, division, print_function
import glob
import os
import procrunner
expected_data_files = [
'4_scaled.mtz',
'4_scaled_unmerged.mtz',
'6_scaled.mtz',
'6_scaled_unmerged.mtz',
'multi-crystal-report.html'
]
def test_proteinase_k(regression_data, run_in_tmpdir, ccp4):
dat... | bsd-3-clause | Python |
36716d286c054bcae84dfc0e60ed03bdbbf7c354 | create reverse url names | jonge-democraten/dyonisos,jonge-democraten/dyonisos,jonge-democraten/dyonisos | subscribe/urls.py | subscribe/urls.py | from django.conf.urls import url
from subscribe import views
urlpatterns = [
url(r'^$', views.HomeView.as_view(), name='homepage'),
url(r'^inschrijven/(?P<slug>[\w-]+)/$', views.register, name='subscribe'),
url(r'^deleteEventQuestion/$', views.delete_event_question, name='delete-event-question'),
url(... | from django.conf.urls import url
from subscribe import views
urlpatterns = [
url(r'^$', views.HomeView.as_view()),
url(r'^inschrijven/(?P<slug>[\w-]+)/$', views.register),
url(r'^deleteEventQuestion/$', views.delete_event_question),
url(r'^webhook/(?P<id>\d+)/?$', views.webhook, name='webhook'),
u... | mit | Python |
61a1ebdeb4004e04e8cf97bba47aa4ce4bae33dd | Correct typos | fedora-infra/kitchen,fedora-infra/kitchen | kitchen/release.py | kitchen/release.py | '''
Information about this kitchen release.
'''
from kitchen import _, __version__
NAME = 'kitchen'
VERSION = __version__
DESCRIPTION = _('Kitchen contains a cornucopia of useful code')
LONG_DESCRIPTION = _('''
We've all done it. In the process of writing a brand new application we've
discovered that we need a littl... | '''
Information about this kitchen release.
'''
from kitchen import _, __version__
NAME = 'kitchen'
VERSION = __version__
DESCRIPTION = _('Kitchen contains a cornucopia of useful code')
LONG_DESCRIPTION = _('''
We've all done it. In the process of writing a brand new application we've
discovered that we need a littl... | lgpl-2.1 | Python |
f97d250f35215071d7bf97e96cc4ee50897f9ac5 | Bump TensorFlow to 2.4.0rc2 (#1201) | tensorflow/io,tensorflow/io,tensorflow/io,tensorflow/io,tensorflow/io,tensorflow/io,tensorflow/io | tensorflow_io/core/python/ops/version_ops.py | tensorflow_io/core/python/ops/version_ops.py | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 | Python |
c58876fa3fdf3c3288454c4ee0ee1a247537cb25 | Use `sign_apk` in `add_assets.py` | facebook/redex,facebook/redex,facebook/redex,facebook/redex,facebook/redex,facebook/redex,facebook/redex,facebook/redex,facebook/redex | test/debug_info/add_assets.py | test/debug_info/add_assets.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import os
import zipfile
from pyredex.utils import sign_apk
parser = argparse.ArgumentParser()
parse... | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import os
import subprocess
import sys
import zipfile
parser = argparse.ArgumentParser()
parser.add_a... | mit | Python |
d927ada17522edfb91489e8558bbc88ff741a3c5 | Introduce Markup abstract base class | aiguofer/bokeh,jakirkham/bokeh,ChinaQuants/bokeh,percyfal/bokeh,bokeh/bokeh,philippjfr/bokeh,philippjfr/bokeh,stonebig/bokeh,percyfal/bokeh,muku42/bokeh,DuCorey/bokeh,muku42/bokeh,ericmjl/bokeh,azjps/bokeh,muku42/bokeh,percyfal/bokeh,philippjfr/bokeh,msarahan/bokeh,deeplook/bokeh,Karel-van-de-Plassche/bokeh,htygithub/b... | bokeh/models/widgets/markups.py | bokeh/models/widgets/markups.py | """ Various kinds of markup (static content) widgets.
"""
from __future__ import absolute_import
from ...properties import abstract
from ...properties import Int, String
from ..widget import Widget
@abstract
class Markup(Widget):
""" Base class for HTML markup widget models. """
class Paragraph(Markup):
"""... | """ Various kinds of markup (static content) widgets.
"""
from __future__ import absolute_import
from ...properties import abstract
from ...properties import Int, String
from ..widget import Widget
class Paragraph(Widget):
""" A block (paragraph) of text.
"""
text = String(help="""
The contents of ... | bsd-3-clause | Python |
d6917dd1396d8e7300dd58fac56e8d467ccc29c9 | Update the test to work the final protocol | freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut | tests/causalorderingtest.py | tests/causalorderingtest.py | #!/usr/bin/env python
from twisted.internet import reactor
from mesh import Mesh
from mesh import MeshNode
import sys
nodes = []
# We're optimists
success = True
class TestMeshNode(MeshNode):
num = 1
def newNode (self, data):
self.num += 1
if len (nodes) == self.num:
reactor.callLater(1.5, (lambda... | #!/usr/bin/env python
from twisted.internet import reactor
from mesh import Mesh
from mesh import MeshNode
import sys
nodes = []
# We're optimists
success = True
class TestMeshNode(MeshNode):
def unknownOutput(self, line):
if (self.name == "node3"):
MeshNode.unknownOutput(self, line)
class TestMesh(Mesh... | lgpl-2.1 | Python |
0bfca41744c07fe4227256bf1a7e8569cf191502 | Update displays.py | matt-cahill/munkireport-php,matt-cahill/munkireport-php,n8felton/munkireport-php,n8felton/munkireport-php,n8felton/munkireport-php,poundbangbash/munkireport-php,gmarnin/munkireport-php,n8felton/munkireport-php,childrss/munkireport-php,poundbangbash/munkireport-php,dannooooo/munkireport-php,matt-cahill/munkireport-php,g... | app/modules/displays_info/scripts/displays.py | app/modules/displays_info/scripts/displays.py | #!/usr/bin/python
# extracts information about the external displays from system profiler
import sys
import os
import subprocess
import plistlib
import datetime
# Skip manual check
if len(sys.argv) > 1:
if sys.argv[1] == 'manualcheck':
print 'Manual check: skipping'
exit(0)
# Create cache dir if it does no... | #!/usr/bin/python
# extracts information about the external displays from system profiler
import sys
import os
import subprocess
import plistlib
import datetime
# Skip manual check
if len(sys.argv) > 1:
if sys.argv[1] == 'manualcheck':
print 'Manual check: skipping'
exit(0)
# Create cache dir if it does no... | mit | Python |
9d21e42c49cf96a7f5c7c3d28cccf90d2857d7f8 | Update load_quarterly_revalidation_threshold.py | fedspendingtransparency/data-act-broker-backend,fedspendingtransparency/data-act-broker-backend | dataactvalidator/scripts/load_quarterly_revalidation_threshold.py | dataactvalidator/scripts/load_quarterly_revalidation_threshold.py | import os
import logging
import boto3
import pandas as pd
from dataactcore.logging import configure_logging
from dataactcore.interfaces.db import GlobalDB
from dataactcore.config import CONFIG_BROKER
from dataactcore.models.jobModels import QuarterlyRevalidationThreshold
from dataactvalidator.health_check import crea... | import os
import logging
import boto3
import pandas as pd
from dataactcore.logging import configure_logging
from dataactcore.interfaces.db import GlobalDB
from dataactcore.config import CONFIG_BROKER
from dataactcore.models.jobModels import QuarterlyRevalidationThreshold
from dataactvalidator.health_check import crea... | cc0-1.0 | Python |
fbbfa4a2123ce41969230d531000b5836f1ab399 | support gray | yuyu2172/chainercv,yuyu2172/chainercv,chainer/chainercv,pfnet/chainercv,chainer/chainercv | chainercv/utils/image.py | chainercv/utils/image.py | import numpy as np
from PIL import Image
def read_image(path, dtype=np.float32, color=True):
"""Read an image from a file.
This function reads an image from given file. The image is CHW format and
the range of its value is :math:`[0, 255]`. If :obj:`color = True`, the
order of the channels is RGB.
... | import numpy as np
from PIL import Image
def read_image(path, dtype=np.float32, color=True):
"""Read an image from a file.
This function reads an image from given file. The image is CHW format and
the range of its value is :math:`[0, 255]`. If :obj:`color = True`, the
order of the channels is RGB.
... | mit | Python |
f5c2a2171b711b80e51cf0ce0f0054cb655c3e42 | Remove prints | thorgate/django-esteid,thorgate/django-esteid,thorgate/django-esteid | tests/distinguished_name.py | tests/distinguished_name.py | # -*- coding: utf-8 -*-
import pytest
from esteid.helpers import parse_rfc_dn, parse_legacy_dn
@pytest.mark.parametrize('distinguished_name,expected_res', [
(
u'serialNumber=51001091072,GN=SEITSMES,SN=TESTN\\C3\\9CMBER,'
u'CN=TESTN\\C3\\9CMBER\\,SEITSMES\\,51001091072,OU=authentication,O=ESTEID,C... | # -*- coding: utf-8 -*-
import pytest
from esteid.helpers import parse_rfc_dn, parse_legacy_dn
@pytest.mark.parametrize('distinguished_name,expected_res', [
(
u'serialNumber=51001091072,GN=SEITSMES,SN=TESTN\\C3\\9CMBER,'
u'CN=TESTN\\C3\\9CMBER\\,SEITSMES\\,51001091072,OU=authentication,O=ESTEID,C... | bsd-3-clause | Python |
c6dd15e45a5994ac1bb086c41a68eda66679a7e5 | Add integ test for table query with count projection #95 | numberoverzero/bloop,numberoverzero/bloop | tests/integ/test_queries.py | tests/integ/test_queries.py | from .models import User, valid_user
def test_query_with_projection(engine):
engine.bind(User)
user = valid_user()
user.profile = "Hello, World"
engine.save(user)
query = engine.query(
User,
key=User.email == user.email,
projection={User.email, User.username})
result ... | from .models import User, valid_user
def test_query_with_projection(engine):
engine.bind(User)
user = valid_user()
user.profile = "Hello, World"
engine.save(user)
query = engine.query(
User,
key=User.email == user.email,
projection={User.email, User.username})
result ... | mit | Python |
fb4e9d64402fcb5908cda3e46af7a52b0c5628b7 | Remove unused things | uranusjr/django-tastypie-crust | testproj/testapp/resources.py | testproj/testapp/resources.py | #!/usr/bin/env python
# -*- coding: utf-8
from django.contrib.auth import get_user_model
from tastypie import resources
from tastycrust.resources import ActionResourceMixin, action
class UserResource(ActionResourceMixin, resources.ModelResource):
class Meta:
queryset = get_user_model().objects.all()
... | #!/usr/bin/env python
# -*- coding: utf-8
from django.contrib.auth import get_user_model
from tastypie import resources
from tastycrust.resources import ActionResourceMixin, action
class UserResource(ActionResourceMixin, resources.ModelResource):
class Meta:
queryset = get_user_model().objects.all()
... | bsd-3-clause | Python |
e034078ad7fec7f87911db215909a1333baac450 | update test case | chfw/moban,chfw/moban | tests/test_filter_github.py | tests/test_filter_github.py | from moban.filters.github import github_expand
from nose.tools import eq_
def test_github_expand():
inputs = [
['fix `#12`', 'project', 'organisation'],
['fix `#13` too', 'project', 'organisation'],
['`#14` works', 'project', 'organisation'],
['`PR#15` works', 'project', 'organisat... | from moban.filters.github import github_expand
from nose.tools import eq_
def test_github_expand():
inputs = [
['fix `#12`', 'project', 'organisation'],
['fix `#13` too', 'project', 'organisation'],
['`#14` works', 'project', 'organisation'],
['`PR#15` works', 'project', 'organisat... | mit | Python |
7b8586a4dc43c643da24a797121260697f0b26a5 | Correct logger | rjeschmi/vsc-base,rjeschmi/vsc-base | lib/vsc/utils/lock.py | lib/vsc/utils/lock.py | #!/usr/bin/python
##
#
# Copyright 2009-2012 Ghent University
#
# This file is part of the tools originally by the HPC team of
# Ghent University (http://ugent.be/hpc).
#
# This is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Soft... | #!/usr/bin/python
##
#
# Copyright 2009-2012 Ghent University
#
# This file is part of the tools originally by the HPC team of
# Ghent University (http://ugent.be/hpc).
#
# This is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Soft... | lgpl-2.1 | Python |
735f358d8e1dfbea2a1bdf8a6da4a676a716a0e5 | Modify a xfail annotation | thombashi/sqlitebiter,thombashi/sqlitebiter | test/test_file_subcommand_ipynb.py | test/test_file_subcommand_ipynb.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import print_function
import os
import pytest
from click.testing import CliRunner
from sqlitebiter._enum import ExitCode
from sqlitebiter.sqlitebiter import cmd
from .common import print_traceback
db_path = ... | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import print_function
import os
import pytest
from click.testing import CliRunner
from sqlitebiter._enum import ExitCode
from sqlitebiter.sqlitebiter import cmd
from .common import print_traceback
db_path = ... | mit | Python |
9534a5caba59a6c39b555e21242335d227727afb | Update to arguments | TJKessler/ECNet | examples/limit_input_parameters.py | examples/limit_input_parameters.py | # Import the Server object
from ecnet import Server
if __name__ == '__main__':
# Create Server
sv = Server()
# Import data (change 'my_data.csv' to your database name)
sv.import_data('my_data.csv')
# Limit the input dimensionality to 15, save to 'my_data_limited.csv'
sv.limit_input_parameter... | # Import the Server object
from ecnet import Server
if __name__ == '__main__':
# Create Server
sv = Server()
# Import data (change 'my_data.csv' to your database name)
sv.import_data('my_data.csv')
# Limit the input dimensionality to 15, save to 'my_data_limited.csv'
sv.limit_input_parameter... | mit | Python |
1da7e9ea36b9e410142d00cd6153bbbcd38abcc8 | fix corehq.apps.case_importer.tracking.tests.test_filestorage | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/case_importer/tracking/tests/test_filestorage.py | corehq/apps/case_importer/tracking/tests/test_filestorage.py | from __future__ import absolute_import
from __future__ import unicode_literals
from django.test import TestCase
from corehq.apps.case_importer.tracking.filestorage import transient_file_store, persistent_file_store
from corehq.util.files import file_extention_from_filename
from corehq.util.test_utils import generate_ca... | from __future__ import absolute_import
from __future__ import unicode_literals
from django.test import TestCase
from corehq.apps.case_importer.tracking.filestorage import transient_file_store, persistent_file_store
from corehq.util.files import file_extention_from_filename
from corehq.util.test_utils import generate_ca... | bsd-3-clause | Python |
e9d0ec30810875b5ef1bdc5e3481b546152d8fe0 | Change name to orgmember | kave/cfgov-refresh,kave/cfgov-refresh,kave/cfgov-refresh,kave/cfgov-refresh | _tests/processor_tests/tests/test_wordpress_orgmember_processor.py | _tests/processor_tests/tests/test_wordpress_orgmember_processor.py | # -*- coding: utf-8 -*-
import unittest
import mock
import os
import json
import wordpress_orgmember_processor
class WordpressOrgmemberProcessorTestCase(unittest.TestCase):
"""
wordpress_orgmember_processor grabs orgmember from the WordPress API
and returns them for indexing in Elasticsearch by Sheer.
... | # -*- coding: utf-8 -*-
import unittest
import mock
import os
import json
import wordpress_orgmember_processor
class WordpressOrgmemberProcessorTestCase(unittest.TestCase):
"""
wordpress_orgmember_processor grabs orgmember from the WordPress API
and returns them for indexing in Elasticsearch by Sheer.
... | cc0-1.0 | Python |
2cb73ac018287ab77b380c31166ec4fc6fd99f5e | Make the G-Cloud collector empty the data set | alphagov/performanceplatform-collector,alphagov/performanceplatform-collector,alphagov/performanceplatform-collector | performanceplatform/collector/gcloud/__init__.py | performanceplatform/collector/gcloud/__init__.py | from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
from dshelpers import download_url
from performanceplatform.collector.gcloud.core import (
nuke_local_database, save_raw_data, aggregate_and_save,
push_aggregates)
from performanceplatform.collector.gcloud.sales_parser import (
ge... | from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
from dshelpers import download_url
from performanceplatform.collector.gcloud.core import (
nuke_local_database, save_raw_data, aggregate_and_save,
push_aggregates)
from performanceplatform.collector.gcloud.sales_parser import (
ge... | mit | Python |
771fc25a18f9657d0a95d7be01895c313e28aa4d | Make the output tab-space compliant | gquintard/Varnish-Cache,gquintard/Varnish-Cache,gquintard/Varnish-Cache,gquintard/Varnish-Cache | bin/varnishtest/huffman_gen.py | bin/varnishtest/huffman_gen.py | #!/usr/bin/env python
import re
import sys
#HPH(0x30, 0x00000000, 5)
regex = re.compile("^HPH\((.{4}), (.{10}), +(.{1,3})\)")
if len(sys.argv) != 2:
print("{} takes one and only one argument".format(sys.argv[0]))
sys.exit(2)
class sym:
def __init__(self, bigval, bigvall, chr = 0, esc = None):
self.vall = bigv... | #!/usr/bin/env python
import re
import sys
#HPH(0x30, 0x00000000, 5)
regex = re.compile("^HPH\((.{4}), (.{10}), +(.{1,3})\)")
if len(sys.argv) != 2:
print("{} takes one and only one argument".format(sys.argv[0]))
sys.exit(2)
class sym:
def __init__(self, bigval, bigvall, chr = 0, esc = None):
self.vall = bigv... | bsd-2-clause | Python |
542f194273e475d0bccc780704f3c60dc1083558 | make it quiet and fix tags | mms-gianni/datadog-website-metrics | checks.d/websitestats.py | checks.d/websitestats.py | import json
import pycurl
import sys
from checks import AgentCheck
class Websitestats(AgentCheck):
def __init__(self, name, init_config, agentConfig, instances=None):
AgentCheck.__init__(self, name, init_config, agentConfig, instances=instances)
def check(self, instance):
# Make sure plug... | import json
import pycurl
import sys
from checks import AgentCheck
class Websitestats(AgentCheck):
def __init__(self, name, init_config, agentConfig, instances=None):
AgentCheck.__init__(self, name, init_config, agentConfig, instances=instances)
def check(self, instance):
# Make sure plug... | mit | Python |
191f3f1c89f5ae7b6908838ba2c4475f80b0c886 | Bump version | Jackevansevo/taggy,Jackevansevo/taggy | taggy/__init__.py | taggy/__init__.py | __version__ = "0.2.2"
| __version__ = "0.2.1"
| mit | Python |
5992efc28a367a7baa1ff07846c0614ad3ad5ad8 | add metadata | chrismattmann/tika-similarity,harsham05/tika-similarity,dongnizh/tika-img-similarity,RashmiNalwad/tika-similarity,YongchaoShang/tika-img-similarity,chrismattmann/tika-similarity,chrismattmann/tika-img-similarity,dongnizh/tika-img-similarity,Lerex/tika-img-similarity,Lerex/tika-img-similarity,YongchaoShang/tika-img-simi... | cluster-scores.py | cluster-scores.py | #!/usr/bin/env python2.7
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "... | #!/usr/bin/env python2.7
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "... | apache-2.0 | Python |
962b09190dbb0fa9ddc2794f56be16f2e2a6b993 | Add command to trigger all checks, including artifact scan | bioconda/bioconda-utils,bioconda/bioconda-utils,bioconda/bioconda-utils | bioconda_utils/bot/commands.py | bioconda_utils/bot/commands.py | """
Bot commands issued via issue/pull-request comments
"""
import logging
from typing import Callable, Dict
from .tasks import bump, create_check_run, get_latest_pr_commit
logger = logging.getLogger(__name__) # pylint: disable=invalid-name
class CommandDispatch:
"""Decorator based router handling bot comman... | """
Bot commands issued via issue/pull-request comments
"""
import logging
from typing import Callable, Dict
from .tasks import bump, create_check_run, get_latest_pr_commit
logger = logging.getLogger(__name__) # pylint: disable=invalid-name
class CommandDispatch:
"""Decorator based router handling bot comman... | mit | Python |
8f917dbe8485e2848c2a0c24768434f252173cc6 | copy the order id to the invoice it creates | yvaucher/connector-ecommerce,Antiun/connector-ecommerce,factorlibre/connector-ecommerce,Endika/connector-ecommerce,brain-tec/connector-ecommerce | connector_ecommerce/sale.py | connector_ecommerce/sale.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | agpl-3.0 | Python |
a75c71920e08e2c3d532a210e1f3847e2b044034 | Fix return format | tobi-wan-kenobi/bumblebee-status,tobi-wan-kenobi/bumblebee-status | bumblebee/modules/brightness.py | bumblebee/modules/brightness.py | # pylint: disable=C0111,R0903
"""Displays the brightness of a display
Parameters:
* brightness.step: The amount of increase/decrease on scroll in % (defaults to 2)
* brightness.device_path: The device path (defaults to /sys/class/backlight/intel_backlight)
"""
import bumblebee.input
import bumblebee.output
... | # pylint: disable=C0111,R0903
"""Displays the brightness of a display
Parameters:
* brightness.step: The amount of increase/decrease on scroll in % (defaults to 2)
* brightness.device_path: The device path (defaults to /sys/class/backlight/intel_backlight)
"""
import bumblebee.input
import bumblebee.output
... | mit | Python |
4845faf76e9a4eeb21fbadcbcae138bceb736ed0 | Add prefix option for tarball packages | shoreflyer/cerbero,ramaxlo/cerbero,freedesktop-unofficial-mirror/gstreamer__cerbero,sdroege/cerbero,centricular/cerbero,OptoFidelity/cerbero,jackjansen/cerbero,jackjansen/cerbero-2013,multipath-rtp/cerbero,ford-prefect/cerbero,atsushieno/cerbero,flexVDI/cerbero,brion/cerbero,ylatuya/cerbero,multipath-rtp/cerbero,justin... | cerbero/packages/disttarball.py | cerbero/packages/disttarball.py | # cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; eit... | # cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; eit... | lgpl-2.1 | Python |
69a2f125ca07ca33edb4ba3368af55808426af16 | add correct way to handle form usage | teamworkquality/twq-app,tassolom/twq-app,teamworkquality/twq-app,tassolom/twq-app,tassolom/twq-app,teamworkquality/twq-app,tassolom/twq-app,teamworkquality/twq-app | api/forms/views.py | api/forms/views.py | from django.core.exceptions import ObjectDoesNotExist
from rest_framework.views import APIView
from rest_framework.response import Response
from .models import Form
from .serializers import FormSerializer
class FormsView(APIView):
queryset = Form.objects.all()
def get(self, request, format=None, **kwargs):
... | from django.core.exceptions import ObjectDoesNotExist
from rest_framework.views import APIView
from rest_framework.response import Response
from .models import Form
class FormsView(APIView):
queryset = Form.objects.all()
def get(self, request, format=None, **kwargs):
if kwargs.get('form_id'):
... | mit | Python |
6d1b1e59fb5347b5cb77dfe132cd215d7d4035f3 | Add some basic tests for `EmptyArrayRecorder`. | DudLab/nanshe,jakirkham/nanshe,DudLab/nanshe,jakirkham/nanshe,nanshe-org/nanshe,nanshe-org/nanshe | tests/test_HDF5_recorder.py | tests/test_HDF5_recorder.py | __author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>"
__date__ = "$Mar 24, 2015 07:35:20 EDT$"
import numpy
import nanshe.nanshe.HDF5_recorder
class TestHDF5Recorder(object):
def test_EmptyArrayRecorder(self):
recorder = nanshe.nanshe.HDF5_recorder.EmptyArrayRecorder()
# Check if this stor... | __author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>"
__date__ = "$Mar 24, 2015 07:35:20 EDT$"
| bsd-3-clause | Python |
63210bca6dbfd1a4db5568035977086f1cd98f6c | fix sky line | dmargala/qusp | bosslya/wavelength.py | bosslya/wavelength.py | import math
def getFiducialWavelength(pixelIndex):
return 3500.26*(10**(1e-4*pixelIndex))
def getFiducialWavelengthRatio(lambda1, lambda2=3500.26):
return 1e4*math.log10(lambda1/lambda2)
def getFiducialPixelIndexOffset(coeff0, coeff1=1e-4):
if coeff1 != 1e-4:
return 0
delta = (math.log10(3500... | import math
def getFiducialWavelength(pixelIndex):
return 3500.26*(10**(1e-4*pixelIndex))
def getFiducialWavelengthRatio(lambda1, lambda2=3500.26):
return 1e4*math.log10(lambda1/lambda2)
def getFiducialPixelIndexOffset(coeff0, coeff1=1e-4):
if coeff1 != 1e-4:
return 0
delta = (math.log10(3500... | mit | Python |
2399d5ccef3425beafbce7974b699f61b182d2c3 | Fix benchmark | honnibal/cython-blis,honnibal/cython-blis,honnibal/cython-blis,honnibal/cython-blis | blis/benchmark.py | blis/benchmark.py | import numpy
import numpy.random
from .blis import gemm_
from .blis import init
from timeit import default_timer as timer
numpy.random.seed(0)
init()
def create_data(nO, nI, batch_size):
X = numpy.zeros((batch_size, nI), dtype='f')
X += numpy.random.uniform(-1., 1., X.shape)
W = numpy.zeros((nO, nI), dtype... | import numpy
import numpy.random
from blis.blis import gemm_
from blis.blis import init
from timeit import default_timer as timer
numpy.random.seed(0)
init()
def create_data(nO, nI, batch_size):
X = numpy.zeros((batch_size, nI), dtype='f')
X += numpy.random.uniform(-1., 1., X.shape)
W = numpy.zeros((nO, nI... | mit | Python |
27a31e859fd8ca0c3891ab021245021aca9c5004 | bump version | chaostoolkit/chaostoolkit | chaostoolkit/__init__.py | chaostoolkit/__init__.py | # -*- coding: utf-8 -*-
__version__ = '0.2.6'
| # -*- coding: utf-8 -*-
__version__ = '0.2.5'
| apache-2.0 | Python |
c14b4cbef2543608be68c933e9a94723864d9c55 | check whats missing from install | justinwp/croplands,justinwp/croplands | tests/test_fusion_tables.py | tests/test_fusion_tables.py | from unittest import TestCase
from gfsad import create_app, limiter
from gfsad.models import db
try:
from gfsad.utils.fusion import FUSION_TABLE_SCOPE, init_google_service, replace_rows
except ImportError as e:
print e
raise e
import csv
from cStringIO import StringIO
class TestFusionTables(TestCase):
... | from unittest import TestCase
from gfsad import create_app, limiter
from gfsad.models import db
from gfsad.utils.fusion import FUSION_TABLE_SCOPE, init_google_service, replace_rows
import csv
from cStringIO import StringIO
class TestFusionTables(TestCase):
app = None
def setUp(self):
self.app = TestF... | mit | Python |
1f3ac498433b7c20d1ee2dccf056f66c1c323dc9 | Fix module doc str in test_identify_repo | audreyr/cookiecutter,drgarcia1986/cookiecutter,pjbull/cookiecutter,jhermann/cookiecutter,sp1rs/cookiecutter,tylerdave/cookiecutter,dajose/cookiecutter,christabor/cookiecutter,luzfcb/cookiecutter,0k/cookiecutter,michaeljoseph/cookiecutter,vintasoftware/cookiecutter,hackebrot/cookiecutter,lgp171188/cookiecutter,audreyr/c... | tests/test_identify_repo.py | tests/test_identify_repo.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_identify_repo
------------------
"""
import pytest
from cookiecutter import exceptions, vcs
def test_identify_git_github():
repo_url = "https://github.com/audreyr/cookiecutter-pypackage.git"
assert vcs.identify_repo(repo_url) == "git"
def test_identi... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_identify_repo.py
---------------------
"""
import pytest
from cookiecutter import exceptions, vcs
def test_identify_git_github():
repo_url = "https://github.com/audreyr/cookiecutter-pypackage.git"
assert vcs.identify_repo(repo_url) == "git"
def test_... | bsd-3-clause | Python |
56c9d33780344b2f80b6c015781095d06550350c | Make tests more robust | valgur/metsaregister | tests/test_metsaregister.py | tests/test_metsaregister.py | from os.path import abspath, dirname, join
import pytest
from click.testing import CliRunner
import geopandas as gpd
from metsaregister import cli
assert pytest.config.pluginmanager.hasplugin('vcr')
tests_dir = dirname(abspath(__file__))
fixtures_dir = join(tests_dir, 'fixtures')
aoi_path = join(fixtures_dir, 'ao... | from os.path import abspath, dirname, join
import pytest
from click.testing import CliRunner
from metsaregister import cli
assert pytest.config.pluginmanager.hasplugin('vcr')
tests_dir = dirname(abspath(__file__))
fixtures_dir = join(tests_dir, 'fixtures')
aoi_path = join(fixtures_dir, 'aoi.geojson')
def test_c... | mit | Python |
3ed2cbef6828b08492e42455cb9ba045701cf737 | Add unittest for randint | cupy/cupy,wkentaro/chainer,okuta/chainer,kikusu/chainer,kiyukuta/chainer,sinhrks/chainer,sinhrks/chainer,niboshi/chainer,pfnet/chainer,ysekky/chainer,jnishi/chainer,AlpacaDB/chainer,ronekko/chainer,rezoo/chainer,hvy/chainer,keisuke-umezawa/chainer,wkentaro/chainer,hvy/chainer,hvy/chainer,truongdq/chainer,niboshi/chaine... | tests/cupy_tests/random_tests/test_sample.py | tests/cupy_tests/random_tests/test_sample.py | import mock
import unittest
from cupy import cuda
from cupy import testing
from cupy import random
@testing.gpu
class TestRandint(unittest.TestCase):
_multiprocess_can_split_ = True
def setUp(self):
device_id = cuda.Device().id
self.m = mock.Mock()
self.m.interval.return_value = 0
... | import unittest
from cupy import testing
@testing.gpu
class TestSample(unittest.TestCase):
_multiprocess_can_split_ = True
| mit | Python |
bd0ccca9e629b6a9c48147984b8d68cf80fe470c | Add a test for bmc info working eleven times in a row | Cynerva/pyipmi,emaadmanzoor/pyipmi | test/single_system/bmc_test.py | test/single_system/bmc_test.py | import sys, unittest
from singlesystemtest import SingleSystemTest
class TestBmcInfo(SingleSystemTest):
def test_bmc_info(self):
"""BMC info provides expected results"""
info = self.bmc.info()
check_items = self.get_checks()['BMCInfo']
for item,expected in check_items.iteritems():... | import sys, unittest
from singlesystemtest import SingleSystemTest
class TestBmcInfo(SingleSystemTest):
def test_bmc_info(self):
"""BMC info provides expected results"""
info = self.bmc.info()
check_items = self.get_checks()['BMCInfo']
for item,expected in check_items.iteritems():... | bsd-3-clause | Python |
71c954ce34012848e6ada06eedab2dda9c9b1498 | Remove required name * Requiring name breaks db w/ existing data, remove | laslabs/vertical-medical,laslabs/vertical-medical | medical_prescription_sale/models/medical_prescription_order_line.py | medical_prescription_sale/models/medical_prescription_order_line.py | # -*- coding: utf-8 -*-
# © 2016 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import fields, models, api
class MedicalPrescriptionOrderLine(models.Model):
_inherit = 'medical.prescription.order.line'
sale_order_line_ids = fields.One2many(
comodel_nam... | # -*- coding: utf-8 -*-
# © 2016 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import fields, models, api
class MedicalPrescriptionOrderLine(models.Model):
_inherit = 'medical.prescription.order.line'
sale_order_line_ids = fields.One2many(
comodel_nam... | agpl-3.0 | Python |
6f6c350d247a23a1fa3e493ed8c9e42d00d57d65 | Update location of some files in the build script | qvacua/vimr,qvacua/vimr,qvacua/vimr,qvacua/vimr,qvacua/vimr | bin/set_appcast.py | bin/set_appcast.py | #!/usr/bin/env python
# pip install requests
# pip install Markdown
import os
import io
import sys
import subprocess
import requests
import json
import markdown
from datetime import datetime
from string import Template
SIGN_UPDATE = './bin/sign_update'
PRIVATE_KEY_PATH = os.path.expanduser('~/.local/data/secrets/spa... | #!/usr/bin/env python
# pip install requests
# pip install Markdown
import os
import io
import sys
import subprocess
import requests
import json
import markdown
from datetime import datetime
from string import Template
SIGN_UPDATE = './bin/sign_update'
PRIVATE_KEY_PATH = os.path.expanduser('~/Projects/sparkle_priv.p... | mit | Python |
3f0dfcb6003438d4a86bb1d3721e34b2e8e5e1cc | add tests through elif except for winrar else | dsavransky/EXOSIMS,dsavransky/EXOSIMS | tests/util/test_get_dirs.py | tests/util/test_get_dirs.py | import unittest
import EXOSIMS.util.get_dirs as gd
import os
from unittest.mock import *
import numpy as np
class TestGetDirs(unittest.TestCase):
"""
Tests the get_dir tool.
Sonny Rappaport, Cornell, July 2021
"""
def setUp(self):
self.assertErrors = []
def tearDown(self):
... | import unittest
import EXOSIMS.util.get_dirs as gd
import os
from unittest.mock import *
class TestGetDirs(unittest.TestCase):
"""
Tests the get_dir tool.
Sonny Rappaport, Cornell, July 2021
"""
def test_get_home_dir(self):
"""
Tests that get_home_dir works in muiltiple OS envi... | bsd-3-clause | Python |
2309e597e423ed82e06db402eb100f359fea7556 | modify code for raspberry pi | kanak87/oldboy_rep,kanak87/oldboy_rep,kanak87/oldboy_rep,kanak87/oldboy_rep | raspberrypi_webcam_streaming/webcam_streaming.py | raspberrypi_webcam_streaming/webcam_streaming.py | import json
import cv2
import requests
video_capture = cv2.VideoCapture(0)
#video_capture.set(3, 1024)
#video_capture.set(4, 768)
#video_capture.set(15, -8.0)
params = list()
params.append(cv2.IMWRITE_PNG_COMPRESSION)
params.append(9)
while True:
# Capture frame-by-frame
ret, frame = video_capture.read()
... | import base64
import json
import urllib
import StringIO
from PIL import Image
import cv2
import requests
video_capture = cv2.VideoCapture(1)
#video_capture.set(3, 1024)
#video_capture.set(4, 768)
#video_capture.set(15, -8.0)
params = list()
params.append(cv2.IMWRITE_PNG_COMPRESSION)
params.append(9)
while True:
... | mit | Python |
d1b4e66e90b4de8448520d4ad3705132a7076849 | make test just test for version 1, probably not a long term solution | Victory/notice-javascript-bugs,Victory/notice-javascript-bugs,Victory/notice-javascript-bugs | tests/test-couchdb-version.py | tests/test-couchdb-version.py | import json
import unittest
import re
import logging as log
from urllib2 import urlopen
class TestCouchDbVersion(unittest.TestCase):
def test_coudb_listening(self):
urlh = urlopen('http://127.0.0.1:5984/')
json_data = urlh.read()
json.loads(json_data)
def test_couchdb_version(self):... | import json
import unittest
import re
import logging as log
from urllib2 import urlopen
class TestCouchDbVersion(unittest.TestCase):
def test_coudb_listening(self):
urlh = urlopen('http://127.0.0.1:5984/')
json_data = urlh.read()
json.loads(json_data)
def test_couchdb_version(self):... | mit | Python |
8a2bc75e555cec399f02f51fcc04e0f4a88f8bdb | make it python 3 friendly | LawrenceHan/thefuck,nvbn/thefuck,princeofdarkness76/thefuck,SimenB/thefuck,qrqiuren/thefuck,suxinde2009/thefuck,Clpsplug/thefuck,hxddh/thefuck,gaurav9991/thefuck,manashmndl/thefuck,SimenB/thefuck,barneyElDinosaurio/thefuck,roth1002/thefuck,bigplus/thefuck,Aeron/thefuck,MJerty/thefuck,qingying5810/thefuck,bigplus/thefuc... | thefuck/rules/no_command.py | thefuck/rules/no_command.py | from subprocess import Popen, PIPE
import re
from thefuck.utils import which, wrap_settings
local_settings = {'command_not_found': '/usr/lib/command-not-found'}
def _get_output(command, settings):
name = command.script.split(' ')[command.script.startswith('sudo')]
check_script = '{} {}'.format(settings.comma... | from subprocess import Popen, PIPE
import re
from thefuck.utils import which, wrap_settings
local_settings = {'command_not_found': '/usr/lib/command-not-found'}
def _get_output(command, settings):
name = command.script.split(' ')[command.script.startswith('sudo')]
check_script = '{} {}'.format(settings.comma... | mit | Python |
efe108e1e6fc74067c4eb356a216e5baceb48f55 | make master pass all tests | eragnms/cosycar,eragnms/cosycar,eragnms/cosycar | tests/test_calendar_events.py | tests/test_calendar_events.py | # -*- coding: utf-8 -*-
import unittest
import logging
from cosycar.calendar_events import CalendarEvents
class CalendarEventsTests(unittest.TestCase):
def setUp(self):
logging.basicConfig(
filename='tests/data/cosycar.log',
level='DEBUG',
format='%(asctime)s - %(name)... | # -*- coding: utf-8 -*-
import unittest
import logging
from cosycar.calendar_events import CalendarEvents
class CalendarEventsTests(unittest.TestCase):
def setUp(self):
logging.basicConfig(
filename='tests/data/cosycar.log',
level='DEBUG',
format='%(asctime)s - %(name)... | mit | Python |
3b71674984479b89ac3c23177151b285a1fc6803 | change cruise input dim | ApolloAuto/apollo,jinghaomiao/apollo,wanglei828/apollo,ycool/apollo,ycool/apollo,xiaoxq/apollo,ApolloAuto/apollo,ApolloAuto/apollo,jinghaomiao/apollo,ycool/apollo,wanglei828/apollo,wanglei828/apollo,ycool/apollo,jinghaomiao/apollo,wanglei828/apollo,ApolloAuto/apollo,ApolloAuto/apollo,wanglei828/apollo,xiaoxq/apollo,xia... | modules/tools/prediction/mlp_train/common/configure.py | modules/tools/prediction/mlp_train/common/configure.py | #!/usr/bin/env python
###############################################################################
# Copyright 2018 The Apollo Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy ... | #!/usr/bin/env python
###############################################################################
# Copyright 2018 The Apollo Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy ... | apache-2.0 | Python |
2c9e9491711872f3863aeec55a2542f1fd876072 | Fix bare except: in thrift/compiler/py/setup.py | facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift | thrift/compiler/py/setup.py | thrift/compiler/py/setup.py | #!/usr/bin/env python
import sys
import shutil
try:
from setuptools import setup, Extension
except ImportError:
from distutils.core import setup, Extension, Command
def run_setup():
if sys.argv[1] == 'build':
shutil.copy('.libs/frontend.so', 'frontend.so')
setup(name = 'thrift-py',
ve... | #!/usr/bin/env python
import sys
import shutil
try:
from setuptools import setup, Extension
except:
from distutils.core import setup, Extension, Command
def run_setup():
if sys.argv[1] == 'build':
shutil.copy('.libs/frontend.so', 'frontend.so')
setup(name = 'thrift-py',
version = '0.9... | apache-2.0 | Python |
05fec17d9b126ee680095110fd520162669a6ce7 | Add test for 'S' typecode in ustruct. | HenrikSolver/micropython,bvernoux/micropython,hiway/micropython,kerneltask/micropython,deshipu/micropython,deshipu/micropython,adafruit/circuitpython,swegener/micropython,torwag/micropython,adafruit/circuitpython,cwyark/micropython,henriknelson/micropython,infinnovation/micropython,selste/micropython,toolmacher/micropy... | tests/basics/struct_micropython.py | tests/basics/struct_micropython.py | # test MicroPython-specific features of struct
try:
import ustruct as struct
except:
try:
import struct
except ImportError:
import sys
print("SKIP")
sys.exit()
class A():
pass
# pack and unpack objects
o = A()
s = struct.pack("<O", o)
o2 = struct.unpack("<O", s)
print(... | # test MicroPython-specific features of struct
try:
import ustruct as struct
except:
try:
import struct
except ImportError:
import sys
print("SKIP")
sys.exit()
class A():
pass
# pack and unpack objects
o = A()
s = struct.pack("<O", o)
o2 = struct.unpack("<O", s)
print(... | mit | Python |
45dd447a3cb1d2560b7ec1049706f07aa545f63d | work on report | akleber/ventilation-control | ventilation-control/report.py | ventilation-control/report.py | #!/usr/local/bin/python
# coding: utf-8
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
from os import curdir, sep
import building
PORT_NUMBER = 8080
#This class will handles any incoming request from
#the browser
class Handler(BaseHTTPRequestHandler):
def send_file(self, mimetype, path):
... | #!/usr/local/bin/python
# coding: utf-8
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
from os import curdir, sep
PORT_NUMBER = 8080
#This class will handles any incoming request from
#the browser
class Handler(BaseHTTPRequestHandler):
def sendFile(self, mimetype, path):
try:
... | mit | Python |
e732a2e96dc108a8bb39551bb6aaca41aaee3c23 | fix urls | mihi-tr/eriwan,mihi-tr/eriwan | eriwan/funda/urls.py | eriwan/funda/urls.py | from django.conf.urls import patterns, include, url
import funda.views
# Uncomment the next two lines to enable the admin:
urlpatterns = patterns('',
# Examples:
url(r'^$', 'funda.views.home', name='home'),
url(r'^questions/','funda.views.questions', name='questions'),
url(r'^persons/','funda.views.per... | from django.conf.urls import patterns, include, url
import funda.views
# Uncomment the next two lines to enable the admin:
urlpatterns = patterns('',
# Examples:
url(r'^$', 'funda.views.home', name='home'),
url(r'^questions/','funda.views.questions', name='questions'),
url(r'^persons/','funda.views.per... | bsd-2-clause | Python |
ebbb1e37d0ed9b86e989c0493e83dd6da1ee4784 | Modify LOGGER | klen/peewee_migrate | peewee_migrate/__init__.py | peewee_migrate/__init__.py | """
The package description.
"""
import datetime as dt
import logging
import peewee as pw
# Package information
# ===================
__version__ = "0.11.0"
__project__ = "peewee_migrate"
__author__ = "Kirill Klenov <horneds@gmail.com>"
__license__ = "BSD"
LOGGER = logging.getLogger(__name__)
LOGGER.addHandl... | """
The package description.
"""
import datetime as dt
import logging
import peewee as pw
# Package information
# ===================
__version__ = "0.11.0"
__project__ = "peewee_migrate"
__author__ = "Kirill Klenov <horneds@gmail.com>"
__license__ = "BSD"
LOGGER = logging.getLogger(__name__)
LOGGER.addHandl... | bsd-3-clause | Python |
c40c0b2ee7191a7a0b84f968a80f5c1028f146fb | Add JSON to data. | ItsCalebJones/SpaceLaunchNow-Server,ItsCalebJones/SpaceLaunchNow-Server,ItsCalebJones/SpaceLaunchNow-Server | bot/serializer.py | bot/serializer.py | from bot.models import Launch, Notification, DailyDigestRecord
from rest_framework import serializers
class NotificationSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Notification
fields = (
'launch', 'url', 'wasNotifiedTwentyFourHour', 'wasNotifiedOneHour', '... | from bot.models import Launch, Notification, DailyDigestRecord
from rest_framework import serializers
class NotificationSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Notification
fields = (
'launch', 'url', 'wasNotifiedTwentyFourHour', 'wasNotifiedOneHour', '... | apache-2.0 | Python |
7dd35ef7266c1ac5807a7a9935a81e2c13d145b5 | fix asteval version check | markneville/nupic,pulinagrawal/nupic,wanghaven/nupic,vamsirajendra/nupic,metaml/nupic,lscheinkman/nupic,elkingtonmcb/nupic,marionleborgne/nupic,BeiLuoShiMen/nupic,akhilaananthram/nupic,BoltzmannBrain/nupic,ben-hopps/nupic,runt18/nupic,vitaly-krugl/nupic,pap/nupic,GeraldLoeffler/nupic,sambitgaan/nupic,rayNymous/nupic,ra... | tests/external/py2/asteval_test.py | tests/external/py2/asteval_test.py | #!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | #!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | agpl-3.0 | Python |
b93933448e6df4d1fdea86f759c1930efad0b242 | Test unregister() on stream not in poller. | pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython | tests/extmod/uselect_poll_basic.py | tests/extmod/uselect_poll_basic.py | try:
import usocket as socket, uselect as select, uerrno as errno
except ImportError:
try:
import socket, select, errno
select.poll # Raises AttributeError for CPython implementations without poll()
except (ImportError, AttributeError):
print("SKIP")
raise SystemExit
polle... | try:
import usocket as socket, uselect as select, uerrno as errno
except ImportError:
try:
import socket, select, errno
select.poll # Raises AttributeError for CPython implementations without poll()
except (ImportError, AttributeError):
print("SKIP")
raise SystemExit
polle... | mit | Python |
28763be519b667bacedcbe104d28569d6eda48c4 | Remove unused import | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/integration/runners/state.py | tests/integration/runners/state.py | # -*- coding: utf-8 -*-
'''
Tests for the state runner
'''
# Import Python Libs
from __future__ import absolute_import
# Import Salt Testing Libs
from salttesting.helpers import (
ensure_in_syspath,
)
ensure_in_syspath('../../')
# Import Salt Libs
import integration
class StateRunnerTest(integration.ShellCase)... | # -*- coding: utf-8 -*-
'''
Tests for the state runner
'''
# Import Python Libs
from __future__ import absolute_import
# Import Salt Testing Libs
from salttesting import skipIf
from salttesting.helpers import (
ensure_in_syspath,
)
ensure_in_syspath('../../')
# Import Salt Libs
import integration
class StateRu... | apache-2.0 | Python |
c3b32a5d1a47630a644e4e2b4e5310aca625e4a1 | add ledger_ids in read_request_manager | evernym/plenum,evernym/zeno | plenum/server/request_managers/read_request_manager.py | plenum/server/request_managers/read_request_manager.py | from typing import Dict
from common.exceptions import LogicError
from plenum.common.constants import TXN_TYPE
from plenum.common.messages.node_messages import RequestNack
from plenum.common.request import Request
from plenum.server.request_handlers.handler_interfaces.read_request_handler import ReadRequestHandler
from... | from typing import Dict
from common.exceptions import LogicError
from plenum.common.constants import TXN_TYPE
from plenum.common.messages.node_messages import RequestNack
from plenum.common.request import Request
from plenum.server.request_handlers.handler_interfaces.read_request_handler import ReadRequestHandler
from... | apache-2.0 | Python |
bed23756d085c5158f0154be53729d58df38591f | use right exception to check if still loading | Caleydo/caleydo_data_redis | phovea_data_redis/utils.py | phovea_data_redis/utils.py | import logging
_log = logging.getLogger(__name__)
def wait_for_redis_ready(db, timeout=None):
import time
import redis
_log.info('check if redis is ready')
start_time = time.time()
while timeout is None or time.time() - start_time < timeout:
try:
db.dbsize()
except redis.exceptions.BusyLoadi... | import logging
_log = logging.getLogger(__name__)
def wait_for_redis_ready(db, timeout=None):
import time
import redis
_log.info('check if redis is ready')
start_time = time.time()
while timeout is None or time.time() - start_time < timeout:
try:
db.dbsize()
except redis.ResponseError as exc... | bsd-3-clause | Python |
7346103a36d69d1f27bc064843afa8c18d201d2b | Change send bulk message display verb to 'Send message'. | praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go | go/apps/bulk_message/definition.py | go/apps/bulk_message/definition.py | from go.vumitools.conversation.definition import (
ConversationDefinitionBase, ConversationAction)
class BulkSendAction(ConversationAction):
action_name = 'bulk_send'
action_display_name = 'Write and send bulk message'
action_display_verb = 'Send message'
needs_confirmation = True
needs_grou... | from go.vumitools.conversation.definition import (
ConversationDefinitionBase, ConversationAction)
class BulkSendAction(ConversationAction):
action_name = 'bulk_send'
action_display_name = 'Write and send bulk message'
needs_confirmation = True
needs_group = True
needs_running = True
de... | bsd-3-clause | Python |
26262387b67063a704b437ac0c1822070541edc5 | Create kmer-test.py | alexpreynolds/kmer-counter,alexpreynolds/kmer-counter | test/kmer-test.py | test/kmer-test.py | #!/usr/bin/env python
import sys
import subprocess
k = 6
fastaFile = 'kmer.fa'
kmerCmd = '../kmer-counter --fasta --k=%d %s' % (k, fastaFile)
try:
output = subprocess.check_output(kmerCmd, shell=True)
result = {}
for line in output.splitlines():
(header, counts) = line.strip().split('\t')
... | #!/usr/bin/env python
import sys
import subprocess
k = 6
fastaFile = 'kmer.fa'
result = {}
kmerCmd = '../kmer-counter --fasta --k=%d %s' % (k, fastaFile)
try:
output = subprocess.check_output(kmerCmd, shell=True)
for line in output.splitlines():
(header, counts) = line.strip().split('\t')
head... | mit | Python |
1bc569e7b1dcdeece79f617b7bf06ed8d1304eda | rewrite kutil test in pytest | PeerAssets/pypeerassets | test/kutiltest.py | test/kutiltest.py | import pytest
from pypeerassets.kutil import Kutil
def test_network_parameter_load():
'''tests if loading of network parameteres is accurate.'''
mykey = Kutil(network="ppc")
assert mykey.denomination == 1000000
assert mykey.wif_prefix == b'b7'
assert mykey.pubkeyhash == b'37'
def test_key_gene... | import unittest
from hashlib import sha256
from pypeerassets.kutil import Kutil
class KutilTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
print('''Starting Kutil class tests.
This class handles all things cryptography.''')
def test_network_parameter_load(self):
... | bsd-3-clause | Python |
2682c32d50d72762da3f36263207c62ac6036ff5 | add version 1.5.2 (#19080) | LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/py-cached-property/package.py | var/spack/repos/builtin/packages/py-cached-property/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyCachedProperty(PythonPackage):
"""A decorator for caching properties in classes."""
... | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyCachedProperty(PythonPackage):
"""A decorator for caching properties in classes."""
... | lgpl-2.1 | Python |
e494e97b1802b1ca3c32873070cb1bf9e163e870 | Rename helpers to turbine_helpers in Python code | swift-lang/swift-t,swift-lang/swift-t,swift-lang/swift-t,swift-lang/swift-t,swift-lang/swift-t,swift-lang/swift-t,swift-lang/swift-t | turbine/code/py/turbine_helpers.py | turbine/code/py/turbine_helpers.py | # Copyright 2013 University of Chicago and Argonne National Laboratory
#
# 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 b... | # Copyright 2013 University of Chicago and Argonne National Laboratory
#
# 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 b... | apache-2.0 | Python |
12b80fdb069713b8df7ba263ae7bccfd9623df30 | Fix a comment in File. | s3rvac/retdec-python | retdec/file.py | retdec/file.py | #
# Project: retdec-python
# Copyright: (c) 2015 by Petr Zemek <s3rvac@gmail.com> and contributors
# License: MIT, see the LICENSE file for more details
#
"""Representation of a file."""
class File:
"""Representation of a file."""
def __init__(self, file, name=None):
"""Initializes the file.
... | #
# Project: retdec-python
# Copyright: (c) 2015 by Petr Zemek <s3rvac@gmail.com> and contributors
# License: MIT, see the LICENSE file for more details
#
"""Representation of a file."""
class File:
"""Representation of a file."""
def __init__(self, file, name=None):
"""Initializes the file.
... | mit | Python |
a7731d6db40166af5febab7b3739f751d3583957 | Bump up number of transitions in test_exponentials_transition_hypers. | probcomp/cgpm,probcomp/cgpm | tests/test_exponentials_transition_hypers.py | tests/test_exponentials_transition_hypers.py | # -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 MIT Probabilistic Computing Project
# 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
# Unles... | # -*- coding: utf-8 -*-
# Copyright (c) 2015-2016 MIT Probabilistic Computing Project
# 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
# Unles... | apache-2.0 | Python |
fc18f86964e170c48632c614c86a0d26c9fbdd41 | Resolve broken test in appveyor | channelcat/sanic,channelcat/sanic,ashleysommer/sanic,channelcat/sanic,ashleysommer/sanic,ashleysommer/sanic,channelcat/sanic | tests/test_load_module_from_file_location.py | tests/test_load_module_from_file_location.py | from pathlib import Path
from types import ModuleType
import pytest
from sanic.exceptions import LoadFileException
from sanic.utils import load_module_from_file_location
@pytest.fixture
def loaded_module_from_file_location():
return load_module_from_file_location(
str(Path(__file__).parent / "static" / ... | from pathlib import Path
from types import ModuleType
import pytest
from sanic.exceptions import LoadFileException
from sanic.utils import load_module_from_file_location
@pytest.fixture
def loaded_module_from_file_location():
return load_module_from_file_location(
str(Path(__file__).parent / "static/app... | mit | Python |
c0cd24e747d6ae90f3a37eece01e58a07537c97c | Bump version | thombashi/pingparsing,thombashi/pingparsing | pingparsing/__version__.py | pingparsing/__version__.py | __author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright 2016, {}".format(__author__)
__license__ = "MIT License"
__version__ = "1.0.1"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| __author__ = "Tsuyoshi Hombashi"
__copyright__ = "Copyright 2016, {}".format(__author__)
__license__ = "MIT License"
__version__ = "1.0.0"
__maintainer__ = __author__
__email__ = "tsuyoshi.hombashi@gmail.com"
| mit | Python |
e58711d76a53f8d5d061ce33cb753d30e023a148 | Sort imports | thombashi/pathvalidate | pathvalidate/__init__.py | pathvalidate/__init__.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import absolute_import
from .__version__ import __author__, __copyright__, __email__, __license__, __version__
from ._common import (
ascii_symbols,
replace_unprintable_char,
unprintable_ascii_chars,... | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import absolute_import
from .__version__ import __author__, __copyright__, __email__, __license__, __version__
from ._common import (
ascii_symbols,
replace_unprintable_char,
unprintable_ascii_chars,... | mit | Python |
1f8d7c5be399d2d82d080bf48fe6b1ed8ad882ae | update doc iterator | andrew-lockwood/lab-project | corpus/document_iterator.py | corpus/document_iterator.py | # Simple iterator that goes over every full text article in the database
# Uses the same parsing as the unlabled sentence iterator
import sqlite3
import re
# Settings tells Documents where the database is located
from context import settings
conn = sqlite3.connect(settings.db)
curr = conn.cursor()
class Documents:... | # Simple iterator that goes over every full text article in the database
# Uses the same parsing as the unlabled sentence iterator
import sqlite3
import re
from context import settings
conn = sqlite3.connect(settings.db)
curr = conn.cursor()
class Documents:
def __init__(self):
q = (" SELECT articleID... | mit | Python |
e3b88f0dca6b413e538ac020fae2e6de4be5ef5f | remove the temp | muffinresearch/solitude,muffinresearch/solitude | lib/proxy/views.py | lib/proxy/views.py | import logging
import urlparse
from django import http
from django.conf import settings
from django_statsd.clients import statsd
import requests
from lib.paypal.client import get_client
from lib.paypal.constants import HEADERS_URL_GET, HEADERS_TOKEN_GET
from lib.paypal.map import urls
log = logging.getLogger('s.pro... | import logging
import urlparse
from django import http
from django.conf import settings
from django_statsd.clients import statsd
import requests
from lib.paypal.client import get_client
from lib.paypal.constants import HEADERS_URL_GET, HEADERS_TOKEN_GET
from lib.paypal.map import urls
log = logging.getLogger('s.pro... | bsd-3-clause | Python |
bdcaaf4ab999c51a6633b7e72971d7594de0b66b | Add python script to find unused linux-headers packages | elleryq/oh-my-home,elleryq/oh-my-home,elleryq/oh-my-home | bin/clean_unused_headers.py | bin/clean_unused_headers.py | #!/usr/bin/env python
from __future__ import print_function
import sys
import os
import re
from subprocess import check_output
IMAGE_PATTERN = re.compile(
'linux-image-(?P<version>[0-9\.]+)-(?P<rev>[0-9]{2})-generic')
HEADER_PATTERN = re.compile(
'linux-headers-(?P<version>[0-9\.]+)-(?P<rev>[0-9]{2})-generic'... | #!/usr/bin/env python
from __future__ import print_function
import sys
import os
import re
from subprocess import check_output
IMAGE_PATTERN = re.compile(
'linux-image-(?P<version>[0-9\.]+)-(?P<rev>[0-9]{2})-generic')
HEADER_PATTERN = re.compile(
'linux-headers-(?P<version>[0-9\.]+)-(?P<rev>[0-9]{2})-generic'... | apache-2.0 | Python |
4fdd3a27b13efeeab8417f0a1de60643e6096f4c | Update mjdm.py | tarasfrompir/majordomo,sergejey/majordomo,sergejey/majordomo,tarasfrompir/majordomo,sergejey/majordomo,tarasfrompir/majordomo,sergejey/majordomo,sergejey/majordomo,tarasfrompir/majordomo | lib/python/mjdm.py | lib/python/mjdm.py | # -*- coding: utf-8 -*-
from mjd_constants import *
try:
import urllib.request as urllib2
from urllib.parse import urlencode
except ImportError:
import urllib2
from urllib import urlencode
import re
import MySQLdb as mdb
import sys
def getURL(url):
response = urllib2.urlopen(url).read()
return... | # -*- coding: utf-8 -*-
from mjd_constants import *
try:
import urllib.request as urllib2
from urllib.parse import urlencode
except ImportError:
import urllib2
from urllib import urlencode
import re
import MySQLdb as mdb
import sys
def getURL(url):
response = urllib2.urlopen(url).read()
return... | mit | Python |
ce56e438c729d6475e37264e8f485cfedc44b884 | update error | ClearCorp/odootools,ClearCorp/odootools | oerptools/install/update.py | oerptools/install/update.py | #!/usr/bin/python2
# -*- coding: utf-8 -*-
########################################################################
#
# OpenERP Tools by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... | #!/usr/bin/python2
# -*- coding: utf-8 -*-
########################################################################
#
# OpenERP Tools by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... | agpl-3.0 | Python |
55dc6f2e9164644f0dd079457f05e12d607cdc4e | delete geo stuff | nypl-spacetime/map-vectorizer,NYPL/map-vectorizer,tlevine/map-vectorizer,nypl-spacetime/map-vectorizer,tlevine/map-vectorizer,NYPL/map-vectorizer | bin/compare-thresholding.py | bin/compare-thresholding.py | #!/usr/bin/env python3
import os, logging, string, subprocess, re
def gimp(inputfile:'file', thresholdfile:'file',
brightness, contrast, thresholdblack, thresholdwhite,
gimp_path = '/Users/t/Applications/GIMP.app/Contents/MacOS/GIMP'):
contraststring = '(gimp-brightness-contrast drawable ' + str... | #!/usr/bin/env python3
import os, logging, string, subprocess, re
def gimp(inputfile:'file', outputfile:'file',
brightness, contrast, thresholdblack, thresholdwhite,
gimp_path = '/Users/t/Applications/GIMP.app/Contents/MacOS/GIMP'):
print "\n\n"
print "Thresholdizing:"
print "-----------... | mit | Python |
19d1462142977053d775c8bce5448756a37d6f70 | Bump to version 0.1.29 | MichaelAquilina/s3backup,MichaelAquilina/s3backup | s4/__init__.py | s4/__init__.py | VERSION = '0.1.29'
| VERSION = '0.1.28'
| mit | Python |
c4f09156ff793bc222e368583696a1a33bb2ae70 | Remove unused imports (F401). | eeshangarg/zulip,synicalsyntax/zulip,dhcrzf/zulip,shubhamdhama/zulip,kou/zulip,eeshangarg/zulip,dhcrzf/zulip,hackerkid/zulip,hackerkid/zulip,dhcrzf/zulip,zulip/zulip,kou/zulip,mahim97/zulip,hackerkid/zulip,jackrzhang/zulip,punchagan/zulip,rht/zulip,showell/zulip,tommyip/zulip,shubhamdhama/zulip,zulip/zulip,showell/zuli... | corporate/urls.py | corporate/urls.py | from django.conf.urls import url
from django.views.generic import TemplateView
i18n_urlpatterns = [
# Zephyr/MIT
url(r'^zephyr/$', TemplateView.as_view(template_name='corporate/zephyr.html')),
url(r'^zephyr-mirror/$', TemplateView.as_view(template_name='corporate/zephyr-mirror.html')),
]
urlpatterns = i18... | from django.conf.urls import url
from django.views.generic import TemplateView, RedirectView
i18n_urlpatterns = [
# Zephyr/MIT
url(r'^zephyr/$', TemplateView.as_view(template_name='corporate/zephyr.html')),
url(r'^zephyr-mirror/$', TemplateView.as_view(template_name='corporate/zephyr-mirror.html')),
]
url... | apache-2.0 | Python |
5392626ef746cf52043494e7d1360fd373bdfe93 | Read java path from environment variable if set | smartschat/cort,smartschat/cort,smartschat/cort,smartschat/cort,smartschat/cort | cort/core/util.py | cort/core/util.py | """ Utility functions. """
__author__ = 'smartschat'
def clean_via_pos(tokens, pos):
""" Clean a list of tokens according to their part-of-speech tags.
In particular, retain only tokens which do not have the part-of-speech tag
DT (determiner) or POS (possessive 's').
Args:
tokens (list(str)... | """ Utility functions. """
__author__ = 'smartschat'
def clean_via_pos(tokens, pos):
""" Clean a list of tokens according to their part-of-speech tags.
In particular, retain only tokens which do not have the part-of-speech tag
DT (determiner) or POS (possessive 's').
Args:
tokens (list(str)... | mit | Python |
28291298ba72d07b2c8d32a3a9ed8b8982615105 | Enable multithreading for ec2api | openstack/ec2-api,stackforge/ec2-api,hayderimran7/ec2-api,stackforge/ec2-api,openstack/ec2-api,hayderimran7/ec2-api | ec2api/cmd/api.py | ec2api/cmd/api.py | # Copyright 2014
# The Cloudscaling Group, 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... | # Copyright 2014
# The Cloudscaling Group, 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... | apache-2.0 | Python |
7458c10e62a37e075cf00cb1c41ab8d8f071c611 | Update simple_dhcp_server.py | alyosha1879/ryu,alyosha1879/ryu,alyosha1879/ryu,alyosha1879/ryu | ryu/app/simple_dhcp_server.py | ryu/app/simple_dhcp_server.py | """
Simple DHCP Server
"""
import logging
from ryu.base import app_manager
from ryu.lib.packet import dhcp
from ryu.lib.packet import ipv4
from ryu.controller.handler import set_ev_cls
from ryu.controller import ofp_event
from ryu.controller.handler import MAIN_DISPATCHER
from ryu.lib.packet import packet
class DHCP... | """
Simple DHCP Server
"""
import logging
from ryu.base import app_manager
from ryu.lib.packet import dchp
class DHCPServer():
@set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER)
def _packet_in_handler(self, ev):
msg = ev.msg
datapath = msg.datapath
ofproto = datapath.ofproto
... | apache-2.0 | Python |
4bfd1a8c9c20ea998189b2f8b651013565265627 | make sure RGB values are in range | jtauber/web-graphics | graphics.py | graphics.py | import zlib
import struct
import array
def output_chunk(out, chunk_type, data):
out.write(struct.pack("!I", len(data)))
out.write(chunk_type)
out.write(data)
checksum = zlib.crc32(data, zlib.crc32(chunk_type))
out.write(struct.pack("!I", checksum))
def get_data(width, height, rgb_func):
fw = f... | import zlib
import struct
import array
def output_chunk(out, chunk_type, data):
out.write(struct.pack("!I", len(data)))
out.write(chunk_type)
out.write(data)
checksum = zlib.crc32(data, zlib.crc32(chunk_type))
out.write(struct.pack("!I", checksum))
def get_data(width, height, rgb_func):
fw = f... | mit | Python |
ab225c8892008ca3d2c041cbc8b034a057de9cfe | remove newline processing | tomv564/LSP | plugin/core/popups.py | plugin/core/popups.py | popup_class = "lsp_popup"
popup_css = '''
.lsp_popup {
margin: 0.5rem 0.5rem 0 0.5rem;
}
.lsp_popup .highlight {
border-width: 0;
border-radius: 0;
}
.lsp_popup p {
margin-bottom: 0.5rem;
padding: 0 0.5rem;
font-family: system;
}
'''
def preserv... | popup_class = "lsp_popup"
popup_css = '''
.lsp_popup {
margin: 0.5rem 0.5rem 0 0.5rem;
}
.lsp_popup .highlight {
border-width: 0;
border-radius: 0;
}
.lsp_popup p {
margin-bottom: 0.5rem;
padding: 0 0.5rem;
font-family: system;
}
'''
def preserv... | mit | Python |
40f50cde1c0a754d0c94265cc0e4481f7dda4e0b | decrease label buffer on today high temp plot | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | scripts/current/today_high.py | scripts/current/today_high.py | # Output the 12z morning low temperature
import sys
import matplotlib.cm as cm
import numpy as np
import datetime
from pyiem.plot import MapPlot
import psycopg2
from pyiem.tracker import loadqc
now = datetime.datetime.now()
qdict = loadqc()
IEM = psycopg2.connect(database='iem', host='iemdb', user='nobody')
icursor = ... | # Output the 12z morning low temperature
import sys
import matplotlib.cm as cm
import numpy as np
import datetime
from pyiem.plot import MapPlot
import psycopg2
from pyiem.tracker import loadqc
now = datetime.datetime.now()
qdict = loadqc()
IEM = psycopg2.connect(database='iem', host='iemdb', user='nobody')
icursor = ... | mit | Python |
1496e80709a5b73d3948d427fafa5111f15536b8 | add simple bar chart to yearly report | akrherz/idep,akrherz/dep,akrherz/dep,akrherz/idep,akrherz/idep,akrherz/dep,akrherz/idep,akrherz/dep,akrherz/idep,akrherz/dep,akrherz/idep | scripts/util/yearly_report.py | scripts/util/yearly_report.py | """Generate a report for the yearly DEP totals"""
import sys
import datetime
import matplotlib.pyplot as plt
import psycopg2
from pandas.io.sql import read_sql
def main(argv):
"""Do What We Wanted"""
scenario = int(argv[1])
pgconn = psycopg2.connect(database='idep', host='localhost', port=5555)
df =... | """Generate a report for the yearly DEP totals"""
import sys
import psycopg2
from pandas.io.sql import read_sql
def main(argv):
"""Do What We Wanted"""
scenario = int(argv[1])
pgconn = psycopg2.connect(database='idep', host='localhost', port=5555)
df = read_sql("""
WITH iahuc12 as (
... | mit | Python |
697495b017512268ff42d35c05fd4a69de57623e | Fix copy / paste oversight (#2448) | TheAlgorithms/Python | scripts/validate_filenames.py | scripts/validate_filenames.py | #!/usr/bin/env python3
import os
from build_directory_md import good_file_paths
filepaths = list(good_file_paths())
assert filepaths, "good_file_paths() failed!"
upper_files = [file for file in filepaths if file != file.lower()]
if upper_files:
print(f"{len(upper_files)} files contain uppercase characters:")
... | #!/usr/bin/env python3
import os
from build_directory_md import good_file_paths
filepaths = list(good_file_paths())
assert filepaths, "good_file_paths() failed!"
upper_files = [file for file in filepaths if file != file.lower()]
if upper_files:
print(f"{len(upper_files)} files contain uppercase characters:")
... | mit | Python |
fedff2cd99058e9ccdbfa857cd2dab14a4184689 | update the path | zkbt/mosasaurus | scripts/wasp94/wasp94_base.py | scripts/wasp94/wasp94_base.py | # create an instrument with the appropriate settings
from mosasaurus.instruments import LDSS3C
i = LDSS3C(grism='vph-all')
# for working on a remote hardisk
import os
path = '/Users/zkbt/Cosmos/Data/Magellan/LDSS3/'
if os.path.exists(path):
i.setupDirectories(path)
i.extractiondefaults['spatialsubarray'] = 200
i... | # create an instrument with the appropriate settings
from mosasaurus.instruments import LDSS3C
i = LDSS3C(grism='vph-all')
# for working on a remote hardisk
import os
path = '/Users/zkbt/Cosmos/Data/Magellan/LDSS3/data/'
if os.path.exists(path):
i.setupDirectories(path)
i.extractiondefaults['spatialsubarray'] = ... | mit | Python |
23aefa07d1fe1e8fd375768d945bd3e5ed74e9aa | clean whitespace | develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms | trunk/editor/saveFileRooms.py | trunk/editor/saveFileRooms.py | #!/usr/bin/env python
from xml.dom import minidom
from xml.etree import ElementTree
#to use OrderedDict in python < 2.7
try:
from collections import OrderedDict
except ImportError:
from misc.dict import OrderedDict
def prettify(content):
"""
Return a pretty-printed XML string for the Element.
"""... | #!/usr/bin/env python
from xml.dom import minidom
from xml.etree import ElementTree
#to use OrderedDict in python < 2.7
try:
from collections import OrderedDict
except ImportError:
from misc.dict import OrderedDict
def prettify(content):
"""
Return a pretty-printed XML string for the Element.
"""... | mit | Python |
7ed0036af08f93f11ea690a498984bba9b1a785e | update networkx dependency to allow version 2.x | fishtown-analytics/dbt,fishtown-analytics/dbt,analyst-collective/dbt,analyst-collective/dbt,fishtown-analytics/dbt | core/setup.py | core/setup.py | #!/usr/bin/env python
from setuptools import find_packages
from distutils.core import setup
import os
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
package_name = "dbt-core"
package_version = "0.14.0a1"
description = """dbt (data build tool) is a command line tool that help... | #!/usr/bin/env python
from setuptools import find_packages
from distutils.core import setup
import os
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
package_name = "dbt-core"
package_version = "0.14.0a1"
description = """dbt (data build tool) is a command line tool that help... | apache-2.0 | Python |
16d949e6ffe9a2bc76e8f76de57b6936f6d92226 | Add task_options attribute to BaseTask | SalesforceFoundation/CumulusCI,SalesforceFoundation/CumulusCI,cdcarter/CumulusCI,e02d96ec16/CumulusCI,Joble/CumulusCI,e02d96ec16/CumulusCI | core/tasks.py | core/tasks.py | import logging
class BaseTask(object):
task_options = {}
def __init__(self, project_config, task_config):
self.project_config = project_config
self.task_config = task_config
self._init_logger()
self._init_task()
def _init_logger(self):
""" Initializes self.logger "... | import logging
class BaseTask(object):
def __init__(self, project_config, task_config):
self.project_config = project_config
self.task_config = task_config
self._init_logger()
self._init_task()
def _init_logger(self):
""" Initializes self.logger """
self.logger ... | bsd-3-clause | Python |
1f5a5a410547fd0fb327f22c7fb48fa551b2df64 | disable whitenoise altogether when testing | openstates/openstates.org,openstates/openstates.org,openstates/openstates.org,openstates/openstates.org | openstates/test_settings.py | openstates/test_settings.py | from .settings import * # noqa
SIMPLEKEYS_ZONE_PATHS = []
# disable whitenoise so we don't have to collectstatic for tests
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
MIDDLEWARE_REMOVE = [
'whitenoise.middleware.WhiteNoiseMiddleware',
]
MIDDLEWARE = [m for m in MIDDLEWARE if m n... | from .settings import * # noqa
SIMPLEKEYS_ZONE_PATHS = []
MIDDLEWARE_REMOVE = [
'whitenoise.middleware.WhiteNoiseMiddleware',
]
MIDDLEWARE = [m for m in MIDDLEWARE if m not in MIDDLEWARE_REMOVE] # noqa
| mit | Python |
fcd9987b3759ab795a7a87c7d0572650cc635d04 | Update version | schae234/PonyTools | ponytools/__init__.py | ponytools/__init__.py |
__version__ = '0.2.0'
__license__ = (
'''
Copyright (c) 2017 Robert Schaefer
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, ... |
__version__ = '0.1.14'
__license__ = (
'''
Copyright (c) 2017 Robert Schaefer
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,... | mit | Python |
20af3d8ebfba59fe7749742c914b39ec561aa6e5 | support multilig | gnina/scripts | create_caches.py | create_caches.py | #!/usr/bin/env python
'''Takes a bunch of types training files. First argument is what index the receptor starts on
(ligand is assumed to be right after). Reads in the gninatypes files specified in these types
files and writes out two monolithic receptor and ligand cache files for use with recmolcache
and ligmolcach... | #!/usr/bin/env python
'''Takes a bunch of types training files. First argument is what index the receptor starts on
(ligand is assumed to be right after). Reads in the gninatypes files specified in these types
files and writes out two monolithic receptor and ligand cache files for use with recmolcache
and ligmolcach... | bsd-3-clause | Python |
d2c83e0c6a484fd49f470b949310418a2a2e3ffb | Fix linux libname | ariovistus/pyd,ariovistus/pyd,ariovistus/pyd | setup/pyd_get_env_set_text.py | setup/pyd_get_env_set_text.py | from distutils import sysconfig
import os
python_version = sysconfig.get_config_var('VERSION')
python_version_compact = python_version.replace('.', '')
if python_version_compact[0] == '2':
versionNumbers = list(map(lambda n: '2_' + str(n),
range(4, int(python_version_compact[1]) + 1)))
else:
versionNumbers = list... | from distutils import sysconfig
import os
python_version = sysconfig.get_config_var('VERSION')
python_version_compact = python_version.replace('.', '')
if python_version_compact[0] == '2':
versionNumbers = list(map(lambda n: '2_' + str(n),
range(4, int(python_version_compact[1]) + 1)))
else:
versionNumbers = list... | mit | Python |
67daf4140c17ce28b0ab45ddd2366968082de739 | Update last_used_at after successful computer verification | mathspace/django-two-factor-auth,percipient/django-two-factor-auth,percipient/django-two-factor-auth,moreati/django-two-factor-auth,Bouke/django-two-factor-auth,moreati/django-two-factor-auth,mathspace/django-two-factor-auth,koleror/django-two-factor-auth,koleror/django-two-factor-auth,Bouke/django-two-factor-auth,fusi... | two_factor/auth_backends.py | two_factor/auth_backends.py | from django.contrib.auth.backends import ModelBackend
from django.utils.timezone import now
from oath import accept_totp
class TokenBackend(ModelBackend):
def authenticate(self, user, token):
accepted, drift = accept_totp(key=user.token.seed, response=token)
return user if accepted else None
cla... | from django.contrib.auth.backends import ModelBackend
from django.utils.timezone import now
from oath import accept_totp
class TokenBackend(ModelBackend):
def authenticate(self, user, token):
accepted, drift = accept_totp(key=user.token.seed, response=token)
return user if accepted else None
cla... | mit | Python |
86d844680015d60043a404f0b021463027b89e43 | Fix off by one error in line number enumeration | dupuy/pre-commit-hooks,jordant/pre-commit-hooks,jordant/pre-commit-hooks,pre-commit/pre-commit-hooks,Coverfox/pre-commit-hooks,bgschiller/pre-commit-hooks,chriskuehl/pre-commit-hooks,Harwood/pre-commit-hooks,arahayrabedian/pre-commit-hooks | pre_commit_hooks/check_merge_conflict.py | pre_commit_hooks/check_merge_conflict.py | from __future__ import print_function
import argparse
import sys
CONFLICT_PATTERNS = [
'<<<<<<< ',
'=======',
'>>>>>>> '
]
WARNING_MSG = 'Merge conflict string "{0}" found in {1}:{2}'
def detect_merge_conflict(argv=None):
parser = argparse.ArgumentParser()
parser.add_argument('filenames', nargs=... | from __future__ import print_function
import argparse
import sys
CONFLICT_PATTERNS = [
'<<<<<<< ',
'=======',
'>>>>>>> '
]
WARNING_MSG = 'Merge conflict string "{0}" found in {1}:{2}'
def detect_merge_conflict(argv=None):
parser = argparse.ArgumentParser()
parser.add_argument('filenames', nargs=... | mit | Python |
b55561b9b2b8a2c5608fab4a168d17b490b11024 | Add note about colormap usage | atmtools/typhon,atmtools/typhon | typhon/plots/cm/__init__.py | typhon/plots/cm/__init__.py | # -*- coding: utf-8 -*-
"""
This module provides colormaps to use for the visualisation of meteorological
data. It heavily bases on the cmocean_ package developed by Kristen Thyng.
Most colormaps are directly inherited and renamed for meteorological
applications.
The colormaps are registered in matplotlib after impor... | # -*- coding: utf-8 -*-
"""
This module provides colormaps to use for the visualisation of meteorological
data.
This module heavily bases on the cmocean_ package developed by Kristen Thyng.
Most colormaps are directly inherited and renamed for meteorological
applications.
.. _cmocean: http://matplotlib.org/cmocean/
"... | mit | Python |
c6025e7bfa4de06a2611d87a4d54e65524c822ea | Update config.py | GoogleCloudPlatform/asl-ml-immersion,GoogleCloudPlatform/asl-ml-immersion,GoogleCloudPlatform/asl-ml-immersion | notebooks/tfx_pipelines/pipeline/solutions/pipeline_vertex/config.py | notebooks/tfx_pipelines/pipeline/solutions/pipeline_vertex/config.py | # Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | # Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 | Python |
2d9d4f640fb2be0fd0e75abc9281ce56fc7909dc | Increase memory constraint on cc | cf-charmers/cloudfoundry,cf-charmers/cloudfoundry | cloudfoundry/releases.py | cloudfoundry/releases.py | # The names of services in this file are references to
# services in cloudfoundry.services.SERVICES
# Service Definition to deployed service name
# mapping
COMMON_SERVICES = [
('cloud-controller-v1', 'cc'),
('cloud-controller-clock-v1', 'cc-clock'),
('cloud-controller-worker-v1', 'cc-worker'),
('router... | # The names of services in this file are references to
# services in cloudfoundry.services.SERVICES
# Service Definition to deployed service name
# mapping
COMMON_SERVICES = [
('cloud-controller-v1', 'cc'),
('cloud-controller-clock-v1', 'cc-clock'),
('cloud-controller-worker-v1', 'cc-worker'),
('router... | bsd-3-clause | Python |
e80cc896396b217a3e3a4f01294b50061faf68cd | Put name first in range form | zeeman/cyder,zeeman/cyder,akeym/cyder,akeym/cyder,akeym/cyder,OSU-Net/cyder,OSU-Net/cyder,murrown/cyder,zeeman/cyder,OSU-Net/cyder,OSU-Net/cyder,murrown/cyder,akeym/cyder,zeeman/cyder,drkitty/cyder,murrown/cyder,murrown/cyder,drkitty/cyder,drkitty/cyder,drkitty/cyder | cyder/cydhcp/range/forms.py | cyder/cydhcp/range/forms.py | from django import forms
from cyder.base.eav.forms import get_eav_form
from cyder.base.mixins import UsabilityFormMixin
from cyder.cydhcp.range.models import Range, RangeAV
from cyder.cydns.forms import ViewChoiceForm
class RangeForm(ViewChoiceForm, UsabilityFormMixin):
class Meta:
model = Range
... | from django import forms
from cyder.base.eav.forms import get_eav_form
from cyder.base.mixins import UsabilityFormMixin
from cyder.cydhcp.range.models import Range, RangeAV
from cyder.cydns.forms import ViewChoiceForm
class RangeForm(ViewChoiceForm, UsabilityFormMixin):
class Meta:
model = Range
... | bsd-3-clause | Python |
b967c71125009f7932c12f973ff47b7ac5bf3d82 | Add test case for RegistryURI with trailing slash (fails) | projectatomic/osbs-client,bfontecc007/osbs-client,bfontecc007/osbs-client,vrutkovs/osbs-client,DBuildService/osbs-client,DBuildService/osbs-client,vrutkovs/osbs-client,projectatomic/osbs-client | tests/build/test_spec.py | tests/build/test_spec.py | """
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
import pytest
from osbs.build.spec import BuildIDParam, RegistryURIsParam, CommonSpec
from osbs.exceptions import OsbsValidationException
fro... | """
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
import pytest
from osbs.build.spec import BuildIDParam, RegistryURIsParam, CommonSpec
from osbs.exceptions import OsbsValidationException
fro... | bsd-3-clause | Python |
86d963af3b78a210a4c71287c505ae9267a2e042 | fix for _get_attached_fields | wlanslovenija/cmsplugin-blog,wlanslovenija/cmsplugin-blog,wlanslovenija/cmsplugin-blog,divio/cmsplugin-blog,divio/cmsplugin-blog,divio/cmsplugin-blog,wlanslovenija/cmsplugin-blog | cmsplugin_blog/fields.py | cmsplugin_blog/fields.py | from django.db import models
from django.conf import settings
from cms.models import Placeholder
def _get_attached_field(self):
from cms.models import CMSPlugin
if not hasattr(self, '_attached_field_cache'):
self._attached_field_cache = None
for rel in self._meta.get_all_related_objec... | from django.db import models
from django.conf import settings
from cms.models import Placeholder
def _get_attached_field(self):
from cms.models import CMSPlugin
if not hasattr(self, '_attached_field_cache'):
self._attached_field_cache = None
for rel in self._meta.get_all_related_objec... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.