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 |
|---|---|---|---|---|---|---|---|---|---|---|
ebd42aabb39495f5ba22726073eeca5f9159ac7f | test/unit/sorting/test_merge_sort.py | test/unit/sorting/test_merge_sort.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import unittest
from helper.read_data_file import read_int_array
from sorting.merge_sort import sort
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
class InsertionSortTester(unittest.TestCase):
# Test sort in default order, i.e., in ascending ord... | Add unit test for merge sort implementation. | Add unit test for merge sort implementation.
| Python | mit | weichen2046/algorithm-study,weichen2046/algorithm-study | ---
+++
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import os
+import unittest
+
+from helper.read_data_file import read_int_array
+from sorting.merge_sort import sort
+
+
+BASE_DIR = os.path.dirname(os.path.abspath(__file__))
+
+
+class InsertionSortTester(unittest.TestCase):
+
+ # Test so... | |
a9f3a9213268fe41489b58e6ce61bf8d726b9e6f | shopcart.py | shopcart.py | class Shopcart(object):
"""
This is model for the shop carts
Assumptions:
- In memory persistence
- The fields of a shopcart include:
- user id
- list of products (product id, quantity of product )
- The total price of the shopcart will be dynamically calcula... | Add the data model of Shopcart | Add the data model of Shopcart
| Python | apache-2.0 | nyu-devops-echo/shopcarts,nyu-devops-echo/shopcarts,nyu-devops-echo/shopcarts,nyu-devops-echo/shopcarts | ---
+++
@@ -0,0 +1,27 @@
+class Shopcart(object):
+
+ """
+ This is model for the shop carts
+ Assumptions:
+ - In memory persistence
+ - The fields of a shopcart include:
+ - user id
+ - list of products (product id, quantity of product )
+ - The total price of the... | |
2d2d186002a9b7bcb8f0b5c1e9325c9bc9354f26 | Ex03/chebNodesWeights.py | Ex03/chebNodesWeights.py | import numpy as np
from scipy.interpolate import lagrange
def chebNodes(N):
"Returns N Chebyshev nodes in (-1,1)."
return np.array([np.cos(
np.pi * (2*k-1)/(2*N)) for k in range(1,N+1)])
def l(j,q):
"Returns the j-th lagrange basis polynomial on the nodes q."
myf = len(q)*[0]
myf[j] = 1
... | Add minimal standalone code to test Cheb weights negativity | Add minimal standalone code to test Cheb weights negativity
| Python | mit | adabrow/NumAnEx2014 | ---
+++
@@ -0,0 +1,47 @@
+import numpy as np
+from scipy.interpolate import lagrange
+
+def chebNodes(N):
+ "Returns N Chebyshev nodes in (-1,1)."
+ return np.array([np.cos(
+ np.pi * (2*k-1)/(2*N)) for k in range(1,N+1)])
+
+def l(j,q):
+ "Returns the j-th lagrange basis polynomial on the nodes q."
+... | |
8cbc27c7c3af16c53fe1033530e69c359606d5d6 | scripts/find_pubchem_removables.py | scripts/find_pubchem_removables.py | """This script helps identify entries in PubChem.tsv that systematically
lead to incorrect groundings and should therefore be removed."""
import os
import re
from indra.databases import chebi_client
if __name__ == '__main__':
# Basic positioning
here = os.path.dirname(os.path.abspath(__file__))
kb_dir = o... | Add script to find removables from PubChem | Add script to find removables from PubChem
| Python | apache-2.0 | clulab/bioresources | ---
+++
@@ -0,0 +1,29 @@
+"""This script helps identify entries in PubChem.tsv that systematically
+lead to incorrect groundings and should therefore be removed."""
+
+import os
+import re
+from indra.databases import chebi_client
+
+if __name__ == '__main__':
+ # Basic positioning
+ here = os.path.dirname(os.p... | |
a9f11f6c7ba8f9d91e388bb8dd93e600f521a814 | app/api/cruds/event_crud.py | app/api/cruds/event_crud.py | import graphene
from graphene_django import DjangoObjectType
from django_filters import OrderingFilter, FilterSet
from app.timetables.models import Event
from .timetable_crud import TimetableNode
class EventNode(DjangoObjectType):
original_id = graphene.Int()
class Meta:
model = Event
inter... | Add Event filter and Node | Add Event filter and Node
| Python | mit | teamtaverna/core | ---
+++
@@ -0,0 +1,43 @@
+import graphene
+from graphene_django import DjangoObjectType
+from django_filters import OrderingFilter, FilterSet
+
+from app.timetables.models import Event
+from .timetable_crud import TimetableNode
+
+
+class EventNode(DjangoObjectType):
+ original_id = graphene.Int()
+
+
+ class M... | |
7d60c4af17f59a63a2d861bc20d3eecececea1b1 | pymanopt/tools/autodiff/_pytorch.py | pymanopt/tools/autodiff/_pytorch.py | """
Module containing functions to differentiate functions using pytorch.
"""
try:
import torch
except ImportError:
torch = None
else:
from torch import autograd
from ._backend import Backend, assert_backend_available
class PyTorchBackend(Backend):
def __str__(self):
return "pytorch"
@st... | Add first implementation of pytorch backend | Add first implementation of pytorch backend
Signed-off-by: Niklas Koep <342d5290239d9c5264c8f98185afedb99596601a@gmail.com>
| Python | bsd-3-clause | pymanopt/pymanopt,pymanopt/pymanopt,nkoep/pymanopt,nkoep/pymanopt,nkoep/pymanopt | ---
+++
@@ -0,0 +1,75 @@
+"""
+Module containing functions to differentiate functions using pytorch.
+"""
+try:
+ import torch
+except ImportError:
+ torch = None
+else:
+ from torch import autograd
+
+from ._backend import Backend, assert_backend_available
+
+
+class PyTorchBackend(Backend):
+ def __str_... | |
30a0787e8ec184aa1d274a11234ed37d41807df5 | django_split/templatetags/django_split.py | django_split/templatetags/django_split.py | from django import template
from ..base import EXPERIMENTS
register = template.Library()
@register.filter
def experiment(user, experiment, group='experiment'):
return EXPERIMENTS[experiment].in_group(user, group)
| Add template tag for experiment group membership | Add template tag for experiment group membership
| Python | mit | prophile/django_split | ---
+++
@@ -0,0 +1,9 @@
+from django import template
+
+from ..base import EXPERIMENTS
+
+register = template.Library()
+
+@register.filter
+def experiment(user, experiment, group='experiment'):
+ return EXPERIMENTS[experiment].in_group(user, group) | |
1466e8227b847c5e926eb6b745da5d7192cd31f7 | scripts/read_fk.py | scripts/read_fk.py | import poppy_inverse_kinematics.creature as model_creature
import numpy as np
import poppy_inverse_kinematics.meta_creature as meta_creature
import time
# parameters
activate_follow = True
interface_type = "vrep"
plot = True
waiting_time = 5
# Create creatures
right_arm = model_creature.creature("torso_right_arm")
le... | Add helper script for hand_follow | Add helper script for hand_follow
| Python | apache-2.0 | Phylliade/ikpy | ---
+++
@@ -0,0 +1,47 @@
+import poppy_inverse_kinematics.creature as model_creature
+import numpy as np
+import poppy_inverse_kinematics.meta_creature as meta_creature
+import time
+
+# parameters
+activate_follow = True
+interface_type = "vrep"
+plot = True
+waiting_time = 5
+
+# Create creatures
+right_arm = model... | |
a078868a80c8cc48740c8caea0fb6f4906e490a5 | test/downhill_test.py | test/downhill_test.py | import downhill
import numpy as np
import theano
class TestMinimize:
def test_minimize(self):
x = theano.shared(-3 + np.zeros((2, ), 'f'), name='x')
data = downhill.Dataset(np.zeros((1, 1)), batch_size=1)
data._batches = [[]]
downhill.minimize(
(100 * (x[1:] - x[:-1] **... | Add a test for global minimize wrapper. | Add a test for global minimize wrapper.
| Python | mit | lmjohns3/downhill,rodrigob/downhill | ---
+++
@@ -0,0 +1,21 @@
+import downhill
+import numpy as np
+import theano
+
+
+class TestMinimize:
+ def test_minimize(self):
+ x = theano.shared(-3 + np.zeros((2, ), 'f'), name='x')
+ data = downhill.Dataset(np.zeros((1, 1)), batch_size=1)
+ data._batches = [[]]
+ downhill.minimize(... | |
484ca8e8e8ab53b0fe62062758a3f74d4194d3c0 | examples/compass_high_angle_hist.py | examples/compass_high_angle_hist.py | #!/usr/bin/env python
"""
Prints a histogram of inclinations to show what proportion are high-angle.
usage: compass_high_angle_hist.py DATFILE...
"""
import sys
from davies import compass
def compass_stats(datfiles, bin_size=5, display_scale=3):
histogram = [0 for bin in range(0, 91, bin_size)]
for datfil... | Add example script that prints a histogram of inclinations | Add example script that prints a histogram of inclinations
| Python | mit | riggsd/davies | ---
+++
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+"""
+Prints a histogram of inclinations to show what proportion are high-angle.
+
+usage: compass_high_angle_hist.py DATFILE...
+"""
+
+import sys
+
+from davies import compass
+
+
+def compass_stats(datfiles, bin_size=5, display_scale=3):
+ histogram = [0 for bin i... | |
a5fea9b538a309422f7503ff689f0dde932585f6 | samples/migrations/0013_auto_20170526_1718.py | samples/migrations/0013_auto_20170526_1718.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-26 20:18
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('samples', '0012_auto_20170512_1138'),
]
operations =... | Add migration file for samples app | :memo: Add migration file for samples app
| Python | mit | gems-uff/labsys,gems-uff/labsys,gems-uff/labsys | ---
+++
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11 on 2017-05-26 20:18
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('samples', '0012_auto_2... | |
3e25b09882fa57f7063cecd2e223741132f83854 | muspelheim/src/test/python/newlinejson.py | muspelheim/src/test/python/newlinejson.py | #!/usr/bin/env python
import json
import sys
def newline_json(in_file, out_file):
for line in json.load(in_file):
json.dump(line, out_file)
out_file.write('\n')
if __name__ == '__main__':
if len(sys.argv) < 2:
print "Usage: python newlinejson.py [path to ordinary json file]"
sy... | Add script to convert JSON arrays to newline separated JSON | Add script to convert JSON arrays to newline separated JSON
[Finished #37633897]
| Python | agpl-3.0 | precog/platform,precog/platform,precog/platform,precog/platform | ---
+++
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+import json
+import sys
+
+def newline_json(in_file, out_file):
+ for line in json.load(in_file):
+ json.dump(line, out_file)
+ out_file.write('\n')
+
+if __name__ == '__main__':
+ if len(sys.argv) < 2:
+ print "Usage: python newlinejson.py [... | |
a64b5896b6bd8da36b3e2d2d5bd8b48c4c355935 | poyo/__init__.py | poyo/__init__.py | # -*- coding: utf-8 -*-
__author__ = 'Raphael Pierzina'
__email__ = 'raphael@hackebrot.de'
__version__ = '0.1.0'
from .parser import parse_string
__all__ = ['parse_string']
| Create an init file with meta information | Create an init file with meta information
| Python | mit | hackebrot/poyo | ---
+++
@@ -0,0 +1,9 @@
+# -*- coding: utf-8 -*-
+
+__author__ = 'Raphael Pierzina'
+__email__ = 'raphael@hackebrot.de'
+__version__ = '0.1.0'
+
+from .parser import parse_string
+
+__all__ = ['parse_string'] | |
de026ce0b3070c7f17f37c4a1db039b834dc1ac8 | commitlog_archiving_test.py | commitlog_archiving_test.py | from dtest import Tester, debug
from pytools import since, replace_in_file
import tempfile, shutil, glob, os, time
import distutils.dir_util
class CommitLogArchivingTest(Tester):
def __init__(self, *args, **kwargs):
Tester.__init__(self, *args, **kwargs)
def insert_rows(self, cursor, start, end):
... | Add test for commitlog archiving | Add test for commitlog archiving
| Python | apache-2.0 | pcmanus/cassandra-dtest,spodkowinski/cassandra-dtest,bdeggleston/cassandra-dtest,krummas/cassandra-dtest,yukim/cassandra-dtest,aweisberg/cassandra-dtest,beobal/cassandra-dtest,mambocab/cassandra-dtest,mambocab/cassandra-dtest,blerer/cassandra-dtest,bdeggleston/cassandra-dtest,carlyeks/cassandra-dtest,aweisberg/cassandr... | ---
+++
@@ -0,0 +1,48 @@
+from dtest import Tester, debug
+from pytools import since, replace_in_file
+import tempfile, shutil, glob, os, time
+import distutils.dir_util
+
+
+class CommitLogArchivingTest(Tester):
+ def __init__(self, *args, **kwargs):
+ Tester.__init__(self, *args, **kwargs)
+
+ def inse... | |
141d3f90dd52f89eb5846618b067c22db83a64a1 | api/management/commands/verifyuser.py | api/management/commands/verifyuser.py | from django.core.management.base import BaseCommand, CommandError
from api.models import Account
import fileinput
import sys
class Command(BaseCommand):
can_import_settings = True
def handle(self, *args, **options):
if len(args) < 1:
print 'Specify account'
return
accou... | Add a command to verify users | Add a command to verify users
| Python | apache-2.0 | SchoolIdolTomodachi/SchoolIdolAPI,rdsathene/SchoolIdolAPI,laurenor/SchoolIdolAPI,dburr/SchoolIdolAPI,laurenor/SchoolIdolAPI,SchoolIdolTomodachi/SchoolIdolAPI,dburr/SchoolIdolAPI,rdsathene/SchoolIdolAPI,dburr/SchoolIdolAPI,SchoolIdolTomodachi/SchoolIdolAPI,rdsathene/SchoolIdolAPI,laurenor/SchoolIdolAPI | ---
+++
@@ -0,0 +1,30 @@
+from django.core.management.base import BaseCommand, CommandError
+from api.models import Account
+import fileinput
+import sys
+
+class Command(BaseCommand):
+ can_import_settings = True
+
+ def handle(self, *args, **options):
+ if len(args) < 1:
+ print 'Specify acc... | |
22924945638989ebf620c262ae8de37a8b4508c6 | mistral/api/wsgi.py | mistral/api/wsgi.py | # Copyright 2015 - StackStorm, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Add WSGI script for API server | Add WSGI script for API server
Include a WSGI script for the API server so it can be used with Apache
or Nginx deployment.
Change-Id: I16166f78b5975dad0480a7ee4ccde47f234f5802
Implements: blueprint mistral-api-wsgi-script
| Python | apache-2.0 | StackStorm/mistral,dennybaa/mistral,dennybaa/mistral,openstack/mistral,StackStorm/mistral,openstack/mistral | ---
+++
@@ -0,0 +1,21 @@
+# Copyright 2015 - StackStorm, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# U... | |
9b5dbc51c9d20fdbdaf63aa4cce0ac683c22013c | contrib/filter_redirects.py | contrib/filter_redirects.py | """
A simple script to filter the output of the redirects spreadsheet we made into
a CSV suitable for loading into the redirects app with
python manage.py import_redirects_csv ...
Usage:
python filter_redirects.py <spreadsheet.csv >redirects.csv
"""
from __future__ import absolute_import, print_function
i... | Add script for munging redirects | Add script for munging redirects
| Python | mit | okfn/website,okfn/foundation,MjAbuz/foundation,okfn/website,okfn/foundation,okfn/foundation,MjAbuz/foundation,okfn/website,MjAbuz/foundation,okfn/website,okfn/foundation,MjAbuz/foundation | ---
+++
@@ -0,0 +1,55 @@
+"""
+A simple script to filter the output of the redirects spreadsheet we made into
+a CSV suitable for loading into the redirects app with
+
+ python manage.py import_redirects_csv ...
+
+Usage:
+
+ python filter_redirects.py <spreadsheet.csv >redirects.csv
+
+"""
+
+from __future__ i... | |
9835b069ea931cbadae92a9e10bcdff513ae425d | readthedocs/core/management/commands/build_files.py | readthedocs/core/management/commands/build_files.py | import logging
from django.core.management.base import BaseCommand
from django.conf import settings
from projects import tasks
from projects.models import ImportedFile
from builds.models import Version
log = logging.getLogger(__name__)
class Command(BaseCommand):
help = '''\
Delete and re-create ImportedFile ... | import logging
from django.core.management.base import BaseCommand
from django.conf import settings
from projects import tasks
from projects.models import ImportedFile
from builds.models import Version
log = logging.getLogger(__name__)
class Command(BaseCommand):
help = '''\
Delete and re-create ImportedFile ... | Index only latest by default. | Index only latest by default.
| Python | mit | singingwolfboy/readthedocs.org,VishvajitP/readthedocs.org,SteveViss/readthedocs.org,GovReady/readthedocs.org,CedarLogic/readthedocs.org,kenshinthebattosai/readthedocs.org,istresearch/readthedocs.org,laplaceliu/readthedocs.org,rtfd/readthedocs.org,kenshinthebattosai/readthedocs.org,fujita-shintaro/readthedocs.org,jerel/... | ---
+++
@@ -24,7 +24,7 @@
'''
# Delete all existing as a cleanup for any deleted projects.
ImportedFile.objects.all().delete()
- if getattr(settings, 'INDEX_ONLY_LATEST', False):
+ if getattr(settings, 'INDEX_ONLY_LATEST', True):
queryset = Version.objects.filter(... |
b6d253aac72abcbee53460b56e76aac7f33dd199 | scripts/get_bank_registry_at.py | scripts/get_bank_registry_at.py | import json
import csv
import requests
URL = "https://www.oenb.at/docroot/downloads_observ/sepa-zv-vz_gesamt.csv"
def process():
registry = []
with requests.get(URL, stream=True) as csvfile:
count = 0
for row in csvfile.iter_lines():
if count != 6:
count += 1
... | Add script to generate AT bank registry | Add script to generate AT bank registry
| Python | mit | figo-connect/schwifty | ---
+++
@@ -0,0 +1,33 @@
+import json
+import csv
+import requests
+
+URL = "https://www.oenb.at/docroot/downloads_observ/sepa-zv-vz_gesamt.csv"
+
+
+def process():
+ registry = []
+ with requests.get(URL, stream=True) as csvfile:
+ count = 0
+ for row in csvfile.iter_lines():
+ if coun... | |
e6a8bd61ed82a1de862d8eadfdb31dda5577b1a8 | cnxepub/tests/scripts/test_collated_single_html.py | cnxepub/tests/scripts/test_collated_single_html.py | # -*- coding: utf-8 -*-
# ###
# Copyright (c) 2016, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###
import mimetypes
import os.path
import tempfile
import unittest
try:
from unittest import mock
except ... | Add a test for the validate-collated script | Add a test for the validate-collated script
| Python | agpl-3.0 | Connexions/cnx-epub,Connexions/cnx-epub,Connexions/cnx-epub | ---
+++
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+# ###
+# Copyright (c) 2016, Rice University
+# This software is subject to the provisions of the GNU Affero General
+# Public License version 3 (AGPLv3).
+# See LICENCE.txt for details.
+# ###
+
+import mimetypes
+import os.path
+import tempfile
+import unittest
+tr... | |
aa777fd643f2eccebde94188d6179e820e84cc49 | test/test_SimExample.py | test/test_SimExample.py | from os.path import dirname, realpath, sep, pardir
import sys
sys.path.append(dirname(realpath(__file__)) + sep + pardir + sep +
"examples")
import simExample
def test_sim():
simExample.run_simulation()
| Add a test runner for simExample. | Add a test runner for simExample.
| Python | mit | Tech-XCorp/ultracold-ions,hosseinsadeghi/ultracold-ions,Tech-XCorp/ultracold-ions,hosseinsadeghi/ultracold-ions | ---
+++
@@ -0,0 +1,10 @@
+from os.path import dirname, realpath, sep, pardir
+import sys
+sys.path.append(dirname(realpath(__file__)) + sep + pardir + sep +
+ "examples")
+import simExample
+
+def test_sim():
+ simExample.run_simulation()
+
+ | |
f115257cfc51b621554ac1d8de984a329f6a1942 | tests/test_api_views.py | tests/test_api_views.py | import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "api.api.settings")
import django
from django.test import TestCase
from rest_framework.test import APIRequestFactory
from api.webview.views import DocumentList
django.setup()
class APIViewTests(TestCase):
def setUp(self):
self.factory = APIRequ... | Move api tests to test dir | Move api tests to test dir
| Python | apache-2.0 | CenterForOpenScience/scrapi,mehanig/scrapi,mehanig/scrapi,felliott/scrapi,erinspace/scrapi,fabianvf/scrapi,fabianvf/scrapi,felliott/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi | ---
+++
@@ -0,0 +1,25 @@
+import os
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "api.api.settings")
+
+import django
+from django.test import TestCase
+from rest_framework.test import APIRequestFactory
+
+from api.webview.views import DocumentList
+
+django.setup()
+
+
+class APIViewTests(TestCase):
+
+ def s... | |
5a28eca2039bce9b6e8102c9330c3087ece9484a | cura/ProfileReader.py | cura/ProfileReader.py | # Copyright (c) 2016 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from UM.PluginObject import PluginObject
## A type of plug-ins that reads profiles from a file.
#
# The profile is then stored as instance container of the type user profile.
class ProfileReader(PluginObject):
def _... | Add profile reader plug-in type | Add profile reader plug-in type
This type of plug-in will load a file as an instance container of the user profile type.
Contributes to issue CURA-1278.
| Python | agpl-3.0 | fieldOfView/Cura,Curahelper/Cura,ynotstartups/Wanhao,fieldOfView/Cura,totalretribution/Cura,Curahelper/Cura,hmflash/Cura,hmflash/Cura,senttech/Cura,totalretribution/Cura,senttech/Cura,ynotstartups/Wanhao | ---
+++
@@ -0,0 +1,17 @@
+# Copyright (c) 2016 Ultimaker B.V.
+# Cura is released under the terms of the AGPLv3 or higher.
+
+from UM.PluginObject import PluginObject
+
+## A type of plug-ins that reads profiles from a file.
+#
+# The profile is then stored as instance container of the type user profile.
+class Pr... | |
fbca1fe9e8df6cde95c7082bfc465f75ad0380b1 | main.py | main.py | import subprocess
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import re
import math
from scipy.interpolate import griddata
class FEMMans:
def __init__(self, points, preamble):
self.points = points
self.preamble = preamble
self.x = np.zeros(points)
sel... | Add reading and plotting of .ans files | Add reading and plotting of .ans files
| Python | mit | DrLuke/FEMM-bode | ---
+++
@@ -0,0 +1,76 @@
+import subprocess
+import matplotlib as mpl
+import matplotlib.pyplot as plt
+import numpy as np
+import re
+import math
+from scipy.interpolate import griddata
+
+class FEMMans:
+ def __init__(self, points, preamble):
+ self.points = points
+ self.preamble = preamble
+ ... | |
228173482c273a49aa4df00a1bd524ec52be086b | examples/alert.py | examples/alert.py | import gtk
from sugar.graphics.alert import TimeoutAlert
window = gtk.Window()
box = gtk.VBox()
window.add(box)
def _timeout_alert_response_cb(alert, response_id):
if response_id is gtk.RESPONSE_OK:
print 'Ok or Timeout'
elif response_id is gtk.RESPONSE_CANCEL:
print 'Cancel'
box.remove(a... | Save As - add TimeoutAlert example | Save As - add TimeoutAlert example
| Python | lgpl-2.1 | sugarlabs/sugar-toolkit,sugarlabs/sugar-toolkit,sugarlabs/sugar-toolkit,sugarlabs/sugar-toolkit | ---
+++
@@ -0,0 +1,25 @@
+import gtk
+from sugar.graphics.alert import TimeoutAlert
+
+window = gtk.Window()
+
+box = gtk.VBox()
+window.add(box)
+
+def _timeout_alert_response_cb(alert, response_id):
+ if response_id is gtk.RESPONSE_OK:
+ print 'Ok or Timeout'
+ elif response_id is gtk.RESPONSE_CANCEL:
... | |
9f17c05916ed43d40e4fa21e156c8c0a9aac2b19 | test/os_win7.py | test/os_win7.py | #!/usr/bin/env python
"""
mbed SDK
Copyright (c) 2011-2015 ARM Limited
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 basic unit tests for Win7 specific platform | Add basic unit tests for Win7 specific platform
| Python | apache-2.0 | jjones646/mbed-ls,mazimkhan/mbed-ls,mtmtech/mbed-ls,jupe/mbed-ls,mazimkhan/mbed-ls,mtmtech/mbed-ls,jupe/mbed-ls,jjones646/mbed-ls | ---
+++
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+"""
+mbed SDK
+Copyright (c) 2011-2015 ARM Limited
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENS... | |
6e3d64ca0769732506fe4cb188b53e719645f641 | ArcToolbox/Scripts/change_datasource_paths.py | ArcToolbox/Scripts/change_datasource_paths.py | '''
Tool: Change Datasource Paths
Source: change_datasource_paths.py
Author: Matt.Wilkie@gov.yk.ca
License: X/MIT, (c) 2011 Environment Yukon
When data has moved to a different workspace AND feature dataset the regular
`findAndReplaceWorkspacePath` does not work. This script rectifies that.
Required Arguments:
... | Fix path where findAndReplaceWorkspacePath doesn't | Fix path where findAndReplaceWorkspacePath doesn't
When data has moved to a different workspace AND feature dataset the
regular
`findAndReplaceWorkspacePath` does not work. This script rectifies that.
| Python | mit | DougFirErickson/arcplus,maphew/arcplus,maphew/arcplus | ---
+++
@@ -0,0 +1,46 @@
+'''
+Tool: Change Datasource Paths
+Source: change_datasource_paths.py
+Author: Matt.Wilkie@gov.yk.ca
+License: X/MIT, (c) 2011 Environment Yukon
+
+When data has moved to a different workspace AND feature dataset the regular
+`findAndReplaceWorkspacePath` does not work. This script rec... | |
58fdd69ae5c493e3ae26278528fbff09c95c48cd | examples/client_auth.py | examples/client_auth.py | import aiohttp
import asyncio
@asyncio.coroutine
def go(session):
print('Query http://httpbin.org/basic-auth/andrew/password')
resp = yield from session.get(
'http://httpbin.org/basic-auth/andrew/password')
print(resp.status)
try:
body = yield from resp.text()
print(body)
f... | Add example for basic auth | Add example for basic auth
| Python | apache-2.0 | arthurdarcet/aiohttp,pathcl/aiohttp,elastic-coders/aiohttp,z2v/aiohttp,morgan-del/aiohttp,elastic-coders/aiohttp,moden-py/aiohttp,mind1master/aiohttp,danielnelson/aiohttp,rutsky/aiohttp,AlexLisovoy/aiohttp,panda73111/aiohttp,pfreixes/aiohttp,mind1master/aiohttp,AlexLisovoy/aiohttp,moden-py/aiohttp,AraHaanOrg/aiohttp,ja... | ---
+++
@@ -0,0 +1,28 @@
+import aiohttp
+import asyncio
+
+
+@asyncio.coroutine
+def go(session):
+ print('Query http://httpbin.org/basic-auth/andrew/password')
+ resp = yield from session.get(
+ 'http://httpbin.org/basic-auth/andrew/password')
+ print(resp.status)
+ try:
+ body = yield fro... | |
2c5fb5a0bcf47e49c9862891730615f6c180462f | crmapp/subscribers/forms.py | crmapp/subscribers/forms.py | from django import forms
from django.contrib.auth.forms import UserCreationForm
class SubscriberForm(UserCreationForm):
email = forms.EmailField(
required=True, widget=forms.TextInput(attrs={'class':'form-control'})
)
username = forms.CharField(
widget=forms.TextInput(attrs={'class':'form-c... | from django import forms
from django.contrib.auth.forms import UserCreationForm
from .models import Subscriber
class AddressMixin(forms.ModelForm):
class Meta:
model = Subscriber
fields = ('address_one', 'address_two', 'city', 'state',)
widgets = {
'address_one': forms.TextInp... | Create the Subscriber Form - Part II > Update the Form | Create the Subscriber Form - Part II > Update the Form
| Python | mit | tabdon/crmeasyapp,tabdon/crmeasyapp,deenaariff/Django | ---
+++
@@ -1,7 +1,27 @@
from django import forms
from django.contrib.auth.forms import UserCreationForm
-class SubscriberForm(UserCreationForm):
+from .models import Subscriber
+
+
+class AddressMixin(forms.ModelForm):
+ class Meta:
+ model = Subscriber
+ fields = ('address_one', 'address_two', ... |
def34fb7055824f57c3b9f93a40d9bc68b72f39d | pysingcells/abcstep.py | pysingcells/abcstep.py |
# -*- coding: utf-8 -*-
# std import
from enum import Enum
from abc import ABCMeta, abstractmethod
class StepStat(Enum):
nostat = 1
load = 2
no_ready = 3
ready = 4
succes = 5
failled = 6
class AbcStep(metaclass=ABCMeta):
""" Abstract class for mapper """
def __init__(self):
... | Add abstract class for step management | Add abstract class for step management
| Python | mit | Fougere87/pysingcells | ---
+++
@@ -0,0 +1,37 @@
+
+# -*- coding: utf-8 -*-
+
+# std import
+from enum import Enum
+from abc import ABCMeta, abstractmethod
+
+class StepStat(Enum):
+ nostat = 1
+ load = 2
+ no_ready = 3
+ ready = 4
+ succes = 5
+ failled = 6
+
+class AbcStep(metaclass=ABCMeta):
+ """ Abstract class for ... | |
e91682aee85d33b859f6f5be29ec6e518bd14544 | pytac/enabled_bpm_x.py | pytac/enabled_bpm_x.py | import pytac.load_csv
import pytac.epics
def main():
lattice = pytac.load_csv.load('VMX', pytac.epics.EpicsControlSystem())
bpms = lattice.get_elements('BPM')
disabled_devices = 0
for bpm in bpms:
if not bpm._devices['x'].is_enabled():
disabled_devices += 1
if not bpm._dev... | Print to the screen how many bpm devices are disabled | Print to the screen how many bpm devices are disabled
| Python | apache-2.0 | razvanvasile/Work-Mini-Projects,razvanvasile/Work-Mini-Projects,razvanvasile/Work-Mini-Projects | ---
+++
@@ -0,0 +1,20 @@
+import pytac.load_csv
+import pytac.epics
+
+
+def main():
+ lattice = pytac.load_csv.load('VMX', pytac.epics.EpicsControlSystem())
+ bpms = lattice.get_elements('BPM')
+
+ disabled_devices = 0
+ for bpm in bpms:
+ if not bpm._devices['x'].is_enabled():
+ disabl... | |
6afb3c7f8efbc8623c8af3c2de763f09ac15536c | polygraph/types/tests/test_field.py | polygraph/types/tests/test_field.py | from unittest import TestCase
from polygraph.exceptions import PolygraphSchemaError
from polygraph.types.field import (
field,
validate_field_types,
validate_method_annotations,
)
from polygraph.types.lazy_type import LazyType
from polygraph.types.object_type import ObjectType
from polygraph.types.scalar i... | Add test case around field type validation | Add test case around field type validation
| Python | mit | polygraph-python/polygraph | ---
+++
@@ -0,0 +1,54 @@
+from unittest import TestCase
+
+from polygraph.exceptions import PolygraphSchemaError
+from polygraph.types.field import (
+ field,
+ validate_field_types,
+ validate_method_annotations,
+)
+from polygraph.types.lazy_type import LazyType
+from polygraph.types.object_type import Obj... | |
795681f19f80eca114c05d1e2c4e73a48529f27a | edit_distance/python/edit_distance.py | edit_distance/python/edit_distance.py | # Helpful tutorial: https://www.youtube.com/watch?v=We3YDTzNXEk
# Useful link: https://en.wikipedia.org/wiki/Edit_distance
def get_edit_distance(s1, s2):
l1 = len(s1) + 1
l2 = len(s2) + 1
edit_table = {}
for i in range(l1):
edit_table[i, 0] = i
for j in range(l2):
edit_table[0, j] ... | Add edit distance algorithm in python | Add edit distance algorithm in python
| Python | apache-2.0 | churrizo/Algorithms_Example,xiroV/Algorithms_Example,churrizo/Algorithms_Example,churrizo/Algorithms_Example,AtoMc/Algorithms_Example,pranjalrai/Algorithms_Example,Anat-Port/Algorithms_Example,pranjalrai/Algorithms_Example,maazsq/Algorithms_Example,alok760/Algorithms_Example,churrizo/Algorithms_Example,churrizo/Algorit... | ---
+++
@@ -0,0 +1,31 @@
+# Helpful tutorial: https://www.youtube.com/watch?v=We3YDTzNXEk
+# Useful link: https://en.wikipedia.org/wiki/Edit_distance
+def get_edit_distance(s1, s2):
+
+ l1 = len(s1) + 1
+ l2 = len(s2) + 1
+ edit_table = {}
+ for i in range(l1):
+ edit_table[i, 0] = i
+
+ for j i... | |
e832f29697dc0308a99b60008a538f21f59a44f5 | documentation/html.py | documentation/html.py | """Documentation of the JSON representing HTML."""
# an html element
ELEMENT = {
"type": "element",
"name": "", # name of HTML tag
"attrs": {}, # dictionary of type dice[str,str] for tag attrbutes
"children": [] # list of children (also HTML elements)
}
# Attributes of an HTML element
ATTRIBU... | Add docs for structure of JSON for HTML | doc: Add docs for structure of JSON for HTML
| Python | apache-2.0 | Lodifice/mfnf-pdf-export,Lodifice/mfnf-pdf-export,Lodifice/mfnf-pdf-export | ---
+++
@@ -0,0 +1,15 @@
+"""Documentation of the JSON representing HTML."""
+
+# an html element
+ELEMENT = {
+ "type": "element",
+ "name": "", # name of HTML tag
+ "attrs": {}, # dictionary of type dice[str,str] for tag attrbutes
+ "children": [] # list of children (also HTML elements)
+}
+
+#... | |
64fc8cbccd753e0d56157a588902ace934a0a600 | setup.py | setup.py | #!/usr/bin/env python
import os
from setuptools import setup
def read(fname):
with open(os.path.join(os.path.dirname(__file__), fname)) as fp:
return fp.read()
setup(
name='django-decorator-include',
version='1.3',
license='BSD',
description='Include Django URL patterns with decorators... | #!/usr/bin/env python
import os
from setuptools import setup
def read(fname):
with open(os.path.join(os.path.dirname(__file__), fname)) as fp:
return fp.read()
setup(
name='django-decorator-include',
version='1.3',
license='BSD',
description='Include Django URL patterns with decorators... | Remove duplicate trove classifier for Python | Remove duplicate trove classifier for Python
Alphabetize list to help catch potential future duplication.
| Python | bsd-2-clause | jdufresne/django-decorator-include,twidi/django-decorator-include,jdufresne/django-decorator-include,twidi/django-decorator-include | ---
+++
@@ -32,8 +32,6 @@
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
- 'Topic :: Internet :: WWW/HTTP',
- 'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programm... |
fe7d96c9182831613f4f44bc6c4f5903c7e02858 | setup.py | setup.py | from setuptools import setup
def fread(fn):
return open(fn, 'rb').read().decode('utf-8')
setup(
name='tox-travis',
description='Seamless integration of Tox into Travis CI',
long_description=fread('README.rst') + '\n\n' + fread('HISTORY.rst'),
author='Ryan Hiebert',
author_email='ryan@ryanhieb... | from setuptools import setup
def fread(fn):
return open(fn, 'rb').read().decode('utf-8')
setup(
name='tox-travis',
description='Seamless integration of Tox into Travis CI',
long_description=fread('README.rst') + '\n\n' + fread('HISTORY.rst'),
author='Ryan Hiebert',
author_email='ryan@ryanhieb... | Add Python 3.5 trove classifier | Add Python 3.5 trove classifier
| Python | mit | rpkilby/tox-travis,ryanhiebert/tox-travis,tox-dev/tox-travis | ---
+++
@@ -27,5 +27,6 @@
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
+ 'Programming Language :: Python :: 3.5',
],
) |
fb9df7b3e02d605c3888f1b30cb799f1c95928dc | examples/keras/mnist_mlp.py | examples/keras/mnist_mlp.py | '''Trains a simple deep NN on the MNIST dataset.
Gets to 98.40% test accuracy after 20 epochs
(there is *a lot* of margin for parameter tuning).
2 seconds per epoch on a K520 GPU.
'''
from __future__ import print_function
import numpy as np
np.random.seed(1337) # for reproducibility
from keras.datasets import mnist... | Add some example model - simple network on MNIST. | Add some example model - simple network on MNIST.
A basic example from Keras - https://github.com/fchollet/keras/tree/master/examples
| Python | mit | bzamecnik/sanctuary | ---
+++
@@ -0,0 +1,60 @@
+'''Trains a simple deep NN on the MNIST dataset.
+
+Gets to 98.40% test accuracy after 20 epochs
+(there is *a lot* of margin for parameter tuning).
+2 seconds per epoch on a K520 GPU.
+'''
+
+from __future__ import print_function
+import numpy as np
+np.random.seed(1337) # for reproducibil... | |
0bea26ee40261f5f7da0f6acb74dce8aabfd5856 | photutils/utils/tests/test_parameters.py | photutils/utils/tests/test_parameters.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for the parameters module.
"""
import numpy as np
from numpy.testing import assert_equal
import pytest
from .._parameters import as_pair
def test_as_pair():
assert_equal(as_pair('myparam', 4), (4, 4))
assert_equal(as_pair('myparam', ... | Add unit tests for as_pair | Add unit tests for as_pair
| Python | bsd-3-clause | astropy/photutils,larrybradley/photutils | ---
+++
@@ -0,0 +1,33 @@
+# Licensed under a 3-clause BSD style license - see LICENSE.rst
+"""
+Tests for the parameters module.
+"""
+
+import numpy as np
+from numpy.testing import assert_equal
+import pytest
+
+from .._parameters import as_pair
+
+
+def test_as_pair():
+ assert_equal(as_pair('myparam', 4), (4, ... | |
6b81d4f79112347262f0b43965531f300db0ef26 | jarviscli/tests/test_cryptotracker.py | jarviscli/tests/test_cryptotracker.py | import unittest
from colorama import Fore
from tests import PluginTest
from mock import patch
from plugins import cryptotracker
class TestCryptotracker(PluginTest):
"""
A test class that contains test cases for the methods of
the cryptotracker plugin.
"""
def setUp(self):
self.module = se... | Create test cases for the cryptotracker plugin | Create test cases for the cryptotracker plugin
| Python | mit | sukeesh/Jarvis,sukeesh/Jarvis,sukeesh/Jarvis,sukeesh/Jarvis | ---
+++
@@ -0,0 +1,73 @@
+import unittest
+from colorama import Fore
+from tests import PluginTest
+from mock import patch
+from plugins import cryptotracker
+
+
+class TestCryptotracker(PluginTest):
+ """
+ A test class that contains test cases for the methods of
+ the cryptotracker plugin.
+ """
+
+ ... | |
28b4fa36a7ae022324fb89d69c14ebf9201ad116 | lib/GenomeFileUtil/core/exceptions.py | lib/GenomeFileUtil/core/exceptions.py | import json
class RENotFound(RuntimeError):
"""A resource was not found on the relation engine."""
def __init__(self, coll, key, val, resp_json):
"""
`key` - the key we used to try to find something.
`val` - the val we used to try to look up the above key.
"""
self.key... | Add an RENotFound exception class to be raised when we cannot locate a required resource on RE | Add an RENotFound exception class to be raised when we cannot locate a required resource on RE
| Python | mit | kbaseapps/GenomeFileUtil,kbaseapps/GenomeFileUtil,kbaseapps/GenomeFileUtil,kbaseapps/GenomeFileUtil | ---
+++
@@ -0,0 +1,22 @@
+import json
+
+
+class RENotFound(RuntimeError):
+ """A resource was not found on the relation engine."""
+
+ def __init__(self, coll, key, val, resp_json):
+ """
+ `key` - the key we used to try to find something.
+ `val` - the val we used to try to look up the ab... | |
1ed276fceba0a4d8a105bc2b60986d815326dcca | tests/test_utils.py | tests/test_utils.py | import datetime
import unittest
import hiro
from hiro.errors import InvalidTypeError
from hiro.utils import timedelta_to_seconds, time_in_seconds, chained
class TestTimeDeltaToSeconds(unittest.TestCase):
def test_fractional(self):
delta = datetime.timedelta(seconds=1, microseconds=1000)
self.asse... | Add test suite for hiro.utils | Add test suite for hiro.utils
| Python | mit | alisaifee/hiro,alisaifee/hiro | ---
+++
@@ -0,0 +1,56 @@
+import datetime
+import unittest
+
+import hiro
+from hiro.errors import InvalidTypeError
+from hiro.utils import timedelta_to_seconds, time_in_seconds, chained
+
+
+class TestTimeDeltaToSeconds(unittest.TestCase):
+ def test_fractional(self):
+ delta = datetime.timedelta(seconds=1... | |
be4388302069e59996438f083ab738470a68860c | jenkinsapi/utils/krb_requester.py | jenkinsapi/utils/krb_requester.py | from jenkinsapi.utils.requester import Requester
from requests_kerberos import HTTPKerberosAuth, OPTIONAL
class KrbRequester(Requester):
"""
A class which carries out HTTP requests with Kerberos/GSSAPI authentication.
"""
def __init__(self, ssl_verify=None, baseurl=None, mutual_auth=OPTIONAL):
... | Add kerberos authentication requester using requests_kerberos | Add kerberos authentication requester using requests_kerberos
| Python | mit | salimfadhley/jenkinsapi,JohnLZeller/jenkinsapi,imsardine/jenkinsapi,jduan/jenkinsapi,aerickson/jenkinsapi,mistermocha/jenkinsapi,imsardine/jenkinsapi,jduan/jenkinsapi,mistermocha/jenkinsapi,JohnLZeller/jenkinsapi,zaro0508/jenkinsapi,zaro0508/jenkinsapi,aerickson/jenkinsapi,mistermocha/jenkinsapi,zaro0508/jenkinsapi,sal... | ---
+++
@@ -0,0 +1,34 @@
+from jenkinsapi.utils.requester import Requester
+from requests_kerberos import HTTPKerberosAuth, OPTIONAL
+
+
+class KrbRequester(Requester):
+
+ """
+ A class which carries out HTTP requests with Kerberos/GSSAPI authentication.
+ """
+
+ def __init__(self, ssl_verify=None, base... | |
5e99e33df59ebb40c1c49f66b6b88244292d7d1b | data/tm_prediction/parallel_tmhmm.py | data/tm_prediction/parallel_tmhmm.py | #!/usr/bin/env python3
#-*- coding: utf-8 -*-
"""
Script to process tmhmm in parallel
"""
from Bio import SeqIO
import argparse
import os
import sys
import multiprocessing
def parse_and_validate(args):
"""
Parse input args
"""
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--inpu... | Add arg parsing for parallel tmhmm script | Add arg parsing for parallel tmhmm script
| Python | apache-2.0 | fmaguire/volution,fmaguire/volution,fmaguire/volution | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/bin/env python3
+#-*- coding: utf-8 -*-
+"""
+Script to process tmhmm in parallel
+"""
+
+from Bio import SeqIO
+
+import argparse
+import os
+import sys
+import multiprocessing
+
+def parse_and_validate(args):
+ """
+ Parse input args
+ """
+
+ parser = argparse.ArgumentP... | |
2ebbb9dcf32ec1bee38f59e6be24c17529402042 | money_rounding.py | money_rounding.py | def get_price_without_vat(price_to_show, vat_percent):
raise NotImplementedError()
def get_price_without_vat_from_other_valuta(conversion_rate, origin_price,
origin_vat, other_vat):
raise NotImplementedError()
| Add task for rounding of money | Add task for rounding of money
| Python | mit | coolshop-com/coolshop-application-assignment | ---
+++
@@ -0,0 +1,7 @@
+def get_price_without_vat(price_to_show, vat_percent):
+ raise NotImplementedError()
+
+
+def get_price_without_vat_from_other_valuta(conversion_rate, origin_price,
+ origin_vat, other_vat):
+ raise NotImplementedError() | |
859a13523da2c06dd031451d3d458cc3665ee295 | dtda_module.py | dtda_module.py | from jnius import autoclass, cast
from TripsModule import trips_module
KQMLPerformative = autoclass('TRIPS.KQML.KQMLPerformative')
KQMLList = autoclass('TRIPS.KQML.KQMLList')
KQMLObject = autoclass('TRIPS.KQML.KQMLObject')
from bioagents.dtda import DTDA
class DTDA_Module(trips_module.TripsModule):
def __init__(... | Implement DTDA as TRIPS module | Implement DTDA as TRIPS module
| Python | bsd-2-clause | bgyori/bioagents,sorgerlab/bioagents | ---
+++
@@ -0,0 +1,74 @@
+from jnius import autoclass, cast
+from TripsModule import trips_module
+
+KQMLPerformative = autoclass('TRIPS.KQML.KQMLPerformative')
+KQMLList = autoclass('TRIPS.KQML.KQMLList')
+KQMLObject = autoclass('TRIPS.KQML.KQMLObject')
+
+from bioagents.dtda import DTDA
+
+class DTDA_Module(trips_m... | |
a4b6d4c7880222901ddcd53485100a8ee3a784f2 | backend/django/apps/accounts/serializers.py | backend/django/apps/accounts/serializers.py | from rest_framework import serializers
from .models import AbstractAccount
class WholeAccountSerializer(serializers.ModelSerializer):
password = serializers.CharField(write_only=True, required=False)
class Meta:
model = AbstractAccount
fields = ('id', 'first_name', 'last_name', 'email', 'pass... | Create the serializer for the AbstractAccount | Create the serializer for the AbstractAccount
| Python | mit | slavpetroff/sweetshop,slavpetroff/sweetshop | ---
+++
@@ -0,0 +1,19 @@
+from rest_framework import serializers
+from .models import AbstractAccount
+
+
+class WholeAccountSerializer(serializers.ModelSerializer):
+ password = serializers.CharField(write_only=True, required=False)
+
+ class Meta:
+ model = AbstractAccount
+ fields = ('id', 'fir... | |
282477965c07124f4cba7b647b2f9ab1b54d9903 | scripts/occupy_seat_group.py | scripts/occupy_seat_group.py | #!/usr/bin/env python
"""Occupy a seat group with a ticket bundle.
:Copyright: 2006-2018 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import click
from byceps.services.seating import seat_group_service
from byceps.services.ticketing import ticket_bundle_service
from byceps.util.system i... | Add script to occupy a seat group with a ticket bundle | Add script to occupy a seat group with a ticket bundle
| Python | bsd-3-clause | homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps,m-ober/byceps,m-ober/byceps,m-ober/byceps | ---
+++
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+
+"""Occupy a seat group with a ticket bundle.
+
+:Copyright: 2006-2018 Jochen Kupperschmidt
+:License: Modified BSD, see LICENSE for details.
+"""
+
+import click
+
+from byceps.services.seating import seat_group_service
+from byceps.services.ticketing import ticket_b... | |
1cd21ad4538cd71e93fec3a7efac29646503bde7 | white_balance.py | white_balance.py | import cv2
import numpy as np
import plantcv as pcv
def white_balance(img, roi=None):
"""Corrects the exposure of an image based on its histogram.
Inputs:
img - A grayscale image on which to perform the correction
roi - A list of 4 points (x, y, width, height) that form the rectangular ROI of the whi... | import cv2
import numpy as np
import plantcv as pcv
def white_balance(img, roi=None):
"""Corrects the exposure of an image based on its histogram.
Inputs:
img - A grayscale image on which to perform the correction
roi - A list of 4 points (x, y, width, height) that form the rectangular ROI of the whi... | Fix Bug for Nonetype ROI | Fix Bug for Nonetype ROI
| Python | mit | danforthcenter/plantcv-seeds | ---
+++
@@ -15,10 +15,10 @@
img - Image after exposure correction
"""
# Finds histogram of roi if valid roi is given. Otherwise, finds histogram of entire image
- if len(roi) != 4:
+ if roi is not None and len(roi) == 4:
+ hist = cv2.calcHist(tuple(img[roi[1]:roi[1]+roi[3], roi[0]:roi[0]+r... |
cc6aad9324373d4dd7860ec2e5e807ae4ec03028 | test/option--.py | test/option--.py | #!/usr/bin/env python
__revision__ = "test/option-n.py __REVISION__ __DATE__ __DEVELOPER__"
import TestCmd
import os.path
import string
import sys
test = TestCmd.TestCmd(program = 'scons.py',
workdir = '',
interpreter = 'python')
test.write('build.py', r"""
import sys
f... | Add a test for -- terminating option processing. | Add a test for -- terminating option processing.
git-svn-id: 7892167f69f80ee5d3024affce49f20c74bcb41d@48 fdb21ef1-2011-0410-befe-b5e4ea1792b1
| Python | mit | azverkan/scons,datalogics-robb/scons,azverkan/scons,azverkan/scons,datalogics-robb/scons,datalogics/scons,datalogics/scons,datalogics-robb/scons,datalogics-robb/scons,datalogics/scons,azverkan/scons,azverkan/scons,datalogics/scons | ---
+++
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+
+__revision__ = "test/option-n.py __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestCmd
+import os.path
+import string
+import sys
+
+test = TestCmd.TestCmd(program = 'scons.py',
+ workdir = '',
+ interpreter = 'python')
+
... | |
1d0faecd1f8897e4b9e68cb62cc49125250ff59f | k8s_snapshots/rule.py | k8s_snapshots/rule.py | from typing import Dict, Any
import attr
@attr.s(slots=True)
class Rule:
"""
A rule describes how and when to make backups.
"""
volume_name = attr.ib()
namespace = attr.ib()
deltas = attr.ib()
gce_disk = attr.ib()
gce_disk_zone = attr.ib()
claim_name = attr.ib()
@property
... | from typing import Dict, Any
import attr
@attr.s(slots=True)
class Rule:
"""
A rule describes how and when to make backups.
"""
name = attr.ib()
namespace = attr.ib()
deltas = attr.ib()
gce_disk = attr.ib()
gce_disk_zone = attr.ib()
claim_name = attr.ib()
@property
def... | Fix accidentally commited attribute name change | Fix accidentally commited attribute name change
| Python | bsd-2-clause | miracle2k/k8s-snapshots,EQTPartners/k8s-snapshots | ---
+++
@@ -9,7 +9,7 @@
A rule describes how and when to make backups.
"""
- volume_name = attr.ib()
+ name = attr.ib()
namespace = attr.ib()
deltas = attr.ib() |
6444674ced35019c3139dfeb7af69dfe985b3fe1 | choosealicense/test/test_context.py | choosealicense/test/test_context.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Tests for the `license context` function
"""
from click.testing import CliRunner
from choosealicense.main import (context, LICENSE_WITH_CONTEXT,
get_default_context)
def test_show_license_context():
all_the_licenses = ('agpl... | Add test for `license context` function | Add test for `license context` function
| Python | mit | lord63/choosealicense-cli | ---
+++
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+ Tests for the `license context` function
+"""
+
+from click.testing import CliRunner
+
+from choosealicense.main import (context, LICENSE_WITH_CONTEXT,
+ get_default_context)
+
+
+def test_show_license... | |
a90b6fb3b03fb177b07814873f1fcfe01c7cab6a | labonneboite/alembic/versions/c519ecaf1fa6_deduplicate_users.py | labonneboite/alembic/versions/c519ecaf1fa6_deduplicate_users.py | """
deduplicate users
Revision ID: c519ecaf1fa6
Revises: a6ff4a27b063
Create Date: 2018-09-26 16:45:13.810694
"""
# from alembic import op
import sqlalchemy as sa
# Revision identifiers, used by Alembic.
revision = 'c519ecaf1fa6'
down_revision = 'a6ff4a27b063'
branch_labels = None
depends_on = None
def upgrade():... | Add data migration to deduplicate users | Add data migration to deduplicate users
| Python | agpl-3.0 | StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite | ---
+++
@@ -0,0 +1,55 @@
+"""
+deduplicate users
+
+Revision ID: c519ecaf1fa6
+Revises: a6ff4a27b063
+Create Date: 2018-09-26 16:45:13.810694
+"""
+# from alembic import op
+
+import sqlalchemy as sa
+
+
+# Revision identifiers, used by Alembic.
+revision = 'c519ecaf1fa6'
+down_revision = 'a6ff4a27b063'
+branch_label... | |
8b80caed94f4bed7e970f6b7c730b71de2133da8 | django_adaptive/cached.py | django_adaptive/cached.py | """
Provide support for Cached loader.
Generate key for cached templates based on template names
and device type (desktop or mobile or tablet)
"""
from django.template.loaders.cached import Loader as CachedLoader
from django_adaptive.loader_utils import get_template_suffix
class AdaptiveTemplateCache(dict):
def ... | Support for Cached template loader with django adaptive | Support for Cached template loader with django adaptive
| Python | bsd-3-clause | RevSquare/django-adaptive | ---
+++
@@ -0,0 +1,31 @@
+"""
+Provide support for Cached loader.
+Generate key for cached templates based on template names
+and device type (desktop or mobile or tablet)
+"""
+from django.template.loaders.cached import Loader as CachedLoader
+from django_adaptive.loader_utils import get_template_suffix
+
+
+class A... | |
89570d098dd15b11e8787e44c353e27dfc1debff | dashboard_app/migrations/0002_auto_20140917_1935.py | dashboard_app/migrations/0002_auto_20140917_1935.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('dashboard_app', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='bundle',
name='... | Add automatic migration for dashboard changes. | Add automatic migration for dashboard changes.
Migrations for 'dashboard_app':
0002_auto_20140917_1935.py:
- Alter field is_deserialized on bundle
- Alter field is_anonymous on bundlestream
- Alter field time_check_performed on testrun
Change-Id: I2627c0b48512ceb0c50bb8d29ea67827a6f73c80
| Python | agpl-3.0 | Linaro/lava-server,Linaro/lava-server,Linaro/lava-server,Linaro/lava-server | ---
+++
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('dashboard_app', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ ... | |
ab0ecd4defaffc2e342d435ca490dd28e0314316 | tests/test_simpleflow/test_exceptions.py | tests/test_simpleflow/test_exceptions.py | import unittest
from sure import expect
from simpleflow.exceptions import TaskFailed
class TestTaskFailed(unittest.TestCase):
def test_task_failed_representation(self):
failure = TaskFailed("message", None, None)
expect(str(failure)).to.equal("('message', None, None)")
expect(repr(failur... | Add basic tests for simpleflow.exceptions.TaskFailed | Add basic tests for simpleflow.exceptions.TaskFailed
| Python | mit | botify-labs/simpleflow,botify-labs/simpleflow | ---
+++
@@ -0,0 +1,16 @@
+import unittest
+
+from sure import expect
+
+from simpleflow.exceptions import TaskFailed
+
+
+class TestTaskFailed(unittest.TestCase):
+ def test_task_failed_representation(self):
+ failure = TaskFailed("message", None, None)
+ expect(str(failure)).to.equal("('message', No... | |
ab55836a2ff1ab5ec1ee62a5119b2dbadf8944a9 | tests/rules_tests/isValid_tests/EpsilonTest.py | tests/rules_tests/isValid_tests/EpsilonTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
"""
from unittest import main, TestCase
from grammpy import Rule, EPS
from .grammar import *
class EpsilonTest(TestCase):
pass
if __name__ == '__main__':
main()
| Add file to epsilon tests | Add file to epsilon tests
| Python | mit | PatrikValkovic/grammpy | ---
+++
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+"""
+:Author Patrik Valkovic
+:Created 23.06.2017 16:39
+:Licence GNUv3
+Part of grammpy
+
+"""
+
+from unittest import main, TestCase
+from grammpy import Rule, EPS
+from .grammar import *
+
+
+class EpsilonTest(TestCase):
+ pass
+
+
+if __name__ == '__main__':
+ ... | |
31d2686555a93ddadd3713c3c880b75641d98d89 | scripts/read_reldist.py | scripts/read_reldist.py | import os
import yaml
from thermof.parameters import plot_parameters
from thermof.read import read_framework_distance
# --------------------------------------------------------------------------------------------------
main = ''
results_file = '%s-reldist-results.yaml' % os.path.basename(main)
run_list_file = '%s-run-... | Add script for reading reldist for multiple trials | Add script for reading reldist for multiple trials
| Python | mit | kbsezginel/tee_mof,kbsezginel/tee_mof | ---
+++
@@ -0,0 +1,19 @@
+import os
+import yaml
+from thermof.parameters import plot_parameters
+from thermof.read import read_framework_distance
+
+# --------------------------------------------------------------------------------------------------
+main = ''
+results_file = '%s-reldist-results.yaml' % os.path.base... | |
9ceb3373b2e812662e402d797207b3cadd74b034 | tests/functional/test_06_jenkins.py | tests/functional/test_06_jenkins.py | #!/usr/bin/python
#
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
#
# 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 r... | Add a simple functional tests for jenkins: check config-* jobs | Add a simple functional tests for jenkins: check config-* jobs
Change-Id: I41f880e55fe380273ed614944bc4523278501252
| Python | apache-2.0 | invenfantasy/software-factory,enovance/software-factory,invenfantasy/software-factory,invenfantasy/software-factory,invenfantasy/software-factory,enovance/software-factory,enovance/software-factory,enovance/software-factory,invenfantasy/software-factory,enovance/software-factory | ---
+++
@@ -0,0 +1,32 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
+#
+# 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.o... | |
99b680ee8d610e1c0d02c53e465a510e3c5a50d3 | thinc/tests/unit/test_exceptions.py | thinc/tests/unit/test_exceptions.py | import pytest
from .. import exceptions as e
def test_shape_error():
raise_if(e.ShapeError.dimensions_mismatch(10, 20, 'inside test'))
def raise_if(e):
if e is not None:
raise e.with_traceback(self.tb)
| Add unit test for exceptions | Add unit test for exceptions
| Python | mit | explosion/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc,explosion/thinc,spacy-io/thinc | ---
+++
@@ -0,0 +1,13 @@
+import pytest
+
+from .. import exceptions as e
+
+
+def test_shape_error():
+ raise_if(e.ShapeError.dimensions_mismatch(10, 20, 'inside test'))
+
+
+def raise_if(e):
+ if e is not None:
+ raise e.with_traceback(self.tb)
+ | |
4cb92cbfd79117b81ac8b4fa9533c01933eb5770 | shuup/admin/settings.py | shuup/admin/settings.py | # -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
"""
Settings of Shuup Admi... | Add missed wizard spec setting definition | Admin: Add missed wizard spec setting definition
| Python | agpl-3.0 | shoopio/shoop,shoopio/shoop,suutari-ai/shoop,suutari-ai/shoop,shoopio/shoop,suutari-ai/shoop | ---
+++
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+# This file is part of Shuup.
+#
+# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.
+#
+# This source code is licensed under the AGPLv3 license found in the
+# LICENSE file in the root directory of this source tree.
+from __future__ import unicode_l... | |
1b310904b641dda7ad74e98a24f62d573bbd81f8 | chrome/browser/policy/PRESUBMIT.py | chrome/browser/policy/PRESUBMIT.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Chromium presubmit script for chrome/browser/policy.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details on ... | Send try jobs that touch policy code to the linux_chromeos bot too. | Send try jobs that touch policy code to the linux_chromeos bot too.
Review URL: https://chromiumcodereview.appspot.com/10473015
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@140268 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | Jonekee/chromium.src,TheTypoMaster/chromium-crosswalk,hgl888/chromium-crosswalk-efl,anirudhSK/chromium,Jonekee/chromium.src,nacl-webkit/chrome_deps,M4sse/chromium.src,keishi/chromium,dednal/chromium.src,axinging/chromium-crosswalk,zcbenz/cefode-chromium,nacl-webkit/chrome_deps,keishi/chromium,pozdnyakov/chromium-crossw... | ---
+++
@@ -0,0 +1,15 @@
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Chromium presubmit script for chrome/browser/policy.
+
+See http://dev.chromium.org/developers/how-tos/depottools/pres... | |
e6a589d9a1a81e32de6f2e50ea7aaee4f5f6a6c3 | migrations/versions/820_untweak_g9_lots.py | migrations/versions/820_untweak_g9_lots.py | """no lots are products for G-Cloud 9 - they are all services
Revision ID: 820
Revises: 810
Create Date: 2017-02-01 11:20:00.000000
"""
# revision identifiers, used by Alembic.
revision = '820'
down_revision = '810'
from alembic import op
def upgrade():
# Update G-Cloud 9 lot records
op.execute("""
... | Revert change from services to products for G9 lots | Revert change from services to products for G9 lots
Just when I thought I was out, they pull me back in.
| Python | mit | alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api | ---
+++
@@ -0,0 +1,30 @@
+"""no lots are products for G-Cloud 9 - they are all services
+
+Revision ID: 820
+Revises: 810
+Create Date: 2017-02-01 11:20:00.000000
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '820'
+down_revision = '810'
+
+from alembic import op
+
+
+def upgrade():
+ # Update G-C... | |
deaa7d58271fab03bd403f068ef0e261bc6a6577 | mosqito/sound_synthesis/read_spectro_xls.py | mosqito/sound_synthesis/read_spectro_xls.py | # -*- coding: utf-8 -*-
from pandas import ExcelFile, read_excel
from numpy import squeeze, zeros, transpose
def read_spectro_xls(file_name):
"""Read spectrogram as an xls file, format: A3:AN = time, B3:BN = speed,
C1:ZZ1 = DC, C2:ZZ2 = orders, C3:ZZN = spectrum
and compute the frequencies
Parameters... | Read spectro from excel file with orders as input | [NF] Read spectro from excel file with orders as input
| Python | apache-2.0 | Eomys/MoSQITo | ---
+++
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+from pandas import ExcelFile, read_excel
+from numpy import squeeze, zeros, transpose
+
+def read_spectro_xls(file_name):
+ """Read spectrogram as an xls file, format: A3:AN = time, B3:BN = speed,
+ C1:ZZ1 = DC, C2:ZZ2 = orders, C3:ZZN = spectrum
+ and comp... | |
8782775bceeb01a1985627e1203359b6d67d5272 | numba/typesystem/exttypes/attributestype.py | numba/typesystem/exttypes/attributestype.py | from numba.typesystem import *
#------------------------------------------------------------------------
# Extension Attributes Type
#------------------------------------------------------------------------
class ExtensionAttributesTableType(NumbaType):
"""
Type for extension type attributes.
"""
def... | Add extension attribute table type | Add extension attribute table type
| Python | bsd-2-clause | numba/numba,stuartarchibald/numba,jriehl/numba,GaZ3ll3/numba,pombredanne/numba,stonebig/numba,stuartarchibald/numba,stefanseefeld/numba,shiquanwang/numba,gdementen/numba,pitrou/numba,GaZ3ll3/numba,stefanseefeld/numba,pitrou/numba,sklam/numba,pombredanne/numba,pitrou/numba,cpcloud/numba,gdementen/numba,IntelLabs/numba,j... | ---
+++
@@ -0,0 +1,31 @@
+from numba.typesystem import *
+
+#------------------------------------------------------------------------
+# Extension Attributes Type
+#------------------------------------------------------------------------
+
+class ExtensionAttributesTableType(NumbaType):
+ """
+ Type for extensi... | |
6cc2a8c748d50799d97ab8096e3fc2a82ebf674c | edb/tools/__main__.py | edb/tools/__main__.py | #
# This source file is part of the EdgeDB open source project.
#
# Copyright 2016-present MagicStack Inc. and the EdgeDB 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... | Allow running the `edb` command as `python -m edb.tools` | Allow running the `edb` command as `python -m edb.tools`
| Python | apache-2.0 | edgedb/edgedb,edgedb/edgedb,edgedb/edgedb | ---
+++
@@ -0,0 +1,27 @@
+#
+# This source file is part of the EdgeDB open source project.
+#
+# Copyright 2016-present MagicStack Inc. and the EdgeDB 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 ... | |
2cddde6dcee901021d449bf956bf144617ab3705 | setup.py | setup.py |
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
PACKAGES = [
'lib',
'lib.scripts',
'lib.scripts.biosql',
'lib.scripts.blast',
'lib.scripts.ftp',
'lib.scripts.genbank',
'lib.sc... | Develop here. Belongs in top level Orthologs Project. | Develop here. Belongs in top level Orthologs Project.
| Python | mit | datasnakes/Datasnakes-Scripts,datasnakes/Datasnakes-Scripts,datasnakes/Datasnakes-Scripts,datasnakes/Datasnakes-Scripts,datasnakes/Datasnakes-Scripts,datasnakes/Datasnakes-Scripts | ---
+++
@@ -0,0 +1,40 @@
+
+from setuptools import setup, find_packages
+# To use a consistent encoding
+from codecs import open
+from os import path
+
+here = path.abspath(path.dirname(__file__))
+PACKAGES = [
+ 'lib',
+ 'lib.scripts',
+ 'lib.scripts.biosql',
+ 'lib.scripts.blast',
+ 'lib.scripts.ftp'... | |
e583cb2baba822863cda6caf80dd5ebd0ce042c8 | helevents/migrations/0003_auto_20170915_1529.py | helevents/migrations/0003_auto_20170915_1529.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-15 12:29
from __future__ import unicode_literals
import django.contrib.auth.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('helevents', '0002_auto_20151231_1111'),
]
ope... | Add django 1.11 user migration to helevents | Add django 1.11 user migration to helevents
| Python | mit | City-of-Helsinki/linkedevents,City-of-Helsinki/linkedevents,City-of-Helsinki/linkedevents | ---
+++
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.5 on 2017-09-15 12:29
+from __future__ import unicode_literals
+
+import django.contrib.auth.validators
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('helevents', '00... | |
16a5b7897a76c9a53e60d78baf7fb94fcc59b220 | powerline/segments/shell.py | powerline/segments/shell.py | # -*- coding: utf-8 -*-
from powerline.theme import requires_segment_info
@requires_segment_info
def last_status(segment_info):
'''Return last exit code.'''
return str(segment_info.last_exit_code) if segment_info.last_exit_code else None
@requires_segment_info
def last_pipe_status(segment_info):
'''Return last ... | # -*- coding: utf-8 -*-
from powerline.theme import requires_segment_info
@requires_segment_info
def last_status(segment_info):
'''Return last exit code.'''
if not segment_info.last_exit_code:
return None
return [{'contents': str(segment_info.last_exit_code), 'highlight_group': 'exit_fail'}]
@requires_segment... | Use exit_fail hl group for last_status segment | Use exit_fail hl group for last_status segment
Fixes #270
| Python | mit | bezhermoso/powerline,darac/powerline,magus424/powerline,wfscheper/powerline,dragon788/powerline,prvnkumar/powerline,xxxhycl2010/powerline,QuLogic/powerline,magus424/powerline,russellb/powerline,seanfisk/powerline,cyrixhero/powerline,blindFS/powerline,bezhermoso/powerline,kenrachynski/powerline,prvnkumar/powerline,junix... | ---
+++
@@ -6,7 +6,9 @@
@requires_segment_info
def last_status(segment_info):
'''Return last exit code.'''
- return str(segment_info.last_exit_code) if segment_info.last_exit_code else None
+ if not segment_info.last_exit_code:
+ return None
+ return [{'contents': str(segment_info.last_exit_code), 'highlight_gro... |
fd8c2f45bd686a0f1e03891faf80f8c95d41f633 | services/management/commands/empty_search_columns.py | services/management/commands/empty_search_columns.py | import logging
from django.core.management.base import BaseCommand
from munigeo.models import Address, AdministrativeDivision
from services.models import Service, ServiceNode, Unit
logger = logging.getLogger("search")
MODELS = [Address, AdministrativeDivision, Unit, Service, ServiceNode]
class Command(BaseCommand... | Add management command that empty search columns | Add management command that empty search columns
| Python | agpl-3.0 | City-of-Helsinki/smbackend,City-of-Helsinki/smbackend | ---
+++
@@ -0,0 +1,22 @@
+import logging
+
+from django.core.management.base import BaseCommand
+from munigeo.models import Address, AdministrativeDivision
+
+from services.models import Service, ServiceNode, Unit
+
+logger = logging.getLogger("search")
+
+MODELS = [Address, AdministrativeDivision, Unit, Service, Ser... | |
455192b34b00e16b3fa0b2a45388de4327ca0c7b | notes/managers.py | notes/managers.py | #
# Copyright (c) 2009 Brad Taylor <brad@getcoded.net>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# This... | #
# Copyright (c) 2009 Brad Taylor <brad@getcoded.net>
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# This... | Fix typo that made private notes viewable by any other user. | Fix typo that made private notes viewable by any other user.
| Python | agpl-3.0 | leonhandreke/snowy,syskill/snowy,jaredjennings/snowy,jaredjennings/snowy,sandyarmstrong/snowy,leonhandreke/snowy,widox/snowy,NoUsername/PrivateNotesExperimental,nekohayo/snowy,widox/snowy,GNOME/snowy,nekohayo/snowy,syskill/snowy,jaredjennings/snowy,GNOME/snowy,sandyarmstrong/snowy,NoUsername/PrivateNotesExperimental,ja... | ---
+++
@@ -22,5 +22,5 @@
notes = self.filter(author=author)
if request_user != author:
# Public notes only
- notes.filter(permissions=1)
+ notes = notes.filter(permissions=1)
return notes |
07b5e63ba44b76158f7129720616199d6eb8401a | code2html/tests/unit/test_vim.py | code2html/tests/unit/test_vim.py | # -*- coding: utf-8 -*-
import unittest
from code2html.vim import vim_command
class VimCommandTest(unittest.TestCase):
def test_vim_command(self):
vimrc_file = '/tmp/temporary-vimrc'
expected = 'vim -u /tmp/temporary-vimrc -c TOhtml -c wqa'
self.assertEqual(expected, ' '.join(vim_command... | Add an unit test for vim.py | Add an unit test for vim.py
| Python | mit | kfei/code2html | ---
+++
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+
+import unittest
+
+from code2html.vim import vim_command
+
+
+class VimCommandTest(unittest.TestCase):
+ def test_vim_command(self):
+ vimrc_file = '/tmp/temporary-vimrc'
+ expected = 'vim -u /tmp/temporary-vimrc -c TOhtml -c wqa'
+ self.ass... | |
7bedccd6f6288c123f8dafb660417b6f7f4bde9c | tests/unit/test_vendor_tornado.py | tests/unit/test_vendor_tornado.py | # -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import, unicode_literals
import os
import re
import logging
# Import Salt Testing libs
from tests.support.unit import TestCase, skipIf
from tests.support.runtests import RUNTIME_VARS
# Import Salt libs
import salt.modules.cmdmod
import salt... | Add tests to validate vendor tornado usage | Add tests to validate vendor tornado usage
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+# Import Python libs
+from __future__ import absolute_import, unicode_literals
+import os
+import re
+import logging
+
+
+# Import Salt Testing libs
+from tests.support.unit import TestCase, skipIf
+from tests.support.runtests import RUNTIME_VARS
+
+# Import Salt lib... | |
f524a951286b4cef5689abe5a76bc88e13e24e22 | mindbender/maya/plugins/validate_frame_range.py | mindbender/maya/plugins/validate_frame_range.py | import pyblish.api
class ValidateMindbenderFrameRange(pyblish.api.InstancePlugin):
"""Animation should normally be published with the range for a shot"""
label = "Validate Frame Range"
order = pyblish.api.ValidatorOrder
hosts = ["maya"]
optional = True
families = [
"mindbender.animati... | Implement validate frame range, as optional | Implement validate frame range, as optional
| Python | mit | getavalon/core,mindbender-studio/core,MoonShineVFX/core,MoonShineVFX/core,getavalon/core,mindbender-studio/core | ---
+++
@@ -0,0 +1,31 @@
+import pyblish.api
+
+
+class ValidateMindbenderFrameRange(pyblish.api.InstancePlugin):
+ """Animation should normally be published with the range for a shot"""
+
+ label = "Validate Frame Range"
+ order = pyblish.api.ValidatorOrder
+ hosts = ["maya"]
+ optional = True
+ fa... | |
8bc4471b95884f00d58d1067ad90c6a3220ce61e | katagawa/sql/operators.py | katagawa/sql/operators.py | """
Operators - stuff like `column = 'value'`, and similar.
"""
import abc
from katagawa.sql import Token
from katagawa.sql.dialects.common import Field
class Operator(Token):
"""
The base class for an operator.
An operator has three attributes - the field, the other value, and the actual operator itsel... | Add operator module, which contains the base class for an Operator token. | [sql] Add operator module, which contains the base class for an Operator token.
| Python | mit | SunDwarf/asyncqlio | ---
+++
@@ -0,0 +1,60 @@
+"""
+Operators - stuff like `column = 'value'`, and similar.
+"""
+import abc
+
+from katagawa.sql import Token
+from katagawa.sql.dialects.common import Field
+
+
+class Operator(Token):
+ """
+ The base class for an operator.
+
+ An operator has three attributes - the field, the o... | |
19a9d49fe84f0ba89de04001d2a5d0c8cc3f135a | tools/print-zk.py | tools/print-zk.py | #!/usr/bin/env python
#
# 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, softwa... | Add a script to print the ZK tree | Add a script to print the ZK tree
This script uses a nodepool config file to connect to ZK and print
the entire contents of the ZK tree for debugging purposes.
Change-Id: I31566e15d915e701639325f757d1b917ad93c780
| Python | apache-2.0 | Tesora/tesora-nodepool,Tesora/tesora-nodepool | ---
+++
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+#
+# 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... | |
4a7fb72b496f036e33a8d48b120717f328828756 | corehq/apps/accounting/tests/test_enterprise_mode.py | corehq/apps/accounting/tests/test_enterprise_mode.py | from django.test import override_settings
from corehq import privileges
from corehq.apps.accounting.models import SoftwarePlanEdition
from corehq.apps.accounting.tests.base_tests import BaseAccountingTest
from corehq.apps.accounting.tests.utils import DomainSubscriptionMixin
from corehq.apps.accounting.utils import do... | Add failing test for desired behavior | Add failing test for desired behavior
| Python | bsd-3-clause | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | ---
+++
@@ -0,0 +1,32 @@
+from django.test import override_settings
+
+from corehq import privileges
+from corehq.apps.accounting.models import SoftwarePlanEdition
+from corehq.apps.accounting.tests.base_tests import BaseAccountingTest
+from corehq.apps.accounting.tests.utils import DomainSubscriptionMixin
+from core... | |
08581be11f891e21014a7863ab102d4586388d47 | packs/docker/actions/build_image.py | packs/docker/actions/build_image.py | import os
from lib.base import DockerBasePythonAction
__all__ = [
'DockerBuildImageAction'
]
class DockerBuildImageAction(DockerBasePythonAction):
def run(self, dockerfile_path, tag):
if os.path.isdir(dockerfile_path):
return self.wrapper.build(path=dockerfile_path, tag=tag)
els... | import os
from lib.base import DockerBasePythonAction
__all__ = [
'DockerBuildImageAction'
]
class DockerBuildImageAction(DockerBasePythonAction):
def run(self, dockerfile_path, tag):
if os.path.isdir(dockerfile_path):
return self.wrapper.build(path=dockerfile_path, tag=tag)
els... | Expand user in the path. | Expand user in the path.
| Python | apache-2.0 | StackStorm/st2contrib,jtopjian/st2contrib,armab/st2contrib,Aamir-raza-1/st2contrib,tonybaloney/st2contrib,StackStorm/st2contrib,pearsontechnology/st2contrib,digideskio/st2contrib,meirwah/st2contrib,tonybaloney/st2contrib,dennybaa/st2contrib,jtopjian/st2contrib,armab/st2contrib,tonybaloney/st2contrib,digideskio/st2contr... | ---
+++
@@ -13,5 +13,6 @@
if os.path.isdir(dockerfile_path):
return self.wrapper.build(path=dockerfile_path, tag=tag)
else:
+ dockerfile_path = os.path.expanduser(dockerfile_path)
with open(dockerfile_path, 'r') as fp:
return self.wrapper.build(f... |
7f2700ee4b6aafed259d78affef462197194d2fc | usecase/spider_limit.py | usecase/spider_limit.py | # coding: utf-8
import setup_script
from grab.spider import Spider, Task
import logging
class TestSpider(Spider):
def task_generator(self):
yield Task('initial', url='http://google.com:89/',
network_try_count=9)
def task_initial(self):
print 'done'
logging.basicConfig(leve... | Add use case of spider with limits | Add use case of spider with limits
| Python | mit | kevinlondon/grab,SpaceAppsXploration/grab,liorvh/grab,subeax/grab,alihalabyah/grab,pombredanne/grab-1,SpaceAppsXploration/grab,subeax/grab,codevlabs/grab,giserh/grab,istinspring/grab,istinspring/grab,DDShadoww/grab,shaunstanislaus/grab,huiyi1990/grab,huiyi1990/grab,giserh/grab,maurobaraldi/grab,lorien/grab,pombredanne/... | ---
+++
@@ -0,0 +1,19 @@
+# coding: utf-8
+import setup_script
+from grab.spider import Spider, Task
+import logging
+
+class TestSpider(Spider):
+ def task_generator(self):
+ yield Task('initial', url='http://google.com:89/',
+ network_try_count=9)
+
+ def task_initial(self):
+ ... | |
7606021f677955967fc0a21d962d3638fd4d0cbf | scripts/dbdata.py | scripts/dbdata.py | #!/usr/bin/env python
"""
Script to fetch DBpedia data
"""
import sys, time
from urllib.request import urlopen
from urllib.parse import unquote
import json
def main():
for line in sys.stdin.readlines():
line = line.strip()
norm = unquote(line)
url = line.replace('/resource/', '/data/') + '... | Add script to fetch lon/lat from DBPedia. | Add script to fetch lon/lat from DBPedia.
| Python | apache-2.0 | ViralTexts/vt-passim,ViralTexts/vt-passim,ViralTexts/vt-passim | ---
+++
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+"""
+Script to fetch DBpedia data
+"""
+
+import sys, time
+from urllib.request import urlopen
+from urllib.parse import unquote
+import json
+
+def main():
+ for line in sys.stdin.readlines():
+ line = line.strip()
+ norm = unquote(line)
+ url ... | |
9cf0703f20f47143385260a6b63189f1c780f73e | tempest/tests/test_imports.py | tempest/tests/test_imports.py | # Copyright 2017 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | Add unit tests to check for CONF getattr during import | Add unit tests to check for CONF getattr during import
Since the early days in tempest we've been fighting getattrs on CONF
during imports. We're able to get around this during test runs by lazy
loading the conf file. However, in things like the tempest commands this
doesn't work because we rely on the config file not... | Python | apache-2.0 | Juniper/tempest,cisco-openstack/tempest,openstack/tempest,openstack/tempest,cisco-openstack/tempest,Juniper/tempest,masayukig/tempest,masayukig/tempest | ---
+++
@@ -0,0 +1,69 @@
+# Copyright 2017 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by appli... | |
d5db2a91729671e7a47e8c7d442ab76b697dc58f | tests/cupy_tests/sparse_tests/test_base.py | tests/cupy_tests/sparse_tests/test_base.py | import unittest
import scipy.sparse
import cupy.sparse
from cupy import testing
class DummySparseCPU(scipy.sparse.spmatrix):
def __init__(self, maxprint=50, shape=None, nnz=0):
super(DummySparseCPU, self).__init__(maxprint)
self._shape = shape
self._nnz = nnz
def getnnz(self):
... | Add test for base spmatrix | Add test for base spmatrix
| Python | mit | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | ---
+++
@@ -0,0 +1,74 @@
+import unittest
+
+import scipy.sparse
+
+import cupy.sparse
+from cupy import testing
+
+
+class DummySparseCPU(scipy.sparse.spmatrix):
+
+ def __init__(self, maxprint=50, shape=None, nnz=0):
+ super(DummySparseCPU, self).__init__(maxprint)
+ self._shape = shape
+ se... | |
7bdc8dfaabdee59d1961a390418ae6aafe0f9e62 | platform_tools/android/tradefed/upload_dm_results.py | platform_tools/android/tradefed/upload_dm_results.py | #!/usr/bin/env python
# Copyright 2014 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.
"""Upload DM output PNG files and JSON summary to Google Storage."""
import datetime
import os
import shutil
import sys
import tempfi... | Add custom dm upload script to be used by the android framework | Add custom dm upload script to be used by the android framework
Review URL: https://codereview.chromium.org/979153002
| Python | bsd-3-clause | YUPlayGodDev/platform_external_skia,MarshedOut/android_external_skia,Infinitive-OS/platform_external_skia,noselhq/skia,PAC-ROM/android_external_skia,tmpvar/skia.cc,MinimalOS-AOSP/platform_external_skia,UBERMALLOW/external_skia,rubenvb/skia,ominux/skia,YUPlayGodDev/platform_external_skia,geekboxzone/mmallow_external_ski... | ---
+++
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+# Copyright 2014 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.
+
+"""Upload DM output PNG files and JSON summary to Google Storage."""
+
+
+import datetime
+import os
+... | |
e8f323207f8b59452a040aadd0e411dc5abdb218 | tests/test_plugin_euronews.py | tests/test_plugin_euronews.py | import unittest
from streamlink.plugins.euronews import Euronews
class TestPluginEuronews(unittest.TestCase):
def test_can_handle_url(self):
# should match
self.assertTrue(Euronews.can_handle_url("http://www.euronews.com/live"))
self.assertTrue(Euronews.can_handle_url("http://fr.euronews.... | Add unit tests for Euronews plugin | Add unit tests for Euronews plugin
| Python | bsd-2-clause | streamlink/streamlink,beardypig/streamlink,back-to/streamlink,gravyboat/streamlink,beardypig/streamlink,bastimeyer/streamlink,bastimeyer/streamlink,streamlink/streamlink,wlerin/streamlink,wlerin/streamlink,javiercantero/streamlink,melmorabity/streamlink,chhe/streamlink,back-to/streamlink,chhe/streamlink,melmorabity/str... | ---
+++
@@ -0,0 +1,27 @@
+import unittest
+
+from streamlink.plugins.euronews import Euronews
+
+
+class TestPluginEuronews(unittest.TestCase):
+ def test_can_handle_url(self):
+ # should match
+ self.assertTrue(Euronews.can_handle_url("http://www.euronews.com/live"))
+ self.assertTrue(Euronew... | |
1b0560da645ecadc2bd9d01dde77274afb8970ba | tools/parse_rtntrace_stack.py | tools/parse_rtntrace_stack.py | #!/usr/bin/env python
import sys, os, subprocess
def ex_ret(cmd):
return subprocess.Popen(cmd, stdout = subprocess.PIPE).communicate()[0]
def cppfilt(name):
return ex_ret([ 'c++filt', name ])
if len(sys.argv) > 1:
outputdir = sys.argv[1]
else:
outputdir = '.'
filename = os.path.join(outputdir, 'sim.rtntrace... | Add script to parse rtntracefull output into a call tree | [rtntracer] Add script to parse rtntracefull output into a call tree
| Python | mit | abanaiyan/sniper,abanaiyan/sniper,abanaiyan/sniper,abanaiyan/sniper,abanaiyan/sniper | ---
+++
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+
+import sys, os, subprocess
+
+def ex_ret(cmd):
+ return subprocess.Popen(cmd, stdout = subprocess.PIPE).communicate()[0]
+def cppfilt(name):
+ return ex_ret([ 'c++filt', name ])
+
+if len(sys.argv) > 1:
+ outputdir = sys.argv[1]
+else:
+ outputdir = '.'
+
+filena... | |
144608f98f5b8aff555ee4954d0a07aebb828aff | ThinkLikeProg/chp2ex.py | ThinkLikeProg/chp2ex.py | #!/usr/local/bin/python
# Think Like a Programmer Chapter 2: Pure Puzzles exercises
def main():
poundV()
print()
poundDiamond()
def poundV():
'''
Using only single output statements of a space, pound, or new line, create:
########
######
####
##
'''
n = 4
space ... | Add Think Like a Programmer section and start chp 2 exercises | Add Think Like a Programmer section and start chp 2 exercises
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,48 @@
+#!/usr/local/bin/python
+# Think Like a Programmer Chapter 2: Pure Puzzles exercises
+
+
+def main():
+ poundV()
+ print()
+ poundDiamond()
+
+
+def poundV():
+ '''
+ Using only single output statements of a space, pound, or new line, create:
+ ########
+ ######
+ ... | |
59dc769f3ccf0e0251c527b7e1e23544dedab048 | tests/test_to_text.py | tests/test_to_text.py | from datetime import datetime
from recurrence import Recurrence, Rule
import recurrence
def test_rule_to_text_simple():
assert Rule(
recurrence.WEEKLY
).to_text() == 'weekly'
def test_rule_to_text_interval():
assert Rule(
recurrence.WEEKLY,
interval=3
).to_text() == 'every 3 ... | Add initial tests for to_text | Add initial tests for to_text
| Python | bsd-3-clause | django-recurrence/django-recurrence,FrankSalad/django-recurrence,linux2400/django-recurrence,Nikola-K/django-recurrence,django-recurrence/django-recurrence,FrankSalad/django-recurrence,Nikola-K/django-recurrence,linux2400/django-recurrence | ---
+++
@@ -0,0 +1,42 @@
+from datetime import datetime
+from recurrence import Recurrence, Rule
+import recurrence
+
+
+def test_rule_to_text_simple():
+ assert Rule(
+ recurrence.WEEKLY
+ ).to_text() == 'weekly'
+
+
+def test_rule_to_text_interval():
+ assert Rule(
+ recurrence.WEEKLY,
+ ... | |
045f1ae3d436b4372e45fd821740d7a94d2ca049 | src/repository/migrations/0003_auto_20170524_1503.py | src/repository/migrations/0003_auto_20170524_1503.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-05-24 15:03
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('repository', '0002_auto_20170522_2021'),
]
operations = [
migrations.AlterModelOpti... | Change meta option for Github | Change meta option for Github
| Python | bsd-3-clause | lozadaOmr/ansible-admin,lozadaOmr/ansible-admin,lozadaOmr/ansible-admin | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.5 on 2017-05-24 15:03
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('repository', '0002_auto_20170522_2021'),
+ ]
+
+ operati... | |
40761c39bcc3703e8fd99544aa1d08f955538779 | TrevorNet/tasks.py | TrevorNet/tasks.py | import nets
import random
import math
def XOR():
'''Exclusive or'''
net = nets.FeedForwardNet(2, 3, 1)
domain = ((1,1), (1,-1), (-1,1), (-1,-1))
rng = ((0,), (1,), (1,), (0,))
for i in range(100000):
r = random.randrange(4)
net.train(domain[r], rng[r])
for d in domain:
... | Add file with test problems | Add file with test problems
| Python | mit | tmerr/trevornet | ---
+++
@@ -0,0 +1,37 @@
+import nets
+import random
+import math
+
+def XOR():
+ '''Exclusive or'''
+ net = nets.FeedForwardNet(2, 3, 1)
+
+ domain = ((1,1), (1,-1), (-1,1), (-1,-1))
+ rng = ((0,), (1,), (1,), (0,))
+ for i in range(100000):
+ r = random.randrange(4)
+ net.train(doma... | |
7b2f561bb7d36eb9fe978e622789932c02c11411 | vsub/templatetags/parse_if.py | vsub/templatetags/parse_if.py | # Loosely based on noparse.py from https://code.djangoproject.com/ticket/14502
from django import template
from django.template.defaulttags import TemplateIfParser
register = template.Library()
token_formats = {
template.TOKEN_TEXT: u'%s',
template.TOKEN_VAR: u'%s%%s%s' % (template.VARIABLE_TAG_START, templa... | Add a template tag to conditionally *parse* the tag's nested content. | Add a template tag to conditionally *parse* the tag's nested content.
| Python | mit | PrecisionMojo/pm-www,PrecisionMojo/pm-www | ---
+++
@@ -0,0 +1,76 @@
+# Loosely based on noparse.py from https://code.djangoproject.com/ticket/14502
+
+from django import template
+from django.template.defaulttags import TemplateIfParser
+
+register = template.Library()
+
+token_formats = {
+ template.TOKEN_TEXT: u'%s',
+ template.TOKEN_VAR: u'%s%%s%s' %... | |
882944fb5c3afcd9eed086d996998f9921df6198 | dropbox_login.py | dropbox_login.py | #!/usr/bin/env python
# YOU NEED TO INSERT YOUR APP KEY AND SECRET BELOW!
# Go to dropbox.com/developers/apps to create an app.
import webbrowser
from dropbox import client, rest, session
import pickle
import yaml
def load_config(config_name):
with open(config_name) as f:
return yaml.load(f)
def save_c... | Add script to use Dropbox API | Add script to use Dropbox API
| Python | mit | philipbl/instagram2dayone | ---
+++
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+
+# YOU NEED TO INSERT YOUR APP KEY AND SECRET BELOW!
+# Go to dropbox.com/developers/apps to create an app.
+
+import webbrowser
+from dropbox import client, rest, session
+import pickle
+import yaml
+
+def load_config(config_name):
+ with open(config_name) as f:
+... | |
7036bfe5740ff1a3027485dab60615c2596bce11 | hackerrank/pdfviewer/solution.py | hackerrank/pdfviewer/solution.py | """
When you select a contiguous block of text in a PDF viewer, the selection is highlighted with a blue rectangle. In this PDF viewer, each word is highlighted independently. For example:
PDF-highighting.png
In this challenge, you will be given a list of letter heights in the alphabet and a string. Using the le... | Solve by exploiting ascii values | Solve by exploiting ascii values
| Python | mit | lemming52/white_pawn,lemming52/white_pawn | ---
+++
@@ -0,0 +1,72 @@
+"""
+When you select a contiguous block of text in a PDF viewer, the selection is highlighted with a blue rectangle. In this PDF viewer, each word is highlighted independently. For example:
+
+PDF-highighting.png
+
+In this challenge, you will be given a list of letter heights in the alphabe... | |
474d3379d6cc04c1f4bac441c83399860333de3d | excel_convert.py | excel_convert.py | import csv
import xlwt
import os
import sys
import subprocess
def convert(filename):
# Look for input file in same location as script file:
inputfilename = os.path.join(os.path.dirname(sys.argv[0]), filename)
# Strip off the path
basefilename = os.path.basename(inputfilename)
# Strip off the extension
basefile... | Add excel converter which converts tab spaced text file data to excel file | Add excel converter which converts tab spaced text file data to excel file
| Python | mit | prashanth-nani/sentiment-analysis,prashanth-nani/snapdeal-review-grabber | ---
+++
@@ -0,0 +1,44 @@
+import csv
+import xlwt
+import os
+import sys
+import subprocess
+
+def convert(filename):
+ # Look for input file in same location as script file:
+ inputfilename = os.path.join(os.path.dirname(sys.argv[0]), filename)
+ # Strip off the path
+ basefilename = os.path.basename(inputfilename... | |
02fad660afbb6b5ca1fc4f1c3a1fcf3c95f9fd0d | pypeerassets/providers/node.py | pypeerassets/providers/node.py |
'''Communicate with local or remote peercoin-daemon via JSON-RPC'''
from operator import itemgetter
try:
from peercoin_rpc import Client
except:
raise EnvironmentError("peercoin_rpc library is required for this to work,\
use pip to install it.")
def select_inputs(cls, total_amoun... |
'''Communicate with local or remote peercoin-daemon via JSON-RPC'''
from operator import itemgetter
try:
from peercoin_rpc import Client
except:
raise EnvironmentError("peercoin_rpc library is required for this to work,\
use pip to install it.")
def select_inputs(cls, total_amoun... | Refactor unspent utxo data gathering | Refactor unspent utxo data gathering | Python | bsd-3-clause | PeerAssets/pypeerassets,backpacker69/pypeerassets | ---
+++
@@ -14,24 +14,20 @@
to never spend old transactions with a lot of coin age.
Argument is intiger, returns list of apropriate UTXO's'''
- my_addresses = [i["address"] for i in cls.listreceivedbyaddress()]
-
utxo = []
utxo_sum = float(-0.01) ## starts from negative due to minimal fee
... |
5ad7e4f7b1be1203b63ff4f530d57d0bd3e092c4 | add_filename_suffix.py | add_filename_suffix.py | #!/usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) 2014 Keita Kita
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the righ... | Add the script on Python 2.x. | Add the script on Python 2.x.
| Python | mit | mikanbako/add-filename-suffix | ---
+++
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+
+# The MIT License (MIT)
+#
+# Copyright (c) 2014 Keita Kita
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, i... | |
a78f918849e35dca110eec38741001ab11279c65 | sara_flexbe_states/src/sara_flexbe_states/WonderlandAddUpdatePeople.py | sara_flexbe_states/src/sara_flexbe_states/WonderlandAddUpdatePeople.py | #!/usr/bin/env python
# encoding=utf8
import json
import requests
from flexbe_core import EventState, Logger
"""
Created on 17/05/2018
@author: Lucas Maurice
"""
class WonderlandAddUpdatePeople(EventState):
'''
Add or update all known persons in wonderland.
<= done return when the... | Add a state for update entire list of persons. | Add a state for update entire list of persons.
| Python | bsd-3-clause | WalkingMachine/sara_behaviors,WalkingMachine/sara_behaviors | ---
+++
@@ -0,0 +1,98 @@
+#!/usr/bin/env python
+# encoding=utf8
+
+import json
+
+import requests
+from flexbe_core import EventState, Logger
+
+"""
+Created on 17/05/2018
+
+@author: Lucas Maurice
+"""
+
+
+class WonderlandAddUpdatePeople(EventState):
+ '''
+ Add or update all known persons in wonderland.
+
+... | |
c7c7c3aaf466af37fb8e632b959b08ce34d143dc | calico/felix/test/test_endpoint.py | calico/felix/test/test_endpoint.py | # -*- coding: utf-8 -*-
# Copyright 2014 Metaswitch Networks
#
# 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 applicab... | Add initial tests for endpoint code. | Add initial tests for endpoint code.
| Python | apache-2.0 | ocadotechnology/calico,alexhersh/calico,nbartos/calico,neiljerram/felix,beddari/calico,alexaltair/calico,alexhersh/calico,matthewdupre/felix,TrimBiggs/calico,kasisnu/calico,alexaltair/calico,neiljerram/felix,neiljerram/felix,beddari/calico,anortef/calico,ocadotechnology/calico,fasaxc/felix,matthewdupre/felix,Metaswitch... | ---
+++
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# Copyright 2014 Metaswitch Networks
+#
+# 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-... | |
942315bb5baa45df4dfde9b04b99685a6be6f574 | diagnose_error.py | diagnose_error.py | from __future__ import with_statement
import os, sys, tempfile, subprocess, re
__all__ = ["has_error", "get_error_line_number", "make_reg_string", "get_coq_output"]
DEFAULT_ERROR_REG_STRING = 'File "[^"]+", line ([0-9]+), characters [0-9-]+:\n([^\n]+)'
DEFAULT_ERROR_REG_STRING_GENERIC = 'File "[^"]+", line ([0-9]+), ... | Add a file to extract error strings | Add a file to extract error strings
| Python | mit | JasonGross/coq-tools,JasonGross/coq-tools | ---
+++
@@ -0,0 +1,50 @@
+from __future__ import with_statement
+import os, sys, tempfile, subprocess, re
+
+__all__ = ["has_error", "get_error_line_number", "make_reg_string", "get_coq_output"]
+
+DEFAULT_ERROR_REG_STRING = 'File "[^"]+", line ([0-9]+), characters [0-9-]+:\n([^\n]+)'
+DEFAULT_ERROR_REG_STRING_GENERI... | |
df07313b0fdb7ca5caba3aefcbf8eb3a3f7f3191 | pythran/tests/cases/nd_local_maxima.py | pythran/tests/cases/nd_local_maxima.py | #from https://github.com/iskandr/parakeet/blob/master/benchmarks/nd_local_maxima.py
#pythran export local_maxima(float [][][][])
#runas import numpy as np ; shape = (8,6,4,2) ; x = np.arange(8*6*4*2, dtype=np.float64).reshape(*shape) ; local_maxima(x)
import numpy as np
def wrap(pos, offset, bound):
return ( pos +... | Add a difficult test case from parakeet | Add a difficult test case from parakeet
| Python | bsd-3-clause | artas360/pythran,artas360/pythran,pbrunet/pythran,serge-sans-paille/pythran,serge-sans-paille/pythran,artas360/pythran,pbrunet/pythran,hainm/pythran,pombredanne/pythran,pombredanne/pythran,pombredanne/pythran,pbrunet/pythran,hainm/pythran,hainm/pythran | ---
+++
@@ -0,0 +1,25 @@
+#from https://github.com/iskandr/parakeet/blob/master/benchmarks/nd_local_maxima.py
+#pythran export local_maxima(float [][][][])
+#runas import numpy as np ; shape = (8,6,4,2) ; x = np.arange(8*6*4*2, dtype=np.float64).reshape(*shape) ; local_maxima(x)
+import numpy as np
+
+def wrap(pos, o... | |
4ca101b1e7527deba3bf660745b0048def309170 | opps/article/views.py | opps/article/views.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.views.generic.detail import DetailView
from opps.article.models import Post
class OppsDetail(DetailView):
context_object_name = "context"
queryset = Post.objects.all()
| Create basic view on opps article | Create basic view on opps article
| Python | mit | williamroot/opps,YACOWS/opps,williamroot/opps,opps/opps,opps/opps,williamroot/opps,opps/opps,YACOWS/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,jeanmask/opps,YACOWS/opps,opps/opps,jeanmask/opps,jeanmask/opps | ---
+++
@@ -0,0 +1,12 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from django.views.generic.detail import DetailView
+
+from opps.article.models import Post
+
+
+class OppsDetail(DetailView):
+
+ context_object_name = "context"
+ queryset = Post.objects.all() | |
5601271051fee2e24024843b0a74ca6a3047f25c | Algol/consts.py | Algol/consts.py | #!/usr/bin/env python
# Copyright (c) 2015 Angel Terrones (<angelterrones@gmail.com>)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the r... | Add the const module: List of control constants. | Add the const module: List of control constants.
| Python | mit | AngelTerrones/Algol,AngelTerrones/Algol | ---
+++
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+# Copyright (c) 2015 Angel Terrones (<angelterrones@gmail.com>)
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.