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 |
|---|---|---|---|---|---|---|---|---|---|---|
aee32ebbd0aa13a03d6c69eef8505f922c274af1 | tools/cvs2svn/profile-cvs2svn.py | tools/cvs2svn/profile-cvs2svn.py | #!/usr/bin/env python
#
# Use this script to profile cvs2svn.py using Python's hotshot profiler.
#
# The profile data is stored in cvs2svn.hotshot. To view the data using
# hotshot, run the following in python:
#
# import hotshot.stats
# stats = hotshot.stats.load('cvs2svn.hotshot')
# stats.strip_dirs()... | Add a new script to simplify profiling of cvs2svn.py. Document in the script how to use kcachegrind to view the results. | Add a new script to simplify profiling of cvs2svn.py. Document in the
script how to use kcachegrind to view the results.
* tools/cvs2svn/profile-cvs2svn.py: New script.
| Python | apache-2.0 | jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion | ---
+++
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+#
+# Use this script to profile cvs2svn.py using Python's hotshot profiler.
+#
+# The profile data is stored in cvs2svn.hotshot. To view the data using
+# hotshot, run the following in python:
+#
+# import hotshot.stats
+# stats = hotshot.stats.load('cvs2svn... | |
410b447f54838e4a28b28aa1a027bd058520d9b0 | Python/HARPS-e2ds-to-order.py | Python/HARPS-e2ds-to-order.py | #!/usr/bin/env python
# encoding: utf-8
"""
HARPS-e2ds-to-order.py
Created by Jonathan Whitmore on 2011-10-14.
Copyright (c) 2011. All rights reserved.
"""
import sys
import os
import argparse
import pyfits as pf
import numpy as np
help_message = '''
Takes reduced HARPS***e2ds_A.fits data and reads the header to out... | Order by order of HARPS data | Order by order of HARPS data
| Python | mit | jbwhit/CaliCompari | ---
+++
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+# encoding: utf-8
+"""
+HARPS-e2ds-to-order.py
+
+Created by Jonathan Whitmore on 2011-10-14.
+Copyright (c) 2011. All rights reserved.
+"""
+
+import sys
+import os
+import argparse
+import pyfits as pf
+import numpy as np
+
+help_message = '''
+Takes reduced HARPS***... | |
7881a0561dd74cfb792c06f824fde22e9764ea4c | CodeFights/arrayMaxConsecutiveSum.py | CodeFights/arrayMaxConsecutiveSum.py | #!/usr/local/bin/python
# Code Fights Array Max Consecutive Sum Problem
def arrayMaxConsecutiveSum(inputArray, k):
rolling_sum = sum(inputArray[:k])
max_sum = rolling_sum
i = 0
for j in range(k, len(inputArray)):
rolling_sum = rolling_sum + inputArray[j] - inputArray[i]
max_sum = max(r... | Solve Code Fights array max consecutive sum problem | Solve Code Fights array max consecutive sum problem
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,37 @@
+#!/usr/local/bin/python
+# Code Fights Array Max Consecutive Sum Problem
+
+
+def arrayMaxConsecutiveSum(inputArray, k):
+ rolling_sum = sum(inputArray[:k])
+ max_sum = rolling_sum
+ i = 0
+ for j in range(k, len(inputArray)):
+ rolling_sum = rolling_sum + inputArray[j] - ... | |
a18151a4675ef014680a4e74daba3b19670ab4f1 | src/files_set_utime.py | src/files_set_utime.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Find name patterns in a tree"""
import KmdCmd
import KmdFiles
import os, sys, re, time
import logging
class KmdFindPatterns(KmdCmd.KmdCommand):
def extendParser(self):
super(KmdFindPatterns, self).extendParser()
#Extend parser
self.parser.a... | Set time according to date in filename | Set time according to date in filename
| Python | mit | pzia/keepmydatas | ---
+++
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""Find name patterns in a tree"""
+
+import KmdCmd
+import KmdFiles
+
+import os, sys, re, time
+import logging
+
+class KmdFindPatterns(KmdCmd.KmdCommand):
+ def extendParser(self):
+ super(KmdFindPatterns, self).extendParser()
+ ... | |
b6cafc70f43dbe98991d00f9413c389f908cbb38 | science/physics_python/standalone_modules/pointmass_spring.py | science/physics_python/standalone_modules/pointmass_spring.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)
import numpy as np
class State:
def __init__(self, ndim):
self.ndim = ndim
self.position = np.zeros(self.ndim)
self.velocity = np.zeros(self.ndim)
class Model:
def __init__(sel... | Add a snippet (Python physics). | Add a snippet (Python physics).
| Python | mit | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | ---
+++
@@ -0,0 +1,75 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)
+
+import numpy as np
+
+
+class State:
+ def __init__(self, ndim):
+ self.ndim = ndim
+ self.position = np.zeros(self.ndim)
+ self.velocity = np.zeros(self.nd... | |
abd97f71e54515c057e94f7d21aa953faba3f5fc | taskflow/examples/delayed_return.py | taskflow/examples/delayed_return.py | # -*- coding: utf-8 -*-
# Copyright (C) 2014 Yahoo! Inc. 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... | Add a example that activates a future when a result is ready | Add a example that activates a future when a result is ready
To allow for an engine to continue to run while at the same time
returning from a function when a component of that engine finishes
a pattern can be used that ties and engines listeners to the function
return, allowing for both to be used simulatenously.
Ch... | Python | apache-2.0 | openstack/taskflow,junneyang/taskflow,openstack/taskflow,jimbobhickville/taskflow,pombredanne/taskflow-1,junneyang/taskflow,pombredanne/taskflow-1,jimbobhickville/taskflow | ---
+++
@@ -0,0 +1,90 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2014 Yahoo! Inc. 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... | |
8cf2a16ff98cc831734c82116c4a91ddb1094865 | tests/integration/modules/cmdmod.py | tests/integration/modules/cmdmod.py | # Import python libs
import os
# Import salt libs
import integration
class CMDModuleTest(integration.ModuleCase):
'''
Validate the cmd module
'''
def test_run(self):
'''
cmd.run
'''
self.assertTrue(self.run_function('cmd.run', ['echo $SHELL']))
self.assertEqual(... | Add tests for the cmd module | Add tests for the cmd module
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,90 @@
+# Import python libs
+import os
+
+# Import salt libs
+import integration
+
+class CMDModuleTest(integration.ModuleCase):
+ '''
+ Validate the cmd module
+ '''
+ def test_run(self):
+ '''
+ cmd.run
+ '''
+ self.assertTrue(self.run_function('cmd.run', [... | |
04e6770c489734b72d6f14dee7f3e7ac30517456 | graph/graph_search.py | graph/graph_search.py | # -*- coding:utf-8 -*-
from collections import deque
from graph import Undigraph
def bfs(graph, s, t):
if s == t:
return
queue = deque()
pre = [ -1 ] * len(graph)
visited = [False] * len(graph)
visited[s] = True
queue.append(s)
while len(queue) > 0:
vertex = queue.poplef... | Implement the broad first search of the undirected graph | Implement the broad first search of the undirected graph
| Python | apache-2.0 | free-free/algorithm,free-free/algorithm | ---
+++
@@ -0,0 +1,49 @@
+# -*- coding:utf-8 -*-
+
+
+from collections import deque
+from graph import Undigraph
+
+
+def bfs(graph, s, t):
+ if s == t:
+ return
+ queue = deque()
+ pre = [ -1 ] * len(graph)
+ visited = [False] * len(graph)
+ visited[s] = True
+ queue.append(s)
+ while le... | |
f86cdb5391aef61d9aa81e28a7777d394b37410a | Regression/PolynomialRegression/regularPolynomialRegression.py | Regression/PolynomialRegression/regularPolynomialRegression.py | # -*- coding: utf-8 -*-
"""Polynomial regression for machine learning.
polynomial regression is a form of regression analysis in which the
relationship between the independent variable x and the dependent variable y is
modelled as an nth degree polynomial in x. Polynomial regression fits a
nonlinear relationship betwe... | Add Polynomial regression Python file | Add Polynomial regression Python file
| Python | mit | a-holm/MachinelearningAlgorithms,a-holm/MachinelearningAlgorithms | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+"""Polynomial regression for machine learning.
+
+polynomial regression is a form of regression analysis in which the
+relationship between the independent variable x and the dependent variable y is
+modelled as an nth degree polynomial in x. Polynomial regression fi... | |
3638aa4949d7f0f2b79fed0e829e56777c0eb9c0 | gooey/tests/test_language_parity.py | gooey/tests/test_language_parity.py | import os
import unittest
import json
from collections import OrderedDict
from gooey import languages
from gooey.gui.processor import ProcessController
class TestLanguageParity(unittest.TestCase):
"""
Checks that all language files have the same set of keys so that non-english
languages don't... | Add regression test for language files | Add regression test for language files
| Python | mit | partrita/Gooey,chriskiehl/Gooey,codingsnippets/Gooey | ---
+++
@@ -0,0 +1,41 @@
+import os
+import unittest
+import json
+from collections import OrderedDict
+from gooey import languages
+
+from gooey.gui.processor import ProcessController
+
+
+class TestLanguageParity(unittest.TestCase):
+ """
+ Checks that all language files have the same set of keys so that non-... | |
f4715ec87f03cda417a33a5fba901229f6687ce2 | gdb/vectorwrapper.py | gdb/vectorwrapper.py | #
# Copyright 2015-2017 Michele "King_DuckZ" Santullo
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | Add a sample gdb pretty printer for Vec<std::array> types | Add a sample gdb pretty printer for Vec<std::array> types
| Python | apache-2.0 | KingDuckZ/vectorwrapper,KingDuckZ/vectorwrapper,KingDuckZ/vectorwrapper,KingDuckZ/vectorwrapper | ---
+++
@@ -0,0 +1,72 @@
+ #
+ # Copyright 2015-2017 Michele "King_DuckZ" Santullo
+ #
+ # 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... | |
e407b99d0d1f89bab3d90fa519631b0088735f4e | InvenTree/part/test_migrations.py | InvenTree/part/test_migrations.py | """
Unit tests for the part model database migrations
"""
from django_test_migrations.contrib.unittest_case import MigratorTestCase
from InvenTree import helpers
class TestForwardMigrations(MigratorTestCase):
"""
Test entire schema migration sequence for the part app
"""
migrate_from = ('part', hel... | Add initial migration unit test for the 'part' app | Add initial migration unit test for the 'part' app
| Python | mit | inventree/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,SchrodingersGat/InvenTree | ---
+++
@@ -0,0 +1,52 @@
+"""
+Unit tests for the part model database migrations
+"""
+
+from django_test_migrations.contrib.unittest_case import MigratorTestCase
+
+from InvenTree import helpers
+
+
+class TestForwardMigrations(MigratorTestCase):
+ """
+ Test entire schema migration sequence for the part app
+... | |
9638f0e932f6efb65b8a1dd8dc965cdffd99cc39 | kdvadmin/migrations/0001_initial.py | kdvadmin/migrations/0001_initial.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-10-18 21:24
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Cre... | Add missing migration for kdvadmin | Add missing migration for kdvadmin
| Python | agpl-3.0 | d120/kifplan,d120/kifplan,d120/kifplan | ---
+++
@@ -0,0 +1,63 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.16 on 2018-10-18 21:24
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+... | |
70fb8e9055e106e66f330e3c70b85c977dce53d8 | salt/utils/dicttrim.py | salt/utils/dicttrim.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
import sys
import salt.payload
def trim_dict(
data,
max_dict_bytes,
percent=50.0,
stepper_size=10,
replace_with='VALUE_TRIMMED',
is_msgpacked=False):
'''
Takes... | Add the needed file :] | Add the needed file :]
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,79 @@
+# -*- coding: utf-8 -*-
+from __future__ import absolute_import
+from __future__ import print_function
+
+import sys
+
+import salt.payload
+
+
+def trim_dict(
+ data,
+ max_dict_bytes,
+ percent=50.0,
+ stepper_size=10,
+ replace_with='VALUE_TRIMMED',
+ ... | |
b371f277de0f4df99663b8b9e49f187f54012c79 | development/build_log_simplifier.py | development/build_log_simplifier.py | #!/usr/bin/python3
#
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | Add a script for simplifying build.log files | Add a script for simplifying build.log files
Change-Id: Icfc409816b7f7cd028c3022e7073741f60ff30b6
Test: run the script
Bug: b/155305020
| Python | apache-2.0 | androidx/androidx,androidx/androidx,androidx/androidx,AndroidX/androidx,androidx/androidx,AndroidX/androidx,androidx/androidx,AndroidX/androidx,androidx/androidx,androidx/androidx,AndroidX/androidx,androidx/androidx,AndroidX/androidx,AndroidX/androidx,androidx/androidx,AndroidX/androidx,AndroidX/androidx,AndroidX/andro... | ---
+++
@@ -0,0 +1,62 @@
+#!/usr/bin/python3
+#
+# Copyright (C) 2016 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/li... | |
0e3cecfb94417b7a29765880732684c325ae2406 | test/test_synthesis.py | test/test_synthesis.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2016:
# Matthieu Estrada, ttamalfor@gmail.com
#
# This file is part of (AlignakApp).
#
# (AlignakApp) 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 Sof... | Add Unit Tests for Synthesis | Add Unit Tests for Synthesis
Ref #127 synthesis.py
| Python | agpl-3.0 | Alignak-monitoring-contrib/alignak-app,Alignak-monitoring-contrib/alignak-app | ---
+++
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2015-2016:
+# Matthieu Estrada, ttamalfor@gmail.com
+#
+# This file is part of (AlignakApp).
+#
+# (AlignakApp) is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public L... | |
ff61b83fa07a944eb5f82d560643d6e8aed4c172 | saulify/sitespec.py | saulify/sitespec.py | """ Reading and representation of Instapaper spec files. """
import sys
from saulify.clean import clean_content
class TestCase(object):
"""
Test case for the article scraper.
Attributes:
url (str): URL of the page being tested
fragments (list of str): Fragments of text that should be presen... | Add module handling Instapaper config files | Add module handling Instapaper config files
| Python | agpl-3.0 | asm-products/saulify-web,asm-products/saulify-web,asm-products/saulify-web | ---
+++
@@ -0,0 +1,87 @@
+""" Reading and representation of Instapaper spec files. """
+
+import sys
+
+from saulify.clean import clean_content
+
+
+class TestCase(object):
+ """
+ Test case for the article scraper.
+
+ Attributes:
+ url (str): URL of the page being tested
+ fragments (list of str)... | |
8046d67046a0be334b87e0ad54d78b6cfce83aad | main/test_race.py | main/test_race.py | import multiprocessing
import pprint
from ppm import Trie
trie = None
def test(a):
x, trie = a
trie.add('b')
trie.add('b')
print(x, trie.bit_encoding)
return trie.bit_encoding
if __name__ == '__main__':
trie = Trie(5)
trie.add('a')
alist = [ (x, trie) for x in range(0, multiprocessing... | Add a race condition tester | Add a race condition tester
| Python | mit | worldwise001/stylometry | ---
+++
@@ -0,0 +1,20 @@
+import multiprocessing
+import pprint
+from ppm import Trie
+
+trie = None
+
+def test(a):
+ x, trie = a
+ trie.add('b')
+ trie.add('b')
+ print(x, trie.bit_encoding)
+ return trie.bit_encoding
+
+if __name__ == '__main__':
+ trie = Trie(5)
+ trie.add('a')
+ alist = [... | |
ad14c2da6b7fdaf8744b48c6e714acc18c8c073c | render_random_particle.py | render_random_particle.py | import pygame
import random
pygame.init()
#-- SCREEN CHARACTERISTICS ------------------------->>>
background_color = (255,255,255)
(width, height) = (300, 200)
class Particle:
def __init__(self, (x, y), radius):
self.x = x
self.y = y
self.radius = radius
self.color = (255, 0, 0)
... | Add module that renders particles on screen with random position | Add module that renders particles on screen with random position
| Python | mit | withtwoemms/pygame-explorations | ---
+++
@@ -0,0 +1,44 @@
+import pygame
+import random
+
+
+pygame.init()
+
+#-- SCREEN CHARACTERISTICS ------------------------->>>
+background_color = (255,255,255)
+(width, height) = (300, 200)
+
+class Particle:
+ def __init__(self, (x, y), radius):
+ self.x = x
+ self.y = y
+ self.radius ... | |
ba49f8608bfe0130ea3b971e2844d6ad43b6e2ba | trypython/stdlib/sys_/sys_getsizeof_vs_dunder_sizeof_diff.py | trypython/stdlib/sys_/sys_getsizeof_vs_dunder_sizeof_diff.py | """
sys.getsizeof() と __sizeof__() で 返される値が異なる時があるのを確認するサンプル
REFERENCES:: http://bit.ly/2GTVkbs
"""
import sys
from trypython.common.commoncls import SampleBase
class Sample(SampleBase):
def exec(self):
# sys.getsizeof() は GC フィールドの分を加算するので
# __sizeof__() が返す値と異なるときがある
list_data = [10, 2... | Add sys.getsizeof() vs ```__sizeof__()``` difference example | Add sys.getsizeof() vs ```__sizeof__()``` difference example
| Python | mit | devlights/try-python | ---
+++
@@ -0,0 +1,41 @@
+"""
+sys.getsizeof() と __sizeof__() で 返される値が異なる時があるのを確認するサンプル
+
+REFERENCES:: http://bit.ly/2GTVkbs
+"""
+import sys
+
+from trypython.common.commoncls import SampleBase
+
+
+class Sample(SampleBase):
+ def exec(self):
+ # sys.getsizeof() は GC フィールドの分を加算するので
+ # __sizeof__()... | |
43f4c62d45d41b9dae5582e2d7f10b187731f2b7 | utils/test/__init__.py | utils/test/__init__.py | import os
import unittest
from google.appengine.ext import testbed
from google.appengine.datastore import datastore_stub_util
import settings
HRD_CONSISTENCY = 1
class DatastoreTestCase(unittest.TestCase):
"""Test case with stubbed high-replication datastore API. The datastore
stub uses an optimistic, alw... | Add datastore and memcache stub test cases | Add datastore and memcache stub test cases
| Python | apache-2.0 | tylertreat/gaeutils | ---
+++
@@ -0,0 +1,90 @@
+import os
+import unittest
+
+from google.appengine.ext import testbed
+from google.appengine.datastore import datastore_stub_util
+
+import settings
+
+
+HRD_CONSISTENCY = 1
+
+
+class DatastoreTestCase(unittest.TestCase):
+ """Test case with stubbed high-replication datastore API. The d... | |
3fb964bd49ab5855b60ecbf8981fe0bceffb108b | slr1/wsgi_websocket.py | slr1/wsgi_websocket.py | import os
import gevent.socket
import redis.connection
redis.connection.socket = gevent.socket
os.environ.update(DJANGO_SETTINGS_MODULE='settings.base')
from ws4redis.uwsgi_runserver import uWSGIWebsocketServer
application = uWSGIWebsocketServer()
| Introduce wsgi app for websockets | Introduce wsgi app for websockets
| Python | bsd-3-clause | stefantsov/blackbox3,stefantsov/blackbox3,stefantsov/blackbox3 | ---
+++
@@ -0,0 +1,7 @@
+import os
+import gevent.socket
+import redis.connection
+redis.connection.socket = gevent.socket
+os.environ.update(DJANGO_SETTINGS_MODULE='settings.base')
+from ws4redis.uwsgi_runserver import uWSGIWebsocketServer
+application = uWSGIWebsocketServer() | |
4cbe57c803de833d912cf2f325e9e710eb17aa10 | contrib/os_export/archive_sources.py | contrib/os_export/archive_sources.py | import requests
import json
import sys
import os
def grab_source(url, output):
"""
Grab a source from a url and store it in an output file
This creates uses requests as a dependency because I'm lazy.
It probably would have taken me less time to just write it with
urllib than writing this docstrin... | Add source archiving to OpenSpending export (separate script) | Add source archiving to OpenSpending export (separate script)
This is a separate script because the export scripts is run on a
production server (or a server with access to the database) and we
don't want the production server to also do the archiving, we can
do that on some poor local machine.
| Python | agpl-3.0 | pudo/spendb,johnjohndoe/spendb,openspending/spendb,pudo/spendb,spendb/spendb,CivicVision/datahub,spendb/spendb,CivicVision/datahub,pudo/spendb,openspending/spendb,johnjohndoe/spendb,spendb/spendb,openspending/spendb,johnjohndoe/spendb,CivicVision/datahub | ---
+++
@@ -0,0 +1,70 @@
+import requests
+import json
+import sys
+import os
+
+
+def grab_source(url, output):
+ """
+ Grab a source from a url and store it in an output file
+
+ This creates uses requests as a dependency because I'm lazy.
+ It probably would have taken me less time to just write it wit... | |
5594a131574e410d750fbc20d40c0b13c67671e9 | pinax/app_name/apps.py | pinax/app_name/apps.py | import importlib
from django.apps import AppConfig as BaseAppConfig
from django.utils.translation import ugettext_lazy as _
class AppConfig(BaseAppConfig):
name = "pinax.{{ app_name }}"
label = "pinax_{{ app_name }}"
verbose_name = _("Pinax {{ app_name|title }}")
| Add AppConfig to namespace tables with label | Add AppConfig to namespace tables with label | Python | mit | pinax/pinax-starter-app | ---
+++
@@ -0,0 +1,11 @@
+import importlib
+
+from django.apps import AppConfig as BaseAppConfig
+from django.utils.translation import ugettext_lazy as _
+
+
+class AppConfig(BaseAppConfig):
+
+ name = "pinax.{{ app_name }}"
+ label = "pinax_{{ app_name }}"
+ verbose_name = _("Pinax {{ app_name|title }}") | |
57d207ff7facac0d3970f96f5ac91bbb6e7ec7f8 | indra/tools/hypothesis_annotator.py | indra/tools/hypothesis_annotator.py | import logging
from indra.sources import indra_db_rest
from indra.pipeline import AssemblyPipeline
from indra.sources.hypothesis import upload_statement_annotation
ref_priority = ['TRID', 'PMCID', 'PMID']
logger = logging.getLogger(__name__)
def annotate_paper(text_refs, pipeline=None):
"""Upload INDRA Statemen... | Add tool for annotating a given paper | Add tool for annotating a given paper
| Python | bsd-2-clause | bgyori/indra,bgyori/indra,bgyori/indra,johnbachman/indra,johnbachman/indra,sorgerlab/indra,sorgerlab/belpy,sorgerlab/indra,sorgerlab/belpy,sorgerlab/belpy,sorgerlab/indra,johnbachman/indra | ---
+++
@@ -0,0 +1,43 @@
+import logging
+from indra.sources import indra_db_rest
+from indra.pipeline import AssemblyPipeline
+from indra.sources.hypothesis import upload_statement_annotation
+
+ref_priority = ['TRID', 'PMCID', 'PMID']
+
+logger = logging.getLogger(__name__)
+
+
+def annotate_paper(text_refs, pipeli... | |
aec2ff67b3dbf2fa7770fc62b08659b51e6ed41e | tests/test_membrane.py | tests/test_membrane.py | from membrane import Membrane, Proxy
from rt import Wait
def test_membrane():
m1 = Membrane.create()
m1.transport = {'protocol': 'null',
'membrane': m1}
m2 = Membrane.create()
m2.transport = {'protocol': 'null',
'membrane': m1}
m1 << 'start'
m2 << 'start'... | Add test for membrane behavior | Add test for membrane behavior | Python | mit | waltermoreira/tartpy | ---
+++
@@ -0,0 +1,44 @@
+from membrane import Membrane, Proxy
+from rt import Wait
+
+def test_membrane():
+ m1 = Membrane.create()
+ m1.transport = {'protocol': 'null',
+ 'membrane': m1}
+ m2 = Membrane.create()
+ m2.transport = {'protocol': 'null',
+ 'membrane': m1... | |
af27946ce53405afa044de872d931c0b92a2af9b | providers/popularity/thepiratebay.py | providers/popularity/thepiratebay.py | from providers.popularity.provider import PopularityProvider
from utils.torrent_util import torrent_to_movie, remove_bad_torrent_matches
from urllib import quote
IDENTIFIER = "thepiratebay"
class Provider(PopularityProvider):
PAGES_TO_FETCH = 3
def get_popular(self):
names = []
query = quote(... | Add support for The Pirate Bay as popularity provider. | Add support for The Pirate Bay as popularity provider.
| Python | mit | EmilStenstrom/nephele | ---
+++
@@ -0,0 +1,20 @@
+from providers.popularity.provider import PopularityProvider
+from utils.torrent_util import torrent_to_movie, remove_bad_torrent_matches
+from urllib import quote
+
+IDENTIFIER = "thepiratebay"
+
+class Provider(PopularityProvider):
+ PAGES_TO_FETCH = 3
+
+ def get_popular(self):
+ ... | |
88fc811658b002d0ef6f0cce070df9e8ef85e739 | tweetyr.py | tweetyr.py | #!/usr/bin/env python
# -*- coding: UTF-8
'''
A simple twitter client that posts current weather to twitter
'''
import tweepy
import json
from urllib2 import urlopen
import os
root =os.path.dirname(os.path.abspath(__file__))
conf = json.loads(file(root+'/twitterconfig.json').read())
auth = tweepy.OAuthHandler(conf['... | Add a simple tweeting weather bot | Add a simple tweeting weather bot
| Python | bsd-3-clause | torhve/Amatyr,torhve/Amatyr,torhve/Amatyr | ---
+++
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8
+'''
+A simple twitter client that posts current weather to twitter
+'''
+import tweepy
+import json
+from urllib2 import urlopen
+import os
+
+root =os.path.dirname(os.path.abspath(__file__))
+
+conf = json.loads(file(root+'/twitterconfig.json').re... | |
b08e60e57484810fc2fb695e5a8fc6aef7b8ea77 | sst/create_filelist.py | sst/create_filelist.py | #!/usr/bin/env python
"""Create filelists to use for training and testing."""
import os
import json
from sklearn.cross_validation import train_test_split
path_data = os.path.join(os.environ['DATA_PATH'],
'data_road/roadC621/',
"image_2/")
files_data = [os.path.join(... | Add utility function to create file list | Add utility function to create file list
| Python | mit | MartinThoma/sst,MartinThoma/sst | ---
+++
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+
+"""Create filelists to use for training and testing."""
+
+import os
+import json
+from sklearn.cross_validation import train_test_split
+
+
+path_data = os.path.join(os.environ['DATA_PATH'],
+ 'data_road/roadC621/',
+ ... | |
f2ce38fd51706848814dc9a2f420776bcf8ebd3f | pwnedcheck/__init__.py | pwnedcheck/__init__.py | __author__ = 'Casey Dunham'
__version__ = "0.1.0"
import urllib
import urllib2
import json
PWNED_API_URL = "https://haveibeenpwned.com/api/breachedaccount/%s"
class InvalidEmail(Exception):
pass
def check(email):
req = urllib.Request(PWNED_API_URL % urllib.quote(email))
try:
resp = urllib.ur... | Check single email against api | Check single email against api
| Python | mit | caseydunham/PwnedCheck | ---
+++
@@ -0,0 +1,26 @@
+__author__ = 'Casey Dunham'
+__version__ = "0.1.0"
+
+
+import urllib
+import urllib2
+import json
+
+
+PWNED_API_URL = "https://haveibeenpwned.com/api/breachedaccount/%s"
+
+
+class InvalidEmail(Exception):
+ pass
+
+
+def check(email):
+ req = urllib.Request(PWNED_API_URL % urllib.qu... | |
33a0e85ef52bd13a407f17aaacb37d4081343c0e | data/3_2_make_json_for_each_pheno.py | data/3_2_make_json_for_each_pheno.py | #!/usr/bin/env python2
from __future__ import print_function, division, absolute_import
import gzip
import glob
import heapq
import re
import os.path
import json
def parse_marker_id(marker_id):
chr1, pos1, ref, alt, chr2, pos2 = re.match(r'([^:]+):([0-9]+)_([-ATCG]+)/([-ATCG]+)_([^:]+):([0-9]+)', marker_id).grou... | Make GWAS json for each pheno | Make GWAS json for each pheno
| Python | agpl-3.0 | statgen/pheweb,statgen/pheweb,statgen/pheweb,statgen/pheweb,statgen/pheweb | ---
+++
@@ -0,0 +1,48 @@
+#!/usr/bin/env python2
+
+from __future__ import print_function, division, absolute_import
+
+import gzip
+import glob
+import heapq
+import re
+import os.path
+import json
+
+def parse_marker_id(marker_id):
+ chr1, pos1, ref, alt, chr2, pos2 = re.match(r'([^:]+):([0-9]+)_([-ATCG]+)/([-AT... | |
5f2e986a9dbc8cf82e55fd711dbe9931b4b3edc4 | link_in_global_module.py | link_in_global_module.py | # Link in a module in the global Python site-packages the virtualenv that we are currently in
# Author: Luke Macken <lmacken@redhat.com>
import os
import sys
from glob import glob
from distutils.sysconfig import get_python_lib
def symlink_global_module_into_virtualenv(modulename, env):
for path in (get_python_li... | Add a tool for linking in global python modules into our virtualenv | Add a tool for linking in global python modules into our virtualenv
| Python | agpl-3.0 | Fale/fedora-packages,fedora-infra/fedora-packages,Fale/fedora-packages,fedora-infra/fedora-packages,fedora-infra/fedora-packages,Fale/fedora-packages,fedora-infra/fedora-packages | ---
+++
@@ -0,0 +1,32 @@
+# Link in a module in the global Python site-packages the virtualenv that we are currently in
+# Author: Luke Macken <lmacken@redhat.com>
+
+import os
+import sys
+
+from glob import glob
+from distutils.sysconfig import get_python_lib
+
+def symlink_global_module_into_virtualenv(modulename,... | |
9daceaf8cad088a1507af7ce1503f15bc619695d | panoptes/panoptes.py | panoptes/panoptes.py | #!/usr/bin/env python
import ephem
import panoptes.utils.logger as logger
import panoptes.observatory as observatory
class Panoptes:
"""
Sets up logger, reads config file and starts up application.
"""
def __init__(self):
# Setup utils
self.logger = logger.Logger()
self.logge... | Simplify Panoptes class so that site belongs to observatory. We need to read in a config here. | Simplify Panoptes class so that site belongs to observatory. We need to read in a config here.
| Python | mit | Guokr1991/POCS,panoptes/POCS,joshwalawender/POCS,panoptes/POCS,joshwalawender/POCS,fmin2958/POCS,Guokr1991/POCS,fmin2958/POCS,joshwalawender/POCS,AstroHuntsman/POCS,Guokr1991/POCS,AstroHuntsman/POCS,panoptes/POCS,panoptes/POCS,fmin2958/POCS,Guokr1991/POCS,AstroHuntsman/POCS,AstroHuntsman/POCS | ---
+++
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+
+import ephem
+
+import panoptes.utils.logger as logger
+import panoptes.observatory as observatory
+
+class Panoptes:
+ """
+ Sets up logger, reads config file and starts up application.
+ """
+ def __init__(self):
+ # Setup utils
+ self.log... | |
1f7bb3ae05ef00a78a579553ac2f1954ae32b991 | payment_ogone_compassion/migrations/11.0.1.0.0/post-migration.py | payment_ogone_compassion/migrations/11.0.1.0.0/post-migration.py | from openupgradelib import openupgrade
@openupgrade.migrate()
def migrate(env, version):
if not version:
return
# Update payment_acquirers
env.cr.execute("""
select id from ir_ui_view where name = 'ogone_acquirer_button'
""")
old_view_id = env.cr.fetchone()[0]
new_view_id = en... | Add migrations for payment acquirers | Add migrations for payment acquirers
| Python | agpl-3.0 | CompassionCH/compassion-switzerland,eicher31/compassion-switzerland,CompassionCH/compassion-switzerland,eicher31/compassion-switzerland,eicher31/compassion-switzerland,CompassionCH/compassion-switzerland | ---
+++
@@ -0,0 +1,17 @@
+from openupgradelib import openupgrade
+
+
+@openupgrade.migrate()
+def migrate(env, version):
+ if not version:
+ return
+
+ # Update payment_acquirers
+ env.cr.execute("""
+ select id from ir_ui_view where name = 'ogone_acquirer_button'
+ """)
+ old_view_id = e... | |
7e4dd4bc4cfdea5f1e2872b3348b760473a3b2ab | Problems/uniqueChars.py | Problems/uniqueChars.py | #!/Applications/anaconda/envs/Python3/bin
def main():
# Test suite
strings = [None, '', 'Young Frankenstein', 'Yodeling cat']
results = [False, True, False, True]
for i, s in enumerate(strings):
if has_unique_chars(s) == results[i]:
print('PASSED test case: {} returned {}'.format(s... | Add unique characters algorithm and tests | Add unique characters algorithm and tests
| Python | mit | HKuz/Test_Code | ---
+++
@@ -0,0 +1,35 @@
+#!/Applications/anaconda/envs/Python3/bin
+
+
+def main():
+ # Test suite
+ strings = [None, '', 'Young Frankenstein', 'Yodeling cat']
+ results = [False, True, False, True]
+ for i, s in enumerate(strings):
+ if has_unique_chars(s) == results[i]:
+ print('PASSE... | |
0994f60728a19a14628ca2e4544693d1ea918126 | examples/li_to_hdf5.py | examples/li_to_hdf5.py | #!/usr/bin/env python
import sys
from datetime import datetime
import pymoku.dataparser
import h5py
if len(sys.argv) != 3:
print "Usage: li_to_csv.py infile.li outfile.hd5"
exit(1)
reader = pymoku.dataparser.LIDataFileReader(sys.argv[1])
writer = h5py.File(sys.argv[2], 'w')
ncols = reader.nch
set_name = 'moku:da... | Add HDF5 data file writer to examples | HD5: Add HDF5 data file writer to examples
| Python | mit | benizl/pymoku,liquidinstruments/pymoku | ---
+++
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+
+import sys
+from datetime import datetime
+
+import pymoku.dataparser
+import h5py
+
+if len(sys.argv) != 3:
+ print "Usage: li_to_csv.py infile.li outfile.hd5"
+ exit(1)
+
+reader = pymoku.dataparser.LIDataFileReader(sys.argv[1])
+writer = h5py.File(sys.argv[2], 'w'... | |
9858c56188f4d6c81daf6535e7cd58ff23e20712 | application/senic/nuimo_hub/tests/test_setup_wifi.py | application/senic/nuimo_hub/tests/test_setup_wifi.py | import pytest
from mock import patch
@pytest.fixture
def url(route_url):
return route_url('wifi_setup')
def test_get_scanned_wifi(browser, url):
assert browser.get_json(url).json == ['grandpausethisnetwork']
@pytest.fixture
def no_such_wifi(settings):
settings['wifi_networks_path'] = '/no/such/file'
... | import pytest
from mock import patch
@pytest.fixture
def setup_url(route_url):
return route_url('wifi_setup')
def test_get_scanned_wifi(browser, setup_url):
assert browser.get_json(setup_url).json == ['grandpausethisnetwork']
@pytest.fixture
def no_such_wifi(settings):
settings['wifi_networks_path'] =... | Make `url` fixture less generic | Make `url` fixture less generic
in preparation for additional endpoints
| Python | mit | grunskis/nuimo-hub-backend,grunskis/nuimo-hub-backend,getsenic/senic-hub,grunskis/senic-hub,grunskis/senic-hub,grunskis/nuimo-hub-backend,grunskis/senic-hub,grunskis/senic-hub,getsenic/senic-hub,grunskis/senic-hub,grunskis/nuimo-hub-backend,grunskis/senic-hub,grunskis/nuimo-hub-backend | ---
+++
@@ -3,12 +3,12 @@
@pytest.fixture
-def url(route_url):
+def setup_url(route_url):
return route_url('wifi_setup')
-def test_get_scanned_wifi(browser, url):
- assert browser.get_json(url).json == ['grandpausethisnetwork']
+def test_get_scanned_wifi(browser, setup_url):
+ assert browser.get_j... |
ca53296d4f7af651905657d533ac18517531ca32 | pybloom/slidingwindow.py | pybloom/slidingwindow.py | import time
from collections import deque
from pybloom import ScalableBloomFilter
class DecayScalableBloomFilter(ScalableBloomFilter):
'''
Stepwise decaying Bloom Filter
'''
def __init__(self, initial_capacity=1000, error_rate=0.01, window_period = 60):
super(DecayScalableBloomFilter, self)._... | Add simple SlidingWindowScalableBloomFilter for combating overengineer habit | Add simple SlidingWindowScalableBloomFilter for combating overengineer habit
| Python | mit | Parsely/python-bloomfilter | ---
+++
@@ -0,0 +1,83 @@
+import time
+
+from collections import deque
+from pybloom import ScalableBloomFilter
+
+
+class DecayScalableBloomFilter(ScalableBloomFilter):
+ '''
+ Stepwise decaying Bloom Filter
+ '''
+ def __init__(self, initial_capacity=1000, error_rate=0.01, window_period = 60):
+ ... | |
e7e30eaebf3075df3c965d700352506f52be10ef | test.py | test.py | import usb.core
import usb.util
import binascii,time
reset=[binascii.unhexlify('06cb150010000000')]
rainb=[binascii.unhexlify('06cd080800000000')]
color=[binascii.unhexlify('06cd080100000000'), #red
binascii.unhexlify('06cd080200000000'),#yellow
binascii.unhexlify('06cd080300000000'),#green
... | Test file that "programs" the mouse.It switches between colors and can reset the programming | Test file that "programs" the mouse.It switches between colors and can reset the programming
| Python | mit | BlackLotus/mx1200py | ---
+++
@@ -0,0 +1,39 @@
+import usb.core
+import usb.util
+import binascii,time
+
+reset=[binascii.unhexlify('06cb150010000000')]
+rainb=[binascii.unhexlify('06cd080800000000')]
+color=[binascii.unhexlify('06cd080100000000'), #red
+ binascii.unhexlify('06cd080200000000'),#yellow
+ binascii.unhe... | |
8d0443e7423a480c7001d0f9b59af4dc903166b3 | nodeconductor/cost_tracking/migrations/0023_consumptiondetails.py | nodeconductor/cost_tracking/migrations/0023_consumptiondetails.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
import jsonfield.fields
import model_utils.fields
import uuidfield.fields
class Migration(migrations.Migration):
dependencies = [
('cost_tracking', '0022_priceestimate_le... | Add DB migration for ConsumptionDetails | Add DB migration for ConsumptionDetails
- nc-1521
| Python | mit | opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor | ---
+++
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.utils.timezone
+import jsonfield.fields
+import model_utils.fields
+import uuidfield.fields
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ... | |
75a9315ac2bffdc4b9f22d1ea6184a369e4ddec3 | project/scripts/get_context_data.py | project/scripts/get_context_data.py | # Copyright 2021 Google 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | Add script for fetching context data on a new investment | Add script for fetching context data on a new investment
| Python | apache-2.0 | googleinterns/sgonks,googleinterns/sgonks,googleinterns/sgonks,googleinterns/sgonks | ---
+++
@@ -0,0 +1,38 @@
+# Copyright 2021 Google 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
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by appl... | |
66c5285cc0b5d9e29dcd511114060ffc9f17fdb1 | volunteering/migrations/0005_volunteeradded.py | volunteering/migrations/0005_volunteeradded.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('volunteering', '0004_auto_20150415_2058'),
]
operations = [
migrations.CreateModel(
name='VolunteerAdded',
... | Migrate for proxy model (should be noop) | Migrate for proxy model (should be noop)
| Python | agpl-3.0 | jesseh/dothis,jesseh/dothis,jesseh/dothis,jesseh/dothis | ---
+++
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('volunteering', '0004_auto_20150415_2058'),
+ ]
+
+ operations = [
+ migrations.CreateModel(... | |
eeb84ac27b924903c10f6a9a1169e57b481256be | tests/Settings/TestExtruderStack.py | tests/Settings/TestExtruderStack.py | # Copyright (c) 2017 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
import pytest #This module contains automated tests.
import unittest.mock #For the mocking and monkeypatching functionality.
import cura.Settings.ExtruderStack #The module we're testing.
from cura.Settings.Exceptions impor... | Add tests for prohibited operations on extruder stacks | Add tests for prohibited operations on extruder stacks
These operations are explicitly prohibited, so they should raise an exception.
Contributes to issue CURA-3497.
| Python | agpl-3.0 | hmflash/Cura,ynotstartups/Wanhao,hmflash/Cura,fieldOfView/Cura,ynotstartups/Wanhao,fieldOfView/Cura,Curahelper/Cura,Curahelper/Cura | ---
+++
@@ -0,0 +1,28 @@
+# Copyright (c) 2017 Ultimaker B.V.
+# Cura is released under the terms of the AGPLv3 or higher.
+
+import pytest #This module contains automated tests.
+import unittest.mock #For the mocking and monkeypatching functionality.
+
+import cura.Settings.ExtruderStack #The module we're testing.
+... | |
67cee2591ab0aa41ff51a327a55fa3dff136652e | will/tests/test_acl.py | will/tests/test_acl.py | import unittest
from will.mixins.roster import RosterMixin
from will import settings
from mock import patch
class TestIsAdmin(unittest.TestCase):
def setUp(self):
self.message = {'nick': 'WoOh'}
@patch('will.mixins.roster.RosterMixin.get_user_from_message')
def test_message_is_from_admin_true_if... | Cover current ACL with tests | Cover current ACL with tests
| Python | mit | fredsmith/will,wontonst/will,brandonsturgeon/will,ammartins/will,ammartins/will,woohgit/will,ammartins/will,jacobbridges/will,Ironykins/will,woohgit/will,jacobbridges/will,shadow7412/will,mvanbaak/will,mvanbaak/will,mike-love/will,chillipeper/will,mvanbaak/will,dmuntean/will,fredsmith/will,grahamhayes/will,wontonst/wil... | ---
+++
@@ -0,0 +1,34 @@
+import unittest
+
+from will.mixins.roster import RosterMixin
+from will import settings
+from mock import patch
+
+class TestIsAdmin(unittest.TestCase):
+
+ def setUp(self):
+ self.message = {'nick': 'WoOh'}
+
+ @patch('will.mixins.roster.RosterMixin.get_user_from_message')
+ ... | |
5207550b9d19ff6823fb641e86e4851106ebd7f1 | bench/run-paper-nums.py | bench/run-paper-nums.py | #!/usr/bin/env python
devices = [
("hdd", "/dev/sdc1"),
("ssd-sam", "/dev/sdb1"),
("sdd-intel", "/dev/sdd2"),
("ram", "/dev/loop0"),
]
benches = [
("smallfile", "./smallfile /tmp/ft"),
("smallsync", "./smallsync /tmp/ft"),
("largefile", "./largefile /tmp/ft"),
... | Add script to run benchmarks for paper | Add script to run benchmarks for paper
| Python | mit | mit-pdos/fscq-impl,mit-pdos/fscq-impl,mit-pdos/fscq-impl,mit-pdos/fscq-impl,mit-pdos/fscq-impl | ---
+++
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+
+
+devices = [
+ ("hdd", "/dev/sdc1"),
+ ("ssd-sam", "/dev/sdb1"),
+ ("sdd-intel", "/dev/sdd2"),
+ ("ram", "/dev/loop0"),
+ ]
+
+benches = [
+ ("smallfile", "./smallfile /tmp/ft"),
+ ("smallsync", "./smallsync /tmp/ft"),
+ (... | |
4ecad80ff60f9964e4027a02d9382b7505d8386a | pullpush/GitPython-Daemon-Example.py | pullpush/GitPython-Daemon-Example.py | #!/usr/bin/env python3
import git
import tempfile
import time
tmpdir = tempfile.TemporaryDirectory(suffix='.git')
repo = git.Repo.init(tmpdir.name, shared=True, bare=True)
repo.daemon_export = True
gd = git.Git().daemon(tmpdir.name,
enable='receive-pack',
listen='127.0.0... | Add Example for Git Deamon. | Add Example for Git Deamon.
This can now be used in the unittests
| Python | mit | martialblog/git-pullpush | ---
+++
@@ -0,0 +1,27 @@
+#!/usr/bin/env python3
+
+
+import git
+import tempfile
+import time
+
+tmpdir = tempfile.TemporaryDirectory(suffix='.git')
+repo = git.Repo.init(tmpdir.name, shared=True, bare=True)
+
+repo.daemon_export = True
+
+gd = git.Git().daemon(tmpdir.name,
+ enable='receive-pac... | |
9c88eb5994ac33e72fad750b46de84c7de38328e | ChannelWorm/adapters.py | ChannelWorm/adapters.py | # configure django to use default settings
# note that this can also be done using an environment variable
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
if hasattr(settings, 'DEBUG'):
# settings are configured already
pass
else:
# load default settings if they're ... | Fix configuration imports. Adapter now works. | Fix configuration imports. Adapter now works.
| Python | mit | joebowen/ChannelWorm,VahidGh/ChannelWorm,cheelee/ChannelWorm,openworm/ChannelWorm,cheelee/ChannelWorm,cheelee/ChannelWorm,gsarma/ChannelWorm,gsarma/ChannelWorm,gsarma/ChannelWorm,joebowen/ChannelWorm,joebowen/ChannelWorm,openworm/ChannelWorm,joebowen/ChannelWorm,VahidGh/ChannelWorm,gsarma/ChannelWorm,openworm/ChannelWo... | ---
+++
@@ -0,0 +1,53 @@
+# configure django to use default settings
+# note that this can also be done using an environment variable
+from django.conf import settings
+from django.core.exceptions import ImproperlyConfigured
+
+if hasattr(settings, 'DEBUG'):
+ # settings are configured already
+ pass
+else:
+ ... | |
1418112d0ba752d3ebac6cdf2d727fdd71a2cf6f | test/unit/interfaces/test_map_ctp.py | test/unit/interfaces/test_map_ctp.py | import sys, os, re, shutil
from nose.tools import *
import logging
logger = logging.getLogger(__name__)
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
from qipipe.interfaces import MapCTP
ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__), '..', '..'))
"""The test parent director... | Test the Map CTP interface. | Test the Map CTP interface.
| Python | bsd-2-clause | ohsu-qin/qipipe | ---
+++
@@ -0,0 +1,52 @@
+import sys, os, re, shutil
+from nose.tools import *
+
+import logging
+logger = logging.getLogger(__name__)
+
+sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
+from qipipe.interfaces import MapCTP
+
+ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__), '..... | |
5096f4432978ef1e5d1f3d449fd3f54050f3c287 | test/widgets/test_wlan.py | test/widgets/test_wlan.py | # Copyright (c) 2021 elParaguayo
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distrib... | Add test for wlan widget | Add test for wlan widget
| Python | mit | ramnes/qtile,qtile/qtile,ramnes/qtile,qtile/qtile | ---
+++
@@ -0,0 +1,90 @@
+# Copyright (c) 2021 elParaguayo
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy... | |
e08257d4012b6df624c88b45ba28e8f9829ce2ad | spacy/cli/_git_sparse_checkout_example.py | spacy/cli/_git_sparse_checkout_example.py | import tempfile
import typer
from pathlib import Path
import subprocess
import shlex
import shutil
from contextlib import contextmanager
@contextmanager
def make_tempdir():
d = Path(tempfile.mkdtemp())
yield d
shutil.rmtree(str(d))
def clone_repo(repo, temp_dir):
subprocess.check_call([
"gi... | Add example of how to do sparse-checkout | Add example of how to do sparse-checkout
| Python | mit | spacy-io/spaCy,spacy-io/spaCy,spacy-io/spaCy,explosion/spaCy,explosion/spaCy,spacy-io/spaCy,explosion/spaCy,honnibal/spaCy,honnibal/spaCy,honnibal/spaCy,spacy-io/spaCy,explosion/spaCy,honnibal/spaCy,spacy-io/spaCy,explosion/spaCy,explosion/spaCy | ---
+++
@@ -0,0 +1,62 @@
+import tempfile
+import typer
+from pathlib import Path
+import subprocess
+import shlex
+import shutil
+from contextlib import contextmanager
+
+
+@contextmanager
+def make_tempdir():
+ d = Path(tempfile.mkdtemp())
+ yield d
+ shutil.rmtree(str(d))
+
+
+
+def clone_repo(repo, temp_... | |
f3c047a39f3d8438487ab31764d82afb7a86524e | apps/api/permissions.py | apps/api/permissions.py | from oauth2_provider.ext.rest_framework import TokenHasScope
from rest_framework.permissions import DjangoObjectPermissions
class TokenHasScopeOrUserHasObjectPermissionsOrWriteOnly(DjangoObjectPermissions, TokenHasScope):
"""
Allow anyone to write to this endpoint, but only the ones with the required scope to... | Add API permission class for HasScopeOrWriteOnly | Add API permission class for HasScopeOrWriteOnly
| Python | mit | dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4,dotKom/onlineweb4 | ---
+++
@@ -0,0 +1,25 @@
+from oauth2_provider.ext.rest_framework import TokenHasScope
+from rest_framework.permissions import DjangoObjectPermissions
+
+
+class TokenHasScopeOrUserHasObjectPermissionsOrWriteOnly(DjangoObjectPermissions, TokenHasScope):
+ """
+ Allow anyone to write to this endpoint, but only t... | |
5ac528eff7c5cb49e329de720cbabc2ac89fc50c | ideascube/conf/kb_bdi_tv5monde.py | ideascube/conf/kb_bdi_tv5monde.py | # -*- coding: utf-8 -*-
"""KoomBook conf"""
from .kb import * # noqa
LANGUAGE_CODE = 'fr'
IDEASCUBE_NAME = 'TV5 Monde Burundi'
HOME_CARDS = STAFF_HOME_CARDS + [
{
'id': 'blog',
},
{
'id': 'mediacenter',
},
{
'id': 'gutemberg',
},
{
'id': 'khanacademy',
}... | Add conf file for TV5 Monde Burundi | Add conf file for TV5 Monde Burundi
| Python | agpl-3.0 | ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube | ---
+++
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+"""KoomBook conf"""
+from .kb import * # noqa
+
+LANGUAGE_CODE = 'fr'
+IDEASCUBE_NAME = 'TV5 Monde Burundi'
+HOME_CARDS = STAFF_HOME_CARDS + [
+ {
+ 'id': 'blog',
+ },
+ {
+ 'id': 'mediacenter',
+ },
+ {
+ 'id': 'gutemberg',
+ ... | |
c3dd34a6fa80be8a90d178e3e0d28716583f9a9a | src/data_collection/FaceCollector_Main.py | src/data_collection/FaceCollector_Main.py | import cv2, sys, os, time, logging
video = cv2.VideoCapture(0)
while True:
ret, cameraFrame = video.read()
if not ret:
exit()
cv2.imshow("Live Video", cameraFrame)
continue
| Test the webcam with cv2 | Test the webcam with cv2
| Python | apache-2.0 | xphongvn/smart-attendance-system-ta,xphongvn/smart-attendance-system-ta,xphongvn/smart-attendance-system-ta | ---
+++
@@ -0,0 +1,10 @@
+import cv2, sys, os, time, logging
+
+video = cv2.VideoCapture(0)
+
+while True:
+ ret, cameraFrame = video.read()
+ if not ret:
+ exit()
+ cv2.imshow("Live Video", cameraFrame)
+ continue | |
c3b286db4dd39cbe81b81e374819cba1fab2df13 | ideascube/conf/kb_mooc_cog.py | ideascube/conf/kb_mooc_cog.py | # -*- coding: utf-8 -*-
"""KoomBook conf"""
from .base import * # noqa
from django.utils.translation import ugettext_lazy as _
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = bool(os.environ.get('DEBUG', True))
TEMPLATE_DEBUG = False
ALLOWED_HOSTS = ['.koombook.lan.', 'localhost', '127.0... | Add conf file for MOOC RDC | Add conf file for MOOC RDC
| Python | agpl-3.0 | ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube | ---
+++
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+
+"""KoomBook conf"""
+
+from .base import * # noqa
+from django.utils.translation import ugettext_lazy as _
+
+# SECURITY WARNING: don't run with debug turned on in production!
+DEBUG = bool(os.environ.get('DEBUG', True))
+
+TEMPLATE_DEBUG = False
+
+ALLOWED_HOSTS ... | |
e082c56ef5629924e3d760fb86eff182cc3579a5 | misc/make-msi-package.py | misc/make-msi-package.py | # Copyright 2016, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | Add script to only create the MSI package. | Release: Add script to only create the MSI package.
* This is for external CI to produce MSI packages instead of my
internal one.
| Python | apache-2.0 | kayhayen/Nuitka,kayhayen/Nuitka,kayhayen/Nuitka,kayhayen/Nuitka | ---
+++
@@ -0,0 +1,82 @@
+# Copyright 2016, Kay Hayen, mailto:kay.hayen@gmail.com
+#
+# Part of "Nuitka", an optimizing Python compiler that is compatible and
+# integrates with CPython, but also works on its own.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not... | |
2c14466740a53619acc34a8599dfcd2ff3244db6 | src/proposals/tests/test_management.py | src/proposals/tests/test_management.py | from datetime import timedelta
import re
import pytest
from django.utils.timezone import now
from django.core.management import call_command
from proposals.models import TalkProposal
@pytest.fixture()
def weekago_talk_proposal(user):
dt_weekago = now() - timedelta(weeks=1)
proposal = TalkProposal.objects.cr... | Add unittest for command recent_proposals | Add unittest for command recent_proposals
| Python | mit | pycontw/pycontw2016,uranusjr/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016,uranusjr/pycontw2016,uranusjr/pycontw2016,uranusjr/pycontw2016 | ---
+++
@@ -0,0 +1,85 @@
+from datetime import timedelta
+import re
+
+import pytest
+from django.utils.timezone import now
+from django.core.management import call_command
+
+from proposals.models import TalkProposal
+
+
+@pytest.fixture()
+def weekago_talk_proposal(user):
+ dt_weekago = now() - timedelta(weeks=1... | |
0e00742cf60285fc6d45ec5762e00d439ba61ddd | IVoiSysAuthorisation.py | IVoiSysAuthorisation.py | # Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved.
# Copyright (c) 2006-2007 Sippy Software, Inc. All rights reserved.
#
# This file is part of SIPPY, a free RFC3261 SIP stack and B2BUA.
#
# SIPPY is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License a... | Add class specific for IVoiSys to do DB auth. | Add class specific for IVoiSys to do DB auth.
| Python | bsd-2-clause | jevonearth/rtpproxy,jevonearth/rtpproxy,dsanders11/rtpproxy,sippy/rtpproxy,dsanders11/rtpproxy,synety-jdebp/rtpproxy,jevonearth/rtpproxy,sippy/rtp_cluster,synety-jdebp/rtpproxy,jevonearth/rtpproxy,dsanders11/rtpproxy,sippy/rtpproxy,sippy/rtpproxy,synety-jdebp/rtpproxy,synety-jdebp/rtpproxy,sippy/rtp_cluster | ---
+++
@@ -0,0 +1,44 @@
+# Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved.
+# Copyright (c) 2006-2007 Sippy Software, Inc. All rights reserved.
+#
+# This file is part of SIPPY, a free RFC3261 SIP stack and B2BUA.
+#
+# SIPPY is free software; you can redistribute it and/or modify
+# it under the terms o... | |
f51623142dfc089aeb46e986b1d0382f3fab3025 | test/test_producer.py | test/test_producer.py | import pytest
from kafka import KafkaConsumer, KafkaProducer
from test.conftest import version
from test.testutil import random_string
@pytest.mark.skipif(not version(), reason="No KAFKA_VERSION set")
def test_end_to_end(kafka_broker):
connect_str = 'localhost:' + str(kafka_broker.port)
producer = KafkaProdu... | Add simple KafkaProducer -> KafkaConsumer integration test | Add simple KafkaProducer -> KafkaConsumer integration test
| Python | apache-2.0 | wikimedia/operations-debs-python-kafka,zackdever/kafka-python,ohmu/kafka-python,mumrah/kafka-python,scrapinghub/kafka-python,dpkp/kafka-python,Yelp/kafka-python,mumrah/kafka-python,DataDog/kafka-python,scrapinghub/kafka-python,zackdever/kafka-python,wikimedia/operations-debs-python-kafka,Yelp/kafka-python,ohmu/kafka-py... | ---
+++
@@ -0,0 +1,34 @@
+import pytest
+
+from kafka import KafkaConsumer, KafkaProducer
+from test.conftest import version
+from test.testutil import random_string
+
+
+@pytest.mark.skipif(not version(), reason="No KAFKA_VERSION set")
+def test_end_to_end(kafka_broker):
+ connect_str = 'localhost:' + str(kafka_b... | |
30c927a6a35f3a6f8d4f11ff4e4a8f12431e80b5 | shuup_tests/xtheme/test_admin.py | shuup_tests/xtheme/test_admin.py | from shuup.apps.provides import override_provides
from shuup.testing.utils import apply_request_middleware
from shuup.xtheme.admin_module.views import ThemeConfigView, ThemeConfigDetailView, ThemeGuideTemplateView
from shuup_tests.xtheme.utils import FauxTheme
def test_config_view(rf, admin_user):
request = apply... | Add some xtheme admin tests | Add some xtheme admin tests
| Python | agpl-3.0 | shoopio/shoop,shoopio/shoop,shoopio/shoop | ---
+++
@@ -0,0 +1,17 @@
+from shuup.apps.provides import override_provides
+from shuup.testing.utils import apply_request_middleware
+from shuup.xtheme.admin_module.views import ThemeConfigView, ThemeConfigDetailView, ThemeGuideTemplateView
+from shuup_tests.xtheme.utils import FauxTheme
+
+
+def test_config_view(rf... | |
d93abe8554db7deaf318939d42214e4cf1fc0807 | tests/test_catalog.py | tests/test_catalog.py | """Objects catalog unittests."""
import unittest2 as unittest
from objects.catalog import AbstractCatalog
from objects.providers import Object
from objects.providers import Value
from objects.errors import Error
class CatalogTests(unittest.TestCase):
"""Catalog test cases."""
class Catalog(AbstractCatal... | Add some tests for catalog | Add some tests for catalog
| Python | bsd-3-clause | ets-labs/dependency_injector,ets-labs/python-dependency-injector,rmk135/objects,rmk135/dependency_injector | ---
+++
@@ -0,0 +1,51 @@
+"""Objects catalog unittests."""
+
+import unittest2 as unittest
+
+from objects.catalog import AbstractCatalog
+
+from objects.providers import Object
+from objects.providers import Value
+
+from objects.errors import Error
+
+
+class CatalogTests(unittest.TestCase):
+
+ """Catalog test ... | |
63c20427f573d95bfc5326d0614455640123e6ed | modules/tools/extractor/extractor.py | modules/tools/extractor/extractor.py | #!/usr/bin/env python
###############################################################################
# Copyright 2017 The Apollo Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy ... | Add tool to extract routing from planning debug | Add tool to extract routing from planning debug
| Python | apache-2.0 | startcode/apollo,startcode/apollo,fy2462/apollo,startcode/apollo,startcode/apollo,startcode/apollo,fy2462/apollo,fy2462/apollo,fy2462/apollo,startcode/apollo,fy2462/apollo,fy2462/apollo | ---
+++
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+
+###############################################################################
+# Copyright 2017 The Apollo Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the... | |
9185f1e51c5884ac63839ba8c17ad31a44c88647 | virtool/tests/cls.py | virtool/tests/cls.py | class AuthorizedTest:
async def test_not_authorized(self, do_get):
resp = await do_get("/api/users")
assert resp.status == 403
assert await resp.json() == {
"message": "Not authorized"
}
class ProtectedTest(AuthorizedTest):
async def test_not_authorized(self, do... | Add test superclasses for authorization and permissions | Add test superclasses for authorization and permissions
| Python | mit | virtool/virtool,virtool/virtool,igboyes/virtool,igboyes/virtool | ---
+++
@@ -0,0 +1,31 @@
+class AuthorizedTest:
+
+ async def test_not_authorized(self, do_get):
+ resp = await do_get("/api/users")
+
+ assert resp.status == 403
+
+ assert await resp.json() == {
+ "message": "Not authorized"
+ }
+
+
+class ProtectedTest(AuthorizedTest):
+
+... | |
f53628d7adc6a74fccbc28e2483e4360ae561438 | korail_split_ticket_checker_test.py | korail_split_ticket_checker_test.py | # -*- coding: utf-8 -*-
import unittest
import korail_split_ticket_checker
import datetime
class TestKorailSplitTickerChecker(unittest.TestCase):
def setUp(self):
tomorrow = datetime.datetime.now() + datetime.timedelta(days=1)
self.date = tomorrow.strftime('%Y%m%d')
def test_get_train_routes_ktx(self):
# ... | Add a unit test for get_train_routes func. | Add a unit test for get_train_routes func.
| Python | mit | kimtree/korail-split-ticket-checker | ---
+++
@@ -0,0 +1,59 @@
+# -*- coding: utf-8 -*-
+import unittest
+import korail_split_ticket_checker
+
+import datetime
+
+class TestKorailSplitTickerChecker(unittest.TestCase):
+
+ def setUp(self):
+ tomorrow = datetime.datetime.now() + datetime.timedelta(days=1)
+ self.date = tomorrow.strftime('%Y%m%d')
+
+ d... | |
a90c15e409451bbca366c7c3994f90e61e5f726b | tests/test_start.py | tests/test_start.py | import unittest
from coilmq.server.socket_server import ThreadedStompServer
from coilmq.start import server_from_config
class GetServerTestCase(unittest.TestCase):
def test_server_from_config_default(self):
self.assertIsInstance(server_from_config(), ThreadedStompServer) | Add test for the start module | Add test for the start module
| Python | apache-2.0 | hozn/coilmq | ---
+++
@@ -0,0 +1,10 @@
+import unittest
+
+from coilmq.server.socket_server import ThreadedStompServer
+from coilmq.start import server_from_config
+
+class GetServerTestCase(unittest.TestCase):
+
+ def test_server_from_config_default(self):
+
+ self.assertIsInstance(server_from_config(), ThreadedStompSer... | |
2f37d4f81513d6d8a783883ffa18bffc5eb3e559 | examples/various_nameservers.py | examples/various_nameservers.py | """
This example is relatively complex.
We will be creating a system in which agents will connect to different
name servers. Each name server will therefore represent a 'group' of agents.
That way, we can easily shut down all agents belonging to a group, without
interfering with the others.
"""
import time
from osbra... | Add example of various name servers from one script | Add example of various name servers from one script
| Python | apache-2.0 | opensistemas-hub/osbrain | ---
+++
@@ -0,0 +1,50 @@
+"""
+This example is relatively complex.
+
+We will be creating a system in which agents will connect to different
+name servers. Each name server will therefore represent a 'group' of agents.
+That way, we can easily shut down all agents belonging to a group, without
+interfering with the o... | |
9dba843bdeede54eab30e7f3b537c75965748110 | functional/tests/network/v2/test_floating_ip.py | functional/tests/network/v2/test_floating_ip.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 tests for commands of floating ip | Add functional tests for commands of floating ip
This patch add functinal tests for commands of floating ip
Change-Id: I7f29578d0e14884f21183bfb82228d2fe7b7a029
| Python | apache-2.0 | openstack/python-openstackclient,dtroyer/python-openstackclient,dtroyer/python-openstackclient,redhat-openstack/python-openstackclient,openstack/python-openstackclient,redhat-openstack/python-openstackclient | ---
+++
@@ -0,0 +1,58 @@
+# 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... | |
0e54e8ac75acbd289c2fde2d7fae486cc31ab3ab | tests/test_block_aio.py | tests/test_block_aio.py | # -*- coding: utf-8 -*-
import aiounittest
from graphenecommon.utils import parse_time
from .fixtures_aio import fixture_data, Block, BlockHeader
class Testcases(aiounittest.AsyncTestCase):
def setUp(self):
fixture_data()
async def test_block(self):
block = await Block(1)
self.assertE... | Add test for async Block | Add test for async Block
| Python | mit | xeroc/python-graphenelib | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+import aiounittest
+from graphenecommon.utils import parse_time
+from .fixtures_aio import fixture_data, Block, BlockHeader
+
+
+class Testcases(aiounittest.AsyncTestCase):
+ def setUp(self):
+ fixture_data()
+
+ async def test_block(self):
+ bloc... | |
f6b851e14d108ae016278351cec71e76bf96ba5e | h2o-py/tests/testdir_algos/gbm/pyunit_gbm_quantiles_no_num.py | h2o-py/tests/testdir_algos/gbm/pyunit_gbm_quantiles_no_num.py | import sys, os
sys.path.insert(1, os.path.join("..","..",".."))
import h2o
from tests import pyunit_utils
from h2o.estimators.gbm import H2OGradientBoostingEstimator
def gbm_quantiles_global_with_only_categorical_colums():
prostate_train = h2o.import_file(path=pyunit_utils.locate("smalldata/logreg/prostate_train.cs... | Add test showing QuantilesGlobal works with categorical-only dataset | PUBDEV-8722: Add test showing QuantilesGlobal works with categorical-only dataset
| Python | apache-2.0 | h2oai/h2o-3,h2oai/h2o-3,h2oai/h2o-3,h2oai/h2o-3,h2oai/h2o-3,h2oai/h2o-3,h2oai/h2o-3,h2oai/h2o-3 | ---
+++
@@ -0,0 +1,22 @@
+import sys, os
+sys.path.insert(1, os.path.join("..","..",".."))
+import h2o
+from tests import pyunit_utils
+from h2o.estimators.gbm import H2OGradientBoostingEstimator
+
+
+def gbm_quantiles_global_with_only_categorical_colums():
+ prostate_train = h2o.import_file(path=pyunit_utils.locate... | |
e6dea0455e9d0d9158843b40045f3753dbdb17c2 | Orange/widgets/evaluate/tests/test_owrocanalysis.py | Orange/widgets/evaluate/tests/test_owrocanalysis.py | import unittest
import numpy
import Orange.data
import Orange.evaluation
import Orange.classification
from Orange.widgets.evaluate import owrocanalysis
class TestROC(unittest.TestCase):
def test_ROCData_from_results(self):
data = Orange.data.Table("iris")
learners = [
Orange.classifi... | Add basic tests for roc analysis utilities | owrocanalysis: Add basic tests for roc analysis utilities
| Python | bsd-2-clause | cheral/orange3,cheral/orange3,cheral/orange3,cheral/orange3,cheral/orange3,cheral/orange3 | ---
+++
@@ -0,0 +1,57 @@
+import unittest
+import numpy
+
+import Orange.data
+import Orange.evaluation
+import Orange.classification
+
+from Orange.widgets.evaluate import owrocanalysis
+
+
+class TestROC(unittest.TestCase):
+ def test_ROCData_from_results(self):
+ data = Orange.data.Table("iris")
+ ... | |
d5ef19d5e024fb68d4781fb78ec6136e28904ae5 | tools/valouev2kmers.py | tools/valouev2kmers.py | # Takes a file in the format used by Valouev and extracts k-mers as new maps
import sys
import numpy as np
k = 12 # window size ... | Add script for doing OPTIMA-overlap queries | Add script for doing OPTIMA-overlap queries | Python | mit | mmuggli/doppelganger,mmuggli/KOHDISTA,mmuggli/KOHDISTA,mmuggli/KOHDISTA,mmuggli/doppelganger,mmuggli/KOHDISTA,mmuggli/doppelganger,mmuggli/doppelganger | ---
+++
@@ -0,0 +1,17 @@
+# Takes a file in the format used by Valouev and extracts k-mers as new maps
+import sys
+import numpy as np
+k = 12 # window size ... | |
288305839dab0f5a54bf3bed5a3a55849afadfff | migrations/versions/470_remove_old_imported_buyer_accounts.py | migrations/versions/470_remove_old_imported_buyer_accounts.py | """Remove old imported buyer accounts
Revision ID: 470
Revises: 460
Create Date: 2016-01-22 16:20:29.793439
"""
# revision identifiers, used by Alembic.
revision = '470'
down_revision = '460'
from alembic import op
def upgrade():
op.execute("""
DELETE FROM users
WHERE users.role = 'buyer';
... | Add a migration to remove old imported buyer accounts | Add a migration to remove old imported buyer accounts
Users with a "buyer" role were imported from the Grails app and are
a mix of buyer and supplier users. We used to convert them to supplier
accounts during registration, but now that we're planning to open buyer
registration for valid buyers we're going to delete al... | Python | mit | alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api,alphagov/digitalmarketplace-api | ---
+++
@@ -0,0 +1,24 @@
+"""Remove old imported buyer accounts
+
+Revision ID: 470
+Revises: 460
+Create Date: 2016-01-22 16:20:29.793439
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '470'
+down_revision = '460'
+
+from alembic import op
+
+
+def upgrade():
+ op.execute("""
+ DELETE FROM ... | |
b1c8d27d2fdb44a98b33176bf7b14ef6d2d889d2 | scripts/add-extension.py | scripts/add-extension.py | #!/usr/bin/env python
# Note, you need to pip install python-magic to use this.
import magic
import os
import sys
def fix_with_magic(filename):
base, ext = os.path.splitext(filename)
if ext:
print "skipping {}".format(filename)
return
result = magic.from_file(filename, mime=True)
if ... | Add script to add extension based on mimetype | Add script to add extension based on mimetype
| Python | bsd-3-clause | shaleh/useful-things,shaleh/useful-things | ---
+++
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+
+# Note, you need to pip install python-magic to use this.
+
+import magic
+import os
+import sys
+
+def fix_with_magic(filename):
+ base, ext = os.path.splitext(filename)
+ if ext:
+ print "skipping {}".format(filename)
+ return
+
+ result = ma... | |
3da85702dc841c53d73ef890cec040dcb6a51812 | utils/event_matcher.py | utils/event_matcher.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
logger = logging.getLogger(__name__)
def is_matching_event(play, event):
"""
Checks whether specified play (retrieved from json data) and database event
match.
"""
if play['play_type'] == 'PENL':
return is_matching_penalty_even... | Add utility functions to distinguish events with same type/time | Add utility functions to distinguish events with same type/time
| Python | mit | leaffan/pynhldb | ---
+++
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import logging
+
+logger = logging.getLogger(__name__)
+
+
+def is_matching_event(play, event):
+ """
+ Checks whether specified play (retrieved from json data) and database event
+ match.
+ """
+ if play['play_type'] == 'PENL'... | |
e46dfbd615f0d0fa8ac8d213cd053d71d7b42024 | migrations/versions/201609141652_55d523872c43_add_abstract_fks.py | migrations/versions/201609141652_55d523872c43_add_abstract_fks.py | """Add abstract FKs
Revision ID: 55d523872c43
Revises: 2ce1756a2f12
Create Date: 2016-09-14 16:52:29.196932
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = '55d523872c43'
down_revision = '2ce1756a2f12'
def upgrade():
op.create_foreign_key(None,
'abstrac... | Add alembic revision to create FKs | Add alembic revision to create FKs
To be run AFTER running the zodbimporter
| Python | mit | DirkHoffmann/indico,DirkHoffmann/indico,ThiefMaster/indico,mvidalgarcia/indico,mic4ael/indico,mic4ael/indico,pferreir/indico,indico/indico,DirkHoffmann/indico,OmeGak/indico,indico/indico,indico/indico,pferreir/indico,mvidalgarcia/indico,mic4ael/indico,DirkHoffmann/indico,ThiefMaster/indico,mic4ael/indico,pferreir/indic... | ---
+++
@@ -0,0 +1,30 @@
+"""Add abstract FKs
+
+Revision ID: 55d523872c43
+Revises: 2ce1756a2f12
+Create Date: 2016-09-14 16:52:29.196932
+"""
+
+from alembic import op
+
+
+# revision identifiers, used by Alembic.
+revision = '55d523872c43'
+down_revision = '2ce1756a2f12'
+
+
+def upgrade():
+ op.create_foreign_... | |
3b48c8a14937547f7e6cc9baa9ea37b744855739 | judge/migrations/0116_contest_curator_and_tester.py | judge/migrations/0116_contest_curator_and_tester.py | # Generated by Django 2.2.13 on 2021-04-26 02:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('judge', '0115_contest_scoreboard_visibility'),
]
operations = [
migrations.AlterField(
model_name='contest',
name='... | Add migration for contest curator and tester | Add migration for contest curator and tester
| Python | agpl-3.0 | DMOJ/site,DMOJ/site,DMOJ/site,DMOJ/site | ---
+++
@@ -0,0 +1,33 @@
+# Generated by Django 2.2.13 on 2021-04-26 02:57
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('judge', '0115_contest_scoreboard_visibility'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ ... | |
08293b3c679e7079e80fcb1afc1f8b26570a6f2c | mrp_subcontracting/models/mrp_routing_workcenter.py | mrp_subcontracting/models/mrp_routing_workcenter.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the... | # -*- encoding: utf-8 -*-
##############################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the... | Allow to select any type of subcontracting product | [FIX] mrp_subcontracting: Allow to select any type of subcontracting product
| Python | agpl-3.0 | diagramsoftware/odoomrp-wip,agaldona/odoomrp-wip-1,raycarnes/odoomrp-wip,alhashash/odoomrp-wip,esthermm/odoomrp-wip,odoocn/odoomrp-wip,esthermm/odoomrp-wip,oihane/odoomrp-wip,factorlibre/odoomrp-wip,xpansa/odoomrp-wip,maljac/odoomrp-wip,diagramsoftware/odoomrp-wip,dvitme/odoomrp-wip,windedge/odoomrp-wip,odoomrp/odoomrp... | ---
+++
@@ -23,8 +23,6 @@
external = fields.Boolean('External', help="Is Subcontract Operation")
semifinished_id = fields.Many2one(
- 'product.product', 'Semifinished Subcontracting',
- domain=[('type', '=', 'product'),
- ])
+ comodel_name='product.product', string='Sem... |
8f18bc32e84de1ce25bfcb972c6b9f1b24e0f6af | runners/test/python/sparse_codegen_test_util.py | runners/test/python/sparse_codegen_test_util.py | """Testing error handling in the common test utilities.
The module tests the error handling in the utilities we use for writing
exhaustive tests for the sparse codegen.
"""
import inspect
import sys
# Import MLIR related modules.
from mlir.dialects import sparse_tensor as st
from mlir.dialects.linalg.opdsl import la... | Add tests for the exhaustive test utilities. | [mlir][python[[sparse] Add tests for the exhaustive test utilities.
Add tests for the common utilities that we use for writing exhaustive tests for
the MLIR sparse codegen.
Simplify the relevant build rules by adding a new filegroup and moving a shared
library to an existing filegroup.
PiperOrigin-RevId: 385571670
| Python | apache-2.0 | iree-org/iree-llvm-sandbox,iree-org/iree-llvm-sandbox,iree-org/iree-llvm-sandbox,iree-org/iree-llvm-sandbox | ---
+++
@@ -0,0 +1,95 @@
+"""Testing error handling in the common test utilities.
+
+The module tests the error handling in the utilities we use for writing
+exhaustive tests for the sparse codegen.
+"""
+
+import inspect
+import sys
+
+# Import MLIR related modules.
+from mlir.dialects import sparse_tensor as st
+fr... | |
dca6f5450c449aeedca792326964ddb91992ec95 | test/unit/sorting/test_bucket_sort.py | test/unit/sorting/test_bucket_sort.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import unittest
from helper.read_data_file import read_int_array
from sorting.bucket_sort import sort
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
class InsertionSortTester(unittest.TestCase):
# Test sort in default order, i.e., in ascending or... | Add unit test for bucket sort implementation. | Add unit test for bucket sort implementation.
| Python | mit | weichen2046/algorithm-study,weichen2046/algorithm-study | ---
+++
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import os
+import unittest
+
+from helper.read_data_file import read_int_array
+from sorting.bucket_sort import sort
+
+
+BASE_DIR = os.path.dirname(os.path.abspath(__file__))
+
+
+class InsertionSortTester(unittest.TestCase):
+
+ # Test s... | |
ce09da7df6668692133786bfdd5e25c6ac5d2c17 | conpaas-director/cpsdirector/get_external_idps.py | conpaas-director/cpsdirector/get_external_idps.py | #!/usr/bin/python
import ConfigParser
import pprint
def get_external_idps(director_configfile):
"""
get_external_idps(director_configfile)
Checks in the conpaas section if the support_external_idp option is present and set.
If so, checks if external_idps option is present, and for all
named idps collects all ... | Add code to support OpenID | Add code to support OpenID
| Python | bsd-3-clause | ConPaaS-team/conpaas,ConPaaS-team/conpaas,ConPaaS-team/conpaas,ConPaaS-team/conpaas,ConPaaS-team/conpaas,ConPaaS-team/conpaas,ConPaaS-team/conpaas | ---
+++
@@ -0,0 +1,44 @@
+#!/usr/bin/python
+import ConfigParser
+import pprint
+
+def get_external_idps(director_configfile):
+ """
+ get_external_idps(director_configfile)
+ Checks in the conpaas section if the support_external_idp option is present and set.
+ If so, checks if external_idps option is present, an... | |
a47860e73c68ffbba97f1a70355223a2052a5f3c | tests/modules/test_pulseaudio.py | tests/modules/test_pulseaudio.py | # pylint: disable=C0103,C0111
import mock
import unittest
import tests.mocks as mocks
from bumblebee.input import LEFT_MOUSE, RIGHT_MOUSE, WHEEL_UP, WHEEL_DOWN
from bumblebee.modules.pulseaudio import Module
class TestPulseAudioModule(unittest.TestCase):
def setUp(self):
mocks.setup_test(self, Module)
... | Add unit tests for pulseaudio module | [tests] Add unit tests for pulseaudio module
| Python | mit | tobi-wan-kenobi/bumblebee-status,tobi-wan-kenobi/bumblebee-status | ---
+++
@@ -0,0 +1,34 @@
+# pylint: disable=C0103,C0111
+
+import mock
+import unittest
+
+import tests.mocks as mocks
+
+from bumblebee.input import LEFT_MOUSE, RIGHT_MOUSE, WHEEL_UP, WHEEL_DOWN
+from bumblebee.modules.pulseaudio import Module
+
+class TestPulseAudioModule(unittest.TestCase):
+ def setUp(self):
+... | |
c88947ad3dd5ad0c2e113e8fb8a37aff642b3381 | timm/data/parsers/parser_hfds.py | timm/data/parsers/parser_hfds.py | """ Dataset parser interface that wraps Hugging Face datasets
Hacked together by / Copyright 2022 Ross Wightman
"""
import io
import math
import torch
import torch.distributed as dist
from PIL import Image
try:
import datasets
except ImportError as e:
print("Please install Hugging Face datasets package `pip in... | Add initial Hugging Face Datasets parser impl. | Add initial Hugging Face Datasets parser impl.
| Python | apache-2.0 | rwightman/pytorch-image-models,rwightman/pytorch-image-models | ---
+++
@@ -0,0 +1,69 @@
+""" Dataset parser interface that wraps Hugging Face datasets
+Hacked together by / Copyright 2022 Ross Wightman
+"""
+import io
+import math
+import torch
+import torch.distributed as dist
+from PIL import Image
+
+try:
+ import datasets
+except ImportError as e:
+ print("Please insta... | |
626832a2e65635a0e47d0b01fbc8d49c9fcf9952 | rpc_flush_datastack.py | rpc_flush_datastack.py | #==============================================================================
# rpc_flush_datastack.py
# Python script that flushes a dataport for a device
#
# IMPORTANT NOTE!!: This will remove all data in a dataport (data source)
# USE AT YOUR OWN RISK
#
#
#==========================================================... | Add flush data stack example utility file | Add flush data stack example utility file
| Python | bsd-3-clause | exosite-garage/utility_scripts | ---
+++
@@ -0,0 +1,59 @@
+#==============================================================================
+# rpc_flush_datastack.py
+# Python script that flushes a dataport for a device
+#
+# IMPORTANT NOTE!!: This will remove all data in a dataport (data source)
+# USE AT YOUR OWN RISK
+#
+#
+#======================... | |
bc7c8e879e6643f240f98503415a28493c19d181 | scripts/get_services_to_deploy.py | scripts/get_services_to_deploy.py | #!/usr/bin/env python
import requests
import json
import sys
import argparse
parser = argparse.ArgumentParser('Queries Monorail to get the services and deployNotes where a list of Pull requests will be deployed')
parser.add_argument('--url', help='URL where Monorail is located')
parser.add_argument('--pr', help='List... | Add script that gets the services and deployNotes where a list of Pull requests will be deployed | Add script that gets the services and deployNotes where a list of Pull requests will be deployed
| Python | mit | AudienseCo/monorail,AudienseCo/monorail | ---
+++
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+
+import requests
+import json
+import sys
+import argparse
+
+parser = argparse.ArgumentParser('Queries Monorail to get the services and deployNotes where a list of Pull requests will be deployed')
+parser.add_argument('--url', help='URL where Monorail is located')
+p... | |
4a07f1c9c36ecd47e3fce1738c87d42615d53f8c | odl/operator/utility.py | odl/operator/utility.py | # Copyright 2014, 2015 The ODL development group
#
# This file is part of ODL.
#
# ODL is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
... | Add a function for matrix representation. | DEV: Add a function for matrix representation.
See issue #49.
| Python | mpl-2.0 | aringh/odl,odlgroup/odl,odlgroup/odl,kohr-h/odl,kohr-h/odl,aringh/odl | ---
+++
@@ -0,0 +1,77 @@
+# Copyright 2014, 2015 The ODL development group
+#
+# This file is part of ODL.
+#
+# ODL is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (... | |
2b51cbe6204abf12d1eca023a0784a1c903c244d | data/scripts/load_chuls.py | data/scripts/load_chuls.py | import os
import csv
import json
from django.conf import settings
chul_file = os.path.join(
settings.BASE_DIR, 'data/csvs/chul.csv')
table_columns = [
"CommUnitId", "Cu_code", "CommUnitName", "Date_CU_Established",
"Date_CU_Operational", "CuLocation", "Link_Facility_Code",
"CU_OfficialMobile", "CU_Of... | Add script to read and load chus and chews | Add script to read and load chus and chews
| Python | mit | MasterFacilityList/mfl_api,MasterFacilityList/mfl_api,MasterFacilityList/mfl_api,urandu/mfl_api,MasterFacilityList/mfl_api,urandu/mfl_api,urandu/mfl_api,MasterFacilityList/mfl_api,urandu/mfl_api | ---
+++
@@ -0,0 +1,101 @@
+import os
+import csv
+import json
+from django.conf import settings
+
+
+chul_file = os.path.join(
+ settings.BASE_DIR, 'data/csvs/chul.csv')
+
+table_columns = [
+ "CommUnitId", "Cu_code", "CommUnitName", "Date_CU_Established",
+ "Date_CU_Operational", "CuLocation", "Link_Facilit... | |
6b01cfd5b580354de811fa7266811bfb04e31086 | migrations/versions/0092_data_gov_uk.py | migrations/versions/0092_data_gov_uk.py | """empty message
Revision ID: 0092_data_gov_uk
Revises: 0091_letter_billing
Create Date: 2017-06-05 16:15:17.744908
"""
# revision identifiers, used by Alembic.
revision = '0092_data_gov_uk'
down_revision = '0091_letter_billing'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgres... | Add data.gov.uk to the list of organisations | Add data.gov.uk to the list of organisations
We need to send an email with data.gov.uk branding.
The image for the logo doesn’t exist yet, but doing this migration so
we’re ready when it the logo does exist.
| Python | mit | alphagov/notifications-api,alphagov/notifications-api | ---
+++
@@ -0,0 +1,31 @@
+"""empty message
+
+Revision ID: 0092_data_gov_uk
+Revises: 0091_letter_billing
+Create Date: 2017-06-05 16:15:17.744908
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '0092_data_gov_uk'
+down_revision = '0091_letter_billing'
+
+from alembic import op
+import sqlalchemy as sa... | |
8414ff6fa396117cc02dfea08098a9213889baad | proselint/checks/inprogress/capitalizationErrors.py | proselint/checks/inprogress/capitalizationErrors.py | # -*- coding: utf-8 -*-
"""MSC: Password in plain text.
---
layout: post
error_code: MSC
source: ???
source_url: ???
title: Capitalization of abbreviations
date: 2014-06-10 12:31:19
categories: writing
---
In Hybrid Zones, p 255 in a citation Hughes & Huges Systems Experts and Computers: The System... | Add a capitalization check for world wars inspired by error in a bibliography | Add a capitalization check for world wars inspired by error in a bibliography
| Python | bsd-3-clause | amperser/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint,jstewmon/proselint,jstewmon/proselint,amperser/proselint,amperser/proselint | ---
+++
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+"""MSC: Password in plain text.
+
+---
+layout: post
+error_code: MSC
+source: ???
+source_url: ???
+title: Capitalization of abbreviations
+date: 2014-06-10 12:31:19
+categories: writing
+---
+
+In Hybrid Zones, p 255 in a citation Hughes & Huges ... | |
9d3557234419fac0376e07d732f0f6788bf13a55 | demos/hybrid-mixed/mixed-helmholtz.py | demos/hybrid-mixed/mixed-helmholtz.py | """This demonstration generates the relevant code from the Slate
expressions. Note that this is for code only; it's not solving any
particular PDE with given data.
See the main hybrid-mixed folder for an actual solution to a
mixed system using hybridization and static condensation.
"""
from firedrake import *
mesh = ... | Add simple code generation script | Add simple code generation script
| Python | mit | thomasgibson/tabula-rasa | ---
+++
@@ -0,0 +1,38 @@
+"""This demonstration generates the relevant code from the Slate
+expressions. Note that this is for code only; it's not solving any
+particular PDE with given data.
+
+See the main hybrid-mixed folder for an actual solution to a
+mixed system using hybridization and static condensation.
+""... | |
dc15f8eb74592e0bc26aad2a2850e6a04de1492c | scripts/newActivity.py | scripts/newActivity.py | #!/usr/bin/env python
from datetime import datetime
from pymongo import MongoClient
import re
from subprocess import call
import sys
# minutes
window = 30
if len(sys.argv) != 2:
print 'Usage: %s <logfile>' % sys.argv[0]
sys.exit(1)
now = datetime.now()
logformat = re.compile('(\d{4}-\d\d-\d\d \d\d:\d\d:\d\... | Add in script to track new account activity | Add in script to track new account activity
| Python | apache-2.0 | drostron/quasar,slamdata/slamengine,djspiewak/quasar,slamdata/slamengine,drostron/quasar,slamdata/slamengine,drostron/quasar,quasar-analytics/quasar,quasar-analytics/quasar,slamdata/quasar,jedesah/Quasar,jedesah/Quasar,quasar-analytics/quasar,jedesah/Quasar,jedesah/Quasar,quasar-analytics/quasar,drostron/quasar | ---
+++
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+
+from datetime import datetime
+from pymongo import MongoClient
+import re
+from subprocess import call
+import sys
+
+# minutes
+window = 30
+
+if len(sys.argv) != 2:
+ print 'Usage: %s <logfile>' % sys.argv[0]
+ sys.exit(1)
+
+now = datetime.now()
+
+logformat... | |
ee54f0ca3317b6f2119f15d42a7dd8d42d4f8059 | standup/test_settings.py | standup/test_settings.py | from standup.settings import *
DATABASE_URL = 'sqlite://'
| from standup.settings import *
# This looks wrong, but actually, it's an in-memory db uri
# and it causes our tests to run super fast!
DATABASE_URL = 'sqlite://'
| Add comment of vital importance | Add comment of vital importance
This bumps me up another shade of green! Yay!
| Python | bsd-3-clause | safwanrahman/standup,rehandalal/standup,willkg/standup,rlr/standup,rehandalal/standup,rlr/standup,mozilla/standup,rlr/standup,safwanrahman/standup,mozilla/standup,willkg/standup,willkg/standup,safwanrahman/standup,willkg/standup,safwanrahman/standup,mozilla/standup,rehandalal/standup,mozilla/standup | ---
+++
@@ -1,3 +1,5 @@
from standup.settings import *
+# This looks wrong, but actually, it's an in-memory db uri
+# and it causes our tests to run super fast!
DATABASE_URL = 'sqlite://' |
23289be44808baf78c01acb93761f661c0908022 | scripts/retranslate_models.py | scripts/retranslate_models.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-06-04 09:55
from __future__ import unicode_literals
from django.db import connection
from django.utils.translation import activate, _trans, ugettext as _
from tenant_extras.middleware import tenant_translation
from bluebottle.clients.utils import LocalTenan... | Add script that re-translates models | Add script that re-translates models
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | ---
+++
@@ -0,0 +1,31 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.8 on 2018-06-04 09:55
+from __future__ import unicode_literals
+
+from django.db import connection
+from django.utils.translation import activate, _trans, ugettext as _
+
+from tenant_extras.middleware import tenant_translation
+from bluebo... | |
1734198f0471c55dd872e14b31ce59b98baf576f | violations/tests/test_py_unittest.py | violations/tests/test_py_unittest.py | from django.test import TestCase
from tasks.const import STATUS_SUCCESS, STATUS_FAILED
from ..py_unittest import py_unittest_violation
from .base import get_content
class PyUnittestViolationCase(TestCase):
"""Python unittest violation case"""
def test_success(self):
"""Test success result"""
... | Add py unittest violation case | Add py unittest violation case
| Python | mit | nvbn/coviolations_web,nvbn/coviolations_web | ---
+++
@@ -0,0 +1,30 @@
+from django.test import TestCase
+from tasks.const import STATUS_SUCCESS, STATUS_FAILED
+from ..py_unittest import py_unittest_violation
+from .base import get_content
+
+
+class PyUnittestViolationCase(TestCase):
+ """Python unittest violation case"""
+
+ def test_success(self):
+ ... | |
758e2777310935083760dfb50e97062a93214720 | tests/changes/api/test_auth_index.py | tests/changes/api/test_auth_index.py | from changes.testutils import APITestCase
class AuthIndexTest(APITestCase):
path = '/api/0/auth/'
def test_anonymous(self):
resp = self.client.get(self.path)
assert resp.status_code == 200
data = self.unserialize(resp)
assert data['authenticated'] is False
def test_authen... | Add tests for auth index | Add tests for auth index
| Python | apache-2.0 | dropbox/changes,bowlofstew/changes,bowlofstew/changes,dropbox/changes,dropbox/changes,dropbox/changes,wfxiang08/changes,wfxiang08/changes,wfxiang08/changes,bowlofstew/changes,bowlofstew/changes,wfxiang08/changes | ---
+++
@@ -0,0 +1,23 @@
+from changes.testutils import APITestCase
+
+
+class AuthIndexTest(APITestCase):
+ path = '/api/0/auth/'
+
+ def test_anonymous(self):
+ resp = self.client.get(self.path)
+ assert resp.status_code == 200
+ data = self.unserialize(resp)
+ assert data['authent... | |
1f2cee72bfec767e0dcdc37b86c8ab745d2b4544 | project/api/migrations/0017_auto_20180331_1322.py | project/api/migrations/0017_auto_20180331_1322.py | # Generated by Django 2.0.3 on 2018-03-31 20:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0016_auto_20180328_0601'),
]
operations = [
migrations.AlterField(
model_name='office',
name='code',
... | Add candidate status to DB field | Add candidate status to DB field
| Python | bsd-2-clause | dbinetti/barberscore-django,barberscore/barberscore-api,barberscore/barberscore-api,dbinetti/barberscore,dbinetti/barberscore-django,barberscore/barberscore-api,barberscore/barberscore-api,dbinetti/barberscore | ---
+++
@@ -0,0 +1,18 @@
+# Generated by Django 2.0.3 on 2018-03-31 20:22
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('api', '0016_auto_20180328_0601'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='o... | |
ad3dbee189ac900baf3a84f3b0e843d202f369f8 | tests/unit/test_test_module_names.py | tests/unit/test_test_module_names.py | # -*- coding: utf-8 -*-
'''
tests.unit.doc_test
~~~~~~~~~~~~~~~~~~~~
'''
# Import Python libs
from __future__ import absolute_import
import os
# Import Salt Testing libs
from salttesting import TestCase
# Import Salt libs
import integration
EXCLUDED_DIRS = [
'tests/pkg',
'tests/perf',
'tests/un... | Add test case to make sure we always proper test module names from now on | Add test case to make sure we always proper test module names from now on
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,84 @@
+# -*- coding: utf-8 -*-
+'''
+ tests.unit.doc_test
+ ~~~~~~~~~~~~~~~~~~~~
+'''
+
+# Import Python libs
+from __future__ import absolute_import
+import os
+
+# Import Salt Testing libs
+from salttesting import TestCase
+
+
+# Import Salt libs
+import integration
+
+EXCLUDED_DIRS = [
+ ... | |
75942935696a7aee2ee16013fc7341728fb8f18d | __init__.py | __init__.py | """
This file is part of library PyRandLib.
It is provided under MIT License.
Please see files README.md and LICENSE.
Copyright (c) 2017 Philippe Schmouker
"""
from .baselcg import BaseLCG
from .baselfib64 import BaseLFib64
from .basemrg import BaseMRG
from .baserandom import BaseRandom
from .fa... | Package init module now added. | Package init module now added.
| Python | mit | schmouk/PyRandLib | ---
+++
@@ -0,0 +1,21 @@
+"""
+This file is part of library PyRandLib.
+It is provided under MIT License.
+Please see files README.md and LICENSE.
+
+Copyright (c) 2017 Philippe Schmouker
+"""
+
+from .baselcg import BaseLCG
+from .baselfib64 import BaseLFib64
+from .basemrg import BaseMRG
+from .ba... | |
5ddbb8dd77c4be14cc459640324d449850984d3b | zou/app/utils/api.py | zou/app/utils/api.py | from flask_restful import Api, output_json
def configure_api_from_blueprint(blueprint, route_tuples):
api = Api(blueprint, catch_all_404s=True)
api.representations = {
'application/json; charset=utf-8': output_json,
'application/json': output_json,
}
for route_tuple in route_tuples:
... | Add utils to manage blueprints | Add utils to manage blueprints
| Python | agpl-3.0 | cgwire/zou | ---
+++
@@ -0,0 +1,16 @@
+from flask_restful import Api, output_json
+
+
+def configure_api_from_blueprint(blueprint, route_tuples):
+ api = Api(blueprint, catch_all_404s=True)
+
+ api.representations = {
+ 'application/json; charset=utf-8': output_json,
+ 'application/json': output_json,
+ }
+... | |
cb1fe63325ec06d2c0ec94ac605e32d48ea8c8db | scripts/estad_semana.py | scripts/estad_semana.py | # -*- coding:utf-8 -*-
import valoratweets
import mongoengine
from tweemanager.tweetdocument import TweetDocument
import pprint
import re
import datetime as dt
from bson import json_util as json
mongoengine.connect(host="mongodb://192.168.80.221:27017/tweets")
cosas = TweetDocument._get_collection().aggregate(
[
{... | Add script for counting valorated tweets per week | Add script for counting valorated tweets per week
| Python | agpl-3.0 | nfqsolutions/tweemanager | ---
+++
@@ -0,0 +1,44 @@
+# -*- coding:utf-8 -*-
+
+import valoratweets
+import mongoengine
+from tweemanager.tweetdocument import TweetDocument
+import pprint
+import re
+import datetime as dt
+from bson import json_util as json
+
+
+mongoengine.connect(host="mongodb://192.168.80.221:27017/tweets")
+
+cosas = TweetD... | |
99e52824426195d1f23a72c04b900d2aed2946c9 | home/migrations/0019_auto_20190319_1438.py | home/migrations/0019_auto_20190319_1438.py | # Generated by Django 2.0.13 on 2019-03-19 14:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0018_auto_20171005_0247'),
]
operations = [
migrations.AlterField(
model_name='formfield',
name='field_type... | Make migrations for Wagtail 2.3 | Make migrations for Wagtail 2.3
This commit is the result of running
```
docker-compose exec django /bin/bash -c "./manage.py makemigrations"
```
| Python | agpl-3.0 | freedomofpress/securethenews,freedomofpress/securethenews,freedomofpress/securethenews,freedomofpress/securethenews | ---
+++
@@ -0,0 +1,18 @@
+# Generated by Django 2.0.13 on 2019-03-19 14:38
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('home', '0018_auto_20171005_0247'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name=... | |
e0651992608e08204b3812b3e8a30f235157c780 | gnome_terminal_tabs.py | gnome_terminal_tabs.py | #!/usr/bin/env python
"""
Run a command on multiple servers via SSH, each in a GNOME Terminal tab.
See http://exyr.org/2011/gnome-terminal-tabs/
"""
import subprocess
command = 'sudo aptitude update && sudo aptitude safe-upgrade'
terminal = ['gnome-terminal']
for host in ('cartonbox', 'hako'):
termina... | Add GNOME Terminal tabs script. | Add GNOME Terminal tabs script.
| Python | bsd-3-clause | SimonSapin/snippets,SimonSapin/snippets | ---
+++
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+"""
+ Run a command on multiple servers via SSH, each in a GNOME Terminal tab.
+ See http://exyr.org/2011/gnome-terminal-tabs/
+"""
+
+import subprocess
+
+command = 'sudo aptitude update && sudo aptitude safe-upgrade'
+terminal = ['gnome-terminal']
+for host... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.