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 |
|---|---|---|---|---|---|---|---|---|---|---|
c7fa4500b22104b34b50bbcacc3b64923d6da294 | trex/parsers.py | trex/parsers.py | # -*- coding: utf-8 -*-
#
# (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>
#
# See LICENSE comming with the source of 'trex' for details.
#
from io import TextIOWrapper
from rest_framework.parsers import BaseParser
class PlainTextParser(BaseParser):
media_type = "text/plain"
def parse(self, stream, media_... | Add a parser for plain text | Add a parser for plain text
| Python | mit | bjoernricks/trex,bjoernricks/trex | ---
+++
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+#
+# (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>
+#
+# See LICENSE comming with the source of 'trex' for details.
+#
+
+from io import TextIOWrapper
+
+from rest_framework.parsers import BaseParser
+
+
+class PlainTextParser(BaseParser):
+
+ media_type = "text/... | |
e8560c42e3ae73f1753073b8ad6aef7d564e6d65 | Host/original.py | Host/original.py | import sys
from functools import reduce
tempVmId = -1
def enhancedActiveVMLoadBalancer(vmStateList, currentAllocationCounts):
'''
vmStateList: Dict<vmId, vmState>
currentAllocationCounts: Dict<vmId, currentActiveAllocationCount>
'''
global tempVmId
vmId = -1
tot... | Implement basic active monitoring algorithm | Implement basic active monitoring algorithm
| Python | mit | kaushikSarma/VM-Load-balancing,kaushikSarma/VM-Load-balancing,kaushikSarma/VM-Load-balancing,kaushikSarma/VM-Load-balancing | ---
+++
@@ -0,0 +1,42 @@
+import sys
+from functools import reduce
+
+tempVmId = -1
+
+def enhancedActiveVMLoadBalancer(vmStateList, currentAllocationCounts):
+ '''
+ vmStateList: Dict<vmId, vmState>
+ currentAllocationCounts: Dict<vmId, currentActiveAllocationCount>
+ '''
+
+ ... | |
3693b1aea769af1e0fbe31007a00f3e33bcec622 | aids/sorting_and_searching/pair_sum.py | aids/sorting_and_searching/pair_sum.py | '''
Given an integer array, output all pairs that sum up to a specific value k
'''
from binary_search import binary_search_iterative
def pair_sum_sorting(arr, k):
'''
Using sorting - O(n logn)
'''
number_of_items = len(arr)
if number_of_items < 2:
return
arr.sort()
for index, item in enumerate(arr):
ind... | Add function to solve two pair sum | Add function to solve two pair sum
| Python | mit | ueg1990/aids | ---
+++
@@ -0,0 +1,39 @@
+'''
+Given an integer array, output all pairs that sum up to a specific value k
+
+'''
+
+from binary_search import binary_search_iterative
+
+def pair_sum_sorting(arr, k):
+ '''
+ Using sorting - O(n logn)
+
+ '''
+ number_of_items = len(arr)
+ if number_of_items < 2:
+ return
+ arr.sort(... | |
9a67d63650b751c7b876f248bb3d82e619b37725 | frequenciesToWords.py | frequenciesToWords.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Spell corrector - http://www.chiodini.org/
# Copyright © 2015 Luca Chiodini <luca@chiodini.org>
#
# 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 Fou... | Add new script to create a list of words from frequencies | Add new script to create a list of words from frequencies
| Python | agpl-3.0 | lucach/spellcorrect,lucach/spellcorrect,lucach/spellcorrect,lucach/spellcorrect | ---
+++
@@ -0,0 +1,53 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# Spell corrector - http://www.chiodini.org/
+# Copyright © 2015 Luca Chiodini <luca@chiodini.org>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+... | |
4535d6c41e17031b943e7016fc7de6f76b890f17 | test/lib/test_inputsource.py | test/lib/test_inputsource.py | ########################################################################
# test/xslt/test_inputsource.py
import os
from amara.lib import inputsource, iri, treecompare
module_dir = os.path.dirname(os.path.abspath(__file__))
rlimit_nofile = 300
try:
import resource
except ImportError:
pass
else:
rlimit_nof... | Put the test into the correct directory. | Put the test into the correct directory.
--HG--
rename : test/xslt/test_inputsource.py => test/lib/test_inputsource.py
| Python | apache-2.0 | zepheira/amara,zepheira/amara,zepheira/amara,zepheira/amara,zepheira/amara,zepheira/amara | ---
+++
@@ -0,0 +1,29 @@
+########################################################################
+# test/xslt/test_inputsource.py
+
+import os
+from amara.lib import inputsource, iri, treecompare
+
+module_dir = os.path.dirname(os.path.abspath(__file__))
+
+rlimit_nofile = 300
+try:
+ import resource
+except Imp... | |
732898dc4858ae5cfc7eac3e470069ac702f6c12 | mapit/management/commands/mapit_generation_deactivate.py | mapit/management/commands/mapit_generation_deactivate.py | # This script deactivates a particular generation
from optparse import make_option
from django.core.management.base import BaseCommand
from mapit.models import Generation
class Command(BaseCommand):
help = 'Deactivate a generation'
args = '<GENERATION-ID>'
option_list = BaseCommand.option_list + (
... | Add a command for deactivating a generation | Add a command for deactivating a generation
| Python | agpl-3.0 | Sinar/mapit,chris48s/mapit,New-Bamboo/mapit,Sinar/mapit,opencorato/mapit,chris48s/mapit,chris48s/mapit,Code4SA/mapit,opencorato/mapit,opencorato/mapit,Code4SA/mapit,Code4SA/mapit,New-Bamboo/mapit | ---
+++
@@ -0,0 +1,28 @@
+# This script deactivates a particular generation
+
+from optparse import make_option
+from django.core.management.base import BaseCommand
+from mapit.models import Generation
+
+class Command(BaseCommand):
+ help = 'Deactivate a generation'
+ args = '<GENERATION-ID>'
+ option_list ... | |
98fbfe6e65c4cb32ea0f4f6ce6cba77f7fadcb7b | app/api/tests/test_vendor_api.py | app/api/tests/test_vendor_api.py | from django.test import Client, TestCase
from .utils import obtain_api_key, create_admin_account
class VendorApiTest(TestCase):
"""Test for Vendor API."""
def setUp(self):
self.client = Client()
self.endpoint = '/api'
self.admin_test_credentials = ('admin', 'admin@taverna.com', 'qwer... | Add test for vendor object creation | Add test for vendor object creation
| Python | mit | teamtaverna/core | ---
+++
@@ -0,0 +1,73 @@
+from django.test import Client, TestCase
+
+from .utils import obtain_api_key, create_admin_account
+
+
+class VendorApiTest(TestCase):
+ """Test for Vendor API."""
+
+ def setUp(self):
+ self.client = Client()
+ self.endpoint = '/api'
+ self.admin_test_credentials... | |
7c33e8c7a386e911d835f81e637515d40dfc4e62 | benchmarks/bench_laplace.py | benchmarks/bench_laplace.py | """
Benchmark Laplace equation solving.
From the Numpy benchmark suite, original code at
https://github.com/yarikoptic/numpy-vbench/commit/a192bfd43043d413cc5d27526a9b28ad343b2499
"""
import numpy as np
from numba import jit
dx = 0.1
dy = 0.1
dx2 = (dx * dx)
dy2 = (dy * dy)
@jit(nopython=True)
def laplace(N, Nite... | Add a Laplace equation solving benchmark (from Numpy) | Add a Laplace equation solving benchmark (from Numpy)
| Python | bsd-2-clause | numba/numba-benchmark | ---
+++
@@ -0,0 +1,41 @@
+"""
+Benchmark Laplace equation solving.
+
+From the Numpy benchmark suite, original code at
+https://github.com/yarikoptic/numpy-vbench/commit/a192bfd43043d413cc5d27526a9b28ad343b2499
+"""
+
+import numpy as np
+
+from numba import jit
+
+
+dx = 0.1
+dy = 0.1
+dx2 = (dx * dx)
+dy2 = (dy * d... | |
9115628cf10e194f1975e01142d8ae08ab5c4b06 | joommf/test_odtreader.py | joommf/test_odtreader.py | def test_odtreader_dynamics_example():
from joommf.sim import Sim
from joommf.mesh import Mesh
from joommf.energies.exchange import Exchange
from joommf.energies.demag import Demag
from joommf.energies.zeeman import FixedZeeman
from joommf.drivers import evolver
# Mesh specification.
lx ... | Add test for pandas dataframe loading | Add test for pandas dataframe loading
| Python | bsd-2-clause | fangohr/oommf-python,ryanpepper/oommf-python,ryanpepper/oommf-python,fangohr/oommf-python,ryanpepper/oommf-python,fangohr/oommf-python,ryanpepper/oommf-python | ---
+++
@@ -0,0 +1,36 @@
+def test_odtreader_dynamics_example():
+ from joommf.sim import Sim
+ from joommf.mesh import Mesh
+ from joommf.energies.exchange import Exchange
+ from joommf.energies.demag import Demag
+ from joommf.energies.zeeman import FixedZeeman
+ from joommf.drivers import evolver... | |
5f47cf46c82d9a48a9efe5ad11c6c3a55896da12 | cupy/sparse/compressed.py | cupy/sparse/compressed.py | from cupy import cusparse
from cupy.sparse import base
from cupy.sparse import data as sparse_data
class _compressed_sparse_matrix(sparse_data._data_matrix):
def __init__(self, arg1, shape=None, dtype=None, copy=False):
if isinstance(arg1, tuple) and len(arg1) == 3:
data, indices, indptr = ar... | Implement abstract class for csc and csr matrix | Implement abstract class for csc and csr matrix
| Python | mit | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | ---
+++
@@ -0,0 +1,75 @@
+from cupy import cusparse
+from cupy.sparse import base
+from cupy.sparse import data as sparse_data
+
+
+class _compressed_sparse_matrix(sparse_data._data_matrix):
+
+ def __init__(self, arg1, shape=None, dtype=None, copy=False):
+ if isinstance(arg1, tuple) and len(arg1) == 3:
+ ... | |
36333c275f4d3a66c8f14383c3ada5a42a197bea | bumblebee/modules/memory.py | bumblebee/modules/memory.py | import bumblebee.module
import psutil
def fmt(num, suffix='B'):
for unit in [ "", "Ki", "Mi", "Gi" ]:
if num < 1024.0:
return "{:.2f}{}{}".format(num, unit, suffix)
num /= 1024.0
return "{:05.2f%}{}{}".format(num, "Gi", suffix)
class Module(bumblebee.module.Module):
def __init_... | Add module for displaying RAM usage | [modules] Add module for displaying RAM usage
Shows free RAM, total RAM, free RAM percentage
| Python | mit | tobi-wan-kenobi/bumblebee-status,tobi-wan-kenobi/bumblebee-status | ---
+++
@@ -0,0 +1,30 @@
+import bumblebee.module
+import psutil
+
+def fmt(num, suffix='B'):
+ for unit in [ "", "Ki", "Mi", "Gi" ]:
+ if num < 1024.0:
+ return "{:.2f}{}{}".format(num, unit, suffix)
+ num /= 1024.0
+ return "{:05.2f%}{}{}".format(num, "Gi", suffix)
+
+class Module(bum... | |
eda3e6c005c1115a039f394d6f00baabebd39fee | calaccess_website/management/commands/updatebuildpublish.py | calaccess_website/management/commands/updatebuildpublish.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Update to the latest available CAL-ACCESS snapshot and publish the files to the
website.
"""
import logging
from django.core.management import call_command
from calaccess_raw.management.commands.updatecalaccessrawdata import Command as updatecommand
logger = logging.get... | Add command for full daily build process | Add command for full daily build process
| Python | mit | california-civic-data-coalition/django-calaccess-downloads-website,california-civic-data-coalition/django-calaccess-downloads-website,california-civic-data-coalition/django-calaccess-downloads-website | ---
+++
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+Update to the latest available CAL-ACCESS snapshot and publish the files to the
+website.
+"""
+import logging
+from django.core.management import call_command
+from calaccess_raw.management.commands.updatecalaccessrawdata import Command a... | |
b8acaf64187f5626ef6755ef00d2b2a1471d4914 | numba/tests/closures/test_closure_type_inference.py | numba/tests/closures/test_closure_type_inference.py | import numpy as np
from numba import *
from numba.tests.test_support import *
@autojit
def test_cellvar_promotion(a):
"""
>>> inner = test_cellvar_promotion(10)
200.0
>>> inner.__name__
'inner'
>>> inner()
1000.0
"""
b = int(a) * 2
@jit(void())
def inner():
print a... | Add closure type inference test | Add closure type inference test
| Python | bsd-2-clause | pombredanne/numba,pombredanne/numba,cpcloud/numba,seibert/numba,numba/numba,gmarkall/numba,gmarkall/numba,numba/numba,jriehl/numba,stefanseefeld/numba,sklam/numba,GaZ3ll3/numba,stefanseefeld/numba,gmarkall/numba,sklam/numba,stuartarchibald/numba,gdementen/numba,ssarangi/numba,GaZ3ll3/numba,GaZ3ll3/numba,sklam/numba,sto... | ---
+++
@@ -0,0 +1,27 @@
+import numpy as np
+
+from numba import *
+from numba.tests.test_support import *
+
+@autojit
+def test_cellvar_promotion(a):
+ """
+ >>> inner = test_cellvar_promotion(10)
+ 200.0
+ >>> inner.__name__
+ 'inner'
+ >>> inner()
+ 1000.0
+ """
+ b = int(a) * 2
+
+ ... | |
5f503f0b9ab51ca2b1985fe88d5e84ff63b7d745 | addplaylists.py | addplaylists.py | #!/usr/bin/env python2
from datetime import datetime
from datetime import timedelta
import random
from wuvt.trackman.lib import perdelta
from wuvt import db
from wuvt.trackman.models import DJSet, DJ
today = datetime.now()
print("adding dj")
dj = DJ(u"Johnny 5", u"John")
db.session.add(dj)
db.session.commit()
print("... | Add sample playlists for testing features. | Add sample playlists for testing features.
| Python | agpl-3.0 | wuvt/wuvt-site,wuvt/wuvt-site,wuvt/wuvt-site,wuvt/wuvt-site | ---
+++
@@ -0,0 +1,23 @@
+#!/usr/bin/env python2
+from datetime import datetime
+from datetime import timedelta
+import random
+from wuvt.trackman.lib import perdelta
+from wuvt import db
+from wuvt.trackman.models import DJSet, DJ
+
+today = datetime.now()
+print("adding dj")
+dj = DJ(u"Johnny 5", u"John")
+db.sessi... | |
4fab31eef9ad80230b36039b66c70d94456e5f9b | tests/monad.py | tests/monad.py | '''Test case for monads and monoidic functions
'''
import unittest
from lighty import monads
class MonadTestCase(unittest.TestCase):
'''Test case for partial template execution
'''
def testNumberComparision(self):
monad = monads.ValueMonad(10)
assert monad == 10, 'Number __eq__ error: %s... | Add missing tests file from previous commit. | Add missing tests file from previous commit.
| Python | bsd-3-clause | GrAndSE/lighty | ---
+++
@@ -0,0 +1,44 @@
+'''Test case for monads and monoidic functions
+'''
+import unittest
+
+from lighty import monads
+
+
+class MonadTestCase(unittest.TestCase):
+ '''Test case for partial template execution
+ '''
+
+ def testNumberComparision(self):
+ monad = monads.ValueMonad(10)
+ ass... | |
1a7fa8080d19909ccf8e8e89aa19c92c1413f1c1 | apps/pyjob_submite_jobs_again.py | apps/pyjob_submite_jobs_again.py | #!/usr/bin/env python3
import os
import sys
import subprocess
right_inputs = False
if len(sys.argv) > 2 :
tp = sys.argv[1]
rms = [int(x) for x in sys.argv[2:]]
if tp in ['ma', 'ex', 'xy']: right_inputs = True
curdir = os.getcwd()
if right_inputs:
if curdir.endswith('trackcpp'):
flatfile = 'fl... | Add script to submite jobs again | Add script to submite jobs again
| Python | mit | lnls-fac/job_manager | ---
+++
@@ -0,0 +1,37 @@
+#!/usr/bin/env python3
+
+import os
+import sys
+import subprocess
+
+right_inputs = False
+if len(sys.argv) > 2 :
+ tp = sys.argv[1]
+ rms = [int(x) for x in sys.argv[2:]]
+ if tp in ['ma', 'ex', 'xy']: right_inputs = True
+
+curdir = os.getcwd()
+if right_inputs:
+ if curdir.en... | |
884ae74bb75e5a0c60da74791a2e6fad9e4b83e5 | py/find-right-interval.py | py/find-right-interval.py | from operator import itemgetter
# Definition for an interval.
# class Interval(object):
# def __init__(self, s=0, e=0):
# self.start = s
# self.end = e
class Solution(object):
def findRightInterval(self, intervals):
"""
:type intervals: List[Interval]
:rtype: List[int]
... | Add py solution for 436. Find Right Interval | Add py solution for 436. Find Right Interval
436. Find Right Interval: https://leetcode.com/problems/find-right-interval/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,29 @@
+from operator import itemgetter
+# Definition for an interval.
+# class Interval(object):
+# def __init__(self, s=0, e=0):
+# self.start = s
+# self.end = e
+
+class Solution(object):
+ def findRightInterval(self, intervals):
+ """
+ :type intervals: List... | |
07f8fd56ab366a2d1365278c3310ade4b1d30c57 | heat_integrationtests/functional/test_versionnegotiation.py | heat_integrationtests/functional/test_versionnegotiation.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | Add functional test for version negotiation | Add functional test for version negotiation
the test attempts to make an unauthenticated request to the Heat API
root.
Change-Id: Ib14628927efe561744cda683ca4dcf27b0524e20
Story: 2002531
Task: 22077
| Python | apache-2.0 | openstack/heat,noironetworks/heat,noironetworks/heat,openstack/heat | ---
+++
@@ -0,0 +1,36 @@
+# 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 agr... | |
47dff2561be481ff067c22ed98d9ea6a9cf8ae10 | test/test_notebook.py | test/test_notebook.py | import os
import glob
import contextlib
import subprocess
import pytest
notebooks = list(glob.glob("*.ipynb", recursive=True))
@contextlib.contextmanager
def cleanup(notebook):
name, __ = os.path.splitext(notebook)
yield
fname = name + ".html"
if os.path.isfile(fname):
os.remove(fname)
@py... | Add test to execute notebooks | Add test to execute notebooks
| Python | mit | adicu/AccessibleML,alanhdu/AccessibleML | ---
+++
@@ -0,0 +1,26 @@
+import os
+import glob
+import contextlib
+import subprocess
+
+import pytest
+
+notebooks = list(glob.glob("*.ipynb", recursive=True))
+
+@contextlib.contextmanager
+def cleanup(notebook):
+ name, __ = os.path.splitext(notebook)
+ yield
+
+ fname = name + ".html"
+ if os.path.is... | |
0b8d5794d2c5a1ae46659e02b65d1c21ffe8881d | babyonboard/api/tests/test_views.py | babyonboard/api/tests/test_views.py | import json
from rest_framework import status
from django.test import TestCase, Client
from django.urls import reverse
from ..models import Temperature
from ..serializers import TemperatureSerializer
client = Client()
class GetCurrentTemperatureTest(TestCase):
""" Test class for GET current temperature from API... | Implement tests for temperature endpoint | Implement tests for temperature endpoint
| Python | mit | BabyOnBoard/BabyOnBoard-API,BabyOnBoard/BabyOnBoard-API | ---
+++
@@ -0,0 +1,52 @@
+import json
+from rest_framework import status
+from django.test import TestCase, Client
+from django.urls import reverse
+from ..models import Temperature
+from ..serializers import TemperatureSerializer
+
+
+client = Client()
+
+
+class GetCurrentTemperatureTest(TestCase):
+ """ Test cl... | |
aa6837e14e520f5917cf1c452bd0c9a8ce2a27dd | module/others/plugins.py | module/others/plugins.py | from maya import cmds
class Commands(object):
""" class name must be 'Commands' """
commandDict = {}
def _loadObjPlugin(self):
if not cmds.pluginInfo("objExport", q=True, loaded=True):
cmds.loadPlugin("objExport")
commandDict['sampleCommand'] = "sphere.png"
# ^ Don't forget t... | Add new module for plugin loading | Add new module for plugin loading
| Python | mit | minoue/miExecutor | ---
+++
@@ -0,0 +1,13 @@
+from maya import cmds
+
+
+class Commands(object):
+ """ class name must be 'Commands' """
+
+ commandDict = {}
+
+ def _loadObjPlugin(self):
+ if not cmds.pluginInfo("objExport", q=True, loaded=True):
+ cmds.loadPlugin("objExport")
+ commandDict['sampleCommand'... | |
67350e9ac3f2dc0fceb1899c8692adcd9cdd4213 | frappe/tests/test_boot.py | frappe/tests/test_boot.py | import unittest
import frappe
from frappe.boot import get_unseen_notes
from frappe.desk.doctype.note.note import mark_as_seen
class TestBootData(unittest.TestCase):
def test_get_unseen_notes(self):
frappe.db.delete("Note")
frappe.db.delete("Note Seen By")
note = frappe.get_doc(
{
"doctype": "Note",
... | Add a test case to validate `get_unseen_notes` | test: Add a test case to validate `get_unseen_notes`
| Python | mit | yashodhank/frappe,StrellaGroup/frappe,frappe/frappe,yashodhank/frappe,yashodhank/frappe,yashodhank/frappe,frappe/frappe,frappe/frappe,StrellaGroup/frappe,StrellaGroup/frappe | ---
+++
@@ -0,0 +1,29 @@
+import unittest
+
+import frappe
+from frappe.boot import get_unseen_notes
+from frappe.desk.doctype.note.note import mark_as_seen
+
+
+class TestBootData(unittest.TestCase):
+ def test_get_unseen_notes(self):
+ frappe.db.delete("Note")
+ frappe.db.delete("Note Seen By")
+ note = frappe.g... | |
f7f25876d3398cacc822faf2b16cc156e88c7fd3 | misc/jp2_kakadu_pillow.py | misc/jp2_kakadu_pillow.py | # This the basic flow for getting from a JP2 to a jpg w/ kdu_expand and Pillow
# Useful for debugging the scenario independent of the server.
from PIL import Image
from PIL.ImageFile import Parser
from os import makedirs, path, unlink
import subprocess
import sys
KDU_EXPAND='/usr/local/bin/kdu_expand'
LIB_KDU='/usr/l... | Use this enough, might as well add it. | Use this enough, might as well add it.
| Python | bsd-2-clause | ehenneken/loris,medusa-project/loris,rlskoeser/loris,medusa-project/loris,rlskoeser/loris,ehenneken/loris | ---
+++
@@ -0,0 +1,56 @@
+# This the basic flow for getting from a JP2 to a jpg w/ kdu_expand and Pillow
+# Useful for debugging the scenario independent of the server.
+
+from PIL import Image
+from PIL.ImageFile import Parser
+from os import makedirs, path, unlink
+import subprocess
+import sys
+
+KDU_EXPAND='/usr/... | |
d5e67563f23acb11fe0e4641d48b67fe3509822f | apps/companyprofile/migrations/0002_auto_20151014_2132.py | apps/companyprofile/migrations/0002_auto_20151014_2132.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('companyprofile', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='company',
old... | Add test migration removing ref to old company image | Add test migration removing ref to old company image
| Python | mit | dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4 | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('companyprofile', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.RenameField(
+ ... | |
d5b622e9fb855753630cd3a6fae1a315b4be1a08 | examples/dominant_eigenvector_pytorch.py | examples/dominant_eigenvector_pytorch.py | import numpy as np
import numpy.random as rnd
import numpy.linalg as la
import torch
from pymanopt import Problem
from pymanopt.tools import decorators
from pymanopt.manifolds import Sphere
from pymanopt.solvers import TrustRegions
def dominant_eigenvector(A):
"""
Returns the dominant eigenvector of the symm... | Add example using new pytorch backend | Add example using new pytorch backend
Signed-off-by: Niklas Koep <342d5290239d9c5264c8f98185afedb99596601a@gmail.com>
| Python | bsd-3-clause | nkoep/pymanopt,nkoep/pymanopt,pymanopt/pymanopt,nkoep/pymanopt,pymanopt/pymanopt | ---
+++
@@ -0,0 +1,61 @@
+import numpy as np
+import numpy.random as rnd
+import numpy.linalg as la
+import torch
+
+from pymanopt import Problem
+from pymanopt.tools import decorators
+from pymanopt.manifolds import Sphere
+from pymanopt.solvers import TrustRegions
+
+
+def dominant_eigenvector(A):
+ """
+ Ret... | |
9fbde5b8dd4d2555e03bc0b7915fc4e55f8333d9 | numba/tests/test_help.py | numba/tests/test_help.py | from __future__ import print_function
import builtins
import types as pytypes
import numpy as np
from numba import types
from .support import TestCase
from numba.help.inspector import inspect_function, inspect_module
class TestInspector(TestCase):
def check_function_descriptor(self, info, must_be_defined=False... | Add test to help module | Add test to help module
| Python | bsd-2-clause | numba/numba,stonebig/numba,numba/numba,stonebig/numba,seibert/numba,stuartarchibald/numba,cpcloud/numba,sklam/numba,gmarkall/numba,stuartarchibald/numba,IntelLabs/numba,seibert/numba,IntelLabs/numba,IntelLabs/numba,gmarkall/numba,gmarkall/numba,seibert/numba,numba/numba,cpcloud/numba,gmarkall/numba,stuartarchibald/numb... | ---
+++
@@ -0,0 +1,55 @@
+from __future__ import print_function
+
+import builtins
+import types as pytypes
+
+import numpy as np
+
+from numba import types
+from .support import TestCase
+from numba.help.inspector import inspect_function, inspect_module
+
+
+class TestInspector(TestCase):
+ def check_function_des... | |
e8607fce01bfe17c08de0702c4041d98504bc159 | reunition/apps/alumni/migrations/0006_auto_20150823_2030.py | reunition/apps/alumni/migrations/0006_auto_20150823_2030.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('alumni', '0005_note'),
]
operations = [
migrations.AlterField(
model_name='note',
name='contacted',
... | Add migration for changing CONTACTED_CHOICES | Add migration for changing CONTACTED_CHOICES
| Python | mit | reunition/reunition,reunition/reunition,reunition/reunition | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('alumni', '0005_note'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_n... | |
3367f9d1e394bf686bc6bbd6316265c9feef4f03 | test/on_yubikey/test_cli_config.py | test/on_yubikey/test_cli_config.py | from .util import (DestructiveYubikeyTestCase, ykman_cli)
class TestConfigUSB(DestructiveYubikeyTestCase):
def setUp(self):
ykman_cli('config', 'usb', '--enable-all', '-f')
def tearDown(self):
ykman_cli('config', 'usb', '--enable-all', '-f')
def test_disable_otp(self):
ykman_cli... | Add basic tests for config usb | Add basic tests for config usb
| Python | bsd-2-clause | Yubico/yubikey-manager,Yubico/yubikey-manager | ---
+++
@@ -0,0 +1,40 @@
+from .util import (DestructiveYubikeyTestCase, ykman_cli)
+
+
+class TestConfigUSB(DestructiveYubikeyTestCase):
+
+ def setUp(self):
+ ykman_cli('config', 'usb', '--enable-all', '-f')
+
+ def tearDown(self):
+ ykman_cli('config', 'usb', '--enable-all', '-f')
+
+ def te... | |
28b5fef57580640cd78775d6c0544bc633e5958a | generate-key.py | generate-key.py | #!/usr/bin/python
import os
import sqlite3
import sys
import time
if len(sys.argv) < 3:
raise ValueError('Usage: %s "Firstnam Lastname" email@example.com' % sys.argv[0])
db = sqlite3.connect('/var/lib/zon-api/data.db')
api_key = str(os.urandom(26).encode('hex'))
tier = 'free'
name = sys.argv[1]
email = sys.argv[... | Add helper script to generate API keys. | Add helper script to generate API keys.
| Python | bsd-3-clause | ZeitOnline/content-api,ZeitOnline/content-api | ---
+++
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+
+import os
+import sqlite3
+import sys
+import time
+
+if len(sys.argv) < 3:
+ raise ValueError('Usage: %s "Firstnam Lastname" email@example.com' % sys.argv[0])
+
+db = sqlite3.connect('/var/lib/zon-api/data.db')
+api_key = str(os.urandom(26).encode('hex'))
+tier = 'fr... | |
3b27b1d6b1c4739b8d456703542ec8182ce12277 | heat/tests/functional/test_WordPress_Composed_Instances.py | heat/tests/functional/test_WordPress_Composed_Instances.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# 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 applicabl... | Add a Wordpress+MySQL composed instance functional test case | Add a Wordpress+MySQL composed instance functional test case
Change-Id: I6a905b186be59c929e530519414e46d222b4ea08
Signed-off-by: Steven Dake <8638f3fce5db0278cfbc239bd581dfc00c29ec9d@redhat.com>
| Python | apache-2.0 | gonzolino/heat,noironetworks/heat,steveb/heat,cwolferh/heat-scratch,noironetworks/heat,gonzolino/heat,maestro-hybrid-cloud/heat,citrix-openstack-build/heat,pshchelo/heat,cryptickp/heat,dragorosson/heat,rh-s/heat,Triv90/Heat,steveb/heat,rh-s/heat,srznew/heat,srznew/heat,openstack/heat,redhat-openstack/heat,rickerc/heat_... | ---
+++
@@ -0,0 +1,54 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+#
+# 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
+... | |
3bd95d8789871246fb90c6eb0487d9746ef5cb27 | bluebottle/cms/migrations/0056_auto_20191106_1041.py | bluebottle/cms/migrations/0056_auto_20191106_1041.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-11-06 09:41
from __future__ import unicode_literals
from django.db import migrations
def migrate_project_blocks(apps, schema_editor):
ProjectsContent = apps.get_model('cms', 'ProjectsContent')
ActivitiesContent = apps.get_model('cms', 'ActivitiesC... | Migrate all project contents blocks to activity contents blocks | Migrate all project contents blocks to activity contents blocks
BB-15606 #resolve
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | ---
+++
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.15 on 2019-11-06 09:41
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+def migrate_project_blocks(apps, schema_editor):
+ ProjectsContent = apps.get_model('cms', 'ProjectsContent')
+ ActivitiesContent... | |
06570a926bde2ea10730062b05a2348c3020745c | examples/filter_ensemble_average.py | examples/filter_ensemble_average.py | import numpy as np
import matplotlib.pyplot as plt
import atomic
from ensemble_average import time_dependent_power
if __name__ == '__main__':
times = np.logspace(-7, 0, 50)
temperature = np.logspace(0, 3, 50)
density = 1e19
from atomic.pec import TransitionPool
ad = atomic.element('argon')
t... | Add example: filtered ensemble average. | Add example: filtered ensemble average.
| Python | mit | cfe316/atomic,ezekial4/atomic_neu,ezekial4/atomic_neu | ---
+++
@@ -0,0 +1,38 @@
+import numpy as np
+import matplotlib.pyplot as plt
+import atomic
+
+from ensemble_average import time_dependent_power
+
+
+if __name__ == '__main__':
+ times = np.logspace(-7, 0, 50)
+ temperature = np.logspace(0, 3, 50)
+ density = 1e19
+
+ from atomic.pec import TransitionPoo... | |
38b4ec7164f07af7135c41c401c4f403c1061d66 | app/main.py | app/main.py | """lazy
Usage:
lazy (new|n)
lazy (show|s) [<id>]
lazy (delete|d) [<id>]
lazy (import|i) <path>
lazy (export|e) <path> [<id>]
Options:
-h, --help: Show this help message.
"""
from docopt import docopt
def main():
# Parse commandline arguments.
args = docop... | Add skeleton for parsing commands | Add skeleton for parsing commands
| Python | mit | Zillolo/lazy-todo | ---
+++
@@ -0,0 +1,50 @@
+"""lazy
+
+ Usage:
+ lazy (new|n)
+ lazy (show|s) [<id>]
+ lazy (delete|d) [<id>]
+ lazy (import|i) <path>
+ lazy (export|e) <path> [<id>]
+
+ Options:
+ -h, --help: Show this help message.
+"""
+
+from docopt import docopt
+
+
+def main():
+ # ... | |
3ed9dd0ca03216311771cda5f9cd3eb954a14d4f | telemeta/management/commands/telemeta-test-boilerplate.py | telemeta/management/commands/telemeta-test-boilerplate.py | from optparse import make_option
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from django.template.defaultfilters import slugify
import os
from telemeta.models import *
from timeside.core.tools.test_samples import generat... | Add boilerplate with simple test sounds | Add boilerplate with simple test sounds
| Python | agpl-3.0 | Parisson/Telemeta,Parisson/Telemeta,ANR-kamoulox/Telemeta,ANR-kamoulox/Telemeta,Parisson/Telemeta,ANR-kamoulox/Telemeta,ANR-kamoulox/Telemeta,Parisson/Telemeta | ---
+++
@@ -0,0 +1,36 @@
+from optparse import make_option
+from django.conf import settings
+from django.core.management.base import BaseCommand, CommandError
+from django.contrib.auth.models import User
+from django.template.defaultfilters import slugify
+
+import os
+from telemeta.models import *
+from timeside.co... | |
3e0ababfeb0e22d33853d4bad68a29a0249e1a60 | other/iterate_deadlock.py | other/iterate_deadlock.py |
"""
Demonstrates deadlock related to attribute iteration.
"""
from threading import Thread
import h5py
FNAME = "deadlock.hdf5"
def make_file():
with h5py.File(FNAME,'w') as f:
for idx in xrange(1000):
f.attrs['%d'%idx] = 1
def list_attributes():
with h5py.File(FNAME, 'r') as f:
... | Add script demonstrating thread deadlock | Add script demonstrating thread deadlock
| Python | bsd-3-clause | h5py/h5py,h5py/h5py,h5py/h5py | ---
+++
@@ -0,0 +1,27 @@
+
+"""
+ Demonstrates deadlock related to attribute iteration.
+"""
+
+from threading import Thread
+
+import h5py
+
+FNAME = "deadlock.hdf5"
+
+def make_file():
+ with h5py.File(FNAME,'w') as f:
+ for idx in xrange(1000):
+ f.attrs['%d'%idx] = 1
+
+def list_attributes... | |
b1517f63c3aa549170d77c6fb3546901fdbe744b | candidates/migrations/0017_remove_cv_and_program_fields.py | candidates/migrations/0017_remove_cv_and_program_fields.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('candidates', '0016_migrate_data_to_extra_fields'),
]
operations = [
migrations.RemoveField(
model_name='personex... | Remove the hard-coded extra 'cv' and 'program' fields | Remove the hard-coded extra 'cv' and 'program' fields
| Python | agpl-3.0 | datamade/yournextmp-popit,datamade/yournextmp-popit,datamade/yournextmp-popit,datamade/yournextmp-popit,datamade/yournextmp-popit | ---
+++
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('candidates', '0016_migrate_data_to_extra_fields'),
+ ]
+
+ operations = [
+ migrations.Remo... | |
72738366fa074b457021faab0c21c3b89070b5ad | nautilus/wizbit-extension.py | nautilus/wizbit-extension.py | from urlparse import urlparse
from os.path import exists, split, isdir
import nautilus
from lxml import etree
WIZ_CONTROLLED = "wiz-controlled"
WIZ_CONFLICT = "wiz-conflict"
YES = "Yes"
NO = "No"
class WizbitExtension(nautilus.ColumnProvider, nautilus.InfoProvider):
def __init__(self):
pass
def get... | Add first revision of Nautilus extension. | Add first revision of Nautilus extension.
Features: Adds file properties for wizbit controlled
and wizbit conflicting. Adds emblems to the file for
these states.
| Python | lgpl-2.1 | wizbit-archive/wizbit,wizbit-archive/wizbit | ---
+++
@@ -0,0 +1,84 @@
+from urlparse import urlparse
+from os.path import exists, split, isdir
+
+import nautilus
+from lxml import etree
+
+WIZ_CONTROLLED = "wiz-controlled"
+WIZ_CONFLICT = "wiz-conflict"
+
+YES = "Yes"
+NO = "No"
+
+class WizbitExtension(nautilus.ColumnProvider, nautilus.InfoProvider):
+ def ... | |
24cf3c2676e4ea7342e95e6a37857c6fa687865e | src/submission/migrations/0058_auto_20210812_1254.py | src/submission/migrations/0058_auto_20210812_1254.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-08-12 12:54
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('submission', '0057_merge_20210811_1506'),
]
operations = [
migrations.AlterModelMa... | Remove managers for article obj. | Remove managers for article obj.
| Python | agpl-3.0 | BirkbeckCTP/janeway,BirkbeckCTP/janeway,BirkbeckCTP/janeway,BirkbeckCTP/janeway | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.29 on 2021-08-12 12:54
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('submission', '0057_merge_20210811_1506'),
+ ]
+
+ opera... | |
68a7f9faf1933bb224113d9fa5d0ddd362b2e5ea | SizeDocGenerator.py | SizeDocGenerator.py | import os, re;
# I got the actual size of the binary code wrong on the site once - this script should help prevent that.
dsDoc_by_sArch = {"w32": "x86", "w64": "x64", "win": "x86+x64"};
with open("build_info.txt", "rb") as oFile:
iBuildNumber = int(re.search(r"build number\: (\d+)", oFile.read(), re.M).group(1)... | Add script to generate the site documentation containing the sizes of the binary shellcodes. | Add script to generate the site documentation containing the sizes of the binary shellcodes. | Python | bsd-3-clause | computerline1z/win-exec-calc-shellcode,computerline1z/win-exec-calc-shellcode,ohio813/win-exec-calc-shellcode,ohio813/win-exec-calc-shellcode | ---
+++
@@ -0,0 +1,14 @@
+import os, re;
+# I got the actual size of the binary code wrong on the site once - this script should help prevent that.
+
+dsDoc_by_sArch = {"w32": "x86", "w64": "x64", "win": "x86+x64"};
+with open("build_info.txt", "rb") as oFile:
+ iBuildNumber = int(re.search(r"build number\: (\d+)", ... | |
bbc208548f0dd381f3045d24db3c21c4c8ee004e | grovepi/scan.py | grovepi/scan.py | import time
import grove_i2c_temp_hum_mini # temp + humidity
import hp206c # altitude + temp + pressure
import grovepi # used by air sensor and dust sensor
import atexit # used for the dust sensor
import json
# Initialize the sensors
t= grove_i2c_temp_hum_mini.th02()
h= hp206c.hp206c()
grovepi.dust_sensor_en()
air_se... | Test all sensors at once | Test all sensors at once
| Python | mit | mmewen/UTSEUS-Binky,mmewen/UTSEUS-Binky,mmewen/UTSEUS-Binky,mmewen/UTSEUS-Binky,mmewen/UTSEUS-Binky | ---
+++
@@ -0,0 +1,66 @@
+import time
+import grove_i2c_temp_hum_mini # temp + humidity
+import hp206c # altitude + temp + pressure
+import grovepi # used by air sensor and dust sensor
+import atexit # used for the dust sensor
+import json
+
+# Initialize the sensors
+t= grove_i2c_temp_hum_mini.th02()
+h= hp206c.hp2... | |
c834082c59abe6ae6d2e065e1a5afac2d399a612 | lib/bridgedb/test/test_crypto.py | lib/bridgedb/test/test_crypto.py | # -*- coding: utf-8 -*-
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org>
# please also see AUTHORS file
# :copyright: (c) 2013, Isis Lovecruft
# (c) 2007-2013, The Tor Project, Inc.
# (c) 2007-201... | Add unittests for the bridgedb.crypto module. | Add unittests for the bridgedb.crypto module.
| Python | bsd-3-clause | mmaker/bridgedb,pagea/bridgedb,mmaker/bridgedb,wfn/bridgedb,pagea/bridgedb,wfn/bridgedb | ---
+++
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+#
+# This file is part of BridgeDB, a Tor bridge distribution system.
+#
+# :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org>
+# please also see AUTHORS file
+# :copyright: (c) 2013, Isis Lovecruft
+# (c) 2007-2013, The Tor Proje... | |
955bca3beb7808636a586bed43c37e5f74fba17f | kino/functions/weather.py | kino/functions/weather.py | # -*- coding: utf-8 -*-
import datetime
import forecastio
from geopy.geocoders import GoogleV3
from kino.template import MsgTemplate
from slack.slackbot import SlackerAdapter
from utils.config import Config
class Weather(object):
def __init__(self):
self.config = Config()
self.slackbot = Slacker... | Add Weather class (use forecastio, geopy) - forecase(current/daily) | Add Weather class (use forecastio, geopy) - forecase(current/daily)
| Python | mit | DongjunLee/kino-bot | ---
+++
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+
+import datetime
+import forecastio
+from geopy.geocoders import GoogleV3
+
+from kino.template import MsgTemplate
+from slack.slackbot import SlackerAdapter
+from utils.config import Config
+
+class Weather(object):
+
+ def __init__(self):
+ self.config =... | |
6789f2ea1862f4c30e8d60bd0b47640b7e5835c1 | count_labels.py | count_labels.py | """Count HEEM labels in data set.
Usage: python count_labels.py <dir with train and test files>
"""
import codecs
from glob import glob
import numpy as np
import argparse
from collections import Counter
def load_data(data_file):
data = [ln.rsplit(None, 1) for ln in open(data_file)]
X_data, Y_data = zip(*dat... | Add script to count labels in a data set | Add script to count labels in a data set
(Moved from embodied emotions ml code.)
| Python | apache-2.0 | NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts | ---
+++
@@ -0,0 +1,48 @@
+"""Count HEEM labels in data set.
+
+Usage: python count_labels.py <dir with train and test files>
+"""
+import codecs
+from glob import glob
+import numpy as np
+import argparse
+from collections import Counter
+
+
+def load_data(data_file):
+ data = [ln.rsplit(None, 1) for ln in open(da... | |
a9609a500a65cc0efb787f5d90e164bd6fa48c1a | leftViewofBST.py | leftViewofBST.py | class BST:
def __init__(self,val):
self.left = None
self.right = None
self.data = val
def insertToBst(root,value):
if root is None:
root = value
else:
if value.data < root.data:
if root.left is None:
root.left = value
else:
... | Print the left view of a BST | Print the left view of a BST
| Python | mit | arunkumarpalaniappan/algorithm_tryouts | ---
+++
@@ -0,0 +1,43 @@
+class BST:
+ def __init__(self,val):
+ self.left = None
+ self.right = None
+ self.data = val
+
+def insertToBst(root,value):
+ if root is None:
+ root = value
+ else:
+ if value.data < root.data:
+ if root.left is None:
+ ... | |
e19097216c090c0e3f4b68c743d6427f012ab69e | txlege84/legislators/migrations/0004_auto_20141201_1604.py | txlege84/legislators/migrations/0004_auto_20141201_1604.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('legislators', '0003_auto_20141120_1731'),
]
operations = [
migrations.AlterField(
model_name='legislator',
... | Add migration for legislator change | Add migration for legislator change
| Python | mit | texastribune/txlege84,texastribune/txlege84,texastribune/txlege84,texastribune/txlege84 | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('legislators', '0003_auto_20141120_1731'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+... | |
897843932937faa841220cde90bdc89603d95615 | hackerrank/linked-list/dedup.py | hackerrank/linked-list/dedup.py | # https://www.hackerrank.com/challenges/delete-duplicate-value-nodes-from-a-sorted-linked-list/problem
def RemoveDuplicates(head):
if head is None:
return None
curr = head
while curr.next is not None:
currentData = curr.data
next = curr.next;
nextData = next.data
... | Solve hackerrank linked list problem | [algorithm] Solve hackerrank linked list problem
| Python | mit | honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice,honux77/practice | ---
+++
@@ -0,0 +1,17 @@
+# https://www.hackerrank.com/challenges/delete-duplicate-value-nodes-from-a-sorted-linked-list/problem
+
+def RemoveDuplicates(head):
+ if head is None:
+ return None
+
+ curr = head
+ while curr.next is not None:
+ currentData = curr.data
+ next = curr.next... | |
a8274a5d5e4ec68f3ee594ffa741e90f11cf24db | tools/update_test_bmv2_jsons.py | tools/update_test_bmv2_jsons.py | #!/usr/bin/env python2
import argparse
import fnmatch
import os
import subprocess
import sys
def find_files(root):
files = []
for path_prefix, _, filenames in os.walk(root, followlinks=False):
for filename in fnmatch.filter(filenames, '*.p4'):
path = os.path.join(path_prefix, filename)
... | Add tool to regenerate JSON files from P4 progs | Add tool to regenerate JSON files from P4 progs
tools/update_test_bmv2_jsons.py can be used to regenerate all the bmv2
JSON files from their P4 counterpart
| Python | apache-2.0 | p4lang/PI,p4lang/PI,p4lang/PI,p4lang/PI | ---
+++
@@ -0,0 +1,62 @@
+#!/usr/bin/env python2
+
+import argparse
+import fnmatch
+import os
+import subprocess
+import sys
+
+def find_files(root):
+ files = []
+ for path_prefix, _, filenames in os.walk(root, followlinks=False):
+ for filename in fnmatch.filter(filenames, '*.p4'):
+ path =... | |
b9034ca499ae8c0366ac8cd5ee71641f39c0ffba | website/project/taxonomies/__init__.py | website/project/taxonomies/__init__.py | import json
import os
from website import settings
from modularodm import fields, Q
from modularodm.exceptions import NoResultsFound
from framework.mongo import (
ObjectId,
StoredObject,
utils as mongo_utils
)
@mongo_utils.unique_on(['id', '_id'])
class Subject(StoredObject):
_id = fields.StringFie... | Add taxonomy model and initiation | Add taxonomy model and initiation
| Python | apache-2.0 | Nesiehr/osf.io,binoculars/osf.io,pattisdr/osf.io,mattclark/osf.io,caseyrollins/osf.io,leb2dg/osf.io,baylee-d/osf.io,monikagrabowska/osf.io,monikagrabowska/osf.io,acshi/osf.io,icereval/osf.io,adlius/osf.io,leb2dg/osf.io,aaxelb/osf.io,chrisseto/osf.io,binoculars/osf.io,rdhyee/osf.io,alexschiller/osf.io,chennan47/osf.io,m... | ---
+++
@@ -0,0 +1,57 @@
+import json
+import os
+
+from website import settings
+
+from modularodm import fields, Q
+from modularodm.exceptions import NoResultsFound
+
+from framework.mongo import (
+ ObjectId,
+ StoredObject,
+ utils as mongo_utils
+)
+
+
+@mongo_utils.unique_on(['id', '_id'])
+class Subje... | |
7491f500c75850c094158b4621fdef602bce3d27 | benchmarks/benchmarks/benchmark_custom_generators.py | benchmarks/benchmarks/benchmark_custom_generators.py | from tohu.v6.primitive_generators import Integer, HashDigest, FakerGenerator
from tohu.v6.derived_generators import Apply, Lookup, SelectOne, SelectMultiple
from tohu.v6.custom_generator import CustomGenerator
from .common import NUM_PARAMS
mapping = {
'A': ['a', 'aa', 'aaa', 'aaaa', 'aaaaa'],
'B': ['b', 'bb... | Add benchmarks for custom generators | Add benchmarks for custom generators
| Python | mit | maxalbert/tohu | ---
+++
@@ -0,0 +1,64 @@
+from tohu.v6.primitive_generators import Integer, HashDigest, FakerGenerator
+from tohu.v6.derived_generators import Apply, Lookup, SelectOne, SelectMultiple
+from tohu.v6.custom_generator import CustomGenerator
+
+from .common import NUM_PARAMS
+
+
+mapping = {
+ 'A': ['a', 'aa', 'aaa', ... | |
48eb4604673513b771b6def05a1652ae1b66d4d0 | scripts/add_ssm_config.py | scripts/add_ssm_config.py | #!/usr/bin/env python
# -*- encoding: utf-8
"""
Store a config variable in SSM under the key structure
/{project_id}/config/{label}/{config_key}
This script can store a regular config key (unencrypted) or an encrypted key.
"""
import sys
import boto3
import click
ssm_client = boto3.client("ssm")
@click.com... | Add a script for storing a config variable | Add a script for storing a config variable
| Python | mit | wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api | ---
+++
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+# -*- encoding: utf-8
+"""
+Store a config variable in SSM under the key structure
+
+ /{project_id}/config/{label}/{config_key}
+
+This script can store a regular config key (unencrypted) or an encrypted key.
+
+"""
+
+import sys
+
+import boto3
+import click
+
+
+... | |
50dded21e316b6b8e6cb7800b17ed7bd92624946 | xml_to_json.py | xml_to_json.py | #!/usr/bin/env python
import xml.etree.cElementTree as ET
from sys import argv
input_file = argv[1]
NAMESPACE = "{http://www.mediawiki.org/xml/export-0.10/}"
with open(input_file) as open_file:
in_page = False
for _, elem in ET.iterparse(open_file):
# Pull out each revision
if elem.tag == NA... | Add toy example of reading a large XML file | Add toy example of reading a large XML file
| Python | apache-2.0 | tiffanyj41/hermes,tiffanyj41/hermes,tiffanyj41/hermes,tiffanyj41/hermes | ---
+++
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+
+import xml.etree.cElementTree as ET
+from sys import argv
+
+input_file = argv[1]
+
+NAMESPACE = "{http://www.mediawiki.org/xml/export-0.10/}"
+
+with open(input_file) as open_file:
+ in_page = False
+ for _, elem in ET.iterparse(open_file):
+ # Pull out... | |
63f9f87a3f04cb03c1e286cc5b6d49306f90e352 | python/004_largest_palindrome_product/palindrome_product.py | python/004_largest_palindrome_product/palindrome_product.py | from itertools import combinations_with_replacement
from operator import mul
three_digit_numbers = tuple(range(100, 1000))
combinations = combinations_with_replacement(three_digit_numbers, 2)
products = [mul(*x) for x in combinations]
max_palindrome = max([x for x in products if str(x)[::-1] == str(x)])
| Add solution for problem 4 | Add solution for problem 4
| Python | bsd-3-clause | gidj/euler,gidj/euler | ---
+++
@@ -0,0 +1,10 @@
+from itertools import combinations_with_replacement
+from operator import mul
+
+three_digit_numbers = tuple(range(100, 1000))
+
+combinations = combinations_with_replacement(three_digit_numbers, 2)
+
+products = [mul(*x) for x in combinations]
+
+max_palindrome = max([x for x in products if... | |
d410fb26d3fb8bbd843234e90891bee5a5fff7e7 | halaqat/settings/local_settings.py | halaqat/settings/local_settings.py | from .base_settings import *
DEBUG = True
LANGUAGE_CODE = 'en'
TIME_FORMAT = [
'%I:%M %p',
'%H:%M %p',
]
TIME_INPUT_FORMATS = [
'%I:%M %p',
'%H:%M %p'
]
| Add local dev settings module | Add local dev settings module
| Python | mit | EmadMokhtar/halaqat,EmadMokhtar/halaqat,EmadMokhtar/halaqat | ---
+++
@@ -0,0 +1,17 @@
+from .base_settings import *
+
+DEBUG = True
+
+LANGUAGE_CODE = 'en'
+
+TIME_FORMAT = [
+
+ '%I:%M %p',
+ '%H:%M %p',
+]
+
+
+TIME_INPUT_FORMATS = [
+ '%I:%M %p',
+ '%H:%M %p'
+] | |
dc7cf288c5c5c9733a59184770fbaa26db036833 | tests/unit_project/test_core/test_custom_urls.py | tests/unit_project/test_core/test_custom_urls.py | # -*- coding: utf-8 -*-
from djangosanetesting import UnitTestCase
from django.http import Http404
from ella.core.custom_urls import DetailDispatcher
# dummy functions to register as views
def view(request, bits, context):
return request, bits, context
def custom_view(request, context):
return request, cont... | Add basic tests for custom_urls system | Add basic tests for custom_urls system
| Python | bsd-3-clause | whalerock/ella,petrlosa/ella,WhiskeyMedia/ella,whalerock/ella,whalerock/ella,MichalMaM/ella,petrlosa/ella,MichalMaM/ella,ella/ella,WhiskeyMedia/ella | ---
+++
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+from djangosanetesting import UnitTestCase
+
+from django.http import Http404
+
+from ella.core.custom_urls import DetailDispatcher
+
+# dummy functions to register as views
+def view(request, bits, context):
+ return request, bits, context
+
+def custom_view(requ... | |
c153bc9422308599d1354abf782273ca7bd78952 | nova/tests/virt_unittest.py | nova/tests/virt_unittest.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2010 OpenStack LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | Add a few unit tests for libvirt_conn. | Add a few unit tests for libvirt_conn. | Python | apache-2.0 | n0ano/ganttclient | ---
+++
@@ -0,0 +1,69 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+#
+# Copyright 2010 OpenStack LLC
+#
+# 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:/... | |
ea11ae8919139eae8eaa6b9b1dfe256726d3c584 | test/test_SBSolarcell.py | test/test_SBSolarcell.py | # -*- coding: utf-8 -*-
import numpy as np
import ibei
from astropy import units
import unittest
temp_sun = 5762.
temp_earth = 288.
bandgap = 1.15
input_params = {"temp_sun": temp_sun,
"temp_planet": temp_earth,
"bandgap": bandgap,
"voltage": 0.5,}
class CalculatorsRe... | Copy SBSolarcell tests into individual file | Copy SBSolarcell tests into individual file
| Python | mit | jrsmith3/ibei,jrsmith3/tec,jrsmith3/tec | ---
+++
@@ -0,0 +1,89 @@
+# -*- coding: utf-8 -*-
+import numpy as np
+import ibei
+from astropy import units
+import unittest
+
+temp_sun = 5762.
+temp_earth = 288.
+bandgap = 1.15
+
+input_params = {"temp_sun": temp_sun,
+ "temp_planet": temp_earth,
+ "bandgap": bandgap,
+ ... | |
8fd466ecd16db736177104902eb84f661b2b62cc | opps/sitemaps/googlenews.py | opps/sitemaps/googlenews.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib.sitemaps import GenericSitemap
from django.contrib.sites.models import Site
class GoogleNewsSitemap(GenericSitemap):
# That's Google News limit. Do not increase it!
limit = 1000
sitemap_template = 'sitemap_googlenews.xml'
def get_urls(... | Create sitemap for google news | Create sitemap for google news
| Python | mit | jeanmask/opps,opps/opps,YACOWS/opps,williamroot/opps,opps/opps,YACOWS/opps,williamroot/opps,williamroot/opps,opps/opps,YACOWS/opps,jeanmask/opps,YACOWS/opps,opps/opps,jeanmask/opps,williamroot/opps,jeanmask/opps | ---
+++
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+from django.contrib.sitemaps import GenericSitemap
+from django.contrib.sites.models import Site
+
+
+class GoogleNewsSitemap(GenericSitemap):
+ # That's Google News limit. Do not increase it!
+ limit = 1000
+ sitemap_template = 'sitem... | |
2a106a12db2a59ccb0517a13db67b35f475b3ef5 | apps/survey/urls.py | apps/survey/urls.py | from django.conf.urls.defaults import *
from . import views
urlpatterns = patterns('',
url(r'^profile/$', views.profile_index, name='survey_profile'),
url(r'^profile/electric/$', views.profile_electric, name='survey_profile_electric'),
url(r'^main/$', views.main_index),
url(r'^group_management/$', vie... | from django.conf.urls.defaults import *
from . import views
urlpatterns = patterns('',
url(r'^profile/$', views.profile_index, name='survey_profile'),
url(r'^profile/electric/$', views.profile_electric, name='survey_profile_electric'),
url(r'^main/$', views.main_index),
url(r'^group_management/$', vie... | Add args to survey_data url | Add args to survey_data url
| Python | agpl-3.0 | chispita/epiwork,chispita/epiwork,chispita/epiwork,chispita/epiwork,chispita/epiwork,chispita/epiwork,chispita/epiwork | ---
+++
@@ -8,7 +8,8 @@
url(r'^main/$', views.main_index),
url(r'^group_management/$', views.group_management, name='group_management'),
url(r'^survey_management/$', views.survey_management, name='survey_management'),
- url(r'^survey_data/$', views.survey_data, name='survey_management'),
+ url(r'... |
1b00a597d8145b2df05054fef8d072d452209463 | src/data/surface.py | src/data/surface.py | from glob import glob
# Third-party modules
import pandas as pd
# Hand-made modules
from base import LocationHandlerBase
SFC_REGEX_DIRNAME = "sfc[1-5]"
KWARGS_READ_CSV_SFC_MASTER = {
"index_col": 0,
}
KWARGS_READ_CSV_SFC_LOG = {
"index_col": 0,
"na_values": ['', ' ']
}
class SurfaceHandler(LocationHandle... | Make SurfaceHandler (for sfc data) | Make SurfaceHandler (for sfc data)
| Python | mit | gciteam6/xgboost,gciteam6/xgboost | ---
+++
@@ -0,0 +1,71 @@
+from glob import glob
+# Third-party modules
+import pandas as pd
+# Hand-made modules
+from base import LocationHandlerBase
+
+SFC_REGEX_DIRNAME = "sfc[1-5]"
+KWARGS_READ_CSV_SFC_MASTER = {
+ "index_col": 0,
+}
+KWARGS_READ_CSV_SFC_LOG = {
+ "index_col": 0,
+ "na_values": ['', ' ']... | |
3091555ca7fc421f886a1df1ac28f677feb70a53 | app/migrations/0006_auto_20150825_1513.py | app/migrations/0006_auto_20150825_1513.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0005_auto_20150819_1054'),
]
operations = [
migrations.AlterField(
model_name='socialnetworkapp',
... | Add default value for the fields object and field of the social network app model | Add default value for the fields object and field of the social network app model
| Python | mit | rebearteta/social-ideation,rebearteta/social-ideation,rebearteta/social-ideation,joausaga/social-ideation,rebearteta/social-ideation,joausaga/social-ideation,joausaga/social-ideation,joausaga/social-ideation | ---
+++
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('app', '0005_auto_20150819_1054'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ ... | |
d9be3f189fc34117bdec6e0c7856f7a7dc5f902a | cdap-docs/tools/versionscallback-gen.py | cdap-docs/tools/versionscallback-gen.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2014 Cask Data, Inc.
#
# Used to generate JSONP from a CDAP documentation directory on a webserver.
#
# sudo echo "versionscallback({\"development\": \"2.6.0-SNAPSHOT\", \"current\": \"2.5.2\", \"versions\": [\"2.5.1\", \"2.5.0\"]});" > json-versions.js; l... | Add tool for generating the JSONP required by the documentation versions. | Add tool for generating the JSONP required by the documentation versions.
| Python | apache-2.0 | chtyim/cdap,mpouttuclarke/cdap,anthcp/cdap,chtyim/cdap,hsaputra/cdap,chtyim/cdap,hsaputra/cdap,caskdata/cdap,chtyim/cdap,caskdata/cdap,mpouttuclarke/cdap,mpouttuclarke/cdap,hsaputra/cdap,caskdata/cdap,hsaputra/cdap,mpouttuclarke/cdap,caskdata/cdap,anthcp/cdap,anthcp/cdap,chtyim/cdap,caskdata/cdap,anthcp/cdap,caskdata/c... | ---
+++
@@ -0,0 +1,80 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+#
+# Copyright © 2014 Cask Data, Inc.
+#
+# Used to generate JSONP from a CDAP documentation directory on a webserver.
+#
+# sudo echo "versionscallback({\"development\": \"2.6.0-SNAPSHOT\", \"current\": \"2.5.2\", \"versions\": [\"2.5.1\", ... | |
bf3f14692b6e2a348f5a0171ad57e494801ed4f4 | scripts/writelibsvmdataformat.py | scripts/writelibsvmdataformat.py | """
A script to write out lib svm expected data format from my collecting data
"""
import os
import sys
import csv
import getopt
cmd_usage = """
usage: writelibsvmdataformat.py --inputs="/inputs/csv_files" --output="/output/lib_svm_data"
"""
feature_space = 10
def write_libsvm_data(input_files, output_file):
... | Add python script to write lib svm expected data format from my collected data | Add python script to write lib svm expected data format from my collected data
| Python | bsd-3-clause | Wayne82/libsvm-practice,Wayne82/libsvm-practice,Wayne82/libsvm-practice | ---
+++
@@ -0,0 +1,82 @@
+"""
+A script to write out lib svm expected data format from my collecting data
+"""
+import os
+import sys
+import csv
+import getopt
+
+cmd_usage = """
+ usage: writelibsvmdataformat.py --inputs="/inputs/csv_files" --output="/output/lib_svm_data"
+"""
+feature_space = 10
+
+
+def write_... | |
1c2c7d5134780e58bd69f24ee06050b2f405d946 | src/program/lwaftr/tests/subcommands/run_nohw_test.py | src/program/lwaftr/tests/subcommands/run_nohw_test.py | """
Test the "snabb lwaftr run_nohw" subcommand.
"""
import unittest
from random import randint
from subprocess import call, check_call
from test_env import DATA_DIR, SNABB_CMD, BaseTestCase
class TestRun(BaseTestCase):
program = [
str(SNABB_CMD), 'lwaftr', 'run_nohw',
]
cmd_args = {
'--... | Add unit test for run_nohw | Add unit test for run_nohw
| Python | apache-2.0 | Igalia/snabb,eugeneia/snabbswitch,eugeneia/snabbswitch,eugeneia/snabbswitch,alexandergall/snabbswitch,Igalia/snabb,alexandergall/snabbswitch,snabbco/snabb,dpino/snabb,eugeneia/snabb,heryii/snabb,alexandergall/snabbswitch,snabbco/snabb,snabbco/snabb,alexandergall/snabbswitch,Igalia/snabbswitch,Igalia/snabb,snabbco/snabb... | ---
+++
@@ -0,0 +1,77 @@
+"""
+Test the "snabb lwaftr run_nohw" subcommand.
+"""
+
+import unittest
+
+from random import randint
+from subprocess import call, check_call
+from test_env import DATA_DIR, SNABB_CMD, BaseTestCase
+
+class TestRun(BaseTestCase):
+
+ program = [
+ str(SNABB_CMD), 'lwaftr', 'run_... | |
87565c1e6032bff2cc3e20f5c4f46b7a17977f7c | migrations/versions/0098_tfl_dar.py | migrations/versions/0098_tfl_dar.py | """empty message
Revision ID: 0098_tfl_dar
Revises: 0097_notnull_inbound_provider
Create Date: 2017-06-05 16:15:17.744908
"""
# revision identifiers, used by Alembic.
revision = '0098_tfl_dar'
down_revision = '0097_notnull_inbound_provider'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects imp... | Add organisation for TFL Dial a Ride | Add organisation for TFL Dial a Ride
References image added in:
- [ ] https://github.com/alphagov/notifications-admin/pull/1321
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -0,0 +1,32 @@
+"""empty message
+
+Revision ID: 0098_tfl_dar
+Revises: 0097_notnull_inbound_provider
+Create Date: 2017-06-05 16:15:17.744908
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '0098_tfl_dar'
+down_revision = '0097_notnull_inbound_provider'
+
+from alembic import op
+import sqla... | |
22585d29220709dc3a3de16b03c626ca27c715ca | migrations/versions/3025c44bdb2_.py | migrations/versions/3025c44bdb2_.py | """empty message
Revision ID: 3025c44bdb2
Revises: None
Create Date: 2014-12-16 12:13:55.759378
"""
# revision identifiers, used by Alembic.
revision = '3025c44bdb2'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
pass
def downgrade():
pass
| Add migration version? Not sure if this is right | Add migration version? Not sure if this is right
| Python | bsd-2-clause | brianwolfe/robotics-tutorial,brianwolfe/robotics-tutorial,brianwolfe/robotics-tutorial | ---
+++
@@ -0,0 +1,22 @@
+"""empty message
+
+Revision ID: 3025c44bdb2
+Revises: None
+Create Date: 2014-12-16 12:13:55.759378
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '3025c44bdb2'
+down_revision = None
+
+from alembic import op
+import sqlalchemy as sa
+
+
+def upgrade():
+ pass
+
+
+def do... | |
64c70f3f73d14d5bdd18cf5c4ad8b15ec745f517 | config/check_ascii.py | config/check_ascii.py | import json
files = ["go-ussd_public.ibo_NG.json"]
def is_ascii(s):
return all(ord(c) < 128 for c in s)
current_message_id = 0
for file_name in files:
json_file = open(file_name, "rU").read()
json_data = json.loads(json_file)
print "Proccessing %s\n-------" % file_name
for key, value in json_dat... | Add helpful script for ascii checking - fyi @bruskiza | Add helpful script for ascii checking - fyi @bruskiza
| Python | bsd-3-clause | praekelt/mama-ng-jsbox,praekelt/mama-ng-jsbox | ---
+++
@@ -0,0 +1,20 @@
+import json
+files = ["go-ussd_public.ibo_NG.json"]
+
+
+def is_ascii(s):
+ return all(ord(c) < 128 for c in s)
+
+current_message_id = 0
+for file_name in files:
+ json_file = open(file_name, "rU").read()
+ json_data = json.loads(json_file)
+ print "Proccessing %s\n-------" % fi... | |
289ce4a720c5863f6a80e1b86083fd2919b52f14 | tests/startsymbol_tests/NotNonterminalTest.py | tests/startsymbol_tests/NotNonterminalTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 10.08.2017 23:12
:Licence GNUv3
Part of grammpy
"""
from unittest import TestCase, main
from grammpy import *
class NotNonterminalTest(TestCase):
pass
if __name__ == '__main__':
main()
| Add file for tests of start symbol as not nonterminal | Add file for tests of start symbol as not nonterminal
| Python | mit | PatrikValkovic/grammpy | ---
+++
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+"""
+:Author Patrik Valkovic
+:Created 10.08.2017 23:12
+:Licence GNUv3
+Part of grammpy
+
+"""
+
+from unittest import TestCase, main
+from grammpy import *
+
+
+class NotNonterminalTest(TestCase):
+ pass
+
+
+if __name__ == '__main__':
+ main() | |
e075b0b1c8d581107209e869eda7f6ff07a7321c | reverse_dict.py | reverse_dict.py | """Reverse modern->historic spelling variants dictonary to historic->modern
mappings
"""
import argparse
import codecs
import json
from collections import Counter
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('input_dict', help='the name of the json file '
... | Add script to create a historic->modern dictionary | Add script to create a historic->modern dictionary
The script takes as input a modern->historic variants dictionary in a
json file (created by the generate_historic_liwc script) and
reverses it to a dictionary that can be used to replace historic words
with their modern variant(s). Currently, the script only prints
st... | Python | apache-2.0 | NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts | ---
+++
@@ -0,0 +1,47 @@
+"""Reverse modern->historic spelling variants dictonary to historic->modern
+mappings
+"""
+import argparse
+import codecs
+import json
+from collections import Counter
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser()
+ parser.add_argument('input_dict', help='the name... | |
fb6eee18b2bf48dd0063623515ced00e980bdf10 | nipype/utils/tests/test_docparse.py | nipype/utils/tests/test_docparse.py | from nipype.testing import *
from nipype.utils.docparse import reverse_opt_map, build_doc
class Foo(object):
opt_map = {'outline': '-o', 'fun': '-f %.2f', 'flags': '%s'}
foo_doc = """Usage: foo infile outfile [opts]
Bunch of options:
-o something about an outline
-f <f> intensity of fun factor
O... | Add a few tests for docparse. | Add a few tests for docparse.
git-svn-id: 24f545668198cdd163a527378499f2123e59bf9f@338 ead46cd0-7350-4e37-8683-fc4c6f79bf00
| Python | bsd-3-clause | carolFrohlich/nipype,carolFrohlich/nipype,sgiavasis/nipype,gerddie/nipype,christianbrodbeck/nipype,glatard/nipype,grlee77/nipype,satra/NiPypeold,arokem/nipype,wanderine/nipype,mick-d/nipype,carlohamalainen/nipype,rameshvs/nipype,dgellis90/nipype,blakedewey/nipype,glatard/nipype,gerddie/nipype,grlee77/nipype,Leoniela/ni... | ---
+++
@@ -0,0 +1,40 @@
+from nipype.testing import *
+
+from nipype.utils.docparse import reverse_opt_map, build_doc
+
+class Foo(object):
+ opt_map = {'outline': '-o', 'fun': '-f %.2f', 'flags': '%s'}
+
+foo_doc = """Usage: foo infile outfile [opts]
+
+Bunch of options:
+
+ -o something about an outline... | |
555dac76a8810cfeaae96f8de04e9eb3362a3314 | migrations/versions/0109_rem_old_noti_status.py | migrations/versions/0109_rem_old_noti_status.py | """
Revision ID: 0109_rem_old_noti_status
Revises: 0108_change_logo_not_nullable
Create Date: 2017-07-10 14:25:15.712055
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0109_rem_old_noti_status'
down_revision = '0108_change_logo_not_nullable'
def upgrade():... | Remove old notification status column | Remove old notification status column
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -0,0 +1,45 @@
+"""
+
+Revision ID: 0109_rem_old_noti_status
+Revises: 0108_change_logo_not_nullable
+Create Date: 2017-07-10 14:25:15.712055
+
+"""
+from alembic import op
+import sqlalchemy as sa
+from sqlalchemy.dialects import postgresql
+
+revision = '0109_rem_old_noti_status'
+down_revision = '0108_ch... | |
21a67556b83b7905134439d55afe33c35e4b3422 | migrations/versions/0246_notifications_index.py | migrations/versions/0246_notifications_index.py | """
Revision ID: 0246_notifications_index
Revises: 0245_archived_flag_jobs
Create Date: 2018-12-12 12:00:09.770775
"""
from alembic import op
revision = '0246_notifications_index'
down_revision = '0245_archived_flag_jobs'
def upgrade():
conn = op.get_bind()
conn.execute(
"CREATE INDEX IF NOT EXISTS... | Add an index on notifications for (service_id, created_at) to improve the performance of the notification queries. We've already performed this update on production since you need to create the index concurrently, which is not allowed from the alembic script. For that reason we are checking if the index exists. | Add an index on notifications for (service_id, created_at) to improve the performance of the notification queries.
We've already performed this update on production since you need to create the index concurrently, which is not allowed from the alembic script. For that reason we are checking if the index exists.
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -0,0 +1,26 @@
+"""
+
+Revision ID: 0246_notifications_index
+Revises: 0245_archived_flag_jobs
+Create Date: 2018-12-12 12:00:09.770775
+
+"""
+from alembic import op
+
+revision = '0246_notifications_index'
+down_revision = '0245_archived_flag_jobs'
+
+
+def upgrade():
+ conn = op.get_bind()
+ conn.e... | |
5acc7d50cbe199af49aece28b95ea97484ae31c7 | snake/solutions/ghiaEtAl1982.py | snake/solutions/ghiaEtAl1982.py | """
Implementation of the class `GhiaEtAl1982` that reads the centerline velocities
reported in Ghia et al. (1982).
_References:_
* Ghia, U. K. N. G., Ghia, K. N., & Shin, C. T. (1982).
High-Re solutions for incompressible flow using the Navier-Stokes equations
and a multigrid method.
Journal of computational ph... | Add solution class for Ghia et al. (1982) | Add solution class for Ghia et al. (1982)
| Python | mit | mesnardo/snake | ---
+++
@@ -0,0 +1,71 @@
+"""
+Implementation of the class `GhiaEtAl1982` that reads the centerline velocities
+reported in Ghia et al. (1982).
+
+_References:_
+* Ghia, U. K. N. G., Ghia, K. N., & Shin, C. T. (1982).
+ High-Re solutions for incompressible flow using the Navier-Stokes equations
+ and a multigrid me... | |
14068a2e3ca445c02895aed38420baf846338aae | scripts/examples/25-Machine-Learning/nn_haar_smile_detection.py | scripts/examples/25-Machine-Learning/nn_haar_smile_detection.py | # Simle detection using Haar Cascade + CNN.
import sensor, time, image, os, nn
sensor.reset() # Reset and initialize the sensor.
sensor.set_contrast(2)
sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565
sensor.set_framesize(sensor.QQVGA) # Set frame size to QVGA (320x240... | Add smile detection example script. | NN: Add smile detection example script.
| Python | mit | iabdalkader/openmv,iabdalkader/openmv,iabdalkader/openmv,iabdalkader/openmv,openmv/openmv,kwagyeman/openmv,openmv/openmv,kwagyeman/openmv,kwagyeman/openmv,openmv/openmv,kwagyeman/openmv,openmv/openmv | ---
+++
@@ -0,0 +1,35 @@
+# Simle detection using Haar Cascade + CNN.
+import sensor, time, image, os, nn
+
+sensor.reset() # Reset and initialize the sensor.
+sensor.set_contrast(2)
+sensor.set_pixformat(sensor.GRAYSCALE) # Set pixel format to RGB565
+sensor.set_framesize(sensor.QQVGA) ... | |
139123ddb81eec12d0f932ff6ff73aadb4b418cc | ocradmin/lib/nodetree/decorators.py | ocradmin/lib/nodetree/decorators.py | """
Nodetree decorators.
"""
import inspect
import textwrap
import node
def underscore_to_camelcase(value):
def camelcase():
yield str.lower
while True:
yield str.capitalize
c = camelcase()
return "".join(c.next()(x) if x else '_' for x in value.split("_"))
def upper_camelca... | Add decorator to make a Node class from a regular function | Add decorator to make a Node class from a regular function
| Python | apache-2.0 | vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium | ---
+++
@@ -0,0 +1,55 @@
+"""
+Nodetree decorators.
+"""
+
+import inspect
+import textwrap
+import node
+
+
+def underscore_to_camelcase(value):
+ def camelcase():
+ yield str.lower
+ while True:
+ yield str.capitalize
+ c = camelcase()
+ return "".join(c.next()(x) if x else '_' fo... | |
fbc780c7beb94d73b2a4ea110e733f8c87763741 | geoip/lookups.py | geoip/lookups.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
##
## Author: Orcun Avsar <orc.avs@gmail.com>
##
## Copyright (C) 2011 S2S Network Consultoria e Tecnologia da Informacao LTDA
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU Affero General Public License as
## pub... | Add location name lookup for ajax_select. | Add location name lookup for ajax_select.
| Python | agpl-3.0 | umitproject/openmonitor-aggregator,umitproject/openmonitor-aggregator,umitproject/openmonitor-aggregator,umitproject/openmonitor-aggregator,umitproject/openmonitor-aggregator | ---
+++
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+##
+## Author: Orcun Avsar <orc.avs@gmail.com>
+##
+## Copyright (C) 2011 S2S Network Consultoria e Tecnologia da Informacao LTDA
+##
+## This program is free software: you can redistribute it and/or modify
+## it under the terms of the GNU Aff... | |
af3ba846a8074132c64568c420ecb9b6ade9c6ea | geomRegexTest.py | geomRegexTest.py | __author__ = 'Thomas Heavey'
import re
filename = "testg.out"
def findgeoms(filename):
"""A function that takes a file name and returns a list of
geometries."""
relevantelem = [1,3,4,5]
xyzformat = '{:>2} {: f} {: f} {: f}'
geomregex = re.compile(
r'(?:Standard orientation)' # no... | Work on defining RegEx to find and format molecular geometries in Gaussian output files. | Work on defining RegEx to find and format molecular geometries in Gaussian output files.
| Python | apache-2.0 | thompcinnamon/QM-calc-scripts | ---
+++
@@ -0,0 +1,36 @@
+__author__ = 'Thomas Heavey'
+
+import re
+
+filename = "testg.out"
+
+def findgeoms(filename):
+ """A function that takes a file name and returns a list of
+ geometries."""
+ relevantelem = [1,3,4,5]
+ xyzformat = '{:>2} {: f} {: f} {: f}'
+ geomregex = re.compile(
+... | |
c2b69a51faac56689edc88e747a00b60cf08cc04 | dthm4kaiako/poet/migrations/0003_auto_20190731_1912.py | dthm4kaiako/poet/migrations/0003_auto_20190731_1912.py | # Generated by Django 2.1.5 on 2019-07-31 07:12
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('poet', '0002_progressoutcomegroup'),
]
operations = [
migrations.AlterModelOptions(
name='progressoutcomegroup',
options={'o... | Add default ordering of progress outcome groups | Add default ordering of progress outcome groups
| Python | mit | uccser/cs4teachers,uccser/cs4teachers,uccser/cs4teachers,uccser/cs4teachers | ---
+++
@@ -0,0 +1,17 @@
+# Generated by Django 2.1.5 on 2019-07-31 07:12
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('poet', '0002_progressoutcomegroup'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='progr... | |
32a79573b38c6d2ea7f5b81363610a5d9332ed4e | src/main/resources/jsonformat.py | src/main/resources/jsonformat.py | #!/usr/bin/python2.7
import json
import socket
import sys
def readOutput(host, port):
data = None
s = None
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, int(port)))
except socket.error as msg:
s = None
print msg
if s is None:
return None
try:
data = s.recv(1024)
except ... | Add python script to parse JSON output | Add python script to parse JSON output
| Python | apache-2.0 | leo27lijiang/app-monitor,leo27lijiang/app-monitor | ---
+++
@@ -0,0 +1,56 @@
+#!/usr/bin/python2.7
+import json
+import socket
+import sys
+
+def readOutput(host, port):
+ data = None
+ s = None
+ try:
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ s.connect((host, int(port)))
+ except socket.error as msg:
+ s = None
+ print msg
+ if s is None:
+ retur... | |
699469342179fdc4319b5f39ea201015860ef09d | infrastructure/migrations/0020_auto_20210922_0929.py | infrastructure/migrations/0020_auto_20210922_0929.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-09-22 07:29
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('infrastructure', '0019_project_latest_implementation_year'... | Add migration for CI fix | Add migration for CI fix
| Python | mit | Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data | ---
+++
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.29 on 2021-09-22 07:29
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('infrastructure', '0... | |
c63144242d9cf2ecf02d58eb9a93cfe426acc6dc | scripts/send_preprint_unreg_contributor_emails.py | scripts/send_preprint_unreg_contributor_emails.py | # -*- coding: utf-8 -*-
"""Sends an unregistered user claim email for preprints created after 2017-03-14. A hotfix was made on that
date which caused unregistered user claim emails to not be sent. The regression was fixed on 2017-05-05. This
sends the emails that should have been sent during that time period.
NOTE: Th... | Add script to send unregister user emails | Add script to send unregister user emails
...to unregistered contributors who didn't receive the email
after 568413a77cc51511a0f7afe081a218676a36ebb6 was deployed
Relates to [OSF-7935]
| Python | apache-2.0 | laurenrevere/osf.io,Nesiehr/osf.io,cwisecarver/osf.io,leb2dg/osf.io,crcresearch/osf.io,leb2dg/osf.io,brianjgeiger/osf.io,Johnetordoff/osf.io,chennan47/osf.io,chrisseto/osf.io,Johnetordoff/osf.io,cslzchen/osf.io,Nesiehr/osf.io,caseyrollins/osf.io,sloria/osf.io,baylee-d/osf.io,cslzchen/osf.io,hmoco/osf.io,TomBaxter/osf.i... | ---
+++
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+"""Sends an unregistered user claim email for preprints created after 2017-03-14. A hotfix was made on that
+date which caused unregistered user claim emails to not be sent. The regression was fixed on 2017-05-05. This
+sends the emails that should have been sent dur... | |
4065a08ea401e0d95e8d40d9d735edf92edda861 | oslo_policy/tests/test_cache_handler.py | oslo_policy/tests/test_cache_handler.py | # Copyright (c) 2020 OpenStack Foundation.
# All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | Add unit tests on cache handler | Add unit tests on cache handler
Change-Id: Ife6600da240f830aa0080e3f214cedf1389ea512
| Python | apache-2.0 | openstack/oslo.policy | ---
+++
@@ -0,0 +1,66 @@
+# Copyright (c) 2020 OpenStack Foundation.
+# All Rights Reserved.
+
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/... | |
3661ca3947763656165f8fc68ea42358ad37285a | test/unit/helpers/test_qiprofile.py | test/unit/helpers/test_qiprofile.py | import os
import glob
import shutil
from nose.tools import (assert_equal, assert_is_not_none)
import qixnat
from ... import (project, ROOT)
from ...helpers.logging import logger
from qipipe.helpers import qiprofile
COLLECTION = 'Sarcoma'
"""The test collection."""
SUBJECT = 'Sarcoma001'
"""The test subjects."""
SESS... | Add stub for qiprofile update test. | Add stub for qiprofile update test.
| Python | bsd-2-clause | ohsu-qin/qipipe | ---
+++
@@ -0,0 +1,49 @@
+import os
+import glob
+import shutil
+from nose.tools import (assert_equal, assert_is_not_none)
+import qixnat
+from ... import (project, ROOT)
+from ...helpers.logging import logger
+from qipipe.helpers import qiprofile
+
+COLLECTION = 'Sarcoma'
+"""The test collection."""
+
+SUBJECT = 'Sa... | |
36af45d88f01723204d9b65d4081e74a80f0776b | test/layers_test.py | test/layers_test.py | import theanets
import numpy as np
class TestLayer:
def test_build(self):
layer = theanets.layers.build('feedforward', nin=2, nout=4)
assert isinstance(layer, theanets.layers.Layer)
class TestFeedforward:
def test_create(self):
l = theanets.layers.Feedforward(nin=2, nout=4)
a... | Add test for layers module. | Add test for layers module.
| Python | mit | chrinide/theanets,devdoer/theanets,lmjohns3/theanets | ---
+++
@@ -0,0 +1,40 @@
+import theanets
+import numpy as np
+
+
+class TestLayer:
+ def test_build(self):
+ layer = theanets.layers.build('feedforward', nin=2, nout=4)
+ assert isinstance(layer, theanets.layers.Layer)
+
+
+class TestFeedforward:
+ def test_create(self):
+ l = theanets.lay... | |
3dcf251276060b43ac888e0239f26a0cf2531832 | tests/test_proxy_drop_executable.py | tests/test_proxy_drop_executable.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Copyright (c) 2017 Mozilla Corporation
from positive_alert_test_case import PositiveAlertTestCase
from negative_alert_t... | Add tests for proxy drop executable | Add tests for proxy drop executable
| Python | mpl-2.0 | gdestuynder/MozDef,mozilla/MozDef,jeffbryner/MozDef,gdestuynder/MozDef,jeffbryner/MozDef,mozilla/MozDef,jeffbryner/MozDef,Phrozyn/MozDef,Phrozyn/MozDef,gdestuynder/MozDef,mpurzynski/MozDef,Phrozyn/MozDef,gdestuynder/MozDef,jeffbryner/MozDef,mpurzynski/MozDef,mozilla/MozDef,mpurzynski/MozDef,Phrozyn/MozDef,mpurzynski/Mo... | ---
+++
@@ -0,0 +1,70 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+# Copyright (c) 2017 Mozilla Corporation
+from positive_alert_test_case import PositiveAle... | |
379aef7e3aebc05352cacd274b43b156e32de18b | runtests.py | runtests.py | #!/usr/bin/env python
import argparse
import sys
import django
from django.conf import settings
from django.test.utils import get_runner
def runtests(test_labels):
settings.configure(INSTALLED_APPS=['tests'])
django.setup()
TestRunner = get_runner(settings)
test_runner = TestRunner()
failures = t... | Add script to run tests | Add script to run tests
| Python | mit | lamarmeigs/django-clean-fields | ---
+++
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+import argparse
+import sys
+
+import django
+from django.conf import settings
+from django.test.utils import get_runner
+
+
+def runtests(test_labels):
+ settings.configure(INSTALLED_APPS=['tests'])
+ django.setup()
+ TestRunner = get_runner(settings)
+ te... | |
abf39931331f54aff5f10345939420041bd2039d | tests/test_APS2Pattern.py | tests/test_APS2Pattern.py | import h5py
import unittest
import numpy as np
from copy import copy
from QGL import *
from instruments.drivers import APS2Pattern
class APSPatternUtils(unittest.TestCase):
def setUp(self):
self.q1gate = Channels.LogicalMarkerChannel(label='q1-gate')
self.q1 = Qubit(label='q1', gateChan=self.q1gat... | Add test for APS2 instruction merging. | Add test for APS2 instruction merging.
A reduced example of the failing situation from issue #90.
| Python | apache-2.0 | Plourde-Research-Lab/PyQLab,BBN-Q/PyQLab,rmcgurrin/PyQLab,calebjordan/PyQLab | ---
+++
@@ -0,0 +1,51 @@
+import h5py
+import unittest
+import numpy as np
+from copy import copy
+
+from QGL import *
+from instruments.drivers import APS2Pattern
+
+class APSPatternUtils(unittest.TestCase):
+ def setUp(self):
+ self.q1gate = Channels.LogicalMarkerChannel(label='q1-gate')
+ self.q1 ... | |
aeaf2e1a1207f2094ea4298b1ecff015f5996b5a | skimage/filter/tests/test_gabor.py | skimage/filter/tests/test_gabor.py | import numpy as np
from numpy.testing import assert_almost_equal, assert_array_almost_equal
from skimage.filter import gabor_kernel, gabor_filter
def test_gabor_kernel_sum():
for sigmax in range(1, 10, 2):
for sigmay in range(1, 10, 2):
for frequency in range(0, 10, 2):
kernel... | Add test cases for gabor filter | Add test cases for gabor filter
| Python | bsd-3-clause | blink1073/scikit-image,dpshelio/scikit-image,emon10005/scikit-image,ofgulban/scikit-image,Britefury/scikit-image,chriscrosscutler/scikit-image,keflavich/scikit-image,Hiyorimi/scikit-image,keflavich/scikit-image,warmspringwinds/scikit-image,chintak/scikit-image,vighneshbirodkar/scikit-image,ClinicalGraphics/scikit-image... | ---
+++
@@ -0,0 +1,35 @@
+import numpy as np
+from numpy.testing import assert_almost_equal, assert_array_almost_equal
+
+from skimage.filter import gabor_kernel, gabor_filter
+
+
+def test_gabor_kernel_sum():
+ for sigmax in range(1, 10, 2):
+ for sigmay in range(1, 10, 2):
+ for frequency in ra... | |
a70f46aac52be5b38b869cfbe18c0421a0032aee | count_params.py | count_params.py | import sys
import numpy as np
import torch
model = torch.load(sys.argv[1])
params = 0
for key in model:
params += np.multiply.reduce(model[key].shape)
print('Total number of parameters: ' + str(params))
| Add script to count parameters of PyTorch model | Add script to count parameters of PyTorch model
Signed-off-by: Tushar Pankaj <514568343cdd6c4d7c6bb94cf636e24b01176284@gmail.com>
| Python | mit | sauhaardac/training,sauhaardac/training | ---
+++
@@ -0,0 +1,9 @@
+import sys
+import numpy as np
+import torch
+
+model = torch.load(sys.argv[1])
+params = 0
+for key in model:
+ params += np.multiply.reduce(model[key].shape)
+print('Total number of parameters: ' + str(params)) | |
35e76ec99a3710a20b17a5afddaa14389af65098 | tools/import_mediawiki.py | tools/import_mediawiki.py | import os
import os.path
import argparse
from sqlalchemy import create_engine
def main():
parser = argparse.ArgumentParser()
parser.add_argument('url')
parser.add_argument('-o', '--out', default='wikked_import')
parser.add_argument('--prefix', default='wiki')
parser.add_argument('-v', '--verbose',... | Add some simple MediaWiki importer. | tools: Add some simple MediaWiki importer.
| Python | apache-2.0 | ludovicchabant/Wikked,ludovicchabant/Wikked,ludovicchabant/Wikked | ---
+++
@@ -0,0 +1,73 @@
+import os
+import os.path
+import argparse
+from sqlalchemy import create_engine
+
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('url')
+ parser.add_argument('-o', '--out', default='wikked_import')
+ parser.add_argument('--prefix', default='wiki')
+ ... | |
fe6ece236e684d76441280ba700565f7fbce40cc | 14B-088/HI/analysis/pbcov_masking.py | 14B-088/HI/analysis/pbcov_masking.py |
'''
Cut out noisy regions by imposing a mask of the primary beam coverage.
'''
from astropy.io import fits
from spectral_cube import SpectralCube
from spectral_cube.cube_utils import beams_to_bintable
from astropy.utils.console import ProgressBar
import os
from analysis.paths import fourteenB_HI_data_path
# execfil... | Create masked version based on pbcov cutogg | Create masked version based on pbcov cutogg
| Python | mit | e-koch/VLA_Lband,e-koch/VLA_Lband | ---
+++
@@ -0,0 +1,47 @@
+
+'''
+Cut out noisy regions by imposing a mask of the primary beam coverage.
+'''
+
+from astropy.io import fits
+from spectral_cube import SpectralCube
+from spectral_cube.cube_utils import beams_to_bintable
+from astropy.utils.console import ProgressBar
+import os
+
+from analysis.paths i... | |
b3e6855489eba5d59507ef6fb4c92f8284526ec1 | Arrays/check_consecutive_elements.py | Arrays/check_consecutive_elements.py | import unittest
"""
Given an unsorted array of numbers, return true if the array only contains consecutive elements.
Input: 5 2 3 1 4
Ouput: True (consecutive elements from 1 through 5)
Input: 83 78 80 81 79 82
Output: True (consecutive elements from 78 through 83)
Input: 34 23 52 12 3
Output: False
"""
"""
Approach:
... | Check consecutive elements in an array | Check consecutive elements in an array
| Python | mit | prathamtandon/g4gproblems | ---
+++
@@ -0,0 +1,49 @@
+import unittest
+"""
+Given an unsorted array of numbers, return true if the array only contains consecutive elements.
+Input: 5 2 3 1 4
+Ouput: True (consecutive elements from 1 through 5)
+Input: 83 78 80 81 79 82
+Output: True (consecutive elements from 78 through 83)
+Input: 34 23 52 12 ... | |
55b33bff9856cc91943f0a5ae492db1fdc7d8d5a | numba/tests/jitclass_usecases.py | numba/tests/jitclass_usecases.py | """
Usecases with Python 3 syntax in the signatures. This is a separate module
in order to avoid syntax errors with Python 2.
"""
class TestClass1(object):
def __init__(self, x, y, z=1, *, a=5):
self.x = x
self.y = y
self.z = z
self.a = a
class TestClass2(object):
def __init_... | Add missing python 3 only file. | Add missing python 3 only file.
As title.
| Python | bsd-2-clause | cpcloud/numba,stonebig/numba,gmarkall/numba,numba/numba,seibert/numba,seibert/numba,stonebig/numba,cpcloud/numba,stuartarchibald/numba,stuartarchibald/numba,IntelLabs/numba,sklam/numba,IntelLabs/numba,sklam/numba,numba/numba,numba/numba,seibert/numba,jriehl/numba,cpcloud/numba,jriehl/numba,IntelLabs/numba,seibert/numba... | ---
+++
@@ -0,0 +1,21 @@
+"""
+Usecases with Python 3 syntax in the signatures. This is a separate module
+in order to avoid syntax errors with Python 2.
+"""
+
+
+class TestClass1(object):
+ def __init__(self, x, y, z=1, *, a=5):
+ self.x = x
+ self.y = y
+ self.z = z
+ self.a = a
+
+
... | |
e251aff9a232a66b2d24324f394da2ad9345ce79 | scripts/migration/migrate_none_as_email_verification.py | scripts/migration/migrate_none_as_email_verification.py | """ Ensure that users with User.email_verifications == None now have {} instead
"""
import logging
import sys
from tests.base import OsfTestCase
from tests.factories import UserFactory
from modularodm import Q
from nose.tools import *
from website import models
from website.app import init_app
from scripts import util... | Add migration script for changing users with None as email_verifications to {} | Add migration script for changing users with None as email_verifications to {}
| Python | apache-2.0 | rdhyee/osf.io,samanehsan/osf.io,barbour-em/osf.io,saradbowman/osf.io,haoyuchen1992/osf.io,brandonPurvis/osf.io,jolene-esposito/osf.io,emetsger/osf.io,laurenrevere/osf.io,HarryRybacki/osf.io,haoyuchen1992/osf.io,CenterForOpenScience/osf.io,samchrisinger/osf.io,jnayak1/osf.io,caneruguz/osf.io,reinaH/osf.io,binoculars/osf... | ---
+++
@@ -0,0 +1,49 @@
+""" Ensure that users with User.email_verifications == None now have {} instead
+"""
+
+import logging
+import sys
+from tests.base import OsfTestCase
+from tests.factories import UserFactory
+from modularodm import Q
+from nose.tools import *
+from website import models
+from website.app im... | |
4c8ea40eeec6df07cf8721c256ad8cc3d35fb23e | src/test_main.py | src/test_main.py | import pytest
from main import *
test_files = [ "examples/C/filenames/script", "examples/Clojure/index.cljs.hl",
"examples/Chapel/lulesh.chpl", "examples/Forth/core.fth",
"examples/GAP/Magic.gd", "examples/JavaScript/steelseries-min.js",
"examples/Matlab/FTLE_reg.m", ... | Add intial unit test file | Add intial unit test file
Currently just tests the two primary functions, the results are a bit
brittle but that will allow us to detect regressions for future work.
| Python | mit | masterkoppa/whatodo | ---
+++
@@ -0,0 +1,46 @@
+import pytest
+from main import *
+
+test_files = [ "examples/C/filenames/script", "examples/Clojure/index.cljs.hl",
+ "examples/Chapel/lulesh.chpl", "examples/Forth/core.fth",
+ "examples/GAP/Magic.gd", "examples/JavaScript/steelseries-min.js",
+ ... | |
4a179825234b711a729fce5bc9ffc8de029c0999 | utest/controller/test_loading.py | utest/controller/test_loading.py | import unittest
from robot.utils.asserts import assert_true, assert_raises
from robotide.application.chiefcontroller import ChiefController
from robotide.namespace import Namespace
from resources import MINIMAL_SUITE_PATH, RESOURCE_PATH
from robot.errors import DataError
class _FakeObserver(object):
def notify... | import unittest
from robot.utils.asserts import assert_true, assert_raises, assert_raises_with_msg
from robotide.controller import ChiefController
from robotide.namespace import Namespace
from resources import MINIMAL_SUITE_PATH, RESOURCE_PATH, FakeLoadObserver
from robot.errors import DataError
class TestDataLoadi... | Test for invalid data when loading | Test for invalid data when loading
| Python | apache-2.0 | robotframework/RIDE,robotframework/RIDE,HelioGuilherme66/RIDE,HelioGuilherme66/RIDE,caio2k/RIDE,robotframework/RIDE,HelioGuilherme66/RIDE,robotframework/RIDE,HelioGuilherme66/RIDE,fingeronthebutton/RIDE,fingeronthebutton/RIDE,fingeronthebutton/RIDE,caio2k/RIDE,caio2k/RIDE | ---
+++
@@ -1,27 +1,18 @@
import unittest
-from robot.utils.asserts import assert_true, assert_raises
+from robot.utils.asserts import assert_true, assert_raises, assert_raises_with_msg
-from robotide.application.chiefcontroller import ChiefController
+from robotide.controller import ChiefController
from robotide... |
0e6a7a805ff08f191c88bda67992cb874f538c2f | services/migrations/0097_alter_unitconnection_section_type.py | services/migrations/0097_alter_unitconnection_section_type.py | # Generated by Django 4.0.5 on 2022-06-22 05:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("services", "0096_create_syllables_fi_columns"),
]
operations = [
migrations.AlterField(
model_name="unitconnection",
... | Add migration for unitconnection section types | Add migration for unitconnection section types
| Python | agpl-3.0 | City-of-Helsinki/smbackend,City-of-Helsinki/smbackend | ---
+++
@@ -0,0 +1,33 @@
+# Generated by Django 4.0.5 on 2022-06-22 05:40
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("services", "0096_create_syllables_fi_columns"),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ ... | |
5e49eb4fb6bce9cdeae515590530b78e4dde89d9 | doc/examples/plot_match_face_template.py | doc/examples/plot_match_face_template.py | """
=================
Template Matching
=================
In this example, we use template matching to identify the occurrence of an
image patch (in this case, a sub-image centered on the camera man's head).
Since there's only a single match, the maximum value in the `match_template`
result` corresponds to the head lo... | Add alternate example for `match_template`. | Add alternate example for `match_template`.
| Python | bsd-3-clause | emmanuelle/scikits.image,warmspringwinds/scikit-image,bennlich/scikit-image,rjeli/scikit-image,ofgulban/scikit-image,GaZ3ll3/scikit-image,rjeli/scikit-image,ClinicalGraphics/scikit-image,dpshelio/scikit-image,pratapvardhan/scikit-image,michaelpacer/scikit-image,chintak/scikit-image,michaelaye/scikit-image,chintak/sciki... | ---
+++
@@ -0,0 +1,41 @@
+"""
+=================
+Template Matching
+=================
+
+In this example, we use template matching to identify the occurrence of an
+image patch (in this case, a sub-image centered on the camera man's head).
+Since there's only a single match, the maximum value in the `match_template`... | |
edc5116472c49370e5bf3ff7f9f7872732b0285e | phone_numbers.py | phone_numbers.py | #!/usr/bin/env python
import unittest
words = set(["dog", "clog", "cat", "mouse", "rat", "can",
"fig", "dig", "mud", "a", "an", "duh", "sin",
"get", "shit", "done", "all", "glory", "comes",
"from", "daring", "to", "begin", ])
dialmap = {
'a':2, 'b':2, 'c':2,
'd':3, 'e':... | Add a solution to the phone number problem: can a phone number be represented as words in a dictionary? | Add a solution to the phone number problem: can a phone number be represented as words in a dictionary?
| Python | apache-2.0 | aww/cs_practice | ---
+++
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+
+import unittest
+
+words = set(["dog", "clog", "cat", "mouse", "rat", "can",
+ "fig", "dig", "mud", "a", "an", "duh", "sin",
+ "get", "shit", "done", "all", "glory", "comes",
+ "from", "daring", "to", "begin", ])
+
+dialmap = {
+ ... | |
86baa4f437cf3892c15a56e8331c19b6d2e63b1d | lib/gen-names.py | lib/gen-names.py | #!/usr/bin/python3
# Input: https://www.unicode.org/Public/UNIDATA/UnicodeData.txt
import io
import re
class Builder(object):
def __init__(self):
pass
def read(self, infile):
names = []
for line in infile:
if line.startswith('#'):
continue
line... | Add a script for generating unicode name table | lib: Add a script for generating unicode name table
GLib doesn't have a way to get unicode char names, so we'll have to
reimplement this.
| Python | bsd-3-clause | GNOME/gnome-characters,GNOME/gnome-characters,GNOME/gnome-characters,GNOME/gnome-characters,GNOME/gnome-characters | ---
+++
@@ -0,0 +1,56 @@
+#!/usr/bin/python3
+
+# Input: https://www.unicode.org/Public/UNIDATA/UnicodeData.txt
+
+import io
+import re
+
+class Builder(object):
+ def __init__(self):
+ pass
+
+ def read(self, infile):
+ names = []
+ for line in infile:
+ if line.startswith('#'):... | |
3ba109622c24bd52f32e605c523249e1c26b0207 | spacy/tests/regression/test_issue834.py | spacy/tests/regression/test_issue834.py | # coding: utf-8
from io import StringIO
word2vec_str = """, -0.046107 -0.035951 -0.560418
de -0.648927 -0.400976 -0.527124
. 0.113685 0.439990 -0.634510
-1.499184 -0.184280 -0.598371"""
def test_issue834(en_vocab):
f = StringIO(word2vec_str)
vector_length = en_vocab.load_vectors(f)
assert vector_lengt... | Add regression test with non ' ' space character as token | Add regression test with non ' ' space character as token
| Python | mit | banglakit/spaCy,banglakit/spaCy,explosion/spaCy,Gregory-Howard/spaCy,Gregory-Howard/spaCy,raphael0202/spaCy,banglakit/spaCy,banglakit/spaCy,oroszgy/spaCy.hu,explosion/spaCy,recognai/spaCy,explosion/spaCy,oroszgy/spaCy.hu,explosion/spaCy,Gregory-Howard/spaCy,oroszgy/spaCy.hu,explosion/spaCy,banglakit/spaCy,recognai/spaC... | ---
+++
@@ -0,0 +1,14 @@
+# coding: utf-8
+
+from io import StringIO
+
+word2vec_str = """, -0.046107 -0.035951 -0.560418
+de -0.648927 -0.400976 -0.527124
+. 0.113685 0.439990 -0.634510
+ -1.499184 -0.184280 -0.598371"""
+
+
+def test_issue834(en_vocab):
+ f = StringIO(word2vec_str)
+ vector_length = en_vocab... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.