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 |
|---|---|---|---|---|---|---|---|---|
c6f67857c61544069122e0e2ed65d2742d3c453d | Define association request service messages | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | apps/domain/src/main/core/services/association_request.py | apps/domain/src/main/core/services/association_request.py | # stdlib
import secrets
from typing import List
from typing import Type
from typing import Union
# third party
from nacl.signing import VerifyKey
# syft relative
from syft.core.node.abstract.node import AbstractNode
from syft.core.node.common.service.auth import service_auth
from syft.core.node.common.service.node_se... | # stdlib
import secrets
from typing import List
from typing import Type
from typing import Union
# third party
from nacl.signing import VerifyKey
# syft relative
from syft.core.node.abstract.node import AbstractNode
from syft.core.node.common.service.auth import service_auth
from syft.core.node.common.service.node_se... | apache-2.0 | Python |
238c1ac23b1f1ef3ab42196d2d325caf56d46d30 | Bump version 1.2.6 | redhat-openstack/infrared,redhat-openstack/infrared,okolisny/InfraRed,okolisny/InfraRed,redhat-openstack/infrared,okolisny/InfraRed | cli/__init__.py | cli/__init__.py | __VERSION__ = '1.2.6'
| __VERSION__ = '1.2.5'
| apache-2.0 | Python |
5d283d28ad0bd4ce434b6230fd154937f40083c6 | add missing dependency to client | planetlabs/datalake,planetlabs/datalake,planetlabs/datalake,planetlabs/datalake,planetlabs/atl | client/setup.py | client/setup.py | from setuptools import setup, find_packages
from setuptools import distutils
import os
import versioneer
def get_version():
if os.path.exists("PKG-INFO"):
metadata = distutils.dist.DistributionMetadata("PKG-INFO")
return metadata.version
else:
return versioneer.get_version()
setup(na... | from setuptools import setup, find_packages
from setuptools import distutils
import os
import versioneer
def get_version():
if os.path.exists("PKG-INFO"):
metadata = distutils.dist.DistributionMetadata("PKG-INFO")
return metadata.version
else:
return versioneer.get_version()
setup(na... | apache-2.0 | Python |
d72e4094d188d6e0f18493a57bfd28b3c901e1a8 | Bump version | UncleStranger/grab-site,bright-sparks/grab-site,UncleStranger/grab-site,bright-sparks/grab-site | libgrabsite/__init__.py | libgrabsite/__init__.py | __version__ = '0.6.3'
| __version__ = '0.6.2'
| mit | Python |
9d56b33e27a33d6c068e714e9bd0e8923936b74a | fix aug | yu4u/age-gender-estimation,yu4u/age-gender-estimation | src/generator.py | src/generator.py | from pathlib import Path
import numpy as np
import cv2
import albumentations as A
from tensorflow.keras.utils import Sequence
transforms = A.Compose([
A.ShiftScaleRotate(shift_limit=0.03125, scale_limit=0.20, rotate_limit=20, border_mode=cv2.BORDER_CONSTANT,
value=0, p=1.0),
A.RandomBri... | from pathlib import Path
import numpy as np
import cv2
import albumentations as A
from tensorflow.keras.utils import Sequence
transforms = A.Compose([
A.OneOf([
A.ShiftScaleRotate(shift_limit=0.03125, scale_limit=0.20, rotate_limit=20, border_mode=cv2.BORDER_CONSTANT,
value=0, p... | mit | Python |
5559e9f429e9019959f1c79fbc2a7f82c12f91c4 | Fix how hppcorbaserver is killed in ServerManager | humanoid-path-planner/hpp-corbaserver,humanoid-path-planner/hpp-corbaserver | src/hpp/utils.py | src/hpp/utils.py | # Copyright (c) 2020, CNRS
# Authors: Guilhem Saurel <guilhem.saurel@laas.fr>
import os
import subprocess
import time
import hpp.corbaserver
try:
from subprocess import DEVNULL, run
except ImportError: # Python2 fallback
DEVNULL = os.open(os.devnull, os.O_RDWR)
def run(*args):
subprocess.Popen(*... | # Copyright (c) 2020, CNRS
# Authors: Guilhem Saurel <guilhem.saurel@laas.fr>
import os
import subprocess
import time
try:
from subprocess import DEVNULL, run
except ImportError: # Python2 fallback
DEVNULL = os.open(os.devnull, os.O_RDWR)
def run(*args):
subprocess.Popen(*args).wait()
class Se... | bsd-2-clause | Python |
281c6b06762a8899609b5eb660ba459a871445c1 | return empty for NaN and no records | dpeters6/Brachistochrone_2,dpeters6/Brachistochrone_2 | dbSearch.py | dbSearch.py | import os
import requests
import json
from flask import Flask, render_template, request
from mysql import connector
env_var = os.environ["VCAP_SERVICES"]
vcap = json.loads(env_var)
mysql_creds = vcap['cleardb'][0]['credentials']
SCHEMA = mysql_creds['name']
def get_mysql_conn():
conn = connector.connect(host=mysq... | import os
import requests
from flask import Flask, render_template, request
from mysql import connector
env_var = os.environ["VCAP_SERVICES"]
vcap = json.loads(env_var)
mysql_creds = vcap['cleardb'][0]['credentials']
SCHEMA = mysql_creds['name']
def get_mysql_conn():
conn = connector.connect(host=mysql_creds['hos... | apache-2.0 | Python |
c2eb3e5e3a8067e7d796b30d54d352ca05f32db7 | fix error name | KujiraProject/Flask-PAM,KujiraProject/Flask-PAM,kolodziej/Flask-PAM,kolodziej/Flask-PAM | flask_pam/__init__.py | flask_pam/__init__.py | from auth import Auth # pylint: disable=unused-import
import token_storage # pylint: disable=unused-import
import token # pylint: disable=unused-import
| from auth import Auth # pylint: disable=unsed-import
import token_storage # pylint: disable=unused-import
import token # pylint: disable=unused-import
| mit | Python |
e4edaae45402c601ef6e09eab58ef67369f738aa | Update views.py | 02agarwalt/FNGS_website,ebridge2/FNGS_website,ebridge2/FNGS_website,ebridge2/FNGS_website,ebridge2/FNGS_website,02agarwalt/FNGS_website,02agarwalt/FNGS_website | fngs/analyze/views.py | fngs/analyze/views.py | from django.http import HttpResponse, Http404
from django.shortcuts import render, get_object_or_404
from django.views import generic
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.core.urlresolvers import reverse_lazy
from .models import Submission
from .forms import SubmissionFor... | from django.http import HttpResponse, Http404
from django.shortcuts import render, get_object_or_404
from django.views import generic
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.core.urlresolvers import reverse_lazy
from .models import Submission
from .forms import SubmissionFor... | apache-2.0 | Python |
28d5a8190ba1188a563d84b4fba6fb2d2281179c | Fix bug in symbolics comments | jstewmon/proselint,amperser/proselint,amperser/proselint,amperser/proselint,amperser/proselint,amperser/proselint,jstewmon/proselint,jstewmon/proselint | proselint/checks/butterick/symbols.py | proselint/checks/butterick/symbols.py | # -*- coding: utf-8 -*-
"""BTR100: Use the symbols.
---
layout: post
error_code: BTR100
source: Butterick's Practical Typography
source_url: http://practicaltypography.com/
title: Tense present
date: 2014-06-10 12:31:19
categories: writing
---
Use the symbols.
"""
from tools import memoize, existe... | # -*- coding: utf-8 -*-
"""BTR100: Use the symbols.
---
layout: post
error_code: BTR100
source: Butterick's Practical Typography
source_url: http://practicaltypography.com/
title: Tense present
date: 2014-06-10 12:31:19
categories: writing
---
Use the symbols.
"""
from tools import memoize, existe... | bsd-3-clause | Python |
febe4d7ff7dbdcefeb62be8353e69d53fb906ce6 | install I2C and Platform for regular Raspbian | karan259/PivotPi,karan259/PivotPi,karan259/PivotPi | Software/Python/setup.py | Software/Python/setup.py | #!/usr/bin/env python
#
'''
## License
GoPiGo for the Raspberry Pi: an open source robotics platform for the Raspberry Pi.
Copyright (C) 2015 Dexter Industries
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 ... | #!/usr/bin/env python
#
'''
## License
GoPiGo for the Raspberry Pi: an open source robotics platform for the Raspberry Pi.
Copyright (C) 2015 Dexter Industries
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 ... | mit | Python |
39ae7f922b98f5c8fb8743042531097a83804a1c | Remove core import | keras-team/keras-cv,keras-team/keras-cv,keras-team/keras-cv | keras_cv/metrics/serialization_test.py | keras_cv/metrics/serialization_test.py | # Copyright 2022 The KerasCV 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 ... | # Copyright 2022 The KerasCV 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 ... | apache-2.0 | Python |
a4be1e5e8b1eaa924d8fe53230783f74341812b3 | Add WindowsRegistryKeyring to the test suite. | jaraco/keyring | keyring/tests/backends/test_Windows.py | keyring/tests/backends/test_Windows.py | import sys
from ..py30compat import unittest
import keyring.backends.Windows
from ..test_backend import BackendBasicTests
from .test_file import FileKeyringTests
def is_win32_crypto_supported():
try:
__import__('keyring.backends._win_crypto')
except ImportError:
return False
return sys.pl... | import sys
from ..py30compat import unittest
import keyring.backends.Windows
from ..test_backend import BackendBasicTests
from .test_file import FileKeyringTests
def is_win32_crypto_supported():
try:
__import__('keyring.backends._win_crypto')
except ImportError:
return False
return sys.pl... | mit | Python |
0f5dcd5d84c7155fe9feef9f4d9fe6c4a699cd47 | Update for Desktop 5.0.0 release. | timabbott/zulip,andersk/zulip,brainwane/zulip,andersk/zulip,punchagan/zulip,rht/zulip,rht/zulip,kou/zulip,zulip/zulip,eeshangarg/zulip,shubhamdhama/zulip,kou/zulip,timabbott/zulip,eeshangarg/zulip,hackerkid/zulip,punchagan/zulip,shubhamdhama/zulip,showell/zulip,rht/zulip,rht/zulip,showell/zulip,brainwane/zulip,timabbot... | version.py | version.py | import os
ZULIP_VERSION = "2.2.dev+git"
# Add information on number of commits and commit hash to version, if available
zulip_git_version_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'zulip-git-version')
if os.path.exists(zulip_git_version_file):
with open(zulip_git_version_file) as f:
v... | import os
ZULIP_VERSION = "2.2.dev+git"
# Add information on number of commits and commit hash to version, if available
zulip_git_version_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'zulip-git-version')
if os.path.exists(zulip_git_version_file):
with open(zulip_git_version_file) as f:
v... | apache-2.0 | Python |
fe4a5aa9dc11cf4b2f45e861b1f81abca4cd13ff | Add explicit GPLv2 and LGPLv2 option to the licenses | MatthewWilkes/mw4068-packaging,MatthewWilkes/mw4068-packaging,MatthewWilkes/mw4068-packaging,MatthewWilkes/mw4068-packaging | app/soc/models/licenses.py | app/soc/models/licenses.py | #!/usr/bin/env python2.5
#
# Copyright 2009 the Melange 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 applic... | #!/usr/bin/env python2.5
#
# Copyright 2009 the Melange 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 applic... | apache-2.0 | Python |
fdfae21deca179a4cfe5a0233fa1eaf991ed22bd | Set version as 0.4.3 | Alignak-monitoring-contrib/mod-alignakbackend,Alignak-monitoring-contrib/mod-alignakbackend,Alignak-monitoring-contrib/alignak-module-backend,Alignak-monitoring-contrib/alignak-module-backend | version.py | version.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2017:
# David Durieux, david.durieux@alignak.net
#
"""
Alignak - Arbiter, Scheduler and Broker modules for the Alignak backend
"""
# Package name
__pkg_name__ = u"alignak_module_backend"
# Module type for PyPI keywords
# Used for:
# - PyPI keyw... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2017:
# David Durieux, david.durieux@alignak.net
#
"""
Alignak - Arbiter, Scheduler and Broker modules for the Alignak backend
"""
# Package name
__pkg_name__ = u"alignak_module_backend"
# Module type for PyPI keywords
# Used for:
# - PyPI keyw... | agpl-3.0 | Python |
d15e6ab50bf2518b24af4693d015b913eb0efa55 | Fix api endpoints | alexandermendes/pybossa-analyst,alexandermendes/pybossa-analyst,alexandermendes/pybossa-analyst,LibCrowds/libcrowds-analyst | libcrowds_analyst/api.py | libcrowds_analyst/api.py | # -*- coding: utf8 -*-
import json
from rq import Queue
from redis import Redis
from flask import Blueprint, request, current_app, jsonify, abort
from libcrowds_analyst import analysis
BP = Blueprint('api', __name__)
QUEUE = Queue('libcrowds_analyst', connection=Redis())
MINUTE = 60
def analyse(func):
"""Analy... | # -*- coding: utf8 -*-
import json
from rq import Queue
from redis import Redis
from flask import Blueprint, request, current_app, jsonify, abort
from libcrowds_analyst import analysis
BP = Blueprint('api', __name__)
QUEUE = Queue('libcrowds_analyst', connection=Redis())
MINUTE = 60
def analyse(func):
"""Analy... | unknown | Python |
503cc29b03694d2b8daaf3427f2129312cfaf328 | Change the __unicode__ to __str__ | OckiFals/crud-django,OckiFals/crud-django | beer/models.py | beer/models.py | from django.db import models
BEER_CHOICES = (
(1, 'Domestic'),
(2, 'Import'),
)
class Beer(models.Model):
name = models.CharField(max_length=200)
slug = models.SlugField(unique=True)
brewery = models.ForeignKey('Brewery')
locality = models.IntegerField(choices=BEER_CHOICES)
description = m... | from django.db import models
BEER_CHOICES = (
(1, 'Domestic'),
(2, 'Import'),
)
class Beer(models.Model):
name = models.CharField(max_length=200)
slug = models.SlugField(unique=True)
brewery = models.ForeignKey('Brewery')
locality = models.IntegerField(choices=BEER_CHOICES)
description = m... | mit | Python |
06d5886f926df6730f25949d1c2ac6374745384a | comment out ES-dependent tests | puttarajubr/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq | corehq/apps/domain/tests/test_domain_name_generation.py | corehq/apps/domain/tests/test_domain_name_generation.py | from __future__ import print_function, unicode_literals
from django.test import TestCase
from django.test.client import Client
from corehq.apps.domain.models import Domain
class DomainNameGenerationTestBase(TestCase):
def setUp(self):
self.client = Client()
self.domains = []
def add_domain(... | from __future__ import print_function, unicode_literals
from django.test import TestCase
from django.test.client import Client
from corehq.apps.domain.models import Domain
class DomainNameGenerationTestBase(TestCase):
def setUp(self):
self.client = Client()
self.domains = []
def add_domain(... | bsd-3-clause | Python |
9858bcab75f56cf98328ae8c6c9ee025b3ff8bb0 | customize 503 message for superusers and support | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/cloudcare/decorators.py | corehq/apps/cloudcare/decorators.py | from functools import wraps
from django.http import HttpResponse
from corehq.apps.domain.decorators import login_and_domain_required
from corehq import toggles
from corehq.apps.users.decorators import require_permission
from corehq.apps.users.models import Permissions
def require_cloudcare_access_ex():
"""
... | from functools import wraps
from django.http import HttpResponse
from corehq.apps.domain.decorators import login_and_domain_required
from corehq.toggles import DISABLE_WEB_APPS
from corehq.apps.users.decorators import require_permission
from corehq.apps.users.models import Permissions
def require_cloudcare_access_e... | bsd-3-clause | Python |
0babe81bdcd9375e208b016ec3f3c54936403a4b | fix some imports and whitespace in mock_afp | ImmobilienScout24/afp-cli,ImmobilienScout24/afp-cli,ImmobilienScout24/afp-cli | src/cmdlinetest/afp_mock.py | src/cmdlinetest/afp_mock.py | #!/usr/bin/env python
from bottle import route
from bottledaemon import daemon_run
from textwrap import dedent
@route('/account')
def account():
return """{"test_account": ["test_role"]}"""
@route('/account/<account>/<role>')
def credentials(account, role):
return dedent("""
{"Code": "Succ... | #!/usr/bin/env python
from bottle import route, run, response
from bottledaemon import daemon_run
from textwrap import dedent
@route('/account')
def account():
return """{"test_account": ["test_role"]}"""
@route('/account/<account>/<role>')
def credentials(account, role):
return dedent("""
... | apache-2.0 | Python |
9031ecff2a128f5e33039a349eccfad80b24f1c5 | Update P2_imageDownloader working solution | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter11/PracticeProjects/P2_imageDownloader.py | books/AutomateTheBoringStuffWithPython/Chapter11/PracticeProjects/P2_imageDownloader.py | # Write a program that goes to a photo-sharing site like Flickr or Imgur,
# searches for a category of photos, and then downloads all the resulting images.
# You could write a program that works with any photo site that has a search feature.
#
# NOTES:
# - Many photo-sharing sites do not want direct download links easi... | # Write a program that goes to a photo-sharing site like Flickr or Imgur,
# searches for a category of photos, and then downloads all the resulting images.
# You could write a program that works with any photo site that has a search feature.
import requests, os, bs4
from selenium import webdriver, common
# Open Brows... | mit | Python |
d18232644dccd7403f135760e164acf8dc503899 | Clean up | daviddoji/PyEng,shantnu/PyEng,daviddoji/PyEng,shantnu/PyEng,daviddoji/PyEng,shantnu/PyEng,shantnu/PyEng,daviddoji/PyEng | audio/noisy.py | audio/noisy.py | #! /usr/bin/python
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import numpy as np
import wave
import struct
import matplotlib.pyplot as plt
# frequency is the number of times a wave repeats a second
frequency = 1000
noisy_freq = 50
num_samples = 48000
... | #! /usr/bin/python
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import numpy as np
import wave
import struct
import matplotlib.pyplot as plt
# frequency is the number of times a wave repeats a second
frequency = 1000
noisy_freq = 50
num_samples = 48000
... | mit | Python |
0b7c597151a8728f98d7d5ff48253860289593ec | Add format option | Josef-Friedrich/audiorename | audiorename.py | audiorename.py | #! /usr/bin/env python
import os, sys, argparse, textwrap
from beets.mediafile import MediaFile
from beets.util.functemplate import Template
from beets.library import DefaultTemplateFunctions as Functions
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter,
description=textwrap.d... | #! /usr/bin/env python
import os, sys, argparse, textwrap
from beets.mediafile import MediaFile
from beets.util.functemplate import Template
from beets.library import DefaultTemplateFunctions as Functions
fields = MediaFile.fields()
parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpForma... | mit | Python |
52e5c3fb10a931bf0085bc11e3adab29d4d5418c | Implement the bulk of functionality. It now parses and does nothing with it. | Rosuav/shed,Rosuav/shed,Rosuav/shed,Rosuav/shed,Rosuav/shed | auto-volume.py | auto-volume.py | # Build auto-volume.lua from the template and a JSON file of data
import os
import re
import argparse
import pydub
# Expects a series of paths as arguments. Files will be checked;
# directories will be recursed into. Unreadable or unparseable files
# will be ignored.
file_info = {}
# TODO: Read from auto-volume.json
... | # Build auto-volume.lua from the template and a JSON file of data
import os
import re
import shutil
import pydub
# Expects a series of paths as arguments. Files will be checked;
# directories will be recursed into. Unreadable or unparseable files
# will be ignored.
file_info = {}
# TODO: Read from auto-volume.json
d... | mit | Python |
50f15b98c4d91131a945937cc8e7fb7d68ee1fbc | add elbo and other metrics | gdikov/vae-playground | avb/metrics.py | avb/metrics.py | import numpy as np
import logging
logger = logging.getLogger(__name__)
try:
from third_party.ite.cost import MDKL_HSCE as D_KL
except ImportError:
D_KL = None
logger.error("Cannot import ITE package (probably) for using a Python 2 interpreter. "
"Using any KL divergence based algorithm will... | from third_party.ite.cost import MDKL_HSCE as D_KL
import numpy as np
class KLDivergenceEstimator(object):
def __init__(self, reference_dist='standard_normal'):
self.estimator = D_KL.estimation
if reference_dist == 'standard_normal':
self.ref_distribution = np.random.randn
else... | mit | Python |
575efb9285d4208bfd7596c43a3319476f90b98a | Use ~/Music directory | jdloft/py-skyjam | download.py | download.py | import sys
import os
import logging
from gmusicapi.clients import Musicmanager
logging.basicConfig(filename='dl.log', level=logging.DEBUG)
def fix(path):
# OSX: : -> FULLWIDTH COLON (U+FF1A)
# OSX: / -> : (translated as / in Cocoa)
# LINUX: / -> DIVISION SLASH (U+2215)
path = path.replace(':', ... | import sys
import os
import logging
from gmusicapi.clients import Musicmanager
logging.basicConfig(filename='dl.log', level=logging.DEBUG)
def fix(path):
# OSX: : -> FULLWIDTH COLON (U+FF1A)
# OSX: / -> : (translated as / in Cocoa)
# LINUX: / -> DIVISION SLASH (U+2215)
path = path.replace(':', ... | bsd-3-clause | Python |
896136f763d883049cb449d5fb560d70e4563adc | Update check_bytesize.py | joshavenue/python_notebook | notebook2/check_bytesize.py | notebook2/check_bytesize.py | msg = 'The world is a funny place to live.'
file = open('hi.txt', 'w')
amount_written = file.write(msg)
print(amount_written)
file.close()
## file.write(x) is the same as len(x) ##
| msg = 'The world is a funny place to live.'
file = open('hi.txt', 'w')
amount_written = file.write(msg)
print(amount_written)
file.close()
| unlicense | Python |
71bb3587bc0f75a116736aeaf007e3723d4bab0e | Bump version | vmalloc/backslash-python,slash-testing/backslash-python | backslash/__version__.py | backslash/__version__.py | __version__ = '2.26.1'
| __version__ = '2.26.0'
| bsd-3-clause | Python |
9f648ac80ee01709c946561c90c83575a4263c79 | Fix indentation and PEP8 | cifvts/PyEuler | euler036.py | euler036.py | #!/usr/bin/python
from math import pow
LIMIT = 1000000
palindrome_sum = 0
def is_palindrome(res):
return res == res[::-1]
def binary(x):
res = []
while(x):
res.insert(0, x % 2)
x //= 2
return res
for palindrome in range(1, LIMIT):
if(is_palindrome(list(str(palindrome)))):
... | #!/usr/bin/python
from math import pow
LIMIT = 1000000
palindrome_sum = 0
def is_palindrome(res):
return res == res[::-1]
def binary(x):
res = []
while(x):
res.insert(0, x % 2)
x //= 2
return res
for palindrome in range(1, LIMIT):
if(is_palindrome(list(str(palindrome)))):
binary_n = binary(palindrome)
... | mit | Python |
4cfe530d52ed5b1a2157d80bd4853a68219c9693 | Fix for snakebite logging. | jkafader/trough,jkafader/trough | bin/settings.py | bin/settings.py | import logging
import yaml
import sys
import os
import socket
def get_ip():
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("example.com", 80))
output = s.getsockname()[0]
s.close()
return output
def get_storage_in_bytes(settings):
'''
Set a reasonable def... | import logging
import yaml
import sys
import os
import socket
def get_ip():
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("example.com", 80))
output = s.getsockname()[0]
s.close()
return output
def get_storage_in_bytes(settings):
'''
Set a reasonable def... | bsd-2-clause | Python |
4d414915824c0c20860bf8b90443974c2939b012 | Fix to setup.py | cwho/pyfileserver | PyFileServer/setup.py | PyFileServer/setup.py | # If true, then the svn revision won't be used to calculate the
# revision (set to True for real releases)
RELEASE = False
__version__ = "0.1"
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
setup(name="PyFileServer",
version=__version__,
description="Pyth... | # If true, then the svn revision won't be used to calculate the
# revision (set to True for real releases)
RELEASE = False
__version__ = "0.1"
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
setup(name="PyFileServer",
version=__version__,
description="Pyth... | lgpl-2.1 | Python |
e165e403948aea79fe3f7f61f2baa97f97a79f2a | Deal with missing blocks and refactor BlockViewer | azeteki/bitcoind-ncurses,esotericnonsense/bitcoind-ncurses | block_viewer.py | block_viewer.py | #!/usr/bin/env python
import curses
import calendar
import gevent
import time
import global_mod as g
import getstr
class BlockViewer(object):
def __init__(self, block_store, window):
self._block_store = block_store
self._window = window
self._mode = None # TODO debug
self._browse... | #!/usr/bin/env python
import curses
import calendar
import gevent
import time
import global_mod as g
import getstr
class BlockViewer(object):
def __init__(self, block_store, window):
self._block_store = block_store
self._window = window
self._mode = None # TODO debug
self._browse... | mit | Python |
58842345bc88acc98921f7c2187e07d665211f86 | change env variable to verbosity | termicoder/termicoder,termicoder/termicoder | termicoder/cli/__init__.py | termicoder/cli/__init__.py | import click
import click_log
from .view import main as view
from . import code
from . import debug
from . import setup
from . import submit
from . import test
from . import repl
from . import config
from . import ls
from . import clip
from ..utils.logging import logger
from ..utils.config import check_config_path
from... | import click
import click_log
from .view import main as view
from . import code
from . import debug
from . import setup
from . import submit
from . import test
from . import repl
from . import config
from . import ls
from . import clip
from ..utils.logging import logger
from ..utils.config import check_config_path
from... | mit | Python |
9faa04f61e7e83076c1a0e6c0466cdeafc689fba | Fix deprecation decorator not working on 2.6. | patrys/opbeat_python,tarkatronic/opbeat_python,beniwohli/apm-agent-python,patrys/opbeat_python,beniwohli/apm-agent-python,dirtycoder/opbeat_python,ticosax/opbeat_python,dirtycoder/opbeat_python,ticosax/opbeat_python,daikeren/opbeat_python,tarkatronic/opbeat_python,beniwohli/apm-agent-python,patrys/opbeat_python,daikere... | opbeat/utils/deprecation.py | opbeat/utils/deprecation.py | import warnings
import functools
# https://wiki.python.org/moin/PythonDecoratorLibrary#Smart_deprecation_warnings_.28with_valid_filenames.2C_line_numbers.2C_etc..29
def deprecated(alternative=None):
'''This is a decorator which can be used to mark functions
as deprecated. It will result in a warning being em... | import warnings
import functools
# https://wiki.python.org/moin/PythonDecoratorLibrary#Smart_deprecation_warnings_.28with_valid_filenames.2C_line_numbers.2C_etc..29
def deprecated(alternative=None):
'''This is a decorator which can be used to mark functions
as deprecated. It will result in a warning being em... | bsd-3-clause | Python |
e630d58006eb9649cd55a11e38e052823526cbb5 | Update ipc_lista2.04.py | any1m1c/ipc20161 | lista2/ipc_lista2.04.py | lista2/ipc_lista2.04.py | #ipc_lista2.04
#Professor: Jucimar Junior
#Any Mnedes Carvalho - 1615310044
#
#
#
#
#Faça um programa que verifique se uma letra digitada é vogal ou consoante.
letra = raw_input("INforme uma letra: ")
if (letra == "a" or letra == "e" or letra == "i" or letra == "o" or letra = "u"):
print (letra
| #ipc_lista2.04
#Professor: Jucimar Junior
#Any Mnedes Carvalho - 1615310044
#
#
#
#
#Faça um programa que verifique se uma letra digitada é vogal ou consoante.
letra = raw_input("INforme uma letra: ")
if (letra == "a" or letra == "e" or letra == "i" or letra == "o" or letra = "u"):
print
| apache-2.0 | Python |
79f11c9224972e5df3ec2fcef52f85ceb3b71b95 | Simplify pie example, remove Counter (#8087) | ericmjl/bokeh,bokeh/bokeh,dennisobrien/bokeh,timsnyder/bokeh,jakirkham/bokeh,ericmjl/bokeh,dennisobrien/bokeh,ericmjl/bokeh,jakirkham/bokeh,mindriot101/bokeh,jakirkham/bokeh,dennisobrien/bokeh,bokeh/bokeh,dennisobrien/bokeh,mindriot101/bokeh,bokeh/bokeh,jakirkham/bokeh,timsnyder/bokeh,jakirkham/bokeh,bokeh/bokeh,mindri... | examples/plotting/file/pie.py | examples/plotting/file/pie.py | from math import pi
import pandas as pd
from bokeh.io import output_file, show
from bokeh.palettes import Category20c
from bokeh.plotting import figure
from bokeh.transform import cumsum
output_file("pie.html")
x = {
'United States': 157,
'United Kingdom': 93,
'Japan': 89,
'China': 63,
'Germany'... | from collections import Counter
from math import pi
import pandas as pd
from bokeh.io import output_file, show
from bokeh.palettes import Category20c
from bokeh.plotting import figure
from bokeh.transform import cumsum
output_file("pie.html")
x = Counter({
'United States': 157,
'United Kingdom': 93,
'Ja... | bsd-3-clause | Python |
e61753febb08b080c807669f0acb28697c8c9a7e | set AUTOSYNTH_MULTIPLE_COMMITS=true for context aware commits (#304) | googleapis/google-cloud-node,googleapis/google-cloud-node,googleapis/google-cloud-node,googleapis/google-cloud-node | packages/google-cloud-resourcemanager/synth.py | packages/google-cloud-resourcemanager/synth.py | import synthtool as s
import synthtool.gcp as gcp
import logging
import subprocess
logging.basicConfig(level=logging.DEBUG)
AUTOSYNTH_MULTIPLE_COMMITS = True
common_templates = gcp.CommonTemplates()
templates = common_templates.node_library(source_location="build/src")
s.copy(templates)
| import synthtool as s
import synthtool.gcp as gcp
import logging
import subprocess
logging.basicConfig(level=logging.DEBUG)
common_templates = gcp.CommonTemplates()
templates = common_templates.node_library(source_location="build/src")
s.copy(templates)
| apache-2.0 | Python |
64a9e5a86189544a4f03319ad4a2114a407ab881 | Fix foreign key missing in admin list view. | weijia/djangoautoconf,weijia/djangoautoconf | djangoautoconf/auto_conf_admin_tools/list_and_search.py | djangoautoconf/auto_conf_admin_tools/list_and_search.py | from django.db.models import DateTimeField, ForeignKey
from djangoautoconf.auto_conf_admin_tools.admin_feature_base import AdminFeatureBase
__author__ = 'weijia'
class ListAndSearch(AdminFeatureBase):
def __init__(self):
super(ListAndSearch, self).__init__()
self.search_fields = []
self.l... | from django.db.models import DateTimeField, ForeignKey
from djangoautoconf.auto_conf_admin_tools.admin_feature_base import AdminFeatureBase
__author__ = 'weijia'
class ListAndSearch(AdminFeatureBase):
def __init__(self):
super(ListAndSearch, self).__init__()
self.search_fields = []
self.l... | bsd-3-clause | Python |
746d3cfa049559de33364a974f6b80e840d12494 | Remove unnecessary helpers | jwittenbach/bolt,bolt-project/bolt,andrewosh/bolt | bolt/spark/utils.py | bolt/spark/utils.py | def get_kv_shape(shape, key_axes):
func = lambda axis: shape[axis]
return _get_kv_func(func, shape, key_axes)
def get_kv_axes(shape, key_axes):
func = lambda axis: axis
return _get_kv_func(func, shape, key_axes)
def _get_kv_func(func, shape, key_axes):
key_res = [func(axis) for axis in key_axes]
... | def get_kv_shape(shape, key_axes):
func = lambda axis: shape[axis]
return _get_kv_func(func, shape, key_axes)
def get_kv_axes(shape, key_axes):
func = lambda axis: axis
return _get_kv_func(func, shape, key_axes)
def _get_kv_func(func, shape, key_axes):
key_res = [func(axis) for axis in key_axes]
... | apache-2.0 | Python |
9eacd1f80516145190b2c9f0a42ad8e08ed19665 | Make test python 2/3 str/unicode compatible | pytorch/text,pytorch/text,pytorch/text,pytorch/text | test/data/test_pipeline.py | test/data/test_pipeline.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import six
import torchtext.data as data
from ..common.torchtext_test_case import TorchtextTestCase
class TestPipeline(TorchtextTestCase):
@staticmethod
def repeat_n(x, n=3):
"""
Given a sequence, repeat it n times.
"""
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import torchtext.data as data
from ..common.torchtext_test_case import TorchtextTestCase
class TestPipeline(TorchtextTestCase):
@staticmethod
def repeat_n(x, n=3):
"""
Given a sequence, repeat it n times.
"""
retu... | bsd-3-clause | Python |
333ce66e8c87a832a8773674504f7f44db4cd6ff | Fix error loading configuration | geronimo-iia/brume,flou/brume | brume/config.py | brume/config.py | import os
import yaml
from subprocess import check_output, CalledProcessError
from colors import red
from jinja2 import Template
class Config():
@staticmethod
def env(key):
"""Return the value of the `key` environment variable."""
try:
return os.environ[key]
except KeyErr... | import os
import yaml
from subprocess import check_output, CalledProcessError
from colors import red
from jinja2 import Template
class Config():
@staticmethod
def env(key):
"""Return the value of the `key` environment variable."""
try:
return os.environ[key]
except KeyErr... | mit | Python |
c0a74ce4110d295b3662066e4d08c4ab65fb0905 | Mark pre-selected topics on form | jamesturk/tot,jamesturk/tot,jamesturk/tot,jamesturk/tot,jamesturk/tot | bills/views.py | bills/views.py |
from django.db import transaction
from django.shortcuts import render, redirect
from preferences.views import _mark_selected
from bills.utils import get_all_subjects, get_all_locations
from opencivicdata.models import Bill
def bill_list(request):
subjects = get_all_subjects()
if request.POST.getlist('bill... |
from django.shortcuts import render, redirect
from bills.utils import get_all_subjects, get_all_locations
from opencivicdata.models import Bill
def bill_list(request):
subjects = get_all_subjects()
if request.POST.getlist('bill_subjects'):
filter_subjects = request.POST.getlist('bill_subjects')
... | mit | Python |
e04d1a96d9a704332e85b88a0841177a21c533ff | Bump version to 0.2.1a (#274) | quantumlib/OpenFermion-Cirq,quantumlib/OpenFermion-Cirq | openfermioncirq/_version.py | openfermioncirq/_version.py | # 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 writing, software
# distributed under t... | # 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 writing, software
# distributed under t... | apache-2.0 | Python |
43e36abbcaa09e347500dbb02e91ca4e026a8957 | Remove influence | charanpald/APGL | exp/influence2/GraphRanker.py | exp/influence2/GraphRanker.py | import numpy
import logging
from exp.influence2.MaxInfluence import MaxInfluence
class GraphRanker(object):
def __init__(self):
pass
@staticmethod
def rankedLists(graph, k=100, p=0.5):
"""
Return a list of ranked lists. The list is: betweenness, pagerank,
degre... | import numpy
import logging
from exp.influence2.MaxInfluence import MaxInfluence
class GraphRanker(object):
def __init__(self):
pass
@staticmethod
def rankedLists(graph, k=100, p=0.5):
"""
Return a list of ranked lists. The list is: betweenness, pagerank,
degre... | bsd-3-clause | Python |
21ed6883602d34adcb58db44d17aedec2bcd0421 | Update cozmo_minibot.py | cornell-cup/cs-minibot-platform,cornell-cup/cs-minibot-platform,cornell-cup/cs-minibot-platform,cornell-cup/cs-minibot-platform,cornell-cup/cs-minibot-platform,cornell-cup/cs-minibot-platform | python-interface/bot/cozmo_minibot.py | python-interface/bot/cozmo_minibot.py | from received.base_minibot import BaseMiniBot
import cozmo
import time
from cozmo.util import distance_mm, speed_mmps, degrees
class CozmoMiniBot(BaseMiniBot):
def __init__(self):
BaseMiniBot.__init__(self)
self.robot=cozmo.robot.Robot
self.action=None
def move_forward(self, power):
if... | from received.base_minibot import BaseMiniBot
import cozmo
import time
from cozmo.util import distance_mm, speed_mmps, degrees
class CozmoMiniBot(BaseMiniBot):
def __init__(self):
BaseMiniBot.__init__(self)
self.robot=cozmo.robot.Robot
def move_forward(self, power):
#TODO: FIX
... | apache-2.0 | Python |
32bcb328ae5d748535b46bedb1af85bc93981a46 | Add downloading of the devdata.env file for secret env vars | hypothesis/via,hypothesis/via,hypothesis/via | bin/devdata.py | bin/devdata.py | """Download dev data from github.com:hypothesis/devdata.git."""
import os
from pathlib import Path
from shutil import copyfile
from subprocess import check_call
from tempfile import TemporaryDirectory
def _get_devdata():
# The directory that we'll clone the devdata git repo into.
with TemporaryDirectory() as... | """Download .devdata from github.com:hypothesis/devdata.git."""
import os
from pathlib import Path
from shutil import copyfile
from subprocess import check_call
from tempfile import TemporaryDirectory
def _get_devdata():
# The directory that we'll clone the devdata git repo into.
with TemporaryDirectory() as... | bsd-2-clause | Python |
60a62fbf034e18e2117a929b856d0f4cf644e9d3 | Revert "Changed sms2irc app to use Router.get_backend." | rapidsms/rapidsms-legacy,rapidsms/rapidsms-legacy,rapidsms/rapidsms-legacy | apps/sms2irc/app.py | apps/sms2irc/app.py | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import rapidsms
from rapidsms.message import Message
# a pointless app to demonstrate the structure
# of sms applications without magic decorators
class App(rapidsms.app.App):
def start(self):
self.name = 'sms2irc'
self.irc_backend = None
... | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import rapidsms
from rapidsms.message import Message
# a pointless app to demonstrate the structure
# of sms applications without magic decorators
class App(rapidsms.app.App):
def start(self):
self.irc_backend = self.router.get_backend('irc')
def pa... | bsd-3-clause | Python |
58a9baa31df52946f62a3738af354911f639042a | Fix reclimit bug. | christianlundkvist/bitcoinista | bitcoinista.py | bitcoinista.py | import sys
import bitcoinista
# Supported user modes are:
# 'mainnet'
# 'demo'
user_mode = 'mainnet'
if __name__ == '__main__':
# Pythonista resets recursion
# limit to 256 in the interpreter
# so we need to force it here
reclimit = sys.getrecursionlimit()
if reclimit < 1000:
sys.setrecu... | import sys
import bitcoinista
user_mode = 'mainnet'
if __name__ == '__main__':
# Pythonista resets recursion
# limit to 256 in the interpreter
# so we need to force it here
reclimit = sys.getrecursionlimit()
if reclimit > 1000:
sys.setrecursionlimit(1000)
ctrl = bitcoinista.TextControl... | mit | Python |
7db5021d5fbb726bdf3d7d0866a278e47a7d61ca | fix flake | martinlunde/RealBack,martinlunde/RealBack,martinlunde/RealBack | emailauth/views.py | emailauth/views.py |
from django.shortcuts import render, redirect
from . import forms
def register(request):
""" Register a new user """
if request.method == 'POST':
form = forms.UserCreationForm(request.POST)
if form.is_valid():
form.save(commit=True)
return redirect('lecturer:front_page... |
from django.shortcuts import render, redirect
from . import forms
def register(request):
""" Register a new user """
if request.method == 'POST':
form = forms.UserCreationForm(request.POST)
if form.is_valid():
user = form.save(commit=True)
return redirect('lecturer:fro... | mit | Python |
3a56bfee36a2d689e37b6476a953b94fc1522ee7 | Fix docstring. | amorphic/braubuddy,amorphic/braubuddy,amorphic/braubuddy | braubuddy/tests/output/test_libratoapi.py | braubuddy/tests/output/test_libratoapi.py | """
Braubuddy LibratoAPI unit tests.
"""
from mock import call, patch, MagicMock
from braubuddy.tests import BraubuddyTestCase
from braubuddy.output import libratoapi
@patch('braubuddy.output.libratoapi.librato.connect')
class LibratoAPIOutput(BraubuddyTestCase):
def test_librato_api_connect(self, mk_libratoapi... | """
Braubuddy LibratoAPI unit tests
"""
from mock import call, patch, MagicMock
from braubuddy.tests import BraubuddyTestCase
from braubuddy.output import libratoapi
@patch('braubuddy.output.libratoapi.librato.connect')
class LibratoAPIOutput(BraubuddyTestCase):
def test_librato_api_connect(self, mk_libratoapi_... | bsd-3-clause | Python |
17459fa2fbc1f56a34382473b6100799778d4405 | Unify test configuration settings for local and travis testing. | harvard-vpal/bridge-adaptivity,harvard-vpal/bridge-adaptivity,harvard-vpal/bridge-adaptivity,harvard-vpal/bridge-adaptivity | bridge_adaptivity/config/settings/test.py | bridge_adaptivity/config/settings/test.py | # coding: utf-8
from config.settings.local import * # noqa: F401,F403
TEST_RUNNER = 'config.test_runner.PytestTestRunner'
UPDATE_DATABASE = {'NAME': 'traviscidb', 'HOST': 'localhost'}
try:
from . import secure
UPDATE_DATABASE['PORT'] = 5430
except ImportError:
from . import secure_example as secure
DAT... | # coding: utf-8
from config.settings.local import * # noqa: F401,F403
TEST_RUNNER = 'config.test_runner.PytestTestRunner'
UPDATE_DATABASE = {'NAME': 'traviscidb'}
try:
from . import secure
except ImportError:
from . import secure_example as secure
UPDATE_DATABASE['HOST'] = 'localhost'
DATABASES = secur... | bsd-3-clause | Python |
0938e19f15c0192ba2051cba665408207dec32df | Update decode-ways.py | tudennis/LeetCode---kamyu104-11-24-2015,jaredkoontz/leetcode,githubutilities/LeetCode,yiwen-luo/LeetCode,yiwen-luo/LeetCode,yiwen-luo/LeetCode,kamyu104/LeetCode,githubutilities/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,jaredkoontz/lee... | Python/decode-ways.py | Python/decode-ways.py | # Time: O(n)
# Space: O(1)
#
# A message containing letters from A-Z is being encoded to numbers using the following mapping:
#
# 'A' -> 1
# 'B' -> 2
# ...
# 'Z' -> 26
# Given an encoded message containing digits, determine the total number of ways to decode it.
#
# For example,
# Given encoded message "12", it coul... | # Time: O(n)
# Space: O(1)
#
# A message containing letters from A-Z is being encoded to numbers using the following mapping:
#
# 'A' -> 1
# 'B' -> 2
# ...
# 'Z' -> 26
# Given an encoded message containing digits, determine the total number of ways to decode it.
#
# For example,
# Given encoded message "12", it coul... | mit | Python |
f2285e7f1f0ea76e084c14842b224fcecfd28625 | fix FuturePrimariesBatchHandler | evernym/plenum,evernym/zeno | plenum/server/future_primaries_batch_handler.py | plenum/server/future_primaries_batch_handler.py | import copy
from collections import OrderedDict
from typing import Tuple, Dict
from common.exceptions import LogicError
from plenum.common.constants import TXN_TYPE, NODE, TARGET_NYM, ALIAS, SERVICES, VALIDATOR, DATA, POOL_LEDGER_ID
from plenum.common.util import getMaxFailures
from plenum.server.batch_handlers.batch_... | import copy
from collections import OrderedDict
from typing import Tuple, Dict
from common.exceptions import LogicError
from plenum.common.constants import TXN_TYPE, NODE, TARGET_NYM, ALIAS, SERVICES, VALIDATOR, DATA, POOL_LEDGER_ID
from plenum.common.util import getMaxFailures
from plenum.server.batch_handlers.batch_... | apache-2.0 | Python |
d78f1edd09b0d8c097d7fe79eb322bdc310e5604 | Tweak unit tests parameters for boot_dqn. | deepmind/bsuite,deepmind/bsuite | bsuite/baselines/jax/boot_dqn/run_test.py | bsuite/baselines/jax/boot_dqn/run_test.py | # python3
# pylint: disable=g-bad-file-header
# Copyright 2019 DeepMind Technologies Limited. 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... | # python3
# pylint: disable=g-bad-file-header
# Copyright 2019 DeepMind Technologies Limited. 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... | apache-2.0 | Python |
bb262cf2dd6cc8a8498419935afb1e79f68ff27c | Add template and static files dirs to the settings. | Alexx-G/django-project-template,Alexx-G/django-project-template | src/config/settings/base.py | src/config/settings/base.py | """
Django settings for project_name project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/stable/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR,... | """
Django settings for project_name project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/stable/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR,... | mit | Python |
54e1a69b09aaaaa6299a7b8d1dfd4bfc7ab3e792 | allow deletion of contact to any user | ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo | addons/point_of_sale/models/res_partner.py | addons/point_of_sale/models/res_partner.py | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
from odoo.exceptions import UserError
class ResPartner(models.Model):
_inherit = 'res.partner'
pos_order_count = fields.Integer(
compute='_compute_pos_order',
... | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
from odoo.exceptions import UserError
class ResPartner(models.Model):
_inherit = 'res.partner'
pos_order_count = fields.Integer(
compute='_compute_pos_order',
... | agpl-3.0 | Python |
e13cc68ae2465a23d17ad93b6a508314e37c4fda | undo test string | vishalsodani/explore-algos | pascals.py | pascals.py | import math
n = 5
space = ' '
def print_pascals_traingle():
"""
Using the idea that each line of a pascal's traingle can be created by
raising 11 to some power; but breaks down after the 5th line
Another observation is that the number of spaces in the begining and
in the end decrease as we go d... | import math
n = 5
space = ' '
#test
def print_pascals_traingle():
"""
Using the idea that each line of a pascal's traingle can be created by
raising 11 to some power; but breaks down after the 5th line
Another observation is that the number of spaces in the begining and
in the end decrease as we... | mit | Python |
8e1997d36c79d02a29f19a76de579a3672e229a9 | Add print statements | ddsnowboard/FantasyStocks,ddsnowboard/FantasyStocks,ddsnowboard/FantasyStocks | fantasyStocks/stocks/tests.py | fantasyStocks/stocks/tests.py | from django.test import TestCase
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.contrib.staticfiles.templatetags.staticfiles import static
from stocks.models import *
import json
import time
from functools import reduce
import urllib
class ScoringStressTestCase(StaticLiveServerTest... | from django.test import TestCase
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.contrib.staticfiles.templatetags.staticfiles import static
from stocks.models import *
import json
import time
from functools import reduce
import urllib
class ScoringStressTestCase(StaticLiveServerTest... | apache-2.0 | Python |
f3c45e1fbc8bb7a4de619fbd958d61e1736ab190 | Update test_commands to work with updated XML generation | PythonScanClient/PyScanClient,PythonScanClient/PyScanClient | Test/test_commands.py | Test/test_commands.py |
import unittest
import xml.etree.ElementTree as ET
from scan.commands import *
# These tests compare the XML as strings, even though for example
# both "<comment><text>Hello</text></comment>"
# and "<comment>\n <text>Hello</text>\n</comment>"
# would be acceptable XML representations.
# Changes to the XML could resu... |
import unittest
from scan.commands import *
# These tests compare the XML as strings, even though for example
# both "<comment><text>Hello</text></comment>"
# and "<comment>\n <text>Hello</text>\n</comment>"
# would be acceptable XML representations.
# Changes to the XML could result in the need to update the tests.... | epl-1.0 | Python |
4a7f3cb59f8a3b8d1be44d270f24062596d24d11 | fix failing test | squirrelo/plate-mapper,squirrelo/plate-mapper | platemap/lib/tests/test_web_helpers.py | platemap/lib/tests/test_web_helpers.py | # -----------------------------------------------------------------------------
# Copyright (c) 2016--, The Plate Mapper Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------... | # -----------------------------------------------------------------------------
# Copyright (c) 2016--, The Plate Mapper Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# -----------------------------------------... | bsd-3-clause | Python |
622bd10946f70a7141c72311d897e869b369e5df | add date data [mandatory] | gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext | erpnext/stock/doctype/delivery_trip/test_delivery_trip.py | erpnext/stock/doctype/delivery_trip/test_delivery_trip.py | # -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import unittest
import erpnext
import frappe
from erpnext.stock.doctype.delivery_trip.delivery_trip import get_contact_and_address, notify_customers
from erpnext.tests... | # -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import unittest
import erpnext
import frappe
from erpnext.stock.doctype.delivery_trip.delivery_trip import get_contact_and_address, notify_customers
from erpnext.tests... | agpl-3.0 | Python |
c5496fddccffd2f16c0b4a140506b9d577d50b61 | Add property to provide template fragment name | jawed123/pinax-eventlog,pinax/pinax-eventlog,KleeTaurus/pinax-eventlog,rosscdh/pinax-eventlog | eventlog/models.py | eventlog/models.py | from django.conf import settings
from django.db import models
from django.utils import timezone
import jsonfield
from .signals import event_logged
class Log(models.Model):
user = models.ForeignKey(
getattr(settings, "AUTH_USER_MODEL", "auth.User"),
null=True,
on_delete=models.SET_NULL
... | from django.conf import settings
from django.db import models
from django.utils import timezone
import jsonfield
from .signals import event_logged
class Log(models.Model):
user = models.ForeignKey(
getattr(settings, "AUTH_USER_MODEL", "auth.User"),
null=True,
on_delete=models.SET_NULL
... | mit | Python |
a9883d74be5e834727f7305893fe6ec196ba2d84 | Improve error message | tiexinliu/geospatial,riess82/geospatial,Endika/geospatial,tiexinliu/geospatial,tiexinliu/geospatial,dreispt/geospatial,acsone/geospatial,Endika/geospatial,laslabs/geospatial,laslabs/geospatial,Endika/geospatial,riess82/geospatial,acsone/geospatial,dreispt/geospatial,laslabs/geospatial,dreispt/geospatial,riess82/geospat... | base_geoengine/geo_db.py | base_geoengine/geo_db.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi
# Copyright 2011-2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi
# Copyright 2011-2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... | agpl-3.0 | Python |
6cf694c13152da49dcdbe26a356562226926687b | Add in IP attribute. | TeaBough/calico-docker,L-MA/calico-docker,caseydavenport/calico-containers,CiscoCloud/calico-docker,dalanlan/calico-docker,projectcalico/calico-docker,dalanlan/calico-docker,robbrockbank/calico-docker,projectcalico/calico-containers,Symmetric/calico-docker,caseydavenport/calico-containers,frostynova/calico-docker,inseq... | calico_containers/tests/st/docker_host.py | calico_containers/tests/st/docker_host.py | import sh
from sh import docker
from utils import get_ip, delete_container
class DockerHost(object):
"""
A host container which will hold workload containers to be networked by calico.
"""
def __init__(self, name):
"""
Create a container using an image made for docker-in-docker. Load ... | import sh
from sh import docker
from utils import get_ip, delete_container
class DockerHost(object):
"""
A host container which will hold workload containers to be networked by calico.
"""
def __init__(self, name):
"""
Create a container using an image made for docker-in-docker. Load ... | apache-2.0 | Python |
16ab16775c8b5014f7e7127833302bf6e6c6930f | Add missing MIME type in code previewer | ThiefMaster/indico-plugins,ThiefMaster/indico-plugins,ThiefMaster/indico-plugins,indico/indico-plugins,indico/indico-plugins,indico/indico-plugins,indico/indico-plugins,ThiefMaster/indico-plugins | previewer_code/indico_previewer_code/plugin.py | previewer_code/indico_previewer_code/plugin.py | # This file is part of the Indico plugins.
# Copyright (C) 2002 - 2020 CERN
#
# The Indico plugins are free software; you can redistribute
# them and/or modify them under the terms of the MIT License;
# see the LICENSE file for more details.
import mimetypes
from flask import render_template
from pygments import high... | # This file is part of the Indico plugins.
# Copyright (C) 2002 - 2020 CERN
#
# The Indico plugins are free software; you can redistribute
# them and/or modify them under the terms of the MIT License;
# see the LICENSE file for more details.
import mimetypes
from flask import render_template
from pygments import high... | mit | Python |
aa88358a50fa96bf0daf30d9389159621328f90e | Simplify proxy setting code to allow for passing further environmental settings in the future #2 | chapmanb/bcbio-nextgen-vm,fw1121/bcbio-nextgen-vm,guillermo-carrasco/bcbio-nextgen-vm,brainstorm/bcbio-nextgen-vm,chapmanb/bcbio-nextgen-vm,brainstorm/bcbio-nextgen-vm,guillermo-carrasco/bcbio-nextgen-vm,alexandrucoman/bcbio-nextgen-vm,alexandrucoman/bcbio-nextgen-vm,fw1121/bcbio-nextgen-vm | bcbiovm/docker/manage.py | bcbiovm/docker/manage.py | """Manage stopping and starting a docker container for running analysis.
"""
from __future__ import print_function
import grp
import os
import pwd
import subprocess
def run_bcbio_cmd(image, mounts, bcbio_nextgen_cl):
"""Run command in docker container with the supplied arguments to bcbio-nextgen.py.
"""
mo... | """Manage stopping and starting a docker container for running analysis.
"""
from __future__ import print_function
import grp
import os
import pwd
import subprocess
def run_bcbio_cmd(image, mounts, bcbio_nextgen_cl):
"""Run command in docker container with the supplied arguments to bcbio-nextgen.py.
"""
mo... | mit | Python |
9e8a77bc5570021e93541eef448cba17bf5104ed | debug ir value in main | SebastianCallh/kartoffel-tsea29,SebastianCallh/kartoffel-tsea29 | pi/main.py | pi/main.py | """
Main program code - where all the magic happens
"""
from datetime import datetime, timedelta
from navigator import Navigator
from driver import Driver
from laser import Laser
from gyro import Gyro
from eventbus import EventBus
from position import Position
from protocol import *
from safety import Safety
impor... | """
Main program code - where all the magic happens
"""
from datetime import datetime, timedelta
from navigator import Navigator
from driver import Driver
from laser import Laser
from gyro import Gyro
from eventbus import EventBus
from position import Position
from protocol import *
from safety import Safety
impor... | mit | Python |
c2de74c8bc2d5ef57a118221e93ddabd010c60fb | Update lims.py | Clinical-Genomics/access | access/lims.py | access/lims.py | #!/usr/bin/python
#Script that connects to the MySQL database and parses data from an html table
#Import the mysql.connector library/module
import sys
import time
import glob
import re
import os
import requests
from xml.etree import ElementTree
def readconfig():
configfile = os.getenv('HOME') + '/.scilifelabrc'
pa... | #!/usr/bin/python
#Script that connects to the MySQL database and parses data from an html table
#Import the mysql.connector library/module
import sys
import time
import glob
import re
import os
import requests
from xml.etree import ElementTree
def readconfig():
configfile = os.getenv('HOME') + '/.scilifelabrc'
pa... | mit | Python |
541b9302797f6f4badd710fe4a94b41c92c8403a | Use ninja with merge_libs.py on Windows and clean up. | sippet/webrtc,sippet/webrtc,sippet/webrtc,sippet/webrtc,sippet/webrtc,sippet/webrtc | build/merge_libs.py | build/merge_libs.py | #!/usr/bin/env python
# Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All ... | #!/usr/bin/env python
# Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All ... | bsd-3-clause | Python |
727059c6af20205a02e414a6fab811d27ce9870e | Improve course display in admin | theworldbright/mainsite,aspc/mainsite,aspc/mainsite,theworldbright/mainsite,theworldbright/mainsite,theworldbright/mainsite,aspc/mainsite,aspc/mainsite | aspc/coursesearch/admin.py | aspc/coursesearch/admin.py | from django.contrib import admin
from aspc.coursesearch.models import Course, Department, Meeting, RequirementArea
class DepartmentAdmin(admin.ModelAdmin):
list_display = ('code', 'name', 'course_count')
class MeetingAdmin(admin.ModelAdmin):
list_display = ('course', 'monday', 'tuesday', 'wednesday', 'thursda... | from django.contrib import admin
from aspc.coursesearch.models import Course, Department, Meeting
class DepartmentAdmin(admin.ModelAdmin):
list_display = ('code', 'name', 'course_count')
class MeetingAdmin(admin.ModelAdmin):
list_display = ('course', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'be... | mit | Python |
21d0e1617be74d693edbb0cd002c89856967cb46 | Remove unused module import | pnordin/trimeol | binarycheck.py | binarycheck.py |
def is_binary_file(fname):
"""Attempt to guess if 'fname' is a binary file heuristically.
The algorithm has many flaws. Use with caution.
It assumes that if a part of the file has NUL bytes
or has more control characters than text characters,
it is probably a binary file.
An ASCII comp... |
import subprocess
def is_binary_file(fname):
"""Attempt to guess if 'fname' is a binary file heuristically.
The algorithm has many flaws. Use with caution.
It assumes that if a part of the file has NUL bytes
or has more control characters than text characters,
it is probably a binary fil... | mit | Python |
b8ba8d91301756fdc86f2d4dba7514dd7d7a0acb | make the regex more explicitly match covtype10x_copies dir (hdfs) | h2oai/h2o,elkingtonmcb/h2o-2,h2oai/h2o-2,vbelakov/h2o,h2oai/h2o-2,eg-zhang/h2o-2,rowhit/h2o-2,rowhit/h2o-2,h2oai/h2o-2,h2oai/h2o-2,eg-zhang/h2o-2,eg-zhang/h2o-2,eg-zhang/h2o-2,calvingit21/h2o-2,elkingtonmcb/h2o-2,calvingit21/h2o-2,h2oai/h2o,h2oai/h2o,vbelakov/h2o,111t8e/h2o-2,elkingtonmcb/h2o-2,rowhit/h2o-2,100star/h2o... | py/testdir_single_jvm/test_hdfs_multi_copies.py | py/testdir_single_jvm/test_hdfs_multi_copies.py |
import os, json, unittest, time, shutil, sys
sys.path.extend(['.','..','py'])
import h2o, h2o_cmd, h2o_hosts
import h2o_browse as h2b
import h2o_import as h2i
import time, random
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
... |
import os, json, unittest, time, shutil, sys
sys.path.extend(['.','..','py'])
import h2o, h2o_cmd, h2o_hosts
import h2o_browse as h2b
import h2o_import as h2i
import time, random
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
... | apache-2.0 | Python |
893dcc984dc52191abbce7fa09a572e67b8d9558 | include _version file | maartenbreddels/vaex,maartenbreddels/vaex,maartenbreddels/vaex,maartenbreddels/vaex,maartenbreddels/vaex,maartenbreddels/vaex | packages/vaex-meta/setup.py | packages/vaex-meta/setup.py | from setuptools import setup
import sys, os, imp
import sys, os, imp
from setuptools import Extension
dirname = os.path.dirname(__file__)
path_version = os.path.join(dirname, 'vaex/meta/_version.py')
version = imp.load_source('version', path_version)
name = 'vaex'
author = 'Maarten A. Breddels'
author_e... | from setuptools import setup
import sys, os, imp
import sys, os, imp
from setuptools import Extension
dirname = os.path.dirname(__file__)
path_version = os.path.join(dirname, 'vaex/meta/_version.py')
version = imp.load_source('version', path_version)
name = 'vaex'
author = 'Maarten A. Breddels'
author_e... | mit | Python |
6049893d2dab42bf4d57c773e759287b98137ec3 | rename options for consistency | tylerdave/FOSSCON-2015-Example | fosscon2015/hello_argparse.py | fosscon2015/hello_argparse.py | #!/usr/bin/env python
from __future__ import print_function
import argparse
def hello():
""" Argparse CLI to gree the provided NAME. """
parser = argparse.ArgumentParser()
parser.add_argument('name', help="name of person to greet")
parser.add_argument('-c', '--count', type=int, default=1,
... | #!/usr/bin/env python
from __future__ import print_function
import argparse
def hello():
""" Says hello """
parser = argparse.ArgumentParser()
parser.add_argument('name', help="name of person to greet")
parser.add_argument('-r', '--repeat', type=int, default=1,
help="number of times to p... | mit | Python |
525a423d4558a876c2fd274da6cd4303f04c7057 | Update coverage on startup, and when opening views | bradfeehan/SublimePHPCoverage,bradfeehan/SublimePHPCoverage | SublimePHPCoverage.py | SublimePHPCoverage.py | import os
import sys
import sublime
import sublime_plugin
# Add current directory to Python's import path, to import php_coverage
sys.path.append(os.path.dirname(__file__))
from php_coverage.command import CoverageCommand
from php_coverage.debug import debug_message
import php_coverage.finder
import php_coverage.media... | import os
import sys
import sublime
import sublime_plugin
# Add current directory to Python's import path, to import php_coverage
sys.path.append(os.path.dirname(__file__))
from php_coverage.command import CoverageCommand
from php_coverage.debug import debug_message
import php_coverage.finder
import php_coverage.media... | mit | Python |
014cdae3fd9ae03d89a36801d33e4edff4d06cf5 | add urls | un33k/django-adware,un33k/django-adware | adware/urls.py | adware/urls.py | from django.conf import settings
from django.conf.urls import url
from django.conf.urls import patterns
from .views import *
from . import defaults as defs
urlpatterns = [
url(
r'^update$',
AdSenseView.as_view(),
name='adsense_update'
),
]
| urls.py
| bsd-3-clause | Python |
0476a73e6ec38140ba645a46c32dfa02a853be74 | Remove 'patterns' from urls.py | michaeljones/django-adzone,michaeljones/django-adzone | adzone/urls.py | adzone/urls.py | from django.conf.urls import url
from adzone.views import ad_view
urlpatterns = [
url(r'^view/(?P<id>[\d]+)/$', ad_view, name='adzone_ad_view'),
]
| from django.conf.urls import patterns, url
from adzone.views import ad_view
urlpatterns = patterns('',
url(r'^view/(?P<id>[\d]+)/$', ad_view, name='adzone_ad_view'),
)
| bsd-3-clause | Python |
f432ae2746f8c8a593cfc19c2c863e4d8a7d19f7 | Switch to using google.appengine.api.memcache to use compare-and-set | grzes/djangae,grzes/djangae,potatolondon/djangae,potatolondon/djangae,grzes/djangae | djangae/contrib/locking/memcache.py | djangae/contrib/locking/memcache.py | import time
from datetime import datetime
from google.appengine.api import memcache
class MemcacheLock(object):
def __init__(self, identifier, cache):
self.identifier = identifier
self._cache = cache
@classmethod
def acquire(cls, identifier, wait=True, steal_after_ms=None):
cache ... | import time
from django.core.cache import cache
class MemcacheLock(object):
def __init__(self, identifier):
self.identifier = identifier
@classmethod
def acquire(cls, identifier, wait=True, steal_after_ms=None):
# Slightly misusing steal_after_ms here as it's actually used as the expiry t... | bsd-3-clause | Python |
c57eb24ae5ee4e0fafb197e3c2939a931fd31f66 | fix indent | jrief/djangocms-cascade,jrief/djangocms-cascade,jrief/djangocms-cascade | examples/manage.py | examples/manage.py | #!/usr/bin/env python
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.pardir))
if __name__ == "__main__":
from django.core.management import execute_from_command_line
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bs4demo.settings')
... | #!/usr/bin/env python
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.pardir))
if __name__ == "__main__":
from django.core.management import execute_from_command_line
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bs4demo.setting... | mit | Python |
8c96375bd8d0d1d8de38488f2353c53d1613d20b | bump up the version | Galithil/genologics,nsc-norway/genologics,SciLifeLab/genologics,senthil10/genologics,BigelowLab/genologics | genologics/version.py | genologics/version.py | __version__="0.3.8"
| __version__="0.3.7"
| mit | Python |
f3da501a62be06f32db23636296a4928c4c49d0e | Move parser action classes | tahsmith/pycmake,tahsmith/pycmake | cmake/parser.py | cmake/parser.py | __author__ = 'tahsmith'
from cmake import grammar
from cmake.elements.variable import IdentifierFragment, InterpolatedIdentifier, VariableReference
class Parser(grammar.Grammar):
def __init__(self):
super(Parser, self).__init__()
self.variable_reference.setParseAction(VariableReference)
s... | __author__ = 'tahsmith'
from cmake import grammar
from variable import IdentifierFragment, InterpolatedIdentifier, VariableReference
class Parser(grammar.Grammar):
def __init__(self):
super(Parser, self).__init__()
self.variable_reference.setParseAction(VariableReference)
self.interpolate... | mit | Python |
a5bdb6a11f0e3079a0c823eb08f06adc71095bb7 | Add fileglob filter | webcrofting/meta-compose | metacompose/cli/main.py | metacompose/cli/main.py | import glob
import sys
import os
import yaml
from jinja2 import Environment, FileSystemLoader, StrictUndefined
import argparse
def env_override(value, key):
return os.getenv(key, value)
def fileglob(pathname):
return glob.glob(pathname)
def parse_args():
parser = argparse.ArgumentParser()
parser.ad... | import sys
import os
import yaml
from jinja2 import Environment, FileSystemLoader, StrictUndefined
import argparse
def env_override(value, key):
return os.getenv(key, value)
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"-d", "--datafile", action='append',
default=[... | apache-2.0 | Python |
5a45840e81d612e1f743ad063fd32da4d19354d4 | Stop using Signal(providing_args) deprected in Django 4.0 | Suor/django-cacheops | cacheops/signals.py | cacheops/signals.py | import django.dispatch
cache_read = django.dispatch.Signal() # args: func, hit
cache_invalidated = django.dispatch.Signal() # args: obj_dict
| import django.dispatch
cache_read = django.dispatch.Signal(providing_args=["func", "hit"])
cache_invalidated = django.dispatch.Signal(providing_args=["obj_dict"])
| bsd-3-clause | Python |
96de1cc430f00ff38c93b4f7c8ccd8effb81f172 | Adjust heuristic, no longer mess up comment lines | def-lkb/ocp-indent-vim | autoload/ocpindent.py | autoload/ocpindent.py | import os
import sys
import vim
import time
import subprocess
ocp_indent_path = "ocp-indent"
ocp_lastline = None
ocp_lasttime = None
ocp_linefst = 0
ocp_linebuf = []
ocp_inarow = 0
def ocp_indent(lines):
if lines:
if type(lines) == int:
end = lines
lines = "%d-%d" % (lines,lines)
else:
end... | import os
import sys
import vim
import time
import subprocess
ocp_indent_path = "ocp-indent"
ocp_lastline = None
ocp_lasttime = None
ocp_linefst = 0
ocp_linebuf = []
ocp_inarow = 0
def ocp_indent(lines):
if lines:
if type(lines) == int:
end = lines
lines = "%d-%d" % (lines,lines)
else:
end... | mit | Python |
b3b67fe0e68423fc2f85bccf1f20acdb779a38ba | Remove unused testing utility function | lxc/pylxd,lxc/pylxd | pylxd/deprecated/tests/utils.py | pylxd/deprecated/tests/utils.py | # Copyright (c) 2015 Canonical 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 ... | # Copyright (c) 2015 Canonical 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 ... | apache-2.0 | Python |
a8c5bb40747a8e6a4b269b15de8d4241d2c61aa2 | Test curModel | simpeg/discretize,simpeg/simpeg,simpeg/discretize,simpeg/discretize | tests/base/test_problem.py | tests/base/test_problem.py | import unittest
from SimPEG import Mesh, Problem
import numpy as np
class TestTimeProblem(unittest.TestCase):
def setUp(self):
mesh = Mesh.TensorMesh([10, 10])
self.prob = Problem.BaseTimeProblem(mesh)
def test_timeProblem_setTimeSteps(self):
self.prob.timeSteps = [(1e-6, 3), 1e-5, (... | import unittest
from SimPEG import Mesh, Problem
import numpy as np
class TestTimeProblem(unittest.TestCase):
def setUp(self):
mesh = Mesh.TensorMesh([10, 10])
self.prob = Problem.BaseTimeProblem(mesh)
def test_timeProblem_setTimeSteps(self):
self.prob.timeSteps = [(1e-6, 3), 1e-5, (... | mit | Python |
28b4016ce00a7028c9b79138fed16e2a3b2d8d9f | Bump version number to 1.12.4 | dan-gamble/cms,dan-gamble/cms,dan-gamble/cms | cms/__init__.py | cms/__init__.py | """
A collection of Django extensions that add content-management facilities to Django projects.
Developed by Dave Hall.
<http://etianen.com/>
"""
# Always use 3 parts, not 1, 2, or 4.
VERSION = (1, 12, 4)
| """
A collection of Django extensions that add content-management facilities to Django projects.
Developed by Dave Hall.
<http://etianen.com/>
"""
# Always use 3 parts, not 1, 2, or 4.
VERSION = (1, 12, 2)
| bsd-3-clause | Python |
c6a0e85bd0ef9a809edb4bbeb9e4f37417b5de98 | Add function for determining a field's simple type | murphyke/avocado,murphyke/avocado,murphyke/avocado,murphyke/avocado | avocado/core/utils.py | avocado/core/utils.py | from django import forms
from django.db import models
from django.utils.importlib import import_module
from avocado.conf import settings
def get_form_class(name):
# Absolute import if a period exists, otherwise assume the
# name refers to a built-in Django class
if '.' in name:
path = name.split('... | from django import forms
from django.db import models
from django.utils.importlib import import_module
from avocado.conf import settings
def get_form_class(name):
# Absolute import if a period exists, otherwise assume the
# name refers to a built-in Django class
if '.' in name:
path = name.split('... | bsd-2-clause | Python |
c672f4af1d3e19860235729f19b121f41afe9f35 | add user details when new | fachschaft-medizin-rostock/django-fsmedhro,fachschaft-medizin-rostock/django-fsmedhro,fachschaft-medizin-rostock/django-fsmedhro | fsmedhrocore/backends/auth.py | fsmedhrocore/backends/auth.py | import ldap
from django.contrib.auth.models import User
class LdapUniHro(object):
"""
"""
BASE_DN = "ou=people,o=uni-rostock,c=de"
HOST = "ldaps://ldap.uni-rostock.de"
def authenticate(self, username, password):
user_dn = "uid=%s,%s" % (username, self.BASE_DN)
conection = ldap.in... | import ldap
from django.contrib.auth.models import User
class LdapUniHro(object):
"""
"""
BASE_DN = "ou=people,o=uni-rostock,c=de"
HOST = "ldaps://ldap.uni-rostock.de"
def authenticate(self, username, password):
user_dn = "uid=%s,%s" % (username, self.BASE_DN)
conection = ldap.in... | mit | Python |
63b76681f1492c1507c8f49e7765676d5f7c09cf | remove covariance test with old mbar. | choderalab/pymbar,choderalab/pymbar,Lnaden/pymbar,Lnaden/pymbar,Lnaden/pymbar,choderalab/pymbar | pymbar/tests/test_covariance.py | pymbar/tests/test_covariance.py | import numpy as np
import pytest
import pymbar
from pymbar.utils_for_testing import (
suppress_derivative_warnings_for_tests,
suppress_matrix_warnings_for_tests,
assert_almost_equal,
oscillators,
exponentials,
)
@pytest.mark.parametrize(
"statesa, statesb, test_system",
[(100, 100, oscilla... | import numpy as np
import pytest
import pymbar
from pymbar.utils_for_testing import (
suppress_derivative_warnings_for_tests,
suppress_matrix_warnings_for_tests,
assert_almost_equal,
oscillators,
exponentials,
)
@pytest.mark.parametrize(
"statesa, statesb, test_system",
[(100, 100, oscilla... | mit | Python |
425429bb70715510c8b6919203eb5ee8e2028b8d | update switch short cut, ctrl+shift+J/K | stonewell/pymterm,stonewell/pymterm,stonewell/pymterm | pymterm/term_pygui/term_menu.py | pymterm/term_pygui/term_menu.py | from GUI.GStdMenus import build_menus, \
fundamental_cmds, help_cmds, pref_cmds, file_cmds, print_cmds, edit_cmds
file_cmds += 'new_window_cmd'
file_cmds += 'close_tab_cmd'
file_cmds += 'next_tab_cmd'
file_cmds += 'prev_tab_cmd'
file_cmds += 'open_session_cmd'
file_cmds += 'transfer_file_cmd'
_edit_menu_items = ... | from GUI.GStdMenus import build_menus, \
fundamental_cmds, help_cmds, pref_cmds, file_cmds, print_cmds, edit_cmds
file_cmds += 'new_window_cmd'
file_cmds += 'close_tab_cmd'
file_cmds += 'next_tab_cmd'
file_cmds += 'prev_tab_cmd'
file_cmds += 'open_session_cmd'
file_cmds += 'transfer_file_cmd'
_edit_menu_items = ... | mit | Python |
5f33aad35f22e8f9746967691344e0c00f666860 | fix types | musicalrunner/Geiger-Counter,samkohn/Geiger-Counter | analyzeData.py | analyzeData.py | #!/usr/bin/env python
import csv
class DataSet:
def __init__ (self, count = [], time = []):
counts = count
times = time
def readInput(filename):
with open(filename, 'rb') as csvfile:
# If a dict is desired, change to csv.DictReader() with the same arguments.
# However, the cod... | #!/usr/bin/env python
import csv
class dataSet:
def __init__ (self, count = [], time = []):
counts = cout
times = time
def readInput(filename):
with open(filename, 'rb') as csvfile:
# If a dict is desired, change to csv.DictReader() with the same arguments.
# However, the code... | mit | Python |
0bf7d163fe028b7e52659dd6b5d88877e31e56af | Return view type in /project/<id>/results_framework | akvo/akvo-rsr,akvo/akvo-rsr,akvo/akvo-rsr,akvo/akvo-rsr | akvo/rest/views/result.py | akvo/rest/views/result.py | # -*- coding: utf-8 -*-
"""Akvo RSR is covered by the GNU Affero General Public License.
See more details in the license.txt file located at the root folder of the Akvo RSR module.
For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
"""
from akvo.rest.models import TastyTok... | # -*- coding: utf-8 -*-
"""Akvo RSR is covered by the GNU Affero General Public License.
See more details in the license.txt file located at the root folder of the Akvo RSR module.
For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
"""
from akvo.rest.models import TastyTok... | agpl-3.0 | Python |
eb70ebf6a748fde2e7ce45a4cfa09a64ee796559 | rename TestUser class to TestUserApi | skitoo/aligot,aligot-project/aligot,aligot-project/aligot,aligot-project/aligot | aligot/tests/test_user.py | aligot/tests/test_user.py | # coding: utf-8
from django.core.urlresolvers import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from ..models import User
class TestUserApi(TestCase):
def setUp(self):
self.client = APIClient()
def test_create_without_params... | # coding: utf-8
from django.core.urlresolvers import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from ..models import User
class TestUser(TestCase):
def setUp(self):
self.client = APIClient()
def test_create_without_params(se... | mit | Python |
1307a3bff07e607d34699298089871318741270b | add print_ts | JDReutt/BayesDB,JDReutt/BayesDB,fivejjs/crosscat,probcomp/crosscat,mit-probabilistic-computing-project/crosscat,probcomp/crosscat,poppingtonic/BayesDB,fivejjs/crosscat,mit-probabilistic-computing-project/crosscat,poppingtonic/BayesDB,probcomp/crosscat,fivejjs/crosscat,poppingtonic/BayesDB,JDReutt/BayesDB,poppingtonic/B... | tabular_predDB/python_utils/general_utils.py | tabular_predDB/python_utils/general_utils.py | import itertools
import inspect
from timeit import default_timer
import datetime
class Timer(object):
def __init__(self, task='action', verbose=True):
self.task = task
self.verbose = verbose
self.timer = default_timer
self.start = None
def get_elapsed_secs(self):
end = s... | import itertools
import inspect
from timeit import default_timer
class Timer(object):
def __init__(self, task='action', verbose=True):
self.task = task
self.verbose = verbose
self.timer = default_timer
self.start = None
def get_elapsed_secs(self):
end = self.timer()
... | apache-2.0 | Python |
76bff32da4bbb50025d2ceb2dfea7d9ad1aa18be | correct bug in convert_protobuf in util | IntegrCiTy/obnl | obnl/util.py | obnl/util.py | import json
from google.protobuf import json_format
from message.coside.coside_pb2 import SimulationInit, Schedule
def convert_json_to_data(json_text):
return json.loads(json_text)
def convert_json_file_to_data(json_file_location):
with open(json_file_location) as json_file:
schedule_data = conver... | import json
from google.protobuf import json_format
from message.coside.coside_pb2 import SimulationInit, Schedule
def convert_json_to_data(json_text):
return json.loads(json_text)
def convert_json_file_to_data(json_file_location):
with open(json_file_location) as json_file:
schedule_data = conver... | apache-2.0 | Python |
e31a108895a619787bf6b023163ee3a7a9604f35 | update version number to 2.31.0 | architecture-building-systems/CityEnergyAnalyst,architecture-building-systems/CityEnergyAnalyst,architecture-building-systems/CityEnergyAnalyst | cea/__init__.py | cea/__init__.py | __version__ = "2.31.0"
class ConfigError(Exception):
"""Raised when the configuration of a tool contains some invalid values."""
rc = 100 # sys.exit(rc)
class CustomDatabaseNotFound(Exception):
"""Raised when the InputLocator can't find a user-provided database (region=='custom')"""
rc = 101 # sys... | __version__ = "2.30.0"
class ConfigError(Exception):
"""Raised when the configuration of a tool contains some invalid values."""
rc = 100 # sys.exit(rc)
class CustomDatabaseNotFound(Exception):
"""Raised when the InputLocator can't find a user-provided database (region=='custom')"""
rc = 101 # sys... | mit | Python |
732e0bd1aef47744953984f83b7e76ec6a571db1 | Fix off by one bug | vikasgorur/wrangler | conversation.py | conversation.py | import logging
import twython
import sys
from config import Config
from ebooks import EbooksText
from peer import ConsolePeer, TwitterPeer
from twython import TwythonStreamer
class Conversation:
"""A conversation starts with the bot messaging the handler with a list
of potential tweets. This continues back an... | import logging
import twython
import sys
from config import Config
from ebooks import EbooksText
from peer import ConsolePeer, TwitterPeer
from twython import TwythonStreamer
class Conversation:
"""A conversation starts with the bot messaging the handler with a list
of potential tweets. This continues back an... | mit | Python |
8014ce4337fec973cc41e659bd25bdb541978c6d | concatenate instead of append to a touple fixed | gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine | celeryconfig.py | celeryconfig.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010-2012, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Lice... | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010-2012, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Lice... | agpl-3.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.