commit stringlengths 40 40 | old_file stringlengths 4 118 | new_file stringlengths 4 118 | old_contents stringlengths 0 2.94k | new_contents stringlengths 1 4.43k | subject stringlengths 15 444 | message stringlengths 16 3.45k | lang stringclasses 1
value | license stringclasses 13
values | repos stringlengths 5 43.2k | prompt stringlengths 17 4.58k | response stringlengths 1 4.43k | prompt_tagged stringlengths 58 4.62k | response_tagged stringlengths 1 4.43k | text stringlengths 132 7.29k | text_tagged stringlengths 173 7.33k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d4274b32f283a056bec7048f1ab8b78bf1518bb6 | var/spack/repos/builtin/packages/bwa/package.py | var/spack/repos/builtin/packages/bwa/package.py | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, [email protected], All rights reserved.
# LLNL-CODE-64... | Make flake8 happy (long lines) | Make flake8 happy (long lines)
| Python | lgpl-2.1 | matthiasdiener/spack,matthiasdiener/spack,TheTimmy/spack,skosukhin/spack,EmreAtes/spack,matthiasdiener/spack,mfherbst/spack,tmerrick1/spack,TheTimmy/spack,EmreAtes/spack,LLNL/spack,tmerrick1/spack,lgarren/spack,lgarren/spack,skosukhin/spack,EmreAtes/spack,iulian787/spack,lgarren/spack,krafczyk/spack,TheTimmy/spack,iuli... | Make flake8 happy (long lines) | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, [email protected], All rights reserved.
# LLNL-CODE-64... | <commit_before><commit_msg>Make flake8 happy (long lines)<commit_after> | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, [email protected], All rights reserved.
# LLNL-CODE-64... | Make flake8 happy (long lines)##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, [email protected], All r... | <commit_before><commit_msg>Make flake8 happy (long lines)<commit_after>##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created ... | |
a0cff25bdc493925ae750d6daa0bad0150677f2e | rdmo/projects/migrations/0032_data_migration.py | rdmo/projects/migrations/0032_data_migration.py | from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
def run_data_migration(apps, schema_editor):
Project = apps.get_model('projects', 'Project')
Task = apps.get_model('tasks', 'Task')
View = apps.get_model('views', 'View')
for project in ... | Add migration to add tasks and views to existing projects | Add migration to add tasks and views to existing projects
| Python | apache-2.0 | DMPwerkzeug/DMPwerkzeug,rdmorganiser/rdmo,rdmorganiser/rdmo,DMPwerkzeug/DMPwerkzeug,DMPwerkzeug/DMPwerkzeug,rdmorganiser/rdmo | Add migration to add tasks and views to existing projects | from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
def run_data_migration(apps, schema_editor):
Project = apps.get_model('projects', 'Project')
Task = apps.get_model('tasks', 'Task')
View = apps.get_model('views', 'View')
for project in ... | <commit_before><commit_msg>Add migration to add tasks and views to existing projects<commit_after> | from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
def run_data_migration(apps, schema_editor):
Project = apps.get_model('projects', 'Project')
Task = apps.get_model('tasks', 'Task')
View = apps.get_model('views', 'View')
for project in ... | Add migration to add tasks and views to existing projectsfrom __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
def run_data_migration(apps, schema_editor):
Project = apps.get_model('projects', 'Project')
Task = apps.get_model('tasks', 'Task')
Vi... | <commit_before><commit_msg>Add migration to add tasks and views to existing projects<commit_after>from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
def run_data_migration(apps, schema_editor):
Project = apps.get_model('projects', 'Project')
Task... | |
9867362ddc198ecdd095b6190936a683caed4aad | oneTimeEditedString.py | oneTimeEditedString.py | def isEditedOnce(stringOne,stringTwo):
stringOneLength = len(stringOne)
stringTwoLength = len(stringTwo)
totalChanges = 0
if abs(stringOneLength - stringTwoLength) > 1:
return False
else:
if stringOneLength == stringTwoLength:
for index in range(0,stringOneLen... | Verify String is edited only one time | Verify String is edited only one time
| Python | mit | arunkumarpalaniappan/algorithm_tryouts | Verify String is edited only one time | def isEditedOnce(stringOne,stringTwo):
stringOneLength = len(stringOne)
stringTwoLength = len(stringTwo)
totalChanges = 0
if abs(stringOneLength - stringTwoLength) > 1:
return False
else:
if stringOneLength == stringTwoLength:
for index in range(0,stringOneLen... | <commit_before><commit_msg>Verify String is edited only one time<commit_after> | def isEditedOnce(stringOne,stringTwo):
stringOneLength = len(stringOne)
stringTwoLength = len(stringTwo)
totalChanges = 0
if abs(stringOneLength - stringTwoLength) > 1:
return False
else:
if stringOneLength == stringTwoLength:
for index in range(0,stringOneLen... | Verify String is edited only one timedef isEditedOnce(stringOne,stringTwo):
stringOneLength = len(stringOne)
stringTwoLength = len(stringTwo)
totalChanges = 0
if abs(stringOneLength - stringTwoLength) > 1:
return False
else:
if stringOneLength == stringTwoLength:
... | <commit_before><commit_msg>Verify String is edited only one time<commit_after>def isEditedOnce(stringOne,stringTwo):
stringOneLength = len(stringOne)
stringTwoLength = len(stringTwo)
totalChanges = 0
if abs(stringOneLength - stringTwoLength) > 1:
return False
else:
if stringOneLength... | |
5d918622ca14c1d9eed88346c200eca60bccaa5f | yatsm/classification/roi.py | yatsm/classification/roi.py | """ Utilities for extracting training data from region of interests (ROI)
"""
import numpy as np
from rasterio.features import rasterize
from shapely.geometry import shape as geom_shape
def extract_roi(src, features, feature_prop=None, all_touched=False, fill=0):
""" Yield pixel data from ``src`` for ROIs in ``fe... | Add ROI extraction code for use w/ xarray | Add ROI extraction code for use w/ xarray
| Python | mit | valpasq/yatsm,c11/yatsm,valpasq/yatsm,c11/yatsm | Add ROI extraction code for use w/ xarray | """ Utilities for extracting training data from region of interests (ROI)
"""
import numpy as np
from rasterio.features import rasterize
from shapely.geometry import shape as geom_shape
def extract_roi(src, features, feature_prop=None, all_touched=False, fill=0):
""" Yield pixel data from ``src`` for ROIs in ``fe... | <commit_before><commit_msg>Add ROI extraction code for use w/ xarray<commit_after> | """ Utilities for extracting training data from region of interests (ROI)
"""
import numpy as np
from rasterio.features import rasterize
from shapely.geometry import shape as geom_shape
def extract_roi(src, features, feature_prop=None, all_touched=False, fill=0):
""" Yield pixel data from ``src`` for ROIs in ``fe... | Add ROI extraction code for use w/ xarray""" Utilities for extracting training data from region of interests (ROI)
"""
import numpy as np
from rasterio.features import rasterize
from shapely.geometry import shape as geom_shape
def extract_roi(src, features, feature_prop=None, all_touched=False, fill=0):
""" Yield... | <commit_before><commit_msg>Add ROI extraction code for use w/ xarray<commit_after>""" Utilities for extracting training data from region of interests (ROI)
"""
import numpy as np
from rasterio.features import rasterize
from shapely.geometry import shape as geom_shape
def extract_roi(src, features, feature_prop=None, ... | |
f631b42aee7e144947236bcd55218cf0252e6ec8 | h2o-py/tests/testdir_algos/gam/pyunit_gam_train_metrics.py | h2o-py/tests/testdir_algos/gam/pyunit_gam_train_metrics.py | from __future__ import division
from __future__ import print_function
import sys
sys.path.insert(1,"../../../")
import h2o
from h2o.estimators.gam import H2OGeneralizedAdditiveEstimator
import pandas as pd
import numpy as np
from tests import pyunit_utils
def gam_train_metrics_recalculate(family):
np.random.seed(... | Add test to show GAM metrics are correct | PUBDEV-8455: Add test to show GAM metrics are correct
We compare training metrics calculated in training and user-calculated
metrics.
| Python | apache-2.0 | h2oai/h2o-3,h2oai/h2o-3,h2oai/h2o-3,h2oai/h2o-3,h2oai/h2o-3,h2oai/h2o-3,h2oai/h2o-3,h2oai/h2o-3 | PUBDEV-8455: Add test to show GAM metrics are correct
We compare training metrics calculated in training and user-calculated
metrics. | from __future__ import division
from __future__ import print_function
import sys
sys.path.insert(1,"../../../")
import h2o
from h2o.estimators.gam import H2OGeneralizedAdditiveEstimator
import pandas as pd
import numpy as np
from tests import pyunit_utils
def gam_train_metrics_recalculate(family):
np.random.seed(... | <commit_before><commit_msg>PUBDEV-8455: Add test to show GAM metrics are correct
We compare training metrics calculated in training and user-calculated
metrics.<commit_after> | from __future__ import division
from __future__ import print_function
import sys
sys.path.insert(1,"../../../")
import h2o
from h2o.estimators.gam import H2OGeneralizedAdditiveEstimator
import pandas as pd
import numpy as np
from tests import pyunit_utils
def gam_train_metrics_recalculate(family):
np.random.seed(... | PUBDEV-8455: Add test to show GAM metrics are correct
We compare training metrics calculated in training and user-calculated
metrics.from __future__ import division
from __future__ import print_function
import sys
sys.path.insert(1,"../../../")
import h2o
from h2o.estimators.gam import H2OGeneralizedAdditiveEstimator
... | <commit_before><commit_msg>PUBDEV-8455: Add test to show GAM metrics are correct
We compare training metrics calculated in training and user-calculated
metrics.<commit_after>from __future__ import division
from __future__ import print_function
import sys
sys.path.insert(1,"../../../")
import h2o
from h2o.estimators.ga... | |
d21d5136351d92a384ea7d5b7db5224ec648ad0f | src/ggrc_risks/migrations/versions/20160513135106_47bf3f1f9be8_add_url_and_reference_url_columns.py | src/ggrc_risks/migrations/versions/20160513135106_47bf3f1f9be8_add_url_and_reference_url_columns.py | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: [email protected]
# Maintained By: [email protected]
"""
Add url and reference_url columns
Create Date: 2016-05-13 13:51:06.534663... | Add `url` and `reference_url` columns to risk object | Add `url` and `reference_url` columns to risk object
| Python | apache-2.0 | andrei-karalionak/ggrc-core,edofic/ggrc-core,kr41/ggrc-core,josthkko/ggrc-core,andrei-karalionak/ggrc-core,NejcZupec/ggrc-core,andrei-karalionak/ggrc-core,j0gurt/ggrc-core,NejcZupec/ggrc-core,AleksNeStu/ggrc-core,josthkko/ggrc-core,j0gurt/ggrc-core,AleksNeStu/ggrc-core,josthkko/ggrc-core,selahssea/ggrc-core,VinnieJohns... | Add `url` and `reference_url` columns to risk object | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: [email protected]
# Maintained By: [email protected]
"""
Add url and reference_url columns
Create Date: 2016-05-13 13:51:06.534663... | <commit_before><commit_msg>Add `url` and `reference_url` columns to risk object<commit_after> | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: [email protected]
# Maintained By: [email protected]
"""
Add url and reference_url columns
Create Date: 2016-05-13 13:51:06.534663... | Add `url` and `reference_url` columns to risk object# Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: [email protected]
# Maintained By: [email protected]
"""
Add url and reference_... | <commit_before><commit_msg>Add `url` and `reference_url` columns to risk object<commit_after># Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: [email protected]
# Maintained By: urban@recipr... | |
1922197472b5afcacdae37da2c4e66856e74116e | storage/mongo_storage.py | storage/mongo_storage.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/
'''
Storage module to interact with MongoDB.
Provides a MongoStorage helper class with the following
functions:
setup:... | Add storage module for mongo DB | Add storage module for mongo DB | Python | mpl-2.0 | awest1339/multiscanner,mitre/multiscanner,MITRECND/multiscanner,awest1339/multiscanner,jmlong1027/multiscanner,mitre/multiscanner,jmlong1027/multiscanner,awest1339/multiscanner,MITRECND/multiscanner,jmlong1027/multiscanner,jmlong1027/multiscanner,mitre/multiscanner,awest1339/multiscanner | Add storage module for mongo DB | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/
'''
Storage module to interact with MongoDB.
Provides a MongoStorage helper class with the following
functions:
setup:... | <commit_before><commit_msg>Add storage module for mongo DB<commit_after> | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/
'''
Storage module to interact with MongoDB.
Provides a MongoStorage helper class with the following
functions:
setup:... | Add storage module for mongo DB# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/
'''
Storage module to interact with MongoDB.
Provides a MongoStorage helper class with the ... | <commit_before><commit_msg>Add storage module for mongo DB<commit_after># This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/
'''
Storage module to interact with MongoDB.
Provi... | |
c050cbd0f13f34915854137dced4003b8836f451 | scripts/image_signing/security_test_artifact.py | scripts/image_signing/security_test_artifact.py | #!/usr/bin/env python3
# Copyright 2022 The ChromiumOS Authors.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Run security tests on an artifact"""
import argparse
import os
from pathlib import Path
import subprocess
import sys
DIR = Path(__file__).resolve().... | Add general security test script | scripts/image_signing: Add general security test script
This commit adds a general security test script. This allows
some logic to be moved out of the signer as well as providing a single
entry point for the security tests run by the signer.
BRANCH=none
BUG=b:202397678
TEST=Verified that correct security tests ran wi... | Python | bsd-3-clause | coreboot/vboot,coreboot/vboot,coreboot/vboot,coreboot/vboot,coreboot/vboot | scripts/image_signing: Add general security test script
This commit adds a general security test script. This allows
some logic to be moved out of the signer as well as providing a single
entry point for the security tests run by the signer.
BRANCH=none
BUG=b:202397678
TEST=Verified that correct security tests ran wi... | #!/usr/bin/env python3
# Copyright 2022 The ChromiumOS Authors.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Run security tests on an artifact"""
import argparse
import os
from pathlib import Path
import subprocess
import sys
DIR = Path(__file__).resolve().... | <commit_before><commit_msg>scripts/image_signing: Add general security test script
This commit adds a general security test script. This allows
some logic to be moved out of the signer as well as providing a single
entry point for the security tests run by the signer.
BRANCH=none
BUG=b:202397678
TEST=Verified that co... | #!/usr/bin/env python3
# Copyright 2022 The ChromiumOS Authors.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Run security tests on an artifact"""
import argparse
import os
from pathlib import Path
import subprocess
import sys
DIR = Path(__file__).resolve().... | scripts/image_signing: Add general security test script
This commit adds a general security test script. This allows
some logic to be moved out of the signer as well as providing a single
entry point for the security tests run by the signer.
BRANCH=none
BUG=b:202397678
TEST=Verified that correct security tests ran wi... | <commit_before><commit_msg>scripts/image_signing: Add general security test script
This commit adds a general security test script. This allows
some logic to be moved out of the signer as well as providing a single
entry point for the security tests run by the signer.
BRANCH=none
BUG=b:202397678
TEST=Verified that co... | |
770da0f60ec4f80425334f281fcd0abb590e6b6b | test/snv/writers_test.py | test/snv/writers_test.py | '''
Created on 05/03/2010
@author: peio
'''
import unittest
from franklin.seq.seqs import SeqFeature, SeqWithQuality, Seq
from Bio.SeqFeature import FeatureLocation
from franklin.snv.snv_annotation import SNP, INVARIANT
from tempfile import NamedTemporaryFile
from franklin.snv.writers import VariantCallFormatWriter
... | Add vcf writer preliminary test | Add vcf writer preliminary test
| Python | agpl-3.0 | JoseBlanca/franklin,JoseBlanca/franklin | Add vcf writer preliminary test | '''
Created on 05/03/2010
@author: peio
'''
import unittest
from franklin.seq.seqs import SeqFeature, SeqWithQuality, Seq
from Bio.SeqFeature import FeatureLocation
from franklin.snv.snv_annotation import SNP, INVARIANT
from tempfile import NamedTemporaryFile
from franklin.snv.writers import VariantCallFormatWriter
... | <commit_before><commit_msg>Add vcf writer preliminary test<commit_after> | '''
Created on 05/03/2010
@author: peio
'''
import unittest
from franklin.seq.seqs import SeqFeature, SeqWithQuality, Seq
from Bio.SeqFeature import FeatureLocation
from franklin.snv.snv_annotation import SNP, INVARIANT
from tempfile import NamedTemporaryFile
from franklin.snv.writers import VariantCallFormatWriter
... | Add vcf writer preliminary test'''
Created on 05/03/2010
@author: peio
'''
import unittest
from franklin.seq.seqs import SeqFeature, SeqWithQuality, Seq
from Bio.SeqFeature import FeatureLocation
from franklin.snv.snv_annotation import SNP, INVARIANT
from tempfile import NamedTemporaryFile
from franklin.snv.writers i... | <commit_before><commit_msg>Add vcf writer preliminary test<commit_after>'''
Created on 05/03/2010
@author: peio
'''
import unittest
from franklin.seq.seqs import SeqFeature, SeqWithQuality, Seq
from Bio.SeqFeature import FeatureLocation
from franklin.snv.snv_annotation import SNP, INVARIANT
from tempfile import Named... | |
2227619b0358db4f2d5f707248ab2fb19652021e | test/test_thin_client.py | test/test_thin_client.py | from unittest import TestCase
from pythinclient.client import *
from pythinclient.server import *
import time
__author__ = 'Alek Ratzloff <[email protected]>'
DATEFMT = "%d/%m/%Y"
def today():
return time.strftime(DATEFMT)
def server_echo(msg, conn, addr):
# Echoes the message
conn.send((msg + '\n').en... | Add thin client tests. They don't work yet - they just kind of hang there. | Add thin client tests. They don't work yet - they just kind of hang there.
| Python | bsd-3-clause | alekratz/pythinclient | Add thin client tests. They don't work yet - they just kind of hang there. | from unittest import TestCase
from pythinclient.client import *
from pythinclient.server import *
import time
__author__ = 'Alek Ratzloff <[email protected]>'
DATEFMT = "%d/%m/%Y"
def today():
return time.strftime(DATEFMT)
def server_echo(msg, conn, addr):
# Echoes the message
conn.send((msg + '\n').en... | <commit_before><commit_msg>Add thin client tests. They don't work yet - they just kind of hang there.<commit_after> | from unittest import TestCase
from pythinclient.client import *
from pythinclient.server import *
import time
__author__ = 'Alek Ratzloff <[email protected]>'
DATEFMT = "%d/%m/%Y"
def today():
return time.strftime(DATEFMT)
def server_echo(msg, conn, addr):
# Echoes the message
conn.send((msg + '\n').en... | Add thin client tests. They don't work yet - they just kind of hang there.from unittest import TestCase
from pythinclient.client import *
from pythinclient.server import *
import time
__author__ = 'Alek Ratzloff <[email protected]>'
DATEFMT = "%d/%m/%Y"
def today():
return time.strftime(DATEFMT)
def server_ech... | <commit_before><commit_msg>Add thin client tests. They don't work yet - they just kind of hang there.<commit_after>from unittest import TestCase
from pythinclient.client import *
from pythinclient.server import *
import time
__author__ = 'Alek Ratzloff <[email protected]>'
DATEFMT = "%d/%m/%Y"
def today():
retu... | |
80e7b007bdb731fb8f5d069230a3c5be09a0ec50 | mz-data.py | mz-data.py | # IPython log file
import numpy as np
import napari
from matplotlib.backends.backend_qt5agg import FigureCanvas
from matplotlib.figure import Figure
# load the data
cube = np.load('datacube.npy')
peaks = np.load('peaklist.npy')
mz = peaks[0]
thresh = np.load('hsr_thresholds.npy')
cubet = np.transpose(cube, (2, 0, 1... | Add script to view mass spec images | Add script to view mass spec images
| Python | bsd-3-clause | jni/useful-histories | Add script to view mass spec images | # IPython log file
import numpy as np
import napari
from matplotlib.backends.backend_qt5agg import FigureCanvas
from matplotlib.figure import Figure
# load the data
cube = np.load('datacube.npy')
peaks = np.load('peaklist.npy')
mz = peaks[0]
thresh = np.load('hsr_thresholds.npy')
cubet = np.transpose(cube, (2, 0, 1... | <commit_before><commit_msg>Add script to view mass spec images<commit_after> | # IPython log file
import numpy as np
import napari
from matplotlib.backends.backend_qt5agg import FigureCanvas
from matplotlib.figure import Figure
# load the data
cube = np.load('datacube.npy')
peaks = np.load('peaklist.npy')
mz = peaks[0]
thresh = np.load('hsr_thresholds.npy')
cubet = np.transpose(cube, (2, 0, 1... | Add script to view mass spec images# IPython log file
import numpy as np
import napari
from matplotlib.backends.backend_qt5agg import FigureCanvas
from matplotlib.figure import Figure
# load the data
cube = np.load('datacube.npy')
peaks = np.load('peaklist.npy')
mz = peaks[0]
thresh = np.load('hsr_thresholds.npy')
... | <commit_before><commit_msg>Add script to view mass spec images<commit_after># IPython log file
import numpy as np
import napari
from matplotlib.backends.backend_qt5agg import FigureCanvas
from matplotlib.figure import Figure
# load the data
cube = np.load('datacube.npy')
peaks = np.load('peaklist.npy')
mz = peaks[0... | |
54c7d5704a148b703fb0db74eeeb66c187134faf | gratipay/utils/pricing.py | gratipay/utils/pricing.py | from decimal import Decimal as D, ROUND_HALF_EVEN
def suggested_payment(usage):
if usage >= 500:
percentage = D('0.02')
elif usage >= 20:
percentage = D('0.05')
else:
percentage = D('0.10')
suggestion = usage * percentage
if suggestion == 0:
rounded = suggestion
... | from decimal import Decimal as D, ROUND_HALF_EVEN
def suggested_payment(usage):
percentage = D('0.05')
suggestion = usage * percentage
rounded = suggestion.quantize(D('0'), ROUND_HALF_EVEN)
return rounded
def suggested_payment_low_high(usage):
# Above $500/wk we suggest 2%.
if usage >= 5000... | Change suggested payment to flat 5% | Change suggested payment to flat 5%
| Python | mit | eXcomm/gratipay.com,eXcomm/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com,studio666/gratipay.com,eXcomm/gratipay.com,studio666/gratipay.com,studio666/gratipay.com,gratipay/gratipay.com,eXcomm/gratipay.com,studio666/gratipay.com | from decimal import Decimal as D, ROUND_HALF_EVEN
def suggested_payment(usage):
if usage >= 500:
percentage = D('0.02')
elif usage >= 20:
percentage = D('0.05')
else:
percentage = D('0.10')
suggestion = usage * percentage
if suggestion == 0:
rounded = suggestion
... | from decimal import Decimal as D, ROUND_HALF_EVEN
def suggested_payment(usage):
percentage = D('0.05')
suggestion = usage * percentage
rounded = suggestion.quantize(D('0'), ROUND_HALF_EVEN)
return rounded
def suggested_payment_low_high(usage):
# Above $500/wk we suggest 2%.
if usage >= 5000... | <commit_before>from decimal import Decimal as D, ROUND_HALF_EVEN
def suggested_payment(usage):
if usage >= 500:
percentage = D('0.02')
elif usage >= 20:
percentage = D('0.05')
else:
percentage = D('0.10')
suggestion = usage * percentage
if suggestion == 0:
rounded ... | from decimal import Decimal as D, ROUND_HALF_EVEN
def suggested_payment(usage):
percentage = D('0.05')
suggestion = usage * percentage
rounded = suggestion.quantize(D('0'), ROUND_HALF_EVEN)
return rounded
def suggested_payment_low_high(usage):
# Above $500/wk we suggest 2%.
if usage >= 5000... | from decimal import Decimal as D, ROUND_HALF_EVEN
def suggested_payment(usage):
if usage >= 500:
percentage = D('0.02')
elif usage >= 20:
percentage = D('0.05')
else:
percentage = D('0.10')
suggestion = usage * percentage
if suggestion == 0:
rounded = suggestion
... | <commit_before>from decimal import Decimal as D, ROUND_HALF_EVEN
def suggested_payment(usage):
if usage >= 500:
percentage = D('0.02')
elif usage >= 20:
percentage = D('0.05')
else:
percentage = D('0.10')
suggestion = usage * percentage
if suggestion == 0:
rounded ... |
b97a5108c26f3e6b4f4a57c9148393e0ba13cfb4 | tests/test_redis/test_redis_ephemeral_tokens.py | tests/test_redis/test_redis_ephemeral_tokens.py | import pytest
from libs.redis_db import RedisEphemeralTokens
from tests.utils import BaseTest
@pytest.mark.redis_mark
class TestRedisEphemeralTokens(BaseTest):
def test_objects(self):
token = RedisEphemeralTokens()
assert token.key is not None
assert token.redis_key == RedisEphemeralToken... | Add ephemeral token redis tests | Add ephemeral token redis tests
| Python | apache-2.0 | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | Add ephemeral token redis tests | import pytest
from libs.redis_db import RedisEphemeralTokens
from tests.utils import BaseTest
@pytest.mark.redis_mark
class TestRedisEphemeralTokens(BaseTest):
def test_objects(self):
token = RedisEphemeralTokens()
assert token.key is not None
assert token.redis_key == RedisEphemeralToken... | <commit_before><commit_msg>Add ephemeral token redis tests<commit_after> | import pytest
from libs.redis_db import RedisEphemeralTokens
from tests.utils import BaseTest
@pytest.mark.redis_mark
class TestRedisEphemeralTokens(BaseTest):
def test_objects(self):
token = RedisEphemeralTokens()
assert token.key is not None
assert token.redis_key == RedisEphemeralToken... | Add ephemeral token redis testsimport pytest
from libs.redis_db import RedisEphemeralTokens
from tests.utils import BaseTest
@pytest.mark.redis_mark
class TestRedisEphemeralTokens(BaseTest):
def test_objects(self):
token = RedisEphemeralTokens()
assert token.key is not None
assert token.r... | <commit_before><commit_msg>Add ephemeral token redis tests<commit_after>import pytest
from libs.redis_db import RedisEphemeralTokens
from tests.utils import BaseTest
@pytest.mark.redis_mark
class TestRedisEphemeralTokens(BaseTest):
def test_objects(self):
token = RedisEphemeralTokens()
assert tok... | |
193e2d520ead6aef22997de2f7ebbcc9b7cec587 | pandachecker.py | pandachecker.py | """
Program will ping the list of website to see if they are online.
Will give an error message if the website is down.
"""
import subprocess
addressListA = ['baseness.com',
'npr.org',
'ucsc.edu',
'google.com',
'facebook.com',
'myeconlab.com',
'instagra... | Add python code for pinging | Add python code for pinging
| Python | unlicense | ahandsel/pandachecker | Add python code for pinging | """
Program will ping the list of website to see if they are online.
Will give an error message if the website is down.
"""
import subprocess
addressListA = ['baseness.com',
'npr.org',
'ucsc.edu',
'google.com',
'facebook.com',
'myeconlab.com',
'instagra... | <commit_before><commit_msg>Add python code for pinging<commit_after> | """
Program will ping the list of website to see if they are online.
Will give an error message if the website is down.
"""
import subprocess
addressListA = ['baseness.com',
'npr.org',
'ucsc.edu',
'google.com',
'facebook.com',
'myeconlab.com',
'instagra... | Add python code for pinging"""
Program will ping the list of website to see if they are online.
Will give an error message if the website is down.
"""
import subprocess
addressListA = ['baseness.com',
'npr.org',
'ucsc.edu',
'google.com',
'facebook.com',
'myeconlab... | <commit_before><commit_msg>Add python code for pinging<commit_after>"""
Program will ping the list of website to see if they are online.
Will give an error message if the website is down.
"""
import subprocess
addressListA = ['baseness.com',
'npr.org',
'ucsc.edu',
'google.com',
... | |
d16a3753d73714a51fbe846e45fe77d5e41cb2ab | examples/dup_and_replay.py | examples/dup_and_replay.py | from mitmproxy import ctx
def request(flow):
f = ctx.master.state.duplicate_flow(flow)
f.request.path = "/changed"
ctx.master.replay_request(f, block=True, run_scripthooks=False)
| from mitmproxy import ctx
def request(flow):
f = ctx.master.state.duplicate_flow(flow)
f.request.path = "/changed"
ctx.master.replay_request(f, block=True)
| Remove dead run_scripthooks example reference. | Remove dead run_scripthooks example reference. | Python | mit | xaxa89/mitmproxy,Kriechi/mitmproxy,cortesi/mitmproxy,zlorb/mitmproxy,dwfreed/mitmproxy,ujjwal96/mitmproxy,vhaupert/mitmproxy,mosajjal/mitmproxy,laurmurclar/mitmproxy,ujjwal96/mitmproxy,Kriechi/mitmproxy,xaxa89/mitmproxy,MatthewShao/mitmproxy,dwfreed/mitmproxy,mosajjal/mitmproxy,mitmproxy/mitmproxy,ddworken/mitmproxy,mo... | from mitmproxy import ctx
def request(flow):
f = ctx.master.state.duplicate_flow(flow)
f.request.path = "/changed"
ctx.master.replay_request(f, block=True, run_scripthooks=False)
Remove dead run_scripthooks example reference. | from mitmproxy import ctx
def request(flow):
f = ctx.master.state.duplicate_flow(flow)
f.request.path = "/changed"
ctx.master.replay_request(f, block=True)
| <commit_before>from mitmproxy import ctx
def request(flow):
f = ctx.master.state.duplicate_flow(flow)
f.request.path = "/changed"
ctx.master.replay_request(f, block=True, run_scripthooks=False)
<commit_msg>Remove dead run_scripthooks example reference.<commit_after> | from mitmproxy import ctx
def request(flow):
f = ctx.master.state.duplicate_flow(flow)
f.request.path = "/changed"
ctx.master.replay_request(f, block=True)
| from mitmproxy import ctx
def request(flow):
f = ctx.master.state.duplicate_flow(flow)
f.request.path = "/changed"
ctx.master.replay_request(f, block=True, run_scripthooks=False)
Remove dead run_scripthooks example reference.from mitmproxy import ctx
def request(flow):
f = ctx.master.state.duplicate... | <commit_before>from mitmproxy import ctx
def request(flow):
f = ctx.master.state.duplicate_flow(flow)
f.request.path = "/changed"
ctx.master.replay_request(f, block=True, run_scripthooks=False)
<commit_msg>Remove dead run_scripthooks example reference.<commit_after>from mitmproxy import ctx
def request(... |
66ea7be70d37c8431d6daef976c6d5c9a7407ea0 | examples/example_injury.py | examples/example_injury.py | #!/usr/bin/env python
from tabulate import tabulate
from mlbgame import injury
import dateutil.parser
from datetime import datetime
team_id = 117 # Houston Astros
i = injury.Injury(team_id)
injuries = []
for inj in i.injuries:
team = inj.team_name
injury = ['{0}, {1} ({2})'.format(inj.name_last, inj.name_fir... | Add example for injury class | Add example for injury class
| Python | mit | panzarino/mlbgame,zachpanz88/mlbgame | Add example for injury class | #!/usr/bin/env python
from tabulate import tabulate
from mlbgame import injury
import dateutil.parser
from datetime import datetime
team_id = 117 # Houston Astros
i = injury.Injury(team_id)
injuries = []
for inj in i.injuries:
team = inj.team_name
injury = ['{0}, {1} ({2})'.format(inj.name_last, inj.name_fir... | <commit_before><commit_msg>Add example for injury class<commit_after> | #!/usr/bin/env python
from tabulate import tabulate
from mlbgame import injury
import dateutil.parser
from datetime import datetime
team_id = 117 # Houston Astros
i = injury.Injury(team_id)
injuries = []
for inj in i.injuries:
team = inj.team_name
injury = ['{0}, {1} ({2})'.format(inj.name_last, inj.name_fir... | Add example for injury class#!/usr/bin/env python
from tabulate import tabulate
from mlbgame import injury
import dateutil.parser
from datetime import datetime
team_id = 117 # Houston Astros
i = injury.Injury(team_id)
injuries = []
for inj in i.injuries:
team = inj.team_name
injury = ['{0}, {1} ({2})'.format... | <commit_before><commit_msg>Add example for injury class<commit_after>#!/usr/bin/env python
from tabulate import tabulate
from mlbgame import injury
import dateutil.parser
from datetime import datetime
team_id = 117 # Houston Astros
i = injury.Injury(team_id)
injuries = []
for inj in i.injuries:
team = inj.team_n... | |
68009fdf18081033609bc1f98afc1b7e6065c35d | examples/get_yara_rules.py | examples/get_yara_rules.py | import urllib2
import socket
from OTXv2 import OTXv2
from OTXv2 import OTXv2, IndicatorTypes
otx = OTXv2('API_KEY')
pulses = otx.getall()
for i in range(0,len(pulses)-1):
print ("// https://otx.alienvault.com/pulse/" + pulses[i]["id"])
indicators = pulses[i]["indicators"]
for ind in indicators:
i... | Add get yara rules script | Add get yara rules script
| Python | apache-2.0 | AlienVault-Labs/OTX-Python-SDK | Add get yara rules script | import urllib2
import socket
from OTXv2 import OTXv2
from OTXv2 import OTXv2, IndicatorTypes
otx = OTXv2('API_KEY')
pulses = otx.getall()
for i in range(0,len(pulses)-1):
print ("// https://otx.alienvault.com/pulse/" + pulses[i]["id"])
indicators = pulses[i]["indicators"]
for ind in indicators:
i... | <commit_before><commit_msg>Add get yara rules script<commit_after> | import urllib2
import socket
from OTXv2 import OTXv2
from OTXv2 import OTXv2, IndicatorTypes
otx = OTXv2('API_KEY')
pulses = otx.getall()
for i in range(0,len(pulses)-1):
print ("// https://otx.alienvault.com/pulse/" + pulses[i]["id"])
indicators = pulses[i]["indicators"]
for ind in indicators:
i... | Add get yara rules scriptimport urllib2
import socket
from OTXv2 import OTXv2
from OTXv2 import OTXv2, IndicatorTypes
otx = OTXv2('API_KEY')
pulses = otx.getall()
for i in range(0,len(pulses)-1):
print ("// https://otx.alienvault.com/pulse/" + pulses[i]["id"])
indicators = pulses[i]["indicators"]
for ind... | <commit_before><commit_msg>Add get yara rules script<commit_after>import urllib2
import socket
from OTXv2 import OTXv2
from OTXv2 import OTXv2, IndicatorTypes
otx = OTXv2('API_KEY')
pulses = otx.getall()
for i in range(0,len(pulses)-1):
print ("// https://otx.alienvault.com/pulse/" + pulses[i]["id"])
indicat... | |
ddf8b393a0695b71400a35a1a218c734a9bc669c | regscrape/regs_common/data_import.py | regscrape/regs_common/data_import.py | import pymongo
import gridfs
import settings
def copy_data(source_db_name, dest_db_name, query):
source = pymongo.Connection(**settings.DB_SETTINGS)[source_db_name]
dest = pymongo.Connection(**settings.DB_SETTINGS)[dest_db_name]
source_gridfs = gridfs.GridFS(source, collection='files')
dest_gridfs = g... | Add a utility for copying data from one database to another. | Add a utility for copying data from one database to another.
| Python | bsd-3-clause | sunlightlabs/regulations-scraper,sunlightlabs/regulations-scraper,sunlightlabs/regulations-scraper | Add a utility for copying data from one database to another. | import pymongo
import gridfs
import settings
def copy_data(source_db_name, dest_db_name, query):
source = pymongo.Connection(**settings.DB_SETTINGS)[source_db_name]
dest = pymongo.Connection(**settings.DB_SETTINGS)[dest_db_name]
source_gridfs = gridfs.GridFS(source, collection='files')
dest_gridfs = g... | <commit_before><commit_msg>Add a utility for copying data from one database to another.<commit_after> | import pymongo
import gridfs
import settings
def copy_data(source_db_name, dest_db_name, query):
source = pymongo.Connection(**settings.DB_SETTINGS)[source_db_name]
dest = pymongo.Connection(**settings.DB_SETTINGS)[dest_db_name]
source_gridfs = gridfs.GridFS(source, collection='files')
dest_gridfs = g... | Add a utility for copying data from one database to another.import pymongo
import gridfs
import settings
def copy_data(source_db_name, dest_db_name, query):
source = pymongo.Connection(**settings.DB_SETTINGS)[source_db_name]
dest = pymongo.Connection(**settings.DB_SETTINGS)[dest_db_name]
source_gridfs = g... | <commit_before><commit_msg>Add a utility for copying data from one database to another.<commit_after>import pymongo
import gridfs
import settings
def copy_data(source_db_name, dest_db_name, query):
source = pymongo.Connection(**settings.DB_SETTINGS)[source_db_name]
dest = pymongo.Connection(**settings.DB_SETTI... | |
6354d6a7cbfa253562f983a9002827af2b3cc819 | csv_insert_script.py | csv_insert_script.py | #!/usr/bin/env python2.7
import csv
import sqlite3
conn = sqlite3.connect("twdb.db")
cur = conn.cursor()
file = open('stgcd_manual.csv', 'r')
reader = csv.reader(file)
readings = []
twdb_nums = []
for row in reader:
readings.append(row)
if (row[0] not in twdb_nums):
twdb_nums.append(row[0])
readi... | Add script to generate SQL script for STGCD manual readings. | Add script to generate SQL script for STGCD manual readings.
| Python | isc | wablair/misc_scripts,wablair/misc_scripts,wablair/misc_scripts,wablair/misc_scripts | Add script to generate SQL script for STGCD manual readings. | #!/usr/bin/env python2.7
import csv
import sqlite3
conn = sqlite3.connect("twdb.db")
cur = conn.cursor()
file = open('stgcd_manual.csv', 'r')
reader = csv.reader(file)
readings = []
twdb_nums = []
for row in reader:
readings.append(row)
if (row[0] not in twdb_nums):
twdb_nums.append(row[0])
readi... | <commit_before><commit_msg>Add script to generate SQL script for STGCD manual readings.<commit_after> | #!/usr/bin/env python2.7
import csv
import sqlite3
conn = sqlite3.connect("twdb.db")
cur = conn.cursor()
file = open('stgcd_manual.csv', 'r')
reader = csv.reader(file)
readings = []
twdb_nums = []
for row in reader:
readings.append(row)
if (row[0] not in twdb_nums):
twdb_nums.append(row[0])
readi... | Add script to generate SQL script for STGCD manual readings.#!/usr/bin/env python2.7
import csv
import sqlite3
conn = sqlite3.connect("twdb.db")
cur = conn.cursor()
file = open('stgcd_manual.csv', 'r')
reader = csv.reader(file)
readings = []
twdb_nums = []
for row in reader:
readings.append(row)
if (row[0... | <commit_before><commit_msg>Add script to generate SQL script for STGCD manual readings.<commit_after>#!/usr/bin/env python2.7
import csv
import sqlite3
conn = sqlite3.connect("twdb.db")
cur = conn.cursor()
file = open('stgcd_manual.csv', 'r')
reader = csv.reader(file)
readings = []
twdb_nums = []
for row in reade... | |
3f09462f3be6f7d59d36ffaf5e4dae4be74b623b | private/realclearpolitics-scraper/scraper.py | private/realclearpolitics-scraper/scraper.py | import sys, os
args = sys.argv
if (len(args) <= 1):
print("ERROR: Please provide source url")
print("Example : python scraper.py url output.csv")
else:
url = args[1]
if (len(args) == 2):
filename = url.split('/')[-1].split('.')[0]
output = filename + ".csv"
print("No output file... | import sys, os
args = sys.argv
if (len(args) <= 1):
raise ValueError('Please provide source url when calling scraper.py. Example : python scraper.py url output.csv')
else:
url = args[1]
if (len(args) == 2):
filename = url.split('/')[-1].split('.')[0]
output = filename + ".csv"
print... | Raise exception when script called with wrong args | Raise exception when script called with wrong args
(instead of just printing)
| Python | mit | Rumel/berniemetrics,Rumel/berniemetrics,Rumel/berniemetrics,dpxxdp/berniemetrics,Rumel/berniemetrics,fpagnoux/berniemetrics,fpagnoux/berniemetrics,fpagnoux/berniemetrics,dpxxdp/berniemetrics,fpagnoux/berniemetrics,dpxxdp/berniemetrics,dpxxdp/berniemetrics | import sys, os
args = sys.argv
if (len(args) <= 1):
print("ERROR: Please provide source url")
print("Example : python scraper.py url output.csv")
else:
url = args[1]
if (len(args) == 2):
filename = url.split('/')[-1].split('.')[0]
output = filename + ".csv"
print("No output file... | import sys, os
args = sys.argv
if (len(args) <= 1):
raise ValueError('Please provide source url when calling scraper.py. Example : python scraper.py url output.csv')
else:
url = args[1]
if (len(args) == 2):
filename = url.split('/')[-1].split('.')[0]
output = filename + ".csv"
print... | <commit_before>import sys, os
args = sys.argv
if (len(args) <= 1):
print("ERROR: Please provide source url")
print("Example : python scraper.py url output.csv")
else:
url = args[1]
if (len(args) == 2):
filename = url.split('/')[-1].split('.')[0]
output = filename + ".csv"
print(... | import sys, os
args = sys.argv
if (len(args) <= 1):
raise ValueError('Please provide source url when calling scraper.py. Example : python scraper.py url output.csv')
else:
url = args[1]
if (len(args) == 2):
filename = url.split('/')[-1].split('.')[0]
output = filename + ".csv"
print... | import sys, os
args = sys.argv
if (len(args) <= 1):
print("ERROR: Please provide source url")
print("Example : python scraper.py url output.csv")
else:
url = args[1]
if (len(args) == 2):
filename = url.split('/')[-1].split('.')[0]
output = filename + ".csv"
print("No output file... | <commit_before>import sys, os
args = sys.argv
if (len(args) <= 1):
print("ERROR: Please provide source url")
print("Example : python scraper.py url output.csv")
else:
url = args[1]
if (len(args) == 2):
filename = url.split('/')[-1].split('.')[0]
output = filename + ".csv"
print(... |
f536adf23907282aa26c6b844dc6875d5412553d | raw2obj.py | raw2obj.py | import numpy as np
import scipy.misc
import mcubes
import argparse
from sklearn.neighbors import NearestNeighbors
parser = argparse.ArgumentParser(description='Visualise the 3D volume')
parser.add_argument('--image', dest='image',
help="The background image to display")
parser.add_argument('--volu... | Convert the raw data to obj file using PyMCubes. | Convert the raw data to obj file using PyMCubes.
| Python | mit | AaronJackson/vrn,AaronJackson/vrn,AaronJackson/vrn | Convert the raw data to obj file using PyMCubes. | import numpy as np
import scipy.misc
import mcubes
import argparse
from sklearn.neighbors import NearestNeighbors
parser = argparse.ArgumentParser(description='Visualise the 3D volume')
parser.add_argument('--image', dest='image',
help="The background image to display")
parser.add_argument('--volu... | <commit_before><commit_msg>Convert the raw data to obj file using PyMCubes.<commit_after> | import numpy as np
import scipy.misc
import mcubes
import argparse
from sklearn.neighbors import NearestNeighbors
parser = argparse.ArgumentParser(description='Visualise the 3D volume')
parser.add_argument('--image', dest='image',
help="The background image to display")
parser.add_argument('--volu... | Convert the raw data to obj file using PyMCubes.import numpy as np
import scipy.misc
import mcubes
import argparse
from sklearn.neighbors import NearestNeighbors
parser = argparse.ArgumentParser(description='Visualise the 3D volume')
parser.add_argument('--image', dest='image',
help="The backgroun... | <commit_before><commit_msg>Convert the raw data to obj file using PyMCubes.<commit_after>import numpy as np
import scipy.misc
import mcubes
import argparse
from sklearn.neighbors import NearestNeighbors
parser = argparse.ArgumentParser(description='Visualise the 3D volume')
parser.add_argument('--image', dest='image'... | |
5770dfc5b5df312dc15f0bc44437c0e62936d688 | events/migrations/0073_soft_delete_replaced_objects.py | events/migrations/0073_soft_delete_replaced_objects.py | # Generated by Django 2.2.9 on 2020-01-31 08:25
from django.db import migrations
def soft_delete_replaced_objects(Model, deleted_attr='deleted', replaced_by_attr='replaced_by'):
for obj in Model.objects.filter(**{f'{replaced_by_attr}__isnull': False, deleted_attr: False}):
print(f'Found an object that is... | Add data migration that deletes replaced objects | Add data migration that deletes replaced objects
| Python | mit | City-of-Helsinki/linkedevents,City-of-Helsinki/linkedevents,City-of-Helsinki/linkedevents | Add data migration that deletes replaced objects | # Generated by Django 2.2.9 on 2020-01-31 08:25
from django.db import migrations
def soft_delete_replaced_objects(Model, deleted_attr='deleted', replaced_by_attr='replaced_by'):
for obj in Model.objects.filter(**{f'{replaced_by_attr}__isnull': False, deleted_attr: False}):
print(f'Found an object that is... | <commit_before><commit_msg>Add data migration that deletes replaced objects<commit_after> | # Generated by Django 2.2.9 on 2020-01-31 08:25
from django.db import migrations
def soft_delete_replaced_objects(Model, deleted_attr='deleted', replaced_by_attr='replaced_by'):
for obj in Model.objects.filter(**{f'{replaced_by_attr}__isnull': False, deleted_attr: False}):
print(f'Found an object that is... | Add data migration that deletes replaced objects# Generated by Django 2.2.9 on 2020-01-31 08:25
from django.db import migrations
def soft_delete_replaced_objects(Model, deleted_attr='deleted', replaced_by_attr='replaced_by'):
for obj in Model.objects.filter(**{f'{replaced_by_attr}__isnull': False, deleted_attr: ... | <commit_before><commit_msg>Add data migration that deletes replaced objects<commit_after># Generated by Django 2.2.9 on 2020-01-31 08:25
from django.db import migrations
def soft_delete_replaced_objects(Model, deleted_attr='deleted', replaced_by_attr='replaced_by'):
for obj in Model.objects.filter(**{f'{replaced... | |
d08404d9589a0a61aba9eeb01231f5d7d6707bf3 | services/migrations/0026_auto_20150302_2222.py | services/migrations/0026_auto_20150302_2222.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import services.models
class Migration(migrations.Migration):
dependencies = [
('services', '0025_merge'),
]
operations = [
migrations.AlterField(
model_name='provider',
... | Add missing migration for provider name validators | Add missing migration for provider name validators
| Python | bsd-3-clause | theirc/ServiceInfo,theirc/ServiceInfo,theirc/ServiceInfo,theirc/ServiceInfo-ircdeploy,theirc/ServiceInfo | Add missing migration for provider name validators | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import services.models
class Migration(migrations.Migration):
dependencies = [
('services', '0025_merge'),
]
operations = [
migrations.AlterField(
model_name='provider',
... | <commit_before><commit_msg>Add missing migration for provider name validators<commit_after> | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import services.models
class Migration(migrations.Migration):
dependencies = [
('services', '0025_merge'),
]
operations = [
migrations.AlterField(
model_name='provider',
... | Add missing migration for provider name validators# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import services.models
class Migration(migrations.Migration):
dependencies = [
('services', '0025_merge'),
]
operations = [
migratio... | <commit_before><commit_msg>Add missing migration for provider name validators<commit_after># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import services.models
class Migration(migrations.Migration):
dependencies = [
('services', '0025_merge'),
... | |
f453221b89d21dc7350706fc707bb3a88012d5ba | src/simple_data_export.py | src/simple_data_export.py | from collections import defaultdict
import json
from math import floor
import sys
import database as db
from database.model import Team
from geotools import simple_distance
from geotools.routing import MapPoint
from webapp.cfg.config import DB_CONNECTION
if len(sys.argv) == 2:
MAX_TEAMS = sys.argv[1]
else:
MA... | Add a very simple script to export team data from the database as json files. | Add a very simple script to export team data from the database as json files.
| Python | bsd-3-clause | eXma/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,eXma/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system,janLo/meet-and-eat-registration-system | Add a very simple script to export team data from the database as json files. | from collections import defaultdict
import json
from math import floor
import sys
import database as db
from database.model import Team
from geotools import simple_distance
from geotools.routing import MapPoint
from webapp.cfg.config import DB_CONNECTION
if len(sys.argv) == 2:
MAX_TEAMS = sys.argv[1]
else:
MA... | <commit_before><commit_msg>Add a very simple script to export team data from the database as json files.<commit_after> | from collections import defaultdict
import json
from math import floor
import sys
import database as db
from database.model import Team
from geotools import simple_distance
from geotools.routing import MapPoint
from webapp.cfg.config import DB_CONNECTION
if len(sys.argv) == 2:
MAX_TEAMS = sys.argv[1]
else:
MA... | Add a very simple script to export team data from the database as json files.from collections import defaultdict
import json
from math import floor
import sys
import database as db
from database.model import Team
from geotools import simple_distance
from geotools.routing import MapPoint
from webapp.cfg.config import DB... | <commit_before><commit_msg>Add a very simple script to export team data from the database as json files.<commit_after>from collections import defaultdict
import json
from math import floor
import sys
import database as db
from database.model import Team
from geotools import simple_distance
from geotools.routing import ... | |
b5a9c8e0c7ae377d9b1a3671170542f6a7fecde3 | ecommerce/extensions/catalogue/migrations/0034_add_on_campus_coupon_category.py | ecommerce/extensions/catalogue/migrations/0034_add_on_campus_coupon_category.py | """ Add 'On-Campus Learners' to the list of default coupon categories"""
from django.db import migrations
from oscar.apps.catalogue.categories import create_from_breadcrumbs
from oscar.core.loading import get_model
Category = get_model('catalogue', 'Category')
COUPON_CATEGORY_NAME = 'Coupons'
ON_CAMPUS_CATEGORY = '... | Create On-Campus Learner Coupon Category | REVE-183: Create On-Campus Learner Coupon Category
| Python | agpl-3.0 | edx/ecommerce,eduNEXT/edunext-ecommerce,eduNEXT/edunext-ecommerce,eduNEXT/edunext-ecommerce,edx/ecommerce,edx/ecommerce,edx/ecommerce,eduNEXT/edunext-ecommerce | REVE-183: Create On-Campus Learner Coupon Category | """ Add 'On-Campus Learners' to the list of default coupon categories"""
from django.db import migrations
from oscar.apps.catalogue.categories import create_from_breadcrumbs
from oscar.core.loading import get_model
Category = get_model('catalogue', 'Category')
COUPON_CATEGORY_NAME = 'Coupons'
ON_CAMPUS_CATEGORY = '... | <commit_before><commit_msg>REVE-183: Create On-Campus Learner Coupon Category<commit_after> | """ Add 'On-Campus Learners' to the list of default coupon categories"""
from django.db import migrations
from oscar.apps.catalogue.categories import create_from_breadcrumbs
from oscar.core.loading import get_model
Category = get_model('catalogue', 'Category')
COUPON_CATEGORY_NAME = 'Coupons'
ON_CAMPUS_CATEGORY = '... | REVE-183: Create On-Campus Learner Coupon Category""" Add 'On-Campus Learners' to the list of default coupon categories"""
from django.db import migrations
from oscar.apps.catalogue.categories import create_from_breadcrumbs
from oscar.core.loading import get_model
Category = get_model('catalogue', 'Category')
COUPON... | <commit_before><commit_msg>REVE-183: Create On-Campus Learner Coupon Category<commit_after>""" Add 'On-Campus Learners' to the list of default coupon categories"""
from django.db import migrations
from oscar.apps.catalogue.categories import create_from_breadcrumbs
from oscar.core.loading import get_model
Category = g... | |
9569ea1d7c3e91dc8f7ba63ca22aaddd2f3bcfca | djangae/contrib/auth/management/__init__.py | djangae/contrib/auth/management/__init__.py | from django.db import DEFAULT_DB_ALIAS, router
from django.db.models import get_model, get_models, signals, UnavailableApp
from django.contrib.auth import (models as auth_app, get_permission_codename,
get_user_model)
from django.contrib.auth.management import _get_all_permissions
def create_permissions(app, create... | Add an override for create_permissions which batches the lookups | Add an override for create_permissions which batches the lookups
| Python | bsd-3-clause | stucox/djangae,nealedj/djangae,SiPiggles/djangae,b-cannon/my_djae,armirusco/djangae,armirusco/djangae,martinogden/djangae,stucox/djangae,martinogden/djangae,kirberich/djangae,grzes/djangae,grzes/djangae,leekchan/djangae,potatolondon/djangae,martinogden/djangae,chargrizzle/djangae,chargrizzle/djangae,asendecka/djangae,S... | Add an override for create_permissions which batches the lookups | from django.db import DEFAULT_DB_ALIAS, router
from django.db.models import get_model, get_models, signals, UnavailableApp
from django.contrib.auth import (models as auth_app, get_permission_codename,
get_user_model)
from django.contrib.auth.management import _get_all_permissions
def create_permissions(app, create... | <commit_before><commit_msg>Add an override for create_permissions which batches the lookups<commit_after> | from django.db import DEFAULT_DB_ALIAS, router
from django.db.models import get_model, get_models, signals, UnavailableApp
from django.contrib.auth import (models as auth_app, get_permission_codename,
get_user_model)
from django.contrib.auth.management import _get_all_permissions
def create_permissions(app, create... | Add an override for create_permissions which batches the lookupsfrom django.db import DEFAULT_DB_ALIAS, router
from django.db.models import get_model, get_models, signals, UnavailableApp
from django.contrib.auth import (models as auth_app, get_permission_codename,
get_user_model)
from django.contrib.auth.management... | <commit_before><commit_msg>Add an override for create_permissions which batches the lookups<commit_after>from django.db import DEFAULT_DB_ALIAS, router
from django.db.models import get_model, get_models, signals, UnavailableApp
from django.contrib.auth import (models as auth_app, get_permission_codename,
get_user_m... | |
5c2ed17e84f435380ded64e0b5d1703f8e3b54c9 | csunplugged/tests/infrastructure/test_deployment.py | csunplugged/tests/infrastructure/test_deployment.py | """Tests deployments."""
import os
import re
from tests.BaseTest import BaseTest
class DeploymentTest(BaseTest):
"""Tests for deployments."""
def test_dev_deploy_scripts_are_called(self):
# Create list of script files
FILES_TO_SKIP = (
'decrypt-dev-secrets.sh',
'load-... | Add test to check resource generation files are called | Add test to check resource generation files are called
| Python | mit | uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged | Add test to check resource generation files are called | """Tests deployments."""
import os
import re
from tests.BaseTest import BaseTest
class DeploymentTest(BaseTest):
"""Tests for deployments."""
def test_dev_deploy_scripts_are_called(self):
# Create list of script files
FILES_TO_SKIP = (
'decrypt-dev-secrets.sh',
'load-... | <commit_before><commit_msg>Add test to check resource generation files are called<commit_after> | """Tests deployments."""
import os
import re
from tests.BaseTest import BaseTest
class DeploymentTest(BaseTest):
"""Tests for deployments."""
def test_dev_deploy_scripts_are_called(self):
# Create list of script files
FILES_TO_SKIP = (
'decrypt-dev-secrets.sh',
'load-... | Add test to check resource generation files are called"""Tests deployments."""
import os
import re
from tests.BaseTest import BaseTest
class DeploymentTest(BaseTest):
"""Tests for deployments."""
def test_dev_deploy_scripts_are_called(self):
# Create list of script files
FILES_TO_SKIP = (
... | <commit_before><commit_msg>Add test to check resource generation files are called<commit_after>"""Tests deployments."""
import os
import re
from tests.BaseTest import BaseTest
class DeploymentTest(BaseTest):
"""Tests for deployments."""
def test_dev_deploy_scripts_are_called(self):
# Create list of ... | |
5ae4da11c2a98321864569b900338f3e78cd22d6 | flexx/app/tests/test_live.py | flexx/app/tests/test_live.py | """ Test a live app connection.
"""
from flexx import app, react
from flexx.util.testing import run_tests_if_main, raises
def runner(cls):
t = app.launch(cls, 'xul')
t.test_init()
app.run()
t.test_check()
class BaseTesterApp(app.Model):
@react.input
def input(v):
return v... | Add test for a life connection with a browser to test important code paths. | Add test for a life connection with a browser to test important code paths.
| Python | bsd-2-clause | JohnLunzer/flexx,jrversteegh/flexx,zoofIO/flexx,JohnLunzer/flexx,zoofIO/flexx,JohnLunzer/flexx,jrversteegh/flexx | Add test for a life connection with a browser to test important code paths. | """ Test a live app connection.
"""
from flexx import app, react
from flexx.util.testing import run_tests_if_main, raises
def runner(cls):
t = app.launch(cls, 'xul')
t.test_init()
app.run()
t.test_check()
class BaseTesterApp(app.Model):
@react.input
def input(v):
return v... | <commit_before><commit_msg>Add test for a life connection with a browser to test important code paths.<commit_after> | """ Test a live app connection.
"""
from flexx import app, react
from flexx.util.testing import run_tests_if_main, raises
def runner(cls):
t = app.launch(cls, 'xul')
t.test_init()
app.run()
t.test_check()
class BaseTesterApp(app.Model):
@react.input
def input(v):
return v... | Add test for a life connection with a browser to test important code paths.""" Test a live app connection.
"""
from flexx import app, react
from flexx.util.testing import run_tests_if_main, raises
def runner(cls):
t = app.launch(cls, 'xul')
t.test_init()
app.run()
t.test_check()
class BaseTesterAp... | <commit_before><commit_msg>Add test for a life connection with a browser to test important code paths.<commit_after>""" Test a live app connection.
"""
from flexx import app, react
from flexx.util.testing import run_tests_if_main, raises
def runner(cls):
t = app.launch(cls, 'xul')
t.test_init()
app.run(... | |
7a838753853f172078068ba37e3462e3093f32c6 | leetcode/289-Game-of-Life/GameofLife_001.py | leetcode/289-Game-of-Life/GameofLife_001.py | class Solution(object):
def gameOfLife(self, board):
"""
:type board: List[List[int]]
:rtype: void Do not return anything, modify board in-place instead.
"""
m, n = len(board), len(board[0])
for i in xrange(m):
for j in xrange(n):
cnt = 0
... | Add Game of Life for lc | Add Game of Life for lc
| Python | mit | cc13ny/Allin,cc13ny/algo,Chasego/cod,cc13ny/Allin,Chasego/cod,cc13ny/algo,Chasego/codirit,Chasego/codirit,cc13ny/Allin,Chasego/codirit,Chasego/codi,Chasego/codi,Chasego/codi,cc13ny/Allin,Chasego/codirit,Chasego/cod,cc13ny/algo,Chasego/cod,Chasego/codi,cc13ny/Allin,Chasego/codirit,Chasego/codi,cc13ny/algo,Chasego/cod,cc... | Add Game of Life for lc | class Solution(object):
def gameOfLife(self, board):
"""
:type board: List[List[int]]
:rtype: void Do not return anything, modify board in-place instead.
"""
m, n = len(board), len(board[0])
for i in xrange(m):
for j in xrange(n):
cnt = 0
... | <commit_before><commit_msg>Add Game of Life for lc<commit_after> | class Solution(object):
def gameOfLife(self, board):
"""
:type board: List[List[int]]
:rtype: void Do not return anything, modify board in-place instead.
"""
m, n = len(board), len(board[0])
for i in xrange(m):
for j in xrange(n):
cnt = 0
... | Add Game of Life for lcclass Solution(object):
def gameOfLife(self, board):
"""
:type board: List[List[int]]
:rtype: void Do not return anything, modify board in-place instead.
"""
m, n = len(board), len(board[0])
for i in xrange(m):
for j in xrange(n):
... | <commit_before><commit_msg>Add Game of Life for lc<commit_after>class Solution(object):
def gameOfLife(self, board):
"""
:type board: List[List[int]]
:rtype: void Do not return anything, modify board in-place instead.
"""
m, n = len(board), len(board[0])
for i in xran... | |
a14ce43c2d318f864f70392eab16145ec6bc4733 | support/jenkins/buildAllModuleCombination.py | support/jenkins/buildAllModuleCombination.py | import os
from subprocess import call
from itertools import product, repeat
# To be called from the OpenSpace main folder
modules = os.listdir("modules")
modules.remove("base")
# Get 2**len(modules) combinatorical combinations of ON/OFF
settings = []
for args in product(*repeat(("ON", "OFF"), len(modules))):
sett... | Add Python script to build all combinations of modules | Add Python script to build all combinations of modules
| Python | mit | OpenSpace/OpenSpace,OpenSpace/OpenSpace,OpenSpace/OpenSpace,OpenSpace/OpenSpace | Add Python script to build all combinations of modules | import os
from subprocess import call
from itertools import product, repeat
# To be called from the OpenSpace main folder
modules = os.listdir("modules")
modules.remove("base")
# Get 2**len(modules) combinatorical combinations of ON/OFF
settings = []
for args in product(*repeat(("ON", "OFF"), len(modules))):
sett... | <commit_before><commit_msg>Add Python script to build all combinations of modules<commit_after> | import os
from subprocess import call
from itertools import product, repeat
# To be called from the OpenSpace main folder
modules = os.listdir("modules")
modules.remove("base")
# Get 2**len(modules) combinatorical combinations of ON/OFF
settings = []
for args in product(*repeat(("ON", "OFF"), len(modules))):
sett... | Add Python script to build all combinations of modulesimport os
from subprocess import call
from itertools import product, repeat
# To be called from the OpenSpace main folder
modules = os.listdir("modules")
modules.remove("base")
# Get 2**len(modules) combinatorical combinations of ON/OFF
settings = []
for args in p... | <commit_before><commit_msg>Add Python script to build all combinations of modules<commit_after>import os
from subprocess import call
from itertools import product, repeat
# To be called from the OpenSpace main folder
modules = os.listdir("modules")
modules.remove("base")
# Get 2**len(modules) combinatorical combinati... | |
e42f488ae779168c10d6a01bd04dfd2f6c3c311d | restalchemy/api/controllers.py | restalchemy/api/controllers.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2014 Eugene Frolov <[email protected]>
#
# 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
#
# ... | Add base class for API Controller | Add base class for API Controller
Change-Id: Idf28f395308be3416a95783d9c1ec1d6c2478487
| Python | apache-2.0 | phantomii/restalchemy | Add base class for API Controller
Change-Id: Idf28f395308be3416a95783d9c1ec1d6c2478487 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2014 Eugene Frolov <[email protected]>
#
# 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
#
# ... | <commit_before><commit_msg>Add base class for API Controller
Change-Id: Idf28f395308be3416a95783d9c1ec1d6c2478487<commit_after> | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2014 Eugene Frolov <[email protected]>
#
# 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
#
# ... | Add base class for API Controller
Change-Id: Idf28f395308be3416a95783d9c1ec1d6c2478487# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2014 Eugene Frolov <[email protected]>
#
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except... | <commit_before><commit_msg>Add base class for API Controller
Change-Id: Idf28f395308be3416a95783d9c1ec1d6c2478487<commit_after># vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2014 Eugene Frolov <[email protected]>
#
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License... | |
8f13e16b904d71149321b4ae8f03db32a49cdf08 | iatidq/user_activity_types.py | iatidq/user_activity_types.py |
# IATI Data Quality, tools for Data QA on IATI-formatted publications
# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith
#
# Copyright (C) 2013 Publish What You Fund
#
# This programme is free software; you may redistribute and/or modify
# it under the terms of the GNU Affero General Public License v3... | Add user activity types module | Add user activity types module
| Python | agpl-3.0 | pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality | Add user activity types module |
# IATI Data Quality, tools for Data QA on IATI-formatted publications
# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith
#
# Copyright (C) 2013 Publish What You Fund
#
# This programme is free software; you may redistribute and/or modify
# it under the terms of the GNU Affero General Public License v3... | <commit_before><commit_msg>Add user activity types module<commit_after> |
# IATI Data Quality, tools for Data QA on IATI-formatted publications
# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith
#
# Copyright (C) 2013 Publish What You Fund
#
# This programme is free software; you may redistribute and/or modify
# it under the terms of the GNU Affero General Public License v3... | Add user activity types module
# IATI Data Quality, tools for Data QA on IATI-formatted publications
# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith
#
# Copyright (C) 2013 Publish What You Fund
#
# This programme is free software; you may redistribute and/or modify
# it under the terms of the GNU Af... | <commit_before><commit_msg>Add user activity types module<commit_after>
# IATI Data Quality, tools for Data QA on IATI-formatted publications
# by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith
#
# Copyright (C) 2013 Publish What You Fund
#
# This programme is free software; you may redistribute and/or m... | |
48ec53343be7d7efc07bc1f66416d884be22b430 | Python/ds.py | Python/ds.py | """
This file includes several data structures used in LeetCode question.
"""
# Definition for a list node.
class ListNode(object):
def __init__(self, n):
self.val = n
self.next = None
def createLinkedList(nodelist):
#type nodelist: list[int/float]
#rtype: head of linked list
linkedList = ListNode(0)
head = ... | Add class file for linked list and binary tree | Add class file for linked list and binary tree
| Python | mit | comicxmz001/LeetCode,comicxmz001/LeetCode | Add class file for linked list and binary tree | """
This file includes several data structures used in LeetCode question.
"""
# Definition for a list node.
class ListNode(object):
def __init__(self, n):
self.val = n
self.next = None
def createLinkedList(nodelist):
#type nodelist: list[int/float]
#rtype: head of linked list
linkedList = ListNode(0)
head = ... | <commit_before><commit_msg>Add class file for linked list and binary tree<commit_after> | """
This file includes several data structures used in LeetCode question.
"""
# Definition for a list node.
class ListNode(object):
def __init__(self, n):
self.val = n
self.next = None
def createLinkedList(nodelist):
#type nodelist: list[int/float]
#rtype: head of linked list
linkedList = ListNode(0)
head = ... | Add class file for linked list and binary tree"""
This file includes several data structures used in LeetCode question.
"""
# Definition for a list node.
class ListNode(object):
def __init__(self, n):
self.val = n
self.next = None
def createLinkedList(nodelist):
#type nodelist: list[int/float]
#rtype: head of ... | <commit_before><commit_msg>Add class file for linked list and binary tree<commit_after>"""
This file includes several data structures used in LeetCode question.
"""
# Definition for a list node.
class ListNode(object):
def __init__(self, n):
self.val = n
self.next = None
def createLinkedList(nodelist):
#type no... | |
4601244bea1c0b84679d90b0b368da7f39908759 | dakota_utils/tests/test_file.py | dakota_utils/tests/test_file.py | #! /usr/bin/env python
#
# Tests for dakota_utils.file.
#
# Call with:
# $ nosetests -sv
#
# Mark Piper ([email protected])
from nose.tools import *
import os
import tempfile
import shutil
from dakota_utils.file import *
def setup_module():
print('File tests:')
os.environ['_test_tmp_dir'] = tempfile.m... | Add unit tests for file module | Add unit tests for file module
| Python | mit | mcflugen/dakota-experiments,mcflugen/dakota-experiments,mdpiper/dakota-experiments,mdpiper/dakota-experiments,mdpiper/dakota-experiments | Add unit tests for file module | #! /usr/bin/env python
#
# Tests for dakota_utils.file.
#
# Call with:
# $ nosetests -sv
#
# Mark Piper ([email protected])
from nose.tools import *
import os
import tempfile
import shutil
from dakota_utils.file import *
def setup_module():
print('File tests:')
os.environ['_test_tmp_dir'] = tempfile.m... | <commit_before><commit_msg>Add unit tests for file module<commit_after> | #! /usr/bin/env python
#
# Tests for dakota_utils.file.
#
# Call with:
# $ nosetests -sv
#
# Mark Piper ([email protected])
from nose.tools import *
import os
import tempfile
import shutil
from dakota_utils.file import *
def setup_module():
print('File tests:')
os.environ['_test_tmp_dir'] = tempfile.m... | Add unit tests for file module#! /usr/bin/env python
#
# Tests for dakota_utils.file.
#
# Call with:
# $ nosetests -sv
#
# Mark Piper ([email protected])
from nose.tools import *
import os
import tempfile
import shutil
from dakota_utils.file import *
def setup_module():
print('File tests:')
os.environ... | <commit_before><commit_msg>Add unit tests for file module<commit_after>#! /usr/bin/env python
#
# Tests for dakota_utils.file.
#
# Call with:
# $ nosetests -sv
#
# Mark Piper ([email protected])
from nose.tools import *
import os
import tempfile
import shutil
from dakota_utils.file import *
def setup_module()... | |
cde2263c2084b8ce91e85face95e5e85439ab7ce | scripts/annotate_rsvps.py | scripts/annotate_rsvps.py | """Utilities for annotating workshop RSVP data.
Example ::
import pandas as pd
from scripts import annotate_rsvps
frame = pd.read_csv('workshop.csv')
annotated = annotate_rsvps.process(frame)
annotated.to_csv('workshop-annotated.csv')
"""
import re
import logging
from dateutil.parser import par... | Add script to annotate conference RSVP spreadsheets. | Add script to annotate conference RSVP spreadsheets.
Requested by @lbanner.
| Python | apache-2.0 | caneruguz/osf.io,CenterForOpenScience/osf.io,petermalcolm/osf.io,bdyetton/prettychart,asanfilippo7/osf.io,petermalcolm/osf.io,KAsante95/osf.io,ZobairAlijan/osf.io,cwisecarver/osf.io,Ghalko/osf.io,Johnetordoff/osf.io,cosenal/osf.io,DanielSBrown/osf.io,doublebits/osf.io,jnayak1/osf.io,MerlinZhang/osf.io,rdhyee/osf.io,dan... | Add script to annotate conference RSVP spreadsheets.
Requested by @lbanner. | """Utilities for annotating workshop RSVP data.
Example ::
import pandas as pd
from scripts import annotate_rsvps
frame = pd.read_csv('workshop.csv')
annotated = annotate_rsvps.process(frame)
annotated.to_csv('workshop-annotated.csv')
"""
import re
import logging
from dateutil.parser import par... | <commit_before><commit_msg>Add script to annotate conference RSVP spreadsheets.
Requested by @lbanner.<commit_after> | """Utilities for annotating workshop RSVP data.
Example ::
import pandas as pd
from scripts import annotate_rsvps
frame = pd.read_csv('workshop.csv')
annotated = annotate_rsvps.process(frame)
annotated.to_csv('workshop-annotated.csv')
"""
import re
import logging
from dateutil.parser import par... | Add script to annotate conference RSVP spreadsheets.
Requested by @lbanner."""Utilities for annotating workshop RSVP data.
Example ::
import pandas as pd
from scripts import annotate_rsvps
frame = pd.read_csv('workshop.csv')
annotated = annotate_rsvps.process(frame)
annotated.to_csv('workshop-ann... | <commit_before><commit_msg>Add script to annotate conference RSVP spreadsheets.
Requested by @lbanner.<commit_after>"""Utilities for annotating workshop RSVP data.
Example ::
import pandas as pd
from scripts import annotate_rsvps
frame = pd.read_csv('workshop.csv')
annotated = annotate_rsvps.process(... | |
1f17a2a4efaefa0b77eef123dd950e1c047fcb2d | scripts/copy_snippet.py | scripts/copy_snippet.py | #!/usr/bin/env python
"""Copy a snippet (in its latest version) from one party to another.
:Copyright: 2006-2018 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import click
from byceps.services.snippet.models.snippet import SnippetType
from byceps.services.snippet import service as snippe... | Add script to copy a snippet from one party to another | Add script to copy a snippet from one party to another
| Python | bsd-3-clause | m-ober/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,homeworkprod/byceps | Add script to copy a snippet from one party to another | #!/usr/bin/env python
"""Copy a snippet (in its latest version) from one party to another.
:Copyright: 2006-2018 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import click
from byceps.services.snippet.models.snippet import SnippetType
from byceps.services.snippet import service as snippe... | <commit_before><commit_msg>Add script to copy a snippet from one party to another<commit_after> | #!/usr/bin/env python
"""Copy a snippet (in its latest version) from one party to another.
:Copyright: 2006-2018 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import click
from byceps.services.snippet.models.snippet import SnippetType
from byceps.services.snippet import service as snippe... | Add script to copy a snippet from one party to another#!/usr/bin/env python
"""Copy a snippet (in its latest version) from one party to another.
:Copyright: 2006-2018 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import click
from byceps.services.snippet.models.snippet import SnippetType... | <commit_before><commit_msg>Add script to copy a snippet from one party to another<commit_after>#!/usr/bin/env python
"""Copy a snippet (in its latest version) from one party to another.
:Copyright: 2006-2018 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import click
from byceps.services.... | |
9991b40871ccd70ee4359b8e44e9a3a5aa15fd8a | migrations/versions/0243_another_letter_org.py | migrations/versions/0243_another_letter_org.py | """empty message
Revision ID: 0243_another_letter_org
Revises: 0242_template_folders
"""
# revision identifiers, used by Alembic.
revision = '0243_another_letter_org'
down_revision = '0242_template_folders'
from alembic import op
NEW_ORGANISATIONS = [
('516', 'Worcestershire County Council', 'worcestershire')... | Add Buckinghamshire and Worcestershire letter logos | Add Buckinghamshire and Worcestershire letter logos
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | Add Buckinghamshire and Worcestershire letter logos | """empty message
Revision ID: 0243_another_letter_org
Revises: 0242_template_folders
"""
# revision identifiers, used by Alembic.
revision = '0243_another_letter_org'
down_revision = '0242_template_folders'
from alembic import op
NEW_ORGANISATIONS = [
('516', 'Worcestershire County Council', 'worcestershire')... | <commit_before><commit_msg>Add Buckinghamshire and Worcestershire letter logos<commit_after> | """empty message
Revision ID: 0243_another_letter_org
Revises: 0242_template_folders
"""
# revision identifiers, used by Alembic.
revision = '0243_another_letter_org'
down_revision = '0242_template_folders'
from alembic import op
NEW_ORGANISATIONS = [
('516', 'Worcestershire County Council', 'worcestershire')... | Add Buckinghamshire and Worcestershire letter logos"""empty message
Revision ID: 0243_another_letter_org
Revises: 0242_template_folders
"""
# revision identifiers, used by Alembic.
revision = '0243_another_letter_org'
down_revision = '0242_template_folders'
from alembic import op
NEW_ORGANISATIONS = [
('516',... | <commit_before><commit_msg>Add Buckinghamshire and Worcestershire letter logos<commit_after>"""empty message
Revision ID: 0243_another_letter_org
Revises: 0242_template_folders
"""
# revision identifiers, used by Alembic.
revision = '0243_another_letter_org'
down_revision = '0242_template_folders'
from alembic impo... | |
ffd021e5effd8264bb8708cb52f17498f3969357 | scripts/update_names.py | scripts/update_names.py | from accounts.models import TimtecUser
import re
cont = 0
for user in TimtecUser.objects.all():
complete_name = user.first_name + " " + user.last_name
complete_name = re.sub(' +',' ', complete_name)
if (complete_name != ' '):
user.first_name = complete_name
user.last_name = ''
user... | Add script to update names | Add script to update names
| Python | agpl-3.0 | mupi/tecsaladeaula,mupi/tecsaladeaula,mupi/tecsaladeaula,mupi/tecsaladeaula | Add script to update names | from accounts.models import TimtecUser
import re
cont = 0
for user in TimtecUser.objects.all():
complete_name = user.first_name + " " + user.last_name
complete_name = re.sub(' +',' ', complete_name)
if (complete_name != ' '):
user.first_name = complete_name
user.last_name = ''
user... | <commit_before><commit_msg>Add script to update names<commit_after> | from accounts.models import TimtecUser
import re
cont = 0
for user in TimtecUser.objects.all():
complete_name = user.first_name + " " + user.last_name
complete_name = re.sub(' +',' ', complete_name)
if (complete_name != ' '):
user.first_name = complete_name
user.last_name = ''
user... | Add script to update namesfrom accounts.models import TimtecUser
import re
cont = 0
for user in TimtecUser.objects.all():
complete_name = user.first_name + " " + user.last_name
complete_name = re.sub(' +',' ', complete_name)
if (complete_name != ' '):
user.first_name = complete_name
user.l... | <commit_before><commit_msg>Add script to update names<commit_after>from accounts.models import TimtecUser
import re
cont = 0
for user in TimtecUser.objects.all():
complete_name = user.first_name + " " + user.last_name
complete_name = re.sub(' +',' ', complete_name)
if (complete_name != ' '):
user.... | |
b00d66ebe0248fcaff164997638c8890b5b5c17c | tensorflow/python/autograph/utils/compat_util.py | tensorflow/python/autograph/utils/compat_util.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Swap out modules in py2 mode in a cleaner fashion. | Swap out modules in py2 mode in a cleaner fashion.
PiperOrigin-RevId: 288526813
Change-Id: I86efd4d804c0c873856307cf4a969270eb7bbae8
| Python | apache-2.0 | annarev/tensorflow,aam-at/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,xzturn/tensorflow,annarev/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow,yongtang/tensorflow,cxxgtxy/tensorflow,davidzchen/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_on... | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | <commit_before># Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | <commit_before># Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
24fe675fa2cedb4cce6596ea46dbed24b31ee072 | python/fix-srt-subtitle/fix-srt-subtitle.py | python/fix-srt-subtitle/fix-srt-subtitle.py | #!/usr/bin/env python
import optparse
import sys
def main():
empty_subtitle = '''1
00:00:00,000 --> 00:00:00,001
'''
parser, infile_name, outfile_name = parse_options()
#if len(sys.argv) < 3:
# sys.exit('USAGE: {0} SRT_INFILE SRT_OUTFILE'.format(sys.argv[0]))
# TODO: with contextlib.clos... | Add script for fixing SRT subtitle files | Add script for fixing SRT subtitle files
| Python | mit | bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile | Add script for fixing SRT subtitle files | #!/usr/bin/env python
import optparse
import sys
def main():
empty_subtitle = '''1
00:00:00,000 --> 00:00:00,001
'''
parser, infile_name, outfile_name = parse_options()
#if len(sys.argv) < 3:
# sys.exit('USAGE: {0} SRT_INFILE SRT_OUTFILE'.format(sys.argv[0]))
# TODO: with contextlib.clos... | <commit_before><commit_msg>Add script for fixing SRT subtitle files<commit_after> | #!/usr/bin/env python
import optparse
import sys
def main():
empty_subtitle = '''1
00:00:00,000 --> 00:00:00,001
'''
parser, infile_name, outfile_name = parse_options()
#if len(sys.argv) < 3:
# sys.exit('USAGE: {0} SRT_INFILE SRT_OUTFILE'.format(sys.argv[0]))
# TODO: with contextlib.clos... | Add script for fixing SRT subtitle files#!/usr/bin/env python
import optparse
import sys
def main():
empty_subtitle = '''1
00:00:00,000 --> 00:00:00,001
'''
parser, infile_name, outfile_name = parse_options()
#if len(sys.argv) < 3:
# sys.exit('USAGE: {0} SRT_INFILE SRT_OUTFILE'.format(sys.ar... | <commit_before><commit_msg>Add script for fixing SRT subtitle files<commit_after>#!/usr/bin/env python
import optparse
import sys
def main():
empty_subtitle = '''1
00:00:00,000 --> 00:00:00,001
'''
parser, infile_name, outfile_name = parse_options()
#if len(sys.argv) < 3:
# sys.exit('USAGE: ... | |
deda54b8b97399019d1d7378d1e45b223436494e | mzalendo/core/management/commands/core_extend_party_memberships.py | mzalendo/core/management/commands/core_extend_party_memberships.py | # This command is intended to fix issue 550:
#
# https://github.com/mysociety/mzalendo/issues/550
#
# "As mentioned in #494 there are lots of party membership positions
# that have an end date of 2012 - meaning that on the site many
# positions are hidden by default. These party memberships should
# probab... | Add an admin command to fix party membership position end_dates | Add an admin command to fix party membership position end_dates
This is a fix for issue #550 - some party membership positions
were set to 2012, so they no longer appear as current
party memberships. Instead, we should set these to 'future'.
We will shortly be importing the new candidate data, in which
lots of these... | Python | agpl-3.0 | hzj123/56th,mysociety/pombola,geoffkilpin/pombola,patricmutwiri/pombola,mysociety/pombola,geoffkilpin/pombola,patricmutwiri/pombola,hzj123/56th,geoffkilpin/pombola,mysociety/pombola,geoffkilpin/pombola,patricmutwiri/pombola,geoffkilpin/pombola,hzj123/56th,geoffkilpin/pombola,ken-muturi/pombola,patricmutwiri/pombola,pat... | Add an admin command to fix party membership position end_dates
This is a fix for issue #550 - some party membership positions
were set to 2012, so they no longer appear as current
party memberships. Instead, we should set these to 'future'.
We will shortly be importing the new candidate data, in which
lots of these... | # This command is intended to fix issue 550:
#
# https://github.com/mysociety/mzalendo/issues/550
#
# "As mentioned in #494 there are lots of party membership positions
# that have an end date of 2012 - meaning that on the site many
# positions are hidden by default. These party memberships should
# probab... | <commit_before><commit_msg>Add an admin command to fix party membership position end_dates
This is a fix for issue #550 - some party membership positions
were set to 2012, so they no longer appear as current
party memberships. Instead, we should set these to 'future'.
We will shortly be importing the new candidate d... | # This command is intended to fix issue 550:
#
# https://github.com/mysociety/mzalendo/issues/550
#
# "As mentioned in #494 there are lots of party membership positions
# that have an end date of 2012 - meaning that on the site many
# positions are hidden by default. These party memberships should
# probab... | Add an admin command to fix party membership position end_dates
This is a fix for issue #550 - some party membership positions
were set to 2012, so they no longer appear as current
party memberships. Instead, we should set these to 'future'.
We will shortly be importing the new candidate data, in which
lots of these... | <commit_before><commit_msg>Add an admin command to fix party membership position end_dates
This is a fix for issue #550 - some party membership positions
were set to 2012, so they no longer appear as current
party memberships. Instead, we should set these to 'future'.
We will shortly be importing the new candidate d... | |
079df6a4908cb03dc5a6ca9b350ffc81b04bdac4 | smsgateway/factories.py | smsgateway/factories.py | # -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import factory
from smsgateway.models import SMS
class SMSFactory(factory.DjangoModelFactory):
FACTORY_FOR = SMS
content = 'This is a test'
sender = factory.Sequence(lambda n: u"+32476{0:06d}".format(n))
to = factory.Sequence(lambda n:... | Add factory for text messages | Add factory for text messages
| Python | bsd-3-clause | mvpoland/django-smsgateway,mvpoland/django-smsgateway,mvpoland/django-smsgateway | Add factory for text messages | # -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import factory
from smsgateway.models import SMS
class SMSFactory(factory.DjangoModelFactory):
FACTORY_FOR = SMS
content = 'This is a test'
sender = factory.Sequence(lambda n: u"+32476{0:06d}".format(n))
to = factory.Sequence(lambda n:... | <commit_before><commit_msg>Add factory for text messages<commit_after> | # -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import factory
from smsgateway.models import SMS
class SMSFactory(factory.DjangoModelFactory):
FACTORY_FOR = SMS
content = 'This is a test'
sender = factory.Sequence(lambda n: u"+32476{0:06d}".format(n))
to = factory.Sequence(lambda n:... | Add factory for text messages# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import factory
from smsgateway.models import SMS
class SMSFactory(factory.DjangoModelFactory):
FACTORY_FOR = SMS
content = 'This is a test'
sender = factory.Sequence(lambda n: u"+32476{0:06d}".format(n))
to... | <commit_before><commit_msg>Add factory for text messages<commit_after># -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import factory
from smsgateway.models import SMS
class SMSFactory(factory.DjangoModelFactory):
FACTORY_FOR = SMS
content = 'This is a test'
sender = factory.Sequence(lam... | |
8841ed6de25e1b5752ba6bcbd8527820526ccc22 | tests/test_regex.py | tests/test_regex.py | import unittest
import importlib
import sublime
from SublimeLinter.lint.linter import get_linter_settings
from SublimeLinter.tests.parameterized import parameterized as p
LinterModule = importlib.import_module('SublimeLinter-annotations.linter')
Linter = LinterModule.Annotations
class TestRegex(unittest.TestCase)... | Add basic test to prove the concept | Add basic test to prove the concept
| Python | mit | SublimeLinter/SublimeLinter-annotations | Add basic test to prove the concept | import unittest
import importlib
import sublime
from SublimeLinter.lint.linter import get_linter_settings
from SublimeLinter.tests.parameterized import parameterized as p
LinterModule = importlib.import_module('SublimeLinter-annotations.linter')
Linter = LinterModule.Annotations
class TestRegex(unittest.TestCase)... | <commit_before><commit_msg>Add basic test to prove the concept<commit_after> | import unittest
import importlib
import sublime
from SublimeLinter.lint.linter import get_linter_settings
from SublimeLinter.tests.parameterized import parameterized as p
LinterModule = importlib.import_module('SublimeLinter-annotations.linter')
Linter = LinterModule.Annotations
class TestRegex(unittest.TestCase)... | Add basic test to prove the conceptimport unittest
import importlib
import sublime
from SublimeLinter.lint.linter import get_linter_settings
from SublimeLinter.tests.parameterized import parameterized as p
LinterModule = importlib.import_module('SublimeLinter-annotations.linter')
Linter = LinterModule.Annotations
... | <commit_before><commit_msg>Add basic test to prove the concept<commit_after>import unittest
import importlib
import sublime
from SublimeLinter.lint.linter import get_linter_settings
from SublimeLinter.tests.parameterized import parameterized as p
LinterModule = importlib.import_module('SublimeLinter-annotations.lin... | |
82a8e092260d5768babc5d498ac0ddf40c7b3634 | tests/views/test_admin_committee_page.py | tests/views/test_admin_committee_page.py | from tests import PMGLiveServerTestCase
from pmg.models import db
from tests.fixtures import (
dbfixture, UserData, CommitteeData, MembershipData
)
class TestAdminCommitteePage(PMGLiveServerTestCase):
def setUp(self):
super(TestAdminCommitteePage, self).setUp()
self.fx = dbfixture.data(
... | Add admin committee view test | Add admin committee view test
| Python | apache-2.0 | Code4SA/pmg-cms-2,Code4SA/pmg-cms-2,Code4SA/pmg-cms-2 | Add admin committee view test | from tests import PMGLiveServerTestCase
from pmg.models import db
from tests.fixtures import (
dbfixture, UserData, CommitteeData, MembershipData
)
class TestAdminCommitteePage(PMGLiveServerTestCase):
def setUp(self):
super(TestAdminCommitteePage, self).setUp()
self.fx = dbfixture.data(
... | <commit_before><commit_msg>Add admin committee view test<commit_after> | from tests import PMGLiveServerTestCase
from pmg.models import db
from tests.fixtures import (
dbfixture, UserData, CommitteeData, MembershipData
)
class TestAdminCommitteePage(PMGLiveServerTestCase):
def setUp(self):
super(TestAdminCommitteePage, self).setUp()
self.fx = dbfixture.data(
... | Add admin committee view testfrom tests import PMGLiveServerTestCase
from pmg.models import db
from tests.fixtures import (
dbfixture, UserData, CommitteeData, MembershipData
)
class TestAdminCommitteePage(PMGLiveServerTestCase):
def setUp(self):
super(TestAdminCommitteePage, self).setUp()
se... | <commit_before><commit_msg>Add admin committee view test<commit_after>from tests import PMGLiveServerTestCase
from pmg.models import db
from tests.fixtures import (
dbfixture, UserData, CommitteeData, MembershipData
)
class TestAdminCommitteePage(PMGLiveServerTestCase):
def setUp(self):
super(TestAdmi... | |
dfdbfa7f68a80cbf3976ce9c6d7cb8771e038209 | conf_site/proposals/migrations/0008_alter_urlfields.py | conf_site/proposals/migrations/0008_alter_urlfields.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-01-16 21:29
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('proposals', '0007_add_urlfields'),
]
operations = [
migrations.AlterField(
... | Add DB migration for previous URL field changes. | Add DB migration for previous URL field changes.
See #214.
| Python | mit | pydata/conf_site,pydata/conf_site,pydata/conf_site | Add DB migration for previous URL field changes.
See #214. | # -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-01-16 21:29
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('proposals', '0007_add_urlfields'),
]
operations = [
migrations.AlterField(
... | <commit_before><commit_msg>Add DB migration for previous URL field changes.
See #214.<commit_after> | # -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-01-16 21:29
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('proposals', '0007_add_urlfields'),
]
operations = [
migrations.AlterField(
... | Add DB migration for previous URL field changes.
See #214.# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-01-16 21:29
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('proposals', '0007_add_urlfields')... | <commit_before><commit_msg>Add DB migration for previous URL field changes.
See #214.<commit_after># -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-01-16 21:29
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
... | |
6cbeab27628b83a0b075d344f46ad8f9207e335e | ikea-ota-download.py | ikea-ota-download.py | #!/usr/bin/env python
"""
Snipped to dowload current IKEA ZLL OTA files into ~/otau
Requires python 2.7, not compatible with python 3.
"""
import os
import json
import urllib
f = urllib.urlopen("http://fw.ota.homesmart.ikea.net/feed/version_info.json")
data = f.read()
arr = json.loads(data)
otapath = '%s/otau' % os... | Add IKEA OTA download script | Add IKEA OTA download script
| Python | bsd-3-clause | dresden-elektronik/deconz-rest-plugin,dresden-elektronik/deconz-rest-plugin,dresden-elektronik/deconz-rest-plugin,dresden-elektronik/deconz-rest-plugin,dresden-elektronik/deconz-rest-plugin | Add IKEA OTA download script | #!/usr/bin/env python
"""
Snipped to dowload current IKEA ZLL OTA files into ~/otau
Requires python 2.7, not compatible with python 3.
"""
import os
import json
import urllib
f = urllib.urlopen("http://fw.ota.homesmart.ikea.net/feed/version_info.json")
data = f.read()
arr = json.loads(data)
otapath = '%s/otau' % os... | <commit_before><commit_msg>Add IKEA OTA download script<commit_after> | #!/usr/bin/env python
"""
Snipped to dowload current IKEA ZLL OTA files into ~/otau
Requires python 2.7, not compatible with python 3.
"""
import os
import json
import urllib
f = urllib.urlopen("http://fw.ota.homesmart.ikea.net/feed/version_info.json")
data = f.read()
arr = json.loads(data)
otapath = '%s/otau' % os... | Add IKEA OTA download script#!/usr/bin/env python
"""
Snipped to dowload current IKEA ZLL OTA files into ~/otau
Requires python 2.7, not compatible with python 3.
"""
import os
import json
import urllib
f = urllib.urlopen("http://fw.ota.homesmart.ikea.net/feed/version_info.json")
data = f.read()
arr = json.loads(dat... | <commit_before><commit_msg>Add IKEA OTA download script<commit_after>#!/usr/bin/env python
"""
Snipped to dowload current IKEA ZLL OTA files into ~/otau
Requires python 2.7, not compatible with python 3.
"""
import os
import json
import urllib
f = urllib.urlopen("http://fw.ota.homesmart.ikea.net/feed/version_info.jso... | |
52d312ad6bcfd68eb88202ef40574f10788eb70b | leetcode/reverse_string.py | leetcode/reverse_string.py | """
# Problem statement
https://leetcode.com/explore/interview/card/top-interview-questions-easy/127/strings/879/
## Algorithm description
Traverse the given input until the middle of it.
Swap the extremes of the input until reach the middle of it.
Example:
input = "abcde"
len(input) = 5
middle = ceil(5 / 3) = 3
... | Add solution for Reverse String problem | Add solution for Reverse String problem
| Python | mit | julianespinel/training,julianespinel/training,julianespinel/training,julianespinel/trainning,julianespinel/trainning,julianespinel/training | Add solution for Reverse String problem | """
# Problem statement
https://leetcode.com/explore/interview/card/top-interview-questions-easy/127/strings/879/
## Algorithm description
Traverse the given input until the middle of it.
Swap the extremes of the input until reach the middle of it.
Example:
input = "abcde"
len(input) = 5
middle = ceil(5 / 3) = 3
... | <commit_before><commit_msg>Add solution for Reverse String problem<commit_after> | """
# Problem statement
https://leetcode.com/explore/interview/card/top-interview-questions-easy/127/strings/879/
## Algorithm description
Traverse the given input until the middle of it.
Swap the extremes of the input until reach the middle of it.
Example:
input = "abcde"
len(input) = 5
middle = ceil(5 / 3) = 3
... | Add solution for Reverse String problem"""
# Problem statement
https://leetcode.com/explore/interview/card/top-interview-questions-easy/127/strings/879/
## Algorithm description
Traverse the given input until the middle of it.
Swap the extremes of the input until reach the middle of it.
Example:
input = "abcde"
le... | <commit_before><commit_msg>Add solution for Reverse String problem<commit_after>"""
# Problem statement
https://leetcode.com/explore/interview/card/top-interview-questions-easy/127/strings/879/
## Algorithm description
Traverse the given input until the middle of it.
Swap the extremes of the input until reach the mi... | |
093c29e315ca0a1eb5efc3099892ceea016ffde1 | awx/main/management/commands/revoke_tokens.py | awx/main/management/commands/revoke_tokens.py | # Django
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
# AWX
from awx.main.models.oauth import OAuth2AccessToken
from oauth2_provider.models import RefreshToken
def revoke_tokens(token_list):
for ... | Add command to revoke tokens | Add command to revoke tokens
Signed-off-by: Cristian Vargas <[email protected]>
| Python | apache-2.0 | wwitzel3/awx,wwitzel3/awx,wwitzel3/awx,wwitzel3/awx | Add command to revoke tokens
Signed-off-by: Cristian Vargas <[email protected]> | # Django
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
# AWX
from awx.main.models.oauth import OAuth2AccessToken
from oauth2_provider.models import RefreshToken
def revoke_tokens(token_list):
for ... | <commit_before><commit_msg>Add command to revoke tokens
Signed-off-by: Cristian Vargas <[email protected]><commit_after> | # Django
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
# AWX
from awx.main.models.oauth import OAuth2AccessToken
from oauth2_provider.models import RefreshToken
def revoke_tokens(token_list):
for ... | Add command to revoke tokens
Signed-off-by: Cristian Vargas <[email protected]># Django
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
# AWX
from awx.main.models.oauth ... | <commit_before><commit_msg>Add command to revoke tokens
Signed-off-by: Cristian Vargas <[email protected]><commit_after># Django
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNo... | |
2af5a573196d409cb70b58fe828de9515dc4088a | bin/fetch_mcgill_transcript.py | bin/fetch_mcgill_transcript.py | #!/usr/bin/env python
import argparse
import getpass
import sys
import StringIO
import mcgill
def parse_args():
parser = argparse.ArgumentParser(
description='fetch McGill transcript',
formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument('-a', '--auth', help='''email:password or... | Add a quick script to dump transcript to stdout. | Add a quick script to dump transcript to stdout.
| Python | mit | isbadawi/minerva | Add a quick script to dump transcript to stdout. | #!/usr/bin/env python
import argparse
import getpass
import sys
import StringIO
import mcgill
def parse_args():
parser = argparse.ArgumentParser(
description='fetch McGill transcript',
formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument('-a', '--auth', help='''email:password or... | <commit_before><commit_msg>Add a quick script to dump transcript to stdout.<commit_after> | #!/usr/bin/env python
import argparse
import getpass
import sys
import StringIO
import mcgill
def parse_args():
parser = argparse.ArgumentParser(
description='fetch McGill transcript',
formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument('-a', '--auth', help='''email:password or... | Add a quick script to dump transcript to stdout.#!/usr/bin/env python
import argparse
import getpass
import sys
import StringIO
import mcgill
def parse_args():
parser = argparse.ArgumentParser(
description='fetch McGill transcript',
formatter_class=argparse.RawTextHelpFormatter)
parser.add_ar... | <commit_before><commit_msg>Add a quick script to dump transcript to stdout.<commit_after>#!/usr/bin/env python
import argparse
import getpass
import sys
import StringIO
import mcgill
def parse_args():
parser = argparse.ArgumentParser(
description='fetch McGill transcript',
formatter_class=argpars... | |
d470e524e534a7a0d0b217a12777d6e18c45eb78 | nurseconnect/formfields.py | nurseconnect/formfields.py | from django.core.exceptions import ValidationError
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from phonenumber_field.formfields import PhoneNumberField as ImportedPhoneNumberField
from phonenumber_field.phonenumber import to_python
def validate_international_... | Add custom PhoneNumberField for use in NurseConnect | Add custom PhoneNumberField for use in NurseConnect
| Python | bsd-2-clause | praekelt/nurseconnect,praekelt/nurseconnect,praekelt/nurseconnect | Add custom PhoneNumberField for use in NurseConnect | from django.core.exceptions import ValidationError
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from phonenumber_field.formfields import PhoneNumberField as ImportedPhoneNumberField
from phonenumber_field.phonenumber import to_python
def validate_international_... | <commit_before><commit_msg>Add custom PhoneNumberField for use in NurseConnect<commit_after> | from django.core.exceptions import ValidationError
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from phonenumber_field.formfields import PhoneNumberField as ImportedPhoneNumberField
from phonenumber_field.phonenumber import to_python
def validate_international_... | Add custom PhoneNumberField for use in NurseConnectfrom django.core.exceptions import ValidationError
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from phonenumber_field.formfields import PhoneNumberField as ImportedPhoneNumberField
from phonenumber_field.phonenu... | <commit_before><commit_msg>Add custom PhoneNumberField for use in NurseConnect<commit_after>from django.core.exceptions import ValidationError
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from phonenumber_field.formfields import PhoneNumberField as ImportedPhoneN... | |
c9f397162c131455ca2f8b63ab7ede126529c053 | 005.py | 005.py | """
Project Euler Problem 5
=======================
2520 is the smallest number that can be divided by each of the numbers
from 1 to 10 without any remainder.
What is the smallest number that is evenly divisible by all of the numbers
from 1 to 20?
"""
from functools import reduce
from math import gcd
def divisible... | Add solution and unit tests for problem 5 | Add solution and unit tests for problem 5
| Python | mit | BeataBak/project-euler-problems | Add solution and unit tests for problem 5 | """
Project Euler Problem 5
=======================
2520 is the smallest number that can be divided by each of the numbers
from 1 to 10 without any remainder.
What is the smallest number that is evenly divisible by all of the numbers
from 1 to 20?
"""
from functools import reduce
from math import gcd
def divisible... | <commit_before><commit_msg>Add solution and unit tests for problem 5<commit_after> | """
Project Euler Problem 5
=======================
2520 is the smallest number that can be divided by each of the numbers
from 1 to 10 without any remainder.
What is the smallest number that is evenly divisible by all of the numbers
from 1 to 20?
"""
from functools import reduce
from math import gcd
def divisible... | Add solution and unit tests for problem 5"""
Project Euler Problem 5
=======================
2520 is the smallest number that can be divided by each of the numbers
from 1 to 10 without any remainder.
What is the smallest number that is evenly divisible by all of the numbers
from 1 to 20?
"""
from functools import re... | <commit_before><commit_msg>Add solution and unit tests for problem 5<commit_after>"""
Project Euler Problem 5
=======================
2520 is the smallest number that can be divided by each of the numbers
from 1 to 10 without any remainder.
What is the smallest number that is evenly divisible by all of the numbers
fr... | |
e2d7b446cc290cda01709636e964f850cbef0532 | 17B-162/HI/analysis/convolve_and_match_iram30m.py | 17B-162/HI/analysis/convolve_and_match_iram30m.py |
'''
Create a cube that is spatially-matched and convolved to the IRAM 30-m
CO(2-1) cube.
'''
import os
from os.path import join as osjoin
from cube_analysis.reprojection import reproject_cube
from cube_analysis.run_pipe import run_pipeline
from paths import (seventeenB_HI_data_1kms_wGBT_path,
sev... | Make a 17B HI cube matched to the 30-m IRAM cube | Make a 17B HI cube matched to the 30-m IRAM cube
| Python | mit | e-koch/VLA_Lband,e-koch/VLA_Lband | Make a 17B HI cube matched to the 30-m IRAM cube |
'''
Create a cube that is spatially-matched and convolved to the IRAM 30-m
CO(2-1) cube.
'''
import os
from os.path import join as osjoin
from cube_analysis.reprojection import reproject_cube
from cube_analysis.run_pipe import run_pipeline
from paths import (seventeenB_HI_data_1kms_wGBT_path,
sev... | <commit_before><commit_msg>Make a 17B HI cube matched to the 30-m IRAM cube<commit_after> |
'''
Create a cube that is spatially-matched and convolved to the IRAM 30-m
CO(2-1) cube.
'''
import os
from os.path import join as osjoin
from cube_analysis.reprojection import reproject_cube
from cube_analysis.run_pipe import run_pipeline
from paths import (seventeenB_HI_data_1kms_wGBT_path,
sev... | Make a 17B HI cube matched to the 30-m IRAM cube
'''
Create a cube that is spatially-matched and convolved to the IRAM 30-m
CO(2-1) cube.
'''
import os
from os.path import join as osjoin
from cube_analysis.reprojection import reproject_cube
from cube_analysis.run_pipe import run_pipeline
from paths import (seventeen... | <commit_before><commit_msg>Make a 17B HI cube matched to the 30-m IRAM cube<commit_after>
'''
Create a cube that is spatially-matched and convolved to the IRAM 30-m
CO(2-1) cube.
'''
import os
from os.path import join as osjoin
from cube_analysis.reprojection import reproject_cube
from cube_analysis.run_pipe import r... | |
126893b50e5d72998398dd1c3687fbf102e6b441 | app/feed.py | app/feed.py | #!/usr/bin/python
# Documentation: http://api.mongodb.org/python/
# A python script connecting to a MongoDB given a MongoDB Connection URI.
import sys
import pymongo
import os
### Create seed data
SEED_DATA = [
{
'decade': '1970s',
'artist': 'Debby Boone',
'song': 'You Light Up My Life',... | Set up mongodb addon to heroku app; created a test python script to connect to db | Set up mongodb addon to heroku app; created a test python script to connect to db
| Python | mit | hw3jung/Gucci,hw3jung/Gucci | Set up mongodb addon to heroku app; created a test python script to connect to db | #!/usr/bin/python
# Documentation: http://api.mongodb.org/python/
# A python script connecting to a MongoDB given a MongoDB Connection URI.
import sys
import pymongo
import os
### Create seed data
SEED_DATA = [
{
'decade': '1970s',
'artist': 'Debby Boone',
'song': 'You Light Up My Life',... | <commit_before><commit_msg>Set up mongodb addon to heroku app; created a test python script to connect to db<commit_after> | #!/usr/bin/python
# Documentation: http://api.mongodb.org/python/
# A python script connecting to a MongoDB given a MongoDB Connection URI.
import sys
import pymongo
import os
### Create seed data
SEED_DATA = [
{
'decade': '1970s',
'artist': 'Debby Boone',
'song': 'You Light Up My Life',... | Set up mongodb addon to heroku app; created a test python script to connect to db#!/usr/bin/python
# Documentation: http://api.mongodb.org/python/
# A python script connecting to a MongoDB given a MongoDB Connection URI.
import sys
import pymongo
import os
### Create seed data
SEED_DATA = [
{
'decade': ... | <commit_before><commit_msg>Set up mongodb addon to heroku app; created a test python script to connect to db<commit_after>#!/usr/bin/python
# Documentation: http://api.mongodb.org/python/
# A python script connecting to a MongoDB given a MongoDB Connection URI.
import sys
import pymongo
import os
### Create seed dat... | |
905f46ffba7f008a6f290cd5db9060ba62e6d576 | test/test_bezier_direct.py | test/test_bezier_direct.py | from __future__ import division
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
import cocos
from cocos.director import director
from cocos.actions import Bezier
from cocos.sprite import Sprite
import pyglet
from cocos import path
def direct_bezier(p0, p1, p2, p3):
'''G... | Test using bezier going through 4 specific points | Test using bezier going through 4 specific points
| Python | bsd-3-clause | google-code-export/los-cocos,google-code-export/los-cocos | Test using bezier going through 4 specific points | from __future__ import division
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
import cocos
from cocos.director import director
from cocos.actions import Bezier
from cocos.sprite import Sprite
import pyglet
from cocos import path
def direct_bezier(p0, p1, p2, p3):
'''G... | <commit_before><commit_msg>Test using bezier going through 4 specific points<commit_after> | from __future__ import division
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
import cocos
from cocos.director import director
from cocos.actions import Bezier
from cocos.sprite import Sprite
import pyglet
from cocos import path
def direct_bezier(p0, p1, p2, p3):
'''G... | Test using bezier going through 4 specific pointsfrom __future__ import division
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
import cocos
from cocos.director import director
from cocos.actions import Bezier
from cocos.sprite import Sprite
import pyglet
from cocos import ... | <commit_before><commit_msg>Test using bezier going through 4 specific points<commit_after>from __future__ import division
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
import cocos
from cocos.director import director
from cocos.actions import Bezier
from cocos.sprite import... | |
470b7313fa9b176fa4492ac9f355acd21542265d | tests/test_lib_fallback.py | tests/test_lib_fallback.py | from mock import patch
from pytest import raises
from tvrenamr.errors import NoMoreLibrariesException
from tvrenamr.main import Episode
from .base import BaseTest
from .mock_requests import initially_bad_xml, invalid_xml
class TestLibrariesFallback(BaseTest):
@patch('tvrenamr.libraries.requests.get', new=invali... | from mock import patch
from pytest import raises
from tvrenamr.errors import NoMoreLibrariesException
from tvrenamr.libraries import TheTvDb, TvRage
from tvrenamr.main import Episode
from .base import BaseTest
from .mock_requests import initially_bad_xml, invalid_xml
class TestLibrariesFallback(BaseTest):
@patc... | Test library fallback is overridden by setting a library | Test library fallback is overridden by setting a library
| Python | mit | wintersandroid/tvrenamr,ghickman/tvrenamr | from mock import patch
from pytest import raises
from tvrenamr.errors import NoMoreLibrariesException
from tvrenamr.main import Episode
from .base import BaseTest
from .mock_requests import initially_bad_xml, invalid_xml
class TestLibrariesFallback(BaseTest):
@patch('tvrenamr.libraries.requests.get', new=invali... | from mock import patch
from pytest import raises
from tvrenamr.errors import NoMoreLibrariesException
from tvrenamr.libraries import TheTvDb, TvRage
from tvrenamr.main import Episode
from .base import BaseTest
from .mock_requests import initially_bad_xml, invalid_xml
class TestLibrariesFallback(BaseTest):
@patc... | <commit_before>from mock import patch
from pytest import raises
from tvrenamr.errors import NoMoreLibrariesException
from tvrenamr.main import Episode
from .base import BaseTest
from .mock_requests import initially_bad_xml, invalid_xml
class TestLibrariesFallback(BaseTest):
@patch('tvrenamr.libraries.requests.g... | from mock import patch
from pytest import raises
from tvrenamr.errors import NoMoreLibrariesException
from tvrenamr.libraries import TheTvDb, TvRage
from tvrenamr.main import Episode
from .base import BaseTest
from .mock_requests import initially_bad_xml, invalid_xml
class TestLibrariesFallback(BaseTest):
@patc... | from mock import patch
from pytest import raises
from tvrenamr.errors import NoMoreLibrariesException
from tvrenamr.main import Episode
from .base import BaseTest
from .mock_requests import initially_bad_xml, invalid_xml
class TestLibrariesFallback(BaseTest):
@patch('tvrenamr.libraries.requests.get', new=invali... | <commit_before>from mock import patch
from pytest import raises
from tvrenamr.errors import NoMoreLibrariesException
from tvrenamr.main import Episode
from .base import BaseTest
from .mock_requests import initially_bad_xml, invalid_xml
class TestLibrariesFallback(BaseTest):
@patch('tvrenamr.libraries.requests.g... |
c41627f6eef6647a2b80e79b7cee860c4455daeb | utils/apply-fixit-edits.py | utils/apply-fixit-edits.py | #!/usr/bin/env python
#===--- apply-fixit-edits.py - Tool for applying edits from .remap files ---===#
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See htt... | Add a script for picking up all .remap files in a directory and applying the edits therein. | [utils] Add a script for picking up all .remap files in a directory and applying the edits therein.
Swift SVN r31773
| Python | apache-2.0 | deyton/swift,ahoppen/swift,IngmarStein/swift,MukeshKumarS/Swift,johnno1962d/swift,shajrawi/swift,harlanhaskins/swift,gmilos/swift,calebd/swift,austinzheng/swift,arvedviehweger/swift,lorentey/swift,sschiau/swift,codestergit/swift,kperryua/swift,jtbandes/swift,uasys/swift,OscarSwanros/swift,parkera/swift,xedin/swift,jtba... | [utils] Add a script for picking up all .remap files in a directory and applying the edits therein.
Swift SVN r31773 | #!/usr/bin/env python
#===--- apply-fixit-edits.py - Tool for applying edits from .remap files ---===#
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See htt... | <commit_before><commit_msg>[utils] Add a script for picking up all .remap files in a directory and applying the edits therein.
Swift SVN r31773<commit_after> | #!/usr/bin/env python
#===--- apply-fixit-edits.py - Tool for applying edits from .remap files ---===#
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See htt... | [utils] Add a script for picking up all .remap files in a directory and applying the edits therein.
Swift SVN r31773#!/usr/bin/env python
#===--- apply-fixit-edits.py - Tool for applying edits from .remap files ---===#
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2015 App... | <commit_before><commit_msg>[utils] Add a script for picking up all .remap files in a directory and applying the edits therein.
Swift SVN r31773<commit_after>#!/usr/bin/env python
#===--- apply-fixit-edits.py - Tool for applying edits from .remap files ---===#
#
# This source file is part of the Swift.org open source ... | |
56ce529d115acfa9d7ae7d1cba574c26f68cb955 | py/diameter-of-binary-tree.py | py/diameter-of-binary-tree.py | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def dfs(self, cur):
if cur:
ldepth = self.dfs(cur.left)
rdepth = self.dfs(cur.right)
... | Add py solution for 543. Diameter of Binary Tree | Add py solution for 543. Diameter of Binary Tree
543. Diameter of Binary Tree: https://leetcode.com/problems/diameter-of-binary-tree/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | Add py solution for 543. Diameter of Binary Tree
543. Diameter of Binary Tree: https://leetcode.com/problems/diameter-of-binary-tree/ | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def dfs(self, cur):
if cur:
ldepth = self.dfs(cur.left)
rdepth = self.dfs(cur.right)
... | <commit_before><commit_msg>Add py solution for 543. Diameter of Binary Tree
543. Diameter of Binary Tree: https://leetcode.com/problems/diameter-of-binary-tree/<commit_after> | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def dfs(self, cur):
if cur:
ldepth = self.dfs(cur.left)
rdepth = self.dfs(cur.right)
... | Add py solution for 543. Diameter of Binary Tree
543. Diameter of Binary Tree: https://leetcode.com/problems/diameter-of-binary-tree/# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(... | <commit_before><commit_msg>Add py solution for 543. Diameter of Binary Tree
543. Diameter of Binary Tree: https://leetcode.com/problems/diameter-of-binary-tree/<commit_after># Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# ... | |
f01ce359618e66163f280eb386d70e1350addbc6 | py/top-k-frequent-elements.py | py/top-k-frequent-elements.py | import heapq
from operator import itemgetter
from collections import Counter
class Solution(object):
def topKFrequent(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: List[int]
"""
c = Counter(nums)
return map(itemgetter(1), heapq.nlargest(k, [(c... | Add py solution for 347. Top K Frequent Elements | Add py solution for 347. Top K Frequent Elements
347. Top K Frequent Elements: https://leetcode.com/problems/top-k-frequent-elements/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | Add py solution for 347. Top K Frequent Elements
347. Top K Frequent Elements: https://leetcode.com/problems/top-k-frequent-elements/ | import heapq
from operator import itemgetter
from collections import Counter
class Solution(object):
def topKFrequent(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: List[int]
"""
c = Counter(nums)
return map(itemgetter(1), heapq.nlargest(k, [(c... | <commit_before><commit_msg>Add py solution for 347. Top K Frequent Elements
347. Top K Frequent Elements: https://leetcode.com/problems/top-k-frequent-elements/<commit_after> | import heapq
from operator import itemgetter
from collections import Counter
class Solution(object):
def topKFrequent(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: List[int]
"""
c = Counter(nums)
return map(itemgetter(1), heapq.nlargest(k, [(c... | Add py solution for 347. Top K Frequent Elements
347. Top K Frequent Elements: https://leetcode.com/problems/top-k-frequent-elements/import heapq
from operator import itemgetter
from collections import Counter
class Solution(object):
def topKFrequent(self, nums, k):
"""
:type nums: List[int]
... | <commit_before><commit_msg>Add py solution for 347. Top K Frequent Elements
347. Top K Frequent Elements: https://leetcode.com/problems/top-k-frequent-elements/<commit_after>import heapq
from operator import itemgetter
from collections import Counter
class Solution(object):
def topKFrequent(self, nums, k):
... | |
eb84efd25b8c5e9ba06434ad78c9611b3f8350f0 | every_election/apps/elections/management/commands/add_tags.py | every_election/apps/elections/management/commands/add_tags.py | import json
from django.contrib.gis.gdal import DataSource
from django.core.management import BaseCommand
from django.db.models import Value
from core.mixins import ReadFromFileMixin
from core.models import JsonbSet
from elections.models import Election
def get_layer(data, layer_index=0):
data_source = DataSour... | Add command to add tags to Election model | Add command to add tags to Election model
| Python | bsd-3-clause | DemocracyClub/EveryElection,DemocracyClub/EveryElection,DemocracyClub/EveryElection | Add command to add tags to Election model | import json
from django.contrib.gis.gdal import DataSource
from django.core.management import BaseCommand
from django.db.models import Value
from core.mixins import ReadFromFileMixin
from core.models import JsonbSet
from elections.models import Election
def get_layer(data, layer_index=0):
data_source = DataSour... | <commit_before><commit_msg>Add command to add tags to Election model<commit_after> | import json
from django.contrib.gis.gdal import DataSource
from django.core.management import BaseCommand
from django.db.models import Value
from core.mixins import ReadFromFileMixin
from core.models import JsonbSet
from elections.models import Election
def get_layer(data, layer_index=0):
data_source = DataSour... | Add command to add tags to Election modelimport json
from django.contrib.gis.gdal import DataSource
from django.core.management import BaseCommand
from django.db.models import Value
from core.mixins import ReadFromFileMixin
from core.models import JsonbSet
from elections.models import Election
def get_layer(data, l... | <commit_before><commit_msg>Add command to add tags to Election model<commit_after>import json
from django.contrib.gis.gdal import DataSource
from django.core.management import BaseCommand
from django.db.models import Value
from core.mixins import ReadFromFileMixin
from core.models import JsonbSet
from elections.model... | |
cac06b93f257afa2760180074a978cffdc05c8c2 | examples/kiwilist.py | examples/kiwilist.py | import gtk
from kiwi.ui.widgets.list import Column, List, SequentialColumn
class Person:
"""The parameters need to be of the same name of the column headers"""
def __init__(self, name, age, city, present):
(self.name, self.age,
self.city, self.present) = name, age, city, present
def __re... | Add a small kiwi list example | Add a small kiwi list example | Python | lgpl-2.1 | stoq/kiwi | Add a small kiwi list example | import gtk
from kiwi.ui.widgets.list import Column, List, SequentialColumn
class Person:
"""The parameters need to be of the same name of the column headers"""
def __init__(self, name, age, city, present):
(self.name, self.age,
self.city, self.present) = name, age, city, present
def __re... | <commit_before><commit_msg>Add a small kiwi list example<commit_after> | import gtk
from kiwi.ui.widgets.list import Column, List, SequentialColumn
class Person:
"""The parameters need to be of the same name of the column headers"""
def __init__(self, name, age, city, present):
(self.name, self.age,
self.city, self.present) = name, age, city, present
def __re... | Add a small kiwi list exampleimport gtk
from kiwi.ui.widgets.list import Column, List, SequentialColumn
class Person:
"""The parameters need to be of the same name of the column headers"""
def __init__(self, name, age, city, present):
(self.name, self.age,
self.city, self.present) = name, age... | <commit_before><commit_msg>Add a small kiwi list example<commit_after>import gtk
from kiwi.ui.widgets.list import Column, List, SequentialColumn
class Person:
"""The parameters need to be of the same name of the column headers"""
def __init__(self, name, age, city, present):
(self.name, self.age,
... | |
dae41df9835a83a71b71b5e4b64561761c404bf5 | mp3-formatter/url_scrape_div.py | mp3-formatter/url_scrape_div.py | #!/usr/bin/python3
# sudo apt-get install python3-pip
# pip3 install requests
import lxml.html
import requests
import sys
def validate_url(url):
if not url:
raise SystemError("validate_url() was given an empty URL")
protocol = "http://"
protocol_error_message = ValueError("A URL beginning with "... | Add script to scrape tracklist from URL | MP3: Add script to scrape tracklist from URL
I didn't do this in separate commits because I had such a rough time
extracting the div I needed from the page.
| Python | mit | jleung51/scripts,jleung51/scripts,jleung51/scripts | MP3: Add script to scrape tracklist from URL
I didn't do this in separate commits because I had such a rough time
extracting the div I needed from the page. | #!/usr/bin/python3
# sudo apt-get install python3-pip
# pip3 install requests
import lxml.html
import requests
import sys
def validate_url(url):
if not url:
raise SystemError("validate_url() was given an empty URL")
protocol = "http://"
protocol_error_message = ValueError("A URL beginning with "... | <commit_before><commit_msg>MP3: Add script to scrape tracklist from URL
I didn't do this in separate commits because I had such a rough time
extracting the div I needed from the page.<commit_after> | #!/usr/bin/python3
# sudo apt-get install python3-pip
# pip3 install requests
import lxml.html
import requests
import sys
def validate_url(url):
if not url:
raise SystemError("validate_url() was given an empty URL")
protocol = "http://"
protocol_error_message = ValueError("A URL beginning with "... | MP3: Add script to scrape tracklist from URL
I didn't do this in separate commits because I had such a rough time
extracting the div I needed from the page.#!/usr/bin/python3
# sudo apt-get install python3-pip
# pip3 install requests
import lxml.html
import requests
import sys
def validate_url(url):
if not url:... | <commit_before><commit_msg>MP3: Add script to scrape tracklist from URL
I didn't do this in separate commits because I had such a rough time
extracting the div I needed from the page.<commit_after>#!/usr/bin/python3
# sudo apt-get install python3-pip
# pip3 install requests
import lxml.html
import requests
import sy... | |
25fb55ed7d90834d36f0f536f4324facbb5db710 | examples/play_tvz.py | examples/play_tvz.py | import sc2
from sc2 import Race
from sc2.player import Human, Bot
from zerg_rush import ZergRushBot
def main():
sc2.run_game(sc2.maps.get("Abyssal Reef LE"), [
Human(Race.Terran),
Bot(Race.Zerg, ZergRushBot())
], realtime=True)
if __name__ == '__main__':
main()
| Add TvZ Human vs AI example | Add TvZ Human vs AI example
| Python | mit | Dentosal/python-sc2 | Add TvZ Human vs AI example | import sc2
from sc2 import Race
from sc2.player import Human, Bot
from zerg_rush import ZergRushBot
def main():
sc2.run_game(sc2.maps.get("Abyssal Reef LE"), [
Human(Race.Terran),
Bot(Race.Zerg, ZergRushBot())
], realtime=True)
if __name__ == '__main__':
main()
| <commit_before><commit_msg>Add TvZ Human vs AI example<commit_after> | import sc2
from sc2 import Race
from sc2.player import Human, Bot
from zerg_rush import ZergRushBot
def main():
sc2.run_game(sc2.maps.get("Abyssal Reef LE"), [
Human(Race.Terran),
Bot(Race.Zerg, ZergRushBot())
], realtime=True)
if __name__ == '__main__':
main()
| Add TvZ Human vs AI exampleimport sc2
from sc2 import Race
from sc2.player import Human, Bot
from zerg_rush import ZergRushBot
def main():
sc2.run_game(sc2.maps.get("Abyssal Reef LE"), [
Human(Race.Terran),
Bot(Race.Zerg, ZergRushBot())
], realtime=True)
if __name__ == '__main__':
main()
| <commit_before><commit_msg>Add TvZ Human vs AI example<commit_after>import sc2
from sc2 import Race
from sc2.player import Human, Bot
from zerg_rush import ZergRushBot
def main():
sc2.run_game(sc2.maps.get("Abyssal Reef LE"), [
Human(Race.Terran),
Bot(Race.Zerg, ZergRushBot())
], realtime=True... | |
b0b4cb81874f4e7d347baaf292b58dad1af6bbb3 | perftest.py | perftest.py | """
Simple peformance tests.
"""
import sys
import time
import couchdb
def main():
print 'sys.version : %r' % (sys.version,)
print 'sys.platform : %r' % (sys.platform,)
tests = [create_doc, create_bulk_docs]
if len(sys.argv) > 1:
tests = [test for test in tests if test.__name__ in sys.argv... | Add a very simple performance testing tool. | Add a very simple performance testing tool.
| Python | bsd-3-clause | erikdejonge/rabshakeh-couchdb-python-progress-attachments | Add a very simple performance testing tool. | """
Simple peformance tests.
"""
import sys
import time
import couchdb
def main():
print 'sys.version : %r' % (sys.version,)
print 'sys.platform : %r' % (sys.platform,)
tests = [create_doc, create_bulk_docs]
if len(sys.argv) > 1:
tests = [test for test in tests if test.__name__ in sys.argv... | <commit_before><commit_msg>Add a very simple performance testing tool.<commit_after> | """
Simple peformance tests.
"""
import sys
import time
import couchdb
def main():
print 'sys.version : %r' % (sys.version,)
print 'sys.platform : %r' % (sys.platform,)
tests = [create_doc, create_bulk_docs]
if len(sys.argv) > 1:
tests = [test for test in tests if test.__name__ in sys.argv... | Add a very simple performance testing tool."""
Simple peformance tests.
"""
import sys
import time
import couchdb
def main():
print 'sys.version : %r' % (sys.version,)
print 'sys.platform : %r' % (sys.platform,)
tests = [create_doc, create_bulk_docs]
if len(sys.argv) > 1:
tests = [test for... | <commit_before><commit_msg>Add a very simple performance testing tool.<commit_after>"""
Simple peformance tests.
"""
import sys
import time
import couchdb
def main():
print 'sys.version : %r' % (sys.version,)
print 'sys.platform : %r' % (sys.platform,)
tests = [create_doc, create_bulk_docs]
if len... | |
3c9fc8bbdbbcbca148a3b00c22a0e5fdaa9108aa | perftest.py | perftest.py | """
Simple peformance tests.
"""
import sys
import time
import couchdb
def main():
print 'sys.version : %r' % (sys.version,)
print 'sys.platform : %r' % (sys.platform,)
tests = [create_doc, create_bulk_docs]
if len(sys.argv) > 1:
tests = [test for test in tests if test.__name__ in sys.argv... | Add a very simple performance testing tool. | Add a very simple performance testing tool.
| Python | bsd-3-clause | gcarranza/couchdb-python,jur9526/couchdb-python | Add a very simple performance testing tool. | """
Simple peformance tests.
"""
import sys
import time
import couchdb
def main():
print 'sys.version : %r' % (sys.version,)
print 'sys.platform : %r' % (sys.platform,)
tests = [create_doc, create_bulk_docs]
if len(sys.argv) > 1:
tests = [test for test in tests if test.__name__ in sys.argv... | <commit_before><commit_msg>Add a very simple performance testing tool.<commit_after> | """
Simple peformance tests.
"""
import sys
import time
import couchdb
def main():
print 'sys.version : %r' % (sys.version,)
print 'sys.platform : %r' % (sys.platform,)
tests = [create_doc, create_bulk_docs]
if len(sys.argv) > 1:
tests = [test for test in tests if test.__name__ in sys.argv... | Add a very simple performance testing tool."""
Simple peformance tests.
"""
import sys
import time
import couchdb
def main():
print 'sys.version : %r' % (sys.version,)
print 'sys.platform : %r' % (sys.platform,)
tests = [create_doc, create_bulk_docs]
if len(sys.argv) > 1:
tests = [test for... | <commit_before><commit_msg>Add a very simple performance testing tool.<commit_after>"""
Simple peformance tests.
"""
import sys
import time
import couchdb
def main():
print 'sys.version : %r' % (sys.version,)
print 'sys.platform : %r' % (sys.platform,)
tests = [create_doc, create_bulk_docs]
if len... | |
216c9e937263838f126474a0728ed9d43797c3e5 | modify_wpr_delays.py | modify_wpr_delays.py | #!/usr/bin/env python
# TODO(cs): make cache hit ratio tunable.
# TODO(cs): two analyses: perfect cachability at proxy, and perfect
# cachability in browser. Use CC: private vs. CC: public to make distinction.
# TODO(cs): don't assume that cache is co-located with browser, i.e. insert
# delays between browser and perf... | Add a script for fingind cacheable responses and setting their delays to 0 | Add a script for fingind cacheable responses and setting their delays to 0
| Python | apache-2.0 | colin-scott/web-page-replay,colin-scott/web-page-replay | Add a script for fingind cacheable responses and setting their delays to 0 | #!/usr/bin/env python
# TODO(cs): make cache hit ratio tunable.
# TODO(cs): two analyses: perfect cachability at proxy, and perfect
# cachability in browser. Use CC: private vs. CC: public to make distinction.
# TODO(cs): don't assume that cache is co-located with browser, i.e. insert
# delays between browser and perf... | <commit_before><commit_msg>Add a script for fingind cacheable responses and setting their delays to 0<commit_after> | #!/usr/bin/env python
# TODO(cs): make cache hit ratio tunable.
# TODO(cs): two analyses: perfect cachability at proxy, and perfect
# cachability in browser. Use CC: private vs. CC: public to make distinction.
# TODO(cs): don't assume that cache is co-located with browser, i.e. insert
# delays between browser and perf... | Add a script for fingind cacheable responses and setting their delays to 0#!/usr/bin/env python
# TODO(cs): make cache hit ratio tunable.
# TODO(cs): two analyses: perfect cachability at proxy, and perfect
# cachability in browser. Use CC: private vs. CC: public to make distinction.
# TODO(cs): don't assume that cache... | <commit_before><commit_msg>Add a script for fingind cacheable responses and setting their delays to 0<commit_after>#!/usr/bin/env python
# TODO(cs): make cache hit ratio tunable.
# TODO(cs): two analyses: perfect cachability at proxy, and perfect
# cachability in browser. Use CC: private vs. CC: public to make distinc... | |
7fea10691b8f8d15e31c30949d15a69e20ee4214 | scripts/identify-unpinned.py | scripts/identify-unpinned.py | import yaml
import glob
for file in glob.glob("*.yaml"):
print("Processing %s" % file)
with open(file, 'r') as handle:
w = yaml.load(handle)
for tool in w['tools']:
print(tool)
if 'changeset_revision' not in tool:
print(tool)
for file in glob.glob("*.yml"):
print("P... | Add script to identify unpinned repos | Add script to identify unpinned repos
| Python | mit | usegalaxy-eu/usegalaxy-eu-tools,usegalaxy-eu/usegalaxy-eu-tools | Add script to identify unpinned repos | import yaml
import glob
for file in glob.glob("*.yaml"):
print("Processing %s" % file)
with open(file, 'r') as handle:
w = yaml.load(handle)
for tool in w['tools']:
print(tool)
if 'changeset_revision' not in tool:
print(tool)
for file in glob.glob("*.yml"):
print("P... | <commit_before><commit_msg>Add script to identify unpinned repos<commit_after> | import yaml
import glob
for file in glob.glob("*.yaml"):
print("Processing %s" % file)
with open(file, 'r') as handle:
w = yaml.load(handle)
for tool in w['tools']:
print(tool)
if 'changeset_revision' not in tool:
print(tool)
for file in glob.glob("*.yml"):
print("P... | Add script to identify unpinned reposimport yaml
import glob
for file in glob.glob("*.yaml"):
print("Processing %s" % file)
with open(file, 'r') as handle:
w = yaml.load(handle)
for tool in w['tools']:
print(tool)
if 'changeset_revision' not in tool:
print(tool)
for fil... | <commit_before><commit_msg>Add script to identify unpinned repos<commit_after>import yaml
import glob
for file in glob.glob("*.yaml"):
print("Processing %s" % file)
with open(file, 'r') as handle:
w = yaml.load(handle)
for tool in w['tools']:
print(tool)
if 'changeset_revision' not ... | |
cd27adc357655e9cd25c5d23a171920addd7c8f5 | jupyter_notebook_config.py | jupyter_notebook_config.py | # Based off of https://github.com/jupyter/notebook/blob/master/docs/source/extending/savehooks.rst
import io
import os
from notebook.utils import to_api_path
_script_exporter = None
_html_exporter = None
def script_post_save(model, os_path, contents_manager, **kwargs):
"""convert notebooks to Python script after... | Add script to automatically save py file in jupyter. | Add script to automatically save py file in jupyter.
| Python | bsd-3-clause | daichi-yoshikawa/dnn | Add script to automatically save py file in jupyter. | # Based off of https://github.com/jupyter/notebook/blob/master/docs/source/extending/savehooks.rst
import io
import os
from notebook.utils import to_api_path
_script_exporter = None
_html_exporter = None
def script_post_save(model, os_path, contents_manager, **kwargs):
"""convert notebooks to Python script after... | <commit_before><commit_msg>Add script to automatically save py file in jupyter.<commit_after> | # Based off of https://github.com/jupyter/notebook/blob/master/docs/source/extending/savehooks.rst
import io
import os
from notebook.utils import to_api_path
_script_exporter = None
_html_exporter = None
def script_post_save(model, os_path, contents_manager, **kwargs):
"""convert notebooks to Python script after... | Add script to automatically save py file in jupyter.# Based off of https://github.com/jupyter/notebook/blob/master/docs/source/extending/savehooks.rst
import io
import os
from notebook.utils import to_api_path
_script_exporter = None
_html_exporter = None
def script_post_save(model, os_path, contents_manager, **kwar... | <commit_before><commit_msg>Add script to automatically save py file in jupyter.<commit_after># Based off of https://github.com/jupyter/notebook/blob/master/docs/source/extending/savehooks.rst
import io
import os
from notebook.utils import to_api_path
_script_exporter = None
_html_exporter = None
def script_post_save... | |
08e7dd7f9e1ee8d9ec57f2ec7b6a68caee1c8f0d | py/number-of-boomerangs.py | py/number-of-boomerangs.py | from collections import Counter
class Solution(object):
def numberOfBoomerangs(self, points):
"""
:type points: List[List[int]]
:rtype: int
"""
cs = [Counter() for _ in xrange(len(points))]
for i1, p1 in enumerate(points):
for i2 in range(i1 + 1, len(point... | Add py solution for 447. Number of Boomerangs | Add py solution for 447. Number of Boomerangs
447. Number of Boomerangs: https://leetcode.com/problems/number-of-boomerangs/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | Add py solution for 447. Number of Boomerangs
447. Number of Boomerangs: https://leetcode.com/problems/number-of-boomerangs/ | from collections import Counter
class Solution(object):
def numberOfBoomerangs(self, points):
"""
:type points: List[List[int]]
:rtype: int
"""
cs = [Counter() for _ in xrange(len(points))]
for i1, p1 in enumerate(points):
for i2 in range(i1 + 1, len(point... | <commit_before><commit_msg>Add py solution for 447. Number of Boomerangs
447. Number of Boomerangs: https://leetcode.com/problems/number-of-boomerangs/<commit_after> | from collections import Counter
class Solution(object):
def numberOfBoomerangs(self, points):
"""
:type points: List[List[int]]
:rtype: int
"""
cs = [Counter() for _ in xrange(len(points))]
for i1, p1 in enumerate(points):
for i2 in range(i1 + 1, len(point... | Add py solution for 447. Number of Boomerangs
447. Number of Boomerangs: https://leetcode.com/problems/number-of-boomerangs/from collections import Counter
class Solution(object):
def numberOfBoomerangs(self, points):
"""
:type points: List[List[int]]
:rtype: int
"""
cs = [C... | <commit_before><commit_msg>Add py solution for 447. Number of Boomerangs
447. Number of Boomerangs: https://leetcode.com/problems/number-of-boomerangs/<commit_after>from collections import Counter
class Solution(object):
def numberOfBoomerangs(self, points):
"""
:type points: List[List[int]]
... | |
1abdf4b669f9d5329c8e0895956af2b0ebf2bfdd | housemarket/housesales/migrations/0001_initial.py | housemarket/housesales/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='HouseSales',
fields=[
('id', models.AutoField(v... | Add initial db migration for HouseSales | Add initial db migration for HouseSales
| Python | mit | andreagrandi/sold-house-prices | Add initial db migration for HouseSales | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='HouseSales',
fields=[
('id', models.AutoField(v... | <commit_before><commit_msg>Add initial db migration for HouseSales<commit_after> | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='HouseSales',
fields=[
('id', models.AutoField(v... | Add initial db migration for HouseSales# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='HouseSales',
fields=[
... | <commit_before><commit_msg>Add initial db migration for HouseSales<commit_after># -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
n... | |
645cbafc95f69d9d8d70ce3438d3907fed1024a2 | pyVers/neuralnet.py | pyVers/neuralnet.py |
import numpy as np
class NeuralNEt(object):
def __init__(self, inputs, outputs, *hiddens):
self.shape = [inputs] + list(hiddens) + [outputs]
self.layers = len(self.shape)
self.weights = self.__randInitialize()
def __randInitialize(self):
"""Randomly initializes... | Work begun on neural network class. | Work begun on neural network class.
| Python | mit | m0baxter/tic-tac-toe-AI | Work begun on neural network class. |
import numpy as np
class NeuralNEt(object):
def __init__(self, inputs, outputs, *hiddens):
self.shape = [inputs] + list(hiddens) + [outputs]
self.layers = len(self.shape)
self.weights = self.__randInitialize()
def __randInitialize(self):
"""Randomly initializes... | <commit_before><commit_msg>Work begun on neural network class.<commit_after> |
import numpy as np
class NeuralNEt(object):
def __init__(self, inputs, outputs, *hiddens):
self.shape = [inputs] + list(hiddens) + [outputs]
self.layers = len(self.shape)
self.weights = self.__randInitialize()
def __randInitialize(self):
"""Randomly initializes... | Work begun on neural network class.
import numpy as np
class NeuralNEt(object):
def __init__(self, inputs, outputs, *hiddens):
self.shape = [inputs] + list(hiddens) + [outputs]
self.layers = len(self.shape)
self.weights = self.__randInitialize()
def __randInitialize(sel... | <commit_before><commit_msg>Work begun on neural network class.<commit_after>
import numpy as np
class NeuralNEt(object):
def __init__(self, inputs, outputs, *hiddens):
self.shape = [inputs] + list(hiddens) + [outputs]
self.layers = len(self.shape)
self.weights = self.__randIniti... | |
453174d7acb9156fda29e4192691ef2d14eda2bb | bookmarks/bookmarks/migrations/0005_rename_app.py | bookmarks/bookmarks/migrations/0005_rename_app.py | from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bookmarks', '0004_auto_20160901_2322'),
]
operations = [
migrations.RunSQL("DROP TABLE bookmarks_bookmark;"),
migrations.RunSQL("ALTER TABLE core_bookmark RENAME TO bookmarks_bookmark;"),
... | Add one-way migration from core to bookmarks | Add one-way migration from core to bookmarks
| Python | mit | tom-henderson/bookmarks,tom-henderson/bookmarks,tom-henderson/bookmarks | Add one-way migration from core to bookmarks | from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bookmarks', '0004_auto_20160901_2322'),
]
operations = [
migrations.RunSQL("DROP TABLE bookmarks_bookmark;"),
migrations.RunSQL("ALTER TABLE core_bookmark RENAME TO bookmarks_bookmark;"),
... | <commit_before><commit_msg>Add one-way migration from core to bookmarks<commit_after> | from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bookmarks', '0004_auto_20160901_2322'),
]
operations = [
migrations.RunSQL("DROP TABLE bookmarks_bookmark;"),
migrations.RunSQL("ALTER TABLE core_bookmark RENAME TO bookmarks_bookmark;"),
... | Add one-way migration from core to bookmarksfrom django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bookmarks', '0004_auto_20160901_2322'),
]
operations = [
migrations.RunSQL("DROP TABLE bookmarks_bookmark;"),
migrations.RunSQL("ALTER TABLE core... | <commit_before><commit_msg>Add one-way migration from core to bookmarks<commit_after>from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bookmarks', '0004_auto_20160901_2322'),
]
operations = [
migrations.RunSQL("DROP TABLE bookmarks_bookmark;"),
... | |
206d1d2eb2b1ead51621670dd3341baeb21ae271 | CodeFights/spiralNumbers.py | CodeFights/spiralNumbers.py | #!/usr/local/bin/python
# Code Fights Spiral Numbers Problem
def spiralNumbers(n):
r, c = 0, 0 # Starting location
# Delta for row or column increments: first direction is left to right
dr, dc = 0, 1
spiral = [[0] * n for _ in range(n)]
for i in range(1, n * n + 1):
spiral[r][c] = i
... | Solve Code Fights spiral numbers problem | Solve Code Fights spiral numbers problem
| Python | mit | HKuz/Test_Code | Solve Code Fights spiral numbers problem | #!/usr/local/bin/python
# Code Fights Spiral Numbers Problem
def spiralNumbers(n):
r, c = 0, 0 # Starting location
# Delta for row or column increments: first direction is left to right
dr, dc = 0, 1
spiral = [[0] * n for _ in range(n)]
for i in range(1, n * n + 1):
spiral[r][c] = i
... | <commit_before><commit_msg>Solve Code Fights spiral numbers problem<commit_after> | #!/usr/local/bin/python
# Code Fights Spiral Numbers Problem
def spiralNumbers(n):
r, c = 0, 0 # Starting location
# Delta for row or column increments: first direction is left to right
dr, dc = 0, 1
spiral = [[0] * n for _ in range(n)]
for i in range(1, n * n + 1):
spiral[r][c] = i
... | Solve Code Fights spiral numbers problem#!/usr/local/bin/python
# Code Fights Spiral Numbers Problem
def spiralNumbers(n):
r, c = 0, 0 # Starting location
# Delta for row or column increments: first direction is left to right
dr, dc = 0, 1
spiral = [[0] * n for _ in range(n)]
for i in range(1, n ... | <commit_before><commit_msg>Solve Code Fights spiral numbers problem<commit_after>#!/usr/local/bin/python
# Code Fights Spiral Numbers Problem
def spiralNumbers(n):
r, c = 0, 0 # Starting location
# Delta for row or column increments: first direction is left to right
dr, dc = 0, 1
spiral = [[0] * n fo... | |
dae0ec0b70ed68a5fa6ae29225c4995256f4ec80 | CodeFights/isBeautifulString.py | CodeFights/isBeautifulString.py | #!/usr/local/bin/python
# Code Fights Is Beautiful String Problem
import string
def isBeautifulString(inputString):
keys = string.ascii_lowercase
for i in range(1, len(keys)):
if inputString.count(keys[i]) > inputString.count(keys[i - 1]):
return False
return True
def main():
t... | Solve Code Fights is beautiful string problem | Solve Code Fights is beautiful string problem
| Python | mit | HKuz/Test_Code | Solve Code Fights is beautiful string problem | #!/usr/local/bin/python
# Code Fights Is Beautiful String Problem
import string
def isBeautifulString(inputString):
keys = string.ascii_lowercase
for i in range(1, len(keys)):
if inputString.count(keys[i]) > inputString.count(keys[i - 1]):
return False
return True
def main():
t... | <commit_before><commit_msg>Solve Code Fights is beautiful string problem<commit_after> | #!/usr/local/bin/python
# Code Fights Is Beautiful String Problem
import string
def isBeautifulString(inputString):
keys = string.ascii_lowercase
for i in range(1, len(keys)):
if inputString.count(keys[i]) > inputString.count(keys[i - 1]):
return False
return True
def main():
t... | Solve Code Fights is beautiful string problem#!/usr/local/bin/python
# Code Fights Is Beautiful String Problem
import string
def isBeautifulString(inputString):
keys = string.ascii_lowercase
for i in range(1, len(keys)):
if inputString.count(keys[i]) > inputString.count(keys[i - 1]):
retu... | <commit_before><commit_msg>Solve Code Fights is beautiful string problem<commit_after>#!/usr/local/bin/python
# Code Fights Is Beautiful String Problem
import string
def isBeautifulString(inputString):
keys = string.ascii_lowercase
for i in range(1, len(keys)):
if inputString.count(keys[i]) > inputSt... | |
f53e12b1e3d939d1c98037589da81c459a61616f | papermill/tests/test_hdfs.py | papermill/tests/test_hdfs.py | import unittest
from unittest.mock import MagicMock, patch
from ..iorw import HDFSHandler
class MockHadoopFileSystem(MagicMock):
def ls(self, path):
return ['test1.ipynb', 'test2.ipynb']
def open(self, path, *args):
return MockHadoopFile()
class MockHadoopFile(object):
def __init__(sel... | Add test for hdfs handler | Add test for hdfs handler
| Python | bsd-3-clause | nteract/papermill,nteract/papermill | Add test for hdfs handler | import unittest
from unittest.mock import MagicMock, patch
from ..iorw import HDFSHandler
class MockHadoopFileSystem(MagicMock):
def ls(self, path):
return ['test1.ipynb', 'test2.ipynb']
def open(self, path, *args):
return MockHadoopFile()
class MockHadoopFile(object):
def __init__(sel... | <commit_before><commit_msg>Add test for hdfs handler<commit_after> | import unittest
from unittest.mock import MagicMock, patch
from ..iorw import HDFSHandler
class MockHadoopFileSystem(MagicMock):
def ls(self, path):
return ['test1.ipynb', 'test2.ipynb']
def open(self, path, *args):
return MockHadoopFile()
class MockHadoopFile(object):
def __init__(sel... | Add test for hdfs handlerimport unittest
from unittest.mock import MagicMock, patch
from ..iorw import HDFSHandler
class MockHadoopFileSystem(MagicMock):
def ls(self, path):
return ['test1.ipynb', 'test2.ipynb']
def open(self, path, *args):
return MockHadoopFile()
class MockHadoopFile(obje... | <commit_before><commit_msg>Add test for hdfs handler<commit_after>import unittest
from unittest.mock import MagicMock, patch
from ..iorw import HDFSHandler
class MockHadoopFileSystem(MagicMock):
def ls(self, path):
return ['test1.ipynb', 'test2.ipynb']
def open(self, path, *args):
return Moc... | |
b5c9fffab5d0c2082d0fcd55967e033272c36acc | flickrest.py | flickrest.py | import md5, urllib
from twisted.internet import defer
from twisted.web import client
from elementtree import ElementTree
class FlickREST:
endpoint = "http://api.flickr.com/services/rest/?"
def __init__(self, api_key, secret, perms="read"):
self.api_key = api_key
self.secret = secret
... | Add prototype and incomplete REST interface | Add prototype and incomplete REST interface | Python | lgpl-2.1 | rossburton/flickrest | Add prototype and incomplete REST interface | import md5, urllib
from twisted.internet import defer
from twisted.web import client
from elementtree import ElementTree
class FlickREST:
endpoint = "http://api.flickr.com/services/rest/?"
def __init__(self, api_key, secret, perms="read"):
self.api_key = api_key
self.secret = secret
... | <commit_before><commit_msg>Add prototype and incomplete REST interface<commit_after> | import md5, urllib
from twisted.internet import defer
from twisted.web import client
from elementtree import ElementTree
class FlickREST:
endpoint = "http://api.flickr.com/services/rest/?"
def __init__(self, api_key, secret, perms="read"):
self.api_key = api_key
self.secret = secret
... | Add prototype and incomplete REST interfaceimport md5, urllib
from twisted.internet import defer
from twisted.web import client
from elementtree import ElementTree
class FlickREST:
endpoint = "http://api.flickr.com/services/rest/?"
def __init__(self, api_key, secret, perms="read"):
self.api_key = ... | <commit_before><commit_msg>Add prototype and incomplete REST interface<commit_after>import md5, urllib
from twisted.internet import defer
from twisted.web import client
from elementtree import ElementTree
class FlickREST:
endpoint = "http://api.flickr.com/services/rest/?"
def __init__(self, api_key, secre... | |
0343ecb6bbc239a3e2542cbb0257f66bfb34a2b1 | tests/test_rietveld.py | tests/test_rietveld.py | from __future__ import absolute_import, print_function
import unittest
import os
from addie.addiedriver import AddieDriver
from tests import DATA_DIR
TOF = 'TOF'
D_SPACING = 'dSpacing'
Q_SPACE = 'MomentumTransfer'
class BraggData(unittest.TestCase):
def setUp(self):
self.filename = os.path.join(DATA_DIR... | Add unit tests for loading gsas data | Add unit tests for loading gsas data
| Python | mit | neutrons/FastGR,neutrons/FastGR,neutrons/FastGR | Add unit tests for loading gsas data | from __future__ import absolute_import, print_function
import unittest
import os
from addie.addiedriver import AddieDriver
from tests import DATA_DIR
TOF = 'TOF'
D_SPACING = 'dSpacing'
Q_SPACE = 'MomentumTransfer'
class BraggData(unittest.TestCase):
def setUp(self):
self.filename = os.path.join(DATA_DIR... | <commit_before><commit_msg>Add unit tests for loading gsas data<commit_after> | from __future__ import absolute_import, print_function
import unittest
import os
from addie.addiedriver import AddieDriver
from tests import DATA_DIR
TOF = 'TOF'
D_SPACING = 'dSpacing'
Q_SPACE = 'MomentumTransfer'
class BraggData(unittest.TestCase):
def setUp(self):
self.filename = os.path.join(DATA_DIR... | Add unit tests for loading gsas datafrom __future__ import absolute_import, print_function
import unittest
import os
from addie.addiedriver import AddieDriver
from tests import DATA_DIR
TOF = 'TOF'
D_SPACING = 'dSpacing'
Q_SPACE = 'MomentumTransfer'
class BraggData(unittest.TestCase):
def setUp(self):
s... | <commit_before><commit_msg>Add unit tests for loading gsas data<commit_after>from __future__ import absolute_import, print_function
import unittest
import os
from addie.addiedriver import AddieDriver
from tests import DATA_DIR
TOF = 'TOF'
D_SPACING = 'dSpacing'
Q_SPACE = 'MomentumTransfer'
class BraggData(unittest.... | |
ade6ab718b6fe29808e37aa9b852d502cc033980 | haml/util.py | haml/util.py |
def extract_haml(fileobj, keywords, comment_tags, options):
""" babel translation token extract function for haml files """
import haml
from mako import lexer, parsetree
from mako.ext.babelplugin import extract_nodes
encoding = options.get('input_encoding', options.get('encoding', None))
te... | Add babel translation string extractor function | Add babel translation string extractor function
haml.util.extract_haml adds ability for babel to
recognize and extract gettext translation tokens from haml files
| Python | bsd-3-clause | mikeboers/PyHAML | Add babel translation string extractor function
haml.util.extract_haml adds ability for babel to
recognize and extract gettext translation tokens from haml files |
def extract_haml(fileobj, keywords, comment_tags, options):
""" babel translation token extract function for haml files """
import haml
from mako import lexer, parsetree
from mako.ext.babelplugin import extract_nodes
encoding = options.get('input_encoding', options.get('encoding', None))
te... | <commit_before><commit_msg>Add babel translation string extractor function
haml.util.extract_haml adds ability for babel to
recognize and extract gettext translation tokens from haml files<commit_after> |
def extract_haml(fileobj, keywords, comment_tags, options):
""" babel translation token extract function for haml files """
import haml
from mako import lexer, parsetree
from mako.ext.babelplugin import extract_nodes
encoding = options.get('input_encoding', options.get('encoding', None))
te... | Add babel translation string extractor function
haml.util.extract_haml adds ability for babel to
recognize and extract gettext translation tokens from haml files
def extract_haml(fileobj, keywords, comment_tags, options):
""" babel translation token extract function for haml files """
import haml
from ma... | <commit_before><commit_msg>Add babel translation string extractor function
haml.util.extract_haml adds ability for babel to
recognize and extract gettext translation tokens from haml files<commit_after>
def extract_haml(fileobj, keywords, comment_tags, options):
""" babel translation token extract function for ha... | |
87179a4c040400aa7f5cc868744ffd298920caa6 | scripts/data_download/secex/create_all_files.py | scripts/data_download/secex/create_all_files.py | import os
import commands
import time
import logging
import sys
if len(sys.argv) != 3 or (sys.argv[1:][0] not in ['pt', 'en']):
print "ERROR! Use:\n python scripts/data_download/secex/create_files.py en/pt output_path\n"
exit()
logging.basicConfig(filename=os.path.abspath(os.path.join(sys.argv[2],str(sys.argv... | Add file to create all files to secex. | Add file to create all files to secex.
| Python | mit | DataViva/dataviva-site,DataViva/dataviva-site,DataViva/dataviva-site,DataViva/dataviva-site | Add file to create all files to secex. | import os
import commands
import time
import logging
import sys
if len(sys.argv) != 3 or (sys.argv[1:][0] not in ['pt', 'en']):
print "ERROR! Use:\n python scripts/data_download/secex/create_files.py en/pt output_path\n"
exit()
logging.basicConfig(filename=os.path.abspath(os.path.join(sys.argv[2],str(sys.argv... | <commit_before><commit_msg>Add file to create all files to secex.<commit_after> | import os
import commands
import time
import logging
import sys
if len(sys.argv) != 3 or (sys.argv[1:][0] not in ['pt', 'en']):
print "ERROR! Use:\n python scripts/data_download/secex/create_files.py en/pt output_path\n"
exit()
logging.basicConfig(filename=os.path.abspath(os.path.join(sys.argv[2],str(sys.argv... | Add file to create all files to secex.import os
import commands
import time
import logging
import sys
if len(sys.argv) != 3 or (sys.argv[1:][0] not in ['pt', 'en']):
print "ERROR! Use:\n python scripts/data_download/secex/create_files.py en/pt output_path\n"
exit()
logging.basicConfig(filename=os.path.abspath... | <commit_before><commit_msg>Add file to create all files to secex.<commit_after>import os
import commands
import time
import logging
import sys
if len(sys.argv) != 3 or (sys.argv[1:][0] not in ['pt', 'en']):
print "ERROR! Use:\n python scripts/data_download/secex/create_files.py en/pt output_path\n"
exit()
log... | |
ce7994e255cd83d84259c369d1823aa7ac8c30cd | sahara/tests/unit/plugins/cdh/test_versionfactory.py | sahara/tests/unit/plugins/cdh/test_versionfactory.py | # Copyright (c) 2015 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Add test cases for CDH plugin versionfactory | Add test cases for CDH plugin versionfactory
Changes:
* add test cases for CDH plugin versionfactory
* add a function to get supported versions into utils
partially implements bp: cdh-plugin-refactoring
Change-Id: I3b60c65ab8a6bb7c296b2a8a1ebbfd4bacfbe6b4
| Python | apache-2.0 | openstack/sahara,egafford/sahara,tellesnobrega/sahara,openstack/sahara,tellesnobrega/sahara,egafford/sahara | Add test cases for CDH plugin versionfactory
Changes:
* add test cases for CDH plugin versionfactory
* add a function to get supported versions into utils
partially implements bp: cdh-plugin-refactoring
Change-Id: I3b60c65ab8a6bb7c296b2a8a1ebbfd4bacfbe6b4 | # Copyright (c) 2015 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | <commit_before><commit_msg>Add test cases for CDH plugin versionfactory
Changes:
* add test cases for CDH plugin versionfactory
* add a function to get supported versions into utils
partially implements bp: cdh-plugin-refactoring
Change-Id: I3b60c65ab8a6bb7c296b2a8a1ebbfd4bacfbe6b4<commit_after> | # Copyright (c) 2015 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | Add test cases for CDH plugin versionfactory
Changes:
* add test cases for CDH plugin versionfactory
* add a function to get supported versions into utils
partially implements bp: cdh-plugin-refactoring
Change-Id: I3b60c65ab8a6bb7c296b2a8a1ebbfd4bacfbe6b4# Copyright (c) 2015 Mirantis Inc.
#
# Licensed under the Apac... | <commit_before><commit_msg>Add test cases for CDH plugin versionfactory
Changes:
* add test cases for CDH plugin versionfactory
* add a function to get supported versions into utils
partially implements bp: cdh-plugin-refactoring
Change-Id: I3b60c65ab8a6bb7c296b2a8a1ebbfd4bacfbe6b4<commit_after># Copyright (c) 2015 ... | |
32bb59d990a00a288c083d23a32b179e61486aff | generic/test_client.py | generic/test_client.py | # Copyright 2014 OpenStack Foundation
# 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 requ... | Fix discover command failed to read extension list issue | Fix discover command failed to read extension list issue
Fix the key error which caused discover command failed to read the
response body of extension list result. This change also added test
cases to cover the use case of generic client extension discovery.
Change-Id: Id687f8d73cead28f594de00d3b5ff9086558947b
Closes... | Python | apache-2.0 | varunarya10/keystonemiddleware | Fix discover command failed to read extension list issue
Fix the key error which caused discover command failed to read the
response body of extension list result. This change also added test
cases to cover the use case of generic client extension discovery.
Change-Id: Id687f8d73cead28f594de00d3b5ff9086558947b
Closes... | # Copyright 2014 OpenStack Foundation
# 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 requ... | <commit_before><commit_msg>Fix discover command failed to read extension list issue
Fix the key error which caused discover command failed to read the
response body of extension list result. This change also added test
cases to cover the use case of generic client extension discovery.
Change-Id: Id687f8d73cead28f594d... | # Copyright 2014 OpenStack Foundation
# 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 requ... | Fix discover command failed to read extension list issue
Fix the key error which caused discover command failed to read the
response body of extension list result. This change also added test
cases to cover the use case of generic client extension discovery.
Change-Id: Id687f8d73cead28f594de00d3b5ff9086558947b
Closes... | <commit_before><commit_msg>Fix discover command failed to read extension list issue
Fix the key error which caused discover command failed to read the
response body of extension list result. This change also added test
cases to cover the use case of generic client extension discovery.
Change-Id: Id687f8d73cead28f594d... | |
e0fe2901e699ed4ac8ded58fed0793c495eec02e | conftest.py | conftest.py | # -*- coding: utf-8 -*-
import pytest
import os
import json
@pytest.fixture(scope="class",
params=os.listdir('test_fixtures'))
def story(request):
"""
Provides a detailed HPACK story to test with.
"""
path = os.path.join('test_fixtures', request.param)
with open(path, 'r', encoding=... | Create a py.test fixture to use the new stories. | Create a py.test fixture to use the new stories.
| Python | mit | plucury/hyper,masaori335/hyper,lawnmowerlatte/hyper,fredthomsen/hyper,irvind/hyper,jdecuyper/hyper,jdecuyper/hyper,masaori335/hyper,Lukasa/hyper,lawnmowerlatte/hyper,irvind/hyper,Lukasa/hyper,fredthomsen/hyper,plucury/hyper | Create a py.test fixture to use the new stories. | # -*- coding: utf-8 -*-
import pytest
import os
import json
@pytest.fixture(scope="class",
params=os.listdir('test_fixtures'))
def story(request):
"""
Provides a detailed HPACK story to test with.
"""
path = os.path.join('test_fixtures', request.param)
with open(path, 'r', encoding=... | <commit_before><commit_msg>Create a py.test fixture to use the new stories.<commit_after> | # -*- coding: utf-8 -*-
import pytest
import os
import json
@pytest.fixture(scope="class",
params=os.listdir('test_fixtures'))
def story(request):
"""
Provides a detailed HPACK story to test with.
"""
path = os.path.join('test_fixtures', request.param)
with open(path, 'r', encoding=... | Create a py.test fixture to use the new stories.# -*- coding: utf-8 -*-
import pytest
import os
import json
@pytest.fixture(scope="class",
params=os.listdir('test_fixtures'))
def story(request):
"""
Provides a detailed HPACK story to test with.
"""
path = os.path.join('test_fixtures', r... | <commit_before><commit_msg>Create a py.test fixture to use the new stories.<commit_after># -*- coding: utf-8 -*-
import pytest
import os
import json
@pytest.fixture(scope="class",
params=os.listdir('test_fixtures'))
def story(request):
"""
Provides a detailed HPACK story to test with.
"""
... | |
c694a5a5e5ba9403eeca57feb9fd21edccd95132 | scripts/get_bank_registry_hr.py | scripts/get_bank_registry_hr.py | #!/usr/bin/env python
import json
import xlrd
import requests
URL = (
"https://www.hnb.hr/documents/20182/121798/tf-pp-ds-vbb-xlsx-e-vbb.xlsx/"
"06982c63-13e3-4aa0-846d-afb7956ee731"
)
def process():
registry = []
book = xlrd.open_workbook(file_contents=requests.get(URL).content)
sheet = book.sh... | Add script to generate HR bic code registry | Add script to generate HR bic code registry
| Python | mit | figo-connect/schwifty | Add script to generate HR bic code registry | #!/usr/bin/env python
import json
import xlrd
import requests
URL = (
"https://www.hnb.hr/documents/20182/121798/tf-pp-ds-vbb-xlsx-e-vbb.xlsx/"
"06982c63-13e3-4aa0-846d-afb7956ee731"
)
def process():
registry = []
book = xlrd.open_workbook(file_contents=requests.get(URL).content)
sheet = book.sh... | <commit_before><commit_msg>Add script to generate HR bic code registry<commit_after> | #!/usr/bin/env python
import json
import xlrd
import requests
URL = (
"https://www.hnb.hr/documents/20182/121798/tf-pp-ds-vbb-xlsx-e-vbb.xlsx/"
"06982c63-13e3-4aa0-846d-afb7956ee731"
)
def process():
registry = []
book = xlrd.open_workbook(file_contents=requests.get(URL).content)
sheet = book.sh... | Add script to generate HR bic code registry#!/usr/bin/env python
import json
import xlrd
import requests
URL = (
"https://www.hnb.hr/documents/20182/121798/tf-pp-ds-vbb-xlsx-e-vbb.xlsx/"
"06982c63-13e3-4aa0-846d-afb7956ee731"
)
def process():
registry = []
book = xlrd.open_workbook(file_contents=req... | <commit_before><commit_msg>Add script to generate HR bic code registry<commit_after>#!/usr/bin/env python
import json
import xlrd
import requests
URL = (
"https://www.hnb.hr/documents/20182/121798/tf-pp-ds-vbb-xlsx-e-vbb.xlsx/"
"06982c63-13e3-4aa0-846d-afb7956ee731"
)
def process():
registry = []
bo... | |
bf059b8b781c786edb4b3ca7ef838e9b4d16d3a0 | tests/commands/test_lib.py | tests/commands/test_lib.py | # Copyright (C) Ivan Kravets <[email protected]>
# See LICENSE for details.
from os import listdir
from os.path import isdir, isfile, join
import re
from click.testing import CliRunner
from platformio.commands.lib import cli
from platformio import util
runner = CliRunner()
def validate_output(result):
assert r... | Cover "lib" commands with tests | Cover "lib" commands with tests
| Python | apache-2.0 | awong1900/platformio,platformio/platformio,ZachMassia/platformio,mplewis/platformio,bkudria/platformio,platformio/platformio-core,jrobeson/platformio,TimJay/platformio,jrobeson/platformio,valeros/platformio,atyenoria/platformio,jrobeson/platformio,bkudria/platformio,TimJay/platformio,mcanthony/platformio,mseroczynski/p... | Cover "lib" commands with tests | # Copyright (C) Ivan Kravets <[email protected]>
# See LICENSE for details.
from os import listdir
from os.path import isdir, isfile, join
import re
from click.testing import CliRunner
from platformio.commands.lib import cli
from platformio import util
runner = CliRunner()
def validate_output(result):
assert r... | <commit_before><commit_msg>Cover "lib" commands with tests<commit_after> | # Copyright (C) Ivan Kravets <[email protected]>
# See LICENSE for details.
from os import listdir
from os.path import isdir, isfile, join
import re
from click.testing import CliRunner
from platformio.commands.lib import cli
from platformio import util
runner = CliRunner()
def validate_output(result):
assert r... | Cover "lib" commands with tests# Copyright (C) Ivan Kravets <[email protected]>
# See LICENSE for details.
from os import listdir
from os.path import isdir, isfile, join
import re
from click.testing import CliRunner
from platformio.commands.lib import cli
from platformio import util
runner = CliRunner()
def valida... | <commit_before><commit_msg>Cover "lib" commands with tests<commit_after># Copyright (C) Ivan Kravets <[email protected]>
# See LICENSE for details.
from os import listdir
from os.path import isdir, isfile, join
import re
from click.testing import CliRunner
from platformio.commands.lib import cli
from platformio impor... | |
c9f2fcdb62856f112a17a51020c9cb215bb8620c | tests/test_gitlab_local.py | tests/test_gitlab_local.py | # MIT licensed
# Copyright (c) 2013-2017 lilydjwg <[email protected]>, et al.
import os
import pytest
import contextlib
pytestmark = [pytest.mark.asyncio,
pytest.mark.skipif(os.environ.get('TRAVIS') == 'true',
reason="rate-limited per IP")]
@contextlib.contextmanager
de... | Add local test for over limit check | tests: Add local test for over limit check
Signed-off-by: Xuanwo <[email protected]>
| Python | mit | lilydjwg/nvchecker | tests: Add local test for over limit check
Signed-off-by: Xuanwo <[email protected]> | # MIT licensed
# Copyright (c) 2013-2017 lilydjwg <[email protected]>, et al.
import os
import pytest
import contextlib
pytestmark = [pytest.mark.asyncio,
pytest.mark.skipif(os.environ.get('TRAVIS') == 'true',
reason="rate-limited per IP")]
@contextlib.contextmanager
de... | <commit_before><commit_msg>tests: Add local test for over limit check
Signed-off-by: Xuanwo <[email protected]><commit_after> | # MIT licensed
# Copyright (c) 2013-2017 lilydjwg <[email protected]>, et al.
import os
import pytest
import contextlib
pytestmark = [pytest.mark.asyncio,
pytest.mark.skipif(os.environ.get('TRAVIS') == 'true',
reason="rate-limited per IP")]
@contextlib.contextmanager
de... | tests: Add local test for over limit check
Signed-off-by: Xuanwo <[email protected]># MIT licensed
# Copyright (c) 2013-2017 lilydjwg <[email protected]>, et al.
import os
import pytest
import contextlib
pytestmark = [pytest.mark.asyncio,
pytest.mark.skipif(os.environ.g... | <commit_before><commit_msg>tests: Add local test for over limit check
Signed-off-by: Xuanwo <[email protected]><commit_after># MIT licensed
# Copyright (c) 2013-2017 lilydjwg <[email protected]>, et al.
import os
import pytest
import contextlib
pytestmark = [pytest.mark.asyncio,
... | |
3653ad1320d7624aa798d67031827056ddf64efd | pontoon/base/migrations/0095_pontoon_intro_permalink_prefix.py | pontoon/base/migrations/0095_pontoon_intro_permalink_prefix.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-28 23:15
from __future__ import unicode_literals
from django.db import migrations
def load_initial_data(apps, schema_editor):
Project = apps.get_model('base', 'Project')
repository = Project.objects.get(slug="pontoon-intro").repositories.first()... | Add required field data for the initial project | Add required field data for the initial project
The permalink_prefix field has been add to the Repository object and
made required, but we never added a data migration to populate it for
the initial project (Pontoon Intro). So let's do this now.
| Python | bsd-3-clause | mathjazz/pontoon,mathjazz/pontoon,jotes/pontoon,mozilla/pontoon,mastizada/pontoon,mozilla/pontoon,mastizada/pontoon,mastizada/pontoon,mozilla/pontoon,mastizada/pontoon,jotes/pontoon,mozilla/pontoon,jotes/pontoon,mathjazz/pontoon,jotes/pontoon,mozilla/pontoon,mathjazz/pontoon,mathjazz/pontoon | Add required field data for the initial project
The permalink_prefix field has been add to the Repository object and
made required, but we never added a data migration to populate it for
the initial project (Pontoon Intro). So let's do this now. | # -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-28 23:15
from __future__ import unicode_literals
from django.db import migrations
def load_initial_data(apps, schema_editor):
Project = apps.get_model('base', 'Project')
repository = Project.objects.get(slug="pontoon-intro").repositories.first()... | <commit_before><commit_msg>Add required field data for the initial project
The permalink_prefix field has been add to the Repository object and
made required, but we never added a data migration to populate it for
the initial project (Pontoon Intro). So let's do this now.<commit_after> | # -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-28 23:15
from __future__ import unicode_literals
from django.db import migrations
def load_initial_data(apps, schema_editor):
Project = apps.get_model('base', 'Project')
repository = Project.objects.get(slug="pontoon-intro").repositories.first()... | Add required field data for the initial project
The permalink_prefix field has been add to the Repository object and
made required, but we never added a data migration to populate it for
the initial project (Pontoon Intro). So let's do this now.# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-28 23:15
f... | <commit_before><commit_msg>Add required field data for the initial project
The permalink_prefix field has been add to the Repository object and
made required, but we never added a data migration to populate it for
the initial project (Pontoon Intro). So let's do this now.<commit_after># -*- coding: utf-8 -*-
# Generat... | |
c26498c9295ffca534d42d80d7d22e53c19822b2 | byceps/typing.py | byceps/typing.py | """
byceps.typing
~~~~~~~~~~~~~
BYCEPS-specific type aliases for PEP 484 type hints
:Copyright: 2006-2017 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from uuid import UUID
UserID = UUID
BrandID = str
PartyID = str
| Add module with BYCEPS-specific types for PEP 484 type hints | Add module with BYCEPS-specific types for PEP 484 type hints
| Python | bsd-3-clause | homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps | Add module with BYCEPS-specific types for PEP 484 type hints | """
byceps.typing
~~~~~~~~~~~~~
BYCEPS-specific type aliases for PEP 484 type hints
:Copyright: 2006-2017 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from uuid import UUID
UserID = UUID
BrandID = str
PartyID = str
| <commit_before><commit_msg>Add module with BYCEPS-specific types for PEP 484 type hints<commit_after> | """
byceps.typing
~~~~~~~~~~~~~
BYCEPS-specific type aliases for PEP 484 type hints
:Copyright: 2006-2017 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from uuid import UUID
UserID = UUID
BrandID = str
PartyID = str
| Add module with BYCEPS-specific types for PEP 484 type hints"""
byceps.typing
~~~~~~~~~~~~~
BYCEPS-specific type aliases for PEP 484 type hints
:Copyright: 2006-2017 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from uuid import UUID
UserID = UUID
BrandID = str
PartyID = str
| <commit_before><commit_msg>Add module with BYCEPS-specific types for PEP 484 type hints<commit_after>"""
byceps.typing
~~~~~~~~~~~~~
BYCEPS-specific type aliases for PEP 484 type hints
:Copyright: 2006-2017 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from uuid import UUID
UserID = UUI... | |
bf897cd1ee43cf970dc9b0b955db0c8c3a2dbbe4 | src/nodeconductor_openstack/tests/test_instance.py | src/nodeconductor_openstack/tests/test_instance.py | from rest_framework import status, test
from nodeconductor.structure.models import CustomerRole
from nodeconductor.structure.tests import factories as structure_factories
from ..apps import OpenStackConfig
from . import factories
class InstanceProvisionTest(test.APITransactionTestCase):
def setUp(self):
... | Add unit tests for provisioning instance with floating IP (NC-1470) | Add unit tests for provisioning instance with floating IP (NC-1470)
| Python | mit | opennode/nodeconductor-openstack | Add unit tests for provisioning instance with floating IP (NC-1470) | from rest_framework import status, test
from nodeconductor.structure.models import CustomerRole
from nodeconductor.structure.tests import factories as structure_factories
from ..apps import OpenStackConfig
from . import factories
class InstanceProvisionTest(test.APITransactionTestCase):
def setUp(self):
... | <commit_before><commit_msg>Add unit tests for provisioning instance with floating IP (NC-1470)<commit_after> | from rest_framework import status, test
from nodeconductor.structure.models import CustomerRole
from nodeconductor.structure.tests import factories as structure_factories
from ..apps import OpenStackConfig
from . import factories
class InstanceProvisionTest(test.APITransactionTestCase):
def setUp(self):
... | Add unit tests for provisioning instance with floating IP (NC-1470)from rest_framework import status, test
from nodeconductor.structure.models import CustomerRole
from nodeconductor.structure.tests import factories as structure_factories
from ..apps import OpenStackConfig
from . import factories
class InstanceProvi... | <commit_before><commit_msg>Add unit tests for provisioning instance with floating IP (NC-1470)<commit_after>from rest_framework import status, test
from nodeconductor.structure.models import CustomerRole
from nodeconductor.structure.tests import factories as structure_factories
from ..apps import OpenStackConfig
from... | |
3bf6d6e13f7611b127582ab862d46228b2164a95 | st2common/bin/migrations/v2.1/st2-migrate-runners.py | st2common/bin/migrations/v2.1/st2-migrate-runners.py | #!/usr/bin/env python
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License... | Add migration script to register runners | Add migration script to register runners
| Python | apache-2.0 | peak6/st2,nzlosh/st2,Plexxi/st2,peak6/st2,tonybaloney/st2,StackStorm/st2,Plexxi/st2,tonybaloney/st2,lakshmi-kannan/st2,pixelrebel/st2,StackStorm/st2,nzlosh/st2,StackStorm/st2,lakshmi-kannan/st2,tonybaloney/st2,Plexxi/st2,pixelrebel/st2,pixelrebel/st2,nzlosh/st2,lakshmi-kannan/st2,nzlosh/st2,StackStorm/st2,Plexxi/st2,pe... | Add migration script to register runners | #!/usr/bin/env python
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License... | <commit_before><commit_msg>Add migration script to register runners<commit_after> | #!/usr/bin/env python
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License... | Add migration script to register runners#!/usr/bin/env python
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apa... | <commit_before><commit_msg>Add migration script to register runners<commit_after>#!/usr/bin/env python
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The AS... | |
5d741bb4a0f0cdab21a23951507e42b257acc2a6 | examples/timer_spinner.py | examples/timer_spinner.py | # -*- coding: utf-8 -*-
"""
examples.timer_spinner
~~~~~~~~~~~~~~~~~~~~~~
Show elapsed time at the end of the line.
"""
import time
from yaspin import yaspin
def main():
with yaspin(text="elapsed time", timer=True) as sp:
# Floats are rounded into two decimal digits in timer output
time.sleep(... | Add usage example for timer feature | Add usage example for timer feature
| Python | mit | pavdmyt/yaspin | Add usage example for timer feature | # -*- coding: utf-8 -*-
"""
examples.timer_spinner
~~~~~~~~~~~~~~~~~~~~~~
Show elapsed time at the end of the line.
"""
import time
from yaspin import yaspin
def main():
with yaspin(text="elapsed time", timer=True) as sp:
# Floats are rounded into two decimal digits in timer output
time.sleep(... | <commit_before><commit_msg>Add usage example for timer feature<commit_after> | # -*- coding: utf-8 -*-
"""
examples.timer_spinner
~~~~~~~~~~~~~~~~~~~~~~
Show elapsed time at the end of the line.
"""
import time
from yaspin import yaspin
def main():
with yaspin(text="elapsed time", timer=True) as sp:
# Floats are rounded into two decimal digits in timer output
time.sleep(... | Add usage example for timer feature# -*- coding: utf-8 -*-
"""
examples.timer_spinner
~~~~~~~~~~~~~~~~~~~~~~
Show elapsed time at the end of the line.
"""
import time
from yaspin import yaspin
def main():
with yaspin(text="elapsed time", timer=True) as sp:
# Floats are rounded into two decimal digits ... | <commit_before><commit_msg>Add usage example for timer feature<commit_after># -*- coding: utf-8 -*-
"""
examples.timer_spinner
~~~~~~~~~~~~~~~~~~~~~~
Show elapsed time at the end of the line.
"""
import time
from yaspin import yaspin
def main():
with yaspin(text="elapsed time", timer=True) as sp:
# Fl... | |
4223ed495639650a1b2ffdbc76546c8cbb7cc90f | moksha/tests/quickstarts/test_consumer.py | moksha/tests/quickstarts/test_consumer.py | import inspect
import pkg_resources
from datetime import timedelta
from moksha.api.hub import Consumer
from moksha.pastetemplate import MokshaConsumerTemplate
from base import QuickstartTester
class TestConsumerQuickstart(QuickstartTester):
def __init__(self,**options):
self.app = None
self.tem... | Add some tests for our consumer quickstart | Add some tests for our consumer quickstart
| Python | apache-2.0 | pombredanne/moksha,ralphbean/moksha,lmacken/moksha,mokshaproject/moksha,mokshaproject/moksha,ralphbean/moksha,lmacken/moksha,pombredanne/moksha,lmacken/moksha,ralphbean/moksha,mokshaproject/moksha,pombredanne/moksha,mokshaproject/moksha,pombredanne/moksha | Add some tests for our consumer quickstart | import inspect
import pkg_resources
from datetime import timedelta
from moksha.api.hub import Consumer
from moksha.pastetemplate import MokshaConsumerTemplate
from base import QuickstartTester
class TestConsumerQuickstart(QuickstartTester):
def __init__(self,**options):
self.app = None
self.tem... | <commit_before><commit_msg>Add some tests for our consumer quickstart<commit_after> | import inspect
import pkg_resources
from datetime import timedelta
from moksha.api.hub import Consumer
from moksha.pastetemplate import MokshaConsumerTemplate
from base import QuickstartTester
class TestConsumerQuickstart(QuickstartTester):
def __init__(self,**options):
self.app = None
self.tem... | Add some tests for our consumer quickstartimport inspect
import pkg_resources
from datetime import timedelta
from moksha.api.hub import Consumer
from moksha.pastetemplate import MokshaConsumerTemplate
from base import QuickstartTester
class TestConsumerQuickstart(QuickstartTester):
def __init__(self,**options)... | <commit_before><commit_msg>Add some tests for our consumer quickstart<commit_after>import inspect
import pkg_resources
from datetime import timedelta
from moksha.api.hub import Consumer
from moksha.pastetemplate import MokshaConsumerTemplate
from base import QuickstartTester
class TestConsumerQuickstart(QuickstartT... | |
6f74d7d1b95eb2b4b2b07e48fab7d935069a9c7c | generate-upload-stream.py | generate-upload-stream.py | #!/usr/bin/env python3
import fileinput
import hashlib
import itertools
import random
import re
import sys
import timer
import utils
"""
Generates an upload request stream from the data collected by file_counts.py.
The input is read from stdin and the compact, binary output is written to
stdout.
Usage:
cat <FILE_P... | Add script for generating upload request stream | Add script for generating upload request stream
| Python | apache-2.0 | sjakthol/dedup-simulator,sjakthol/dedup-simulator | Add script for generating upload request stream | #!/usr/bin/env python3
import fileinput
import hashlib
import itertools
import random
import re
import sys
import timer
import utils
"""
Generates an upload request stream from the data collected by file_counts.py.
The input is read from stdin and the compact, binary output is written to
stdout.
Usage:
cat <FILE_P... | <commit_before><commit_msg>Add script for generating upload request stream<commit_after> | #!/usr/bin/env python3
import fileinput
import hashlib
import itertools
import random
import re
import sys
import timer
import utils
"""
Generates an upload request stream from the data collected by file_counts.py.
The input is read from stdin and the compact, binary output is written to
stdout.
Usage:
cat <FILE_P... | Add script for generating upload request stream#!/usr/bin/env python3
import fileinput
import hashlib
import itertools
import random
import re
import sys
import timer
import utils
"""
Generates an upload request stream from the data collected by file_counts.py.
The input is read from stdin and the compact, binary out... | <commit_before><commit_msg>Add script for generating upload request stream<commit_after>#!/usr/bin/env python3
import fileinput
import hashlib
import itertools
import random
import re
import sys
import timer
import utils
"""
Generates an upload request stream from the data collected by file_counts.py.
The input is re... | |
27cc2a5fb13a9a45fd8af3b8bee1d0c66b7c8d91 | cardinal/test_decorators.py | cardinal/test_decorators.py | import pytest
import decorators
def test_command():
# ensure commands is a list with foo added
@decorators.command('foo')
def foo():
pass
assert foo.commands == ['foo']
# test that you can pass a list
@decorators.command(['foo', 'bar'])
def foo():
pass
assert foo.com... | Add first unit test using py.test | Add first unit test using py.test
Tests Cardinal's decorators
| Python | mit | BiohZn/Cardinal,JohnMaguire/Cardinal | Add first unit test using py.test
Tests Cardinal's decorators | import pytest
import decorators
def test_command():
# ensure commands is a list with foo added
@decorators.command('foo')
def foo():
pass
assert foo.commands == ['foo']
# test that you can pass a list
@decorators.command(['foo', 'bar'])
def foo():
pass
assert foo.com... | <commit_before><commit_msg>Add first unit test using py.test
Tests Cardinal's decorators<commit_after> | import pytest
import decorators
def test_command():
# ensure commands is a list with foo added
@decorators.command('foo')
def foo():
pass
assert foo.commands == ['foo']
# test that you can pass a list
@decorators.command(['foo', 'bar'])
def foo():
pass
assert foo.com... | Add first unit test using py.test
Tests Cardinal's decoratorsimport pytest
import decorators
def test_command():
# ensure commands is a list with foo added
@decorators.command('foo')
def foo():
pass
assert foo.commands == ['foo']
# test that you can pass a list
@decorators.command([... | <commit_before><commit_msg>Add first unit test using py.test
Tests Cardinal's decorators<commit_after>import pytest
import decorators
def test_command():
# ensure commands is a list with foo added
@decorators.command('foo')
def foo():
pass
assert foo.commands == ['foo']
# test that you ... | |
4ba1ea670b208a734aa3f36c694b20e4bb5d6dda | alembic/versions/14ef1fe33bd_add_checkpoint_evaluation_table.py | alembic/versions/14ef1fe33bd_add_checkpoint_evaluation_table.py | """Add checkpoint_evaluation table
Revision ID: 14ef1fe33bd
Revises: 3d0a468b38f
Create Date: 2015-07-10 02:35:06.655075
"""
# revision identifiers, used by Alembic.
revision = '14ef1fe33bd'
down_revision = '3d0a468b38f'
branch_labels = None
depends_on = None
from alembic import op
from bnd.models import Checkpoint... | Write an Alembic migration script | Write an Alembic migration script
| Python | mit | suminb/bnd,suminb/bnd,suminb/bnd | Write an Alembic migration script | """Add checkpoint_evaluation table
Revision ID: 14ef1fe33bd
Revises: 3d0a468b38f
Create Date: 2015-07-10 02:35:06.655075
"""
# revision identifiers, used by Alembic.
revision = '14ef1fe33bd'
down_revision = '3d0a468b38f'
branch_labels = None
depends_on = None
from alembic import op
from bnd.models import Checkpoint... | <commit_before><commit_msg>Write an Alembic migration script<commit_after> | """Add checkpoint_evaluation table
Revision ID: 14ef1fe33bd
Revises: 3d0a468b38f
Create Date: 2015-07-10 02:35:06.655075
"""
# revision identifiers, used by Alembic.
revision = '14ef1fe33bd'
down_revision = '3d0a468b38f'
branch_labels = None
depends_on = None
from alembic import op
from bnd.models import Checkpoint... | Write an Alembic migration script"""Add checkpoint_evaluation table
Revision ID: 14ef1fe33bd
Revises: 3d0a468b38f
Create Date: 2015-07-10 02:35:06.655075
"""
# revision identifiers, used by Alembic.
revision = '14ef1fe33bd'
down_revision = '3d0a468b38f'
branch_labels = None
depends_on = None
from alembic import op
... | <commit_before><commit_msg>Write an Alembic migration script<commit_after>"""Add checkpoint_evaluation table
Revision ID: 14ef1fe33bd
Revises: 3d0a468b38f
Create Date: 2015-07-10 02:35:06.655075
"""
# revision identifiers, used by Alembic.
revision = '14ef1fe33bd'
down_revision = '3d0a468b38f'
branch_labels = None
d... | |
d0ac9b735694220f9d101358da1e51a335fad284 | smap-nepse/preprocessing/l1_regularization.py | smap-nepse/preprocessing/l1_regularization.py | import numpy as np
import pandas as pd
from sklearn.linear_model import Lasso
from sklearn.preprocessing import StandardScaler
df = pd.read_csv("NABIL.csv")
df.drop(df.columns[[0,1,9,13,14]], axis=1, inplace=True)
#print(df.columns)
df.drop(df.index[:19],inplace=True)
scaler = StandardScaler()
#df['Price']=df['... | Select features using l1 regularization | Select features using l1 regularization
| Python | mit | samshara/Stock-Market-Analysis-and-Prediction | Select features using l1 regularization | import numpy as np
import pandas as pd
from sklearn.linear_model import Lasso
from sklearn.preprocessing import StandardScaler
df = pd.read_csv("NABIL.csv")
df.drop(df.columns[[0,1,9,13,14]], axis=1, inplace=True)
#print(df.columns)
df.drop(df.index[:19],inplace=True)
scaler = StandardScaler()
#df['Price']=df['... | <commit_before><commit_msg>Select features using l1 regularization<commit_after> | import numpy as np
import pandas as pd
from sklearn.linear_model import Lasso
from sklearn.preprocessing import StandardScaler
df = pd.read_csv("NABIL.csv")
df.drop(df.columns[[0,1,9,13,14]], axis=1, inplace=True)
#print(df.columns)
df.drop(df.index[:19],inplace=True)
scaler = StandardScaler()
#df['Price']=df['... | Select features using l1 regularizationimport numpy as np
import pandas as pd
from sklearn.linear_model import Lasso
from sklearn.preprocessing import StandardScaler
df = pd.read_csv("NABIL.csv")
df.drop(df.columns[[0,1,9,13,14]], axis=1, inplace=True)
#print(df.columns)
df.drop(df.index[:19],inplace=True)
scale... | <commit_before><commit_msg>Select features using l1 regularization<commit_after>import numpy as np
import pandas as pd
from sklearn.linear_model import Lasso
from sklearn.preprocessing import StandardScaler
df = pd.read_csv("NABIL.csv")
df.drop(df.columns[[0,1,9,13,14]], axis=1, inplace=True)
#print(df.columns)
... | |
899d432b87397368f53010493a3cd67506bbe5a5 | hooks/post_gen_project.py | hooks/post_gen_project.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger('post_gen_project')
import shutil
import os
{% if cookiecutter.docs_tool == "mkdocs" %}
logger.info('Moving files for mkdocs.')
os.rename('mkdocs/mkdocs.yml', 'mkdocs.yml')
shutil.move('... | Implement a post gen hook to rename mkdocs files | Implement a post gen hook to rename mkdocs files
| Python | mit | pytest-dev/cookiecutter-pytest-plugin,luzfcb/cookiecutter-pytest-plugin,s0undt3ch/cookiecutter-pytest-plugin | Implement a post gen hook to rename mkdocs files | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger('post_gen_project')
import shutil
import os
{% if cookiecutter.docs_tool == "mkdocs" %}
logger.info('Moving files for mkdocs.')
os.rename('mkdocs/mkdocs.yml', 'mkdocs.yml')
shutil.move('... | <commit_before><commit_msg>Implement a post gen hook to rename mkdocs files<commit_after> | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger('post_gen_project')
import shutil
import os
{% if cookiecutter.docs_tool == "mkdocs" %}
logger.info('Moving files for mkdocs.')
os.rename('mkdocs/mkdocs.yml', 'mkdocs.yml')
shutil.move('... | Implement a post gen hook to rename mkdocs files#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger('post_gen_project')
import shutil
import os
{% if cookiecutter.docs_tool == "mkdocs" %}
logger.info('Moving files for mkdocs.')
os.rename(... | <commit_before><commit_msg>Implement a post gen hook to rename mkdocs files<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger('post_gen_project')
import shutil
import os
{% if cookiecutter.docs_tool == "mkdocs" %}
logger.in... | |
0b8dc2afb3b3b9b9988e04586ca6c732cd4c7b98 | test/misc/test_commands.py | test/misc/test_commands.py | import json
import datetime
from simplekv import fs
from test.base import ApiTestCase
from zou.app.utils import commands
def totimestamp(dt, epoch=datetime.datetime(1970, 1, 1)):
td = dt - epoch
return (td.microseconds + (td.seconds + td.days * 86400) * 10**6) / 10**6
class CommandsTestCase(ApiTestCase):... | Add tests for commands module | Add tests for commands module
| Python | agpl-3.0 | cgwire/zou | Add tests for commands module | import json
import datetime
from simplekv import fs
from test.base import ApiTestCase
from zou.app.utils import commands
def totimestamp(dt, epoch=datetime.datetime(1970, 1, 1)):
td = dt - epoch
return (td.microseconds + (td.seconds + td.days * 86400) * 10**6) / 10**6
class CommandsTestCase(ApiTestCase):... | <commit_before><commit_msg>Add tests for commands module<commit_after> | import json
import datetime
from simplekv import fs
from test.base import ApiTestCase
from zou.app.utils import commands
def totimestamp(dt, epoch=datetime.datetime(1970, 1, 1)):
td = dt - epoch
return (td.microseconds + (td.seconds + td.days * 86400) * 10**6) / 10**6
class CommandsTestCase(ApiTestCase):... | Add tests for commands moduleimport json
import datetime
from simplekv import fs
from test.base import ApiTestCase
from zou.app.utils import commands
def totimestamp(dt, epoch=datetime.datetime(1970, 1, 1)):
td = dt - epoch
return (td.microseconds + (td.seconds + td.days * 86400) * 10**6) / 10**6
class C... | <commit_before><commit_msg>Add tests for commands module<commit_after>import json
import datetime
from simplekv import fs
from test.base import ApiTestCase
from zou.app.utils import commands
def totimestamp(dt, epoch=datetime.datetime(1970, 1, 1)):
td = dt - epoch
return (td.microseconds + (td.seconds + td... | |
71723aecd5466dc7ad9bd27b2f1d2d267e695ff5 | tests/test_kernel_execution.py | tests/test_kernel_execution.py | from parcels import Grid, ScipyParticle, JITParticle, KernelOp
import numpy as np
import pytest
ptype = {'scipy': ScipyParticle, 'jit': JITParticle}
def DoNothing(particle, grid, time, dt):
return KernelOp.SUCCESS
@pytest.fixture
def grid(xdim=20, ydim=20):
""" Standard unit mesh grid """
lon = np.lin... | Add test to verify timestepping and endtimes after execute | Particle: Add test to verify timestepping and endtimes after execute
| Python | mit | OceanPARCELS/parcels,OceanPARCELS/parcels | Particle: Add test to verify timestepping and endtimes after execute | from parcels import Grid, ScipyParticle, JITParticle, KernelOp
import numpy as np
import pytest
ptype = {'scipy': ScipyParticle, 'jit': JITParticle}
def DoNothing(particle, grid, time, dt):
return KernelOp.SUCCESS
@pytest.fixture
def grid(xdim=20, ydim=20):
""" Standard unit mesh grid """
lon = np.lin... | <commit_before><commit_msg>Particle: Add test to verify timestepping and endtimes after execute<commit_after> | from parcels import Grid, ScipyParticle, JITParticle, KernelOp
import numpy as np
import pytest
ptype = {'scipy': ScipyParticle, 'jit': JITParticle}
def DoNothing(particle, grid, time, dt):
return KernelOp.SUCCESS
@pytest.fixture
def grid(xdim=20, ydim=20):
""" Standard unit mesh grid """
lon = np.lin... | Particle: Add test to verify timestepping and endtimes after executefrom parcels import Grid, ScipyParticle, JITParticle, KernelOp
import numpy as np
import pytest
ptype = {'scipy': ScipyParticle, 'jit': JITParticle}
def DoNothing(particle, grid, time, dt):
return KernelOp.SUCCESS
@pytest.fixture
def grid(xdi... | <commit_before><commit_msg>Particle: Add test to verify timestepping and endtimes after execute<commit_after>from parcels import Grid, ScipyParticle, JITParticle, KernelOp
import numpy as np
import pytest
ptype = {'scipy': ScipyParticle, 'jit': JITParticle}
def DoNothing(particle, grid, time, dt):
return Kernel... | |
ad9f701c9e601a0678ee92e980a15bdbd8d18828 | src/metamodels/nig_normal.py | src/metamodels/nig_normal.py | # -*- coding: utf-8 -*-
# Copyright (c) 2015, MIT Probabilistic Computing Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | Add a starting skeleton for NIG-Normal, by copying IID-Normal, mutatis mutandis. | Add a starting skeleton for NIG-Normal, by copying IID-Normal, mutatis mutandis.
| Python | apache-2.0 | probcomp/bayeslite,probcomp/bayeslite | Add a starting skeleton for NIG-Normal, by copying IID-Normal, mutatis mutandis. | # -*- coding: utf-8 -*-
# Copyright (c) 2015, MIT Probabilistic Computing Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | <commit_before><commit_msg>Add a starting skeleton for NIG-Normal, by copying IID-Normal, mutatis mutandis.<commit_after> | # -*- coding: utf-8 -*-
# Copyright (c) 2015, MIT Probabilistic Computing Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | Add a starting skeleton for NIG-Normal, by copying IID-Normal, mutatis mutandis.# -*- coding: utf-8 -*-
# Copyright (c) 2015, MIT Probabilistic Computing Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obta... | <commit_before><commit_msg>Add a starting skeleton for NIG-Normal, by copying IID-Normal, mutatis mutandis.<commit_after># -*- coding: utf-8 -*-
# Copyright (c) 2015, MIT Probabilistic Computing Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in comp... | |
46c17b1aeba9b4928df0c9f0c9057e5bbaf77378 | dp/lcs.py | dp/lcs.py | def lcslen(x, y):
# Allocate extra row and column for the empty sequence case.
# Extra row and column is appended to the end and exploit
# Python's ability of negative indices: x[-1] is the last elem.
c = [[0 for _ in range(len(y) + 1)] for _ in range(len(x) + 1)]
for i, xi in enumerate(x):
... | Add Longest Common Subsequent implementation | Add Longest Common Subsequent implementation
| Python | mit | dzeban/cs,dzeban/cs,dzeban/cs,dzeban/cs | Add Longest Common Subsequent implementation | def lcslen(x, y):
# Allocate extra row and column for the empty sequence case.
# Extra row and column is appended to the end and exploit
# Python's ability of negative indices: x[-1] is the last elem.
c = [[0 for _ in range(len(y) + 1)] for _ in range(len(x) + 1)]
for i, xi in enumerate(x):
... | <commit_before><commit_msg>Add Longest Common Subsequent implementation<commit_after> | def lcslen(x, y):
# Allocate extra row and column for the empty sequence case.
# Extra row and column is appended to the end and exploit
# Python's ability of negative indices: x[-1] is the last elem.
c = [[0 for _ in range(len(y) + 1)] for _ in range(len(x) + 1)]
for i, xi in enumerate(x):
... | Add Longest Common Subsequent implementationdef lcslen(x, y):
# Allocate extra row and column for the empty sequence case.
# Extra row and column is appended to the end and exploit
# Python's ability of negative indices: x[-1] is the last elem.
c = [[0 for _ in range(len(y) + 1)] for _ in range(len(x) +... | <commit_before><commit_msg>Add Longest Common Subsequent implementation<commit_after>def lcslen(x, y):
# Allocate extra row and column for the empty sequence case.
# Extra row and column is appended to the end and exploit
# Python's ability of negative indices: x[-1] is the last elem.
c = [[0 for _ in r... | |
db45d34db6e4c14be226f33a383a4034cc6f7048 | lib/utils.py | lib/utils.py | import re
def find_memtions(content):
regex = re.compile(r"@(?P<username>)(\s|$)", re.I)
return [m.group("username") for m in regex.finditer(content)]
| Add the method for finding names using regular expression matching. | Add the method for finding names using regular expression matching.
| Python | mit | yiyangyi/cc98-tornado | Add the method for finding names using regular expression matching. | import re
def find_memtions(content):
regex = re.compile(r"@(?P<username>)(\s|$)", re.I)
return [m.group("username") for m in regex.finditer(content)]
| <commit_before><commit_msg>Add the method for finding names using regular expression matching.<commit_after> | import re
def find_memtions(content):
regex = re.compile(r"@(?P<username>)(\s|$)", re.I)
return [m.group("username") for m in regex.finditer(content)]
| Add the method for finding names using regular expression matching.import re
def find_memtions(content):
regex = re.compile(r"@(?P<username>)(\s|$)", re.I)
return [m.group("username") for m in regex.finditer(content)]
| <commit_before><commit_msg>Add the method for finding names using regular expression matching.<commit_after>import re
def find_memtions(content):
regex = re.compile(r"@(?P<username>)(\s|$)", re.I)
return [m.group("username") for m in regex.finditer(content)]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.