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 |
|---|---|---|---|---|---|---|---|---|
65b03a9f03169997042b98670cb44386da43b250 | add v4.09.1 and other updates (#22782) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/trf/package.py | var/spack/repos/builtin/packages/trf/package.py | # Copyright 2013-2021 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 *
import os
class Trf(AutotoolsPackage):
"""Tandem Repeats Finder is a program to locate and displ... | # Copyright 2013-2021 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 *
import os
class Trf(Package):
"""Tandem Repeats Finder is a program to locate and display tandem... | lgpl-2.1 | Python |
585e8163bc988e5e445a6d5e574cb68243dfdf95 | Fix __author__ to be the team! | 2b-or-not-2b/hackathon-app,2b-or-not-2b/hackathon-app,2b-or-not-2b/hackathon-app | back/util/__init__.py | back/util/__init__.py | __author__ = '2b||!2b'
| __author__ = 'neil@everymundo.com'
| mit | Python |
0c5029b6fbd2ae13e91019eb4c03d1e934162407 | fix missing import | sirech/deliver,sirech/deliver | deliver/db/mysql.py | deliver/db/mysql.py | import sqlalchemy
from base import BaseDBWrapper
class DBWrapper(BaseDBWrapper):
'''
Allows communication with an MySQL DB.
'''
def __init__(self, **kws):
super(DBWrapper,self).__init__()
self.engine = sqlalchemy.create_engine('mysql+mysqldb://%s:%s@%s/%s?charset=utf8' %
... | from base import BaseDBWrapper
class DBWrapper(BaseDBWrapper):
'''
Allows communication with an MySQL DB.
'''
def __init__(self, **kws):
super(DBWrapper,self).__init__()
self.engine = sqlalchemy.create_engine('mysql+mysqldb://%s:%s@%s/%s?charset=utf8' %
... | mit | Python |
b89ff5784b19f65ac3eaee8789e9e0f6d60eb815 | Fix multitaskmean bug | jrg365/gpytorch,jrg365/gpytorch,jrg365/gpytorch | gpytorch/means/multitask_mean.py | gpytorch/means/multitask_mean.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import torch
from torch.nn import ModuleList
from copy import deepcopy
from gpytorch.means import Mean
class MultitaskMean(Mean):
"""
Convenience :class:`gpytor... | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import torch
from torch.nn import ModuleList
from copy import deepcopy
from gpytorch.means import Mean
class MultitaskMean(Mean):
"""
Convenience :class:`gpytor... | mit | Python |
7c8af793391fca8b9eaafd45f78438064c7a94ac | Improve the indentantion in method product_id_change | diagramsoftware/sale-workflow,factorlibre/sale-workflow,BT-jmichaud/sale-workflow,adhoc-dev/sale-workflow,open-synergy/sale-workflow,richard-willowit/sale-workflow,thomaspaulb/sale-workflow,alexsandrohaag/sale-workflow,kittiu/sale-workflow,Rona111/sale-workflow,brain-tec/sale-workflow,clubit/sale-workflow,fevxie/sale-w... | sale_order_line_description/models/sale.py | sale_order_line_description/models/sale.py | # -*- coding: utf-8 -*-
#
#
# Copyright (C) 2013-15 Agile Business Group sagl
# (<http://www.agilebg.com>)
#
# 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 ... | # -*- coding: utf-8 -*-
#
#
# Copyright (C) 2013-15 Agile Business Group sagl
# (<http://www.agilebg.com>)
#
# 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 ... | agpl-3.0 | Python |
88b198ff1de67d675b81c736eceeb7a2308851db | Replace commas in names of cities with spaces | aysent/yelp-photo-explorer | json2csv_business.py | json2csv_business.py | import json
def main():
# print the header of output csv file
print 'business_id,city,latitude,longitude'
# for each entry in input json file print one csv row
for line in open("data/yelp_academic_dataset_business.json"):
input_json = json.loads(line)
business_id = input_json['busines... | import json
def main():
# print the header of output csv file
print 'business_id,city,latitude,longitude'
# for each entry in input json file print one csv row
for line in open("data/yelp_academic_dataset_business.json"):
input_json = json.loads(line)
business_id = input_json['busines... | mit | Python |
9aaaf4fe8af3e557c6831bdbe69a5ca5e2f6f5d0 | add import recipient and bank account in this file | pagarme/pagarme-python | pagarme/resources/pagarme.py | pagarme/resources/pagarme.py | from pagarme.resources.handler_request import authentication_key
from pagarme import bank_account
from pagarme import recipient
from pagarme import transaction
| from pagarme.resources.handler_request import authentication_key
from pagarme import transaction
| mit | Python |
3906ee0e659a9aa6f5e2d506ebae81f89a06765e | Bump version. | python-jsonschema/jsonschema,sightmachine/jsonschema,eodolphi/jsonschema,jamesmarva/jsonschema,eodolphi/jsonschema,dnephin/jsonschema,varunarya10/jsonschema,Julian/jsonschema,Julian/jsonschema,mathewmarcus/jsonschema | jsonschema/__init__.py | jsonschema/__init__.py | """
An implementation of JSON Schema for Python
The main functionality is provided by the validator classes for each of the
supported JSON Schema versions.
Most commonly, :func:`validate` is the quickest way to simply validate a given
instance under a schema, and will create a validator for you.
"""
from jsonschema... | """
An implementation of JSON Schema for Python
The main functionality is provided by the validator classes for each of the
supported JSON Schema versions.
Most commonly, :func:`validate` is the quickest way to simply validate a given
instance under a schema, and will create a validator for you.
"""
from jsonschema... | mit | Python |
853490b9d89b6e72d3b3f0e83fa2edb17d684547 | Fix jupyterlab import error message | jupyter/jupyterlab,charnpreetsingh185/jupyterlab,eskirk/jupyterlab,charnpreetsingh185/jupyterlab,jupyter/jupyterlab,eskirk/jupyterlab,eskirk/jupyterlab,jupyter/jupyterlab,charnpreetsingh185/jupyterlab,jupyter/jupyterlab,jupyter/jupyterlab,eskirk/jupyterlab,charnpreetsingh185/jupyterlab,charnpreetsingh185/jupyterlab,esk... | jupyterlab/__init__.py | jupyterlab/__init__.py | """Server extension for JupyterLab."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
try:
from ._version import __version__
except ImportError as e:
# when we are python 3 only, add 'from e' at the end to chain the exception.
raise ImportError("No mod... | """Server extension for JupyterLab."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
try:
from ._version import __version__
except ImportError as e:
# when we are python 3 only, add 'from e' at the end to chain the exception.
raise ImportError("No mod... | bsd-3-clause | Python |
a51c5941ea775f45334256c5c60d3830b5d7ed73 | Remove unnecessary 'index_together' | guswnsxodlf/k-board,hyesun03/k-board,darjeeling/k-board,guswnsxodlf/k-board,kboard/kboard,cjh5414/kboard,guswnsxodlf/k-board,hyesun03/k-board,cjh5414/kboard,hyesun03/k-board,kboard/kboard,cjh5414/kboard,kboard/kboard | kboard/board/models.py | kboard/board/models.py | from django.db import models
from django.core.urlresolvers import reverse
from django_summernote import models as summer_model
from django_summernote import fields as summer_fields
class Board(models.Model):
def get_absolute_url(self):
return reverse('board:post_list', args=[self.id])
name = models.T... | from django.db import models
from django.core.urlresolvers import reverse
from django_summernote import models as summer_model
from django_summernote import fields as summer_fields
class Board(models.Model):
def get_absolute_url(self):
return reverse('board:post_list', args=[self.id])
name = models.T... | mit | Python |
77f2216df2b459af417ff0563c4e350efa8b6964 | add more routes and vids | Tivix/django-spam | dj_spam/__init__.py | dj_spam/__init__.py | from django.conf import settings
# common endpoints bots like
SPAM_ROUTES = [
# asp/x
'admin.aspx',
'admin.asp',
'admin/login.asp',
'admin_login.asp',
'admin_login.aspx',
'administartorlogin.aspx',
'administrator_login.asp',
'administrator_login.aspx',
'login/administrator.aspx... | from django.conf import settings
# common endpoints bots like
SPAM_ROUTES = [
'admin.php',
'admin/login.php',
'administrator/index.php',
'index.php',
'wp-admin/admin-ajax.php',
'wp-admin/post-new.php',
'wp-admin/options-link.php',
'wp-admin/includes/themes.php',
'wp-login.php'
]
#... | mit | Python |
73022a76b7028651b43f73971b00a39d4ace1fcf | fix bitdeli.profiles -> bitdeli.chain in __init__ | bitdeli/bitdeli-py | bitdeli/__init__.py | bitdeli/__init__.py | """
:mod:`bitdeli`: Interface to profiles
=====================================
This module is used by the :ref:`card-script` to access :ref:`profiles`.
The :mod:`bitdeli` module supports a straightforward imperative coding style aka :ref:`the classic flavor <python-flavors>`:
.. code-block:: python
import bitd... | """
:mod:`bitdeli`: Interface to profiles
=====================================
This module is used by the :ref:`card-script` to access :ref:`profiles`.
The :mod:`bitdeli` module supports a straightforward imperative coding style aka :ref:`the classic flavor <python-flavors>`:
.. code-block:: python
import bitd... | mit | Python |
4371f6f856a65b533358a3134a525520d3c03972 | Update the model admin list fields and search options. | twaddington/pdxroasters,paulcpederson/pdxroasters,twaddington/pdxroasters,paulcpederson/pdxroasters,twaddington/pdxroasters | pdxroasters/roaster/admin.py | pdxroasters/roaster/admin.py | from django.contrib import admin
from roaster.models import Cafe, Roaster, Roast
class CafeAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug': ('name',)}
list_display = ('name', 'address', 'phone', 'url', 'created_at', 'modified_at',)
search_fields = ('name',)
class RoasterAdmin(admin.ModelAdmin):
... | from django.contrib import admin
from roaster.models import Cafe, Roaster, Roast
admin.site.register(Cafe)
admin.site.register(Roaster)
admin.site.register(Roast)
| bsd-2-clause | Python |
5da90adbcf188fcee46138f5bd5906383bb4a7db | add cbcollect_info helper | PaintScratcher/perfrunner,dkao-cb/perfrunner,EricACooper/perfrunner,pavel-paulau/perfrunner,thomas-couchbase/perfrunner,couchbase/perfrunner,couchbase/perfrunner,hsharsha/perfrunner,vmx/perfrunner,pavel-paulau/perfrunner,couchbase/perfrunner,PaintScratcher/perfrunner,couchbase/perfrunner,couchbase/perfrunner,couchbase/... | perfrunner/helpers/remote.py | perfrunner/helpers/remote.py | from uuid import uuid4
from fabric.api import execute, hide, get, run, parallel, settings
from logger import logger
from perfrunner.helpers import Helper
def all_hosts(task):
def wrapper(*args, **kargs):
self = args[0]
with hide('output', 'running'):
with settings(user=self.ssh_usern... | from fabric.api import execute, hide, run, parallel, settings
from logger import logger
from perfrunner.helpers import Helper
def all_hosts(task):
def wrapper(*args, **kargs):
self = args[0]
with hide('output', 'running'):
with settings(user=self.ssh_username, password=self.ssh_passwo... | apache-2.0 | Python |
b949d8d1773fc1d437c14ba1a44b838b72908bcb | fix indenting for flake8 | marcelometal/pyvows,heynemann/pyvows | tests/bugs/64_vows.py | tests/bugs/64_vows.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# unbreaking some pyvows
# This file is MIT licensed
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2013 nathan dotz
from pyvows import Vows, expect
from pyvows.core import VowsAssertionError
from pyvows.result import VowsResult
from pyvows.reporting im... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# unbreaking some pyvows
# This file is MIT licensed
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2013 nathan dotz
from pyvows import Vows, expect
from pyvows.core import VowsAssertionError
from pyvows.result import VowsResult
from pyvows.reporting im... | mit | Python |
1d5351cb2f2ebeb0966016d9d1cba21b3e854caa | Return stats from lambda run | multiplechoice/workplace | lambda.py | lambda.py | import json
import os
from scrapy.crawler import CrawlerProcess
from scrapy.utils.project import get_project_settings
def run(event, context):
process = CrawlerProcess(get_project_settings())
process.settings.update({
'LOG_ENABLED': False
})
name = event.get('spider', os.getenv('SCRAPY_SPIDER... | from scrapy.crawler import CrawlerProcess
from scrapy.utils.project import get_project_settings
import os
def run(event, context):
spider = event.get('spider', os.getenv('SCRAPY_SPIDER'))
process = CrawlerProcess(get_project_settings())
process.crawl(spider)
process.start()
return((event, context)... | apache-2.0 | Python |
aee99938ecf25ce537c85449e439e2350a404bdd | Fix mistakes in layers | tmerr/trevornet | layers.py | layers.py | import copy
import neurons
class InputLayer:
def __init__(self, num_neurons):
self._layer = Layer(num_neurons, neurons.InputNeuron)
@property
def neurons(self):
return self._layer.neurons
def connect_layer(self, other):
self._layer.connect_layer(other)
def setInputs(s... | import neurons
class InputLayer:
def __init__(self, num_neurons):
self._layer = Layer(num_neurons, neurons.InputNeuron)
@property
def neurons(self):
return self._layer.neurons
def connect_layer(self, other):
self._layer.connect_layer(other)
def setInputs(self, inputs)... | mit | Python |
438b0fb6d4a53b018ed1b59bf2961800ccb45500 | Update garage_trigger.py | jnk5y/pi_garage_manager,jnk5y/pi_garage_manager | bin/garage_trigger.py | bin/garage_trigger.py | #!/usr/bin/env python
import sys
import os
import socket
if len(sys.argv) < 2:
print "You must pass a parameter. (open, close, trigger, away, home, state)"
else:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("192.168.86.9", 6000))
sock.sendall(sys.argv[1])
result = sock.re... | #!/usr/bin/env python
import sys
import os
from socket
if len(sys.argv) < 2:
print "You must pass a parameter. (open, close, trigger, away, home, state)"
else:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect(("192.168.86.9", 6000))
sock.sendall(sys.argv[1])
result = sock.recv... | mit | Python |
6595ecf0bc9e097c989367b57d812ce371276000 | Update code according to linter report | doitian/SublimeLinter-contrib-elixirc,smanolloff/SublimeLinter-contrib-elixirc | linter.py | linter.py | """This module exports the elixirc plugin class."""
import tempfile
import os
from SublimeLinter.lint import Linter
class Elixirc(Linter):
"""Provides an interface to elixirc."""
syntax = ("elixir")
executable = "elixirc"
tempfile_suffix = "ex"
# Must skip lines in the stack trace such as
... | """This module exports the elixirc plugin class."""
import tempfile
import os
from SublimeLinter.lint import Linter, util
class Elixirc(Linter):
"""Provides an interface to elixirc."""
syntax = ("elixir")
executable = "elixirc"
tempfile_suffix = "ex"
# Must skip lines in the stack trace such ... | mit | Python |
29541a1d92fbce6dc5b87349ac1044f5afa0c2bb | Update ipc_lista1.6.py | any1m1c/ipc20161 | lista1/ipc_lista1.6.py | lista1/ipc_lista1.6.py | #ipc_lista1.6
#Professor: Jucimar Junior
#Any Mendes Carvalho -
#
#
#
#
#Faça
| #ipc_lista1.6
#Professor: Jucimar Junior
#Any Mendes Carvalho -
#
#
#
#
| apache-2.0 | Python |
c5e954fe16eef45cfa4b8f38451b802359b55110 | Update ipc_lista1.6.py | any1m1c/ipc20161 | lista1/ipc_lista1.6.py | lista1/ipc_lista1.6.py | #ipc_lista1.6
#Professor: Jucimar Junior
#Any Mendes Carvalho -
#
#
#
#
#Faça um programa que peça o raio de um círculo, calcule e mostre sua área
raio = 0
area = 0
raio = input("Entre com o valor do raio: ")
area = 3.14 * raio*raio
print "Valor da área do círculo: %d m²"
| #ipc_lista1.6
#Professor: Jucimar Junior
#Any Mendes Carvalho -
#
#
#
#
#Faça um programa que peça o raio de um círculo, calcule e mostre sua área
raio = 0
area = 0
raio = input("Entre com o valor do raio: ")
area = 3.14 * raio*raio
print "Valor da área do círculo: %d m²
| apache-2.0 | Python |
b704985ab01d49f1ac6a7366cd48e878440f645a | Update ipc_lista1.7.py | any1m1c/ipc20161 | lista1/ipc_lista1.7.py | lista1/ipc_lista1.7.py | #ipc_lista1.7
#Professor: Jucimar Junior
#Any Mendes Carvalho
#
#
#
#
#Faça um programa que calcule a área de um quadrado, em seguida
| #ipc_lista1.7
#Professor: Jucimar Junior
#Any Mendes Carvalho
#
#
#
#
#Faça um programa que calcule a área de um quadrado, em metros
| apache-2.0 | Python |
190fb5a3505fb6554c21a00855fbe17c262d6edc | Update rj_gameplay/rj_gameplay/play/basic_defense.py | RoboJackets/robocup-software,RoboJackets/robocup-software,RoboJackets/robocup-software,RoboJackets/robocup-software | rj_gameplay/rj_gameplay/play/basic_defense.py | rj_gameplay/rj_gameplay/play/basic_defense.py | import stp
from rj_gameplay.tactic import wall_tactic, goalie_tactic, nmark_tactic
import stp.role
from stp.role.assignment.naive import NaiveRoleAssignment
import stp.rc
from typing import Dict, List, Tuple, Type
from rj_gameplay.calculations import wall_calculations
import stp.role.cost
from rj_msgs.msg import Robo... | import stp
from rj_gameplay.tactic import wall_tactic, goalie_tactic, nmark_tactic
import stp.role
from stp.role.assignment.naive import NaiveRoleAssignment
import stp.rc
from typing import Dict, List, Tuple, Type
from rj_gameplay.calculations import wall_calculations
import stp.role.cost
from rj_msgs.msg import Robo... | apache-2.0 | Python |
b35b67f4b2d5c78fa7a9eda906db17e746fb2c40 | Change title of 'pelsogpoter' as well | jodal/comics,jodal/comics,jodal/comics,datagutten/comics,jodal/comics,datagutten/comics,datagutten/comics,datagutten/comics | comics/comics/pelsogpoter.py | comics/comics/pelsogpoter.py | from comics.aggregator.crawler import CrawlerBase, CrawlerImage
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = 'Pels og Poter'
language = 'no'
url = 'http://www.start.no/tegneserier/'
start_date = '1994-01-01'
rights = 'Patrick McDonnell'
class Crawler(Craw... | from comics.aggregator.crawler import CrawlerBase, CrawlerImage
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = 'Mutts (start.no)'
language = 'no'
url = 'http://www.start.no/tegneserier/'
start_date = '1994-01-01'
rights = 'Patrick McDonnell'
class Crawler(C... | agpl-3.0 | Python |
3dc335d058bdfc32b39c9dba4db6cac7ac7b66cb | Replace doCleanup to tearDown. | 10nin/blo,10nin/blo | tests/TestDBControl.py | tests/TestDBControl.py | import unittest
from pathlib import Path
from blo.DBControl import DBControl
from blo.BloArticle import BloArticle
class TestDBControlOnMemory(unittest.TestCase):
def setUp(self):
self.db_control = DBControl()
def test_initializer_for_file(self):
file_path = "./test.sqlite"
self.db_co... | import unittest
from pathlib import Path
from blo.DBControl import DBControl
from blo.BloArticle import BloArticle
class TestDBControlOnMemory(unittest.TestCase):
def setUp(self):
self.db_control = DBControl()
def test_initializer_for_file(self):
file_path = "./test.sqlite"
self.db_co... | mit | Python |
89485bf26ebb7cf4570549cda42543061d6b4fd7 | Fix BaseHTTPAdapter for the SSL case | docker/docker-py,funkyfuture/docker-py,funkyfuture/docker-py,vdemeester/docker-py,vdemeester/docker-py,docker/docker-py | docker/transport/basehttpadapter.py | docker/transport/basehttpadapter.py | import requests.adapters
class BaseHTTPAdapter(requests.adapters.HTTPAdapter):
def close(self):
super(BaseHTTPAdapter, self).close()
if hasattr(self, 'pools'):
self.pools.clear()
| import requests.adapters
class BaseHTTPAdapter(requests.adapters.HTTPAdapter):
def close(self):
self.pools.clear()
| apache-2.0 | Python |
9d4f726dfa6fa069d6beaad188be94fb6f0a6ec6 | Simplify the example script | mdmintz/SeleniumBase,mdmintz/seleniumspot,mdmintz/seleniumspot,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,ktp420/SeleniumBase,possoumous/Watchers,seleniumbase/SeleniumBase,possoumous/Watchers,mdmintz/SeleniumBase,possoumous/Watchers,ktp420/SeleniumBase,seleniumbase/SeleniumBase,possoumous/... | examples/my_first_test.py | examples/my_first_test.py | from seleniumbase import BaseCase
class MyTestClass(BaseCase):
def test_basic(self):
self.open("http://xkcd.com/353/")
self.find_element("div#comic")
self.click('a[rel="license"]')
text = self.get_text('center')
self.assertTrue("reuse any of my drawings" in text)
s... | from seleniumbase import BaseCase
class MyTestClass(BaseCase):
def test_basic(self):
self.open("http://xkcd.com/353/")
self.wait_for_element("div#comic")
self.click('a[rel="license"]')
text = self.wait_for_element('center').text
self.assertTrue("reuse any of my drawings" i... | mit | Python |
b4d86431806cc9ce3019aa65db2a3b22c2bd4ac3 | Improve list of headers returned with health route in order to remove /r/n | matthew-shaw/thing-api | flask_skeleton_api/views/general.py | flask_skeleton_api/views/general.py | from flask import request, Blueprint, Response
from flask import current_app
import json
# This is the blueprint object that gets registered into the app in blueprints.py.
general = Blueprint('general', __name__)
@general.route("/health")
def check_status():
return Response(response=json.dumps({
"app": "... | from flask import request, Blueprint, Response
from flask import current_app
import json
# This is the blueprint object that gets registered into the app in blueprints.py.
general = Blueprint('general', __name__)
@general.route("/health")
def check_status():
return Response(response=json.dumps({
"app": "... | mit | Python |
393102b93fda57e63f19412d8ab039c173d452f6 | Fix invalid test on Python 2.7 | banesullivan/ParaViewGeophysics,banesullivan/ParaViewGeophysics,banesullivan/ParaViewGeophysics | tests/helpers_test.py | tests/helpers_test.py | import numpy as np
import pandas as pd
# VTK imports:
import vtk
from vtk.numpy_interface import dataset_adapter as dsa
from base import TestBase
from PVGeo import interface
# Functionality to test:
from PVGeo._helpers import xml
RTOL = 0.000001
class TestXML(TestBase):
"""
Test the XML Helpers to make sure ... | import numpy as np
import pandas as pd
# VTK imports:
import vtk
from vtk.numpy_interface import dataset_adapter as dsa
from base import TestBase
from PVGeo import interface
# Functionality to test:
from PVGeo._helpers import xml
RTOL = 0.000001
class TestXML(TestBase):
"""
Test the XML Helpers to make sure ... | bsd-3-clause | Python |
ffe93b80d1bc2cd9adefb7bd79c3c014605c8b12 | Fix status string -> int conversion | Braedon/prometheus-es-exporter,Showmax/prometheus-es-exporter | prometheus_es_exporter/cluster_health_parser.py | prometheus_es_exporter/cluster_health_parser.py | singular_forms = {
'indices': 'index',
'shards': 'shard'
}
def parse_block(block, metric=[], labels={}):
result = []
# Green is 0, so if we add statuses of mutiple blocks together
# (e.g. all the indices) we don't need to know how many there were
# to know if things are good.
# i.e. 0 mea... | singular_forms = {
'indices': 'index',
'shards': 'shard'
}
def parse_block(block, metric=[], labels={}):
result = []
# Green is 0, so if we add statuses of mutiple blocks together
# (e.g. all the indices) we don't need to know how many there were
# to know if things are good.
# i.e. 0 mea... | mit | Python |
1d42c1b3c4f97a9e0d08bf55580b17ce144bd723 | Modify example to notify incompatibility with --stream SIZE command line option; https://github.com/mitmproxy/mitmproxy/issues/319 | scriptmediala/mitmproxy,laurmurclar/mitmproxy,xbzbing/mitmproxy,vhaupert/mitmproxy,guiquanz/mitmproxy,xaxa89/mitmproxy,owers19856/mitmproxy,owers19856/mitmproxy,vhaupert/mitmproxy,dweinstein/mitmproxy,jvillacorta/mitmproxy,devasia1000/mitmproxy,bazzinotti/mitmproxy,laurmurclar/mitmproxy,elitest/mitmproxy,legendtang/mit... | examples/stream_modify.py | examples/stream_modify.py | """
This inline script won't work with --stream SIZE command line option.
That's because flow.response.stream will be overwritten to True if the
command line option exists.
"""
def modify(chunks):
"""
chunks is a generator that can be used to iterate over all chunks.
Each chunk is a (prefix, content, suff... | def modify(chunks):
"""
chunks is a generator that can be used to iterate over all chunks.
Each chunk is a (prefix, content, suffix) tuple.
For example, in the case of chunked transfer encoding: ("3\r\n","foo","\r\n")
"""
for prefix, content, suffix in chunks:
yield prefix, content.repl... | mit | Python |
77ee43c4acb58b1e3329e5d010c3c3178ccf5ea1 | Fix some stuff | drkitty/metatube,drkitty/metatube | tube.py | tube.py | from __future__ import unicode_literals
import dateutil.parser
def get_user_playlists(client, username=None, likes=False, favorites=False,
uploads=False):
playlists = []
def process_playlist(item):
snippet = item['snippet']
p = {
'id': item['id'],
... | from __future__ import unicode_literals
import dateutil.parser
def get_my_playlists(client):
playlists = []
# normal playlists
def process_playlist(item):
snippet = item['snippet']
p = {
'id': item['id'],
'title': snippet['title'],
'description': snip... | mit | Python |
736cf3da1243f4f095efc0e390b8b82f0c03413d | Add additional tests to cover #32 | JensAstrup/pyOutlook | tests/account_tests.py | tests/account_tests.py | from datetime import datetime
import mock
from unittest import TestCase
from pyOutlook import *
class TestAccount(TestCase):
def test_account_requires_token(self):
""" Test that an account cannot be created without an access token """
with self.assertRaises(TypeError):
OutlookAccount... | from unittest import TestCase
from datetime import datetime
from pyOutlook import *
class TestAccount(TestCase):
def test_account_requires_token(self):
""" Test that an account cannot be created without an access token """
with self.assertRaises(TypeError):
OutlookAccount()
def... | mit | Python |
cdc8068b5ffbf73a7b45b8d3b9e1440be16542fb | Update reverse urls | audiolion/django-shibauth-rit,audiolion/django-shibauth-rit | shibauth_rit/context_processors.py | shibauth_rit/context_processors.py | # Third Party Library Imports
from django.core.urlresolvers import reverse
from django.utils.six.moves.urllib_parse import quote
# First Party Library Imports
from shibauth_rit.conf import settings
def login_link(request):
"""
This assumes your login link is the Shibboleth login page for your server
and ... | # Third Party Library Imports
from django.core.urlresolvers import reverse
from django.utils.six.moves.urllib_parse import quote
# First Party Library Imports
from shibauth_rit.conf import settings
def login_link(request):
"""
This assumes your login link is the Shibboleth login page for your server
and ... | mit | Python |
dd407be3f989a94ce7612afab453eacd1c668192 | make raise_on_error more helpful | m42e/jira,kinow/jira,jameskeane/jira-python,kinow/jira,systemadev/jira-python,tsarnowski/jira-python,akosiaris/jira,milo-minderbinder/jira,coddingtonbear/jira,pycontribs/jira,akosiaris/jira,coddingtonbear/jira,rayyen/jira,jameskeane/jira-python,pycontribs/jira,systemadev/jira-python,stevencarey/jira,rayyen/jira,tsarnow... | jira/exceptions.py | jira/exceptions.py | import json
class JIRAError(Exception):
"""General error raised for all problems in operation of the client."""
def __init__(self, status_code=None, text=None, url=None):
self.status_code = status_code
self.text = text
self.url = url
def __str__(self):
if self.text:
... | import json
class JIRAError(Exception):
"""General error raised for all problems in operation of the client."""
def __init__(self, status_code=None, text=None, url=None):
self.status_code = status_code
self.text = text
self.url = url
def __str__(self):
if self.text:
... | bsd-2-clause | Python |
d2e148d883dc5ef17d67438bc4834fb0bed7dad8 | Fix syntax in urls.py | willmurnane/store | urls.py | urls.py | from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^store/', include('store.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
(r'^ad... | from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^store/', include('store.foo.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
(r'^ad... | bsd-3-clause | Python |
08e60e65072b2da01d42ea8e95d128b4a5599e32 | Remove errornous paste | google/flight-lab,google/flight-lab,google/flight-lab,google/flight-lab | controller/components/badger.py | controller/components/badger.py | # Copyright 2018 Flight Lab authors.
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | # Copyright 2018 Flight Lab authors.
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | apache-2.0 | Python |
8289ec925f13f5ca1c005baece172151d3c37eb1 | Update Version | amplifylitco/asiaq,amplifylitco/asiaq,amplifylitco/asiaq | disco_aws_automation/version.py | disco_aws_automation/version.py | """Place of record for the package version"""
__version__ = "1.1.19"
__rpm_version__ = "WILL_BE_SET_BY_RPM_BUILD"
__git_hash__ = "WILL_BE_SET_BY_EGG_BUILD"
| """Place of record for the package version"""
__version__ = "1.1.18"
__rpm_version__ = "WILL_BE_SET_BY_RPM_BUILD"
__git_hash__ = "WILL_BE_SET_BY_EGG_BUILD"
| bsd-2-clause | Python |
357db324df4b1bd8444c4bf2b89d210e968c8cd7 | Add tests for non-chunked roundtrip | python-lz4/python-lz4,python-lz4/python-lz4 | tests/frame/test_frame_1.py | tests/frame/test_frame_1.py | import lz4.frame as lz4frame
import pytest
def test_create_compression_context():
context = lz4frame.create_compression_context()
assert context != None
def test_create_decompression_context():
context = lz4frame.create_decompression_context()
assert context != None
# TODO add store_source fixture
de... | import lz4.frame as lz4frame
import pytest
def test_create_compression_context():
context = lz4frame.create_compression_context()
assert context != None
def test_create_decompression_context():
context = lz4frame.create_decompression_context()
assert context != None
# TODO add source_size fixture
def... | bsd-3-clause | Python |
74063a8588875c058e6dbbb85b69ed052e1f2099 | Use correct license id #99 | bastikr/boolean.py | boolean/__init__.py | boolean/__init__.py | """
Boolean Algebra.
This module defines a Boolean Algebra over the set {TRUE, FALSE} with boolean
variables and the boolean functions AND, OR, NOT. For extensive documentation
look either into the docs directory or view it online, at
https://booleanpy.readthedocs.org/en/latest/.
Copyright (c) 2009-2020 Sebastian Kra... | """
Boolean Algebra.
This module defines a Boolean Algebra over the set {TRUE, FALSE} with boolean
variables and the boolean functions AND, OR, NOT. For extensive documentation
look either into the docs directory or view it online, at
https://booleanpy.readthedocs.org/en/latest/.
Copyright (c) 2009-2020 Sebastian Kra... | bsd-2-clause | Python |
e1df9380be8891c813a8c87e8d8175393171ac17 | Stop using django's internal `_create_object_from_params` | namespace-ee/django-rest-framework-sso,namespace-ee/django-rest-framework-sso | rest_framework_sso/querysets.py | rest_framework_sso/querysets.py | # coding: utf-8
from __future__ import absolute_import, unicode_literals
from django.db.models import QuerySet, Q
from django.utils import timezone
import logging
logger = logging.getLogger(__name__)
class SessionTokenQuerySet(QuerySet):
def active(self):
return self.filter(Q(revoked_at__isnull=True) |... | # coding: utf-8
from __future__ import absolute_import, unicode_literals
from django.db.models import QuerySet, Q
from django.utils import timezone
import logging
logger = logging.getLogger(__name__)
class SessionTokenQuerySet(QuerySet):
def active(self):
return self.filter(Q(revoked_at__isnull=True) |... | mit | Python |
b29179b2e0b7d895cd2905830950f5a7915bb668 | Add optional tag to logger | alvarogzp/telegram-games,alvarogzp/telegram-games,alvarogzp/telegram-games,alvarogzp/telegram-games | bot/tools/logger.py | bot/tools/logger.py | import time
import telegram
from . import config
class Logger:
def __init__(self, bot: telegram.Bot, tag=None, reuse_message=False):
self.bot = bot
self.tag = tag
self.reuse_message = reuse_message
self.chat_id = config.Key.LOG_CHAT_ID.read()
self.log_enabled = bool(self.... | import time
import telegram
from . import config
class Logger:
def __init__(self, bot: telegram.Bot, reuse_message=False):
self.bot = bot
self.reuse_message = reuse_message
self.chat_id = config.Key.LOG_CHAT_ID.read()
self.log_enabled = bool(self.chat_id)
self.message_tex... | apache-2.0 | Python |
b82167bdc233b866530157cc84eb7299c7f6570c | test settings - set THUMBOR_WRITABLE_SERVER != THUMBOR_SERVER. | Starou/django-thumborstorage,lCharlie123l/django-thumborstorage,Starou/django-thumborstorage,lCharlie123l/django-thumborstorage | tests/settings.py | tests/settings.py | SECRET_KEY = 'i0_+-t@@wul&q)30+4y)8-19s)31@%cv8$q(c@8q1g#h$6wn-='
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
}
## Thumbor ##
THUMBOR_SERVER = 'http://ro.thumbor-server'
THUMBOR_WRITABLE_SERVER = 'http://rw.thumbor-server'
#THUMBOR_MEDIA_URL = 'http://localhost:8000/media'
THU... | SECRET_KEY = 'i0_+-t@@wul&q)30+4y)8-19s)31@%cv8$q(c@8q1g#h$6wn-='
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
}
## Thumbor ##
THUMBOR_SERVER = 'http://localhost:8888'
THUMBOR_WRITABLE_SERVER = THUMBOR_SERVER
#THUMBOR_MEDIA_URL = 'http://localhost:8000/media'
THUMBOR_SECURITY_K... | mit | Python |
a0f0923a32ae7fba408f199d24e92fd8bf6a51a9 | fix test_api.py | michaeltcoelho/pagarme.py | tests/test_api.py | tests/test_api.py | # coding:utf-8
import os
import logging
import unittest
from pagarme.api import PagarmeApi
from pagarme.config import __endpoint__, __user_agent__
from pagarme.exceptions import NullAPIKeyError
# logging
logging.basicConfig(level=logging.INFO)
class ApiTest(unittest.TestCase):
def setUp(self):
self.api ... | # coding:utf-8
import os
import logging
import unittest
from pagarme.api import PagarmeApi
from pagarme.config import __endpoint__, __user_agent__
from pagarme.exceptions import NullAPIKeyError
# logging
logging.basicConfig(level=logging.INFO)
class ApiTest(unittest.TestCase):
def setUp(self):
self.api ... | mit | Python |
5442fa77ab76f53c73bd19c280bbfe192cd58a4b | Remove usage of loop in executor creation on application start | virtool/virtool,igboyes/virtool,igboyes/virtool,virtool/virtool | tests/test_app.py | tests/test_app.py | import pytest
import concurrent.futures
import aiohttp.client
import aiohttp.web
import virtool.app
import virtool.dispatcher
import virtool.startup
import virtool.settings.schema
import virtool.jobs.runner
@pytest.fixture
async def app():
version = "v1.2.3"
app = {
"version": version
}
yi... | import pytest
import concurrent.futures
import aiohttp.client
import aiohttp.web
import virtool.app
import virtool.dispatcher
import virtool.startup
import virtool.settings.schema
import virtool.jobs.runner
@pytest.fixture
async def app(loop):
version = "v1.2.3"
app = {
"version": version
}
... | mit | Python |
5e003422add42d65e75001dd925ea3da92fb4dde | Add other endpoint calls | tshlabs/avalonms | tests/generate_urls.py | tests/generate_urls.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
Output all possible valid requests with query string params
to the songs endpoint
"""
from __future__ import print_function
import os
import os.path
import sys
import urllib
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
import avalon.models
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
Output all possible valid requests with query string params
to the songs endpoint
"""
from __future__ import print_function
import os
import os.path
import sys
import urllib
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
import avalon.models
... | mit | Python |
96cdf70908dfebfa03ad5bad485391c354937988 | Test before_request and after_request | nickfrostatx/malt | tests/test_app.py | tests/test_app.py | # -*- coding: utf-8 -*-
"""Test that the package exists and has specified metadata."""
from malt import Malt, Request, Response, HTTPException
import pytest
@pytest.fixture
def app():
app = Malt()
@app.before_request
def before(request):
if request.path == '/before':
return Response(... | # -*- coding: utf-8 -*-
"""Test that the package exists and has specified metadata."""
from malt import Malt, Request, Response, HTTPException
import pytest
@pytest.fixture
def app():
app = Malt()
@app.error_handler
def handle(error):
return Response('%s\n' % error.message, code=error.status_cod... | mit | Python |
f01bfb38ed89e9b8b268615274e6794bea1d536e | add test for access before and after login | szeestraten/kidsakoder-minecraft,szeestraten/kidsakoder-minecraft,szeestraten/kidsakoder-minecraft,szeestraten/kidsakoder-minecraft | tests/test_app.py | tests/test_app.py | import pytest
import os
from flask_app import app
@pytest.fixture
def client(request):
client = app.test_client()
app.config['WTF_CSRF_ENABLED'] = False
return client
def login(client, email, password):
return client.post('/login', data=dict(
email=email,
password=password
), fol... | import pytest
import os
from flask_app import app
@pytest.fixture
def client(request):
client = app.test_client()
app.config['WTF_CSRF_ENABLED'] = False
return client
def login(client, email, password):
return client.post('/login', data=dict(
email=email,
password=password
), fol... | mit | Python |
ff4b34cda7c0b5bc516d9f9e3689818000301336 | Update test for largest stock | alanc10n/py-cutplanner | tests/test_planner.py | tests/test_planner.py | import cutplanner
import unittest
class TestPlanner(unittest.TestCase):
def setUp(self):
sizes = [80, 120]
needed = [10, 25, 75]
loss = 0.25
self.planner = cutplanner.Planner(sizes, needed, loss)
def test_largest_stock(self):
largest = self.planner.largest_stock
... | import cutplanner
import unittest
class TestPlanner(unittest.TestCase):
def setUp(self):
sizes = [80, 120]
needed = [10, 25, 75]
loss = 0.25
self.planner = cutplanner.Planner(sizes, needed, loss)
def test_get_largest(self):
largest = self.planner.get_largest_stock()
... | mit | Python |
35239dfa812933286884051fceedf12790bf5f14 | Use binary data in fixture | inirudebwoy/bamp | tests/test_vcs_git.py | tests/test_vcs_git.py | # -*- coding: utf-8 -*-
import os
from tempfile import mkstemp, mkdtemp
import pytest
from dulwich import porcelain
from bamp.exc import VCSException
from bamp.vcs.git import is_tree_clean, get_repo, create_commit
class RepoStatusMock(object):
def __init__(self, staged, unstaged):
self.unstaged = unstag... | # -*- coding: utf-8 -*-
import os
from tempfile import mkstemp, mkdtemp
import pytest
from dulwich import porcelain
from bamp.exc import VCSException
from bamp.vcs.git import is_tree_clean, get_repo, create_commit
class RepoStatusMock(object):
def __init__(self, staged, unstaged):
self.unstaged = unstag... | mit | Python |
c2de397754e596eaa4fdcd927f48b28b23777d1a | Remove debug logging | sergey-dryabzhinsky/python-zstd,sergey-dryabzhinsky/python-zstd | tests/test_version.py | tests/test_version.py | # Tests
import os
from tests.base import BaseTestZSTD
class TestZSTD(BaseTestZSTD):
def setUp(self):
if os.getenv("ZSTD_EXTERNAL"):
self.ZSTD_EXTERNAL = True
self.VERSION = os.getenv("VERSION")
self.PKG_VERSION = os.getenv("PKG_VERSION")
v = [int(n) for n in reversed(... | # Tests
import os
from tests.base import BaseTestZSTD, log
class TestZSTD(BaseTestZSTD):
def setUp(self):
if os.getenv("ZSTD_EXTERNAL"):
self.ZSTD_EXTERNAL = True
self.VERSION = os.getenv("VERSION")
self.PKG_VERSION = os.getenv("PKG_VERSION")
log.info("VERSION=%r" % s... | bsd-2-clause | Python |
ca4a6262bb1791a81a1bf7467d02e29d16bafe8b | Update dependency bazelbuild/bazel to latest version | google/copybara,google/copybara,google/copybara | third_party/bazel.bzl | third_party/bazel.bzl | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | apache-2.0 | Python |
b9d6cb1abf5d088ae3ef9eb3a04c8233d4a9e55b | Update dependency bazelbuild/bazel to latest version | google/copybara,google/copybara,google/copybara | third_party/bazel.bzl | third_party/bazel.bzl | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | apache-2.0 | Python |
b55d51cbf2c575979219d2ee6843c2f5457bd360 | Print friendly message when image_export cannot find signatures.conf #2147 (#3060) | log2timeline/plaso,Onager/plaso,rgayon/plaso,rgayon/plaso,kiddinn/plaso,rgayon/plaso,kiddinn/plaso,kiddinn/plaso,log2timeline/plaso,Onager/plaso,joachimmetz/plaso,joachimmetz/plaso | tools/image_export.py | tools/image_export.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""The image export command line tool."""
from __future__ import unicode_literals
import logging
import multiprocessing
import os
import sys
from plaso import dependencies
from plaso.cli import image_export_tool
from plaso.lib import errors
def Main():
"""The main f... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""The image export command line tool."""
from __future__ import unicode_literals
import logging
import multiprocessing
import os
import sys
from plaso import dependencies
from plaso.cli import image_export_tool
from plaso.lib import errors
def Main():
"""The main f... | apache-2.0 | Python |
18712227965b094c6bf86be99f73b21f6f490d94 | Fix to use . to source script files | openstack/tacker,stackforge/tacker,openstack/tacker,stackforge/tacker,openstack/tacker | tools/install_venv.py | tools/install_venv.py | #!/usr/bin/env python
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2010 OpenStack Foundation.
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); y... | #!/usr/bin/env python
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2010 OpenStack Foundation.
# Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); y... | apache-2.0 | Python |
79a98d04064398684e1574eed5bbffaeadf9a851 | Fix URL in python binding packaging #6486 | htcondor/htcondor,htcondor/htcondor,htcondor/htcondor,htcondor/htcondor,htcondor/htcondor,htcondor/htcondor,htcondor/htcondor,htcondor/htcondor | build/packaging/pypi/setup.py | build/packaging/pypi/setup.py | from setuptools import setup
from setuptools.dist import Distribution
import pip
import os
import sys
import io
import classad
package_name = "htcondor"
long_description = open("README.rst", "r").read()
package_data = {}
if os.name == 'posix':
package_data['htcondor'] = ['*.so', 'condor_libs/*.so*']
package_... | from setuptools import setup
from setuptools.dist import Distribution
import pip
import os
import sys
import io
import classad
package_name = "htcondor"
long_description = open("README.rst", "r").read()
package_data = {}
if os.name == 'posix':
package_data['htcondor'] = ['*.so', 'condor_libs/*.so*']
package_... | apache-2.0 | Python |
490846cb8097f5d1c9679c2b5aba2ef4760df037 | Fix linter error | Eloston/ungoogled-chromium,Eloston/ungoogled-chromium | buildkit/packaging/windows.py | buildkit/packaging/windows.py | # -*- coding: UTF-8 -*-
# Copyright (c) 2017 The ungoogled-chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Microsoft Windows-specific build files generation code"""
import shutil
from ..common import PACKAGING_DIR, PATCH... | # -*- coding: UTF-8 -*-
# Copyright (c) 2017 The ungoogled-chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Microsoft Windows-specific build files generation code"""
import shutil
from ..common import PACKAGING_DIR, PATCH... | bsd-3-clause | Python |
14e39e28c22da59049feeae0efd1a9fa2bfb51e6 | Fix OnAccess job link for JobConfig | sprucedev/DockCI-Agent,sprucedev/DockCI-Agent | dockci/models/job_meta/config.py | dockci/models/job_meta/config.py | """
Job metadata stored along side the code
"""
from yaml_model import LoadOnAccess, Model, OnAccess
def get_job(slug):
"""
Wrapper to import, and return a Job object for the JobConfig to avoid
cyclic import
"""
from dockci.models.job import Job
return Job.load(slug)
class JobConfig(Model):... | """
Job metadata stored along side the code
"""
from yaml_model import LoadOnAccess, Model, OnAccess
def get_job(slug):
"""
Wrapper to import, and return a Job object for the JobConfig to avoid
cyclic import
"""
from dockci.models.job import Job
return Job.query.filter_by(slug=slug).first()
... | isc | Python |
d0e61b4167f3c909d5993a95d6dcb061c0a55006 | Improve test structure | yashaka/selene,yashaka/selene,yashaka/selene,yashaka/selene | tests/integration/collection__filtered_by_condition__no_waiting_search_test.py | tests/integration/collection__filtered_by_condition__no_waiting_search_test.py | # MIT License
#
# Copyright (c) 2015-2021 Iakiv Kramarenko
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modif... | # MIT License
#
# Copyright (c) 2015-2021 Iakiv Kramarenko
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modif... | mit | Python |
039798359758a5f02d841c5d2c15fe676318a0c4 | Update start_websocket_servers.py | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | examples/tutorials/advanced/websockets-example-MNIST/start_websocket_servers.py | examples/tutorials/advanced/websockets-example-MNIST/start_websocket_servers.py | import subprocess
call_alice = ['python', "run_websocket_server.py", "--port", "8777", "--id", "alice"]
call_bob = ['python', "run_websocket_server.py", "--port", "8778", "--id", "bob"]
call_charlie = ['python', "run_websocket_server.py", "--port", "8779", "--id", "charlie"]
print("Starting server for Alice")
sub... | import subprocess
import sys
call_alice = ['python', "run_websocket_server.py", "--port", "8777", "--id", "alice"]
call_bob = ['python', "run_websocket_server.py", "--port", "8778", "--id", "bob"]
call_charlie = ['python', "run_websocket_server.py", "--port", "8779", "--id", "charlie"]
print("Starting server for ... | apache-2.0 | Python |
c68ef2e265f5f0e1deca781f84a672ba48baa561 | check session in get user on custom | avelino/bottle-auth | bottle_auth/custom.py | bottle_auth/custom.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from bottle import redirect
log = logging.getLogger('bottle-auth.custom')
class Custom(object):
def __init__(self, login_url="/login",
callback_url="http://127.0.0.1:8000"):
self.login_url = login_url
self.callback_url... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from bottle import redirect
log = logging.getLogger('bottle-auth.custom')
class Custom(object):
def __init__(self, login_url="/login",
callback_url="http://127.0.0.1:8000"):
self.login_url = login_url
self.callback_url... | mit | Python |
f15505714ade5f091e49f6b005e839846e4cfaaf | Add missing license header | andcor02/mbed-os,andcor02/mbed-os,andcor02/mbed-os,mbedmicro/mbed,mbedmicro/mbed,kjbracey-arm/mbed,mbedmicro/mbed,andcor02/mbed-os,mbedmicro/mbed,kjbracey-arm/mbed,mbedmicro/mbed,kjbracey-arm/mbed,kjbracey-arm/mbed,andcor02/mbed-os,andcor02/mbed-os | tools/psa/__init__.py | tools/psa/__init__.py | #!/usr/bin/python
# Copyright (c) 2019 ARM Limited
#
# SPDX-License-Identifier: Apache-2.0
#
# 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
#... | from os.path import basename
from tools.resources import FileType
def find_secure_image(notify, resources, ns_image_path, configured_s_image_filename, image_type):
""" Find secure image. """
assert ns_image_path and configured_s_image_filename, 'ns_image_path and configured_s_image_path are mandatory'
as... | apache-2.0 | Python |
e52896af2ee6e70e29e98e2d7e5e536dd8665cfb | enable parallel build | simbuerg/benchbuild,simbuerg/benchbuild | pprof/projects/pprof/ruby.py | pprof/projects/pprof/ruby.py | #!/usr/bin/evn python
# encoding: utf-8
from pprof.project import ProjectFactory, log
from pprof.settings import config
from group import PprofGroup
from os import path
from plumbum import FG, local
from plumbum.cmd import chmod
class Ruby(PprofGroup):
class Factory:
def create(self, exp):
... | #!/usr/bin/evn python
# encoding: utf-8
from pprof.project import ProjectFactory, log
from pprof.settings import config
from group import PprofGroup
from os import path
from plumbum import FG, local
from plumbum.cmd import chmod
class Ruby(PprofGroup):
class Factory:
def create(self, exp):
... | mit | Python |
674a211cdaa0dcd6e9a4827ca8f794430ceb0a90 | Remove escape sequences from default strings in documentation | russellb/powerline,bezhermoso/powerline,blindFS/powerline,wfscheper/powerline,junix/powerline,junix/powerline,xfumihiro/powerline,Luffin/powerline,xfumihiro/powerline,prvnkumar/powerline,xxxhycl2010/powerline,magus424/powerline,keelerm84/powerline,lukw00/powerline,xxxhycl2010/powerline,prvnkumar/powerline,seanfisk/powe... | docs/source/powerline_autodoc.py | docs/source/powerline_autodoc.py | from sphinx.ext import autodoc
from sphinx.util.inspect import getargspec
from inspect import ArgSpec, getargspec, formatargspec
from powerline.lib.threaded import ThreadedSegment, KwThreadedSegment
from itertools import count
try:
from __builtin__ import unicode
except ImportError:
unicode = lambda s, enc: s
def ... | from sphinx.ext import autodoc
from sphinx.util.inspect import getargspec
from inspect import ArgSpec, getargspec, formatargspec
from powerline.lib.threaded import ThreadedSegment, KwThreadedSegment
from itertools import count
class ThreadedDocumenter(autodoc.FunctionDocumenter):
'''Specialized documenter subclass f... | mit | Python |
e63a6139c3dd3bf8e6ec50c88bdbc110c358fedd | Set input encoding for Textile. Closes #2337. | pkdevbox/trac,pkdevbox/trac,pkdevbox/trac,pkdevbox/trac | trac/mimeview/txtl.py | trac/mimeview/txtl.py | # -*- coding: iso-8859-1 -*-
#
# Copyright (C) 2004-2006 Edgewall Software
# Copyright (C) 2004 Daniel Lundin
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.com/l... | # -*- coding: iso-8859-1 -*-
#
# Copyright (C) 2004 Edgewall Software
# Copyright (C) 2004 Daniel Lundin
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.com/licens... | bsd-3-clause | Python |
b2ff725c82ba28655fa6105eeb05da10291f5247 | Remove unused imports | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/unit/template_test.py | tests/unit/template_test.py | # -*- coding: utf-8 -*-
'''
:codeauthor: :email: `Mike Place <mp@saltstack.com>`
'''
# Import Salt Testing libs
from salttesting import TestCase
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../')
# Import Salt libs
from salt import template
class TemplateTestCase(TestCase):
render_... | # -*- coding: utf-8 -*-
'''
:codeauthor: :email: `Mike Place <mp@saltstack.com>`
'''
# Import Salt Testing libs
from salttesting import TestCase, skipIf
from salttesting.helpers import ensure_in_syspath
from salttesting.mock import NO_MOCK, NO_MOCK_REASON, MagicMock, patch
ensure_in_syspath('../')
# Import Salt ... | apache-2.0 | Python |
86d68c3bf7a31fbc3999bb25207c36fd34d29413 | Update path process logic | flux3dp/fluxghost,flux3dp/fluxghost,flux3dp/fluxghost,flux3dp/fluxghost | fluxghost/http_handler.py | fluxghost/http_handler.py |
from http.server import BaseHTTPRequestHandler
import logging
logger = logging.getLogger("HTTP")
from fluxghost.websocket.echo import WebsocketEcho
from fluxghost import VERSION_STRING
class HttpHandler(BaseHTTPRequestHandler):
server_version = "FLUXGhost/%s" % VERSION_STRING
protocol_version = "HTTP/1.1"
... |
from http.server import BaseHTTPRequestHandler
import logging
logger = logging.getLogger("HTTP")
from fluxghost.websocket.echo import WebsocketEcho
from fluxghost import VERSION_STRING
class HttpHandler(BaseHTTPRequestHandler):
server_version = "FLUXGhost/%s" % VERSION_STRING
protocol_version = "HTTP/1.1"
... | agpl-3.0 | Python |
6b4f0e73423da94e92aea798f353f52dee4b1f4b | Update __init__.py | thouska/spotpy,bees4ever/spotpy,thouska/spotpy,thouska/spotpy,bees4ever/spotpy,bees4ever/spotpy | spotpy/__init__.py | spotpy/__init__.py | # -*- coding: utf-8 -*-
'''
Copyright (c) 2015 by Tobias Houska
This file is part of Statistical Parameter Estimation Tool (SPOTPY).
:author: Tobias Houska
:paper: Houska, T., Kraft, P., Chamorro-Chavez, A. and Breuer, L.:
SPOTting Model Parameters Using a Ready-Made Python Package,
PLoS ONE, 10(12), e0145180, doi:... | # -*- coding: utf-8 -*-
'''
Copyright (c) 2015 by Tobias Houska
This file is part of Statistical Parameter Estimation Tool (SPOTPY).
:author: Tobias Houska
:paper: Houska, T., Kraft, P., Chamorro-Chavez, A. and Breuer, L.:
SPOTting Model Parameters Using a Ready-Made Python Package,
PLoS ONE, 10(12), e0145180, doi:... | mit | Python |
73cae7d1ab8aa343d2f7d4715f7de2b439e0651b | remove unnecessary import | akshayaurora/kivy,bhargav2408/kivy,youprofit/kivy,thezawad/kivy,inclement/kivy,Cheaterman/kivy,tony/kivy,viralpandey/kivy,rafalo1333/kivy,youprofit/kivy,Shyam10/kivy,aron-bordin/kivy,MiyamotoAkira/kivy,xpndlabs/kivy,matham/kivy,cbenhagen/kivy,Farkal/kivy,bhargav2408/kivy,akshayaurora/kivy,aron-bordin/kivy,yoelk/kivy,ma... | kivy/uix/checkbox.py | kivy/uix/checkbox.py | '''
CheckBox
========
.. versionadded:: 1.4.0
.. image:: images/checkbox.png
:align: right
:class:`CheckBox` is a specific two-state button that can be either checked or
unchecked. If the CheckBox is in a Group, it becomes a Radio button.
As with the :class:`~kivy.uix.togglebutton.ToggleButton`, only one Radio b... | '''
CheckBox
========
.. versionadded:: 1.4.0
.. image:: images/checkbox.png
:align: right
:class:`CheckBox` is a specific two-state button that can be either checked or
unchecked. If the CheckBox is in a Group, it becomes a Radio button.
As with the :class:`~kivy.uix.togglebutton.ToggleButton`, only one Radio b... | mit | Python |
6607a323d4584eee646ac7c9edaa253a1673dd7b | Modify output message. | microy/RobotVision,microy/RobotVision | calibrate_camera.py | calibrate_camera.py | #! /usr/bin/env python
# -*- coding:utf-8 -*-
#
# Application to calibrate a camera
#
# External dependencies
import glob
import Calibration
# Calibration pattern size
pattern_size = ( 9, 6 )
# Calibrate the camera
calibration = Calibration.CalibrateCamera( glob.glob( 'image-*.png' ), pattern_size )
# Write the cali... | #! /usr/bin/env python
# -*- coding:utf-8 -*-
#
# Application to calibrate a camera
#
# External dependencies
import glob
import Calibration
# Calibration pattern size
pattern_size = ( 9, 6 )
# Calibrate the camera
calibration = Calibration.CalibrateCamera( glob.glob( 'image-*.png' ), pattern_size )
# Write the cali... | mit | Python |
840a116536495d084727bf8511739987df211626 | make filename positional arg in JPPPump | tamasgal/km3pipe,tamasgal/km3pipe | km3pipe/pumps/jpp.py | km3pipe/pumps/jpp.py | #!/usr/bin/env python
# coding=utf-8
# Filename: jpp.py
# pylint: disable=
"""
Pump for the jpp file read through aanet interface.
"""
from __future__ import division, absolute_import, print_function
import numpy as np
from km3pipe import Pump
from km3pipe.dataclasses import HitSeries
from km3pipe.logger import logg... | #!/usr/bin/env python
# coding=utf-8
# Filename: jpp.py
# pylint: disable=
"""
Pump for the jpp file read through aanet interface.
"""
from __future__ import division, absolute_import, print_function
import numpy as np
from km3pipe import Pump
from km3pipe.dataclasses import HitSeries
from km3pipe.logger import logg... | mit | Python |
6fda2264469db505d71dc0f5114f4a7ac7bfe8ee | Migrate test_condprob to use CGPM_Metamodel. | probcomp/bayeslite,probcomp/bayeslite | tests/test_condprob.py | tests/test_condprob.py | # -*- coding: utf-8 -*-
# Copyright (c) 2010-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/LICENS... | # -*- coding: utf-8 -*-
# Copyright (c) 2010-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/LICENS... | apache-2.0 | Python |
a0c91afa82edd5bc666102759f7abf6ba8e3a6b2 | use the @admin.register decorator for candidates admin | DemocracyClub/yournextrepresentative,mysociety/yournextmp-popit,neavouli/yournextrepresentative,mysociety/yournextmp-popit,mysociety/yournextrepresentative,neavouli/yournextrepresentative,mysociety/yournextmp-popit,mysociety/yournextrepresentative,mysociety/yournextmp-popit,neavouli/yournextrepresentative,mysociety/you... | candidates/admin.py | candidates/admin.py | from __future__ import unicode_literals
from django.contrib import admin
from django.core.urlresolvers import reverse
from django.forms import ModelForm
from .models import LoggedAction, PartySet, ExtraField, PersonExtraFieldValue, SimplePopoloField
# Register your models here.
class LoggedActionAdminForm(ModelFor... | from __future__ import unicode_literals
from django.contrib import admin
from django.core.urlresolvers import reverse
from django.forms import ModelForm
from .models import LoggedAction, PartySet, ExtraField, PersonExtraFieldValue, SimplePopoloField
# Register your models here.
class LoggedActionAdminForm(ModelFor... | agpl-3.0 | Python |
fc21767c089f8ee2828ad98eb01e40f5a8491dab | Make test fail | jakelever/kindred,jakelever/kindred | tests/test_examples.py | tests/test_examples.py | import kindred
def test_bionlpst():
trainData = kindred.BioNLPSTData('2016-BB3-event-training')
devData = kindred.BioNLPSTData('2016-BB3-event-development')
model = kindred.train(trainData)
predictedRelations = model.predict(dev_data.getTextAndEntities())
f1score = kindred.evaluate(dev_data.getRelations(), predic... | import kindred
def test_bionlpst():
trainData = kindred.BioNLPSTData('2016-BB3-event-training')
devData = kindred.BioNLPSTData('2016-BB3-event-development')
model = kindred.train(trainData)
predictedRelations = model.predict(dev_data.getTextAndEntities())
f1score = kindred.evaluate(dev_data.getRelations(), predic... | mit | Python |
14a9a3fb6684f3eab628d59adacbff0a154716e7 | Use mocking for network.has_ipv6 monkey patching | bacontext/mopidy,pacificIT/mopidy,adamcik/mopidy,swak/mopidy,bencevans/mopidy,hkariti/mopidy,priestd09/mopidy,vrs01/mopidy,hkariti/mopidy,ali/mopidy,abarisain/mopidy,glogiotatidis/mopidy,bacontext/mopidy,kingosticks/mopidy,adamcik/mopidy,tkem/mopidy,pacificIT/mopidy,SuperStarPL/mopidy,diandiankan/mopidy,jmarsik/mopidy,... | tests/utils/network_test.py | tests/utils/network_test.py | import mock
import unittest
from mopidy.utils import network
class FormatHostnameTest(unittest.TestCase):
@mock.patch('mopidy.utils.network.has_ipv6', True)
def test_format_hostname_prefixes_ipv4_addresses_when_ipv6_available(self):
network.has_ipv6 = True
self.assertEqual(network.format_hostn... | import mock
import unittest
from mopidy.utils import network
class FormatHostnameTest(unittest.TestCase):
def setUp(self):
self.has_ipv6 = network.has_ipv6
def tearDown(self):
network.has_ipv6 = self.has_ipv6
def test_format_hostname_prefixes_ipv4_addresses_when_ipv6_available(self):
... | apache-2.0 | Python |
229171856f804d901f9b3eefcaa60158f48378e1 | Test type value for str variable with max length | openfisca/openfisca-core,openfisca/openfisca-core | tests/web_api/test_trace.py | tests/web_api/test_trace.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function, division, absolute_import
import json
from numpy import str_
from nose.tools import assert_equal, assert_is_instance
from http.client import OK
import dpath
from openfisca_core.model_api import Variable
from openfisca_core.periods impor... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function, division, absolute_import
import json
from nose.tools import assert_equal, assert_is_instance
from http.client import OK
import dpath
from openfisca_country_template.situation_examples import single, couple
from . import subject
def a... | agpl-3.0 | Python |
2214661c4e6391b707599d5381ce55a91ba5d469 | add distribution to init | mwcraig/ccdproc,astropy/ccdproc | ccdproc/__init__.py | ccdproc/__init__.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
The ccdproc package is a collection of code that will be helpful in basic CCD
processing. These steps will allow reduction of basic CCD data as either a
stand-alone processing or as part of a pipeline.
"""
# Affiliated packages may add whatever they l... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
The ccdproc package is a collection of code that will be helpful in basic CCD
processing. These steps will allow reduction of basic CCD data as either a
stand-alone processing or as part of a pipeline.
"""
# Affiliated packages may add whatever they l... | bsd-3-clause | Python |
9e5299859ec83a64156a46b95faf9fd108b8ea2a | Fix typo | nylas/nylas-python | tests/test_messages.py | tests/test_messages.py | import json
import six
import pytest
import responses
@responses.activate
@pytest.mark.usefixtures("mock_messages")
def test_messages(api_client):
message = api_client.messages.first()
assert len(message.labels) == 1
assert message.labels[0].display_name == 'Inbox'
assert message.folder is None
as... | import json
import six
import pytest
import responses
@responses.activate
@pytest.mark.usefixtures("mock_messages")
def test_messages(api_client):
message = api_client.messages.first()
assert len(message.labels) == 1
assert message.labels[0].display_name == 'Inbox'
assert message.folder is None
as... | mit | Python |
65ca67c3cadc2f177a2b699ed73a9d798012c7f5 | add test for wrong document insertion | mylokin/mongoext | tests/test_mongoext.py | tests/test_mongoext.py | import unittest
import mongoext.fields
import mongoext.collection
import mongoext.models
class Collection(mongoext.collection.Collection):
CONNECTION = {'host': 'localhost', 'port': 27017}
DATABASE = 'db1'
NAME = 'collection1'
KEYS_COMPRESSION = {
'about': 'a'
}
class Model(mongoext.mod... | import unittest
import mongoext.fields
import mongoext.collection
import mongoext.models
class Collection(mongoext.collection.Collection):
CONNECTION = {'host': 'localhost', 'port': 27017}
DATABASE = 'db1'
NAME = 'collection1'
KEYS_COMPRESSION = {
'about': 'a'
}
class Model(mongoext.mod... | mit | Python |
ed34b093513714ba611ebb633c8bf4c7f68614a0 | use Perceptron and quick splitter | petosegan/scikit-learn,kaichogami/scikit-learn,hainm/scikit-learn,macks22/scikit-learn,LiaoPan/scikit-learn,xiaoxiamii/scikit-learn,ahoyosid/scikit-learn,bnaul/scikit-learn,arahuja/scikit-learn,JeanKossaifi/scikit-learn,sinhrks/scikit-learn,tawsifkhan/scikit-learn,liberatorqjw/scikit-learn,cauchycui/scikit-learn,gclena... | solutions/exercise_01_language_train_model.py | solutions/exercise_01_language_train_model.py | """Build a language detector model"""
# Author: Olivier Grisel <olivier.grisel@ensta.org>
# License: Simplified BSD
import sys
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.feature_extraction.text import CharNGramAnalyzer
from skl... | """Build a language detector model"""
# Author: Olivier Grisel <olivier.grisel@ensta.org>
# License: Simplified BSD
import sys
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.feature_extraction.text import CharNGramAnalyzer
from skl... | bsd-3-clause | Python |
7bd8a47be85ff7a02d1fa6692d314a1fa45540cc | Remove this for now, it's useless. | Julian/L | l/tests/test_core.py | l/tests/test_core.py | from textwrap import dedent
from unittest import TestCase
from bp.memory import MemoryFS, MemoryPath
from l import core
class TestShow(TestCase):
def setUp(self):
self.fs = MemoryFS()
self.root = MemoryPath(fs=self.fs, path=("test-dir",))
self.root.createDirectory()
def assertShows(... | from textwrap import dedent
from unittest import TestCase
from bp.memory import MemoryFS, MemoryPath
from l.core import ls, show
class TestLS(TestCase):
def setUp(self):
self.fs = MemoryFS()
self.root = MemoryPath(fs=self.fs, path=("test-dir",))
self.root.createDirectory()
def test_... | mit | Python |
c24ab1e493df5f28626f4be5df3685d59bd5e9c8 | add wiki families for pwb user-config | yuvipanda/paws,yuvipanda/paws | images/singleuser/user-config.py | images/singleuser/user-config.py | import os
mylang = 'test'
family = 'wikipedia'
custom_path = os.path.expanduser('~/user-config.py')
if os.path.exists(custom_path):
with open(custom_path, 'rb') as f:
exec(compile(f.read(), custom_path, 'exec'), globals())
del f
# Clean up temp variables, since pwb issues a warning otherwise
# to he... | import os
mylang = 'test'
family = 'wikipedia'
custom_path = os.path.expanduser('~/user-config.py')
if os.path.exists(custom_path):
with open(custom_path, 'rb') as f:
exec(compile(f.read(), custom_path, 'exec'), globals())
del f
# Clean up temp variables, since pwb issues a warning otherwise
# to he... | mit | Python |
af2455162326aab135a627f524827e6034838a98 | Fix hpo_id in tests | cumc-dbmi/pmi_sprint_reporter | tests/test_reporter.py | tests/test_reporter.py | import settings
import unittest
import reporter
import os
class TestReporter(unittest.TestCase):
def example_path(self, filename):
return os.path.join(settings.example_path, filename)
def check_error(self, r, message, actual, expected=None):
self.assertFalse(r['passed'])
self.assertTr... | import settings
import unittest
import reporter
import os
class TestReporter(unittest.TestCase):
def example_path(self, filename):
return os.path.join(settings.example_path, filename)
def check_error(self, r, message, actual, expected=None):
self.assertFalse(r['passed'])
self.assertTr... | mit | Python |
e1dc7892aae2f4a836fabcf7681e86e504078817 | Print the SBDebugger.CreateTarget error message. | llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb | packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py | packages/Python/lldbsuite/test/macosx/find-app-in-bundle/TestFindAppInBundle.py | """
Make sure we can find the binary inside an app bundle.
"""
from __future__ import print_function
import os
import time
import re
import lldb
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil
import lldbsuite.test.lldbplatformutil as lldbplatformutil
from lldbsuite.test.lldbtest i... | """
Make sure we can find the binary inside an app bundle.
"""
from __future__ import print_function
import os
import time
import re
import lldb
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil
import lldbsuite.test.lldbplatformutil as lldbplatformutil
from lldbsuite.test.lldbtest i... | apache-2.0 | Python |
8f7a70923a83d97d73870cb2dc24922e3d6c587c | Fix migration script. | Mirantis/swift-encrypt,Mirantis/swift-encrypt | swift/common/key_manager/drivers/sql/migrate_repo/versions/001_Initialize_tables.py | swift/common/key_manager/drivers/sql/migrate_repo/versions/001_Initialize_tables.py | # Copyright (c) 2010-2012 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | # Copyright (c) 2010-2012 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | apache-2.0 | Python |
5eae667bd5d872e548a1143a2fddc0f2e6ba1b96 | remove doc_types from test_count | elastic/elasticsearch-dsl-py,3lnc/elasticsearch-dsl-py | test_elasticsearch_dsl/test_integration/test_count.py | test_elasticsearch_dsl/test_integration/test_count.py | from elasticsearch_dsl.search import Search, Q
def test_count_all(data_client):
s = Search(using=data_client).index('git')
assert 53 == s.count()
def test_count_filter(data_client):
s = Search(using=data_client).index('git').filter(~Q('exists', field='parent_shas'))
# initial commit + repo document
... | from elasticsearch_dsl.search import Search, Q
def test_count_all(data_client):
s = Search(using=data_client).index('git')
assert 53 == s.count()
def test_count_type(data_client):
s = Search(using=data_client).index('git').doc_type('repos')
assert 1 == s.count()
def test_count_filter(data_client):
... | apache-2.0 | Python |
38dc67a5818a3fdc78f621bf0f3e6358e02e36a8 | add eros to __init__.py | cameronbracken/ulmo,nathanhilbert/ulmo,ocefpaf/ulmo,ocefpaf/ulmo,cameronbracken/ulmo,nathanhilbert/ulmo | ulmo/usgs/__init__.py | ulmo/usgs/__init__.py | from . import eddn
from . import eros
from . import ned
from . import nwis
| from . import nwis
from . import eddn
from . import ned
| bsd-3-clause | Python |
00cca146c073b6bced44c7ed9efc7571fa5bff1d | enable test_json | eriol/circuits,eriol/circuits,treemo/circuits,nizox/circuits,eriol/circuits,treemo/circuits,treemo/circuits | tests/web/test_json.py | tests/web/test_json.py | #!/usr/bin/env python
import pytest
from json import loads
from circuits.web import JSONController, Sessions
from .helpers import urlopen, build_opener, HTTPCookieProcessor
from .helpers import CookieJar
class Root(JSONController):
def index(self):
return {"success": True, "message": "Hello World!"}
... | #!/usr/bin/env python
import pytest
from json import loads
from circuits.web import JSONController, Sessions
from .helpers import urlopen, build_opener, HTTPCookieProcessor
from .helpers import CookieJar
class Root(JSONController):
def index(self):
return {"success": True, "message": "Hello World!"}
... | mit | Python |
c0924c131a32ca78ea5a9497adb34a40829f7657 | Bump to version 0.7.1 | adelq/thermopy | thermochem/__init__.py | thermochem/__init__.py | __version__ = '0.7.1'
| __version__ = '0.7.0'
| bsd-3-clause | Python |
af60b65b1b40c06dbf76ee2cb9bbfaeb20d655f5 | Update settings.py | ioiogoo/scrapy-monitor,ioiogoo/scrapy-monitor | visiter/visiter/monitor/settings.py | visiter/visiter/monitor/settings.py | # *-* coding:utf-8 *-*
'''
@author: ioiogoo
@date: 2016/12/26 11:48
'''
'''
TIMEINTERVAL 刷新时间间隔,单位毫秒
POINTINTERVAL 图上各点之间间隔,越小则表示点越密集
POINTLENGTH 图上点的数量,越大则表示图上时间跨度越长
STATS_KEYS 图上显示的stats_key
REDIS_HOST redis地址
REDIS_PORT redis端口
REDIS_DB ... | # *-* coding:utf-8 *-*
'''
@author: ioiogoo
@date: 2016/12/26 11:48
'''
'''
TIMEINTERVAL 刷新时间间隔,单位毫秒
POINTINTERVAL 图上各点之间间隔,越大则表示点越密集
POINTLENGTH 图上点的数量,越大则表示图上时间跨度越长
STATS_KEYS 图上显示的stats_key
REDIS_HOST redis地址
REDIS_PORT redis端口
REDIS_DB ... | mit | Python |
4f396cb33bb3e5d8c2b0f75d5f1f6e4daa4cabed | remove overzelous imports | gallantlab/pycortex,gallantlab/pycortex,gallantlab/pycortex,gallantlab/pycortex,gallantlab/pycortex | cortex/polyutils/__init__.py | cortex/polyutils/__init__.py |
from .distortion import Distortion
from .misc import (
tetra_vol,
brick_vol,
sort_polys,
face_area,
face_volume,
decimate,
inside_convex_poly,
make_cube,
boundary_edges,
trace_poly,
rasterize,
voxelize,
measure_volume,
marching_cubes,
)
from .surface import Surfa... |
from .distortion import *
from .misc import *
from .surface import *
| bsd-2-clause | Python |
cfcda3f4a1272d8469f2dc604a8afc585929b0eb | Fix a typo | vladimirgamalian/pictools | resize.py | resize.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import click
from PIL import Image
from utils.misc import get_file_list
import re
def validate_dim(ctx, param, value):
percents = False
if value.endswith('%'):
value = value[:-1]
percents = True
if not re.match(r'^\d{1,6}(\.\d{1,6})?$', value)... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import click
from PIL import Image
from utils.misc import get_file_list
import re
def validate_dim(ctx, param, value):
percents = False
if value.endswith('%'):
value = value[:-1]
percents = True
if not re.match(r'^\d{1,6}(\.\d{1,6})?$', value)... | mit | Python |
7b40f7c061825d0fc58c455f7bc7f7eebd5111d3 | Add omitted license header to python script | TBastiani/ResToC,TBastiani/ResToC | restoc.py | restoc.py | #!/usr/bin/env python27
# Copyright (c) 2014, Thomas Bastiani
# 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 copyright
# notice, ... | #!/usr/bin/env python27
import sys
import json
import os
def printUsage():
print("Usage:")
print("\t./bintoc.py <resource_config.json> <resources_gen.c>")
exit(-1)
# Validate arguments
if len(sys.argv) != 3:
printUsage()
# Read JSON
with open(sys.argv[1], "r") as jsonFile:
jsonStr = jsonFile.read()
resourceDes... | bsd-3-clause | Python |
a1149ca7f9c85eaf65422151053287590132f34d | Fix wiki generation. | jelmer/subvertpy,jelmer/subvertpy | wiki.py | wiki.py | #!/usr/bin/python
# Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
# This program 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 Software Foundation; either version 3 of the License, or
# (at your option) any later versi... | #!/usr/bin/python
# Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
# This program 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 Software Foundation; either version 3 of the License, or
# (at your option) any later versi... | lgpl-2.1 | Python |
b4f30041bc514c5dc4c5ac1a5b6ab76ec8890359 | fix to the IRSA test, again. Seriously? | ceb8/astroquery,imbasimba/astroquery,ceb8/astroquery,imbasimba/astroquery | astroquery/tests/test_irsa.py | astroquery/tests/test_irsa.py | import astroquery.irsa
import numpy as np
import distutils.version as dv
import pytest
@pytest.mark.skipif(dv.StrictVersion(np.__version__) <= dv.StrictVersion("1.4.1"))
def test_trivial():
""" just make sure it doesn't raise anything
takes about 3-5 seconds"""
tbl = astroquery.irsa.query_gator_box('pt_sr... | import astroquery.irsa
import distutils.version as dv
import pytest
@pytest.mark.skipif(dv.StrictVersion(np.__version__) <= dv.StrictVersion("1.4.1"))
def test_trivial():
""" just make sure it doesn't raise anything
takes about 3-5 seconds"""
tbl = astroquery.irsa.query_gator_box('pt_src_cat','83.808 -5.3... | bsd-3-clause | Python |
b6a3ffe6933f20587d0f5e8476557dc552220bd4 | fix flake8 warning | tsuru/varnishapi,tsuru/varnishapi | wsgi.py | wsgi.py | # Copyright 2014 varnishapi authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from api import api
application = api
| # Copyright 2014 varnishapi authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from api import api as application
| bsd-3-clause | Python |
a1679be616d6d0d6ee807a708690549ec1798d04 | Improve runtime by using an array of diffs | rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank | python/array_manipulation.py | python/array_manipulation.py | #!/bin/python3
import math
import os
import random
import re
import sys
def arrayManipulation(n, queries):
# An array used to capture the difference of an element
# compared to the previous element.
# Therefore the value of diffs[n] after all array manipulations is
# the cumulative sum of values from... | #!/bin/python3
import math
import os
import random
import re
import sys
def arrayManipulation(n, queries):
array = [0] * n
for a, b, k in queries:
# Start is a - 1 because this is a one indexed array
for i in range(a - 1, b):
array[i] += k
print(array)
return max(a... | mit | Python |
43c90fa4543c923170fb8881071f85abaf9b803b | Change wsgi imports | nomadenorg/nomads,nomadenorg/nomads,nomadenorg/nomads,nomadenorg/nomads | wsgi.py | wsgi.py | from nomaden import app
if __name__ == "__main__":
# initialize the log handler
log_handler = RotatingFileHandler(config.get('app', 'logpath', 0), maxBytes=10000, backupCount=1)
# set the log handler level
log_handler.setLevel(logging.INFO)
# set the app logger level
app.logger.setLevel(l... | from app import app
if __name__ == "__main__":
# initialize the log handler
log_handler = RotatingFileHandler(config.get('app', 'logpath', 0), maxBytes=10000, backupCount=1)
# set the log handler level
log_handler.setLevel(logging.INFO)
# set the app logger level
app.logger.setLevel(loggi... | agpl-3.0 | Python |
333fc965b492ff8cc1e5972812113beb6f0a840b | change return value placeholder | bryanapperson/stanford-algorithms | stanford_algorithms/count_split_inversions.py | stanford_algorithms/count_split_inversions.py | import sys
def file_to_list(fname):
"""Read a file and return a list newlines stripped and casted to int.
:param fname: name of the file to read"""
with open(fname) as f:
content = [int(x.strip('\n')) for x in f.readlines()]
return content
def count_split_inversions(count_array):
""... | import sys
def file_to_list(fname):
"""Read a file and return a list newlines stripped and casted to int.
:param fname: name of the file to read"""
with open(fname) as f:
content = [int(x.strip('\n')) for x in f.readlines()]
return content
def count_split_inversions(count_array):
""... | mit | Python |
9ecc4c6810aa08295d6c178441705f086635d8ae | implement get_form_class and get_generic_name on TestBackend | qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,SE... | corehq/apps/sms/backend/test.py | corehq/apps/sms/backend/test.py | from corehq.apps.sms.forms import BackendForm
from corehq.apps.sms.mixin import SMSBackend
from dimagi.utils.couch.database import get_safe_write_kwargs
from couchdbkit.ext.django.schema import *
# TODO: What uses this? There already is a test backend
class TestBackend(SMSBackend):
to_console = BooleanProperty(de... | from corehq.apps.sms.mixin import SMSBackend
from dimagi.utils.couch.database import get_safe_write_kwargs
from couchdbkit.ext.django.schema import *
# TODO: What uses this? There already is a test backend
class TestBackend(SMSBackend):
to_console = BooleanProperty(default=False)
@classmethod
def get_api... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.