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 |
|---|---|---|---|---|---|---|---|---|
034f4e968fd802fd3c0cb1db805b6169428d9b99 | Add version method | FlyingCampDesign/bustools | bustools/__init__.py | bustools/__init__.py | #==========================================================================
# DISTRIBUTION VERSION
#--------------------------------------------------------------------------
# This is a PEP 0008 and PEP 0440 compliant version string, i.e.
# "major.minor.micro". It is read by setup.py to determine the
# distribution v... | #==========================================================================
# DISTRIBUTION VERSION
#--------------------------------------------------------------------------
# This is a PEP 0008 and PEP 0440 compliant version string, i.e.
# "major.minor.micro". It is read by setup.py to determine the
# distribution v... | mit | Python |
bbe37f94846f07e53d04fd3065b3fd365b4c2e06 | write get_data() consistently with arcgis and geojson scrapers | wdiv-scrapers/dc-base-scrapers | dc_base_scrapers/ckan_scraper.py | dc_base_scrapers/ckan_scraper.py | import json
from collections import OrderedDict
from dc_base_scrapers.common import (
get_data_from_url,
save,
sync_file_to_github
)
def format_json(json_str):
return json.dumps(
json.loads(json_str, object_pairs_hook=OrderedDict),
sort_keys=True, indent=4
)
class CkanScraper:
... | import json
from collections import OrderedDict
from dc_base_scrapers.common import (
get_data_from_url,
save,
sync_file_to_github
)
def format_json(json_str):
return json.dumps(
json.loads(json_str, object_pairs_hook=OrderedDict),
sort_keys=True, indent=4
)
class CkanScraper:
... | mit | Python |
3cd547a450157b7370d13a611ed06d0f97a4e965 | Add pull-request flow | kylef/maintain,kylef/maintain,kylef/maintain | maintain/commands/release.py | maintain/commands/release.py | import os
from glob import glob
import json
import collections
import subprocess
import click
from semantic_version import Version
from maintain.process import invoke
from maintain.release.cocoapods import CocoaPodsReleaser
from maintain.release.npm import NPMReleaser
@click.command()
@click.argument('version')
@cl... | import os
from glob import glob
import json
import collections
import subprocess
import click
from semantic_version import Version
from maintain.process import invoke
from maintain.release.cocoapods import CocoaPodsReleaser
from maintain.release.npm import NPMReleaser
@click.command()
@click.argument('version')
def... | bsd-2-clause | Python |
52933f030b246615429ac74f7f156b7a33225d7f | Resolve RuntimeError: Invalid DISPLAY variable - tst | opengridcc/opengrid | opengrid/tests/test_plotting.py | opengrid/tests/test_plotting.py | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 30 02:37:25 2013
@author: Jan
"""
import unittest
import pandas as pd
from opengrid.library import plotting
class PlotStyleTest(unittest.TestCase):
def test_default(self):
plt = plotting.plot_style()
class CarpetTest(unittest.TestCase):
def test_defau... | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 30 02:37:25 2013
@author: Jan
"""
import unittest
class PlotStyleTest(unittest.TestCase):
def test_default(self):
from opengrid.library.plotting import plot_style
plt = plot_style()
class CarpetTest(unittest.TestCase):
def test_default(self):
... | apache-2.0 | Python |
33e1c57cd6186820fb95b5d04a1f494710b2ccbe | Comment for types of area that need importing | DemocracyClub/Website,DemocracyClub/Website,DemocracyClub/Website,DemocracyClub/Website | democracy_club/apps/authorities/management/commands/import_mapit_area_type.py | democracy_club/apps/authorities/management/commands/import_mapit_area_type.py | """
DIW
MTW
UTW
"""
import time
import requests
from bs4 import BeautifulSoup
from django.core.management.base import BaseCommand
from django.contrib.gis.geos import GEOSGeometry
from django.contrib.gis.geos import Point
from authorities.models import Authority, MapitArea
from authorities import constants
from auth... | import time
import requests
from bs4 import BeautifulSoup
from django.core.management.base import BaseCommand
from django.contrib.gis.geos import GEOSGeometry
from django.contrib.gis.geos import Point
from authorities.models import Authority, MapitArea
from authorities import constants
from authorities.helpers impor... | bsd-3-clause | Python |
34f615637048ce8dccc474500e986770b13d6309 | Split Bucketlist resource into 2 resources - GetBucketList for single bucketlist item and GetAllBucketList to get all the existing bucketlist items | brayoh/bucket-list-api | controllers/bucketlist.py | controllers/bucketlist.py | from flask_restful import Resource, request
class GetAllBucketLists(Resource):
""" this class gets all the bucketlists in the database."""
def get(self):
pass
class GetBucketList(Resource):
""" this class gets a single bucketlist """
def get(self):
pass
| from flask_restful import Resource
class BucketList(Resource):
"""docstring for BucketListItems."""
def get(self):
pass
| mit | Python |
c9c106f37c9fbbca1a93348695563e2587bc0c65 | Remove a useless trailing $ | ManoSeimas/manoseimas.lt,ManoSeimas/manoseimas.lt,ManoSeimas/manoseimas.lt,ManoSeimas/manoseimas.lt | manoseimas/lobbyists/urls.py | manoseimas/lobbyists/urls.py | from django.conf.urls import include, patterns, url
from manoseimas.lobbyists import views
urlpatterns = patterns(
'',
url(r'^$', 'manoseimas.lobbyists.views.lobbyists.lobbyist_list'),
url(r'^lobbyist/(?P<lobbyist_slug>.+)/',
views.lobbyist_profile, name='lobbyist_profile'),
url(r'^json/', inc... | from django.conf.urls import include, patterns, url
from manoseimas.lobbyists import views
urlpatterns = patterns(
'',
url(r'^$', 'manoseimas.lobbyists.views.lobbyists.lobbyist_list'),
url(r'^lobbyist/(?P<lobbyist_slug>.+)/$',
views.lobbyist_profile, name='lobbyist_profile'),
url(r'^json/', in... | agpl-3.0 | Python |
a2db7857e356409eef9012ed2f5adf89ebd6ef1e | change unit test method name for a better one, start creating db mock instance and +1 ut | sebasmonia/pyquebec | test/test_querybuilder.py | test/test_querybuilder.py | import unittest
from unittest.mock import Mock,MagicMock
from pyquebec.querybuilder import QueryBuilder
class TestQueryBuilder(unittest.TestCase):
@classmethod
def setUpClass(cls):
dbo_mock = Mock()
cls._mock_db_instance = Mock()
cls._mock_db_instance.dbo = MagicMock(return_value=dbo_mo... | import unittest
from pyquebec.querybuilder import QueryBuilder
class TestQueryBuilder(unittest.TestCase):
def test_where_with_None_value(self):
self.assertRaises(ValueError, QueryBuilder,None)
if __name__ == '__main__':
unittest.main()
| mit | Python |
d52ac85e7be984d0a1680b31a7dc2fe887516ed9 | Update Multiwii.py | MyRobotLab/pyrobotlab,sstocker46/pyrobotlab,MyRobotLab/pyrobotlab,mecax/pyrobotlab,mecax/pyrobotlab,sstocker46/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,sstocker46/pyrobotlab,MyRobotLab/pyrobotlab | service/Multiwii.py | service/Multiwii.py | #define POLL_PERIOD 20
serial = Runtime.start("serial","Serial"
COMPORT= "COM19"
BAUDRATE = 9600
#define MSP_SET_RAW_RC 200
#define MSP_SET_RAW_RC_LENGTH 16
RC_MIN = 1000
RC_MID = 1500
RC_MAX = 2000
ROLL = 0
PITCH = 1
YAW = 2
THROTTLE = 3
AUX1 = 4
AUX2 = 5
AUX3 = 6
AUX4 = 7... | #define POLL_PERIOD 20
COMPORT= "COM19"
BAUDRATE = 9600
#define MSP_SET_RAW_RC 200
#define MSP_SET_RAW_RC_LENGTH 16
RC_MIN = 1000
RC_MID = 1500
RC_MAX = 2000
ROLL = 0
PITCH = 1
YAW = 2
THROTTLE = 3
AUX1 = 4
AUX2 = 5
AUX3 = 6
AUX4 = 7
#RC signals to send to the quad
#format:... | apache-2.0 | Python |
935c6abda584d790ee529cc90f68b4741969cc62 | Update pwned.py | 0x424D/crappy,0x424D/crappy | pwned/src/pwned.py | pwned/src/pwned.py | import hashlib, sys, urllib.request
def main():
password = sys.argv[1]
hash = hashlib.sha1(bytes(password, "utf-8"))
digest = hash.hexdigest().upper()
url = f"https://api.pwnedpasswords.com/range/{digest[:5]}"
request = urllib.request.Request(url, headers={"User-Agent":"API-Programming-Exercise"})
page = urllib... | import hashlib, sys, urllib.request
def main():
hash = hashlib.sha1(bytes(sys.argv[1], "utf-8"))
digest = hash.hexdigest().upper()
url = f"https://api.pwnedpasswords.com/range/{digest[:5]}"
request = urllib.request.Request(url, headers={"User-Agent":"API-Programming-Exercise"})
page = urllib.request.urlopen(requ... | agpl-3.0 | Python |
4a2c824ab41675e9793def4b560bddef180a85be | Update views.py | NightTarlis/URLShortener,NightTarlis/URLShortener | shortLinks/views.py | shortLinks/views.py | from django.contrib.auth.models import User
from django.contrib.sites.shortcuts import get_current_site
from django.shortcuts import render_to_response, redirect, get_object_or_404
from django.template.context_processors import csrf
from shortLinks.models import Links
from django.contrib import auth
import hashlib
impo... | from django.contrib.auth.models import User
from django.contrib.sites.shortcuts import get_current_site
from django.http import HttpResponse
from django.shortcuts import render_to_response, redirect, get_object_or_404
from django.template.context_processors import csrf
from shortLinks.models import Links
from django.co... | apache-2.0 | Python |
210669bb46630b1abc6f19605bd77d045b5b396e | Add type hints | hotzenklotz/pybeerxml | pybeerxml/utils.py | pybeerxml/utils.py | from typing import Text, Any, Optional
def to_lower(possible_string: Any) -> Text:
"Helper function to transform strings to lower case"
value = ""
try:
value = possible_string.lower()
except AttributeError:
pass
return value
def cast_to_bool(value: Any) -> bool:
if isinstan... | from typing import Text, Any
def to_lower(possible_string: Any) -> Text:
"Helper function to transform strings to lower case"
value = ""
try:
value = possible_string.lower()
except AttributeError:
pass
return value
def cast_to_bool(value: Any) -> bool:
if isinstance(value, ... | mit | Python |
e20dd3ae46e33f0c27d0d394585dd6f2a1c59c52 | clean up dependencies in cli.py | kbrose/article-tagging,kbrose/article-tagging,chicago-justice-project/article-tagging,chicago-justice-project/article-tagging | lib/tagnews/crimetype/cli.py | lib/tagnews/crimetype/cli.py | import sys
from .tag import Tagger
"""
A command line interface to the automatic article tagger.
Run with `python -m tagnews.crimetype.cli`
"""
if __name__ == '__main__':
tagger = Tagger()
if len(sys.argv) == 1:
print(('Go ahead and start typing.'
'\nIf you are on a UNIX machine, hit c... | import sys
import os
import pickle
from ..utils.model_helpers import LemmaTokenizer
from .tag import Tagger
"""
A command line interface to the automatic article tagger.
Run with `python -m tagnews.crimetype.cli`
"""
if __name__ == '__main__':
tagger = Tagger()
if len(sys.argv) == 1:
print(('Go ahead... | mit | Python |
9b758b11da0444c1ec6e9052ab18da78ca4c762e | use available methods | jalanb/jab,jalanb/jab,jalanb/dotjab,jalanb/dotjab | python/y.py | python/y.py | import os
import argv
import paths
argv.add_options([
('delete', 'delete python compiled files as well', False),
('wipe', 'remove known garbage',False),
('stat', 'run svn stat', False),
('ptags', 'do not refresh the tags file', True),
('verbose', 'run ptags verbosely', False),
])
from ls import ly
def remove_gl... | import os
import argv
import paths
argv.add_options([
('delete', 'delete python compiled files as well', False),
('wipe', 'remove known garbage',False),
('stat', 'run svn stat', False),
('ptags', 'do not refresh the tags file', True),
('verbose', 'run ptags verbosely', False),
])
from ls import ly
def remove_gl... | mit | Python |
5b0c3870239144ec042d37fe5b6b01bf5b339353 | Make sure to use /bin/bash for exit_status_test | Yelp/dumb-init,Yelp/dumb-init,Yelp/dumb-init | tests/exit_status_test.py | tests/exit_status_test.py | import distutils.spawn
import signal
from subprocess import Popen
import pytest
@pytest.mark.parametrize('exit_status', [0, 1, 2, 32, 64, 127, 254, 255])
@pytest.mark.usefixtures('both_debug_modes', 'both_setsid_modes')
def test_exit_status_regular_exit(exit_status):
"""dumb-init should exit with the same exit s... | import signal
from subprocess import Popen
import pytest
@pytest.mark.parametrize('exit_status', [0, 1, 2, 32, 64, 127, 254, 255])
@pytest.mark.usefixtures('both_debug_modes', 'both_setsid_modes')
def test_exit_status_regular_exit(exit_status):
"""dumb-init should exit with the same exit status as the process th... | mit | Python |
5236bc9cecb26a30fcf9072e009422bed7a6ba13 | Update test | kervi/kervi,kervi/kervi,kervi/kervi,kervi/kervi,kervi/kervi | tests/test_application.py | tests/test_application.py | from kervi.application import Application
import kervi.utility.nethelper as nethelper
import time
def module_loaded(module_name):
print(module_name)
def xytest_application():
app = Application()
app.spine.register_event_handler("moduleLoaded", module_loaded)
assert app.settings["info"]["id"] == "k... | from kervi.application import Application
import kervi.utility.nethelper as nethelper
import time
def module_loaded(module_name):
print(module_name)
def xtest_application():
app = Application()
app.spine.register_event_handler("moduleLoaded", module_loaded)
assert app.settings["info"]["id"] == "ke... | mit | Python |
83a7e38c22f0654cd04012525a834b0d0c831dff | Test compilation during warmup | blackjax-devs/blackjax | tests/test_compilation.py | tests/test_compilation.py | """Make sure that the log probability function is only compiled/traced once.
"""
import chex
import jax
import jax.numpy as jnp
import jax.scipy as jscipy
from absl.testing import absltest
import blackjax
class CompilationTest(chex.TestCase):
def test_hmc(self):
@chex.assert_max_traces(n=1)
def l... | """Make sure that the log probability function is only compiled/traced once.
"""
import chex
import jax
import jax.numpy as jnp
import jax.scipy as jscipy
from absl.testing import absltest
import blackjax
class CompilationTest(chex.TestCase):
def test_hmc(self):
@chex.assert_max_traces(n=1)
def l... | apache-2.0 | Python |
d3abc17141647d974aa722e7d7fb48899483db83 | Increase selenium browser timeout | uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal | tests/test_integration.py | tests/test_integration.py | """Unit test module for Selenium testing"""
from selenium import webdriver
from flask.ext.testing import LiveServerTestCase
from tests import TestCase
from pages import LoginPage
class TestUI(TestCase, LiveServerTestCase):
"""Test class for UI integration/workflow testing"""
def setUp(self):
"""Res... | """Unit test module for Selenium testing"""
from selenium import webdriver
from flask.ext.testing import LiveServerTestCase
from tests import TestCase
from pages import LoginPage
class TestUI(TestCase, LiveServerTestCase):
"""Test class for UI integration/workflow testing"""
def setUp(self):
"""Res... | bsd-3-clause | Python |
36af0d8abe86560d866e7e1ed0bd91ac90e8f3c3 | Fix flake8 E501, E101 and W191 in api/pagination | overshard/timestrap,Leahelisabeth/timestrap,cdubz/timestrap,Leahelisabeth/timestrap,cdubz/timestrap,cdubz/timestrap,muhleder/timestrap,muhleder/timestrap,overshard/timestrap,Leahelisabeth/timestrap,muhleder/timestrap,Leahelisabeth/timestrap,overshard/timestrap | api/pagination.py | api/pagination.py | from collections import OrderedDict
from django.db.models import Sum
from rest_framework.pagination import LimitOffsetPagination, _get_count
from rest_framework.response import Response
from core.utils import duration_string_from_delta
class LimitOffsetPaginationWithTotals(LimitOffsetPagination):
total_duratio... | from collections import OrderedDict
from django.db.models import Sum
from rest_framework.pagination import LimitOffsetPagination, _get_count
from rest_framework.response import Response
from core.utils import duration_string_from_delta
class LimitOffsetPaginationWithTotals(LimitOffsetPagination):
total_duratio... | bsd-2-clause | Python |
cc8e643902eb46f9e9d73a4367518e6ab6195308 | Add plant names and childs | amalshehu/exercism-python | kindergarten-garden/kindergarten_garden.py | kindergarten-garden/kindergarten_garden.py | # File: kindergarten_garden.py
# Purpose: Write a program that, given a diagram, can tell you which plants each child in the kindergarten class is responsible for.
# Programmer: Amal Shehu
# Course: Exercism
# Date: Thursday 10th September 2016, 10:51 PM
class Garden(object):
plant_... | # File: kindergarten_garden.py
# Purpose: Write a program that, given a diagram, can tell you which plants each child in the kindergarten class is responsible for.
# Programmer: Amal Shehu
# Course: Exercism
# Date: Thursday 10th September 2016, 10:51 PM
| mit | Python |
5405531b3d935425768248ff1e4d86bdae916f99 | Remove unused argument | thomasgibson/tabula-rasa | results/sccg-table.py | results/sccg-table.py | import os
import sys
import pandas as pd
p4_data = "helmholtz-results/helmholtz_conv-d-4.csv"
p5_data = "helmholtz-results/helmholtz_conv-d-5.csv"
p6_data = "helmholtz-results/helmholtz_conv-d-6.csv"
p7_data = "helmholtz-results/helmholtz_conv-d-7.csv"
data_set = [p4_data, p5_data, p6_data, p7_data]
for data in data... | import os
import sys
import pandas as pd
p4_data = "helmholtz-results/helmholtz_conv-d-4.csv"
p5_data = "helmholtz-results/helmholtz_conv-d-5.csv"
p6_data = "helmholtz-results/helmholtz_conv-d-6.csv"
p7_data = "helmholtz-results/helmholtz_conv-d-7.csv"
data_set = [p4_data, p5_data, p6_data, p7_data]
for data in data... | mit | Python |
c386e9608eecc1e21fb30f073800755713267c07 | Set default delay to 5 seconds (because of my slow laptop). | shellphish/rex,shellphish/rex | rex/network_feeder.py | rex/network_feeder.py |
import time
import threading
import socket
class NetworkFeeder:
"""
A class that feeds data to a socket port
"""
def __init__(self, proto, host, port, data, is_client=True, delay=5, timeout=2):
if not is_client:
raise NotImplementedError("Server mode is not implemented.")
... |
import time
import threading
import socket
class NetworkFeeder:
"""
A class that feeds data to a socket port
"""
def __init__(self, proto, host, port, data, is_client=True, delay=3, timeout=2):
if not is_client:
raise NotImplementedError("Server mode is not implemented.")
... | bsd-2-clause | Python |
c449063108f5aa4b47236c95249b41be35b96229 | test config read default filenames | tsadm/desktop,tsadm/desktop,tsadm/desktop,tsadm/desktop | lib/tsdesktop/config_test.py | lib/tsdesktop/config_test.py | from unittest import TestCase
from tsdesktop import config
class Config(TestCase):
def setUp(self):
config.read('/dev/null')
def test_read_no_filenames(self):
config.read()
def test_defaults(self):
from os.path import expanduser
with self.assertRaises(KeyError):
... | from unittest import TestCase
from tsdesktop import config
class TestConfig(TestCase):
def setUp(self):
config.read('/dev/null')
def test_config_defaults(self):
from os.path import expanduser
with self.assertRaises(KeyError):
config.cfg['tsadm']
self.assertEqual(... | bsd-3-clause | Python |
6ccaf810ddd8934926fd0e1b5b580ca31b3c67c8 | Fix missing parenthesis for default route in budget module. | Zillolo/mana-vault,Zillolo/mana-vault,Zillolo/mana-vault | app/mod_budget/controller.py | app/mod_budget/controller.py | from flask import Blueprint
budget = Blueprint('budget', __name__, template_folder = 'templates')
@budget.route('/')
def default():
return "Hello World!"
| from flask import Blueprint
budget = Blueprint('budget', __name__, template_folder = 'templates')
@budget.route('/')
def default:
return "Hello World!"
| mit | Python |
b4f4d188d6c87b80a75604394d3a154ee63cef3f | Drop '_GaxBundlingEvent' testing fossil. | tseaver/google-cloud-python,tswast/google-cloud-python,tswast/google-cloud-python,googleapis/google-cloud-python,calpeyser/google-cloud-python,tartavull/google-cloud-python,tswast/google-cloud-python,tseaver/gcloud-python,Fkawala/gcloud-python,waprin/google-cloud-python,jonparrott/google-cloud-python,waprin/gcloud-pyth... | gcloud/_testing.py | gcloud/_testing.py | # Copyright 2014 Google Inc. 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 2014 Google Inc. 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 |
894c5f2f9ce66b9f1a6a40e19c15616292c77c9b | Print only the output filename | shadowoneau/skylines,Harry-R/skylines,Harry-R/skylines,snip/skylines,Turbo87/skylines,kerel-fs/skylines,Turbo87/skylines,skylines-project/skylines,RBE-Avionik/skylines,dkm/skylines,kerel-fs/skylines,shadowoneau/skylines,snip/skylines,Turbo87/skylines,skylines-project/skylines,shadowoneau/skylines,RBE-Avionik/skylines,s... | generate_assets.py | generate_assets.py | #!/usr/bin/python
import os
import sys
from argparse import ArgumentParser
from paste.deploy.loadwsgi import appconfig
from skylines.assets import Environment
# Build paths
base_path = os.path.dirname(sys.argv[0])
# Create argument parser
parser = ArgumentParser(description='Generate concatenated and minified CSS an... | #!/usr/bin/python
import os
import sys
from argparse import ArgumentParser
from paste.deploy.loadwsgi import appconfig
from skylines.assets import Environment
# Build paths
base_path = os.path.dirname(sys.argv[0])
# Create argument parser
parser = ArgumentParser(description='Generate concatenated and minified CSS an... | agpl-3.0 | Python |
cb96185f551a3669b979d94de6248c64da981536 | Update for v2.7.0 | maxmind/GeoIP2-python,maxmind/GeoIP2-python | geoip2/__init__.py | geoip2/__init__.py | # pylint:disable=C0111
__title__ = 'geoip2'
__version__ = '2.7.0'
__author__ = 'Gregory Oschwald'
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright (c) 2013-2018 Maxmind, Inc.'
| # pylint:disable=C0111
__title__ = 'geoip2'
__version__ = '2.6.0'
__author__ = 'Gregory Oschwald'
__license__ = 'Apache License, Version 2.0'
__copyright__ = 'Copyright (c) 2013-2018 Maxmind, Inc.'
| apache-2.0 | Python |
82432fc976682beb6cc584230d35deb720f39576 | fix the bug that the recall and precision are misplaced | StackResys/Stack-Resys,StackResys/Stack-Resys,StackResys/Stack-Resys | src/evaluation/evaluator.py | src/evaluation/evaluator.py | """ This module defines the base class for Evaluator """
class Evaluator:
""" Evaluator could be used to analyse the precisiona and recall of
the classified results """
def __init__(self):
self.total_recall = 0
self.total_precision = 0
self.sample_count = 0
def update(self, ori... | """ This module defines the base class for Evaluator """
class Evaluator:
""" Evaluator could be used to analyse the precisiona and recall of
the classified results """
def __init__(self):
self.total_recall = 0
self.total_precision = 0
self.sample_count = 0
def update(self, ori... | bsd-3-clause | Python |
94d3b36e08a546ef470dd0d8dab55a4be3d4265b | Add a comment to this example | imsardine/jenkinsapi,domenkozar/jenkinsapi,jduan/jenkinsapi,mistermocha/jenkinsapi,zaro0508/jenkinsapi,salimfadhley/jenkinsapi,zaro0508/jenkinsapi,aerickson/jenkinsapi,imsardine/jenkinsapi,JohnLZeller/jenkinsapi,aerickson/jenkinsapi,jduan/jenkinsapi,zaro0508/jenkinsapi,mistermocha/jenkinsapi,JohnLZeller/jenkinsapi,sali... | examples/get_config.py | examples/get_config.py | """
An example of how to use JenkinsAPI to fetch the config XML of a job.
"""
from jenkinsapi.jenkins import Jenkins
J = Jenkins('http://localhost:8080')
jobName = 'create_fwrgmkbbzk'
config = J[jobName].get_config()
print config
| import logging
logging.basicConfig()
from jenkinsapi.jenkins import Jenkins
J = Jenkins('http://localhost:8080')
jobName = 'create_fwrgmkbbzk'
config = J[jobName].get_config()
print config
| mit | Python |
005df4a224a2a4bdaf1cacfe103148cceb94761b | fix gi_example | lazka/pgi,lazka/pgi | examples/gi_example.py | examples/gi_example.py | # Copyright 2012 Christoph Reiter
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
from ctypes import byref
i... | # Copyright 2012 Christoph Reiter
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
from ctypes import byref
i... | lgpl-2.1 | Python |
737594d2552747fe0304583b166e1a6a5aa21454 | test eye | glimix/lim | lim/cov/test/test_eye_cov.py | lim/cov/test/test_eye_cov.py | from __future__ import division
import numpy.testing as npt
from numpy.random import RandomState
from numpy import exp
from optimix import check_grad
from lim.cov import EyeCov
from lim.util.fruits import Oranges
from lim.util.fruits import Apples
def test_eye_value():
cov = EyeCov()
cov.scale = 2.1
o... | from __future__ import division
import numpy.testing as npt
from numpy.random import RandomState
from numpy import exp
from optimix import check_grad
from lim.cov import EyeCov
from lim.util.fruits import Oranges
from lim.util.fruits import Apples
def test_eye_value():
cov = EyeCov()
cov.scale = 2.1
o... | mit | Python |
450f082237e5b302988cece5c6eb091a5d8503df | Remove python2 print from img server | thusoy/nuts-auth,thusoy/nuts-auth | examples/img_server.py | examples/img_server.py | #!/usr/bin/env python
"""
This example implements a server taking a single image when receiving a message from the client.
The image will be fragmented into chunks. The first packet sent contains the number of chunks to expect.
"""
import io
import picamera
import time
from nuts import UDPAuthChannel
def ta... | #!/usr/bin/env python
"""
This example implements a server taking a single image when receiving a message from the client.
The image will be fragmented into chunks. The first packet sent contains the number of chunks to expect.
"""
import io
import picamera
import time
from nuts import UDPAuthChannel
def ta... | mit | Python |
1738a8025579e5e4b0e28155606ccd1487ec3a7b | add if __name__ == '__main__': | slightlynybbled/tk_tools | examples/label_grid.py | examples/label_grid.py | import tkinter as tk
import tk_tools
def add_row():
row = [1, 2, 3]
label_grid.add_row(row)
def remove_row():
label_grid.remove_row(0)
if __name__ == '__main__':
root = tk.Tk()
label_grid = tk_tools.LabelGrid(root, 3, ['Column0', 'Column1', 'Column2'])
label_grid.grid(row=0, column=0)
... | import tkinter as tk
import tk_tools
root = tk.Tk()
label_grid = tk_tools.LabelGrid(root, 3, ['Column0', 'Column1', 'Column2'])
label_grid.grid(row=0, column=0)
def add_row():
row = [1, 2, 3]
label_grid.add_row(row)
def remove_row():
label_grid.remove_row(0)
add_row_btn = tk.Button(text='Add Row', c... | mit | Python |
d0633c75b20775c1d963a2c3bf41268051b92a9a | add some comments | lizardsystem/lizard-auth-client,lizardsystem/lizard-auth-client,lizardsystem/lizard-auth-client | lizard_auth_client/client.py | lizard_auth_client/client.py | import requests
import json
from urlparse import urljoin
class AutheticationFailed(Exception):
pass
class CommunicationError(Exception):
pass
def _do_post(url_base, username, password):
'''
Posts the specified username and password combination to the
authentication API listening on url_base.
... | import requests
import json
from urlparse import urljoin
class AutheticationFailed(Exception):
pass
class CommunicationError(Exception):
pass
def _do_post(url_base, username, password):
url = urljoin(url_base, 'sso/authenticate') + '/'
post_data = {
'username': username,
'password': p... | mit | Python |
fae5b9eef3d206fd835db0c73cea22a7ee275db7 | fix pypy isfile failure | titusz/onixcheck | src/onixcheck/utils.py | src/onixcheck/utils.py | # -*- coding: utf-8 -*-
"""Generic or common utility functions"""
from __future__ import print_function, unicode_literals
from os.path import splitext, join
has_scandir = True
try:
from scandir import scandir, walk
except ImportError:
from os import walk
from os import listdir as scandir
from os.path ... | # -*- coding: utf-8 -*-
"""Generic or common utility functions"""
from __future__ import print_function, unicode_literals
from os.path import splitext, join
has_scandir = True
try:
from scandir import scandir, walk
except ImportError:
from os import walk
from os import listdir as scandir
from os.path ... | bsd-2-clause | Python |
2d1f4eb712725715e0d3378473b5b2ff5df24a78 | Fix argument parsing | rbu/redumpster | redumpster/main.py | redumpster/main.py | #!/usr/bin/env python
# <BACKUP_NAME> [<restore_options>...]
"""
Import, export, backup and update data.
Usage:
redumpster [options] dump --config=<CONFIG> --to=<DUMP_DIR>
redumpster [options] restore --config=<CONFIG> --from=<DUMP_DIR>
redumpster -h | --help
Global Options:
--tagged=<TAG> Which... | #!/usr/bin/env python
# <BACKUP_NAME> [<restore_options>...]
"""
Import, export, backup and update data.
Usage:
redumpster [options] dump --config=<CONFIG> --to=<DUMP_DIR> --tagged=<TAG>
redumpster [options] restore --config=<CONFIG> --from=<DUMP_DIR> --tagged=<TAG>
redumpster -h | --help
Global Options:
... | bsd-2-clause | Python |
a5d79b3ef197b03607f385001ddb62d6c24ffb84 | Update search space definition and add mnist.npz as input file | jeffkinnison/shadho,jeffkinnison/shadho | examples/svm/driver.py | examples/svm/driver.py | """This example sets up a search over Support Vector Machine kernel
hyperparameters.
"""
from shadho import Shadho, spaces
if __name__ == '__main__':
# Domains can be stored as variables and used more than once in the event
# that the domain is used multilpe times.
C = spaces.log2_uniform(-5, 15)
g... | """This example sets up a search over Support Vector Machine kernel
hyperparameters.
"""
from shadho import Shadho, spaces
if __name__ == '__main__':
# Domains can be stored as variables and used more than once in the event
# that the domain is used multilpe times.
C = spaces.log2_uniform(-5, 15)
g... | mit | Python |
78e2af5c697f598b6be9b2e6c5e229133cbabb90 | Rename time descriptor | BBN-Q/QGL,BBN-Q/QGL | QGL/BasicSequences/helpers.py | QGL/BasicSequences/helpers.py | # coding=utf-8
from itertools import product
import operator
from ..PulsePrimitives import Id, X, MEAS
from ..ControlFlow import qwait
from functools import reduce
def create_cal_seqs(qubits, numRepeats, measChans=None, waitcmp=False, delay=None):
"""
Helper function to create a set of calibration sequences.
P... | # coding=utf-8
from itertools import product
import operator
from ..PulsePrimitives import Id, X, MEAS
from ..ControlFlow import qwait
from functools import reduce
def create_cal_seqs(qubits, numRepeats, measChans=None, waitcmp=False, delay=None):
"""
Helper function to create a set of calibration sequences.
P... | apache-2.0 | Python |
647700723a8f772d59956851a6a00dfc89497e2d | clone rubyspec into rubyspec folder directly | topazproject/topaz,topazproject/topaz,babelsberg/babelsberg-r,topazproject/topaz,babelsberg/babelsberg-r,babelsberg/babelsberg-r,babelsberg/babelsberg-r,babelsberg/babelsberg-r,topazproject/topaz | tasks/base.py | tasks/base.py | import os
from invoke import run
class BaseTest(object):
def download_mspec(self):
if not os.path.isdir("../mspec"):
run("cd .. && git clone --depth=100 --quiet https://github.com/ruby/mspec")
def download_rubyspec(self):
if not os.path.isdir("../rubyspec"):
run("cd .... | import os
from invoke import run
class BaseTest(object):
def download_mspec(self):
if not os.path.isdir("../mspec"):
run("cd .. && git clone --depth=100 --quiet https://github.com/ruby/mspec")
def download_rubyspec(self):
if not os.path.isdir("../rubyspec"):
run("cd .... | bsd-3-clause | Python |
600b5255f909be37c71da548d32d70fb7b2806f8 | fix #69 | statbio/Sargasso,statbio/Sargasso | sargasso/hits_info.py | sargasso/hits_info.py | import sys
from . import samutils
class HitsInfo:
def __init__(self, hits):
self.hits = hits
self.primary_hits = self._get_primary_hits()
self.total_length = samutils.get_total_length(self.primary_hits)
self.multimaps = samutils.get_multimaps(self.hits[0])
self.primary_mis... | import sys
from . import samutils
class HitsInfo:
def __init__(self, hits):
self.hits = hits
self.primary_hits = self._get_primary_hits()
self.total_length = samutils.get_total_length(self.primary_hits)
self.multimaps = samutils.get_multimaps(self.hits[0])
self.primary_mis... | mit | Python |
5dc65fe540f48986030b1ea40d86c214c364181a | fix rosbag_helper script executer | jinghaomiao/apollo,jinghaomiao/apollo,jinghaomiao/apollo,wanglei828/apollo,ycool/apollo,xiaoxq/apollo,ApolloAuto/apollo,ApolloAuto/apollo,wanglei828/apollo,wanglei828/apollo,xiaoxq/apollo,xiaoxq/apollo,wanglei828/apollo,xiaoxq/apollo,ApolloAuto/apollo,wanglei828/apollo,jinghaomiao/apollo,ycool/apollo,ApolloAuto/apollo,... | docs/demo_guide/rosbag_helper.py | docs/demo_guide/rosbag_helper.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 bash
###############################################################################
# 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 of... | apache-2.0 | Python |
b9f2a6048be8f448c7d6ba792c80786c712aa295 | fix test cases | gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext | erpnext/quality_management/doctype/quality_procedure/test_quality_procedure.py | erpnext/quality_management/doctype/quality_procedure/test_quality_procedure.py | # -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestQualityProcedure(unittest.TestCase):
def test_quality_procedure(self):
test_create_procedure = create_procedure()
test_create_nested_procedure = ... | # -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestQualityProcedure(unittest.TestCase):
def test_quality_procedure(self):
test_create_procedure = create_procedure()
test_create_nested_procedure = ... | agpl-3.0 | Python |
4c3922f2096ba07ac1c48884bf686543f73b5290 | Add missing import | fenhl/gitdir | gitdir/__init__.py | gitdir/__init__.py | import os
import pathlib
GITDIR = pathlib.Path(os.environ.get('GITDIR', '/opt/git')) #TODO check permissions
| import pathlib
GITDIR = pathlib.Path(os.environ.get('GITDIR', '/opt/git')) #TODO check permissions
| mit | Python |
b349994598896c8695f595e7c2d2e9165405a192 | add classdefs Grid and MVGrid | openego/eDisGo,openego/eDisGo | edisgo/grid/grids.py | edisgo/grid/grids.py |
class Grid:
"""Defines a basic grid in eDisGo
Attributes
----------
_network : Network #TODO: ADD CORRECT REF
Network which this scenario is associated with
_voltage_nom : int
Nominal voltage
_peak_load : :obj:`float`
Cumulative peak load of grid
_peak_generation : ... | agpl-3.0 | Python | |
624df072debcf6f641ebdd5808c4efaae432009f | add usage | reyoung/Paddle,PaddlePaddle/Paddle,chengduoZH/Paddle,PaddlePaddle/Paddle,chengduoZH/Paddle,luotao1/Paddle,PaddlePaddle/Paddle,baidu/Paddle,luotao1/Paddle,luotao1/Paddle,tensor-tang/Paddle,reyoung/Paddle,tensor-tang/Paddle,QiJune/Paddle,PaddlePaddle/Paddle,tensor-tang/Paddle,luotao1/Paddle,luotao1/Paddle,chengduoZH/Padd... | tools/check_ctest_hung.py | tools/check_ctest_hung.py | # Copyright (c) 2018 PaddlePaddle 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 appli... | # Copyright (c) 2018 PaddlePaddle 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 appli... | apache-2.0 | Python |
f2cda70ae51f1e3b5cbc3c9ca13e15ea1d1b7053 | Update gpm doc | galileo-project/Galileo-gpm | gpm/cli/default.py | gpm/cli/default.py | from gpm import __version__ as version
from gpm import __name__ as name
from gpm.utils.console import puts
from gpm.cli import CLI
from gpm.utils.operation import LocalOperation
class CLIDefault(CLI):
_OPTS = {"shortcut": "vh", "name": ["version", "help"], "action": ["_version", "_help"], "default": "_help"}
... | from gpm import __version__ as version
from gpm import __name__ as name
from gpm.utils.console import puts
from gpm.cli import CLI
from gpm.utils.operation import LocalOperation
class CLIDefault(CLI):
_OPTS = {"shortcut": "vh", "name": ["version", "help"], "action": ["_version", "_help"], "default": "_help"}
... | mit | Python |
24b948bda9ba443b317bb3614266adc5165a49b8 | fix more paths | mapycz/python-mapnik,mapnik/python-mapnik,mapnik/python-mapnik,tomhughes/python-mapnik,mapycz/python-mapnik,tomhughes/python-mapnik,mapnik/python-mapnik,tomhughes/python-mapnik | test/python_tests/markers_complex_rendering_test.py | test/python_tests/markers_complex_rendering_test.py | # coding=utf8
import os
from nose.tools import eq_
import mapnik
from .utilities import execution_path, run_all
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))
if 'csv' in mapnik.DatasourceCache.plugin_nam... | # coding=utf8
import os
from nose.tools import eq_
import mapnik
from .utilities import execution_path, run_all
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))
if 'csv' in mapnik.DatasourceCache.plugin_nam... | lgpl-2.1 | Python |
2aab93624cfe62110e2932750047b265e46261ea | Fix the waiting time in test_automatic_invalidation | cloudera/Impala,cloudera/Impala,cloudera/Impala,cloudera/Impala,cloudera/Impala,cloudera/Impala,cloudera/Impala | tests/custom_cluster/test_automatic_invalidation.py | tests/custom_cluster/test_automatic_invalidation.py | # 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
# "License"); you may not u... | # 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
# "License"); you may not u... | apache-2.0 | Python |
315b586a90d8b923e8850e212dca1f8bb6ced75b | add object identifier tests (see issues, missing vendor tests) | JoelBender/bacpypes,JoelBender/bacpypes | tests/test_primitive_data/test_object_identifier.py | tests/test_primitive_data/test_object_identifier.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test Primitive Data Object Identifier
-------------------------------------
"""
import unittest
from bacpypes.debugging import bacpypes_debugging, ModuleLogger, xtob
from bacpypes.primitivedata import ObjectIdentifier, Tag
# some debugging
_debug = 0
_log = ModuleLo... | mit | Python | |
1e6f3689a21e12104792236d88e7596cb8397ba5 | Fix post_syncdb signal for demo user to work with Django 1.1 | nikolas/mezzanine,AlexHill/mezzanine,webounty/mezzanine,douglaskastle/mezzanine,nikolas/mezzanine,christianwgd/mezzanine,jjz/mezzanine,guibernardino/mezzanine,stbarnabas/mezzanine,promil23/mezzanine,spookylukey/mezzanine,ryneeverett/mezzanine,gradel/mezzanine,jerivas/mezzanine,fusionbox/mezzanine,guibernardino/mezzanin... | mezzanine/core/management.py | mezzanine/core/management.py |
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth import models as auth_app
from django.db.models.signals import post_syncdb
def create_demo_user(app, created_models, verbosity, **kwargs):
if settings.DEBUG and User in created_models:
if verbosity >= 2:... |
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth import models as auth_app
from django.db.models.signals import post_syncdb
def create_demo_user(app, created_models, verbosity, db, **kwargs):
if settings.DEBUG and User in created_models:
if verbosity >... | bsd-2-clause | Python |
c1f7aab56413063b74e9a6ad366f622389e1b54c | Remove version-specific exception | jalanb/jab,jalanb/dotjab,jalanb/jab,jalanb/dotjab | src/python/pythonrc.py | src/python/pythonrc.py | """Dirty up the main namespace with some extra imports"""
from __future__ import print_function
try:
see
except (NameError):
def see(thing, regexp=None):
"""layout a dir listing filtered by the given regexp"""
if regexp:
import re
print('\n'.join(sorted([item
... | """Dirty up the main namespace with some extra imports"""
from __future__ import print_function
try:
see
except (NameError, ModuleNotFoundError):
def see(thing, regexp=None):
"""layout a dir listing filtered by the given regexp"""
if regexp:
import re
print('\n'.join(s... | mit | Python |
8ddab20fd41217fe4ea9b5e267443a4953d2d8f7 | Add email notification when new user has signed up | lucifurtun/myquotes,lucifurtun/myquotes,lucifurtun/myquotes,lucifurtun/myquotes | apps/authentication/forms.py | apps/authentication/forms.py | from django import forms
from django.core.mail import send_mail
class SignupForm(forms.Form):
def signup(self, request, user):
user.is_active = False
user.save()
send_mail(
'New user on MyQuotes',
'There is one new user asking for access. ID: {id}, Email: {email}'.... | from django import forms
class SignupForm(forms.Form):
def signup(self, request, user):
user.is_active = False
user.save()
| bsd-3-clause | Python |
a2fa8c8cf57d84c279b2df0be61d9d5add7cbde9 | fix the hacky distro check: people just call the right module straight up | ros/dynamic_reconfigure,ros/dynamic_reconfigure,ros/dynamic_reconfigure | src/dynamic_reconfigure/__init__.py | src/dynamic_reconfigure/__init__.py | # Software License Agreement (BSD License)
#
# Copyright (c) 2009, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above... | # Software License Agreement (BSD License)
#
# Copyright (c) 2009, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above... | bsd-3-clause | Python |
d817dff67fb2e9c44e2d919954283e3a8a43d59d | check for internet connection | brainbots/assistant | assisstant/nlp/backends/apiai.py | assisstant/nlp/backends/apiai.py | from nlp_backend import NlpBackend
import socket
class ApiaiBackend(NlpBackend):
def get_intent(self, query, session_id):
if not self._check_connection():
raise ConnectionError("No internet connection, please connect to the internet.")
def _check_connection(self,host="8.8.8.8", port=53, timeout=3):
# Try to ... | from nlp_backend import NlpBackend
class ApiaiBackend(NlpBackend):
def get_intent(self, query, session_id):
pass
| apache-2.0 | Python |
c50b31c6648bc0c20aa40ac0fd9c50d4f6b16e13 | Mark this as skipped for now. There is a race condition with SectionLoadList exposed by this test. Greg tried to chase it down & got pretty far but the isn't correct so we'll disable this test for now until I can figure that out. | apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb | packages/Python/lldbsuite/test/api/multiple-debuggers/TestMultipleDebuggers.py | packages/Python/lldbsuite/test/api/multiple-debuggers/TestMultipleDebuggers.py | """Test the lldb public C++ api when doing multiple debug sessions simultaneously."""
from __future__ import print_function
import os
import re
import subprocess
import sys
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestMulti... | """Test the lldb public C++ api when doing multiple debug sessions simultaneously."""
from __future__ import print_function
import os
import re
import subprocess
import sys
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestMulti... | apache-2.0 | Python |
35b23b65ca71848f4dfa1b77193a77a4bfda30d3 | Fix redirect for maps url | IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site,IQSS/gentb-site | apps/maps/urls.py | apps/maps/urls.py | #
# Copyright (C) 2017 Maha Farhat
#
# This program 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 of the License, or
# (at your option) any later version.
#
# This program is distribu... | #
# Copyright (C) 2017 Maha Farhat
#
# This program 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 of the License, or
# (at your option) any later version.
#
# This program is distribu... | agpl-3.0 | Python |
b7cb4bdfe41fb00d49234222b3d18c598c61af10 | Add pipeline component for spaCy v2.x | spacy-io/sense2vec,spacy-io/sense2vec,spacy-io/sense2vec | sense2vec/__init__.py | sense2vec/__init__.py | # coding: utf8
from __future__ import unicode_literals
from .vectors import VectorMap
from .about import __version__
def load(vectors_path):
vector_map = VectorMap(128)
vector_map.load(vectors_path)
return vector_map
class Sense2VecComponent(object):
"""
spaCy v2.0 pipeline component.
USAG... | # coding: utf8
from __future__ import unicode_literals
from .vectors import VectorMap
from .about import __version__
def load(vectors_path):
vector_map = VectorMap(128)
vector_map.load(vectors_path)
return vector_map
| mit | Python |
9d1cd3dce5188d635a300d8835298f4fdd049d7b | Test for Githook. | royburns/dsc-crawler | dsc-crawler/dsc-crawler_test.py | dsc-crawler/dsc-crawler_test.py | # -*- coding: utf-8 -*-
import ujson
import requests
# test for Githook
URL = 'https://dscapp.dscun.com'
HOST = 'dscapp.dscun.com'
token = "30d9ce9660dbe362b25f7bdabdb31e40"
def get_user_info(user_id):
print '111'
url_api = 'api/user'
headers = {
'Host': "dscapp.dscun.com",
'meet-token'... | # -*- coding: utf-8 -*-
import ujson
import requests
URL = 'https://dscapp.dscun.com'
HOST = 'dscapp.dscun.com'
token = "30d9ce9660dbe362b25f7bdabdb31e40"
def get_user_info(user_id):
print '111'
url_api = 'api/user'
headers = {
'Host': "dscapp.dscun.com",
'meet-token': '0ccbe9212e7640a9... | apache-2.0 | Python |
5d6c985573304d55de37b01a772dc509bd36dc38 | fix for repository naming scheme | fedora-conary/conary,fedora-conary/conary,fedora-conary/conary,fedora-conary/conary,fedora-conary/conary | server/apachehooks.py | server/apachehooks.py | from mod_python import apache
import base64
import os
import xmlrpclib
import netserver
BUFFER=1024 * 256
def xmlPost(repos, req):
if not req.headers_in.has_key('Authorization'):
user = None
pw = None
else:
info = req.headers_in['Authorization'].split()
if len(info) != 2 or info[0] != "Basic":
retur... | from mod_python import apache
import base64
import os
import xmlrpclib
import netserver
BUFFER=1024 * 256
def xmlPost(repos, req):
if not req.headers_in.has_key('Authorization'):
user = None
pw = None
else:
info = req.headers_in['Authorization'].split()
if len(info) != 2 or info[0] != "Basic":
retur... | apache-2.0 | Python |
01c6643a534d8d5168eb576c8dd8a4e889a77806 | fix grouping in reports query (RBL-2152) | sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint | mint/reports/active_users.py | mint/reports/active_users.py | #
# Copyright (c) 2005-2007 rPath, Inc.
# All Rights Reserved
#
import time
from mint.reports.mint_reports import MintReport
class ActiveUsersReport(MintReport):
title = 'Active users in the last 30 days'
headers = ('Username', 'Full Name', 'Email', 'Commits')
def getData(self, reportTime = time.time()):... | #
# Copyright (c) 2005-2007 rPath, Inc.
# All Rights Reserved
#
import time
from mint.reports.mint_reports import MintReport
class ActiveUsersReport(MintReport):
title = 'Active users in the last 30 days'
headers = ('Username', 'Full Name', 'Email', 'Commits')
def getData(self, reportTime = time.time()):... | apache-2.0 | Python |
77729f2aa22ce7555c86f10269fa7e75af7c396c | Remove a debugging print, fixes #10 | kaiyou/freeposte.io,kaiyou/freeposte.io,kaiyou/freeposte.io,kaiyou/freeposte.io | fetchmail/fetchmail.py | fetchmail/fetchmail.py | #!/usr/bin/env python
import sqlite3
import time
import os
import tempfile
RC_LINE = """
poll {host} proto {protocol} port {port}
user "{username}" password "{password}"
smtphost "smtp"
smtpname {user_email}
{options}
"""
def fetchmail(fetchmailrc):
with tempfile.NamedTemporaryFile() as handler... | #!/usr/bin/env python
import sqlite3
import time
import os
import tempfile
RC_LINE = """
poll {host} proto {protocol} port {port}
user "{username}" password "{password}"
smtphost "smtp"
smtpname {user_email}
{options}
"""
def fetchmail(fetchmailrc):
print(fetchmailrc)
with tempfile.NamedTem... | mit | Python |
d59f569059b88e5bb56cae0fefe93e45c6257bd9 | Remove a workaround | etalab/udata,opendatateam/udata,etalab/udata,opendatateam/udata,etalab/udata,opendatateam/udata | udata/tests/organization/test_organization_tasks.py | udata/tests/organization/test_organization_tasks.py | # -*- coding: utf-8 -*-
from .. import TestCase, SearchTestMixin
from udata.models import Dataset, Organization
from udata.core.dataset.factories import DatasetFactory, ResourceFactory
from udata.core.dataset.search import DatasetSearch
from udata.core.organization import tasks
from udata.search import es
class Org... | # -*- coding: utf-8 -*-
from .. import TestCase, SearchTestMixin
from udata.models import Dataset, Organization
from udata.core.dataset.factories import DatasetFactory, ResourceFactory
from udata.core.dataset.search import DatasetSearch
from udata.core.organization import tasks
from udata.search import es
class Org... | agpl-3.0 | Python |
0e2f99b04247c76c7605efb965bb4709a6aa17d0 | Fix source bug | kmorrison/my_fair_lady2,kmorrison/my_fair_lady2,kmorrison/my_fair_lady2 | my_fair_lady2/candidate_gatherer/models.py | my_fair_lady2/candidate_gatherer/models.py | from django.contrib import admin
from django.db import models
class SourceType(models.Model):
time_created = models.DateTimeField(auto_now_add=True)
name = models.CharField(max_length=200)
is_active = models.BooleanField(default=False)
def __unicode__(self):
return "%s%s" % (self.name, " (Is ... | from django.contrib import admin
from django.db import models
class SourceType(models.Model):
time_created = models.DateTimeField(auto_now_add=True)
name = models.CharField(max_length=200)
is_active = models.BooleanField(default=False)
def __unicode__(self):
return "%s%s" % (self.name, " (Is ... | mit | Python |
4cb3f89bb14ceb589ac117df3f02e574b5fe52fb | Patch for manual call of pbkdf2 | stamparm/maltrail,stamparm/maltrail,stamparm/maltrail,hxp2k6/https-github.com-stamparm-maltrail,hxp2k6/https-github.com-stamparm-maltrail,hxp2k6/https-github.com-stamparm-maltrail,stamparm/maltrail | core/pbkdf2.py | core/pbkdf2.py | #!/usr/bin/env python
"""
Copyright (c) 2014-2015 Miroslav Stampar (@stamparm)
See the file 'LICENSE' for copying permission
Derivative work from 'python-pbkdf2' by Armin Ronacher (@mitsuhiko)
"""
import hmac
import hashlib
import itertools
import operator
import os
import struct
DEFAULT_ITERATIONS = 10000
# Refer... | #!/usr/bin/env python
"""
Copyright (c) 2014-2015 Miroslav Stampar (@stamparm)
See the file 'LICENSE' for copying permission
Derivative work from 'python-pbkdf2' by Armin Ronacher (@mitsuhiko)
"""
# Reference:
import hmac
import hashlib
import itertools
import operator
import os
import struct
# Reference: https:/... | mit | Python |
7f16d7540826fef9a3590612ccf11fad55d6f9a0 | change domain to select the company | jobiols/odoomrp-wip,factorlibre/odoomrp-wip,sergiocorato/odoomrp-wip,esthermm/odoomrp-wip,odoomrp/odoomrp-wip,Eficent/odoomrp-wip,invitu/odoomrp-wip,oihane/odoomrp-wip,raycarnes/odoomrp-wip,odoomrp/odoomrp-wip,diagramsoftware/odoomrp-wip,odoocn/odoomrp-wip,alhashash/odoomrp-wip,oihane/odoomrp-wip,InakiZabala/odoomrp-wi... | stock_picking_wave_partner_carrier_filter/models/stock_picking_wave.py | stock_picking_wave_partner_carrier_filter/models/stock_picking_wave.py | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, fields, api
class StockPickin... | # -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, fields, api
class StockPickin... | agpl-3.0 | Python |
481a8370ac0915cc97267b2e6c64c6a98dbf622c | update unitest | pkuyym/Paddle,jacquesqiao/Paddle,QiJune/Paddle,pengli09/Paddle,pengli09/Paddle,putcn/Paddle,pkuyym/Paddle,chengduoZH/Paddle,hedaoyuan/Paddle,hedaoyuan/Paddle,PaddlePaddle/Paddle,jacquesqiao/Paddle,putcn/Paddle,pengli09/Paddle,QiJune/Paddle,pengli09/Paddle,hedaoyuan/Paddle,QiJune/Paddle,jacquesqiao/Paddle,pkuyym/Paddle,... | python/paddle/v2/framework/tests/test_pad_op.py | python/paddle/v2/framework/tests/test_pad_op.py | import unittest
import numpy as np
from op_test import OpTest
class TestPadOp(OpTest):
def setUp(self):
self.initTestCase()
self.op_type = "pad"
self.inputs = {'X': np.random.random(self.shape).astype("float32"), }
self.attrs = {}
self.attrs['paddings'] = np.array(self.padd... | import unittest
import numpy as np
from op_test import OpTest
class TestPadOp(OpTest):
def setUp(self):
self.initTestCase()
self.op_type = "pad"
self.inputs = {'X': np.random.random(self.shape).astype("float32"), }
self.attrs = {}
self.attrs['paddings'] = np.array(self.padd... | apache-2.0 | Python |
5261f7618147c3d2f28c1f2e108bcfa235c39326 | fix default default configuration | papousek/spiderpig | spiderpig/config.py | spiderpig/config.py | from .msg import Verbosity
import argparse
def get_argument_parser():
p = argparse.ArgumentParser()
p.add_argument(
'--cache-dir',
action='store',
dest='cache_dir',
default='.spiderpig'
)
p.add_argument(
'--override-cache',
action='store_true',
... | from .msg import Verbosity
import argparse
def get_argument_parser():
p = argparse.ArgumentParser()
p.add_argument(
'--cache-dir',
action='store',
dest='cache_dir',
default='.spiderpig'
)
p.add_argument(
'--override-cache',
action='store_true',
... | mit | Python |
24103624190a4cc26919559dd1a05827d5085600 | add docu to AbstractSellingPointInline | byteweaver/django-eca-catalogue | eca_catalogue/abstract_admin.py | eca_catalogue/abstract_admin.py | from django.contrib import admin
from django.db import models
from django.forms.widgets import TextInput
from treebeard.admin import TreeAdmin
from abstract_models import AbstractSellingPoint
class AbstractProductCategoryAdmin(admin.ModelAdmin):
prepopulated_fields = {"slug": ("name",)}
class AbstractNestedPro... | from django.contrib import admin
from django.db import models
from django.forms.widgets import TextInput
from treebeard.admin import TreeAdmin
from abstract_models import AbstractSellingPoint
class AbstractProductCategoryAdmin(admin.ModelAdmin):
prepopulated_fields = {"slug": ("name",)}
class AbstractNestedPro... | bsd-3-clause | Python |
27a72cf7fe55f13c05e3365799d9f83029541551 | fix install (#11093) | iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack | var/spack/repos/builtin/packages/branson/package.py | var/spack/repos/builtin/packages/branson/package.py | # Copyright 2013-2019 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 Branson(CMakePackage):
"""Branson's purpose is to study different algorithms for parallel ... | # Copyright 2013-2019 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 Branson(CMakePackage):
"""Branson's purpose is to study different algorithms for parallel ... | lgpl-2.1 | Python |
1ddb48a0c18ddd33dad7f914102eb5117896d2c4 | add some necessary imports for fcgi_frontend that were indirectly imported through cgi_frontend that were removed in [2079] | jun66j5/trac-ja,netjunki/trac-Pygit2,walty8/trac,jun66j5/trac-ja,netjunki/trac-Pygit2,jun66j5/trac-ja,walty8/trac,walty8/trac,jun66j5/trac-ja,netjunki/trac-Pygit2,walty8/trac | trac/web/fcgi_frontend.py | trac/web/fcgi_frontend.py | # -*- coding: iso8859-1 -*-
#
# Copyright (C) 2005 Edgewall Software
# Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de>
# Copyright (C) 2005 Matthew Good <trac@matt-good.net>
#
# Trac is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the ... | # -*- coding: iso8859-1 -*-
#
# Copyright (C) 2005 Edgewall Software
# Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de>
# Copyright (C) 2005 Matthew Good <trac@matt-good.net>
#
# Trac is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the ... | bsd-3-clause | Python |
d6735aa5cd6e3de5768f7d2885c274ea72c79f76 | Add latest version of py-tqdm (#13446) | iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/py-tqdm/package.py | var/spack/repos/builtin/packages/py-tqdm/package.py | # Copyright 2013-2019 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 PyTqdm(PythonPackage):
"""A Fast, Extensible Progress Meter"""
homepage = "https://gi... | # Copyright 2013-2019 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 PyTqdm(PythonPackage):
"""A Fast, Extensible Progress Meter"""
homepage = "https://gi... | lgpl-2.1 | Python |
c67e9dea185149f05f3aebea8ba4c31f6bc1a0f2 | enhance hosts method to use a set comprehension | globocom/dbaas-zabbix,globocom/dbaas-zabbix | dbaas_zabbix/dbaas_api.py | dbaas_zabbix/dbaas_api.py | # -*- coding: utf-8 -*-
class DatabaseAsAServiceApi(object):
def __init__(self, databaseinfra, credentials):
self.databaseinfra = databaseinfra
self.credentials = credentials
@property
def user(self):
return self.credentials.user
@property
def password(self):
retu... | # -*- coding: utf-8 -*-
class DatabaseAsAServiceApi(object):
def __init__(self, databaseinfra, credentials):
self.databaseinfra = databaseinfra
self.credentials = credentials
@property
def user(self):
return self.credentials.user
@property
def password(self):
retu... | bsd-3-clause | Python |
94a6e09a8f18c3c7bbce596ff5ea81d1553e5e47 | Integrate replace_keys | flyinactor91/AVWX-API,flyinactor91/AVWX-API,flyinactor91/AVWX-API | avwx_api/cache.py | avwx_api/cache.py | """
Michael duPont - michael@mdupont.com
avwx_api.cache - Class for communicating with the report cache
"""
# stdlib
from datetime import datetime, timedelta
from os import environ
# library
import pymongo
MONGO_URI = environ.get('MONGO_URI', None)
def replace_keys(data: dict, key: str, by_key: str) -> dict:
"""... | """
Michael duPont - michael@mdupont.com
avwx_api.cache - Class for communicating with the report cache
"""
# stdlib
from datetime import datetime, timedelta
from os import environ
# library
import pymongo
MONGO_URI = environ.get('MONGO_URI', None)
class Cache(object):
"""Controls connections with the MongoDB-co... | mit | Python |
ccb558526cd738c5312556a2a6f34471a3202091 | Add `polymorphic` to `INSTALLED_APPS`, and also `MessageMiddlware` (because Django wants it). | ixc/django-polymorphic-auth | polymorphic_auth/tests/settings.py | polymorphic_auth/tests/settings.py | """
Test settings for ``polymorphic_auth`` app.
"""
AUTH_USER_MODEL = 'polymorphic_auth.User'
POLYMORPHIC_AUTH = {
'DEFAULT_CHILD_MODEL': 'polymorphic_auth_email.EmailUser',
}
DATABASES = {
'default': {
'ATOMIC_REQUESTS': True,
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME'... | """
Test settings for ``polymorphic_auth`` app.
"""
AUTH_USER_MODEL = 'polymorphic_auth.User'
POLYMORPHIC_AUTH = {
'DEFAULT_CHILD_MODEL': 'polymorphic_auth_email.EmailUser',
}
DATABASES = {
'default': {
'ATOMIC_REQUESTS': True,
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME'... | mit | Python |
e19d03df21be34571d0f771920170358d90fb36e | Sort main URLs file | kdeloach/nyc-trees,maurizi/nyc-trees,maurizi/nyc-trees,azavea/nyc-trees,kdeloach/nyc-trees,maurizi/nyc-trees,RickMohr/nyc-trees,kdeloach/nyc-trees,RickMohr/nyc-trees,maurizi/nyc-trees,RickMohr/nyc-trees,azavea/nyc-trees,kdeloach/nyc-trees,azavea/nyc-trees,azavea/nyc-trees,kdeloach/nyc-trees,RickMohr/nyc-trees,azavea/ny... | src/nyc_trees/nyc_trees/urls.py | src/nyc_trees/nyc_trees/urls.py | # -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
... | # -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
... | agpl-3.0 | Python |
cafc610a7a7083da711aadfa457d4bf6caf6217d | Remove blank line | mishbahr/django-responsive2,mishbahr/django-responsive2 | responsive/conf.py | responsive/conf.py | from django.conf import settings # noqa
from django.utils.translation import ugettext_lazy as _
from appconf import AppConf
class ResponsiveAppConf(AppConf):
"""
While there are several different items we can query on,
the ones used for django-responsive2 are min-width, max-width, min-height and max-hei... | from django.conf import settings # noqa
from django.utils.translation import ugettext_lazy as _
from appconf import AppConf
class ResponsiveAppConf(AppConf):
"""
While there are several different items we can query on,
the ones used for django-responsive2 are min-width, max-width, min-height and max-hei... | bsd-3-clause | Python |
aedd224b19847dbbcfb4c16b2cc59181f0f63e00 | use read instead of browse | akretion/openerp-server,akretion/openerp-server,akretion/openerp-server | bin/addons/base/ir/ir_default.py | bin/addons/base/ir/ir_default.py | ##############################################################################
#
# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
# Fabien Pinckaers <fp@tiny.Be>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsabili... | ##############################################################################
#
# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
# Fabien Pinckaers <fp@tiny.Be>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsabili... | agpl-3.0 | Python |
7cab0cc318ef0704017ce0a6d8c21e6b5fc5a00f | add \n | openSUSE/sat-solver-bindings,openSUSE/sat-solver-bindings,openSUSE/sat-solver-bindings,openSUSE/sat-solver-bindings,openSUSE/sat-solver-bindings,openSUSE/sat-solver-bindings | bindings/python/tests/loading.py | bindings/python/tests/loading.py | import sys
sys.path.append('../../../build/bindings/python')
import satsolverx
| import sys
sys.path.append('../../../build/bindings/python')
import satsolverx | bsd-3-clause | Python |
bad9a7d9a3c6c9ffedc26618e01fed56a9a166fb | check success of run in juju hooklib module | Ubuntu-Solutions-Engineering/conjure,battlemidget/conjure-up,Ubuntu-Solutions-Engineering/conjure,conjure-up/conjure-up,battlemidget/conjure-up,ubuntu/conjure-up,ubuntu/conjure-up,conjure-up/conjure-up | share/hooklib/juju.py | share/hooklib/juju.py | from subprocess import run, PIPE, CalledProcessError
import yaml
def status():
""" Get juju status
"""
try:
sh = run('juju status --format yaml', shell=True, check=True,
stdout=PIPE)
except CalledProcessError:
return None
return yaml.load(sh.stdout.decode())
def ... | from subprocess import run, PIPE
import yaml
def status():
""" Get juju status
"""
sh = run('juju status --format yaml', shell=True, stdout=PIPE)
return yaml.load(sh.stdout.decode())
def leader(application):
""" Grabs the leader of a set of application units
Arguments:
application: name... | mit | Python |
aeb3155be860170c416cb21e4b7c94d2882172ba | change name of expire field to exp | KujiraProject/Flask-PAM,kolodziej/Flask-PAM,kolodziej/Flask-PAM,KujiraProject/Flask-PAM | flask_pam/token/jwt.py | flask_pam/token/jwt.py | # -*- coding: utf-8 -*-
from token import Token
from jose import jwt
from os import urandom
class JWT(Token):
"""JSON Web Token"""
def __init__(self, *args, **kwargs):
super(JWT, self).__init__(*args, **kwargs)
self.algorithm = 'HS256'
def generate(self):
data = self.context.cop... | # -*- coding: utf-8 -*-
from token import Token
from jose import jwt
from os import urandom
class JWT(Token):
"""JSON Web Token"""
def __init__(self, *args, **kwargs):
super(JWT, self).__init__(*args, **kwargs)
self.algorithm = 'HS256'
def generate(self):
data = self.context.cop... | mit | Python |
a26b2a2152ff507483675db795204c69c242c70c | fix unbundle setting. | abadger/Bento,abadger/Bento,abadger/Bento,abadger/Bento,cournape/Bento,cournape/Bento,cournape/Bento,cournape/Bento | bento/__init__.py | bento/__init__.py | """
Bento, a pythonic packaging solution for python software.
Bento is a packaging solution which aims at being simple and extensible, using
as little magic as possible. Packages are described in a bento.info file which
has a straightforward syntax, and the packaging is driven through bentomaker,
the command line inte... | """
Bento, a pythonic packaging solution for python software.
Bento is a packaging solution which aims at being simple and extensible, using
as little magic as possible. Packages are described in a bento.info file which
has a straightforward syntax, and the packaging is driven through bentomaker,
the command line inte... | bsd-3-clause | Python |
9d2d8c743499408a62d15ea2b30b836e7f7efd87 | print env vars on test_package | igagis/utki,igagis/utki,igagis/utki | conan/test_package/conanfile.py | conan/test_package/conanfile.py | import os
from conans import ConanFile, CMake, tools, RunEnvironment
class UtkiTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
def build(self):
cmake = CMake(self)
# Current dir is "test_package/build/<build_id>" and CMakeLists.txt is
# in "test_package"
cmake... | import os
from conans import ConanFile, CMake, tools, RunEnvironment
class UtkiTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
def build(self):
cmake = CMake(self)
# Current dir is "test_package/build/<build_id>" and CMakeLists.txt is
# in "test_package"
cmake... | mit | Python |
607ea21711847b5ea4d09ce23351935290132f99 | add test | philippjfr/bokeh,philippjfr/bokeh,ptitjano/bokeh,dennisobrien/bokeh,aiguofer/bokeh,Karel-van-de-Plassche/bokeh,ptitjano/bokeh,clairetang6/bokeh,schoolie/bokeh,mindriot101/bokeh,msarahan/bokeh,DuCorey/bokeh,quasiben/bokeh,timsnyder/bokeh,ericmjl/bokeh,draperjames/bokeh,DuCorey/bokeh,KasperPRasmussen/bokeh,schoolie/bokeh... | bokeh/charts/tests/test_stats.py | bokeh/charts/tests/test_stats.py | import pytest
from bokeh.charts.stats import Bins
from bokeh.models import ColumnDataSource
import pandas as pd
@pytest.fixture
def ds(test_data):
return ColumnDataSource(test_data.auto_data)
def test_explicit_bin_count(ds):
b = Bins(source=ds, column='mpg', bin_count=2)
assert len(b.bins) == 2
def ... | import pytest
from bokeh.charts.stats import Bins
from bokeh.models import ColumnDataSource
import pandas as pd
@pytest.fixture
def ds(test_data):
return ColumnDataSource(test_data.auto_data)
def test_explicit_bin_count(ds):
b = Bins(source=ds, column='mpg', bin_count=2)
assert len(b.bins) == 2
def ... | bsd-3-clause | Python |
d34b08c737cd5f8b38cae782d13844dba0923dee | Modify the base error class | thombashi/SimpleSQLite,thombashi/SimpleSQLite | simplesqlite/error.py | simplesqlite/error.py | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
import sqlite3
from tabledata import NameValidationError # noqa: W0611
class DatabaseError(sqlite3.DatabaseError):
"""
Exception raised for errors that are related to the database.
.. seealso::
- `sqlite... | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
import sqlite3
from tabledata import NameValidationError # noqa: W0611
class DatabaseError(sqlite3.DatabaseError):
"""
Exception raised for errors that are related to the database.
.. seealso::
- `sqlite... | mit | Python |
3ff5ae10396da6571c54d1aebf7b604c2946bbe4 | Add tests for year and month archives | alexwlchan/alexwlchan.net,alexwlchan/alexwlchan.net,alexwlchan/alexwlchan.net,alexwlchan/alexwlchan.net,alexwlchan/alexwlchan.net | _tests/run_tests.py | _tests/run_tests.py | #!/usr/bin/env python
# -*- encoding: utf-8
import pytest
import requests
@pytest.mark.parametrize('path', [
# Check pagination is working correctly
'/page/2/', '/page/3/',
])
def test_pages_appear_correctly(path):
resp = requests.get(f'http://localhost:5757/{path}')
assert resp.status_code == 200
... | #!/usr/bin/env python
# -*- encoding: utf-8
import pytest
import requests
@pytest.mark.parametrize('path', [
# Check pagination is working correctly
'/page/2/', '/page/3/',
])
def test_pages_appear_correctly(path):
resp = requests.get(f'http://localhost:5757/{path}')
assert resp.status_code == 200
| mit | Python |
bd665cecf5184cfa3e72370611071eab2dc6d9c5 | Bump version | sergey-dryabzhinsky/denyhosts_sync,sergey-dryabzhinsky/denyhosts_sync,sergey-dryabzhinsky/denyhosts_sync,janpascal/denyhosts_sync,janpascal/denyhosts_sync,janpascal/denyhosts_sync | dh_syncserver/__init__.py | dh_syncserver/__init__.py | """
denyhosts_sync_server is an open source implementation of the U{DenyHosts}
synchronisation server. It is based on the
U{Twisted <http://twistedmatrix.com/trac/>} framework and uses
U{Twistar <http://findingscience.com/twistar>} as an ORM layer.
@author: Jan-Pascal van Best U{janpascal@vanbest.org}
"""
version_in... | """
denyhosts_sync_server is an open source implementation of the U{DenyHosts}
synchronisation server. It is based on the
U{Twisted <http://twistedmatrix.com/trac/>} framework and uses
U{Twistar <http://findingscience.com/twistar>} as an ORM layer.
@author: Jan-Pascal van Best U{janpascal@vanbest.org}
"""
version_in... | agpl-3.0 | Python |
e411d0727c1a2688e1d276c414e6c7ce9e1e785c | fix flake8 issues for conf/example_apps/eventCache.py | acockburn/appdaemon,acockburn/appdaemon | conf/example_apps/eventCache.py | conf/example_apps/eventCache.py | import hassapi as hass
import os
import json
"""
Enable caching of appdaemon events.
You would probably NOT want to use this for HomeAssistant events.
The reason you would use this is probably because you're using custom events in
some other appdaemon app, and want this event to be available (typically for
hadashbo... | import hassapi as hass
import os
import json
"""
Enable caching of appdaemon events.
You would probably NOT want to use this for HomeAssistant events.
The reason you would use this is probably because you're using custom events in
some other appdaemon app, and want this event to be available (typically for
hadashbo... | mit | Python |
49c36018cb2da52950f17b90d653fe355fc66a22 | Bump to 0.8.0 | paultag/aiodocker,barrachri/aiodocker,barrachri/aiodocker,gaopeiliang/aiodocker,barrachri/aiodocker,gaopeiliang/aiodocker,gaopeiliang/aiodocker | aiodocker/__init__.py | aiodocker/__init__.py | from .docker import Docker
__version__ = '0.8.0'
__all__ = ("Docker", )
| from .docker import Docker
__version__ = '0.8.0a0'
__all__ = ("Docker", )
| mit | Python |
d7251cbf1e5615b8b0edfc5594360708a6c61b9b | Bump version to 0.6.1. | oddbird/gurtel,oddbird/gurtel | gurtel/__init__.py | gurtel/__init__.py | __version__ = '0.6.1'
| __version__ = '0.6'
| bsd-3-clause | Python |
a0f0da456ad2142a179c789f63b3dd234979c68c | Update relative imports in the Python library to support Python3 | SpectoLabs/myna,SpectoLabs/myna | contrib/python-myna/myna/__init__.py | contrib/python-myna/myna/__init__.py | from . import shim
tmpdir = None
def setUp():
global tmpdir
tmpdir = shim.setup_shim_for('kubectl')
def tearDown():
global tmpdir
shim.teardown_shim_dir(tmpdir)
| import shim
tmpdir = None
def setUp():
global tmpdir
tmpdir = shim.setup_shim_for('kubectl')
def tearDown():
global tmpdir
shim.teardown_shim_dir(tmpdir)
| apache-2.0 | Python |
487541e1778dd6c57f6fcb0a482a02e1bcd5f25d | make clean response work with tornado client | browniebroke/deezer-python,browniebroke/deezer-python,browniebroke/deezer-python | conftest.py | conftest.py | import pytest
from environs import Env
import deezer
env = Env()
env.read_env()
@pytest.fixture()
def client():
return deezer.Client( # nosec
app_id="foo",
app_secret="bar",
# This is to get human readable response output in VCR cassettes
headers={"Accept-Encoding": "identity"},... | import pytest
from environs import Env
import deezer
env = Env()
env.read_env()
@pytest.fixture()
def client():
return deezer.Client( # nosec
app_id="foo",
app_secret="bar",
# This is to get human readable response output in VCR cassettes
headers={"Accept-Encoding": "identity"},... | mit | Python |
969344a4ed822eafcfbf7bd9d666ca45bf38168f | Add sudo() to prevent user without mailing access try to merge contacts | OCA/social,OCA/social,OCA/social | mass_mailing_partner/wizard/partner_merge.py | mass_mailing_partner/wizard/partner_merge.py | # Copyright 2020 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models
class BasePartnerMergeAutomaticWizard(models.TransientModel):
_inherit = "base.partner.merge.automatic.wizard"
def _merge(self, partner_ids, dst_partner=None, extra_check... | # Copyright 2020 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models
class BasePartnerMergeAutomaticWizard(models.TransientModel):
_inherit = "base.partner.merge.automatic.wizard"
def _merge(self, partner_ids, dst_partner=None, extra_check... | agpl-3.0 | Python |
7a50f9e69e8b9c57b87eb113e8b6736a94d43866 | Change the is_producttype template tag to return a boolean rather than a string. | grengojbo/satchmo,grengojbo/satchmo | satchmo/product/templatetags/satchmo_product.py | satchmo/product/templatetags/satchmo_product.py | from django import template
from django.conf import settings
from django.core import urlresolvers
from django.template import Context, Template
from django.utils.translation import get_language, ugettext_lazy as _
from satchmo.configuration import config_value
from satchmo.product.models import Category
from satchmo.sh... | from django import template
from django.conf import settings
from django.core import urlresolvers
from django.template import Context, Template
from django.utils.translation import get_language, ugettext_lazy as _
from satchmo.configuration import config_value
from satchmo.product.models import Category
from satchmo.sh... | bsd-3-clause | Python |
9318fc97c3b59ab4b4155a3ad4bc9cb9ddb3c0af | Return error page with correct parameters. | incuna/authentic,adieu/authentic2,BryceLohr/authentic,incuna/authentic,BryceLohr/authentic,incuna/authentic,pu239ppy/authentic2,incuna/authentic,pu239ppy/authentic2,incuna/authentic,adieu/authentic2,adieu/authentic2,pu239ppy/authentic2,pu239ppy/authentic2,adieu/authentic2,BryceLohr/authentic,BryceLohr/authentic | authentic2/sslauth/login_ssl.py | authentic2/sslauth/login_ssl.py | from django.http import HttpResponseRedirect
from django.contrib.auth import authenticate, login, logout, get_user
from django.contrib.auth.models import AnonymousUser
from django.utils.translation import ugettext as _
from authentic2.saml.common import error_page
# Use of existing application sslauth
from util impor... | from django.http import HttpResponseRedirect
from django.contrib.auth import authenticate, login, logout, get_user
from django.contrib.auth.models import AnonymousUser
from authentic2.saml.common import error_page
# Use of existing application sslauth
from util import SSLInfo, settings_get
def process_request(reques... | agpl-3.0 | Python |
7c85e2b278667e7340c7c6bf57c3c0c91210c471 | Add some more importing shortcuts | GaretJax/coolfig | coolfig/__init__.py | coolfig/__init__.py | """
Support for working with different sources of configuration values.
class DefaultSettings(schema.Settings):
SECRET_KEY = schema.Value(str)
DEBUG = schema.Value(types.boolean, default=False)
DB_URL = schema.Value(types.sqlalchemy_url)
LOCALES = schema.Value(types.list(str))
... | """
Support for working with different sources of configuration values.
class DefaultSettings(schema.Settings):
SECRET_KEY = schema.Value(str)
DEBUG = schema.Value(types.boolean, default=False)
DB_URL = schema.Value(types.sqlalchemy_url)
LOCALES = schema.Value(types.list(str))
... | mit | Python |
5fb2949598ba1566e54056e1d5052fd2fefcaf11 | Switch from deprecated django.conf.urls.url to django.urls.path | python-social-auth/social-app-django,python-social-auth/social-app-django,python-social-auth/social-app-django | social_django/urls.py | social_django/urls.py | """URLs module"""
from django.conf import settings
from django.urls import path
from social_core.utils import setting_name
from . import views
extra = getattr(settings, setting_name('TRAILING_SLASH'), True) and '/' or ''
app_name = 'social'
urlpatterns = [
# authentication / association
path('login/<str:ba... | """URLs module"""
from django.conf import settings
from django.conf.urls import url
from social_core.utils import setting_name
from . import views
extra = getattr(settings, setting_name('TRAILING_SLASH'), True) and '/' or ''
app_name = 'social'
urlpatterns = [
# authentication / association
url(r'^login/(?... | bsd-3-clause | Python |
d5f57f7a9be9cdb98a55abf70a42a6d92b4c2761 | bump version | TheTrain2000/async2rewrite | async2rewrite/__init__.py | async2rewrite/__init__.py | """
Convert discord.py code using abstract syntax trees.
"""
__title__ = 'async2rewrite'
__author__ = 'Tyler Gibbs'
__version__ = '0.1.2'
__copyright__ = 'Copyright 2017 TheTrain2000'
__license__ = 'MIT'
from .main import *
| """
Convert discord.py code using abstract syntax trees.
"""
__title__ = 'async2rewrite'
__author__ = 'Tyler Gibbs'
__version__ = '0.1.1'
__copyright__ = 'Copyright 2017 TheTrain2000'
__license__ = 'MIT'
from .main import *
| mit | Python |
726662d102453f7c7be5fb31499a8c4d5ab34444 | Revert "Updated fields for Project model." | denverfoundation/storybase,denverfoundation/storybase,denverfoundation/storybase,denverfoundation/storybase | apps/storybase_user/models.py | apps/storybase_user/models.py | from django.contrib.auth.models import User
from django.db import models
from uuidfield.fields import UUIDField
from storybase.fields import ShortTextField
class Organization(models.Model):
""" An organization or a community group that users and stories can be associated with. """
organization_id = UUIDField(a... | from django.contrib.auth.models import User
from django.db import models
from uuidfield.fields import UUIDField
from storybase.fields import ShortTextField
class Organization(models.Model):
""" An organization or a community group that users and stories can be associated with. """
organization_id = UUIDField(a... | mit | Python |
deb4f6e1feaff03916ad3a9b0d7da724bd4608f8 | Simplify REQUIREMENTS | ankit01ojha/coala-bears,ankit01ojha/coala-bears,ankit01ojha/coala-bears,shreyans800755/coala-bears,refeed/coala-bears,Shade5/coala-bears,meetmangukiya/coala-bears,srisankethu/coala-bears,madhukar01/coala-bears,damngamerz/coala-bears,coala/coala-bears,srisankethu/coala-bears,shreyans800755/coala-bears,coala-analyzer/coa... | bears/perl/PerlCriticBear.py | bears/perl/PerlCriticBear.py | import platform
from coalib.bearlib.abstractions.Linter import linter
from dependency_management.requirements.DistributionRequirement import (
DistributionRequirement)
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
@linter(executable='perlcritic',
output_format='regex',
output_regex=r... | import platform
from coalib.bearlib.abstractions.Linter import linter
from dependency_management.requirements.DistributionRequirement import (
DistributionRequirement)
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
@linter(executable='perlcritic',
output_format='regex',
output_regex=r... | agpl-3.0 | Python |
62fbe36217c13636da39fe016f3da37bfe91ea87 | add precision to log path | undertherain/benchmarker,undertherain/benchmarker,undertherain/benchmarker,undertherain/benchmarker | benchmarker/modules/do_numpy.py | benchmarker/modules/do_numpy.py | # -*- coding: utf-8 -*-
"""NumPy support.
"""
import argparse
from timeit import default_timer as timer
import numpy as np
import os
class Benchmark():
def __init__(self, params, remaining_args=None):
self.params = params
parser = argparse.ArgumentParser(description='Benchmark GEMM operations')
... | # -*- coding: utf-8 -*-
"""NumPy support.
"""
import argparse
from timeit import default_timer as timer
import numpy as np
class Benchmark():
def __init__(self, params, remaining_args=None):
self.params = params
parser = argparse.ArgumentParser(description='Benchmark GEMM operations')
#pa... | mpl-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.