commit stringlengths 40 40 | old_file stringlengths 4 150 | new_file stringlengths 4 150 | old_contents stringlengths 0 3.26k | new_contents stringlengths 1 4.43k | subject stringlengths 15 501 | message stringlengths 15 4.06k | lang stringclasses 4
values | license stringclasses 13
values | repos stringlengths 5 91.5k | diff stringlengths 0 4.35k |
|---|---|---|---|---|---|---|---|---|---|---|
dcad82d44e08b6f645a1ffc43c9ba22ec4ce8c30 | src/redmill/api/json_.py | src/redmill/api/json_.py | # This file is part of Redmill.
#
# Redmill is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Redmill is distributed in the ho... | Add JSON converter for database objects | Add JSON converter for database objects
| Python | agpl-3.0 | lamyj/redmill,lamyj/redmill,lamyj/redmill | ---
+++
@@ -0,0 +1,47 @@
+# This file is part of Redmill.
+#
+# Redmill is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
... | |
d13927daaa19c8baff06469fd894154bda436593 | code/loader/dblploader/translateJSON2Cypher.py | code/loader/dblploader/translateJSON2Cypher.py | import os
import sys
import json
cypher = "seeds.cql"
for file in os.listdir(os.getcwd()):
if file.find("docentes-") >= 0:
with open(cypher, "a", encoding="utf-8") as fout:
institution = file.split("-")[1].split(".")[0]
fout.write("CREATE(n:Institution {name: '%s'});\n" % instituti... | Convert json with primary author to cypher script format | Convert json with primary author to cypher script format
| Python | mit | arcosta/sci-synergy,arcosta/sci-synergy,arcosta/sci-synergy | ---
+++
@@ -0,0 +1,28 @@
+import os
+import sys
+import json
+
+cypher = "seeds.cql"
+
+for file in os.listdir(os.getcwd()):
+ if file.find("docentes-") >= 0:
+ with open(cypher, "a", encoding="utf-8") as fout:
+ institution = file.split("-")[1].split(".")[0]
+ fout.write("CREATE(n:Ins... | |
35e05afed6d65a2736069ed59a6732eb6b39aa2b | spc/expressions.py | spc/expressions.py | """
The expression language is fully parsed out before passing it to a backend. This
prevents the backend from having to keep excess context in order to understand
the expression. For example, take the following expression:
(+ a (* b (func 1 2 3)))
Compare the nested form:
Add(a, Multiply(b, Call(func, [1, 2... | Add types for describing expression trees | Add types for describing expression trees
| Python | mit | adamnew123456/spc,adamnew123456/spc | ---
+++
@@ -0,0 +1,48 @@
+"""
+The expression language is fully parsed out before passing it to a backend. This
+prevents the backend from having to keep excess context in order to understand
+the expression. For example, take the following expression:
+
+ (+ a (* b (func 1 2 3)))
+
+Compare the nested form:
+
+ ... | |
9ffed9ce7dad6640246510db579c744037d40f88 | motion_tracker/model/eval_model.py | motion_tracker/model/eval_model.py | import os
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
from motion_tracker.model.model import make_model
from motion_tracker.utils.image_generator import AlovGenerator
if __name__ == "__main__":
img_edge_size = 224
backend_id = 'th'
error_analysis_dir = './work/error_analy... | Add analysis and plotting of prediction errors | Add analysis and plotting of prediction errors
| Python | mit | dansbecker/motion-tracking | ---
+++
@@ -0,0 +1,41 @@
+import os
+import pandas as pd
+import seaborn as sns
+from matplotlib import pyplot as plt
+from motion_tracker.model.model import make_model
+from motion_tracker.utils.image_generator import AlovGenerator
+
+if __name__ == "__main__":
+ img_edge_size = 224
+ backend_id = 'th'
+ er... | |
82dece03d2bb5f691873572b2191733008370924 | bluesky/broker_callbacks.py | bluesky/broker_callbacks.py | from dataportal import DataBroker as db
from metadatastore.commands import find_event_descriptors, find_run_starts
def post_run(callback):
"""
Trigger a callback to process all the Documents from a run at the end.
This function does not receive the Document stream during collection.
It retrieves the ... | Add function that run any callback using broker data instead of strema. | ENH: Add function that run any callback using broker data instead of strema.
| Python | bsd-3-clause | klauer/bluesky,ericdill/bluesky,klauer/bluesky,sameera2004/bluesky,ericdill/bluesky,dchabot/bluesky,dchabot/bluesky,sameera2004/bluesky | ---
+++
@@ -0,0 +1,51 @@
+from dataportal import DataBroker as db
+from metadatastore.commands import find_event_descriptors, find_run_starts
+
+
+def post_run(callback):
+ """
+ Trigger a callback to process all the Documents from a run at the end.
+
+ This function does not receive the Document stream duri... | |
57b1a3b2d7871f6f2f81f8300566778d6b28a85c | games/management/commands/checkbanners.py | games/management/commands/checkbanners.py | import os
from django.core.management.base import BaseCommand
from django.conf import settings
from games.models import Game
class Command(BaseCommand):
def handle(self, *args, **kwargs):
games = Game.objects.all()
for game in games:
icon_path = os.path.join(settings.MEDIA_ROOT, game.i... | Add script to check for deleted icon and banners | Add script to check for deleted icon and banners
| Python | agpl-3.0 | Turupawn/website,Turupawn/website,Turupawn/website,lutris/website,lutris/website,Turupawn/website,lutris/website,lutris/website | ---
+++
@@ -0,0 +1,17 @@
+import os
+from django.core.management.base import BaseCommand
+from django.conf import settings
+from games.models import Game
+
+
+class Command(BaseCommand):
+ def handle(self, *args, **kwargs):
+ games = Game.objects.all()
+ for game in games:
+ icon_path = os... | |
f267fd43d405187e526c5c35f2210bc94ea6a334 | vpr/tests/get_material_ids.py | vpr/tests/get_material_ids.py | from django.db import connection
from vpr_storage.views import requestMaterialPDF
from vpr_content.models import Material
def getAllMaterialIDs():
""" """
cursor = connection.cursor()
cursor.execute('select material_id from vpr_content_material')
all_ids = [item[0] for item in cursor.fetchall()]
... | Add script to request creating all material PDFs | Add script to request creating all material PDFs
| Python | agpl-3.0 | voer-platform/vp.repo,voer-platform/vp.repo,voer-platform/vp.repo,voer-platform/vp.repo | ---
+++
@@ -0,0 +1,33 @@
+from django.db import connection
+from vpr_storage.views import requestMaterialPDF
+from vpr_content.models import Material
+
+
+def getAllMaterialIDs():
+ """ """
+ cursor = connection.cursor()
+ cursor.execute('select material_id from vpr_content_material')
+ all_ids = [item[0]... | |
ba1523b7f10000d2c15fca08ef8a0211329af407 | fabfile.py | fabfile.py | #!/usr/bin/env python
# encoding: utf-8
import os
from fabric.api import *
from fabric.contrib.console import confirm
from fabric.contrib.files import exists, upload_template
from fabric.colors import red, green, yellow, blue
env.use_ssh_config = True
env.hosts = ['xdocker']
www_user = 'sysadmin'
www_group = 'sysa... | Add fabric file for deployment | Add fabric file for deployment
| Python | apache-2.0 | XDocker/Engine,XDocker/Engine | ---
+++
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+import os
+
+from fabric.api import *
+from fabric.contrib.console import confirm
+from fabric.contrib.files import exists, upload_template
+from fabric.colors import red, green, yellow, blue
+
+
+env.use_ssh_config = True
+env.hosts = ['xdocker']
... | |
7b629e134ddd8de512a685e8614af08194ce3d4f | CodeFights/isCoolTeam.py | CodeFights/isCoolTeam.py | #!/usr/local/bin/python
# Code Fights Is Cool Team Problem
class Team(object):
def __init__(self, names):
self.names = names
# TO DO
def isCoolTeam(team):
return bool(Team(team))
def main():
tests = [
[["Mark", "Kelly", "Kurt", "Terk"], True],
[["Lucy"], True],
[["... | Set up Code Fights is cool team problem | Set up Code Fights is cool team problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,43 @@
+#!/usr/local/bin/python
+# Code Fights Is Cool Team Problem
+
+
+class Team(object):
+ def __init__(self, names):
+ self.names = names
+
+ # TO DO
+
+
+def isCoolTeam(team):
+ return bool(Team(team))
+
+
+def main():
+ tests = [
+ [["Mark", "Kelly", "Kurt", "Terk"],... | |
577f3000daae488603e21a2c3bb1dc2fd459920b | data/test-biochemists-nb.py | data/test-biochemists-nb.py | import numpy as np
from autoencoder.io import read_text
from autoencoder.network import mlp
count = read_text('biochemists.tsv', header='infer')
y = count[:, 0].astype(int)
x = count[:, 1:]
net = mlp(x.shape[1], output_size=1, hidden_size=(), masking=False, loss_type='nb')
model = net['model']
model.summary()
model.... | Add a simple NB regression test to compare coefficients with R function glm.nb | Add a simple NB regression test to compare coefficients with R function glm.nb
Former-commit-id: 0ab35ca5ae619fc4f9c2233598f4d7563afdf214 | Python | apache-2.0 | theislab/dca,theislab/dca,theislab/dca | ---
+++
@@ -0,0 +1,16 @@
+import numpy as np
+from autoencoder.io import read_text
+from autoencoder.network import mlp
+
+count = read_text('biochemists.tsv', header='infer')
+y = count[:, 0].astype(int)
+x = count[:, 1:]
+
+net = mlp(x.shape[1], output_size=1, hidden_size=(), masking=False, loss_type='nb')
+model =... | |
93a406b5f2ae3fb0027279a4d46bbf310ec7c93b | projects/sdr_paper/pytorch_experiments/analyze_nonzero.py | projects/sdr_paper/pytorch_experiments/analyze_nonzero.py | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2018, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | Add code to show nonzero table | Add code to show nonzero table
| Python | agpl-3.0 | subutai/htmresearch,subutai/htmresearch,numenta/htmresearch,numenta/htmresearch,subutai/htmresearch,numenta/htmresearch,numenta/htmresearch,numenta/htmresearch,subutai/htmresearch,numenta/htmresearch,subutai/htmresearch,numenta/htmresearch,subutai/htmresearch,subutai/htmresearch,subutai/htmresearch,numenta/htmresearch | ---
+++
@@ -0,0 +1,73 @@
+# ----------------------------------------------------------------------
+# Numenta Platform for Intelligent Computing (NuPIC)
+# Copyright (C) 2018, Numenta, Inc. Unless you have an agreement
+# with Numenta, Inc., for a separate license for this software code, the
+# following terms and c... | |
9f2c9bdb1dfcca677b7efd9f22f697c929b4c223 | readthedocs/core/migrations/0005_migrate-old-passwords.py | readthedocs/core/migrations/0005_migrate-old-passwords.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-10-11 17:28
from __future__ import unicode_literals
from django.db import migrations
def forwards_func(apps, schema_editor):
User = apps.get_model('auth', 'User')
old_password_patterns = (
'sha1$',
# RTD's production database does... | Migrate old passwords to be unusable | Migrate old passwords to be unusable
| Python | mit | rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org,rtfd/readthedocs.org | ---
+++
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.16 on 2018-10-11 17:28
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+def forwards_func(apps, schema_editor):
+ User = apps.get_model('auth', 'User')
+
+ old_password_patterns = (
+ 'sha1$',
+... | |
dc0d2e7bed5f58ae11716e95c554af5345af4c43 | devops/makedb.py | devops/makedb.py | import boto.dynamodb
conn = boto.dynamodb.connect_to_region('us-east-1')
table_schema = conn.create_schema(hash_key_name='MAC',hash_key_proto_value=str)
conn.create_table(name='dev-ysniff',schema=table_schema,read_units=10,write_units=10)
| Add script to make database | Add script to make database
| Python | mit | jasonsbrooks/ysniff-software,jasonsbrooks/ysniff-software | ---
+++
@@ -0,0 +1,7 @@
+import boto.dynamodb
+
+conn = boto.dynamodb.connect_to_region('us-east-1')
+
+table_schema = conn.create_schema(hash_key_name='MAC',hash_key_proto_value=str)
+
+conn.create_table(name='dev-ysniff',schema=table_schema,read_units=10,write_units=10) | |
149195845d7062f7ee12f1d59f52c9d4a054c53f | airflow/contrib/operators/gcs_to_gcs.py | airflow/contrib/operators/gcs_to_gcs.py | # -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | Add gcs to gcs copy operator with renaming if required | [AIRFLOW-1842] Add gcs to gcs copy operator with renaming if required
Copies an object from a Google Cloud Storage
bucket to another Google
Cloud Storage bucket, with renaming if required.
Closes #2808 from litdeviant/gcs_to_gcs
| Python | apache-2.0 | MortalViews/incubator-airflow,yk5/incubator-airflow,adamhaney/airflow,apache/airflow,wooga/airflow,lyft/incubator-airflow,malmiron/incubator-airflow,yk5/incubator-airflow,adamhaney/airflow,nathanielvarona/airflow,OpringaoDoTurno/airflow,artwr/airflow,airbnb/airflow,zack3241/incubator-airflow,lyft/incubator-airflow,sid8... | ---
+++
@@ -0,0 +1,68 @@
+# -*- coding: utf-8 -*-
+#
+# 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 la... | |
bcbcf37f4451fa87e89c527e8990181b24e3402c | google-calendar.py | google-calendar.py | import pprint
import pytz
from datetime import datetime, timedelta
import httplib2
from apiclient.discovery import build
from oauth2client.client import SignedJwtAssertionCredentials
with open('privatekey.p12', 'rb') as f:
key = f.read()
service_account_name = '...@developer.gserviceaccount.com'
calendarId = '.... | Add script for printing google calendar events | Add script for printing google calendar events | Python | mit | voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts | ---
+++
@@ -0,0 +1,41 @@
+import pprint
+import pytz
+from datetime import datetime, timedelta
+import httplib2
+
+from apiclient.discovery import build
+from oauth2client.client import SignedJwtAssertionCredentials
+
+
+with open('privatekey.p12', 'rb') as f:
+ key = f.read()
+
+service_account_name = '...@develo... | |
f52ada02a4f0b6e1ca36d56bd3ad16a8c151ae10 | MachineLearning/TensorFlow/LinearRegression.py | MachineLearning/TensorFlow/LinearRegression.py | '''
'''
# Import libraries
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
def generate_points():
# Define number of points to draw
points = 500
# Initalize lists
x_points = []
y_points = []
# Define constanst
a = 0.22
b = 0.78
for i in range(points)... | Add script to build a model by which to predict the values of a dependent variable from the values of one or more independent variables using machine learning techniques with the linear regression algorithm. | feat: Add script to build a model by which to predict the values of a dependent variable from the values of one or more independent variables using machine learning techniques with the linear regression algorithm.
| Python | mit | aguijarro/DataSciencePython | ---
+++
@@ -0,0 +1,43 @@
+'''
+
+'''
+
+# Import libraries
+import numpy as np
+import matplotlib.pyplot as plt
+import tensorflow as tf
+
+
+def generate_points():
+ # Define number of points to draw
+ points = 500
+
+ # Initalize lists
+ x_points = []
+ y_points = []
+
+ # Define constanst
+ a ... | |
6ad3b3372e8cd641ec41bdcf261a1a3018b073d9 | localtv/management/commands/update_one_thumbnail.py | localtv/management/commands/update_one_thumbnail.py | # This file is part of Miro Community.
# Copyright (C) 2010 Participatory Culture Foundation
#
# Miro Community is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at y... | Add celery-oriented management command to update a thumbnail | Add celery-oriented management command to update a thumbnail
| Python | agpl-3.0 | pculture/mirocommunity,pculture/mirocommunity,pculture/mirocommunity,pculture/mirocommunity | ---
+++
@@ -0,0 +1,46 @@
+# This file is part of Miro Community.
+# Copyright (C) 2010 Participatory Culture Foundation
+#
+# Miro Community is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either v... | |
76d196cc428695c9312d0fc052e43326f356c680 | tests/test_helpers.py | tests/test_helpers.py | import unittest
from contextlib import redirect_stdout
from conllu import print_tree
from conllu.tree_helpers import TreeNode
from io import StringIO
class TestPrintTree(unittest.TestCase):
def test_print_simple_treenode(self):
node = TreeNode(data={"id": "X", "deprel": "Y"}, children={})
result ... | Add simple tests for print_tree. | Add simple tests for print_tree.
| Python | mit | EmilStenstrom/conllu | ---
+++
@@ -0,0 +1,20 @@
+import unittest
+from contextlib import redirect_stdout
+
+from conllu import print_tree
+from conllu.tree_helpers import TreeNode
+from io import StringIO
+
+
+class TestPrintTree(unittest.TestCase):
+ def test_print_simple_treenode(self):
+ node = TreeNode(data={"id": "X", "depre... | |
52bfa1015d51ac5835909eb178caf9279530d666 | dipy/denoise/tests/test_denoise.py | dipy/denoise/tests/test_denoise.py | import numpy as np
import numpy.testing as npt
from dipy.denoise.noise_estimate import estimate_sigma
from dipy.denoise.nlmeans import nlmeans
import dipy.data as dpd
import nibabel as nib
def test_denoise():
"""
"""
fdata, fbval, fbvec = dpd.get_data()
data = nib.load(fdata).get_data()
sigma = es... | Verify that output of estimate_sigma is a proper input to nlmeans. | TST: Verify that output of estimate_sigma is a proper input to nlmeans.
| Python | bsd-3-clause | StongeEtienne/dipy,nilgoyyou/dipy,matthieudumont/dipy,matthieudumont/dipy,nilgoyyou/dipy,JohnGriffiths/dipy,StongeEtienne/dipy,FrancoisRheaultUS/dipy,demianw/dipy,FrancoisRheaultUS/dipy,demianw/dipy,JohnGriffiths/dipy,villalonreina/dipy,villalonreina/dipy | ---
+++
@@ -0,0 +1,15 @@
+import numpy as np
+import numpy.testing as npt
+from dipy.denoise.noise_estimate import estimate_sigma
+from dipy.denoise.nlmeans import nlmeans
+import dipy.data as dpd
+import nibabel as nib
+
+def test_denoise():
+ """
+
+ """
+ fdata, fbval, fbvec = dpd.get_data()
+ data = n... | |
ef4730de0a2cf2a5b5c1b5d8c01e3ac35923be49 | dockci/migrations/0004.py | dockci/migrations/0004.py | """
Rename "job" models to "project" models
"""
import py.path
jobs_path = py.path.local().join('data', 'jobs')
projects_path = py.path.local().join('data', 'projects')
jobs_path.move(projects_path)
| Add migration for job -> project rename | Add migration for job -> project rename
| Python | isc | sprucedev/DockCI,sprucedev/DockCI-Agent,sprucedev/DockCI,sprucedev/DockCI,sprucedev/DockCI-Agent,RickyCook/DockCI,RickyCook/DockCI,sprucedev/DockCI,RickyCook/DockCI,RickyCook/DockCI | ---
+++
@@ -0,0 +1,10 @@
+"""
+Rename "job" models to "project" models
+"""
+import py.path
+
+
+jobs_path = py.path.local().join('data', 'jobs')
+projects_path = py.path.local().join('data', 'projects')
+
+jobs_path.move(projects_path) | |
20c95ee7f6e929c05c20fcba5e1a5806c44d69be | maxwellbloch/tests/test_spectral.py | maxwellbloch/tests/test_spectral.py | """
Unit tests for the spectral analysis module.
Thomas Ogden <t@ogden.eu>
"""
import sys
import os
import unittest
from maxwellbloch import mb_solve, spectral
# Absolute path of tests/json directory, so that tests can be called from
# different directories.
JSON_DIR = os.path.abspath(os.path.join(__file__, '../'... | Add test of spectral methods | Add test of spectral methods
| Python | mit | tommyogden/maxwellbloch,tommyogden/maxwellbloch | ---
+++
@@ -0,0 +1,43 @@
+"""
+Unit tests for the spectral analysis module.
+
+Thomas Ogden <t@ogden.eu>
+
+"""
+
+import sys
+import os
+
+import unittest
+
+from maxwellbloch import mb_solve, spectral
+
+# Absolute path of tests/json directory, so that tests can be called from
+# different directories.
+JSON_DIR = ... | |
f7213a2f99ff9134c4b6a3a184c2c03f64e845ab | data_manipulator.py | data_manipulator.py | from keras.utils import np_utils
import numpy as np
def get_labels_number(batches):
size = batches[0]['data'].shape[1]
return size
def get_empty_batch(size):
merged_batch = {'data': np.array([]).reshape(0, size), 'filenames': [], 'labels': []}
return merged_batch
def append_batch(merged_batch, bat... | Add module for data manipulation | Add module for data manipulation
| Python | mit | maciewar/AGH-Deep-Learning-CIFAR10 | ---
+++
@@ -0,0 +1,37 @@
+from keras.utils import np_utils
+import numpy as np
+
+
+def get_labels_number(batches):
+ size = batches[0]['data'].shape[1]
+ return size
+
+
+def get_empty_batch(size):
+ merged_batch = {'data': np.array([]).reshape(0, size), 'filenames': [], 'labels': []}
+ return merged_bat... | |
2764f0dca9b65bad6ea445a51a914eb29122e71c | devil/devil/android/constants/chrome.py | devil/devil/android/constants/chrome.py | # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import collections
PackageInfo = collections.namedtuple(
'PackageInfo',
['package', 'activity', 'cmdline_file', 'devtools_socket', 'test_package'])
... | Add PACKAGE_INFO to devil in Catapult | Add PACKAGE_INFO to devil in Catapult
This CL adds the PACKAGE_INFO in pylib to devil in Catapult.
So adb_profile_chrome can use this in Catapult.
BUG=catapult:#1937
Review URL: https://codereview.chromium.org/1685803002
| Python | bsd-3-clause | catapult-project/catapult,SummerLW/Perf-Insight-Report,benschmaus/catapult,catapult-project/catapult,catapult-project/catapult,SummerLW/Perf-Insight-Report,benschmaus/catapult,benschmaus/catapult,benschmaus/catapult,sahiljain/catapult,benschmaus/catapult,catapult-project/catapult-csm,sahiljain/catapult,sahiljain/catapu... | ---
+++
@@ -0,0 +1,60 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import collections
+
+PackageInfo = collections.namedtuple(
+ 'PackageInfo',
+ ['package', 'activity', 'cmdline_file', ... | |
fc9acded3072a7fc4ebd874b3d4c582a6ae1e2ec | pythonforandroid/recipes/zbarlight/__init__.py | pythonforandroid/recipes/zbarlight/__init__.py | from os.path import join
from pythonforandroid.recipe import PythonRecipe
class ZBarLightRecipe(PythonRecipe):
version = '2.1'
url = 'https://github.com/Polyconseil/zbarlight/archive/{version}.tar.gz' # noqa
call_hostpython_via_targetpython = False
depends = ['setuptools', 'libzbar']
def get... | Add zbarlight recipe (also compatible with python2 and python3) | Add zbarlight recipe (also compatible with python2 and python3)
| Python | mit | germn/python-for-android,rnixx/python-for-android,germn/python-for-android,kronenpj/python-for-android,kivy/python-for-android,rnixx/python-for-android,kivy/python-for-android,rnixx/python-for-android,rnixx/python-for-android,germn/python-for-android,rnixx/python-for-android,kronenpj/python-for-android,PKRoma/python-fo... | ---
+++
@@ -0,0 +1,26 @@
+from os.path import join
+from pythonforandroid.recipe import PythonRecipe
+
+
+class ZBarLightRecipe(PythonRecipe):
+
+ version = '2.1'
+
+ url = 'https://github.com/Polyconseil/zbarlight/archive/{version}.tar.gz' # noqa
+
+ call_hostpython_via_targetpython = False
+
+ depends ... | |
ae056d2f4e6268c371365d23997c81462855f22b | py/elimination-game.py | py/elimination-game.py | class Solution(object):
def lastRemaining(self, n):
"""
:type n: int
:rtype: int
"""
return ((n | 0x55555555555555) & ((1 << (n.bit_length() - 1)) - 1)) + 1
| Add py solution for 390. Elimination Game | Add py solution for 390. Elimination Game
390. Elimination Game: https://leetcode.com/problems/elimination-game/
Approach:
Observe the first item remaining in each step. The value will be added
1 << step either the remaining count is odd or it's a left-to-right
step. Hence the n | 0x55555.. is the key.
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,7 @@
+class Solution(object):
+ def lastRemaining(self, n):
+ """
+ :type n: int
+ :rtype: int
+ """
+ return ((n | 0x55555555555555) & ((1 << (n.bit_length() - 1)) - 1)) + 1 | |
00f3394deca4bcdca4e2158895bf5a5c2a8a879c | senlin/tests/tempest/api/profiles/test_profile_show.py | senlin/tests/tempest/api/profiles/test_profile_show.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | Add API test for profile show | Add API test for profile show
Add API test for profile show
Change-Id: Ie782839c1f4703507f0bfa71817cd96fd7dfc2a4
| Python | apache-2.0 | openstack/senlin,openstack/senlin,stackforge/senlin,openstack/senlin,stackforge/senlin | ---
+++
@@ -0,0 +1,43 @@
+# 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 writi... | |
8f6a51571a38d2cd35d12b40f046a93236e710ad | print-in-color/printer.py | print-in-color/printer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
printer.py: Simple demo of how to print to console using colors.
"""
__author__ = "Breno RdV"
__copyright__ = "Breno RdV @ raccoon.ninja"
__contact__ = "http://raccoon.ninja"
__license__ = "MIT"
__version__ = "01.000"
__maintainer__ = "Breno RdV"
_... | Print to terminal using colors. | Demo: Print to terminal using colors. | Python | mit | brenordv/python-snippets | ---
+++
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+printer.py: Simple demo of how to print to console using colors.
+"""
+
+__author__ = "Breno RdV"
+__copyright__ = "Breno RdV @ raccoon.ninja"
+__contact__ = "http://raccoon.ninja"
+__license__ = "MIT"
+__version__ = "... | |
83458ec4a716aa8827c3ea6edb9d398073bbb93d | aiofcm/errors.py | aiofcm/errors.py | # See https://firebase.google.com/docs/cloud-messaging/xmpp-server-ref
INVALID_JSON = 'INVALID_JSON'
BAD_REGISTRATION = 'BAD_REGISTRATION'
DEVICE_UNREGISTERED = 'DEVICE_UNREGISTERED'
BAD_ACK = 'BAD_ACK'
SERVICE_UNAVAILABLE = 'SERVICE_UNAVAILABLE'
INTERNAL_SERVER_ERROR = 'INTERNAL_SERVER_ERROR'
DEVICE_MESSAGE_RATE_EXCE... | Add module with error code constants | Add module with error code constants
| Python | apache-2.0 | Fatal1ty/aiofcm | ---
+++
@@ -0,0 +1,11 @@
+# See https://firebase.google.com/docs/cloud-messaging/xmpp-server-ref
+
+INVALID_JSON = 'INVALID_JSON'
+BAD_REGISTRATION = 'BAD_REGISTRATION'
+DEVICE_UNREGISTERED = 'DEVICE_UNREGISTERED'
+BAD_ACK = 'BAD_ACK'
+SERVICE_UNAVAILABLE = 'SERVICE_UNAVAILABLE'
+INTERNAL_SERVER_ERROR = 'INTERNAL_SER... | |
aa2f6d9bb400cb696d4d5942d813b9fccb3022b6 | mezzanine/core/management.py | mezzanine/core/management.py |
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth import models as auth_app
from django.db.models.signals import post_syncdb
def create_demo_user(app, created_models, verbosity, db, **kwargs):
if settings.DEBUG and User in created_models:
if verbosity >... | Add a default user when syncdb is called. | Add a default user when syncdb is called.
| Python | bsd-2-clause | promil23/mezzanine,joshcartme/mezzanine,dsanders11/mezzanine,dsanders11/mezzanine,mush42/mezzanine,PegasusWang/mezzanine,sjuxax/mezzanine,SoLoHiC/mezzanine,damnfine/mezzanine,frankchin/mezzanine,orlenko/plei,frankier/mezzanine,christianwgd/mezzanine,orlenko/sfpirg,Cicero-Zhao/mezzanine,vladir/mezzanine,emile2016/mezzan... | ---
+++
@@ -0,0 +1,15 @@
+
+from django.conf import settings
+from django.contrib.auth.models import User
+from django.contrib.auth import models as auth_app
+from django.db.models.signals import post_syncdb
+
+
+def create_demo_user(app, created_models, verbosity, db, **kwargs):
+ if settings.DEBUG and User in cr... | |
755397b519321b6bc5e85535f2f9345ada972196 | tot/utils.py | tot/utils.py |
from opencivicdata.models.people_orgs import Person
def get_current_people(position):
if position == 'senator':
return Person.objects.filter(memberships__organization__name='Florida Senate')
if position == 'representative':
return Person.objects.filter(memberships__organization__name='Flori... | Add start of util function that will return current people | Add start of util function that will return current people
| Python | mit | jamesturk/tot,jamesturk/tot,jamesturk/tot,jamesturk/tot,jamesturk/tot | ---
+++
@@ -0,0 +1,11 @@
+
+
+from opencivicdata.models.people_orgs import Person
+
+
+def get_current_people(position):
+
+ if position == 'senator':
+ return Person.objects.filter(memberships__organization__name='Florida Senate')
+ if position == 'representative':
+ return Person.objects.filter(... | |
409350557b8b32a1bbe67ea418c3cb043097fd03 | examples/grad/16-force_scan.py | examples/grad/16-force_scan.py | #!/usr/bin/env python
'''
Scan molecule dissociation curve and the force on the curve.
'''
import numpy as np
import matplotlib.pyplot as plt
from pyscf import gto, dft
bond = np.arange(0.8, 5.0, .1)
energy = []
force = []
mol = gto.Mole(atom=[['N', 0, 0, -0.4],
['N', 0, 0, 0.4]],
... | Add example for nuclear gradients | Add example for nuclear gradients
| Python | apache-2.0 | sunqm/pyscf,gkc1000/pyscf,sunqm/pyscf,sunqm/pyscf,gkc1000/pyscf,gkc1000/pyscf,gkc1000/pyscf,gkc1000/pyscf,sunqm/pyscf | ---
+++
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+
+'''
+Scan molecule dissociation curve and the force on the curve.
+'''
+
+import numpy as np
+import matplotlib.pyplot as plt
+
+from pyscf import gto, dft
+
+bond = np.arange(0.8, 5.0, .1)
+energy = []
+force = []
+mol = gto.Mole(atom=[['N', 0, 0, -0.4],
+ ... | |
91535fcab34a4f85e5da4f057f9030ee2d6708db | Discord/cogs/tweepy.py | Discord/cogs/tweepy.py |
from discord import app_commands
from discord.ext import commands
async def setup(bot):
await bot.add_cog(Tweepy())
class Tweepy(commands.Cog, app_commands.Group):
"""Tweepy"""
| Add Tweepy cog and application command group | [Discord] Add Tweepy cog and application command group
| Python | mit | Harmon758/Harmonbot,Harmon758/Harmonbot | ---
+++
@@ -0,0 +1,11 @@
+
+from discord import app_commands
+from discord.ext import commands
+
+
+async def setup(bot):
+ await bot.add_cog(Tweepy())
+
+
+class Tweepy(commands.Cog, app_commands.Group):
+ """Tweepy""" | |
27dfdd2c646dbcaaad80af7aed72e3053c42efad | tensor2tensor/trax/models/research/__init__.py | tensor2tensor/trax/models/research/__init__.py | # coding=utf-8
# Copyright 2019 The Tensor2Tensor Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | Add init Trax research models. | Add init Trax research models.
PiperOrigin-RevId: 247220362
| Python | apache-2.0 | tensorflow/tensor2tensor,tensorflow/tensor2tensor,tensorflow/tensor2tensor,tensorflow/tensor2tensor,tensorflow/tensor2tensor | ---
+++
@@ -0,0 +1,15 @@
+# coding=utf-8
+# Copyright 2019 The Tensor2Tensor Authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.... | |
9d0edb3c9a937e6346d03482d8544ce7a411a0d2 | tests/twisted/roster/request-never-answered-2.py | tests/twisted/roster/request-never-answered-2.py | """
Exhibit a bug where RequestChannel times out when requesting a group channel
after the roster has been received.
"""
import dbus
from gabbletest import exec_test, sync_stream
from servicetest import sync_dbus, call_async
HT_CONTACT_LIST = 3
HT_GROUP = 4
def test(q, bus, conn, stream):
conn.Connect()
# q... | Add a test for the reverse of request-never-answered.py | Add a test for the reverse of request-never-answered.py
When the race in test-group-race.py had the wrong result, it triggered a
bug in the requestotronned roster code.
| Python | lgpl-2.1 | community-ssu/telepathy-gabble,mlundblad/telepathy-gabble,Ziemin/telepathy-gabble,community-ssu/telepathy-gabble,jku/telepathy-gabble,jku/telepathy-gabble,mlundblad/telepathy-gabble,Ziemin/telepathy-gabble,Ziemin/telepathy-gabble,mlundblad/telepathy-gabble,Ziemin/telepathy-gabble,community-ssu/telepathy-gabble,communit... | ---
+++
@@ -0,0 +1,45 @@
+"""
+Exhibit a bug where RequestChannel times out when requesting a group channel
+after the roster has been received.
+"""
+
+import dbus
+
+from gabbletest import exec_test, sync_stream
+from servicetest import sync_dbus, call_async
+
+HT_CONTACT_LIST = 3
+HT_GROUP = 4
+
+def test(q, bus, ... | |
6a223a5b8b82db40121bdfe296af471463d31184 | examples/image_fromarray.py | examples/image_fromarray.py | """Create a nifti image from a numpy array and an affine transform."""
from os import path
import numpy as np
from neuroimaging.core.api import fromarray, save_image, load_image, \
Affine, CoordinateMap
# Imports used just for development and testing. User's typically
# would not uses these when creating an im... | Add example for creating an image from an array and an affine. | Add example for creating an image from an array and an affine. | Python | bsd-3-clause | yarikoptic/NiPy-OLD,yarikoptic/NiPy-OLD | ---
+++
@@ -0,0 +1,63 @@
+"""Create a nifti image from a numpy array and an affine transform."""
+
+from os import path
+
+import numpy as np
+
+from neuroimaging.core.api import fromarray, save_image, load_image, \
+ Affine, CoordinateMap
+
+# Imports used just for development and testing. User's typically
+# wo... | |
d75c8c01c57c0223bfb75f9a7b2ddb9087476d38 | agithub_test.py | agithub_test.py | #!/usr/bin/env python
import agithub
import unittest
class TestGithubObjectCreation(unittest.TestCase):
def test_user_pw(self):
gh = agithub.Github('korfuri', '1234')
self.assertTrue(gh is not None)
gh = agithub.Github(username='korfuri', password='1234')
self.assertTrue(gh is not ... | Add unittests for Github object creation scenarios. | Add unittests for Github object creation scenarios.
Simply run with `./agithub_test.py`.
| Python | mit | mozilla/agithub,jpaugh/agithub | ---
+++
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+import agithub
+import unittest
+
+class TestGithubObjectCreation(unittest.TestCase):
+ def test_user_pw(self):
+ gh = agithub.Github('korfuri', '1234')
+ self.assertTrue(gh is not None)
+
+ gh = agithub.Github(username='korfuri', password='1234... | |
989ea42f13d0e7b6952aaf84ee422851628a98ec | plugins/dicom_viewer/server/event_helper.py | plugins/dicom_viewer/server/event_helper.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware Inc.
#
# Licensed under the Apache License, Version 2.0 ( the "License" );
# you may not use this file except in compliance with the License.
# You may obtain a copy of ... | Add a helper class to wait for event handlers to complete | Add a helper class to wait for event handlers to complete
| Python | apache-2.0 | Kitware/girder,jbeezley/girder,RafaelPalomar/girder,Kitware/girder,data-exp-lab/girder,RafaelPalomar/girder,girder/girder,Xarthisius/girder,manthey/girder,RafaelPalomar/girder,data-exp-lab/girder,kotfic/girder,kotfic/girder,Xarthisius/girder,data-exp-lab/girder,girder/girder,Kitware/girder,Kitware/girder,manthey/girder... | ---
+++
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+###############################################################################
+# Copyright Kitware Inc.
+#
+# Licensed under the Apache License, Version 2.0 ( the "License" );
+# you may not use this file except in compliance with the Li... | |
7fc860c0480c5269d812950bc3e738564cb5577c | tests/test_bot_filter.py | tests/test_bot_filter.py | import pytest
import responses
from instabot.api.config import API_URL
from .test_bot import TestBot
from .test_variables import TEST_USERNAME_INFO_ITEM
class TestBotFilter(TestBot):
@pytest.mark.parametrize('filter_users,filter_business_accounts,filter_verified_accounts,expected', [
(False, False, Fals... | Add test on check user with filter users, business and verified | Add test on check user with filter users, business and verified
| Python | apache-2.0 | instagrambot/instabot,instagrambot/instabot,ohld/instabot | ---
+++
@@ -0,0 +1,40 @@
+import pytest
+import responses
+
+from instabot.api.config import API_URL
+
+from .test_bot import TestBot
+from .test_variables import TEST_USERNAME_INFO_ITEM
+
+
+class TestBotFilter(TestBot):
+ @pytest.mark.parametrize('filter_users,filter_business_accounts,filter_verified_accounts,ex... | |
a2c006a2ce5524a9d4afdd9086fa3c76704cae08 | bashlint.py | bashlint.py | #!/usr/bin/env python
import os
from fnmatch import fnmatch
def filename_match(filename, patterns, default=True):
"""Check if patterns contains a pattern that matches filename.
If patterns is not specified, this always returns True.
"""
if not patterns:
return default
return any(fnmatc... | Implement shell files searching by pattern | Implement shell files searching by pattern
Change-Id: I6bd6743a1b9f15fd704dfa38b1cce34b5948f0df
| Python | mit | skudriashev/bashlint | ---
+++
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+
+import os
+
+from fnmatch import fnmatch
+
+
+def filename_match(filename, patterns, default=True):
+ """Check if patterns contains a pattern that matches filename.
+
+ If patterns is not specified, this always returns True.
+ """
+ if not patterns:
+ ... | |
cbc08671019a62e9840d6f0decf9b883eb2eeec4 | binary_search.py | binary_search.py | from __future__ import division
def recursive_binary_search(sorted_sequence, key, start=0, end=None):
'''Returns the index of `key` in the `sorted_sequence`, or None if `key` is
not in `sorted_sequence`.'''
end = end or len(sorted_sequence)
if (end - start) < 0:
return None
middle = star... | Add Python binary search implementation (recursive and iterative) | Add Python binary search implementation (recursive and iterative)
| Python | mit | gg/algorithms,gg/algorithms,gg/algorithms | ---
+++
@@ -0,0 +1,47 @@
+from __future__ import division
+
+
+def recursive_binary_search(sorted_sequence, key, start=0, end=None):
+ '''Returns the index of `key` in the `sorted_sequence`, or None if `key` is
+ not in `sorted_sequence`.'''
+ end = end or len(sorted_sequence)
+
+ if (end - start) < 0:
+ ... | |
93c8b63df4794765164f3a50f48230121cb334c0 | python/np_types.py | python/np_types.py | #!/usr/in/env python
# -*- coding: utf-8 -*-
import numpy as np
# TODO: generate following sizes with templates
state_size = 4
input_size = 2
output_size = 2
second_order_size = 2
natural_t = np.int32
real_t = np.float64
state_t = (real_t, (state_size, 1))
input_t = (real_t, (input_size, 1))
output_t = (real_t, (ou... | Add Python data types for sample data | Add Python data types for sample data
| Python | bsd-2-clause | oliverlee/bicycle,oliverlee/bicycle | ---
+++
@@ -0,0 +1,59 @@
+#!/usr/in/env python
+# -*- coding: utf-8 -*-
+import numpy as np
+
+
+# TODO: generate following sizes with templates
+state_size = 4
+input_size = 2
+output_size = 2
+second_order_size = 2
+
+natural_t = np.int32
+real_t = np.float64
+
+state_t = (real_t, (state_size, 1))
+input_t = (real_... | |
346aa9624092483de1fe28878c90ab7fdbaa543f | organize/migrations/0005_auto_20170120_1810.py | organize/migrations/0005_auto_20170120_1810.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-20 18:10
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('organize', '0004_auto_20170116_1808'),
]
operations = [
migrations.AlterFie... | Add defaults to last name of organizers | Add defaults to last name of organizers
| Python | bsd-3-clause | patjouk/djangogirls,DjangoGirls/djangogirls,DjangoGirls/djangogirls,DjangoGirls/djangogirls,patjouk/djangogirls,patjouk/djangogirls,patjouk/djangogirls | ---
+++
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.5 on 2017-01-20 18:10
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('organize', '0004_auto_20170116_1808'),
+ ]
+
+ o... | |
6b8554bca4be17bc2b9fdcf2bb2f349900d2b4cb | rdmo/core/management/commands/make_theme.py | rdmo/core/management/commands/make_theme.py | from django.apps import apps
from django.core.management.base import BaseCommand
import os.path
import re
from shutil import copyfile
class Command(BaseCommand):
def get_folders(self):
rdmo_core = os.path.join(apps.get_app_config('rdmo').path, 'core')
rdmo_app_theme = os.path.join(os.getcwd(), 't... | Add make theme manage script | Add make theme manage script
| Python | apache-2.0 | rdmorganiser/rdmo,DMPwerkzeug/DMPwerkzeug,DMPwerkzeug/DMPwerkzeug,DMPwerkzeug/DMPwerkzeug,rdmorganiser/rdmo,rdmorganiser/rdmo | ---
+++
@@ -0,0 +1,61 @@
+from django.apps import apps
+from django.core.management.base import BaseCommand
+import os.path
+import re
+
+from shutil import copyfile
+
+
+class Command(BaseCommand):
+ def get_folders(self):
+ rdmo_core = os.path.join(apps.get_app_config('rdmo').path, 'core')
+ rdmo_a... | |
12ff38555ac735fca4a7585767b006dbf5e15ca9 | groups/tests/test_apps_base.py | groups/tests/test_apps_base.py | from unittest import mock
from django.test import TestCase
import groups # Needed for instantiating AppConfig classes.
from groups import _apps_base
from groups.admin import GroupAdmin
from groups.models import Group
class TestAdminRegisteringAppConfig(TestCase):
def setUp(self):
"""
Create an ... | Add a test for AdminRegisteringAppConfig. | Add a test for AdminRegisteringAppConfig.
| Python | bsd-2-clause | incuna/incuna-groups,incuna/incuna-groups | ---
+++
@@ -0,0 +1,46 @@
+from unittest import mock
+
+from django.test import TestCase
+
+import groups # Needed for instantiating AppConfig classes.
+from groups import _apps_base
+from groups.admin import GroupAdmin
+from groups.models import Group
+
+
+class TestAdminRegisteringAppConfig(TestCase):
+ def setU... | |
7d5eb61423c8538698a65efca8522aa0fbda17c6 | curiosity/plugins/fuyu.py | curiosity/plugins/fuyu.py | import curio
from curious.commands import command
from curious.commands.context import Context
from curious.commands.plugin import Plugin
from curious.dataclasses import Member
def has_admin(ctx: Context):
return ctx.channel.permissions(ctx.author).administrator
class Fuyu(Plugin):
"""
Commands for my ... | Add plugin for my server. | Add plugin for my server.
| Python | mit | SunDwarf/curiosity | ---
+++
@@ -0,0 +1,67 @@
+import curio
+
+from curious.commands import command
+from curious.commands.context import Context
+from curious.commands.plugin import Plugin
+from curious.dataclasses import Member
+
+
+def has_admin(ctx: Context):
+ return ctx.channel.permissions(ctx.author).administrator
+
+
+class Fu... | |
77a6da686e4def9548ac59de9eace929a4332fca | Python/prims_mst.py | Python/prims_mst.py | # Prim's algorithm is a greedy algorithm that
# finds a minimum spanning tree
# for a weighted undirected graph.
#
# Time complexity: O(m * n)
# Input Format:
# First line has two integers, denoting the number of nodes in the graph and
# denoting the number of edges in the graph.
# The next lines each consist of thre... | Add Prim's algorithm for finding MST | Add Prim's algorithm for finding MST
| Python | mit | saru95/DSA,saru95/DSA,saru95/DSA,saru95/DSA,saru95/DSA | ---
+++
@@ -0,0 +1,46 @@
+# Prim's algorithm is a greedy algorithm that
+# finds a minimum spanning tree
+# for a weighted undirected graph.
+#
+# Time complexity: O(m * n)
+
+# Input Format:
+# First line has two integers, denoting the number of nodes in the graph and
+# denoting the number of edges in the graph.
+#... | |
69b546df0fe93377e420e62b29e0666b558cde19 | demo/producer_consumer.py | demo/producer_consumer.py | from sparts.tasks.periodic import PeriodicTask
from sparts.tasks.queue import QueueTask
from sparts.vservice import VService
import random
import threading
class Producer(PeriodicTask):
INTERVAL = 1.0
def initTask(self):
super(Producer, self).initTask()
self.consumer = self.service.requireTas... | Add a "producer consumer" demo using QueueTask and PeriodicTask | Add a "producer consumer" demo using QueueTask and PeriodicTask
| Python | bsd-3-clause | djipko/sparts,fmoo/sparts,pshuff/sparts,fmoo/sparts,bboozzoo/sparts,facebook/sparts,djipko/sparts,facebook/sparts,bboozzoo/sparts,pshuff/sparts | ---
+++
@@ -0,0 +1,33 @@
+from sparts.tasks.periodic import PeriodicTask
+from sparts.tasks.queue import QueueTask
+from sparts.vservice import VService
+import random
+import threading
+
+
+class Producer(PeriodicTask):
+ INTERVAL = 1.0
+
+ def initTask(self):
+ super(Producer, self).initTask()
+ ... | |
fbb93749870b1ba9a228afa7c1bc1791ca449dca | gittaggers.py | gittaggers.py | from setuptools.command.egg_info import egg_info
import subprocess
import time
class EggInfoFromGit(egg_info):
"""Tag the build with git commit timestamp.
If a build tag has already been set (e.g., "egg_info -b", building
from source package), leave it alone.
"""
def git_timestamp_tag(self):
... | from setuptools.command.egg_info import egg_info
import subprocess
import time
class EggInfoFromGit(egg_info):
"""Tag the build with git commit timestamp.
If a build tag has already been set (e.g., "egg_info -b", building
from source package), leave it alone.
"""
def git_timestamp_tag(self):
... | Fix Python packaging to use correct git log for package time/version stamps (2nd try) | Fix Python packaging to use correct git log for package time/version stamps (2nd try)
| Python | apache-2.0 | chapmanb/cwltool,dleehr/cwltool,jeremiahsavage/cwltool,SciDAP/cwltool,chapmanb/cwltool,SciDAP/cwltool,dleehr/cwltool,dleehr/cwltool,dleehr/cwltool,common-workflow-language/cwltool,jeremiahsavage/cwltool,chapmanb/cwltool,jeremiahsavage/cwltool,SciDAP/cwltool,common-workflow-language/cwltool,jeremiahsavage/cwltool,chapma... | ---
+++
@@ -11,7 +11,7 @@
def git_timestamp_tag(self):
gitinfo = subprocess.check_output(
['git', 'log', '--first-parent', '--max-count=1',
- '--format=format:%ct', '..']).strip()
+ '--format=format:%ct']).strip()
return time.strftime('.%Y%m%d%H%M%S', time.g... |
4fd470ad2aa5e6c075e2d34667908401f4284f70 | openfda3/server_opnfda.py | openfda3/server_opnfda.py | import http.server
import json
import socketserver
PORT = 8000
# HTTPRequestHandler class
class testHTTPRequestHandler(http.server.BaseHTTPRequestHandler):
# GET
def do_GET(self):
headers = {'User-Agent': 'http-client'}
conn = http.client.HTTPSConnection("api.fda.gov")
# Get a https... | Add first version of openfda3 | Add first version of openfda3
| Python | apache-2.0 | acs-test/openfda,acs-test/openfda | ---
+++
@@ -0,0 +1,68 @@
+import http.server
+import json
+import socketserver
+
+PORT = 8000
+
+# HTTPRequestHandler class
+class testHTTPRequestHandler(http.server.BaseHTTPRequestHandler):
+ # GET
+ def do_GET(self):
+ headers = {'User-Agent': 'http-client'}
+
+ conn = http.client.HTTPSConnectio... | |
bc8a8686d601bb0d1890e3eacbf7430bbdb50b3c | CodeFights/digitDegree.py | CodeFights/digitDegree.py | #!/usr/local/bin/python
# Code Fights Digits Degree Problem
def digitsDegree(n):
degree = 0
if n < 10:
return 0
while n > 0:
dig = n % 10
n = n // 10
if dig > 0:
degree += 1
return degree
def main():
tests = [
[5, 0],
[100, 1],
... | Solve Code Fights digits degree problem | Solve Code Fights digits degree problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,37 @@
+#!/usr/local/bin/python
+# Code Fights Digits Degree Problem
+
+
+def digitsDegree(n):
+ degree = 0
+ if n < 10:
+ return 0
+ while n > 0:
+ dig = n % 10
+ n = n // 10
+ if dig > 0:
+ degree += 1
+ return degree
+
+
+def main():
+ tests =... | |
c1412a5aac7c0917917e058ff5e7dab11ab48e8e | pyeda/gvmagic.py | pyeda/gvmagic.py | """
Graphviz IPython magic extensions
Magic methods:
%dot <dot graph>
%%dot <dot ...
... graph>
%dotstr "<dot graph>"
%dotobj obj.to_dot()
%dotobjs obj[0].to_dot(), obj[1].to_dot(), ...
Usage:
%load_ext gvmagic
"""
from subprocess import Popen, PIPE
from IPython.core.display import disp... | Add Graphviz magic methods module | Add Graphviz magic methods module
| Python | bsd-2-clause | pombredanne/pyeda,karissa/pyeda,cjdrake/pyeda,sschnug/pyeda,sschnug/pyeda,karissa/pyeda,cjdrake/pyeda,sschnug/pyeda,karissa/pyeda,pombredanne/pyeda,GtTmy/pyeda,cjdrake/pyeda,pombredanne/pyeda,GtTmy/pyeda,GtTmy/pyeda | ---
+++
@@ -0,0 +1,83 @@
+"""
+Graphviz IPython magic extensions
+
+Magic methods:
+ %dot <dot graph>
+ %%dot <dot ...
+ ... graph>
+ %dotstr "<dot graph>"
+ %dotobj obj.to_dot()
+ %dotobjs obj[0].to_dot(), obj[1].to_dot(), ...
+
+Usage:
+
+ %load_ext gvmagic
+"""
+
+from subprocess import Popen,... | |
37a42a6e344c0ff030353c13c6bf6a1717eefbaa | test/integration_tests/python/test_gears.py | test/integration_tests/python/test_gears.py | import json
import logging
log = logging.getLogger(__name__)
sh = logging.StreamHandler()
log.addHandler(sh)
def test_gear_add(as_admin):
r = as_admin.post('/gears/test-case-gear', json={
"category" : "converter",
"gear" : {
"inputs" : {
"wat" : {
"... | Add example test case in python | Add example test case in python
| Python | mit | scitran/api,scitran/core,scitran/core,scitran/core,scitran/core,scitran/api | ---
+++
@@ -0,0 +1,41 @@
+import json
+import logging
+
+log = logging.getLogger(__name__)
+sh = logging.StreamHandler()
+log.addHandler(sh)
+
+
+def test_gear_add(as_admin):
+ r = as_admin.post('/gears/test-case-gear', json={
+ "category" : "converter",
+ "gear" : {
+ "inputs" : {
+ ... | |
060ee041b6f7b0cf7748b11869665183f6656357 | fluent_contents/plugins/markup/migrations/0002_fix_polymorphic_ctype.py | fluent_contents/plugins/markup/migrations/0002_fix_polymorphic_ctype.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
from django.db import models, migrations
def _forwards(apps, schema_editor):
"""
Make sure that the MarkupItem model actually points
to the correct proxy model, that implements the given language.
"""
# Need to work on the... | Make sure MarkupItem is stored under it's proxy class type ID | Make sure MarkupItem is stored under it's proxy class type ID
This is needed for proper formset saving/retrieval,
in combination with django-polymorphic 1.4-git
| Python | apache-2.0 | edoburu/django-fluent-contents,edoburu/django-fluent-contents,django-fluent/django-fluent-contents,edoburu/django-fluent-contents,django-fluent/django-fluent-contents,django-fluent/django-fluent-contents | ---
+++
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+import sys
+from django.db import models, migrations
+
+
+def _forwards(apps, schema_editor):
+ """
+ Make sure that the MarkupItem model actually points
+ to the correct proxy model, that implements the given langu... | |
1f4b525aa93421b890dde2181f02b4445683fd08 | toolbox/stack_to_h5.py | toolbox/stack_to_h5.py | import vigra
import argparse
def convert_to_volume(options):
data = vigra.impex.readVolume(options.input_file)
print("Saving h5 volume of shape {}".format(data.shape))
vigra.writeHDF5(data, options.output_file, options.output_path)
if __name__ == "__main__":
parser = argparse.ArgumentParser(descriptio... | Add short script to create a raw hdf5 file from a tiff stack | Add short script to create a raw hdf5 file from a tiff stack
| Python | mit | chaubold/hytra,chaubold/hytra,chaubold/hytra | ---
+++
@@ -0,0 +1,23 @@
+import vigra
+import argparse
+
+def convert_to_volume(options):
+ data = vigra.impex.readVolume(options.input_file)
+ print("Saving h5 volume of shape {}".format(data.shape))
+ vigra.writeHDF5(data, options.output_file, options.output_path)
+
+if __name__ == "__main__":
+ parser... | |
e30a19d1b72acec4587ddfe85096a6db43b8c7ff | tools/rebuild-index.py | tools/rebuild-index.py | # Rebuild asset indices
# Usage: python3 rebuild-index.py in the project root
import io
import json
import pathlib
index = {}
try:
stream = open("assets/index.json")
index = json.loads(stream.readall())
except Exception:
pass
# An index is a dictionary from filename to a structure:
# "filename" : { "timestamp... | Add script to update index | Add script to update index
| Python | agpl-3.0 | nagakawa/x801,nagakawa/x801,nagakawa/x801,nagakawa/x801,nagakawa/x801 | ---
+++
@@ -0,0 +1,30 @@
+# Rebuild asset indices
+# Usage: python3 rebuild-index.py in the project root
+
+import io
+import json
+import pathlib
+
+index = {}
+
+try:
+ stream = open("assets/index.json")
+ index = json.loads(stream.readall())
+except Exception:
+ pass
+
+# An index is a dictionary from filename ... | |
72ee5d6949f25158b6cbd1deead45ee1e939be5b | sympy/series/__init__.py | sympy/series/__init__.py | """A module that handles series: find a limit, order the series etc.
"""
from order import Order
from limits import limit, Limit
from gruntz import gruntz
from series import series
O = Order
__all__ = [gruntz, limit, series, O, Order, Limit]
| """A module that handles series: find a limit, order the series etc.
"""
from order import Order
from limits import limit, Limit
from gruntz import gruntz
from series import series
O = Order
__all__ = ['gruntz', 'limit', 'series', 'O', 'Order', 'Limit']
| Fix __all__ usage for sympy/series | Fix __all__ usage for sympy/series
| Python | bsd-3-clause | hargup/sympy,Arafatk/sympy,chaffra/sympy,kaushik94/sympy,atreyv/sympy,jbbskinny/sympy,aktech/sympy,AunShiLord/sympy,AkademieOlympia/sympy,beni55/sympy,jerli/sympy,vipulroxx/sympy,Titan-C/sympy,yukoba/sympy,minrk/sympy,Shaswat27/sympy,abloomston/sympy,yashsharan/sympy,shipci/sympy,drufat/sympy,jerli/sympy,toolforger/sym... | ---
+++
@@ -7,4 +7,4 @@
O = Order
-__all__ = [gruntz, limit, series, O, Order, Limit]
+__all__ = ['gruntz', 'limit', 'series', 'O', 'Order', 'Limit'] |
3df9b3962dbade0175b2bdade04dd709fd69fef2 | core/admin/migrations/versions/f1393877871d_.py | core/admin/migrations/versions/f1393877871d_.py | """ Add default columns to the configuration table
Revision ID: f1393877871d
Revises: 546b04c886f0
Create Date: 2018-12-09 16:15:42.317104
"""
# revision identifiers, used by Alembic.
revision = 'f1393877871d'
down_revision = '546b04c886f0'
from alembic import op
import sqlalchemy as sa
def upgrade():
with op... | Add default columns to the configuration table | Add default columns to the configuration table
| Python | mit | kaiyou/freeposte.io,kaiyou/freeposte.io,kaiyou/freeposte.io,kaiyou/freeposte.io | ---
+++
@@ -0,0 +1,28 @@
+""" Add default columns to the configuration table
+
+Revision ID: f1393877871d
+Revises: 546b04c886f0
+Create Date: 2018-12-09 16:15:42.317104
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = 'f1393877871d'
+down_revision = '546b04c886f0'
+
+from alembic import op
+import sqla... | |
5766e412c18d8b049a48b54e1244a735845055b1 | scripts/migrate_addons.py | scripts/migrate_addons.py | import logging
from nose.tools import *
from tests.base import OsfTestCase
from tests.factories import NodeFactory
from website.app import init_app
from website.project.model import Node
logger = logging.getLogger(__name__)
def main():
init_app()
migrate_nodes()
def migrate_addons(node):
ret = False
... | Add migration for wiki and osffiles addons | Add migration for wiki and osffiles addons
| Python | apache-2.0 | himanshuo/osf.io,CenterForOpenScience/osf.io,caneruguz/osf.io,Ghalko/osf.io,laurenrevere/osf.io,monikagrabowska/osf.io,mattclark/osf.io,GageGaskins/osf.io,danielneis/osf.io,brianjgeiger/osf.io,kushG/osf.io,acshi/osf.io,himanshuo/osf.io,pattisdr/osf.io,njantrania/osf.io,baylee-d/osf.io,doublebits/osf.io,GageGaskins/osf.... | ---
+++
@@ -0,0 +1,71 @@
+import logging
+
+from nose.tools import *
+
+from tests.base import OsfTestCase
+from tests.factories import NodeFactory
+
+from website.app import init_app
+from website.project.model import Node
+
+logger = logging.getLogger(__name__)
+
+
+def main():
+ init_app()
+ migrate_nodes()
... | |
8e285914db46c2acc67e455eb09100ed1d39b32e | rmq_utils/common.py | rmq_utils/common.py | from pyrabbit.api import Client
from exceptions import InvalidUser
def connect_to_management_api(host, user, password):
client = Client(host, user, password)
if not client.has_admin_rights:
raise InvalidUser('User must have admin rights')
return client
| Connect to the management API | Connect to the management API
| Python | mit | projectweekend/RMQ-Utils | ---
+++
@@ -0,0 +1,10 @@
+from pyrabbit.api import Client
+
+from exceptions import InvalidUser
+
+
+def connect_to_management_api(host, user, password):
+ client = Client(host, user, password)
+ if not client.has_admin_rights:
+ raise InvalidUser('User must have admin rights')
+ return client | |
bfa56bf9ee0e66d397652db0750a0c99c4437082 | hevector.py | hevector.py |
INNER_PRODUCT = '*'
ADD = '+'
def tupleToVec(t):
if type(t) is int: return str(t)
return '[%s]' % ' '.join(map(tupleToVec,t))
def vecToTuple(v):
return tuple(map(int, v.strip('[]').split()))
def send(ops):
return '\n'.join(v if type(v) is str else tupleToVec(v) for v in ops)
def recv(output):
return tuple(vec... | Add initial python vector interface. | Add initial python vector interface.
| Python | mit | jamespayor/vector-homomorphic-encryption,jamespayor/vector-homomorphic-encryption,jamespayor/vector-homomorphic-encryption | ---
+++
@@ -0,0 +1,32 @@
+
+INNER_PRODUCT = '*'
+ADD = '+'
+
+def tupleToVec(t):
+ if type(t) is int: return str(t)
+ return '[%s]' % ' '.join(map(tupleToVec,t))
+
+def vecToTuple(v):
+ return tuple(map(int, v.strip('[]').split()))
+
+def send(ops):
+ return '\n'.join(v if type(v) is str else tupleToVec(v) for v in o... | |
138bb2b3e1188463d88edb176e26c1c2f633207d | entity_history/migrations/0003_update_triggers.py | entity_history/migrations/0003_update_triggers.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from entity_history.sql.triggers import EntityActivationTrigger, EntityRelationshipActivationTrigger
def refresh_entity_activation_trigger(*args, **kwargs):
EntityActivationTrigger().disable()
EntityActiv... | Add a migration for updating the triggers | Add a migration for updating the triggers
| Python | mit | ambitioninc/django-entity-history,jaredlewis/django-entity-history | ---
+++
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+from entity_history.sql.triggers import EntityActivationTrigger, EntityRelationshipActivationTrigger
+
+
+def refresh_entity_activation_trigger(*args, **kwargs):
+ EntityActivatio... | |
11ae4f118f00e053d882340eb2c031234fce60bd | lin_reg_gradient_desc.py | lin_reg_gradient_desc.py | # Implementing Gradient Descent using TensorFlow
import numpy as np
import tensorflow as tf
from sklearn.datasets import fetch_california_housing
from sklearn.preprocessing import StandardScaler
# Get data
housing = fetch_california_housing()
m, n = housing.data.shape
# Learning parameters
n_epochs = 2500
learning_r... | Complete linear regression using TF | Complete linear regression using TF
Linear regression using gradient descent
| Python | mit | KT12/hands_on_machine_learning | ---
+++
@@ -0,0 +1,47 @@
+# Implementing Gradient Descent using TensorFlow
+
+import numpy as np
+import tensorflow as tf
+from sklearn.datasets import fetch_california_housing
+from sklearn.preprocessing import StandardScaler
+
+# Get data
+housing = fetch_california_housing()
+m, n = housing.data.shape
+
+# Learnin... | |
9773aea7e75fd4eeed5ff9e539abe749f96bdfbf | migrations/versions/56fbf79e705_add_account_id_to_li.py | migrations/versions/56fbf79e705_add_account_id_to_li.py | """Add account_id to list
Revision ID: 56fbf79e705
Revises: 4d93f81e7c0
Create Date: 2013-09-07 16:54:04.163852
"""
# revision identifiers, used by Alembic.
revision = '56fbf79e705'
down_revision = '4d93f81e7c0'
from alembic import op
import sqlalchemy as sa
def upgrade():
# XXX(gmwils): Works if an account e... | Add lists to an account in data schema | Add lists to an account in data schema
| Python | mit | gmwils/cihui | ---
+++
@@ -0,0 +1,29 @@
+"""Add account_id to list
+
+Revision ID: 56fbf79e705
+Revises: 4d93f81e7c0
+Create Date: 2013-09-07 16:54:04.163852
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '56fbf79e705'
+down_revision = '4d93f81e7c0'
+
+from alembic import op
+import sqlalchemy as sa
+
+
+def upgrade... | |
f24534ac03d77443e6dd3df37894c17f0999a03b | tests/simplehtmlparser.py | tests/simplehtmlparser.py |
class SimpleHTMLParser(object):
"""
A simple HTML parser for testing.
Not suitable for harsh cases, and the time efficiency is not considered.
Examples:
<tag key1="val1" key2>text</tag>
<tag />
"""
def __init__(self):
pass
def parse(self, content, parent=None):
... | Add a simple HTML parser for testing. | Add a simple HTML parser for testing.
Signed-off-by: CyberZHG <9ba3659efa42549cffa53a0bc35ef0cabfb20593@gmail.com>
| Python | agpl-3.0 | fakepoet/markdown.py,fakepoet/markdown.py | ---
+++
@@ -0,0 +1,60 @@
+
+
+class SimpleHTMLParser(object):
+ """
+ A simple HTML parser for testing.
+
+ Not suitable for harsh cases, and the time efficiency is not considered.
+
+ Examples:
+ <tag key1="val1" key2>text</tag>
+ <tag />
+ """
+
+ def __init__(self):
+ pass
+
... | |
bbe2f218fb738a32db9f12d308e729712146c18d | src/unittest/python/test_garbage_collection.py | src/unittest/python/test_garbage_collection.py | # coding=utf-8
#
# fysom - pYthOn Finite State Machine - this is a port of Jake
# Gordon's javascript-state-machine to python
# https://github.com/jakesgordon/javascript-state-machine
#
# Copyright (C) 2011 Mansour Behabadi <mansour@oxplot.com>, Jake Gordon
# and o... | Add unit test for garbage collection | Add unit test for garbage collection
| Python | mit | mriehl/fysom | ---
+++
@@ -0,0 +1,78 @@
+# coding=utf-8
+#
+# fysom - pYthOn Finite State Machine - this is a port of Jake
+# Gordon's javascript-state-machine to python
+# https://github.com/jakesgordon/javascript-state-machine
+#
+# Copyright (C) 2011 Mansour Behabadi <mansour@oxplot.com>, Jake Gordon
+# ... | |
d407112debfadeba47742e157779c28d5dc82e0c | connect_to_postgres.py | connect_to_postgres.py | import os
import psycopg2
import urlparse
urlparse.uses_netloc.append("postgres")
url = urlparse.urlparse(os.environ["DATABASE_URL"])
conn = psycopg2.connect(
database=url.path[1:],
user=url.username,
password=url.password,
host=url.hostname,
port=url.port
)
cur = conn.cursor()
cur.execute("SE... | Write script to connect to postgres | Write script to connect to postgres
| Python | mit | gsganden/pitcher-reports,gsganden/pitcher-reports | ---
+++
@@ -0,0 +1,24 @@
+import os
+import psycopg2
+import urlparse
+
+urlparse.uses_netloc.append("postgres")
+url = urlparse.urlparse(os.environ["DATABASE_URL"])
+
+conn = psycopg2.connect(
+ database=url.path[1:],
+ user=url.username,
+ password=url.password,
+ host=url.hostname,
+ port=url.port
+... | |
59fa12f76b564d020196043431cd0551129fb834 | localore/home/migrations/0014_auto_20160328_1654.py | localore/home/migrations/0014_auto_20160328_1654.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('home', '0013_auto_20160328_1515'),
]
operations = [
migrations.AlterField(
mode... | Add missed migration for ddf77b1 | Add missed migration for ddf77b1
| Python | mpl-2.0 | ghostwords/localore,ghostwords/localore,ghostwords/localore | ---
+++
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('home', '0013_auto_20160328_1515'),
+ ]
+
+ operations = [
+ ... | |
4c0c2289ee8deeb6ea7f8bb76db886329e7ae1b3 | zinnia/migrations/0002_subtitle_and_caption.py | zinnia/migrations/0002_subtitle_and_caption.py | from django.db import models
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('zinnia', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='entry',
name='caption',
field=models.TextField(
... | Add migration for adding subtitle and caption fields | Add migration for adding subtitle and caption fields
| Python | bsd-3-clause | Maplecroft/django-blog-zinnia,extertioner/django-blog-zinnia,marctc/django-blog-zinnia,aorzh/django-blog-zinnia,Maplecroft/django-blog-zinnia,ZuluPro/django-blog-zinnia,ghachey/django-blog-zinnia,dapeng0802/django-blog-zinnia,bywbilly/django-blog-zinnia,aorzh/django-blog-zinnia,Zopieux/django-blog-zinnia,petecummings/d... | ---
+++
@@ -0,0 +1,27 @@
+from django.db import models
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('zinnia', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='entry',
+ name='caption',
+ ... | |
692bf6df15410ac1d5deac81081526d6c2aa27ae | aggregate_if.py | aggregate_if.py | # coding: utf-8
'''
Implements conditional aggregates.
This code was based on the work of others found on the internet:
1. http://web.archive.org/web/20101115170804/http://www.voteruniverse.com/Members/jlantz/blog/conditional-aggregates-in-django
2. https://code.djangoproject.com/ticket/11305
3. https://groups.google... | Add aggregate-if source with support to Sum | Add aggregate-if source with support to Sum | Python | mit | henriquebastos/django-aggregate-if | ---
+++
@@ -0,0 +1,68 @@
+# coding: utf-8
+'''
+Implements conditional aggregates.
+
+This code was based on the work of others found on the internet:
+
+1. http://web.archive.org/web/20101115170804/http://www.voteruniverse.com/Members/jlantz/blog/conditional-aggregates-in-django
+2. https://code.djangoproject.com/ti... | |
73e5df0b277b25bdbe88acd31518106615e02cb4 | indra/sources/eidos/make_eidos_ontology.py | indra/sources/eidos/make_eidos_ontology.py | import yaml
import requests
from os.path import join, dirname, abspath
from rdflib import Graph, Namespace, Literal
eidos_ont_url = 'https://raw.githubusercontent.com/clulab/eidos/master/' + \
'src/main/resources/org/clulab/wm/eidos/toy_ontology.yml'
eidos_ns = Namespace('http://github.com/clulab/eido... | Add script to make RDF Eidos ontology | Add script to make RDF Eidos ontology
| Python | bsd-2-clause | bgyori/indra,johnbachman/indra,sorgerlab/indra,pvtodorov/indra,sorgerlab/belpy,johnbachman/indra,sorgerlab/indra,johnbachman/indra,pvtodorov/indra,johnbachman/belpy,sorgerlab/indra,sorgerlab/belpy,pvtodorov/indra,johnbachman/belpy,pvtodorov/indra,bgyori/indra,johnbachman/belpy,sorgerlab/belpy,bgyori/indra | ---
+++
@@ -0,0 +1,49 @@
+import yaml
+import requests
+from os.path import join, dirname, abspath
+from rdflib import Graph, Namespace, Literal
+
+eidos_ont_url = 'https://raw.githubusercontent.com/clulab/eidos/master/' + \
+ 'src/main/resources/org/clulab/wm/eidos/toy_ontology.yml'
+
+eidos_ns = Name... | |
793b1ad0dade4afcdb8ef4a3bc81c53fd1a47f6d | tests/test_pypi.py | tests/test_pypi.py | from tests.helper import ExternalVersionTestCase
class PyPITest(ExternalVersionTestCase):
def test_pypi(self):
self.assertEqual(self.sync_get_version("example", {"pypi": None}), "0.1.0")
| Add a testcase for PyPI | Add a testcase for PyPI
| Python | mit | lilydjwg/nvchecker | ---
+++
@@ -0,0 +1,6 @@
+from tests.helper import ExternalVersionTestCase
+
+
+class PyPITest(ExternalVersionTestCase):
+ def test_pypi(self):
+ self.assertEqual(self.sync_get_version("example", {"pypi": None}), "0.1.0") | |
60c9874bcd085f808ddc676bbe019bbed91900cd | tests/test_util.py | tests/test_util.py | """Tests for util submodule."""
from pathlib import Path
import requests
import xdg
from mccurse import util
def test_cache_use_default():
"""Use cache dir when no dir specified?"""
INPUT = None
EXPECT = Path(xdg.BaseDirectory.save_cache_path(util.RESOURCE_NAME))
assert util.default_cache_dir(IN... | Add tests for util submodule | Add tests for util submodule
| Python | agpl-3.0 | khardix/mccurse | ---
+++
@@ -0,0 +1,62 @@
+"""Tests for util submodule."""
+
+
+from pathlib import Path
+
+import requests
+import xdg
+
+from mccurse import util
+
+
+def test_cache_use_default():
+ """Use cache dir when no dir specified?"""
+
+ INPUT = None
+ EXPECT = Path(xdg.BaseDirectory.save_cache_path(util.RESOURCE_N... | |
3d82021cca499ecaee8f66e563d366268d0422e2 | lemur/migrations/versions/4fe230f7a26e_.py | lemur/migrations/versions/4fe230f7a26e_.py | """Add 'ports' column to certificate_associations table
Revision ID: 4fe230f7a26e
Revises: c301c59688d2
Create Date: 2021-05-07 10:57:16.964743
"""
# revision identifiers, used by Alembic.
revision = '4fe230f7a26e'
down_revision = 'c301c59688d2'
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialect... | Add ports column to certificate_associations - alembic migration only | Add ports column to certificate_associations - alembic migration only
| Python | apache-2.0 | Netflix/lemur,Netflix/lemur,Netflix/lemur,Netflix/lemur | ---
+++
@@ -0,0 +1,39 @@
+"""Add 'ports' column to certificate_associations table
+
+Revision ID: 4fe230f7a26e
+Revises: c301c59688d2
+Create Date: 2021-05-07 10:57:16.964743
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '4fe230f7a26e'
+down_revision = 'c301c59688d2'
+
+import sqlalchemy as sa
+from ... | |
430726e060f1d033f233f59f2c956ec6dd09b49f | Scripts/mode2-parser.py | Scripts/mode2-parser.py | #!/usr/bin/env python
# -*- encoding:utf8 -*-
from __future__ import print_function
import argparse
class Parser(object):
@classmethod
def parse(cls, target_file):
print("Target file : %r" % target_file)
if target_file is None or len(target_file) == 0:
return
with open(... | Add mode2 raw code parser script. | Add mode2 raw code parser script.
| Python | mit | supistar/PiAirRemote,supistar/PiAirRemote | ---
+++
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+# -*- encoding:utf8 -*-
+
+from __future__ import print_function
+import argparse
+
+
+class Parser(object):
+
+ @classmethod
+ def parse(cls, target_file):
+ print("Target file : %r" % target_file)
+
+ if target_file is None or len(target_file) == ... | |
0f6ff08896604e662c0912b0e8548e4c7f37c4e8 | depends.py | depends.py | #!/usr/bin/env python
"""depends.py - print package dependencies
Usage: python depends.py [-h | --help]
"""
from __future__ import print_function
import os
import subprocess
import sys
def depends(home, pkgpath):
os.chdir(os.path.join(home, 'usr', 'pkgsrc'))
os.chdir(pkgpath)
p = subprocess.Popen(
... | Add a script to determine package dependencies. | Add a script to determine package dependencies.
| Python | isc | eliteraspberries/minipkg,eliteraspberries/minipkg | ---
+++
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+
+"""depends.py - print package dependencies
+
+Usage: python depends.py [-h | --help]
+"""
+
+
+from __future__ import print_function
+
+import os
+import subprocess
+import sys
+
+
+def depends(home, pkgpath):
+ os.chdir(os.path.join(home, 'usr', 'pkgsrc'))
+ o... | |
2c0581c79bacf48f0408f55f1d44668d746d0ae6 | analysis_bistability.py | analysis_bistability.py | """
Analyse the distribution of peak distances to make appear the bistability.
To be used for two glomeruli simulations.
"""
import tables
import matplotlib.pyplot as plt
import analysis
import h5manager as hm
def histogram_peaks(simulation):
dists = get_peak_dists(simulation)
plt.figure()
plt.hist(di... | Add script to plot histogram of peak distances | Add script to plot histogram of peak distances
Useful to see if any bistability occurs.
| Python | mit | neuro-lyon/multiglom-model,neuro-lyon/multiglom-model | ---
+++
@@ -0,0 +1,48 @@
+"""
+Analyse the distribution of peak distances to make appear the bistability.
+
+To be used for two glomeruli simulations.
+
+"""
+
+
+import tables
+import matplotlib.pyplot as plt
+import analysis
+import h5manager as hm
+
+
+def histogram_peaks(simulation):
+ dists = get_peak_dists(s... | |
066555c0e6c5bfc11925ce9f60de11141e9a0d0e | runner/fix_hdf5_file_format.py | runner/fix_hdf5_file_format.py | #!/usr/bin/env python
#
# Fix HDF5 files and add mandatory attributes for support PyTables file format
#
import h5py
import sys
# open HDF5 file
hdf5_filename = sys.argv[1]
hdf5_file = h5py.File(hdf5_filename, 'a')
# add mandatory attributes for a file
hdf5_file['/'].attrs['CLASS'] = 'GROUP'
hdf5_file['/'].attrs['... | Add mandatory attributes to support PyTables HDF5 file format. | Add mandatory attributes to support PyTables HDF5 file format.
| Python | mit | lo100/MyRaspiHome,lo100/MyRaspiHome | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+
+#
+# Fix HDF5 files and add mandatory attributes for support PyTables file format
+#
+
+import h5py
+import sys
+
+# open HDF5 file
+hdf5_filename = sys.argv[1]
+hdf5_file = h5py.File(hdf5_filename, 'a')
+
+# add mandatory attributes for a file
+hdf5_file['/'].attrs... | |
63f47104feec03cd529b80c654a2aa80e3e7d524 | tests/cpydiff/builtin_next_arg2.py | tests/cpydiff/builtin_next_arg2.py | """
categories: Modules,builtins
description: Second argument to next() is not implemented
cause: MicroPython is optimised for code space.
workaround: Instead of `val = next(it, deflt)` use::
try:
val = next(it)
except StopIteration:
val = deflt
"""
print(next(iter(range(0)), 42))
| Add difference-test for second arg of builtin next(). | tests/cpydiff: Add difference-test for second arg of builtin next().
| Python | mit | MrSurly/micropython,blazewicz/micropython,torwag/micropython,dmazzella/micropython,MrSurly/micropython,torwag/micropython,pfalcon/micropython,swegener/micropython,ryannathans/micropython,MrSurly/micropython,blazewicz/micropython,infinnovation/micropython,trezor/micropython,pfalcon/micropython,adafruit/circuitpython,bve... | ---
+++
@@ -0,0 +1,12 @@
+"""
+categories: Modules,builtins
+description: Second argument to next() is not implemented
+cause: MicroPython is optimised for code space.
+workaround: Instead of `val = next(it, deflt)` use::
+
+ try:
+ val = next(it)
+ except StopIteration:
+ val = deflt
+"""
+print(... | |
f06d2da6784dbc742cbe304ed1b078702a61c961 | tests/app/soc/modules/gci/views/test_age_check.py | tests/app/soc/modules/gci/views/test_age_check.py | #!/usr/bin/env python2.5
#
# Copyright 2011 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | Add basic test case for the age check view. | Add basic test case for the age check view.
Only check if the page can actually be rendered, need more info on how to deal with cookies and user authentication inside tests to expand this.
| Python | apache-2.0 | rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son | ---
+++
@@ -0,0 +1,47 @@
+#!/usr/bin/env python2.5
+#
+# Copyright 2011 the Melange authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICEN... | |
5072478d2c89d5235aff20f8ccb365ab9ec2e297 | experiments/python/gtk_drawing_area_pixels.py | experiments/python/gtk_drawing_area_pixels.py | __author__ = 'Joel Wright'
import pygtk
pygtk.require('2.0')
import gtk
import math
import cairo
import struct
class DrawingAreaExample(gtk.Window):
def __init__(self):
super(DrawingAreaExample, self).__init__()
self.set_title("Drawing Area Example")
self.resize(300,400)
self.set_... | Add experiment getting pixel values from gtk DrawingArea | Add experiment getting pixel values from gtk DrawingArea
| Python | mit | joel-wright/DDRPi,fraz3alpha/DDRPi,fraz3alpha/led-disco-dancefloor | ---
+++
@@ -0,0 +1,75 @@
+__author__ = 'Joel Wright'
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+import math
+import cairo
+import struct
+
+class DrawingAreaExample(gtk.Window):
+ def __init__(self):
+ super(DrawingAreaExample, self).__init__()
+
+ self.set_title("Drawing Area Example")
+ ... | |
f76ccddca4864b2f2faf8dfadefa6ac15c930043 | examples/tour_examples/driverjs_maps_tour.py | examples/tour_examples/driverjs_maps_tour.py | from seleniumbase import BaseCase
class MyTestClass(BaseCase):
def test_basic(self):
self.open("https://www.google.com/maps/@42.3598616,-71.0912631,15z")
self.wait_for_element("#searchboxinput")
self.wait_for_element("#minimap")
self.wait_for_element("#zoom")
# Create a w... | Add an example tour for DriverJS | Add an example tour for DriverJS
| Python | mit | seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase | ---
+++
@@ -0,0 +1,36 @@
+from seleniumbase import BaseCase
+
+
+class MyTestClass(BaseCase):
+
+ def test_basic(self):
+ self.open("https://www.google.com/maps/@42.3598616,-71.0912631,15z")
+ self.wait_for_element("#searchboxinput")
+ self.wait_for_element("#minimap")
+ self.wait_for_e... | |
b90af30b23015d2fbe93f401a87176c6441e5c0d | altair/examples/wheat_wages.py | altair/examples/wheat_wages.py | """
Wheat and Wages
---------------
A recreation of William Playfair's classic chart visualizing
the price of wheat, the wages of a mechanic, and the reigning British monarch.
"""
# category: case studies
import altair as alt
from vega_datasets import data
base_wheat = alt.Chart(data.wheat.url).transform_calculate(
... | Add William Playfair Wheat and Wages example | ENH: Add William Playfair Wheat and Wages example
| Python | bsd-3-clause | altair-viz/altair,jakevdp/altair | ---
+++
@@ -0,0 +1,56 @@
+"""
+Wheat and Wages
+---------------
+A recreation of William Playfair's classic chart visualizing
+the price of wheat, the wages of a mechanic, and the reigning British monarch.
+"""
+# category: case studies
+import altair as alt
+from vega_datasets import data
+
+
+base_wheat = alt.Chart... | |
8e8c1b326c71ad1e2810bc806d443bf3e9e0a8ed | csunplugged/utils/errors/TextBoxDrawerErrors.py | csunplugged/utils/errors/TextBoxDrawerErrors.py | class TextBoxDrawerError(Exception):
pass
class MissingSVGFile(TextBoxDrawerError):
pass
class TextBoxNotFoundInSVG(TextBoxDrawerError):
pass
class MissingSVGViewBox(TextBoxDrawerError):
pass
| Add custom exceptions for TextBoxDrawer | Add custom exceptions for TextBoxDrawer
This is a skeleton for now, with docstrings etc. to follow
| Python | mit | uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged | ---
+++
@@ -0,0 +1,11 @@
+class TextBoxDrawerError(Exception):
+ pass
+
+class MissingSVGFile(TextBoxDrawerError):
+ pass
+
+class TextBoxNotFoundInSVG(TextBoxDrawerError):
+ pass
+
+class MissingSVGViewBox(TextBoxDrawerError):
+ pass | |
97fe29ff36438fb2e39b24d518bccada54371d6f | extra/vwtags.py | extra/vwtags.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
import re
if len(sys.argv) < 3:
exit()
syntax = sys.argv[1]
filename = sys.argv[2]
rx_default_media = r"^\s*(={1,6})([^=].*[^=])\1\s*$"
rx_markdown = r"^\s*(#{1,6})([^#].*)$"
if syntax in ("default", "media"):
... | Add script to generate tags, taken from vimwiki/utils | Add script to generate tags, taken from vimwiki/utils
| Python | mit | phha/taskwiki,Spirotot/taskwiki | ---
+++
@@ -0,0 +1,72 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from __future__ import print_function
+
+import sys
+import re
+
+if len(sys.argv) < 3:
+ exit()
+
+syntax = sys.argv[1]
+filename = sys.argv[2]
+
+rx_default_media = r"^\s*(={1,6})([^=].*[^=])\1\s*$"
+rx_markdown = r"^\s*(#{1,6})([^#].*)... | |
6b7ae3c74708a3ed666e76e6ba779be7423a022d | myhdl/test/conversion/numeric/test_numass.py | myhdl/test/conversion/numeric/test_numass.py | from __future__ import absolute_import, print_function
from random import randrange
from myhdl import Signal, uintba, sintba, instance, delay, conversion
def NumassBench():
p = Signal(uintba(1, 8))
q = Signal(uintba(1, 40))
r = Signal(sintba(1, 9))
s = Signal(sintba(1, 41))
PBIGINT = randrange(2... | Revert "Revert "Added the number assignment test for numeric."" | Revert "Revert "Added the number assignment test for numeric.""
This reverts commit acbd86165ea6c5cd566928292c095ae570aa00ce.
| Python | lgpl-2.1 | jmgc/myhdl-numeric,jmgc/myhdl-numeric,jmgc/myhdl-numeric | ---
+++
@@ -0,0 +1,55 @@
+from __future__ import absolute_import, print_function
+
+from random import randrange
+
+from myhdl import Signal, uintba, sintba, instance, delay, conversion
+
+
+def NumassBench():
+ p = Signal(uintba(1, 8))
+ q = Signal(uintba(1, 40))
+ r = Signal(sintba(1, 9))
+ s = Signal(s... | |
ee907d14ab905ca347807d8787c9146cd28f6d7d | dit/algorithms/tests/test_lattice.py | dit/algorithms/tests/test_lattice.py |
from nose.tools import *
from dit.algorithms.lattice import sigma_algebra_sort
def test_sigalg_sort():
sigalg = frozenset([
frozenset([]),
frozenset([1]),
frozenset([2]),
frozenset([1,2])
])
sigalg_ = [(), (1,), (2,), (1,2)]
assert_equal( sigalg_, sigma_algebra_sort(sigalg) )
| Add a test for sorting sigma-algebras. | Add a test for sorting sigma-algebras.
| Python | bsd-3-clause | Autoplectic/dit,dit/dit,Autoplectic/dit,Autoplectic/dit,dit/dit,dit/dit,chebee7i/dit,Autoplectic/dit,chebee7i/dit,chebee7i/dit,Autoplectic/dit,dit/dit,dit/dit,chebee7i/dit | ---
+++
@@ -0,0 +1,14 @@
+
+from nose.tools import *
+
+from dit.algorithms.lattice import sigma_algebra_sort
+
+def test_sigalg_sort():
+ sigalg = frozenset([
+ frozenset([]),
+ frozenset([1]),
+ frozenset([2]),
+ frozenset([1,2])
+ ])
+ sigalg_ = [(), (1,), (2,), (1,2)]
+ assert_equal( sigalg_, sigma_algebra_so... | |
ea7bbb23d8818fbc3c06467e500e6b9f9be85c84 | dash/orgs/migrations/0026_fix_org_config_rapidpro.py | dash/orgs/migrations/0026_fix_org_config_rapidpro.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.12 on 2018-04-27 12:04
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
def fix_org_config_rapidpro(apps, schema_editor):
Org = apps.get_model("orgs", "Org")
orgs = Org.objects.all()... | Add migrations to clean up org config | Add migrations to clean up org config
| Python | bsd-3-clause | rapidpro/dash,rapidpro/dash | ---
+++
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.12 on 2018-04-27 12:04
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ def fix_org_config_rapidpro(apps, schema_editor):
+ Org = apps.get_model("orgs", "... | |
f2fb791df5023a39c82561ceb79b92b0b584e5af | scripts/fetch_data.py | scripts/fetch_data.py | import json
import requests
import dataset
def fetch_builds_data(jenkins_url):
'''Get json data of all Jenkins builds
JENKINS_URL/api/json?
tree=jobs[name,builds[number,result,duration,builtOn,id,timestamp,fullDisplayName]]
Return builds_data dictionary with following schema::
[
{
... | Add script to fetch builds from Jenkins | Add script to fetch builds from Jenkins
- uses dataset library to store data in sqlite database,
- supports fetching data from Jenkins via JSON API or from file.
| Python | mit | bookwar/jenkins-report,bookwar/jenkins-report | ---
+++
@@ -0,0 +1,94 @@
+import json
+import requests
+import dataset
+
+
+def fetch_builds_data(jenkins_url):
+ '''Get json data of all Jenkins builds
+
+ JENKINS_URL/api/json?
+ tree=jobs[name,builds[number,result,duration,builtOn,id,timestamp,fullDisplayName]]
+
+ Return builds_data dictionary w... | |
632f29f25e2e639ba3d41e0c12443a7e208cfd9c | web/ext/debug/__init__.py | web/ext/debug/__init__.py | # encoding: utf-8
"""Interactive tracebacks for WebCore."""
class DebuggingExtension(object):
provides = ['debug']
last = True
def __init__(self):
"""Executed to configure the extension."""
super(DebuggingExtension, self).__init__()
def __call__(self, context, app):
"""Executed to wrap the applicat... | Debug extension plan is once again an interactive debugger. | Debug extension plan is once again an interactive debugger.
| Python | mit | marrow/WebCore,marrow/WebCore | ---
+++
@@ -0,0 +1,18 @@
+# encoding: utf-8
+
+"""Interactive tracebacks for WebCore."""
+
+
+
+class DebuggingExtension(object):
+ provides = ['debug']
+ last = True
+
+ def __init__(self):
+ """Executed to configure the extension."""
+
+ super(DebuggingExtension, self).__init__()
+
+ def __call__(self, contex... | |
82574e953dcb2ff3bd47b7ae1a70d956a06633de | examples/demo/basic/scatter_alpha.py | examples/demo/basic/scatter_alpha.py | """
Scatter plot with panning and zooming
Shows a scatter plot of a set of random points,
with basic Chaco panning and zooming.
Interacting with the plot:
- Left-mouse-drag pans the plot.
- Mouse wheel up and down zooms the plot in and out.
- Pressing "z" brings up the Zoom Box, and you can click-drag a rectan... | Add example which demonstrates issue (works in this branch, fails otherwise). | Add example which demonstrates issue (works in this branch, fails otherwise).
| Python | bsd-3-clause | tommy-u/chaco,tommy-u/chaco,tommy-u/chaco | ---
+++
@@ -0,0 +1,109 @@
+"""
+Scatter plot with panning and zooming
+
+Shows a scatter plot of a set of random points,
+with basic Chaco panning and zooming.
+
+Interacting with the plot:
+
+ - Left-mouse-drag pans the plot.
+ - Mouse wheel up and down zooms the plot in and out.
+ - Pressing "z" brings up the Zo... | |
3ab8796bef7900a8f8799d85cecbd37c7db259db | ghnames.py | ghnames.py | # Run this script with `python ghnames.py` until it is correct then
# run `python ghnames.py >> _config.yml` to add it its output to the
# end of our _config.yml. All students will be added as site authors.
# In Python """ starts a string that can span multiple lines
# Add student github names here.
names = """"""
... | Add student author names script | Add student author names script
| Python | mit | silshack/summer2017,silshack/summer2017,silshack/summer2017,silshack/summer2017,silshack/summer2017 | ---
+++
@@ -0,0 +1,21 @@
+# Run this script with `python ghnames.py` until it is correct then
+# run `python ghnames.py >> _config.yml` to add it its output to the
+# end of our _config.yml. All students will be added as site authors.
+
+# In Python """ starts a string that can span multiple lines
+# Add student git... | |
e90d0c585dde96a780dbd1f4109d03dba651b9c2 | extension/test/server/right/system_tests_preferred_masters.py | extension/test/server/right/system_tests_preferred_masters.py | """
This file is part of Arakoon, a distributed key-value store. Copyright
(C) 2010 Incubaid BVBA
Licensees holding a valid Incubaid license may use this file in
accordance with Incubaid's Arakoon commercial license agreement. For
more information on how to enter into this agreement, please contact
Incubaid (contact d... | Add first test for 'preferred_masters' | Tests: Add first test for 'preferred_masters'
This commit adds a first test for 'preferred_masters', by copying the
existing 'system_tests_preferred' test, and changing it slightly to use
'preferredMasters' instead of 'forceMaster' with 'preferred=True'.
See: 98d74321f5d7c2f54d5faaba85f379b2a572c35c
See: d8a6072cbaf5... | Python | apache-2.0 | openvstorage/arakoon,openvstorage/arakoon,Incubaid/arakoon,Incubaid/arakoon,Incubaid/arakoon,openvstorage/arakoon | ---
+++
@@ -0,0 +1,62 @@
+"""
+This file is part of Arakoon, a distributed key-value store. Copyright
+(C) 2010 Incubaid BVBA
+
+Licensees holding a valid Incubaid license may use this file in
+accordance with Incubaid's Arakoon commercial license agreement. For
+more information on how to enter into this agreement, ... | |
953278ec93184bad7586b69aa55ef1f087419edd | Orange/widgets/visualize/tests/test_owboxplot.py | Orange/widgets/visualize/tests/test_owboxplot.py | # Test methods with long descriptive names can omit docstrings
# pylint: disable=missing-docstring
from unittest import skip
import numpy as np
from Orange.data import Table, ContinuousVariable
from Orange.widgets.visualize.owboxplot import OWBoxPlot
from Orange.widgets.tests.base import WidgetTest
class TestOWBoxPl... | Fix crash with missing values | OWBoxPlot: Fix crash with missing values
| Python | bsd-2-clause | cheral/orange3,cheral/orange3,cheral/orange3,cheral/orange3,cheral/orange3,cheral/orange3 | ---
+++
@@ -0,0 +1,55 @@
+# Test methods with long descriptive names can omit docstrings
+# pylint: disable=missing-docstring
+from unittest import skip
+
+import numpy as np
+from Orange.data import Table, ContinuousVariable
+from Orange.widgets.visualize.owboxplot import OWBoxPlot
+from Orange.widgets.tests.base im... | |
3ea6f9f96606d267c98b89f8ab3853eaa026bad8 | haas_rest_test/plugins/tests/test_test_parameters.py | haas_rest_test/plugins/tests/test_test_parameters.py | # -*- coding: utf-8 -*-
# Copyright (c) 2014 Simon Jagoe
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the 3-clause BSD license. See the LICENSE.txt file for details.
from __future__ import absolute_import, unicode_literals
from haas.testing import unittest
from haas_r... | Add test for method plugin | Add test for method plugin
| Python | bsd-3-clause | sjagoe/usagi | ---
+++
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2014 Simon Jagoe
+# All rights reserved.
+#
+# This software may be modified and distributed under the terms
+# of the 3-clause BSD license. See the LICENSE.txt file for details.
+from __future__ import absolute_import, unicode_literals
+
+from haas.... | |
37d90e01e52fbb627f93d0dd2eb0ace3df6131b4 | andalusian/migrations/0005_auto_20190709_1132.py | andalusian/migrations/0005_auto_20190709_1132.py | # Generated by Django 2.1.7 on 2019-07-09 09:32
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('andalusian', '0006_auto_20190709_1045'),
]
operations = [
migrations.RemoveField(
model_name='instr... | Add migrations file for adding andausian instruments | Add migrations file for adding andausian instruments
| Python | agpl-3.0 | MTG/dunya,MTG/dunya,MTG/dunya,MTG/dunya | ---
+++
@@ -0,0 +1,42 @@
+# Generated by Django 2.1.7 on 2019-07-09 09:32
+
+from django.db import migrations, models
+import django.utils.timezone
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('andalusian', '0006_auto_20190709_1045'),
+ ]
+
+ operations = [
+ migrations.R... | |
51187fd8c39a1a05aade20c416084e5b69973176 | tests/test_curtailment.py | tests/test_curtailment.py | """
This "test" runs curtailment for different curtailment requirements and
methods `voltage-based` and `feedin-proportional`.
It requires a ding0 grid called ding0_grid_example.pkl in the same directory.
"""
import pandas as pd
import numpy as np
from edisgo import EDisGo
def get_generator_feedins(edisgo_grid):
... | Test script for running curtailment | Test script for running curtailment
| Python | agpl-3.0 | openego/eDisGo,openego/eDisGo | ---
+++
@@ -0,0 +1,53 @@
+"""
+This "test" runs curtailment for different curtailment requirements and
+methods `voltage-based` and `feedin-proportional`.
+It requires a ding0 grid called ding0_grid_example.pkl in the same directory.
+
+"""
+import pandas as pd
+import numpy as np
+
+from edisgo import EDisGo
+
+
+de... | |
197fb886cba673b385189809a1a90032032f5c26 | keras/legacy/models.py | keras/legacy/models.py | from .layers import Merge
def needs_legacy_support(model):
return isinstance(model.layers[0], Merge)
def legacy_sequential_layers(model):
layers = []
if model.layers:
if isinstance(model.layers[0], Merge):
merge = model.layers[0]
for layer in merge.layers:
... | Add missing legacy support file. | Add missing legacy support file. | Python | apache-2.0 | keras-team/keras,keras-team/keras | ---
+++
@@ -0,0 +1,27 @@
+from .layers import Merge
+
+
+def needs_legacy_support(model):
+ return isinstance(model.layers[0], Merge)
+
+
+def legacy_sequential_layers(model):
+ layers = []
+ if model.layers:
+ if isinstance(model.layers[0], Merge):
+ merge = model.layers[0]
+ fo... | |
324f9ca2728614567d038a0ad3c7354655099b59 | tests/test_connect_cells.py | tests/test_connect_cells.py | """
This unit test tests the cells connected in series or parallel
"""
import unittest
import numpy as np
from pypvcell.solarcell import ResistorCell, SeriesConnect, ParallelConnect
class SPTestCase(unittest.TestCase):
def setUp(self):
self.r1 = 1.0
self.r2 = 2.0
self.r1cell = ResistorC... | Add unit test of SeriesConnect() and ParallelConnect() | Add unit test of SeriesConnect() and ParallelConnect()
| Python | apache-2.0 | kanhua/pypvcell | ---
+++
@@ -0,0 +1,45 @@
+"""
+This unit test tests the cells connected in series or parallel
+
+
+"""
+import unittest
+import numpy as np
+from pypvcell.solarcell import ResistorCell, SeriesConnect, ParallelConnect
+
+
+class SPTestCase(unittest.TestCase):
+
+ def setUp(self):
+ self.r1 = 1.0
+ sel... | |
5b3835b3ed49833d3792e50ef54f23cd50c1b907 | oedb_datamodels/versions/b4e662a73272_nullable_message.py | oedb_datamodels/versions/b4e662a73272_nullable_message.py | """Make message nullable
Revision ID: b4e662a73272
Revises: 1a73867b1e79
Create Date: 2019-04-30 09:04:34.330485
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b4e662a73272'
down_revision = '1a73867b1e79'
branch_labels = None
depends_on = None
def upgrade()... | Add migration for nullable messages | Add migration for nullable messages
| Python | agpl-3.0 | openego/oeplatform,openego/oeplatform,openego/oeplatform,openego/oeplatform | ---
+++
@@ -0,0 +1,28 @@
+"""Make message nullable
+
+Revision ID: b4e662a73272
+Revises: 1a73867b1e79
+Create Date: 2019-04-30 09:04:34.330485
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = 'b4e662a73272'
+down_revision = '1a73867b1e79'
+branch_label... | |
5a1f481a57d356d8995ccce9ad29cd6e83765b10 | scripts/tag_manylinux.py | scripts/tag_manylinux.py | from auditwheel.wheeltools import InWheelCtx, add_platforms
import click
import os
@click.command()
@click.argument('wheel', type=click.Path(exists=True))
def main(wheel):
dir = os.path.dirname(os.path.abspath(wheel))
with InWheelCtx(wheel) as ctx:
try:
new_wheel = add_platforms(ctx, ['manylinux1_x86_6... | Add script to fix up wheel tag to manylinux | Add script to fix up wheel tag to manylinux
We use this instead of auditwheel directly because we have taken
care of the RPATH and auditwheel get confused.
Signed-off-by: Chris Harris <a361e89d1eba6c570561222d75facbbf7aaeeafe@kitware.com>
| Python | bsd-3-clause | ghutchis/avogadrolibs,OpenChemistry/avogadrolibs,OpenChemistry/avogadrolibs,ghutchis/avogadrolibs,ghutchis/avogadrolibs,ghutchis/avogadrolibs,OpenChemistry/avogadrolibs,ghutchis/avogadrolibs,OpenChemistry/avogadrolibs,OpenChemistry/avogadrolibs | ---
+++
@@ -0,0 +1,22 @@
+from auditwheel.wheeltools import InWheelCtx, add_platforms
+import click
+import os
+
+
+@click.command()
+@click.argument('wheel', type=click.Path(exists=True))
+def main(wheel):
+ dir = os.path.dirname(os.path.abspath(wheel))
+ with InWheelCtx(wheel) as ctx:
+ try:
+ new_wheel ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.