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 |
|---|---|---|---|---|---|---|---|---|
e67dc6d0cb46bcce0750246f99c6f99cd3e1ccbc | fix tempita.py for distutils build | matthew-brett/scipy,matthew-brett/scipy,matthew-brett/scipy,matthew-brett/scipy,matthew-brett/scipy | scipy/_build_utils/tempita.py | scipy/_build_utils/tempita.py | import sys
import os
import argparse
from Cython import Tempita as tempita
# XXX: If this import ever fails (does it really?), vendor either
# cython.tempita or numpy/npy_tempita.
def process_tempita(fromfile, outfile=None):
"""Process tempita templated file and write out the result.
The template file is ex... | import sys
import os
import argparse
from Cython import Tempita as tempita
# XXX: If this import ever fails (does it really?), vendor either
# cython.tempita or numpy/npy_tempita.
def process_tempita(fromfile, outfile=None):
"""Process tempita templated file and write out the result.
The template file is ex... | bsd-3-clause | Python |
c5bf1d02c9db4adb00dad2d8bd37c1303f846837 | Reduce import time (pythainlp/augment.word2vec.bpemb_wv) | PyThaiNLP/pythainlp | pythainlp/augment/word2vec/bpemb_wv.py | pythainlp/augment/word2vec/bpemb_wv.py | # -*- coding: utf-8 -*-
from pythainlp.augment.word2vec.core import Word2VecAug
from typing import List, Tuple
class BPEmbAug:
"""
Thai Text Augment using word2vec from BPEmb
BPEmb:
`github.com/bheinzerling/bpemb <https://github.com/bheinzerling/bpemb>`_
"""
def __init__(self, lang: str = "th... | # -*- coding: utf-8 -*-
from pythainlp.augment.word2vec.core import Word2VecAug
from bpemb import BPEmb
from typing import List, Tuple
class BPEmbAug:
"""
Thai Text Augment using word2vec from BPEmb
BPEmb:
`github.com/bheinzerling/bpemb <https://github.com/bheinzerling/bpemb>`_
"""
def __init... | apache-2.0 | Python |
c489157661b5738f37c5213f64736d7e88a0700b | Update application_filter.py | Tlinne2/Basic-Python-Projects- | Data-Science-Tools/application_filter.py | Data-Science-Tools/application_filter.py | '''
Decision Tree V.1
Simple tool for a company to screen applications in the hiring process
Coded By: Tyler Linne
Date: 4/27/16
'''
#Import required packages
import numpy as np
import pandas as pd
import pydot
from sklearn import tree
from IPython.display import Image
from sklearn.externals.six import StringIO... | '''
Decision Tree V.1
Simple tool for a company to screen applications in the hiring process
Coded By: Tyler Linne
Date: 4/27/16
'''
#Import required packages
import numpy as np
import pandas as pd
import pydot
from sklearn import tree
from IPython.display import Image
from sklearn.externals.six import StringIO... | mit | Python |
bfa1a36d1c731f730cabbc914d52c51d5ddf61dc | Add token auth and session | digitalhealthhack/evas,digitalhealthhack/evas | api/evas_api/settings.py | api/evas_api/settings.py | import os
import dj_database_url
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = '-@y4mtyhs=i-uc7q9b==ur(zhs%gu628wtku%q8d8$-vp1qbza'
DEBUG = bool(os.environ.get('DEBUG', False))
TEMPLATE_DEBUG = bool(os.environ.get('TEMPLATE_DEBUG', False))
DATABASES = {'default': dj_database_url.config(default... | import os
import dj_database_url
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = '-@y4mtyhs=i-uc7q9b==ur(zhs%gu628wtku%q8d8$-vp1qbza'
DEBUG = bool(os.environ.get('DEBUG', False))
TEMPLATE_DEBUG = bool(os.environ.get('TEMPLATE_DEBUG', False))
DATABASES = {'default': dj_database_url.config(default... | mit | Python |
130ce365a0d7c709004da5dedf0e0e35ff6ad3d0 | Fix reference error and add script for packing pypi package (#1172) | intel-analytics/BigDL,yangw1234/BigDL,yangw1234/BigDL,intel-analytics/BigDL,intel-analytics/BigDL,yangw1234/BigDL,yangw1234/BigDL,intel-analytics/BigDL | python/dllib/src/bigdl/utils/engine.py | python/dllib/src/bigdl/utils/engine.py | #
# Copyright 2016 The BigDL 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | #
# Copyright 2016 The BigDL 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | apache-2.0 | Python |
b0a948e2036ff232c2026e742a42ab9e9c4fbc07 | Drop unused IndexTypeVar | ecmwf/cfgrib | cfgrib/abc.py | cfgrib/abc.py | """Abstract Base Classes for GRIB messsages and containers"""
import abc
import typing as T
MessageIdTypeVar = T.TypeVar("MessageIdTypeVar")
MessageTypeVar = T.TypeVar("MessageTypeVar", bound="Message")
Message = T.Mapping[str, T.Any]
MutableMessage = T.MutableMapping[str, T.Any]
Container = T.Mapping[MessageIdTypeVa... | """Abstract Base Classes for GRIB messsages and containers"""
import abc
import typing as T
MessageIdTypeVar = T.TypeVar("MessageIdTypeVar")
MessageTypeVar = T.TypeVar("MessageTypeVar", bound="Message")
IndexTypeVar = T.TypeVar("IndexTypeVar", bound="Index") # type: ignore
Message = T.Mapping[str, T.Any]
MutableMess... | apache-2.0 | Python |
54f978c3ed960997b8a5fa9f0e443b17e702ec85 | Update build_flags to point to proper libdir | scanner-research/scanner,scanner-research/scanner,scanner-research/scanner,scanner-research/scanner | python/scannerpy/stdlib/build_flags.py | python/scannerpy/stdlib/build_flags.py | import os.path
import sys
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
def get_include():
return os.path.abspath(os.path.join(SCRIPT_DIR, '..', 'include'))
def print_include():
sys.stdout.write(get_include())
def get_lib():
return os.path.abspath(os.path.join(SCRIPT_DIR, '..', 'lib'))
def p... | import os.path
import sys
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
def get_include():
return os.path.abspath(os.path.join(SCRIPT_DIR, '..', 'include'))
def print_include():
sys.stdout.write(get_include())
def get_lib():
return os.path.abspath(os.path.join(SCRIPT_DIR, '..'))
def print_li... | apache-2.0 | Python |
2027d3347a839ca30abbcb778b34b3f261b266ef | Update Naive Bayes classifier | rushter/MLAlgorithms | mla/naive_bayes.py | mla/naive_bayes.py | import numpy as np
from mla.base import BaseEstimator
from mla.neuralnet.activations import softmax
class NaiveBayesClassifier(BaseEstimator):
"""Gaussian Naive Bayes."""
# Binary problem.
n_classes = 2
def fit(self, X, y=None):
self._setup_input(X, y)
# Check target labels
as... | import numpy as np
from mla.base import BaseEstimator
from mla.neuralnet.activations import softmax
class NaiveBayesClassifier(BaseEstimator):
"""Gaussian Naive Bayes."""
# Binary problem.
n_classes = 2
def fit(self, X, y=None):
self._setup_input(X, y)
# Check target labels
as... | mit | Python |
fd5c84a1272ded54afaa6323fc10c637474096a3 | Increment version to 0.2.5 | tdpreece/ApprovalTests.Python,approvals/ApprovalTests.Python,approvals/ApprovalTests.Python,approvals/ApprovalTests.Python | approvaltests/version.py | approvaltests/version.py | version_number = "0.2.5"
| version_number = "0.2.4"
| apache-2.0 | Python |
fee8e6371c2884ba8cdc587ecae06093e5f6e4de | restructure python 2 to use a generator | lunixbochs/project-euler,lunixbochs/project-euler,lunixbochs/project-euler,lunixbochs/project-euler,lunixbochs/project-euler,lunixbochs/project-euler,lunixbochs/project-euler,lunixbochs/project-euler,lunixbochs/project-euler,lunixbochs/project-euler,lunixbochs/project-euler,lunixbochs/project-euler,lunixbochs/project-e... | 01-50/02/2.py | 01-50/02/2.py | def fib():
a, b = 0, 1
while True:
yield b
a, b = b, a + b
total = 0
i = 0
for i in fib():
if i >= 4000000:
break
if i % 2 == 0:
total += i
print total
| a, b = 0, 1
total = 0
while b < 4000000:
a, b = b, a + b
if b % 2 == 0:
total += b
print total
| mit | Python |
51fa99659a0b975175a0a33ace21021de7de4b45 | Add load_json | Mause/statistical_atlas_of_au | saau/sections/image_provider.py | saau/sections/image_provider.py | import json
import inspect
from os.path import join, exists
def not_implemented():
frame_info = inspect.currentframe().f_back
msg = ''
if 'self' in frame_info.f_locals:
self = frame_info.f_locals['self']
try:
msg += self.__name__ + '#' # for static/class methods
excep... | import json
import inspect
from os.path import join, exists
def not_implemented():
frame_info = inspect.currentframe().f_back
msg = ''
if 'self' in frame_info.f_locals:
self = frame_info.f_locals['self']
try:
msg += self.__name__ + '#' # for static/class methods
excep... | mit | Python |
ee50bea2810676ef655e7ea57565070f7e715741 | Validate quotation is non-empty before allowing conversion to template. | OpusVL/odoo-sale-extras | sale_template_quotation/sale.py | sale_template_quotation/sale.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Template Quotations
# Copyright (C) 2015 OpusVL (<http://opusvl.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
# p... | # -*- coding: utf-8 -*-
##############################################################################
#
# Template Quotations
# Copyright (C) 2015 OpusVL (<http://opusvl.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
# p... | agpl-3.0 | Python |
a537f049bfb61488a056333d362d9983e8e9f88d | Fix minor issues in 2020.10.1 file | foxscotch/advent-of-code,foxscotch/advent-of-code | 2020/10/p1.py | 2020/10/p1.py | # Python 3.8.3
def get_input():
with open('input.txt', 'r') as f:
return set(int(i) for i in f.read().split())
def main():
puzzle = get_input()
last_joltage = 0
one_jolt = 0
three_jolts = 1
while len(puzzle) != 0:
if last_joltage + 1 in puzzle:
last_joltage = last_... | # Python 3.8.3
def get_input():
with open('input.txt', 'r') as f:
return set(int(i) for i in f.read().split())
def main():
puzzle = get_input()
last_joltage = 0
one_jolt = 0
three_jolts = 1 # this is bad lmao
while len(puzzle) != 0:
if last_joltage + 1 in puzzle:
... | mit | Python |
b51e51dc8b1ce66815980bf2e8424f6fe282af66 | test type declare with resolve | Evgenus/metaconfig | metaconfig/tests/test_simple.py | metaconfig/tests/test_simple.py | from nose.tools import *
from io import StringIO
from textwrap import dedent
from metaconfig import Config
def test_declare_empty():
source = """
--- !declare {}
...
"""
config = Config()
with StringIO(dedent(source)) as stream:
config.load(stream)
def test_declare_resolve():
... | from nose.tools import *
from io import StringIO
from textwrap import dedent
from metaconfig import Config
def test_declare_empty():
source = """
--- !declare {}
...
"""
config = Config()
with StringIO(dedent(source)) as stream:
config.load(stream)
| mit | Python |
60b4fc88617f800208f00f24468db6798369fe2e | Add user-supplied arguments in log_handler | gkotton/vmware-nsx,gkotton/vmware-nsx | neutron/openstack/common/log_handler.py | neutron/openstack/common/log_handler.py | # Copyright 2013 IBM Corp.
#
# 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 t... | # Copyright 2013 IBM Corp.
#
# 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 t... | apache-2.0 | Python |
80176ae73fc9843f63aca68306523da822d0b258 | add "group" property to devices | Sirs0ri/PersonalAssistant | samantha/plugins/plugin.py | samantha/plugins/plugin.py | """Contains a baseclass for plugins."""
###############################################################################
#
# TODO: [ ] default methods
#
###############################################################################
# standard library imports
import logging
# related third party imports
# applicati... | """Contains a baseclass for plugins."""
###############################################################################
#
# TODO: [ ] default methods
#
###############################################################################
# standard library imports
import logging
# related third party imports
# applicati... | mit | Python |
586d5f34fc508d4a3eaa93bd39c5dc2b41e4878d | Migrate api7 to api8 | ClearCorp/odoo-clearcorp,sysadminmatmoz/odoo-clearcorp,ClearCorp-dev/odoo-clearcorp,ClearCorp-dev/odoo-clearcorp,ClearCorp/odoo-clearcorp,sysadminmatmoz/odoo-clearcorp,ClearCorp-dev/odoo-clearcorp,sysadminmatmoz/odoo-clearcorp,ClearCorp-dev/odoo-clearcorp,ClearCorp/odoo-clearcorp,sysadminmatmoz/odoo-clearcorp,ClearCorp... | project_task_state/project_task_state.py | project_task_state/project_task_state.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... | agpl-3.0 | Python |
c3d7e7fdcbea0fc34bfa6d9d517efc4d54dc0b15 | add file extension | timothydmorton/qa_explorer,timothydmorton/qa_explorer | scripts/generateQANotebook.py | scripts/generateQANotebook.py | import argparse
import os
parser = argparse.ArgumentParser()
parser.add_argument('repo', help='data repository')
parser.add_argument('--tract', type=int)
parser.add_argument('--filt', type=str)
parser.add_argument('--output', '-o', default='QA', help='output folder')
args = parser.parse_args()
from explorer.noteboo... | import argparse
import os
parser = argparse.ArgumentParser()
parser.add_argument('repo', help='data repository')
parser.add_argument('--tract', type=int)
parser.add_argument('--filt', type=str)
parser.add_argument('--output', '-o', default='QA', help='output folder')
args = parser.parse_args()
from explorer.noteboo... | mit | Python |
1f5bdf4ce98d55339bee0aad16f40439d8a99a33 | Upgrade to the most recent version of buildkit. | kgaughan/zoicon-issues | buildkit.py | buildkit.py | """
Common code used in my setup.py files.
"""
from __future__ import with_statement
import os.path
import sys
def read(*filenames):
"""Read files relative to the executable."""
files = []
for filename in filenames:
full_path = os.path.join(os.path.dirname(sys.argv[0]), filename)
with op... | """
Common code used in my setup.py files.
"""
from __future__ import with_statement
import re
import os.path
import sys
def read(filename):
"""Read files relative to this file."""
full_path = os.path.join(os.path.dirname(sys.argv[0]), filename)
with open(full_path, 'r') as fh:
return fh.read()
... | mit | Python |
0ba69643331f769116fbda0660377f08b0291e6a | Update searchAndStoreTweets.py | MichaelCurrin/twitterverse,MichaelCurrin/twitterverse | app/utils/insert/searchAndStoreTweets.py | app/utils/insert/searchAndStoreTweets.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Search and Store Tweets utility.
Search for tweets in the Twitter API for given input terms, then store
the tweet and the tweet's author data locally, updating or adding objects
as required.
Send search terms as arguments to the command-line tool to search for
them. ... | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
"""
import os
import sys
#import time
# Allow imports to be done when executing this file directly.
appDir = os.path.abspath(os.path.join(os.path.dirname(__file__),
os.path.pardir, os.path.pardir))
sys.path.insert(0, appDir)
fro... | mit | Python |
28adc3fbce76a562e729aef3ae19bdefd3379586 | add taxonomy information to loaded sequences | ctSkennerton/BioSQL-Extensions | scripts/load_into_database.py | scripts/load_into_database.py | #!/usr/bin/env python
import sys
import argparse
from BioSQL import BioSeqDatabase
from Bio import SeqIO
def add_taxid(inIter, taxid):
inIter.annotations['ncbi_taxid'] = taxid
yield inIter
def load_gff(db, gff_file, fasta_file, fetch_taxonomy=False, taxid=None):
from BCBio.GFF import GFFParser
with op... | #!/usr/bin/env python
import sys
import argparse
from BioSQL import BioSeqDatabase
from Bio import SeqIO
def load_gff(db, gff_file, fasta_file):
from BCBio.GFF import GFFParser
with open(fasta_file) as seq_handle:
seq_dict = SeqIO.to_dict(SeqIO.parse(seq_handle, "fasta"))
parser = GFFParser()
... | mit | Python |
93b52ac533086bfa1747c2f3e10ca98d9e666197 | Stop sending stepFinished updates from the tryserver. | eunchong/build,eunchong/build,eunchong/build,eunchong/build | scripts/master/status_push.py | scripts/master/status_push.py | # Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import os
import urlparse
from buildbot.status import status_push
CR_PASSWORD_FILE = '.code_review_password'
class TryServerHttpStatus... | # Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import os
import urlparse
from buildbot.status import status_push
CR_PASSWORD_FILE = '.code_review_password'
class TryServerHttpStatus... | bsd-3-clause | Python |
4748a68b6bde662245b85ecf2a52fbedffc4ffcb | Remove exception handling. | ibmibmibm/beets,beetbox/beets,shamangeorge/beets,jackwilsdon/beets,sampsyo/beets,shamangeorge/beets,beetbox/beets,jackwilsdon/beets,SusannaMaria/beets,shamangeorge/beets,ibmibmibm/beets,ibmibmibm/beets,jackwilsdon/beets,SusannaMaria/beets,sampsyo/beets,shamangeorge/beets,SusannaMaria/beets,sampsyo/beets,jackwilsdon/bee... | beetsplug/sonosupdate.py | beetsplug/sonosupdate.py | # -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2018, Tobias Sauerwein.
#
# 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... | # -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2018, Tobias Sauerwein.
#
# 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... | mit | Python |
77ddff664ad1e10037a43c3ffabd816387c35e42 | Use a comprehension instead of a lambda function | CubicComet/exercism-python-solutions | rotational-cipher/rotational_cipher.py | rotational-cipher/rotational_cipher.py | import string
UPPER = string.ascii_uppercase
LOWER = string.ascii_lowercase
def rotate(s, n):
rules = shift_rules(n)
return "".join(rules.get(ch, ch) for ch in s)
def shift_rules(n):
shifted = UPPER[n:] + UPPER[:n] + LOWER[n:] + LOWER[:n]
return {k:v for k,v in zip(UPPER+LOWER, shifted)}
| import string
UPPER = string.ascii_uppercase
LOWER = string.ascii_lowercase
def rotate(s, n):
rules = shift_rules(n)
return "".join(map(lambda k: rules.get(k, k), s))
def shift_rules(n):
shifted = UPPER[n:] + UPPER[:n] + LOWER[n:] + LOWER[:n]
return {k:v for k,v in zip(UPPER+LOWER, shifted)}
| agpl-3.0 | Python |
25beb8ce9f21d5ef5255304700a76ed2d7aaa425 | Add initial solution | CubicComet/exercism-python-solutions | rotational-cipher/rotational_cipher.py | rotational-cipher/rotational_cipher.py | import string
UPPER = string.ascii_uppercase
LOWER = string.ascii_lowercase
def rotate(s, n):
return "".join(rot_gen(s,n))
def shift_rules(n):
shifted = UPPER[n:] + UPPER[:n] + LOWER[n:] + LOWER[:n]
return {k:v for k,v in zip(UPPER+LOWER, shifted)}
def rot_gen(s, n):
rules = shift_rules(n)
f... | def rotate():
pass
| agpl-3.0 | Python |
644f66a39fd59b1983eee6f127e13e1585a598cd | Fix breakages from girder-client v2.0 | Kitware/candela,Kitware/candela,Kitware/candela,Kitware/candela,Kitware/candela | script/upload-test-images.py | script/upload-test-images.py | import girder_client
import os
import sys
def main():
# Use the API key to authenticate.
key = os.environ.get("GIRDER_API_KEY")
if key is None:
print >>sys.stderr, "Environment variable GIRDER_API_KEY is blank. Cannot upload images."
return 1
gc = girder_client.GirderClient(host="data... | import girder_client
import os
import sys
def main():
# Use the API key to authenticate.
key = os.environ.get("GIRDER_API_KEY")
if key is None:
print >>sys.stderr, "Environment variable GIRDER_API_KEY is blank. Cannot upload images."
return 1
gc = girder_client.GirderClient(host="data... | apache-2.0 | Python |
9b0612b0a4d5c483013311d7c7814cc268609cb0 | Fix URL in setup.py | byxorna/collins,tumblr/collins,discordianfish/collins,tumblr/collins,tumblr/collins,discordianfish/collins,funzoneq/collins,byxorna/collins,byxorna/collins,box/collins,box/collins,discordianfish/collins,byxorna/collins,tumblr/collins,funzoneq/collins,funzoneq/collins,tumblr/collins,defect/collins,defect/collins,byxorna... | support/python/collins_client/setup.py | support/python/collins_client/setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(name="collins_client",
version="0.1.0",
description="The python interface to the collins api.",
author="John Bunting, Nick Thuesen, Nick Sauro, Will Richard",
author_email="opensourcesoftware@tumblr.com",
url="https:... | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(name="collins_client",
version="0.1.0",
description="The python interface to the collins api.",
author="John Bunting, Nick Thuesen, Nick Sauro, Will Richard",
author_email="opensourcesoftware@tumblr.com",
url="https:... | apache-2.0 | Python |
e69f45ecc3ee23be203136be02e9648a4930a3e8 | Make test.py use difflib instead of filecmp. | mitni455/psdump,mitni455/psdump,alco/psdump,alco/psdump,eric-seekas/psdump,mitni455/psdump,alco/psdump,eric-seekas/psdump,alco/psdump,eric-seekas/psdump,mitni455/psdump,eric-seekas/psdump | test/test.py | test/test.py | # -*- coding: utf-8 -*-
import os
import sys
import filecmp
import difflib
from subprocess import call
def run_test(fmt, sample, arg):
psdump = "../build/psdump -o temp -f {0} {1}".format(fmt, arg)
call(psdump.split())
with open("temp", "r") as temp_file:
temp_lines = temp_file.readlines()
... | # -*- coding: utf-8 -*-
import os
import sys
import filecmp
import tempfile
from subprocess import call
def run_test(fmt, sample, arg):
temp = tempfile.NamedTemporaryFile()
psdump = "../build/psdump -o {0} -f {1} {2}".format(temp.name, fmt, arg)
call(psdump.split())
if not filecmp.cmp(temp.name, samp... | mit | Python |
80c5f94f3c2ed02c8603d3eecea23cdb4711ae79 | Use hanging indent | antoinearnoud/openfisca-france,SophieIPP/openfisca-france,benjello/openfisca-france,SophieIPP/openfisca-france,adrienpacifico/openfisca-france,adrienpacifico/openfisca-france,benjello/openfisca-france,antoinearnoud/openfisca-france,sgmap/openfisca-france,sgmap/openfisca-france | openfisca_france/tests/test_tax_rates.py | openfisca_france/tests/test_tax_rates.py | # -*- coding: utf-8 -*-
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca is free software; you can redistribute it and/or modify
# it ... | # -*- coding: utf-8 -*-
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca is free software; you can redistribute it and/or modify
# it ... | agpl-3.0 | Python |
20e7453d143223ae1c95ad32ee49660ceeadf3f7 | Prepare for 1.1.0 | iffy/crudset | crudset/version.py | crudset/version.py | version = "1.1.0-dev"
| version = "1.0.0"
| apache-2.0 | Python |
4510db1e8f2fe3298de395a9d8b1e0783f92c758 | update revision | patochectp/navitia,CanalTP/navitia,CanalTP/navitia,Tisseo/navitia,patochectp/navitia,pbougue/navitia,kinnou02/navitia,Tisseo/navitia,kinnou02/navitia,pbougue/navitia,CanalTP/navitia,kinnou02/navitia,CanalTP/navitia,CanalTP/navitia,Tisseo/navitia,xlqian/navitia,pbougue/navitia,xlqian/navitia,xlqian/navitia,xlqian/naviti... | source/tyr/migrations/versions/1b59ffb421e4_change_max_nb_crowfly_by_mode_type.py | source/tyr/migrations/versions/1b59ffb421e4_change_max_nb_crowfly_by_mode_type.py | """change max_nb_crowfly_by_mode to JSONB and set server_default
Revision ID: 1b59ffb421e4
Revises: 483639f1f00
Create Date: 2018-08-30 12:42:21.089095
"""
# revision identifiers, used by Alembic.
revision = '1b59ffb421e4'
down_revision = '105823db902c'
from alembic import op
import sqlalchemy as sa
from sqlalchemy... | """change max_nb_crowfly_by_mode to JSONB and set server_default
Revision ID: 1b59ffb421e4
Revises: 483639f1f00
Create Date: 2018-08-30 12:42:21.089095
"""
# revision identifiers, used by Alembic.
revision = '1b59ffb421e4'
down_revision = '483639f1f00'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.... | agpl-3.0 | Python |
0e1c2dad600da595403ee893b787a29bdc38e215 | Bump to 2.1.1 | iffy/crudset | crudset/version.py | crudset/version.py | version = "2.1.1"
| version = "0.2.0-dev"
| apache-2.0 | Python |
513c7a2f5c5fb5a8c47b3173a8d5854755f7928f | Use factories instead of creating instance from model | python-dirbtuves/website,python-dirbtuves/website,python-dirbtuves/website | pylab/website/tests/test_about_page.py | pylab/website/tests/test_about_page.py | import datetime
from django_webtest import WebTest
from pylab.core.models import Event
from pylab.core.factories import EventFactory
class AboutPageTests(WebTest):
def test_no_events_on_about_page(self):
resp = self.app.get('/about/')
self.assertEqual(resp.status_int, 200)
self.assertTr... | import datetime
from django_webtest import WebTest
from django.contrib.auth.models import User
from pylab.core.models import Event
class AboutPageTests(WebTest):
def setUp(self):
self.user = User.objects.create(username='u1')
def test_no_events_on_about_page(self):
resp = self.app.get('/ab... | agpl-3.0 | Python |
c9ba9b8796de0802f7b941245cc41eb7d59ce7c8 | Normalize output path to cp.py | ChromiumWebApps/chromium,mohamed--abdel-maksoud/chromium.src,jaruba/chromium.src,Jonekee/chromium.src,ondra-novak/chromium.src,pozdnyakov/chromium-crosswalk,chuan9/chromium-crosswalk,M4sse/chromium.src,bright-sparks/chromium-spacewalk,crosswalk-project/chromium-crosswalk-efl,littlstar/chromium.src,Fireblend/chromium-cr... | build/cp.py | build/cp.py | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Copy a file.
This module works much like the cp posix command - it takes 2 arguments:
(src, dst) and copies the file with path ... | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Copy a file.
This module works much like the cp posix command - it takes 2 arguments:
(src, dst) and copies the file with path ... | bsd-3-clause | Python |
55c00fd6684d6fb378326026475945aea59bfa0b | Fix iterator to list | OPpuolitaival/pyosmo,OPpuolitaival/pyosmo | pyosmo/end_conditions/step_coverage.py | pyosmo/end_conditions/step_coverage.py | from pyosmo.end_conditions.base import OsmoEndCondition
class StepCoverage(OsmoEndCondition):
"""
Stops testing when count is filled
"""
def __init__(self, coverage_percent):
if coverage_percent > 100 or coverage_percent < 0:
raise Exception(f"Coverage is {coverage_percent} and it... | from pyosmo.end_conditions.base import OsmoEndCondition
class StepCoverage(OsmoEndCondition):
"""
Stops testing when count is filled
"""
def __init__(self, coverage_percent):
if coverage_percent > 100 or coverage_percent < 0:
raise Exception(f"Coverage is {coverage_percent} and it... | mit | Python |
544782d2da7fa918133c70ea4e9d0ffe918dcdb4 | Fix documentation for eval and change default display to False | jakelever/kindred,jakelever/kindred | kindred/evalFunctions.py | kindred/evalFunctions.py |
import kindred
from collections import Counter
def evaluate(goldCorpus,testCorpus,metric='f1score',display=False):
""" Compares the gold corpus with the test corpus and calculate appropriate metrics.
:param goldCorpus: The gold standard set of data
:param testCorpus: The test set for comparison
:param metric: W... |
import kindred
from collections import Counter
def evaluate(goldCorpus,testCorpus,metric='f1score',display=True):
""" Compares the gold corpus with the test corpus and calculate appropriate metrics.
:param goldCorpus: The gold standard set of data
:type goldCorpus: kindred.Corpus
:param testCorpus: The test set... | mit | Python |
95768a09d0bf7f6f3576fc28568c3b7897467541 | Add license | tensorflow/cloud,tensorflow/cloud | src/python/tensorflow_cloud/core/tests/examples/multi_file_example/scale_model.py | src/python/tensorflow_cloud/core/tests/examples/multi_file_example/scale_model.py | # Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | import tensorflow_cloud as tfc
tfc.run(
entry_point="train_model.py",
requirements_txt="requirements.txt",
stream_logs=True,
)
| apache-2.0 | Python |
6c2e00084fb11a6d37d55fed247d2e7b6a373823 | Fix dependencies. | OCA/partner-contact,BT-rmartin/partner-contact,OCA/partner-contact,BT-rmartin/partner-contact | partner_contact_nationality/__openerp__.py | partner_contact_nationality/__openerp__.py | # -*- encoding: utf-8 -*-
# Odoo, Open Source Management Solution
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
#
# 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 versio... | # -*- encoding: utf-8 -*-
# Odoo, Open Source Management Solution
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
#
# 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 versio... | agpl-3.0 | Python |
86d604f69ac0e42fb05ec84c3b20da03c7d7d109 | Fix lint error | wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api | scripts/download_oai_harvest.py | scripts/download_oai_harvest.py | #!/usr/bin/env python3
# -*- encoding: utf-8 -*-
"""
Standalone script for downloading the OAI-PMH for Calm.
The final output is dumped into a JSON file ``calm_records.json``, which
can be useful for doing bulk analysis of the Calm data.
"""
import collections
import json
import re
from urllib.parse import unquote
i... | #!/usr/bin/env python3
# -*- encoding: utf-8 -*-
"""
Standalone script for downloading the OAI-PMH for Calm.
The final output is dumped into a JSON file ``calm_records.json``, which
can be useful for doing bulk analysis of the Calm data.
"""
import collections
import json
import re
from urllib.parse import unquote
i... | mit | Python |
96b3904e64617d6c04b0e44506482cd264e28132 | use common method for permission checking | geometalab/osmaxx,geometalab/drf-utm-zone-info,geometalab/drf-utm-zone-info,geometalab/osmaxx,geometalab/osmaxx-frontend,geometalab/osmaxx,geometalab/osmaxx-frontend,geometalab/osmaxx-frontend,geometalab/osmaxx-frontend,geometalab/osmaxx | osmaxx-py/osmaxx/contrib/auth/frontend_permissions.py | osmaxx-py/osmaxx/contrib/auth/frontend_permissions.py | from django.conf import settings
from django.contrib.auth.decorators import login_required, user_passes_test
from django.core.urlresolvers import reverse_lazy
from django.utils.decorators import method_decorator
from rest_framework import permissions
FRONTEND_USER_GROUP = settings.OSMAXX_FRONTEND_USER_GROUP
def _may... | from django.conf import settings
from django.contrib.auth.decorators import login_required, user_passes_test
from django.core.urlresolvers import reverse_lazy
from django.utils.decorators import method_decorator
from rest_framework import permissions
FRONTEND_USER_GROUP = settings.OSMAXX_FRONTEND_USER_GROUP
def fron... | mit | Python |
e38e0b61b74316a171d49fa9390ecc736408694d | Simplify nanomsg sample | clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage | samples/nanomsg/hello_world_asyncio.py | samples/nanomsg/hello_world_asyncio.py | import asyncio
import sys
import nanomsg as nn
from nanomsg.asyncio import Socket
async def ping(url, ack):
with Socket(protocol=nn.NN_PUSH) as sock, sock.connect(url):
await sock.send(b'Hello, World!')
# Shutdown the endpoint after the other side ack'ed; otherwise
# the message could be ... | import asyncio
import sys
import nanomsg as nn
from nanomsg.asyncio import Socket
async def ping(url, barrier):
with Socket(protocol=nn.NN_PUSH) as sock, sock.connect(url):
await sock.send(b'Hello, World!')
# Shutdown the endpoint after the other side ack'ed; otherwise
# the message could... | mit | Python |
f3b6771c43042c599e57d3a26fa678518e12455d | Update jupyterlab/tests/mock_packages/interop/consumer/setup.py | jupyter/jupyterlab,jupyter/jupyterlab,jupyter/jupyterlab,jupyter/jupyterlab,jupyter/jupyterlab | jupyterlab/tests/mock_packages/interop/consumer/setup.py | jupyterlab/tests/mock_packages/interop/consumer/setup.py | import json
from glob import glob
import os.path as osp
name = 'jlab_mock_consumer'
HERE = osp.abspath(osp.dirname(__file__))
with open(osp.join(HERE, 'package.json')) as fid:
data = json.load(fid)
from setuptools import setup
js_name = data['name']
setup(name=name,
version=data['version'],
py_modu... | import json
from glob import glob
import os.path as osp
name = 'jlab_mock_consumer'
HERE = osp.abspath(osp.dirname(__file__))
with open(osp.join(HERE, 'package.json')) as fid:
data = json.load(fid)
from setuptools import setup
js_name = data['name']
setup(name=name,
version=data['version'],
py_modu... | bsd-3-clause | Python |
7c3d2f8afbc5c6d1dc7c719f97ca93ffb908d6ce | Add tests of tangential velocity. | harpolea/r3d2 | test_SR1d.py | test_SR1d.py | import eos_defns
import SR1d
from numpy.testing import assert_allclose
def test_standard_sod():
"""
Relativistic Sod test.
Numbers are taken from the General Matlab code, so accuracy isn't perfect.
"""
eos = eos_defns.eos_gamma_law(5.0/3.0)
w_left = SR1d.State(1.0, 0.0, 0.0, 1.5, eos, labe... | import eos_defns
import SR1d
from numpy.testing import assert_allclose
def test_standard_sod():
"""
Relativistic Sod test.
Numbers are taken from the General Matlab code, so accuracy isn't perfect.
"""
eos = eos_defns.eos_gamma_law(5.0/3.0)
w_left = SR1d.State(1.0, 0.0, 0.0, 1.5, eos, labe... | mit | Python |
1786702388abc4fe737ee73d64ef5864f42f0c3d | Fix missing offset for Query | SkygearIO/chat,SkygearIO/chat | chat/query.py | chat/query.py | # Copyright 2017 Oursky Ltd.
#
# 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 2017 Oursky Ltd.
#
# 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 |
c637eb216e9dc148a588019d22bc96db3565b3fc | Correct breakpoints | haricot/djangocms-bs4forcascade,haricot/djangocms-bs4forcascade | cmsplugin_bs4forcascade/bootstrap4/settings.py | cmsplugin_bs4forcascade/bootstrap4/settings.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.translation import ugettext_lazy as _
from cmsplugin_cascade.extra_fields.config import PluginExtraFieldsConfig
CASCADE_PLUGINS = getat... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.translation import ugettext_lazy as _
from cmsplugin_cascade.extra_fields.config import PluginExtraFieldsConfig
CASCADE_PLUGINS = getat... | mit | Python |
d11478f1ad2d6caf16aeff087f2399297eec83d2 | Improve qrcode generation, add proper error message to generate_uri assertion about secret length | keybar/keybar | src/keybar/utils/totp.py | src/keybar/utils/totp.py | import io
import urllib
import time
from base64 import b32encode
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.twofactor.totp import TOTP
from cryptography.hazmat.primitives.hashes import SHA1
from django.http import HttpResponse
from django.utils.encoding import force_by... | import io
import urllib
import time
from base64 import b32encode
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.twofactor.totp import TOTP
from cryptography.hazmat.primitives.hashes import SHA1
from django.http import HttpResponse
from django.utils.encoding import force_by... | bsd-3-clause | Python |
0a1700b64a2e496217dd0531ebe8326410fd6cdc | Update yamldumper.py | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/utils/yamldumper.py | salt/utils/yamldumper.py | # -*- coding: utf-8 -*-
'''
salt.utils.yamldumper
~~~~~~~~~~~~~~~~~~~~~
'''
from __future__ import absolute_import
try:
from yaml import CDumper as Dumper
except ImportError:
from yaml import Dumper
from salt.utils.odict import OrderedDict
class OrderedDumper(Dumper):
'''
A YAML dumper that... | # -*- coding: utf-8 -*-
'''
salt.utils.yamldumper
~~~~~~~~~~~~~~~~~~~~~
'''
from __future__ import absolute_import
try:
from yaml import CDumper as Dumper
except ImportError:
from yaml import CDumper as Dumper
from salt.utils.odict import OrderedDict
class OrderedDumper(Dumper):
'''
A YAML ... | apache-2.0 | Python |
91f54451fd149506abe57e31f45bc841f9e031ca | Fix unstoppable streaming | benbroce3/PiCamServer,benbroce3/PiCamServer,benbroce3/PiCamServer,benbroce3/PiCamServer | camerav4.py | camerav4.py | import picamera
from picamera import PiCamera
import time
from datetime import datetime
import os.path
from subprocess32 import Popen
print "\nSecurity Camera Logger v4 | Ben Broce & William Hampton\n"
print "Streams video to rtsp://pi-ip:8554/ | Captures to pics/[timestamp].jpg"
print "Ctrl-C quits.\n"
stream = raw_... | import picamera
from picamera import PiCamera
import time
from datetime import datetime
import os.path
from subprocess32 import Popen
print "\nSecurity Camera Logger v4 | Ben Broce & William Hampton\n"
print "Streams video to rtsp://pi-ip:8554/ | Captures to pics/[timestamp].jpg"
print "Ctrl-C quits.\n"
stream = raw_... | mit | Python |
643b8e034f6bdcc2d863f0dda99fa91b1eecb54c | Update __init__.py | dfm/corner.py | corner/__init__.py | corner/__init__.py | # -*- coding: utf-8 -*-
__version__ = "2.0.2.dev0"
__author__ = "Dan Foreman-Mackey (foreman.mackey@gmail.com)"
__copyright__ = "Copyright 2013-2016 Daniel Foreman-Mackey and contributors"
__contributors__ = [
# Alphabetical by first name.
"Adrian Price-Whelan @adrn",
"Brendon Brewer @eggplantbren",
"B... | # -*- coding: utf-8 -*-
__version__ = "2.0.2.dev0"
__author__ = "Dan Foreman-Mackey (foreman.mackey@gmail.com)"
__copyright__ = "Copyright 2013-2016 Daniel Foreman-Mackey and contributors"
__contributors__ = [
# Alphabetical by first name.
"Adrian Price-Whelan @adrn",
"Brendon Brewer @eggplantbren",
"B... | bsd-2-clause | Python |
14efcc349a3b524345808eaf925399bede34c7c6 | make file pep8 compliant | Anaconda-Platform/anaconda-client,Anaconda-Platform/anaconda-client,Anaconda-Platform/anaconda-client | binstar_client/errors.py | binstar_client/errors.py | from clyent.errors import ClyentError
class BinstarError(ClyentError):
def __init__(self, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
if not hasattr(self, 'message'):
self.message = args[0] if args else None
class Unauthorized(BinstarError):
pass
class Conflict... | from clyent.errors import ClyentError
class BinstarError(ClyentError):
def __init__(self, *args, **kwargs):
Exception.__init__(self, *args, **kwargs)
if not hasattr(self, 'message'):
self.message = args[0] if args else None
class Unauthorized(BinstarError):
pass
class Conflict(B... | bsd-3-clause | Python |
600fbdaff54206aaed93e775011b5dcfb054b83c | use url() for /apps urls so we can link to them | davehunt/bedrock,bensternthal/bedrock,mermi/bedrock,CSCI-462-01-2017/bedrock,alexgibson/bedrock,jpetto/bedrock,pmclanahan/bedrock,TheJJ100100/bedrock,craigcook/bedrock,hoosteeno/bedrock,marcoscaceres/bedrock,schalkneethling/bedrock,CSCI-462-01-2017/bedrock,jacshfr/mozilla-bedrock,hoosteeno/bedrock,Jobava/bedrock,pascal... | apps/marketplace/urls.py | apps/marketplace/urls.py | from django.conf.urls.defaults import *
import views
urlpatterns = patterns('',
url(r'^$', views.marketplace, name='marketplace'),
url(r'^partners/$', views.partners, name='partners')
)
| from django.conf.urls.defaults import *
from views import marketplace, partners
urlpatterns = patterns('',
(r'^$', marketplace),
(r'^partners/$', partners),
)
| mpl-2.0 | Python |
38db6404a7f40bc86585c614fc8cbe6691eafb89 | update doc | bird-house/birdy | birdy/native/__init__.py | birdy/native/__init__.py | """
The :func:`import_wps` instantiates a class whose methods call
WPS processes. The methods are generated at runtime based on the
process description provided by the WPS server. Calling a function sends
an `execute` request to the server, which returns a response.
The response is parsed to convert the outputs in nat... | """
The :func:`import_wps` function *imports* on the fly a python module whose
functions call WPS processes. The module is generated at runtime based on the
process description provided by the WPS server. Calling a function sends
an `execute` request to the server, which returns a response.
The response is parsed to c... | apache-2.0 | Python |
270812e89e8e0870bfea01367cf645cf5194a806 | Add sql constraint identation fixed | jorgescalona/openacademy-project | openacademy/model/openacademy_course.py | openacademy/model/openacademy_course.py | # -*- coding: utf-8 -*-
from openerp import models, fields, api
'''
This module create model of Course
'''
class Course(models.Model):
'''This class create model of Course'''
_name = 'openacademy.course' # Model odoo name
name = fields.Char(string='Title', required=True) # field reserved to identified re... | # -*- coding: utf-8 -*-
from openerp import models, fields, api
'''
This module create model of Course
'''
class Course(models.Model):
'''This class create model of Course'''
_name = 'openacademy.course' # Model odoo name
name = fields.Char(string='Title', required=True) # field reserved to identified re... | apache-2.0 | Python |
658d37fff628a3efac1e7202416ac7495960d4ad | Add translator in script | phihag/adhocracy,DanielNeugebauer/adhocracy,liqd/adhocracy,alkadis/vcv,phihag/adhocracy,liqd/adhocracy,liqd/adhocracy,alkadis/vcv,alkadis/vcv,DanielNeugebauer/adhocracy,phihag/adhocracy,phihag/adhocracy,DanielNeugebauer/adhocracy,DanielNeugebauer/adhocracy,alkadis/vcv,alkadis/vcv,phihag/adhocracy,liqd/adhocracy,DanielN... | scripts/replay_notifications.py | scripts/replay_notifications.py | #!/usr/bin/env python
"""
Replay all events in order to create Notification entries to the database which
do not exist yet.
"""
# boilerplate code. copy that
import os
import sys
from argparse import ArgumentParser
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
# /end boilerplate code
from paste.depl... | #!/usr/bin/env python
"""
Replay all events in order to create Notification entries to the database which
do not exist yet.
"""
# boilerplate code. copy that
import os
import sys
from argparse import ArgumentParser
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
# /end boilerplate code
from paste.depl... | agpl-3.0 | Python |
054e2d98a450b75427a7b06c4549373c2f4bc7a3 | Remove default id reosolver from open tracing | mociepka/saleor,mociepka/saleor,mociepka/saleor | saleor/core/tracing.py | saleor/core/tracing.py | from functools import partial
from graphene.relay import GlobalID
from graphene.types.resolver import default_resolver
from graphql import ResolveInfo
def should_trace(info: ResolveInfo) -> bool:
if info.field_name not in info.parent_type.fields:
return False
resolver = info.parent_type.fields[info.... | from functools import partial
from graphene.types.resolver import default_resolver
from graphql import ResolveInfo
def should_trace(info: ResolveInfo) -> bool:
if info.field_name not in info.parent_type.fields:
return False
resolver = info.parent_type.fields[info.field_name].resolver
return not ... | bsd-3-clause | Python |
91449465489ccc71e4d0b5527f0b4b54526b3c02 | update comment | DennyZhang/devops_public,DennyZhang/devops_public,DennyZhang/devops_public,DennyZhang/devops_public | python/parameters_tool/strip_comments.py | python/parameters_tool/strip_comments.py | #!/usr/bin/python
## File : strip_comments.py
## Created : <2017-08-03>
## Updated: Time-stamp: <2017-08-03 18:12:22>
## Description :
## For a block of string, remove useless stuff
## 1. Remove leading whitespace
## 2. Remove tailing whitespace
## 3. Remove any lines start with #
##
## Sample:
## ... | #!/usr/bin/python
## File : strip_comments.py
## Created : <2017-08-03>
## Updated: Time-stamp: <2017-08-03 18:09:41>
## Description :
## For a block of string, remove useless stuff
## 1. Remove leading whitespace
## 2. Remove tailing whitespace
## 3. Remove any lines start with #
##
## Sample:
## ... | mit | Python |
df6b13a70241b616f49d4dcc25073084c371f5b1 | Swap out license with rights | CenterForOpenScience/SHARE,aaxelb/SHARE,zamattiac/SHARE,zamattiac/SHARE,CenterForOpenScience/SHARE,CenterForOpenScience/SHARE,aaxelb/SHARE,zamattiac/SHARE,laurenbarker/SHARE,aaxelb/SHARE,laurenbarker/SHARE,laurenbarker/SHARE | share/models/creative/base.py | share/models/creative/base.py | from django.db import models
from share.models.base import ShareObject
from share.models.people import Person
from share.models.base import TypedShareObjectMeta
from share.models.creative.meta import Venue, Institution, Funder, Award, Tag
from share.models.fields import ShareForeignKey, ShareManyToManyField
class Ab... | from django.db import models
from share.models.base import ShareObject
from share.models.people import Person
from share.models.base import TypedShareObjectMeta
from share.models.creative.meta import Venue, Institution, Funder, Award, Tag
from share.models.fields import ShareForeignKey, ShareManyToManyField
class Ab... | apache-2.0 | Python |
a2849e7d016c812317fc503dc15f8f3dfec7da0a | use apply_async instead of delay | SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci | mrbelvedereci/build/handlers.py | mrbelvedereci/build/handlers.py | from django.db.models.signals import post_save
from django.dispatch import receiver
from mrbelvedereci.build.models import Build
from mrbelvedereci.build.tasks import run_build
@receiver(post_save, sender=Build)
def create_repo_webhooks(sender, **kwargs):
build = kwargs['instance']
created = kwargs['created']
... | from django.db.models.signals import post_save
from django.dispatch import receiver
from mrbelvedereci.build.models import Build
from mrbelvedereci.build.tasks import run_build
@receiver(post_save, sender=Build)
def create_repo_webhooks(sender, **kwargs):
build = kwargs['instance']
created = kwargs['created']
... | bsd-3-clause | Python |
1bb90728d9ef6c08452d2094e9930b6aa916389e | Remove use of girder.events in queue adapter | Kitware/cumulus,Kitware/cumulus | cumulus/queue/__init__.py | cumulus/queue/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2015 Kitware 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 cop... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2015 Kitware 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 cop... | apache-2.0 | Python |
707c4c801a0c35a1503575a6bd8c82fed6c589b6 | Update tv example to use data module. Rewrap some text. | chintak/scikit-image,pratapvardhan/scikit-image,dpshelio/scikit-image,paalge/scikit-image,newville/scikit-image,SamHames/scikit-image,keflavich/scikit-image,GaZ3ll3/scikit-image,paalge/scikit-image,ofgulban/scikit-image,ofgulban/scikit-image,blink1073/scikit-image,warmspringwinds/scikit-image,Britefury/scikit-image,oew... | doc/examples/plot_lena_tv_denoise.py | doc/examples/plot_lena_tv_denoise.py | """
====================================================
Denoising the picture of Lena using total variation
====================================================
In this example, we denoise a noisy version of the picture of Lena
using the total variation denoising filter. The result of this filter
is an image that has... | """
====================================================
Denoising the picture of Lena using total variation
====================================================
In this example, we denoise a noisy version of the picture of Lena using the
total variation denoising filter. The result of this filter is an image that
has... | bsd-3-clause | Python |
507cdda01f9208127f8ce5f1ecadc6d5d521fe4d | fix for flake8 | cupy/cupy,niboshi/chainer,okuta/chainer,ktnyt/chainer,kiyukuta/chainer,anaruse/chainer,wkentaro/chainer,niboshi/chainer,okuta/chainer,hvy/chainer,wkentaro/chainer,chainer/chainer,jnishi/chainer,jnishi/chainer,kashif/chainer,chainer/chainer,jnishi/chainer,chainer/chainer,hvy/chainer,tkerola/chainer,okuta/chainer,cupy/cu... | cupy/manipulation/kind.py | cupy/manipulation/kind.py | from cupy import core
# TODO(okuta): Implement asfarray
def asfortranarray(a, dtype=None):
"""Return an array laid out in Fortran order in memory.
Args:
a (~cupy.ndarray): The input array.
dtype (str or dtype object, optional): By default, the data-type is
inferred from the inpu... | import numpy
import cupy
from cupy import core
# TODO(okuta): Implement asfarray
def asfortranarray(a, dtype=None):
"""Return an array laid out in Fortran order in memory.
Args:
a (~cupy.ndarray): The input array.
dtype (str or dtype object, optional): By default, the data-type is
... | mit | Python |
e157cfbf85bab3373ef7b4e5e76da20bd572bebb | modify method name: get_by_name_or_all to get_artist_by_name refactoring methods | EunJung-Seo/art_archive | art_archive_api/utils.py | art_archive_api/utils.py | from flask import abort
def get_artist_by_name(model, name):
objects = []
if name:
objects = model.query.filter_by(name=name)
else:
objects = model.query
objects_count = objects.count()
return objects, objects_count
def slice_query_set(offset, count, objects_count, objects):
... | from flask import abort
def get_by_name_or_all(model, name):
objects = []
objects_count = 0
if name:
objects = model.query.filter_by(name=name)
objects_count = objects.count()
else:
objects = model.query.all()
objects_count = model.query.count()
return objects, obj... | mit | Python |
9f44888c00d29bd1d1a53eb09ab90b61f33c5e05 | Update existing settings migration with minor field change. | snahelou/awx,wwitzel3/awx,snahelou/awx,wwitzel3/awx,snahelou/awx,wwitzel3/awx,snahelou/awx,wwitzel3/awx | awx/main/migrations/0002_v300_changes.py | awx/main/migrations/0002_v300_changes.py | # -*- coding: utf-8 -*-
# Copyright (c) 2016 Ansible, Inc.
# All Rights Reserved.
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER... | # -*- coding: utf-8 -*-
# Copyright (c) 2016 Ansible, Inc.
# All Rights Reserved.
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER... | apache-2.0 | Python |
e225f443a68b5c25bc55ecdec3a162f11c230fa6 | Update tests | platoai/platoai-python,platoai/platoai | tests/run.py | tests/run.py | from __future__ import print_function
import datetime
from pprint import pprint
import voxjar
if __name__ == "__main__":
metadata = {
"identifier": "test_call_identifier",
"timestamp": datetime.datetime.now(),
# 'company': {
# 'id': 'b87cc8ea-6820-11e7-891e-4f389aefc782'
... | from __future__ import print_function
import datetime
from pprint import pprint
# import json
import voxjar
if __name__ == '__main__':
now = datetime.datetime.now()
metadata = {
'identifier': 'test_call_identifier',
'timestamp': now,
'company': {
'id': 'b87cc8ea-6820-11e7-8... | apache-2.0 | Python |
7893695348a23472835e6d6c2d57b8ac4dea2dc3 | Document test intention. | zlargon/mosquitto,zlargon/mosquitto,zlargon/mosquitto,zlargon/mosquitto,zlargon/mosquitto | test/broker/03-publish-timeout-qos2.py | test/broker/03-publish-timeout-qos2.py | #!/usr/bin/python
# Test whether a PUBLISH to a topic with QoS 2 results in the correct packet
# flow. This test introduces delays into the flow in order to force the broker
# to send duplicate PUBREC and PUBCOMP messages.
import subprocess
import socket
import time
from struct import *
rc = 0
keepalive = 600
connec... | #!/usr/bin/python
# Test whether a PUBLISH to a topic with QoS 2 results in the correct packet
# flow. This test introduces delays into the flow in order to force the broker
# to send duplicate PUBREC and PUBCOMP messages.
import subprocess
import socket
import time
from struct import *
rc = 0
keepalive = 600
connec... | bsd-3-clause | Python |
c546192a83dce300ad46193e351229a5969e979d | Remove warming up from TestBase._test_jitted() (#571) | IntelLabs/hpat,IntelLabs/hpat,IntelLabs/hpat,IntelLabs/hpat | sdc/tests/tests_perf/test_perf_base.py | sdc/tests/tests_perf/test_perf_base.py | import os
import unittest
import numba
from sdc.tests.tests_perf.test_perf_utils import *
class TestBase(unittest.TestCase):
iter_number = 5
results_class = TestResults
@classmethod
def create_test_results(cls):
drivers = []
if is_true(os.environ.get('SDC_TEST_PERF_EXCEL', True)):
... | import os
import unittest
import numba
from sdc.tests.tests_perf.test_perf_utils import *
class TestBase(unittest.TestCase):
iter_number = 5
results_class = TestResults
@classmethod
def create_test_results(cls):
drivers = []
if is_true(os.environ.get('SDC_TEST_PERF_EXCEL', True)):
... | bsd-2-clause | Python |
d6cfc95c436b7eb4be372795948a8f9097d60015 | Remove unused import | dpshelio/astropy-helpers,Cadair/astropy-helpers,larrybradley/astropy-helpers,bsipocz/astropy-helpers,dpshelio/astropy-helpers,larrybradley/astropy-helpers,astropy/astropy-helpers,Cadair/astropy-helpers,bsipocz/astropy-helpers,larrybradley/astropy-helpers,astropy/astropy-helpers,bsipocz/astropy-helpers | astropy_helpers/sphinx/ext/__init__.py | astropy_helpers/sphinx/ext/__init__.py | from __future__ import division, absolute_import, print_function
| from __future__ import division, absolute_import, print_function
from .numpydoc import setup
| bsd-3-clause | Python |
bd45223f8606948936d2c0fa1c104a0c2f13d630 | Update 8x8 generator | thaynewalker/hog2,thaynewalker/hog2,thaynewalker/hog2,thaynewalker/hog2,thaynewalker/hog2 | test/environments/instances/8x8/gen.py | test/environments/instances/8x8/gen.py | #!/usr/bin/python
import random
import os
import errno
for i in range(100):
s=set()
g=set()
while len(s) < 20:
s.add((random.randint(0,7),random.randint(0,7)))
while len(g) < 20:
g.add((random.randint(0,7),random.randint(0,7)))
start=list(s)
goal=list(g)
for size in range(1,21):
if not os.... | #!/usr/bin/python
import random
import os
import errno
for i in range(100):
s=set()
g=set()
while len(s) < 20:
s.add((random.randint(0,7),random.randint(0,7)))
while len(g) < 20:
g.add((random.randint(0,7),random.randint(0,7)))
start=list(s)
goal=list(g)
for size in range(2,22,2):
if not o... | mit | Python |
1a8c06e655b622e7504a615c902ddb9b278f6470 | add urdu mapping [skip ci] | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | custom/icds/translations/integrations/const.py | custom/icds/translations/integrations/const.py | from __future__ import absolute_import
from __future__ import unicode_literals
API_USER = "api"
SOURCE_LANGUAGE_MAPPING = {
# 'hq_code' : 'transifex_code'
'hin': 'hi', # hindi
'ori': 'or', # oriya
'tam': 'ta', # tamil
'pan': 'pa', # punjabi
'asm': 'as', # assamese
'ben': 'bn', # bengal... | from __future__ import absolute_import
from __future__ import unicode_literals
API_USER = "api"
SOURCE_LANGUAGE_MAPPING = {
# 'hq_code' : 'transifex_code'
'hin': 'hi', # hindi
'ori': 'or', # oriya
'tam': 'ta', # tamil
'pan': 'pa', # punjabi
'asm': 'as', # assamese
'ben': 'bn', # bengal... | bsd-3-clause | Python |
d9304cd7c19e29fc24ba474a5c7983ce3bb88a2b | Fix benchmark name | stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib | lib/node_modules/@stdlib/types/ndarray/ind2sub/benchmark/python/numpy/benchmark.py | lib/node_modules/@stdlib/types/ndarray/ind2sub/benchmark/python/numpy/benchmark.py | #!/usr/bin/env python
"""Benchmark numpy.unravel_index."""
from __future__ import print_function
import timeit
NAME = "ind2sub"
REPEATS = 3
ITERATIONS = 1000000
def print_version():
"""Print the TAP version."""
print("TAP version 13")
def print_summary(total, passing):
"""Print the benchmark summary.
... | #!/usr/bin/env python
"""Benchmark numpy.unravel_index."""
from __future__ import print_function
import timeit
NAME = "unravel_index"
REPEATS = 3
ITERATIONS = 1000000
def print_version():
"""Print the TAP version."""
print("TAP version 13")
def print_summary(total, passing):
"""Print the benchmark sum... | apache-2.0 | Python |
deb749252a83f59c0bfee3b14abafc5582fb3986 | fix 500 - closes #20 | letsmeet-click/letsmeet.click,letsmeet-click/letsmeet.click,letsmeet-click/letsmeet.click,letsmeet-click/letsmeet.click | letsmeet/events/views.py | letsmeet/events/views.py | from rules.contrib.views import PermissionRequiredMixin
from django.shortcuts import redirect, get_object_or_404
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic import (
CreateView,
DetailView,
UpdateView,
)
from .models import Event, EventRSVP, EventComment
from .forms... | from rules.contrib.views import PermissionRequiredMixin
from django.shortcuts import redirect
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic import (
CreateView,
DetailView,
UpdateView,
)
from .models import Event, EventRSVP, EventComment
from .forms import EventUpdate... | mit | Python |
c4ea2d360ebf0fc9b9d9494ed43e540eaf2282d8 | add compatibility import | cpcloud/dask,vikhyat/dask,hainm/dask,mraspaud/dask,jakirkham/dask,freeman-lab/dask,jayhetee/dask,mrocklin/dask,vikhyat/dask,simudream/dask,clarkfitzg/dask,hainm/dask,marianotepper/dask,PhE/dask,jcrist/dask,PhE/dask,PeterDSteinberg/dask,wiso/dask,mikegraham/dask,esc/dask,jayhetee/dask,cowlicks/dask,mraspaud/dask,chrisba... | dask/array/into.py | dask/array/into.py | from __future__ import absolute_import, division, print_function
import numpy as np
from toolz import merge, accumulate
from into import discover, convert, append, into
from datashape.dispatch import dispatch
from datashape import DataShape
from operator import add
import itertools
from .core import rec_concatenate, A... | from __future__ import absolute_import, division, print_function
import numpy as np
from toolz import merge, accumulate
from into import discover, convert, append, into
from datashape.dispatch import dispatch
from datashape import DataShape
from operator import add
import itertools
from .core import rec_concatenate, A... | bsd-3-clause | Python |
c1d73206436389f27187f3b52ff0daf6e106918c | Fix serialization of Marathon Constraints | burakbostancioglu/marathon-python,elyast/marathon-python,mesosphere/marathon-python,Carles-Figuerola/marathon-python,thefactory/marathon-python,mattrobenolt/marathon-python,mesosphere/marathon-python,burakbostancioglu/marathon-python,Yelp/marathon-python,drewrobb/marathon-python,Rob-Johnson/marathon-python,Carles-Figue... | marathon/models/constraint.py | marathon/models/constraint.py | from ..exceptions import InvalidOperatorError
from .base import MarathonObject
class MarathonConstraint(MarathonObject):
"""Marathon placement constraint.
See https://mesosphere.github.io/marathon/docs/constraints.html
:param str field: constraint operator target
:param str operator: must be one of ... | from ..exceptions import InvalidOperatorError
from .base import MarathonObject
class MarathonConstraint(MarathonObject):
"""Marathon placement constraint.
See https://mesosphere.github.io/marathon/docs/constraints.html
:param str field: constraint operator target
:param str operator: must be one of ... | mit | Python |
381dc5a1f92916d8ce66c7eef95e2237ff20b044 | fix tests | larrybradley/astropy,joergdietrich/astropy,astropy/astropy,kelle/astropy,mhvk/astropy,lpsinger/astropy,tbabej/astropy,joergdietrich/astropy,AustereCuriosity/astropy,astropy/astropy,larrybradley/astropy,pllim/astropy,lpsinger/astropy,kelle/astropy,larrybradley/astropy,dhomeier/astropy,AustereCuriosity/astropy,AustereCur... | astropy/coordinates/tests/test_sites.py | astropy/coordinates/tests/test_sites.py | from __future__ import (absolute_import, division, print_function,
unicode_literals)
from ...tests.helper import pytest, assert_quantity_allclose
from ... import units as u
from .. import Latitude, Longitude, EarthLocation, get_site, add_site, remove_site
def test_get_site():
# Compare to ... | from __future__ import (absolute_import, division, print_function,
unicode_literals)
from ...tests.helper import pytest, assert_quantity_allclose
from ... import units as u
from .. import Latitude, Longitude, EarthLocation, get_site, add_site, remove_site
def test_get_site():
# Compare to ... | bsd-3-clause | Python |
bdb8d48e0030474a616ec2e7e6d5f19132bb18e7 | Fix account init | vuolter/pyload,vuolter/pyload,vuolter/pyload | module/plugins/accounts/XFileSharingPro.py | module/plugins/accounts/XFileSharingPro.py | # -*- coding: utf-8 -*-
from module.plugins.internal.XFSPAccount import XFSPAccount
class XFileSharingPro(XFSPAccount):
__name__ = "XFileSharingPro"
__type__ = "account"
__version__ = "0.04"
__description__ = """XFileSharingPro multi-purpose account plugin"""
__license__ = "GPLv3"
... | # -*- coding: utf-8 -*-
import re
from module.plugins.internal.XFSPAccount import XFSPAccount
class XFileSharingPro(XFSPAccount):
__name__ = "XFileSharingPro"
__type__ = "account"
__version__ = "0.03"
__description__ = """XFileSharingPro multi-purpose account plugin"""
__license__ = "... | agpl-3.0 | Python |
ee931a528a1483bedc2951dd202f369460c0fec4 | Update version | Outernet-Project/bottle-utils-i18n | bottle_utils/__init__.py | bottle_utils/__init__.py | __version__ = '0.3.5'
__author__ = 'Outernet Inc <hello@outernet.is>'
| __version__ = '0.3.4'
__author__ = 'Outernet Inc <hello@outernet.is>'
| bsd-2-clause | Python |
a806272275fa0071abf038ceed913995c5e99bb5 | add support of IAM roles | PressLabs/z3,PressLabs/z3 | z3/get.py | z3/get.py | import argparse
import sys, re
import boto3
import botocore
from boto3.s3.transfer import TransferConfig
from z3.config import get_config
MB = 1024 ** 2
def main():
cfg = get_config()
parser = argparse.ArgumentParser(
description='Read a key from s3 and write the content to stdout',
)
parser.a... | import argparse
import sys
import boto.s3
from z3.config import get_config
def download(bucket, name):
key = bucket.get_key(name)
key.get_contents_to_file(sys.stdout)
def main():
cfg = get_config()
parser = argparse.ArgumentParser(
description='Read a key from s3 and write the content to s... | apache-2.0 | Python |
3a177a48b1e8f51eb9f13b874879b7fa47216897 | Add comments to multimission-simulation | gbrammer/grizli | grizli/version.py | grizli/version.py | # Should be one commit behind latest
__version__ = "0.1.1-29-gac73d73"
| # Should be one commit behind latest
__version__ = "0.1.1-25-g3109f16"
| mit | Python |
6934ba49ff6f594910843d951606f80db67d9b4b | return to older return | markomanninen/hyml | hyml/ext.py | hyml/ext.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright (c) Marko Manninen <elonmedia@gmail.com>, 2017
import hy, hy.importer as hyi
from jinja2.ext import extract_from_ast
import itertools
def extract_from_ast(source, keywords):
d = None
def filter_hy(e):
# basicly we are searching for babel keyword e... | #!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright (c) Marko Manninen <elonmedia@gmail.com>, 2017
import hy, hy.importer as hyi
from jinja2.ext import extract_from_ast
import itertools
def extract_from_ast(source, keywords):
d = None
def filter_hy(e):
# basicly we are searching for babel keyword e... | mit | Python |
2a63c3cc4a795e23ff00d7c2273ee40939ec3dea | mark string literal as regex to avoid runtime warning in python 3 | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | custom/aaa/urls.py | custom/aaa/urls.py | from __future__ import absolute_import
from __future__ import unicode_literals
from django.conf.urls import url, include
from custom.aaa.views import (
AggregationScriptPage,
LocationFilterAPI,
ProgramOverviewReport,
ProgramOverviewReportAPI,
UnifiedBeneficiaryReport,
UnifiedBeneficiaryReportAP... | from __future__ import absolute_import
from __future__ import unicode_literals
from django.conf.urls import url, include
from custom.aaa.views import (
AggregationScriptPage,
LocationFilterAPI,
ProgramOverviewReport,
ProgramOverviewReportAPI,
UnifiedBeneficiaryReport,
UnifiedBeneficiaryReportAP... | bsd-3-clause | Python |
e7ae8140beb50e3091c0bd7ad1db4535540c95df | remove copyright | smlbiobot/SML-Cogs,smlbiobot/SML-Cogs | cwready/cwready.py | cwready/cwready.py | """
Clan War Readiness
"""
import argparse
import itertools
import os
from collections import defaultdict
from random import choice
import discord
from cogs.utils import checks
from cogs.utils.chat_formatting import box
from cogs.utils.chat_formatting import pagify
from cogs.utils.dataIO import dataIO
from discord.ex... | """
Clan War Readiness
"""
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2017 SML
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 limita... | mit | Python |
0e13bf2b23df3584109fcf9b62710efbb81b2226 | exit with help if no subcommand is supplied. | dattasaurabh82/internetarchive,JesseWeinstein/internetarchive,wumpus/internetarchive,brycedrennan/internetarchive,jjjake/internetarchive | iacli/ia.py | iacli/ia.py | #!/usr/bin/env python
"""A command line interface for Archive.org.
usage:
ia [--debug | --help | --version] [<command>] [<args>...]
options:
-h, --help
-v, --version
-d, --debug [default: True]
commands:
help Retrieve help for subcommands.
configure Configure `ia`.
metadata Retriev... | #!/usr/bin/env python
"""A command line interface for Archive.org.
usage:
ia [--debug] <command> [<args>...]
ia --help
ia --version
options:
-h, --help
-v, --version
-d, --debug [default: True]
commands:
help Retrieve help for subcommands.
configure Configure `ia`.
metadata ... | agpl-3.0 | Python |
f46731c1bfd3be6e7d66b4a1078ca09460d25af5 | Add OCA as author of OCA addons | ddico/account-financial-tools,ddico/account-financial-tools | account_partner_required/__openerp__.py | account_partner_required/__openerp__.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# Account partner required module for OpenERP
# Copyright (C) 2014 Acsone (http://acsone.eu).
# @author Stéphane Bidoul <stephane.bidoul@acsone.eu>
#
# This program is free software: you can redistribu... | # -*- encoding: utf-8 -*-
##############################################################################
#
# Account partner required module for OpenERP
# Copyright (C) 2014 Acsone (http://acsone.eu).
# @author Stéphane Bidoul <stephane.bidoul@acsone.eu>
#
# This program is free software: you can redistribu... | agpl-3.0 | Python |
15785b306557bb81643270415944ca1bda3ae0a8 | Remove database_project_name from api | 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 |
085cee90d03c69d3664de69831fbc18a1412a162 | Update scadabr_database_to_kairosdb.py | paladini/ScadaBR_to_KairosDB,paladini/ScadaBR_to_KairosDB | bin/scadabr_database_to_kairosdb.py | bin/scadabr_database_to_kairosdb.py | #!/usr/bin/env python3
import requests
import gzip
import json
import sys
import pymysql as mariadb
# Creating the connection with MySQL/MariaDB database.
#
# Attributes:
# sys.argv[1] = database name, that was sent by the caller script.
# sys.argv[2] = username of the MySQL/MariaDB server.
# sys.argv[3] = if ... | #!/usr/bin/env python3
import requests
import gzip
import json
import sys
import mysql.connector as mariadb
# Creating the connection with MySQL/MariaDB database.
#
# Attributes:
# sys.argv[1] = database name, that was sent by the caller script.
# sys.argv[2] = username of the MySQL/MariaDB server.
# sys.argv[3] ... | mit | Python |
3b89f8df57fd345e873d87df7f342fe6a01b49ce | Fix config import from __init__ | Neurita/darwin | darwin/__init__.py | darwin/__init__.py |
from .utils.logger import setup_logging
setup_logging()
|
from .logger import setup_logging
setup_logging()
| bsd-3-clause | Python |
e972a2436807ff0f5af4282a7842451e07807e5e | bump to 0.0.8 | alfredodeza/chacractl,ceph/chacractl | chacractl/__init__.py | chacractl/__init__.py | config = {'verbosity': 'info'}
__version__ = '0.0.8'
| config = {'verbosity': 'info'}
__version__ = '0.0.7'
| mit | Python |
d88dcaa6e1256452715aa5071cbe326233f03195 | format model args | aschn/drf-tracking | rest_framework_tracking/base_models.py | rest_framework_tracking/base_models.py | from django.db import models
from django.conf import settings
from django.utils.six import python_2_unicode_compatible
from .managers import PrefetchUserManager
@python_2_unicode_compatible
class BaseAPIRequestLog(models.Model):
""" Logs Django rest framework API requests """
user = models.ForeignKey(
... | from django.db import models
from django.conf import settings
from django.utils.six import python_2_unicode_compatible
from .managers import PrefetchUserManager
@python_2_unicode_compatible
class BaseAPIRequestLog(models.Model):
""" Logs Django rest framework API requests """
user = models.ForeignKey(
... | isc | Python |
1b0b96d78d03af813b10359e1ee7d7dd47045307 | Correct URL to include entire base for API client | bowlofstew/changes,wfxiang08/changes,wfxiang08/changes,wfxiang08/changes,bowlofstew/changes,wfxiang08/changes,bowlofstew/changes,dropbox/changes,bowlofstew/changes,dropbox/changes,dropbox/changes,dropbox/changes | changes/api/client.py | changes/api/client.py | import json
from flask import current_app
class APIError(Exception):
pass
class APIClient(object):
"""
An internal API client.
>>> client = APIClient(version=0)
>>> response = client.get('/projects/')
>>> print response
"""
def __init__(self, version):
self.version = versio... | import json
from flask import current_app
class APIError(Exception):
pass
class APIClient(object):
"""
An internal API client.
>>> client = APIClient(version=0)
>>> response = client.get('/projects/')
>>> print response
"""
def __init__(self, version):
self.version = versio... | apache-2.0 | Python |
2ab57fd58150d9416986eb089430fcd090c9cc31 | Fix ipynb tests | Anaconda-Platform/anaconda-client,Anaconda-Platform/anaconda-client,Anaconda-Platform/anaconda-client | binstar_client/inspect_package/ipynb.py | binstar_client/inspect_package/ipynb.py | import os
import re
import time
from ..utils.notebook.inflection import parameterize
from ..utils.notebook.data_uri import data_uri_from
class IPythonNotebook(object):
_name = None
_version = None
thumbnail_file = None
def __init__(self, filename, fileobj, *args, **kwargs):
self.filename = fi... | import os
import re
import time
from ..utils.notebook.inflection import parameterize
from ..utils.notebook.data_uri import data_uri_from
class IPythonNotebook(object):
_name = None
_version = None
thumbnail_file = None
def __init__(self, filename, fileobj, *args, **kwargs):
self.filename = fi... | bsd-3-clause | Python |
acc0cf7a9e44ca11384d7d2b0dcd743af6e99ef9 | Update version to 1.0.3 | vkosuri/ChatterBot,gunthercox/ChatterBot | chatterbot/__init__.py | chatterbot/__init__.py | """
ChatterBot is a machine learning, conversational dialog engine.
"""
from .chatterbot import ChatBot
__version__ = '1.0.3'
__author__ = 'Gunther Cox'
__email__ = 'gunthercx@gmail.com'
__url__ = 'https://github.com/gunthercox/ChatterBot'
__all__ = (
'ChatBot',
)
| """
ChatterBot is a machine learning, conversational dialog engine.
"""
from .chatterbot import ChatBot
__version__ = '1.0.2'
__author__ = 'Gunther Cox'
__email__ = 'gunthercx@gmail.com'
__url__ = 'https://github.com/gunthercox/ChatterBot'
__all__ = (
'ChatBot',
)
| bsd-3-clause | Python |
287b7b57056201d1d68c6d3cc963f1b2af2f7e83 | Update scripts/alerts/validate_alerts_format.py | GoogleCloudPlatform/monitoring-dashboard-samples,GoogleCloudPlatform/monitoring-dashboard-samples | scripts/alerts/validate_alerts_format.py | scripts/alerts/validate_alerts_format.py | import json
import sys
import yaml
from google.cloud import monitoring_v3
def check_json_in_metadata(path, file_id, file_version):
metadata_path = "/".join(path.split("/")[:-1]) + "/metadata.yaml"
check_metadata_entries(metadata_path)
f = open(metadata_path)
data = yaml.safe_load(f)
templates_metadata = data... | import sys
import yaml
import json
from google.cloud import monitoring_v3
def check_json_in_metadata(path, file_id, file_version):
metadata_path = "/".join(path.split("/")[:-1]) + "/metadata.yaml"
check_metadata_entries(metadata_path)
f = open(metadata_path)
data = yaml.safe_load(f)
templates_metadata = data... | apache-2.0 | Python |
fac1e1bbe26e0fb7b82d65e48619cacc742ea747 | Update default path | davidgasquez/kaggle-airbnb | notebooks/utils/data_loading.py | notebooks/utils/data_loading.py | """Wrappers to simplify data loading."""
import pandas as pd
# Set default path
DEFAULT_PATH = '../data/raw/'
def load_users_data(path=DEFAULT_PATH, preprocessed=False):
"""Load users data into train and test users.
Parameters
----------
path: str
Path of the folder containing the data.
... | """Wrappers to simplify data loading."""
import pandas as pd
# Set default path
DEFAULT_PATH = '../datasets/raw/'
def load_users_data(path=DEFAULT_PATH, preprocessed=False):
"""Load users data into train and test users.
Parameters
----------
path: str
Path of the folder containing the data.... | mit | Python |
d03571b523ba125be94d68bc50cda74a9a934d6f | fix documents | okuta/chainer,chainer/chainer,wkentaro/chainer,ronekko/chainer,ktnyt/chainer,chainer/chainer,niboshi/chainer,ysekky/chainer,cupy/cupy,jnishi/chainer,anaruse/chainer,tkerola/chainer,okuta/chainer,keisuke-umezawa/chainer,ktnyt/chainer,rezoo/chainer,niboshi/chainer,cupy/cupy,kashif/chainer,pfnet/chainer,keisuke-umezawa/ch... | chainer/functions/evaluation/r2_score.py | chainer/functions/evaluation/r2_score.py | from chainer import cuda
from chainer import function
from chainer.utils import type_check
class R2_score(function.Function):
def __init__(self, sample_weight, multioutput):
if sample_weight is not None:
raise NotImplementedError()
if multioutput in ['uniform_average', 'raw_values']:
... | from chainer import cuda
from chainer import function
from chainer.utils import type_check
class R2_score(function.Function):
def __init__(self, sample_weight, multioutput):
if sample_weight is not None:
raise NotImplementedError()
if multioutput in ['uniform_average', 'raw_values']:
... | mit | Python |
d6c20476bebed1265ccd0ac46e3020fdb3804bdd | Add type to command serialization | bowlofstew/changes,bowlofstew/changes,wfxiang08/changes,dropbox/changes,dropbox/changes,dropbox/changes,bowlofstew/changes,wfxiang08/changes,wfxiang08/changes,bowlofstew/changes,dropbox/changes,wfxiang08/changes | changes/api/serializer/models/command.py | changes/api/serializer/models/command.py | from changes.api.serializer import Serializer, register
from changes.models import Command
@register(Command)
class CommandSerializer(Serializer):
def serialize(self, instance, attrs):
return {
'id': instance.id.hex,
'name': instance.label,
'status': instance.status,
... | from changes.api.serializer import Serializer, register
from changes.models import Command
@register(Command)
class CommandSerializer(Serializer):
def serialize(self, instance, attrs):
return {
'id': instance.id.hex,
'name': instance.label,
'status': instance.status,
... | apache-2.0 | Python |
76e1f2db2fe3763e1b8638c9044afa341e4d39bf | Fix fileno method in ReactorTransport. | kirkeby/sheared | sheared/reactor/transport.py | sheared/reactor/transport.py | # vim:nowrap:textwidth=0
import random, os, types
class StringTransport:
def __init__(self):
self.input = ''
self.output = ''
self.closed = 0
def read(self, cnt=4096):
cnt = min(cnt, 1 + int(random.random() * (len(self.input) - 1)))
data = self.input[:cnt]
self... | # vim:nowrap:textwidth=0
import random, os, types
class StringTransport:
def __init__(self):
self.input = ''
self.output = ''
self.closed = 0
def read(self, cnt=4096):
cnt = min(cnt, 1 + int(random.random() * (len(self.input) - 1)))
data = self.input[:cnt]
self... | mit | Python |
67ff8c30d07f54c89d8072f480ded59e144d8463 | Update range test after reporting change | pombredanne/numba,gmarkall/numba,seibert/numba,sklam/numba,jriehl/numba,cpcloud/numba,sklam/numba,stonebig/numba,shiquanwang/numba,numba/numba,cpcloud/numba,pombredanne/numba,pitrou/numba,gdementen/numba,shiquanwang/numba,gmarkall/numba,sklam/numba,jriehl/numba,jriehl/numba,GaZ3ll3/numba,gmarkall/numba,seibert/numba,cp... | numba/tests/builtins/test_builtin_range.py | numba/tests/builtins/test_builtin_range.py | """
>>> range_ret1()
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> range_ret2()
[1, 2, 3, 4]
>>> range_ret3()
[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4]
>>> forward1()
0 1 2 3 4 5 6 7 8 9 done
>>> forward2()
1 2 3 4 done
>>> forward3()
5 8 11 14 done
>>> backward1()
10 7 4 done
>>> backward2()
done
>>> backward3()
-5 -8... | """
>>> range_ret1()
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> range_ret2()
[1, 2, 3, 4]
>>> range_ret3()
[10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4]
>>> forward1()
0 1 2 3 4 5 6 7 8 9 done
>>> forward2()
1 2 3 4 done
>>> forward3()
5 8 11 14 done
>>> backward1()
10 7 4 done
>>> backward2()
done
>>> backward3()
-5 -8... | bsd-2-clause | Python |
5826f791e824b7aa0b38b76570212b7de6e5d1e2 | Index descriptor_data as Text field in ES | genialis/resolwe,jberci/resolwe,genialis/resolwe,jberci/resolwe | resolwe/flow/elastic_indexes/collection.py | resolwe/flow/elastic_indexes/collection.py | """Elastic Search indexes for Collection model."""
import elasticsearch_dsl as dsl
from resolwe.elastic.indices import BaseIndex
from resolwe.flow.utils import dict_dot, iterate_schema
from ..models import Collection
from .base import BaseDocument, BaseIndexMixin
class CollectionDocument(BaseDocument):
"""Docum... | """Elastic Search indexes for Collection model."""
import elasticsearch_dsl as dsl
from resolwe.elastic.fields import Name
from resolwe.elastic.indices import BaseIndex
from resolwe.flow.utils import dict_dot, iterate_schema
from ..models import Collection
from .base import BaseDocument, BaseIndexMixin
class Collec... | apache-2.0 | Python |
7381f177f392b699eed3d93f2e36b7fa39d33ad0 | remove unused import | geometalab/osmaxx,geometalab/osmaxx,geometalab/osmaxx-frontend,geometalab/osmaxx-frontend,geometalab/osmaxx-frontend,geometalab/osmaxx,geometalab/osmaxx,geometalab/osmaxx-frontend,geometalab/drf-utm-zone-info,geometalab/drf-utm-zone-info | build_and_push_images.py | build_and_push_images.py | #!/usr/bin/env python
IMAGES = [
dict(image_name='geometalab/osmaxx-mediator', dockerfile='Dockerfile.mediator'),
dict(image_name='geometalab/osmaxx-worker', dockerfile='Dockerfile.worker'),
dict(image_name='geometalab/osmaxx-frontend', dockerfile='Dockerfile.frontend'),
]
def docker_build(dockerfile, ima... | #!/usr/bin/env python
import argparse
IMAGES = [
dict(image_name='geometalab/osmaxx-mediator', dockerfile='Dockerfile.mediator'),
dict(image_name='geometalab/osmaxx-worker', dockerfile='Dockerfile.worker'),
dict(image_name='geometalab/osmaxx-frontend', dockerfile='Dockerfile.frontend'),
]
def docker_buil... | mit | Python |
7ca3308ced87a51ac073e50229d15b0784f5aed7 | Update chainerx/_docs/device.py | niboshi/chainer,tkerola/chainer,jnishi/chainer,wkentaro/chainer,okuta/chainer,chainer/chainer,wkentaro/chainer,chainer/chainer,keisuke-umezawa/chainer,hvy/chainer,keisuke-umezawa/chainer,niboshi/chainer,niboshi/chainer,hvy/chainer,jnishi/chainer,hvy/chainer,jnishi/chainer,wkentaro/chainer,hvy/chainer,okuta/chainer,ktny... | chainerx/_docs/device.py | chainerx/_docs/device.py | import chainerx
from chainerx import _docs
def _set_docs_device():
Device = chainerx.Device
_docs.set_doc(
Device,
"""Represents a physical computing unit.
""")
_docs.set_doc(
Device.synchronize,
"""Synchronizes the device.
""")
_docs.set_doc(
Device.name,
... | import chainerx
from chainerx import _docs
def _set_docs_device():
Device = chainerx.Device
_docs.set_doc(
Device,
"""Represents a physical computing unit.
""")
_docs.set_doc(
Device.synchronize,
"""Synchronizes the device.
""")
_docs.set_doc(
Device.name,
... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.