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 |
|---|---|---|---|---|---|---|---|---|---|---|
839db09465562e80a9d5612a0fba3a779e99eeb0 | postgres/forms/interval_field.py | postgres/forms/interval_field.py | import datetime
import re
from django import forms
INTERVAL_RE = re.compile(
r'^((?P<days>\d+) days)?,?\W*'
r'((?P<hours>\d\d?)(:(?P<minutes>\d\d)(:(?P<seconds>\d\d))?)?)?'
)
def build_interval(data):
match = INTERVAL_RE.match(data)
if match:
return datetime.timedelta(**dict(
(key... | Add an INTERVAL form field. | Add an INTERVAL form field.
| Python | bsd-3-clause | wlanslovenija/django-postgres | ---
+++
@@ -0,0 +1,23 @@
+import datetime
+import re
+
+from django import forms
+
+INTERVAL_RE = re.compile(
+ r'^((?P<days>\d+) days)?,?\W*'
+ r'((?P<hours>\d\d?)(:(?P<minutes>\d\d)(:(?P<seconds>\d\d))?)?)?'
+)
+
+def build_interval(data):
+ match = INTERVAL_RE.match(data)
+ if match:
+ return da... | |
87a316584c20c3a6589156ad304e9e81f784d726 | libtaxii/test/to_text_11_test.py | libtaxii/test/to_text_11_test.py |
import unittest
import os
import glob
import libtaxii.messages_11 as tm11
import libtaxii.taxii_default_query as tdq
# from libtaxii.validation import SchemaValidator
class To_text_11_test(unittest.TestCase):
input_path = os.path.join('input','1.1')
output_path = os.path.join('output','1.1')
def test_to... | Test to parse & serialize test documents to XML and text. | Test to parse & serialize test documents to XML and text. | Python | bsd-3-clause | stkyle/libtaxii,Intelworks/libtaxii,TAXIIProject/libtaxii | ---
+++
@@ -0,0 +1,45 @@
+
+import unittest
+import os
+import glob
+import libtaxii.messages_11 as tm11
+import libtaxii.taxii_default_query as tdq
+# from libtaxii.validation import SchemaValidator
+
+class To_text_11_test(unittest.TestCase):
+ input_path = os.path.join('input','1.1')
+ output_path = os.path... | |
ff8e52beb234fdd7050206b33bb4728512688b65 | python/itertools/combinations.py | python/itertools/combinations.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Jérémie DECOCK (http://www.jdhp.org)
# 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 witho... | Add a snippet (Python itertools). | Add a snippet (Python itertools).
| 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,39 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2012 Jérémie DECOCK (http://www.jdhp.org)
+
+# 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 w... | |
f6dd79b19f5cf63c32db1d07bc1712185a6cbb6d | tests/api/test_lifecycle.py | tests/api/test_lifecycle.py | class TestShutdown:
async def test(self, mocker, monkeypatch, do_get):
"""
Test that a ``GET /api/lifecycle/shutdown`` results in :meth:`aiohttp.web.Application.shutdown` being called on
the Virtool application object. We check this be seeing if
"""
await do_get.init_clien... | Test the lifecycle shutdown API endpoint | Test the lifecycle shutdown API endpoint
| Python | mit | virtool/virtool,igboyes/virtool,igboyes/virtool,virtool/virtool | ---
+++
@@ -0,0 +1,40 @@
+class TestShutdown:
+
+ async def test(self, mocker, monkeypatch, do_get):
+ """
+ Test that a ``GET /api/lifecycle/shutdown`` results in :meth:`aiohttp.web.Application.shutdown` being called on
+ the Virtool application object. We check this be seeing if
+
+ ... | |
25210e9fd08b24f3eb9a6f661ac3c060fcb6e43e | tests/test_build_failure.py | tests/test_build_failure.py | """Tests for handling failed builds"""
from dxr.testing import SingleFileTestCase, CommandFailure
class BuildFailureTests(SingleFileTestCase):
source = r"""A bunch of garbage"""
@classmethod
def setup_class(cls):
"""Make sure a failed build returns a non-zero status code."""
try:
... | Add a test that proves build_instance raises an exception if `make` (etc.) fails. | Add a test that proves build_instance raises an exception if `make` (etc.) fails.
From here, it's trivial to observe that dxr-build.py itself exits with a non-zero status code on build failure. Thus, our spurious deployment of a new instance even after the moz-central build failed must be the fault of a calling shell ... | Python | mit | pelmers/dxr,kleintom/dxr,jbradberry/dxr,gartung/dxr,jay-z007/dxr,pombredanne/dxr,KiemVM/Mozilla--dxr,pelmers/dxr,pombredanne/dxr,KiemVM/Mozilla--dxr,KiemVM/Mozilla--dxr,bozzmob/dxr,srenatus/dxr,srenatus/dxr,jbradberry/dxr,erikrose/dxr,pombredanne/dxr,gartung/dxr,nrc/dxr,nrc/dxr,kleintom/dxr,nrc/dxr,jay-z007/dxr,nrc/dxr... | ---
+++
@@ -0,0 +1,20 @@
+"""Tests for handling failed builds"""
+
+from dxr.testing import SingleFileTestCase, CommandFailure
+
+
+class BuildFailureTests(SingleFileTestCase):
+ source = r"""A bunch of garbage"""
+
+ @classmethod
+ def setup_class(cls):
+ """Make sure a failed build returns a non-zer... | |
6a56d00b409798fbeccf84e940847b6e2705bfdf | app/soc/modules/gci/logic/profile.py | app/soc/modules/gci/logic/profile.py | #!/usr/bin/env python2.5
#
# Copyright 2011 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | Implement a method that fetches all the mentors for a given organization. | Implement a method that fetches all the mentors for a given organization.
| Python | apache-2.0 | rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son | ---
+++
@@ -0,0 +1,49 @@
+#!/usr/bin/env python2.5
+#
+# Copyright 2011 the Melange authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICEN... | |
489dd26fd22c3e7820cf74d1582adfcff050a8bb | test/test_packages.py | test/test_packages.py | import pytest
@pytest.mark.parametrize("name", [
("bash-completion"),
("bind-utils"),
("bridge-utils"),
("docker"),
("epel-release"),
("git"),
("iptables-services"),
("libnfsidmap"),
("net-tools"),
("nfs-utils"),
("pyOpenSSL"),
("screen"),
("strace"),
("tcpdump"),
("wget"),
])
def test_p... | Add test for installed packages | Add test for installed packages
| Python | mit | wicksy/vagrant-openshift,wicksy/vagrant-openshift,wicksy/vagrant-openshift | ---
+++
@@ -0,0 +1,22 @@
+import pytest
+
+@pytest.mark.parametrize("name", [
+ ("bash-completion"),
+ ("bind-utils"),
+ ("bridge-utils"),
+ ("docker"),
+ ("epel-release"),
+ ("git"),
+ ("iptables-services"),
+ ("libnfsidmap"),
+ ("net-tools"),
+ ("nfs-utils"),
+ ("pyOpenSSL"),
+ ("screen"),
+ ("strace")... | |
cce6e292631d795a1d73fba8252f06b654d2f8fe | tests/test_timer.py | tests/test_timer.py | # -*- coding: utf-8 -*-
"""
tests.test_timer
~~~~~~~~~~~~~~~~~~~~~
"""
import time
import re
from yaspin import yaspin
def test_no_timer():
sp = yaspin(timer=False)
sp._freeze("")
assert re.search(r"\(\d+:\d{2}:\d{2}\)", sp._last_frame) is None
def test_timer_idle():
sp = yaspin(timer=True)
... | Add tests for timer functionality | Add tests for timer functionality
| Python | mit | pavdmyt/yaspin | ---
+++
@@ -0,0 +1,67 @@
+# -*- coding: utf-8 -*-
+
+"""
+tests.test_timer
+~~~~~~~~~~~~~~~~~~~~~
+
+"""
+
+import time
+import re
+
+from yaspin import yaspin
+
+
+def test_no_timer():
+ sp = yaspin(timer=False)
+ sp._freeze("")
+
+ assert re.search(r"\(\d+:\d{2}:\d{2}\)", sp._last_frame) is None
+
+
+def t... | |
a1fd670f25141b176d276514adbce6e110b49e38 | comics/crawlers/slagoon.py | comics/crawlers/slagoon.py | from comics.crawler.base import BaseComicCrawler
from comics.crawler.meta import BaseComicMeta
class ComicMeta(BaseComicMeta):
name = "Sherman's Lagoon"
language = 'en'
url = 'http://www.slagoon.com/'
start_date = '1991-05-13'
history_capable_days = 32
schedule = 'Mo,Tu,We,Th,Fr,Sa,Su'
time... | Add crawler for 'Sherman's Lagoon' | Add crawler for 'Sherman's Lagoon'
| Python | agpl-3.0 | jodal/comics,jodal/comics,klette/comics,datagutten/comics,datagutten/comics,jodal/comics,datagutten/comics,klette/comics,klette/comics,datagutten/comics,jodal/comics | ---
+++
@@ -0,0 +1,18 @@
+from comics.crawler.base import BaseComicCrawler
+from comics.crawler.meta import BaseComicMeta
+
+class ComicMeta(BaseComicMeta):
+ name = "Sherman's Lagoon"
+ language = 'en'
+ url = 'http://www.slagoon.com/'
+ start_date = '1991-05-13'
+ history_capable_days = 32
+ sched... | |
ceea7edd9162e9a834be8888fea18dcd0da43561 | test/test_rendering_dot_files.py | test/test_rendering_dot_files.py | from __future__ import division
from __future__ import print_function
import glob
import os
import subprocess
import sys
from hashlib import sha256
import pydot_ng as pydot
PY3 = not sys.version_info < (3, 0, 0)
if PY3:
NULL_SEP = b''
xrange = range
else:
NULL_SEP = ''
bytes = str
DOT_BINARY_PATH =... | Add testing regressions of pydot vs graphviz | Add testing regressions of pydot vs graphviz
| Python | mit | pydot/pydot-ng | ---
+++
@@ -0,0 +1,90 @@
+from __future__ import division
+from __future__ import print_function
+
+import glob
+import os
+import subprocess
+import sys
+from hashlib import sha256
+
+import pydot_ng as pydot
+
+PY3 = not sys.version_info < (3, 0, 0)
+
+if PY3:
+ NULL_SEP = b''
+ xrange = range
+else:
+ NUL... | |
bc21a64589535a3ed5689ff04f826893d45f4c45 | pygraphc/abstraction/mymethod.py | pygraphc/abstraction/mymethod.py |
class MyMethod(object):
def __init__(self, graph, clusters):
self.graph = graph
self.clusters = clusters
self.count_partitions = {}
def __get_count(self):
abstraction = []
for cluster_id, nodes in self.clusters.iteritems():
if len(nodes) > 1:
... | Add new method for abstraction | Add new method for abstraction
| Python | mit | studiawan/pygraphc | ---
+++
@@ -0,0 +1,25 @@
+
+class MyMethod(object):
+ def __init__(self, graph, clusters):
+ self.graph = graph
+ self.clusters = clusters
+ self.count_partitions = {}
+
+ def __get_count(self):
+ abstraction = []
+ for cluster_id, nodes in self.clusters.iteritems():
+ ... | |
21004e02d9aa43bdfe1d3412a9b92f16e9ecc0f1 | salt/states/influxdb_database.py | salt/states/influxdb_database.py | # -*- coding: utf-8 -*-
'''
Management of Influxdb databases
================================
(compatible with InfluxDB version 0.9+)
'''
def __virtual__():
'''
Only load if the influxdb module is available
'''
if 'influxdb.db_exists' in __salt__:
return 'influxdb_database'
return False
... | Add state module to manage InfluxDB databases | Add state module to manage InfluxDB databases
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,76 @@
+# -*- coding: utf-8 -*-
+'''
+Management of Influxdb databases
+================================
+
+(compatible with InfluxDB version 0.9+)
+'''
+
+
+def __virtual__():
+ '''
+ Only load if the influxdb module is available
+ '''
+ if 'influxdb.db_exists' in __salt__:
+ ret... | |
0f38f94a283914d6aca289f8020e1c6a0551c4ee | plugins/ping_pong.py | plugins/ping_pong.py | """
# Config (valid YAML document) must be at __doc__.
name: ping_pong # Name of plugin, lowercase, match with
# file or package name.
description: "Example plugin for testing bot."
config: # Config variable that needed to set
- SHELDON_PING_PONG_REPLY: '>>>' # in environmen... | Add plugin for bot testing | Add plugin for bot testing
| Python | mit | lises/sheldon | ---
+++
@@ -0,0 +1,16 @@
+"""
+# Config (valid YAML document) must be at __doc__.
+name: ping_pong # Name of plugin, lowercase, match with
+ # file or package name.
+description: "Example plugin for testing bot."
+config: # Config variable that needed to set
+ - SHELDON_PING... | |
7ad8c853854395e34afe99a3b670596a27734e66 | suq1/rankeditems.py | suq1/rankeditems.py | # -*- coding: utf-8 -*-
# Suq1 -- An ad hoc Python toolbox for a web service
# By: Emmanuel Raviart <emmanuel@raviart.com>
#
# Copyright (C) 2009, 2010, 2011, 2012 Easter-eggs & Emmanuel Raviart
# Copyright (C) 2013, 2014 Easter-eggs, Etalab & Emmanuel Raviart
# https://github.com/eraviart/suq1
#
# This file is part ... | Add module to handle ranked items (for Condorcet-Schulze voting method). | Add module to handle ranked items (for Condorcet-Schulze voting method).
| Python | agpl-3.0 | plastic-data/suq1 | ---
+++
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+
+
+# Suq1 -- An ad hoc Python toolbox for a web service
+# By: Emmanuel Raviart <emmanuel@raviart.com>
+#
+# Copyright (C) 2009, 2010, 2011, 2012 Easter-eggs & Emmanuel Raviart
+# Copyright (C) 2013, 2014 Easter-eggs, Etalab & Emmanuel Raviart
+# https://github.com/... | |
951711b6c3e792de56b23423627a5f6faefe3353 | python/FresStream.py | python/FresStream.py | import threading
import time
from functools import partial
from queue import Empty
import msgpack
import zmq
import infupy.backends.fresenius as fresenius
zmqhost = '127.0.0.1'
zmqport = 4201
freseniusport = 'COM5'
def stateWorker(stopevent):
context = zmq.Context()
zmqsocket = context.socket(zmq.PUB)
c... | Add python script that uses the infupy library and streams to zmq | Add python script that uses the infupy library and streams to zmq
| Python | isc | jaj42/hsmedstream,jaj42/phystream | ---
+++
@@ -0,0 +1,85 @@
+import threading
+import time
+from functools import partial
+from queue import Empty
+
+import msgpack
+import zmq
+
+import infupy.backends.fresenius as fresenius
+
+zmqhost = '127.0.0.1'
+zmqport = 4201
+freseniusport = 'COM5'
+
+def stateWorker(stopevent):
+ context = zmq.Context()
+ ... | |
a044a49b019f369aa5738e13004060a2e7d2a01c | evdemo/server/conf/connection_settings.py | evdemo/server/conf/connection_settings.py | # This file is auto-generated by the `evennia connections` wizard.
# Don't edit manually, your changes will be overwritten.
GAME_INDEX_ENABLED = True
GAME_INDEX_LISTING = \
{ 'game_status': 'launched',
'game_website': 'https://demo.evennia.com',
'listing_contact': 'a@a.com',
'long_description': 'The Even... | Add demo connection setting to git | Add demo connection setting to git
| Python | bsd-3-clause | evennia/evdemo | ---
+++
@@ -0,0 +1,22 @@
+# This file is auto-generated by the `evennia connections` wizard.
+# Don't edit manually, your changes will be overwritten.
+
+GAME_INDEX_ENABLED = True
+GAME_INDEX_LISTING = \
+{ 'game_status': 'launched',
+ 'game_website': 'https://demo.evennia.com',
+ 'listing_contact': 'a@a.com'... | |
5c08f299c0022a2d94c77dbe9f91a5fb3dec5b4d | CASA_tools/casa_tools/mytools.py | CASA_tools/casa_tools/mytools.py |
'''
Define my own version of CASA tools that return python errors if they fail.
'''
from tasks import split, uvsub, concat, clean, rmtables
from .graceful_error_catch import catch_fail
def mysplit(**kwargs):
return catch_fail(split, **kwargs)
def myuvsub(**kwargs):
return catch_fail(uvsub, **kwargs)
de... | Define casa tasks that fail with python errors | Define casa tasks that fail with python errors
| Python | mit | e-koch/VLA_Lband,e-koch/VLA_Lband | ---
+++
@@ -0,0 +1,28 @@
+
+'''
+Define my own version of CASA tools that return python errors if they fail.
+'''
+
+from tasks import split, uvsub, concat, clean, rmtables
+
+from .graceful_error_catch import catch_fail
+
+
+def mysplit(**kwargs):
+ return catch_fail(split, **kwargs)
+
+
+def myuvsub(**kwargs):
+... | |
f7a53f7dc09e44fd40367c7c973372314a476912 | ideascube/conf/kb_gin_conakry.py | ideascube/conf/kb_gin_conakry.py | # -*- coding: utf-8 -*-
"""KoomBook conf"""
from .kb import * # noqa
LANGUAGE_CODE = 'fr'
IDEASCUBE_NAME = 'CONAKRY'
HOME_CARDS = STAFF_HOME_CARDS + [
{
'id': 'koombookedu',
},
{
'id': 'bsfcampus',
},
]
| Add conf file for Conakry devices | Add conf file for Conakry devices
| Python | agpl-3.0 | ideascube/ideascube,ideascube/ideascube,ideascube/ideascube,ideascube/ideascube | ---
+++
@@ -0,0 +1,14 @@
+# -*- coding: utf-8 -*-
+"""KoomBook conf"""
+from .kb import * # noqa
+
+LANGUAGE_CODE = 'fr'
+IDEASCUBE_NAME = 'CONAKRY'
+HOME_CARDS = STAFF_HOME_CARDS + [
+ {
+ 'id': 'koombookedu',
+ },
+ {
+ 'id': 'bsfcampus',
+ },
+] | |
bed17c14920fdc2c4e1d9413da4188a64fc4352e | test_atmospheres.py | test_atmospheres.py | # coding: utf-8
""" Test the model atmosphere interpolator """
__author__ = "Andy Casey <andy@astrowizici.st>"
import os
import logging
import numpy as np
import matplotlib.pyplot as plt
from atmosphere import AtmosphereInterpolator as atmospheres, \
parsers
atmosphere_type = "MARCS (20... | Test MARCS model atmosphere interpolator | Test MARCS model atmosphere interpolator
| Python | mit | andycasey/precise-objective-differential-spectroscopy | ---
+++
@@ -0,0 +1,57 @@
+# coding: utf-8
+
+""" Test the model atmosphere interpolator """
+
+__author__ = "Andy Casey <andy@astrowizici.st>"
+
+import os
+import logging
+
+import numpy as np
+import matplotlib.pyplot as plt
+
+from atmosphere import AtmosphereInterpolator as atmospheres, \
+ ... | |
9267d2c83087bb8a570109b60d3517abb8fc66cf | tests/test_reset.py | tests/test_reset.py | #!/usr/bin/python
import sys
import pycurl
saw_error = 1
def main():
global saw_error
pycurl.global_init(pycurl.GLOBAL_DEFAULT)
outf = file("/dev/null", "rb+")
cm = pycurl.CurlMulti()
# Set multi handle's options
cm.setopt(pycurl.M_PIPELINING, 1)
eh = pycur... | Test for reset fixes refcount bug | Test for reset fixes refcount bug
| Python | lgpl-2.1 | pycurl/pycurl,p/pycurl-archived,pycurl/pycurl,pycurl/pycurl,p/pycurl-archived,p/pycurl-archived | ---
+++
@@ -0,0 +1,75 @@
+#!/usr/bin/python
+
+import sys
+import pycurl
+
+saw_error = 1
+
+def main():
+ global saw_error
+
+ pycurl.global_init(pycurl.GLOBAL_DEFAULT)
+
+ outf = file("/dev/null", "rb+")
+ cm = pycurl.CurlMulti()
+
+ # Set multi handle's options
+ cm.setopt... | |
f9ff15636a62a8ca0f7872874721d42019af7e9c | tests/unit_tests.py | tests/unit_tests.py | __author__ = 'Michael'
from src import PClass
# Test for bias addition and correctness of range in init function
testClass = PClass(3)
assert testClass.weightList.size() == 4
for x in range(0, testClass.numInputs):
assert -1 <= testClass.weightList[x] & testClass.weightList[x] <= 1
| Create initial tests for code maintenance | Create initial tests for code maintenance
| Python | mit | michaellee1/ANN-PCML | ---
+++
@@ -0,0 +1,9 @@
+__author__ = 'Michael'
+
+from src import PClass
+
+# Test for bias addition and correctness of range in init function
+testClass = PClass(3)
+assert testClass.weightList.size() == 4
+for x in range(0, testClass.numInputs):
+ assert -1 <= testClass.weightList[x] & testClass.weightList[x] <... | |
06a12ada48c11a101eb138220cd0e0ca33a612be | tests/thread/stress_create.py | tests/thread/stress_create.py | # stress test for creating many threads
try:
import utime as time
except ImportError:
import time
import _thread
def thread_entry(n):
pass
thread_num = 0
while thread_num < 500:
try:
_thread.start_new_thread(thread_entry, (thread_num,))
thread_num += 1
except MemoryError:
... | Add stress-test for creating many threads. | tests/thread: Add stress-test for creating many threads.
| Python | mit | TDAbboud/micropython,Timmenem/micropython,deshipu/micropython,SHA2017-badge/micropython-esp32,alex-robbins/micropython,tobbad/micropython,lowRISC/micropython,oopy/micropython,deshipu/micropython,bvernoux/micropython,puuu/micropython,infinnovation/micropython,trezor/micropython,adafruit/micropython,oopy/micropython,trez... | ---
+++
@@ -0,0 +1,22 @@
+# stress test for creating many threads
+
+try:
+ import utime as time
+except ImportError:
+ import time
+import _thread
+
+def thread_entry(n):
+ pass
+
+thread_num = 0
+while thread_num < 500:
+ try:
+ _thread.start_new_thread(thread_entry, (thread_num,))
+ threa... | |
f2b261ea7af982653dfb3057b98e3b917c72b7a4 | test/test_simple_module_pass.py | test/test_simple_module_pass.py | import sys, unittest
from tools import SamplesTestCase
OUTPUT_FOR_GLOBALS = '''\
Found global named "gfloat": type = float*
Found global named "gppfloat": type = float***
Found global named "gint": type = i32*
'''
PROG = 'simple_module_pass'
class TestSimpleModulePass(SamplesTestCase):
def test_on_globals(self)... | Add a test for simple_module_pass | Add a test for simple_module_pass
| Python | unlicense | eliben/llvm-clang-samples,eliben/llvm-clang-samples,eliben/llvm-clang-samples,eliben/llvm-clang-samples,eliben/llvm-clang-samples,eliben/llvm-clang-samples | ---
+++
@@ -0,0 +1,19 @@
+import sys, unittest
+from tools import SamplesTestCase
+
+
+OUTPUT_FOR_GLOBALS = '''\
+Found global named "gfloat": type = float*
+Found global named "gppfloat": type = float***
+Found global named "gint": type = i32*
+'''
+
+PROG = 'simple_module_pass'
+
+class TestSimpleModulePass(Samples... | |
39646d3a7f3f8539dcb88ae9f79e57a3ad79a9f7 | monasca_setup/detection/plugins/octavia.py | monasca_setup/detection/plugins/octavia.py | # (C) Copyright 2016 Hewlett Packard Enterprise Development Company LP
# 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/licens... | Add process monitoring for Octavia | Add process monitoring for Octavia
This change creates a octavia detection plugin and adds process
monitoring for octavia-api, octavia-worker, octavia-health-manager
and octavia-housekeeping processes.
Change-Id: I71411c640713ac0ab2b3bbb332dfab064b08379b
| Python | bsd-3-clause | sapcc/monasca-agent,sapcc/monasca-agent,sapcc/monasca-agent | ---
+++
@@ -0,0 +1,37 @@
+# (C) Copyright 2016 Hewlett Packard Enterprise Development Company LP
+# 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
+#
+# ... | |
0228ccc1a635408c3d4a27f27ac851b4d89b72b2 | takeyourmeds/reminders/reminders_calls/tests.py | takeyourmeds/reminders/reminders_calls/tests.py | from takeyourmeds.utils.test import TestCase
from ..enums import TypeEnum, SourceEnum
from .enums import StateEnum
class TwimlCallbackTest(TestCase):
def setUp(self):
super(TwimlCallbackTest, self).setUp()
self.call = self.user.reminders.create(
type=TypeEnum.call,
).instance... | Check we can create an url | Check we can create an url
| Python | mit | takeyourmeds/takeyourmeds-web,takeyourmeds/takeyourmeds-web,takeyourmeds/takeyourmeds-web,takeyourmeds/takeyourmeds-web | ---
+++
@@ -0,0 +1,18 @@
+from takeyourmeds.utils.test import TestCase
+
+from ..enums import TypeEnum, SourceEnum
+
+from .enums import StateEnum
+
+class TwimlCallbackTest(TestCase):
+ def setUp(self):
+ super(TwimlCallbackTest, self).setUp()
+
+ self.call = self.user.reminders.create(
+ ... | |
c06f653cb6763f1d1b64797aa48e65820652f981 | tests/alerts/test_open_port_violation.py | tests/alerts/test_open_port_violation.py | from positive_alert_test_case import PositiveAlertTestCase
from negative_alert_test_case import NegativeAlertTestCase
from alert_test_suite import AlertTestSuite
class TestAlertOpenPortViolation(AlertTestSuite):
alert_filename = "open_port_violation"
# This event is the default positive event that will caus... | Add unit-tests for open port violation alert | Add unit-tests for open port violation alert
| Python | mpl-2.0 | Phrozyn/MozDef,ameihm0912/MozDef,ameihm0912/MozDef,jeffbryner/MozDef,jeffbryner/MozDef,mpurzynski/MozDef,mozilla/MozDef,mozilla/MozDef,jeffbryner/MozDef,gdestuynder/MozDef,mozilla/MozDef,mozilla/MozDef,Phrozyn/MozDef,mpurzynski/MozDef,mpurzynski/MozDef,gdestuynder/MozDef,ameihm0912/MozDef,gdestuynder/MozDef,Phrozyn/Moz... | ---
+++
@@ -0,0 +1,84 @@
+from positive_alert_test_case import PositiveAlertTestCase
+from negative_alert_test_case import NegativeAlertTestCase
+
+from alert_test_suite import AlertTestSuite
+
+
+class TestAlertOpenPortViolation(AlertTestSuite):
+ alert_filename = "open_port_violation"
+
+ # This event is the ... | |
5314e142827016eed55c2a1c94faae853d2331e5 | tests/unit/modules/test_bigip.py | tests/unit/modules/test_bigip.py | # -*- coding: utf-8 -*-
"""
tests.unit.modules.test_bigip
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unit tests for the bigip module
"""
from __future__ import absolute_import, print_function, unicode_literals
import logging
import salt.modules.bigip as bigip
from tests.support.mixins import LoaderModuleMockMixin
from tests.suppo... | Add tests to validate that bigip module requests session verifies SSL | Add tests to validate that bigip module requests session verifies SSL
| Python | apache-2.0 | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | ---
+++
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+"""
+tests.unit.modules.test_bigip
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Unit tests for the bigip module
+"""
+from __future__ import absolute_import, print_function, unicode_literals
+import logging
+
+import salt.modules.bigip as bigip
+from tests.support.mixins import... | |
6852c9ee1ff9baf7ea21e5e0e11e8984a8315fba | glance/registry/db/migrate_repo/versions/004_add_checksum.py | glance/registry/db/migrate_repo/versions/004_add_checksum.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# 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/... | Add migration script for checksum column | Add migration script for checksum column | Python | apache-2.0 | akash1808/glance,jumpstarter-io/glance,cloudbau/glance,JioCloud/glance,tanglei528/glance,jumpstarter-io/glance,wkoathp/glance,paramite/glance,stevelle/glance,sigmavirus24/glance,cloudbau/glance,rajalokan/glance,redhat-openstack/glance,ozamiatin/glance,ntt-sic/glance,rickerc/glance_audit,darren-wang/gl,kfwang/Glance-OVA... | ---
+++
@@ -0,0 +1,80 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2011 OpenStack LLC.
+# 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... | |
371bb8f7d7a0f77e7f756ed691b5806a8da33326 | IPython/utils/tests/test_text.py | IPython/utils/tests/test_text.py | # encoding: utf-8
"""Tests for IPython.utils.text"""
#-----------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.... | Add failing test: columnize called with very long entries. | Add failing test: columnize called with very long entries.
Bug reported on-list.
| Python | bsd-3-clause | ipython/ipython,ipython/ipython | ---
+++
@@ -0,0 +1,30 @@
+# encoding: utf-8
+"""Tests for IPython.utils.text"""
+
+#-----------------------------------------------------------------------------
+# Copyright (C) 2011 The IPython Development Team
+#
+# Distributed under the terms of the BSD License. The full license is in
+# the file COPYING, di... | |
f8c26bb11a3d064902fd6bb70b9933861ce7fe1d | rest/httpUtils.py | rest/httpUtils.py | from django.http import HttpResponse
from rest_framework.renderers import JSONRenderer
# Initially taken from
# http://www.django-rest-framework.org/tutorial/1-serialization/
class JSONResponse(HttpResponse):
"""
An HttpResponse that renders its content into JSON.
"""
def __init__(self, data, **kwargs)... | Add one place to get JSONResponse from. | Add one place to get JSONResponse from.
| Python | apache-2.0 | CMPUT404W17T06/CMPUT404-project,CMPUT404W17T06/CMPUT404-project,CMPUT404W17T06/CMPUT404-project | ---
+++
@@ -0,0 +1,13 @@
+from django.http import HttpResponse
+from rest_framework.renderers import JSONRenderer
+
+# Initially taken from
+# http://www.django-rest-framework.org/tutorial/1-serialization/
+class JSONResponse(HttpResponse):
+ """
+ An HttpResponse that renders its content into JSON.
+ """
+ ... | |
5a27d230c92215594d909c49f22ff2ff592806c3 | gaphor/UML/tests/test_diagram.py | gaphor/UML/tests/test_diagram.py | import gaphas
import pytest
from gaphor.services.eventmanager import EventManager
from gaphor.UML import Diagram
from gaphor.UML.elementfactory import ElementFactory
from gaphor.UML.presentation import Presentation
class Example(Presentation, gaphas.Element):
def unlink(self):
self.test_unlinked = True
... | Add some extra tests for Diagram | Add some extra tests for Diagram
| Python | lgpl-2.1 | amolenaar/gaphor,amolenaar/gaphor | ---
+++
@@ -0,0 +1,52 @@
+import gaphas
+import pytest
+
+from gaphor.services.eventmanager import EventManager
+from gaphor.UML import Diagram
+from gaphor.UML.elementfactory import ElementFactory
+from gaphor.UML.presentation import Presentation
+
+
+class Example(Presentation, gaphas.Element):
+ def unlink(self... | |
0a1dbf4d891feda44b1fd45beb7bf59a5737f797 | dataportal/__init__.py | dataportal/__init__.py | import sys
import logging
from .sources import *
logger = logging.getLogger(__name__)
__version__ = 'v0.0.5.post0'
| import sys
import logging
from .sources import *
logger = logging.getLogger(__name__)
__version__ = 'v0.0.5.post0'
from .broker import DataBroker
from .muxer import DataMuxer
| Make DataBroker and DataMuxer top-level. | API: Make DataBroker and DataMuxer top-level.
| Python | bsd-3-clause | ericdill/databroker,danielballan/dataportal,ericdill/datamuxer,tacaswell/dataportal,NSLS-II/datamuxer,NSLS-II/dataportal,danielballan/datamuxer,danielballan/datamuxer,tacaswell/dataportal,danielballan/dataportal,ericdill/datamuxer,NSLS-II/dataportal,ericdill/databroker | ---
+++
@@ -5,3 +5,6 @@
logger = logging.getLogger(__name__)
__version__ = 'v0.0.5.post0'
+
+from .broker import DataBroker
+from .muxer import DataMuxer |
7d068af4cab1eeb9d7e4b78babb8216f60314f4f | portal/tests/test_views.py | portal/tests/test_views.py | from django.test import TestCase
from django.urls import reverse
# Create your tests here.
class HomeViewTestCase(TestCase):
"""HomeView test suite"""
expected_url = '/'
def test_desired_location(self):
resp = self.client.get(self.expected_url)
self.assertEqual(resp.status_code, 200)
... | Add view test cases for portal | Add view test cases for portal
| Python | mit | huangsam/chowist,huangsam/chowist,huangsam/chowist | ---
+++
@@ -0,0 +1,59 @@
+from django.test import TestCase
+from django.urls import reverse
+
+# Create your tests here.
+
+class HomeViewTestCase(TestCase):
+ """HomeView test suite"""
+
+ expected_url = '/'
+
+ def test_desired_location(self):
+ resp = self.client.get(self.expected_url)
+ sel... | |
26b9bc9547865c9b4ea654504adbee15f21ed633 | backend/populate_dionyziz.py | backend/populate_dionyziz.py | from string import ascii_lowercase
import django
import os
import string
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')
django.setup()
from breach.models import Target, Victim
endpoint = 'https://dionyziz.com/breach-test/reflect.php?ref=%s'
prefix = 'imper'
alphabet = ascii_lowercase
secretlengt... | Add population script for dionyziz | Add population script for dionyziz
| Python | mit | dimkarakostas/rupture,dionyziz/rupture,dimkarakostas/rupture,esarafianou/rupture,dimriou/rupture,dionyziz/rupture,dimriou/rupture,dionyziz/rupture,dimriou/rupture,dimriou/rupture,esarafianou/rupture,dimkarakostas/rupture,dimkarakostas/rupture,esarafianou/rupture,dimkarakostas/rupture,esarafianou/rupture,dimriou/rupture... | ---
+++
@@ -0,0 +1,38 @@
+from string import ascii_lowercase
+import django
+import os
+import string
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')
+django.setup()
+
+from breach.models import Target, Victim
+
+endpoint = 'https://dionyziz.com/breach-test/reflect.php?ref=%s'
+prefix = 'imper'... | |
a355a9f76add5b7b91b31b9e8b07c4f0fbc9ce3a | docs/examples/core/ipython-get-history.py | docs/examples/core/ipython-get-history.py | #!/usr/bin/env python
"""Extract a session from the IPython input history.
Usage:
ipython-get-history.py sessionnumber [outputfile]
If outputfile is not given, the relevant history is written to stdout. If
outputfile has a .py extension, the translated history (without IPython's
special syntax) will be extracted.
... | Add example script for extracting history from the database. | Add example script for extracting history from the database.
| Python | bsd-3-clause | ipython/ipython,ipython/ipython | ---
+++
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+"""Extract a session from the IPython input history.
+
+Usage:
+ ipython-get-history.py sessionnumber [outputfile]
+
+If outputfile is not given, the relevant history is written to stdout. If
+outputfile has a .py extension, the translated history (without IPython's
+... | |
64da0215068c789a0e5422e3829c3e876a6cc526 | scripts/osfstorage/repopulate_sha.py | scripts/osfstorage/repopulate_sha.py | import sys
import logging
from modularodm import Q
from website.app import init_app
from website.files.models import FileVersion
from scripts import utils as script_utils
from framework.transactions.context import TokuTransaction
logger = logging.getLogger(__name__)
def do_migration():
logger.info('Starting ... | Add a migration for repopulating sha256s of older osfstorage file versions | Add a migration for repopulating sha256s of older osfstorage file versions
| Python | apache-2.0 | kch8qx/osf.io,laurenrevere/osf.io,laurenrevere/osf.io,rdhyee/osf.io,haoyuchen1992/osf.io,HalcyonChimera/osf.io,pattisdr/osf.io,samanehsan/osf.io,brandonPurvis/osf.io,caneruguz/osf.io,TomHeatwole/osf.io,abought/osf.io,acshi/osf.io,leb2dg/osf.io,cslzchen/osf.io,Nesiehr/osf.io,zamattiac/osf.io,Ghalko/osf.io,mluke93/osf.io... | ---
+++
@@ -0,0 +1,46 @@
+import sys
+import logging
+from modularodm import Q
+
+from website.app import init_app
+from website.files.models import FileVersion
+
+from scripts import utils as script_utils
+
+from framework.transactions.context import TokuTransaction
+
+
+logger = logging.getLogger(__name__)
+
+
+def... | |
ee496c2e8e210124184a3b9b0e4be15dbbe1b01a | scripts/validate_schema.py | scripts/validate_schema.py | #!/usr/bin/env python
# Copyright 2017 Cargill Incorporated
#
# 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 requi... | Add script to validate table metadata values exist | Add script to validate table metadata values exist
| Python | apache-2.0 | Cargill/pipewrench,Cargill/pipewrench | ---
+++
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+# Copyright 2017 Cargill Incorporated
+#
+# 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/licen... | |
c405eb28fb15a7f2891f6630a550bf532d80494a | tests/GIR/test_401_workspace.py | tests/GIR/test_401_workspace.py | # coding=utf-8
import sys
import struct
import unittest
from test_000_config import TestConfig
from test_020_connection import TestConnection
from gi.repository import Midgard
from gi.repository import GObject
class TestWorkspace(unittest.TestCase):
mgd = None
manager = None
def setUp(self):
if self.mgd i... | Test workspace. Initial. Closes gh-181 | Test workspace. Initial. Closes gh-181
| Python | lgpl-2.1 | midgardproject/midgard-core,midgardproject/midgard-core,midgardproject/midgard-core,midgardproject/midgard-core | ---
+++
@@ -0,0 +1,72 @@
+# coding=utf-8
+
+import sys
+import struct
+import unittest
+from test_000_config import TestConfig
+from test_020_connection import TestConnection
+
+from gi.repository import Midgard
+from gi.repository import GObject
+
+class TestWorkspace(unittest.TestCase):
+ mgd = None
+ manager = N... | |
b70fe116d3652202ea9ccee63f255f8b39cd0ebf | src/commands/fedex.py | src/commands/fedex.py | import urllib
import webbrowser
import qmk
class FedexCommand(qmk.Command):
'''Use the Fedex website to view the tracking info for the given
tracking number.'''
def __init__(self):
self._name = 'fedex'
self._help = self.__doc__
self.__baseURL = 'http://www.fedex.com/Tracking' \
... | Add Fedex command for tracking packages. | Add Fedex command for tracking packages.
| Python | mit | kivhift/qmk,kivhift/qmk | ---
+++
@@ -0,0 +1,22 @@
+import urllib
+import webbrowser
+
+import qmk
+
+class FedexCommand(qmk.Command):
+ '''Use the Fedex website to view the tracking info for the given
+ tracking number.'''
+ def __init__(self):
+ self._name = 'fedex'
+ self._help = self.__doc__
+ self.__baseURL ... | |
f3e0f0340b146d7583ae4165549837497ea7a7b0 | scripts/get_bank_registry_cz.py | scripts/get_bank_registry_cz.py | import json
import csv
import requests
URL = "https://www.cnb.cz/cs/platebni-styk/.galleries/ucty_kody_bank/download/kody_bank_CR.csv"
registry = []
def process():
with requests.get(URL, stream=True) as csvfile:
count = 0
for row in csvfile.iter_lines():
if count != 0:
... | Add script to generate CZ bank bic codes registry | Add script to generate CZ bank bic codes registry
| Python | mit | figo-connect/schwifty | ---
+++
@@ -0,0 +1,34 @@
+import json
+import csv
+import requests
+
+URL = "https://www.cnb.cz/cs/platebni-styk/.galleries/ucty_kody_bank/download/kody_bank_CR.csv"
+
+
+registry = []
+
+
+def process():
+ with requests.get(URL, stream=True) as csvfile:
+ count = 0
+ for row in csvfile.iter_lines():... | |
975aa908d01129129c3e103643648aaab994f426 | tests/unit/test_question_answer.py | tests/unit/test_question_answer.py | import os
from tests import PMGTestCase
from tests.fixtures import (
dbfixture, CommitteeQuestionData
)
class TestQuestionAnswer(PMGTestCase):
def setUp(self):
super(TestQuestionAnswer, self).setUp()
self.fx = dbfixture.data(
CommitteeQuestionData,
)
self.fx.setup(... | Add unit test for minister_questions_combined api endpoint | Add unit test for minister_questions_combined api endpoint
| Python | apache-2.0 | Code4SA/pmg-cms-2,Code4SA/pmg-cms-2,Code4SA/pmg-cms-2 | ---
+++
@@ -0,0 +1,45 @@
+import os
+from tests import PMGTestCase
+from tests.fixtures import (
+ dbfixture, CommitteeQuestionData
+)
+
+
+class TestQuestionAnswer(PMGTestCase):
+ def setUp(self):
+ super(TestQuestionAnswer, self).setUp()
+
+ self.fx = dbfixture.data(
+ CommitteeQuesti... | |
2d8f221d55b0c04280a1b44ef72588882946fdea | takeoutStrings.py | takeoutStrings.py | #!/usr/bin/env python
# coding=utf-8
'''
This script will help you take out all strings.xml(Placed in a language-region folder) from an Android projectDir
We now use it to provide the strings and upload them to Crowdin.
'''
from os import system,listdir,path
from sys import argv
def takeoutStrings(resPath):
for... | Add script for Taking out of strings.xml files | Add script for Taking out of strings.xml files
| Python | apache-2.0 | androidyue/DroidPy | ---
+++
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+# coding=utf-8
+'''
+This script will help you take out all strings.xml(Placed in a language-region folder) from an Android projectDir
+We now use it to provide the strings and upload them to Crowdin.
+
+
+
+'''
+from os import system,listdir,path
+from sys import argv... | |
824b616123ca8378e3540409a522708997368ea1 | crandom.py | crandom.py | from __future__ import print_function, division
import numpy as np
def randbool(n, rng=None):
if rng is None:
rng = np.random
return rng.randint(2, size=n) * 2 - 1
| Add random number generation utility module. | Add random number generation utility module.
| Python | bsd-3-clause | eddiejessup/ciabatta | ---
+++
@@ -0,0 +1,8 @@
+from __future__ import print_function, division
+import numpy as np
+
+
+def randbool(n, rng=None):
+ if rng is None:
+ rng = np.random
+ return rng.randint(2, size=n) * 2 - 1 | |
634832b6ed70adfc3a54f6ca5a72e6b396f60d90 | symsynd/exceptions.py | symsynd/exceptions.py | class SymbolicationError(Exception):
message = None
def __init__(self, message):
if isinstance(message, bytes):
message = message.decode('utf-8', 'replace')
Exception.__init__(self, message)
self.message = message
def __str__(self):
return self.message.encode('u... | Move exception into common module and add unicode support | Move exception into common module and add unicode support
| Python | bsd-3-clause | getsentry/symsynd,getsentry/symsynd,getsentry/symsynd,getsentry/symsynd,getsentry/symsynd | ---
+++
@@ -0,0 +1,14 @@
+class SymbolicationError(Exception):
+ message = None
+
+ def __init__(self, message):
+ if isinstance(message, bytes):
+ message = message.decode('utf-8', 'replace')
+ Exception.__init__(self, message)
+ self.message = message
+
+ def __str__(self):
... | |
705b80fba3b165e35fa6d10656e3b888092aa86c | test/autopep8_vim.py | test/autopep8_vim.py | """Run autopep8 on the selected buffer in Vim.
map <C-I> :pyf <path_to>/autopep8_vim.py<CR>
"""
import autopep8
import vim
# TODO: Find out how to get the actual encoding from Vim.
encoding = 'utf-8'
options = autopep8.parse_args(['--range',
str(vim.current.range.start),
... | Add example of how to use autopep8 in Vim | Add example of how to use autopep8 in Vim
This example supports selecting a specific line range to format.
| Python | mit | MeteorAdminz/autopep8,hhatto/autopep8,Vauxoo/autopep8,Vauxoo/autopep8,vauxoo-dev/autopep8,MeteorAdminz/autopep8,hhatto/autopep8,vauxoo-dev/autopep8,SG345/autopep8,SG345/autopep8 | ---
+++
@@ -0,0 +1,22 @@
+"""Run autopep8 on the selected buffer in Vim.
+
+map <C-I> :pyf <path_to>/autopep8_vim.py<CR>
+
+"""
+
+import autopep8
+import vim
+
+# TODO: Find out how to get the actual encoding from Vim.
+encoding = 'utf-8'
+options = autopep8.parse_args(['--range',
+ str... | |
a64c04bcdd39d3c4f734e790a8a1f1f072d31fac | example/tests/test_settings.py | example/tests/test_settings.py | from django_webtest import WebTest
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from . import factory
class AdminTestCase(WebTest):
def setUp(self):
super(AdminTestCase, self).setUp()
self.user = factory.create_superuser()
self.image = facto... | Test disabling inclusion of jQuery | Test disabling inclusion of jQuery
| Python | bsd-3-clause | winzard/django-image-cropping,henriquechehad/django-image-cropping,winzard/django-image-cropping,henriquechehad/django-image-cropping,winzard/django-image-cropping,henriquechehad/django-image-cropping | ---
+++
@@ -0,0 +1,23 @@
+from django_webtest import WebTest
+from django.core.urlresolvers import reverse
+from django.test.utils import override_settings
+from . import factory
+
+
+class AdminTestCase(WebTest):
+
+ def setUp(self):
+ super(AdminTestCase, self).setUp()
+ self.user = factory.create_... | |
76139dd3bfab10256c05aed7998f3c1d79265ced | fireplace/cards/tgt/paladin.py | fireplace/cards/tgt/paladin.py | from ..utils import *
##
# Minions
# Murloc Knight
class AT_076:
inspire = Summon(CONTROLLER, RandomMurloc())
# Eadric the Pure
class AT_081:
play = Buff(ALL_MINIONS, "AT_081e")
##
# Spells
# Seal of Champions
class AT_074:
play = Buff(TARGET, "AT_074e2")
##
# Secrets
# Competitive Spirit
class A... | Implement Paladin cards for The Grand Tournament | Implement Paladin cards for The Grand Tournament
| Python | agpl-3.0 | Ragowit/fireplace,oftc-ftw/fireplace,smallnamespace/fireplace,Meerkov/fireplace,Ragowit/fireplace,liujimj/fireplace,smallnamespace/fireplace,amw2104/fireplace,beheh/fireplace,jleclanche/fireplace,liujimj/fireplace,NightKev/fireplace,Meerkov/fireplace,oftc-ftw/fireplace,amw2104/fireplace | ---
+++
@@ -0,0 +1,32 @@
+from ..utils import *
+
+
+##
+# Minions
+
+# Murloc Knight
+class AT_076:
+ inspire = Summon(CONTROLLER, RandomMurloc())
+
+
+# Eadric the Pure
+class AT_081:
+ play = Buff(ALL_MINIONS, "AT_081e")
+
+
+##
+# Spells
+
+# Seal of Champions
+class AT_074:
+ play = Buff(TARGET, "AT_074... | |
71a29223077e6d447238789191446a0c5cc4cdd8 | scan.py | scan.py | #!/usr/bin/env python
# encoding: utf-8
from wand.image import Image
def rotate_image(filename, degrees):
"""Rotates filename degrees degrees."""
with Image(filename=filename) as image:
with image.clone() as rotated:
rotated.rotate(degrees)
rotated.save(filename=filename)
def ... | Add rotate_image() that rotates image a given amount of degrees | Add rotate_image() that rotates image a given amount of degrees
| Python | bsd-2-clause | sjktje/sjkscan,sjktje/sjkscan | ---
+++
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+from wand.image import Image
+
+def rotate_image(filename, degrees):
+ """Rotates filename degrees degrees."""
+ with Image(filename=filename) as image:
+ with image.clone() as rotated:
+ rotated.rotate(degrees)
+ ... | |
3cf2eda808b9849a8bc57929b31826bbb95a41b9 | examples/test_window_switching.py | examples/test_window_switching.py | """
Sometimes tests open new tabs/windows, and you'll need
to switch to them first in order to interact with them.
The starting window is window(0). Then increments by 1.
"""
from seleniumbase import BaseCase
class TabSwitchingTests(BaseCase):
def test_switch_to_tabs(self):
self.open("data:tex... | Add an example test that has switching to a new tab/window | Add an example test that has switching to a new tab/window
| Python | mit | seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase | ---
+++
@@ -0,0 +1,22 @@
+"""
+Sometimes tests open new tabs/windows, and you'll need
+to switch to them first in order to interact with them.
+The starting window is window(0). Then increments by 1.
+"""
+from seleniumbase import BaseCase
+
+
+class TabSwitchingTests(BaseCase):
+
+ def test_switch_to_tabs(self):
... | |
0834e37317b44940c27cdcdd3ee9929498356220 | copperhead/runtime/np_interop.py | copperhead/runtime/np_interop.py | import numpy as np
import copperhead.compiler.backendtypes as ET
import copperhead.compiler.coretypes as T
from copperhead.compiler.conversions import back_to_front_type
def to_numpy(ary):
front_type = back_to_front_type(ary.type)
if not isinstance(front_type, T.Seq):
raise ValueError("Not convertible... | Add conversion function between cuarray and np.ndarray. | Add conversion function between cuarray and np.ndarray.
| Python | apache-2.0 | beni55/copperhead,copperhead/copperhead,shyamalschandra/copperhead,shyamalschandra/copperhead,beni55/copperhead,copperhead/copperhead | ---
+++
@@ -0,0 +1,24 @@
+import numpy as np
+import copperhead.compiler.backendtypes as ET
+import copperhead.compiler.coretypes as T
+from copperhead.compiler.conversions import back_to_front_type
+
+
+def to_numpy(ary):
+ front_type = back_to_front_type(ary.type)
+ if not isinstance(front_type, T.Seq):
+ ... | |
3279d68859d947f2e618e2770a9fd1b7ce3f26c9 | tests/test_cardxml.py | tests/test_cardxml.py | from hearthstone.enums import GameTag, Rarity
import utils
def test_all_tags_known():
"""
Iterate through the card database and check that all specified GameTags
are known in hearthstone.enums.GameTag
"""
unknown_tags = set()
known_tags = list(GameTag)
known_rarities = list(Rarity)
# Check the db loaded cor... | Add a test to verify that all GameTags are known | Add a test to verify that all GameTags are known
| Python | agpl-3.0 | Ragowit/fireplace,smallnamespace/fireplace,jleclanche/fireplace,beheh/fireplace,amw2104/fireplace,amw2104/fireplace,smallnamespace/fireplace,NightKev/fireplace,Ragowit/fireplace | ---
+++
@@ -0,0 +1,28 @@
+from hearthstone.enums import GameTag, Rarity
+
+import utils
+
+
+def test_all_tags_known():
+ """
+ Iterate through the card database and check that all specified GameTags
+ are known in hearthstone.enums.GameTag
+ """
+ unknown_tags = set()
+ known_tags = list(GameTag)
+ known_rarities = ... | |
eaf44ba0daccf08fa223ecd3d6fc9c967851eeb5 | examples/stream_dealer_router.py | examples/stream_dealer_router.py | import asyncio
import aiozmq
import zmq
@asyncio.coroutine
def go():
router = yield from aiozmq.create_zmq_stream(
zmq.ROUTER,
bind='tcp://127.0.0.1:*')
addr = list(router.transport.bindings())[0]
dealer = yield from aiozmq.create_zmq_stream(
zmq.DEALER,
connect=addr)
... | Add example for zmq streams | Add example for zmq streams
| Python | bsd-2-clause | MetaMemoryT/aiozmq,aio-libs/aiozmq,asteven/aiozmq,claws/aiozmq | ---
+++
@@ -0,0 +1,34 @@
+import asyncio
+import aiozmq
+import zmq
+
+
+@asyncio.coroutine
+def go():
+ router = yield from aiozmq.create_zmq_stream(
+ zmq.ROUTER,
+ bind='tcp://127.0.0.1:*')
+
+ addr = list(router.transport.bindings())[0]
+ dealer = yield from aiozmq.create_zmq_stream(
+ ... | |
2050a52b9b3065a9d6211cb029a308dce054c28d | calexicon/dates/tests/test_bce.py | calexicon/dates/tests/test_bce.py | import unittest
from calexicon.dates import BCEDate
class TestBCEDate(unittest.TestCase):
def test_make_bce_date(self):
bd = BCEDate(-4713, 1, 1)
self.assertEqual(bd.julian_representation(), (-4713, 1, 1))
def test_equality(self):
self.assertEqual(BCEDate(-44, 3, 15), BCEDate(-44, 3,... | Add some tests for BCEDate. | Add some tests for BCEDate.
| Python | apache-2.0 | jwg4/calexicon,jwg4/qual | ---
+++
@@ -0,0 +1,12 @@
+import unittest
+
+from calexicon.dates import BCEDate
+
+class TestBCEDate(unittest.TestCase):
+
+ def test_make_bce_date(self):
+ bd = BCEDate(-4713, 1, 1)
+ self.assertEqual(bd.julian_representation(), (-4713, 1, 1))
+
+ def test_equality(self):
+ self.assertEqu... | |
80f11c95d09a3538a6d67e6a01152fac7d2b6893 | tests/test_core_modules.py | tests/test_core_modules.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from i3pystatus.core.modules import IntervalModule
class IntervalModuleMetaTest(unittest.TestCase):
def test_no_settings(self):
class NoSettings(IntervalModule):
pass
self.assertEqual(NoSettings.settings, ('interval',))
... | Add tests for adding interval setting automatically | Add tests for adding interval setting automatically
| Python | mit | teto/i3pystatus,enkore/i3pystatus,enkore/i3pystatus,fmarchenko/i3pystatus,Elder-of-Ozone/i3pystatus,ncoop/i3pystatus,onkelpit/i3pystatus,paulollivier/i3pystatus,Elder-of-Ozone/i3pystatus,eBrnd/i3pystatus,schroeji/i3pystatus,claria/i3pystatus,yang-ling/i3pystatus,opatut/i3pystatus,richese/i3pystatus,Arvedui/i3pystatus,y... | ---
+++
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import unittest
+
+from i3pystatus.core.modules import IntervalModule
+
+
+class IntervalModuleMetaTest(unittest.TestCase):
+
+ def test_no_settings(self):
+ class NoSettings(IntervalModule):
+ pass
+ self.assertEq... | |
bc2314b31a35e586eba14c8305b223de30fd041a | switch_mod/hawaii/unserved_load.py | switch_mod/hawaii/unserved_load.py | """Add an UnservedLoad component, which ensures the model is always feasible.
This is often useful when the model is constrained to the edge of infeasibility,
(e.g., when evaluating a pre-defined, just-feasible construction plan) to avoid
spurious reports of infeasibility."""
from pyomo.environ import *
def define_arg... | Define UservedLoad variable and penalty factor to relax infeasibility when needed. | Define UservedLoad variable and penalty factor to relax infeasibility when needed.
| Python | apache-2.0 | OCM-Lab-PUC/switch-chile,OCM-Lab-PUC/switch-chile,bmaluenda/switch | ---
+++
@@ -0,0 +1,32 @@
+"""Add an UnservedLoad component, which ensures the model is always feasible.
+This is often useful when the model is constrained to the edge of infeasibility,
+(e.g., when evaluating a pre-defined, just-feasible construction plan) to avoid
+spurious reports of infeasibility."""
+from pyomo.... | |
306416523edddb454ebb126c79e86a7dc7f2bd37 | setup.py | setup.py | #!/usr/bin/env python
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import base32_crockford
package_data = {
'': ['LICENSE', 'README.rst'],
}
setup(
name='base32-crockford',
version='0.2.0',
description=("A Python implementation of Douglas Crockford'... | #!/usr/bin/env python
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import base32_crockford
package_data = {
'': ['LICENSE', 'README.rst'],
}
setup(
name='base32-crockford',
version='0.2.0',
description=("A Python implementation of Douglas Crockford'... | Add Python 2.6 to the classifiers list | Add Python 2.6 to the classifiers list
| Python | bsd-3-clause | jbittel/base32-crockford,klaplong/baas32 | ---
+++
@@ -32,6 +32,7 @@
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
+ 'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Topic :: Software Development :: Libraries :... |
a5bae9a5a9ffa53ab0c7da654e511ab150cb8ac9 | scripts/create_user.py | scripts/create_user.py | import sys
from brain.models.sqlobjects import User
from brain.helpers.sql import session_transaction
if len(sys.argv) not in (4, 5):
print("usage: {0} <username> <rmqvhost> <ftpuser> [quota]\n"
" with <username> a string\n"
" <rmqvhost> the rmqvhost used for the frontend\n"
... | Add sql user creation script | Add sql user creation script
| Python | apache-2.0 | quarkslab/irma,hirokihamasaki/irma,quarkslab/irma,quarkslab/irma,hirokihamasaki/irma,hirokihamasaki/irma,hirokihamasaki/irma,quarkslab/irma,hirokihamasaki/irma | ---
+++
@@ -0,0 +1,23 @@
+import sys
+from brain.models.sqlobjects import User
+from brain.helpers.sql import session_transaction
+
+
+if len(sys.argv) not in (4, 5):
+ print("usage: {0} <username> <rmqvhost> <ftpuser> [quota]\n"
+ " with <username> a string\n"
+ " <rmqvhost> the r... | |
b13ca26da67855f9d32f3209176af052ed46617f | wqflask/tests/utility/test_hmac.py | wqflask/tests/utility/test_hmac.py | # -*- coding: utf-8 -*-
"""Test hmac utility functions"""
import unittest
import mock
from utility.hmac import data_hmac
from utility.hmac import url_for_hmac
from utility.hmac import hmac_creation
class TestHmacUtil(unittest.TestCase):
"""Test Utility method for hmac creation"""
def test_hmac_creation(sel... | Add tests for hmac utility | Add tests for hmac utility
* wqflask/tests/utility/test_hmac.py: New tests.
| Python | agpl-3.0 | pjotrp/genenetwork2,zsloan/genenetwork2,zsloan/genenetwork2,genenetwork/genenetwork2,zsloan/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2,genenetwork/genenetwork2 | ---
+++
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+"""Test hmac utility functions"""
+
+import unittest
+import mock
+
+from utility.hmac import data_hmac
+from utility.hmac import url_for_hmac
+from utility.hmac import hmac_creation
+
+
+class TestHmacUtil(unittest.TestCase):
+ """Test Utility method for hmac cre... | |
0eeb5baed7a4417ac083221805842019185ccec0 | web_page_replay_go/PRESUBMIT.py | web_page_replay_go/PRESUBMIT.py | # Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Presubmit script for changes affecting web_page_replay_go/.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details ... | Add a presubmit script to run tests | [wpr-go] Add a presubmit script to run tests
Eventually, we would like to run webpagereplay tests on catapult continuous
build bots. For the time being, we run them as a presubmit step.
This is patched from nednguyen@'s CL at http://crrev.com/2989573002#ps1.
BUG=catapult:#3669
Review-Url: https://codereview.chromiu... | Python | bsd-3-clause | catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult | ---
+++
@@ -0,0 +1,50 @@
+# Copyright 2017 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Presubmit script for changes affecting web_page_replay_go/.
+
+See http://dev.chromium.org/developers/how-tos/depottools/p... | |
a9853ca2bbaa5a1c3a36e0c03aa08a2279d1b1aa | hashing_passwords.py | hashing_passwords.py | # coding: utf8
"""
Securely hash and check passwords using PBKDF2.
Use random salts to protect againt rainbow tables, many iterations against
brute-force, and constant-time comparaison againt timing attacks.
Keep parameters to the algorithm together with the hash so that we can
change the paramet... | Add some glue code to hash salted passwords wit PBKDF2. | Add some glue code to hash salted passwords wit PBKDF2.
| Python | bsd-3-clause | SimonSapin/snippets,SimonSapin/snippets | ---
+++
@@ -0,0 +1,66 @@
+# coding: utf8
+"""
+
+ Securely hash and check passwords using PBKDF2.
+
+ Use random salts to protect againt rainbow tables, many iterations against
+ brute-force, and constant-time comparaison againt timing attacks.
+
+ Keep parameters to the algorithm together with the hash s... | |
9074375cd27de596eb5d697263b0a1096725a3a8 | hbase/hbase/tests.py | hbase/hbase/tests.py | # -*- coding: utf-8 -*-
from hbase.compat import PY26
from hbase.compat import comp_bytes
import mock
if PY26: # pragma: no cover
import unittest2 as unittest
else:
import unittest
class TableListTests(unittest.TestCase):
def _make_one(self):
from hbase import HBase
return HBase('loca... | Revert "haven't found a sensible way to test things" | Revert "haven't found a sensible way to test things"
This reverts commit 80821d7f46e0072f9df586a14b3d69fc85c216e1.
| Python | bsd-3-clause | fuzzy-id/midas,fuzzy-id/midas,fuzzy-id/midas | ---
+++
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+
+from hbase.compat import PY26
+from hbase.compat import comp_bytes
+
+import mock
+
+if PY26: # pragma: no cover
+ import unittest2 as unittest
+else:
+ import unittest
+
+
+class TableListTests(unittest.TestCase):
+
+ def _make_one(self):
+ from h... | |
3090f80fb75e28d76a2a9f5e25c507d095a695c8 | middleware/python/test_auth_middleware.py | middleware/python/test_auth_middleware.py | from tyk.decorators import *
from gateway import TykGateway as tyk
@CustomKeyCheck
def MyKeyCheck(request, session, metadata, spec):
print("Running MyKeyCheck?")
print("request:", request)
print("session:", session)
print("spec:", spec)
valid_token = 'aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d'
... | from tyk.decorators import *
from gateway import TykGateway as tyk
@CustomKeyCheck
def MyKeyCheck(request, session, metadata, spec):
print("Running MyKeyCheck?")
print("request:", request)
print("session:", session)
print("spec:", spec)
valid_token = 'aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d'
... | Use float in session fields | Use float in session fields
| Python | mpl-2.0 | nebolsin/tyk,nebolsin/tyk,mvdan/tyk,lonelycode/tyk,mvdan/tyk,lonelycode/tyk,nebolsin/tyk,nebolsin/tyk,mvdan/tyk,mvdan/tyk,mvdan/tyk,mvdan/tyk,lonelycode/tyk,nebolsin/tyk,mvdan/tyk,nebolsin/tyk,nebolsin/tyk,nebolsin/tyk,mvdan/tyk | ---
+++
@@ -12,10 +12,12 @@
valid_token = 'aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d'
request_token = request.get_header('Authorization')
+ print("(python) request_token =", request_token)
+
if request_token == valid_token:
print("Token is OK")
- session.rate = 1000
- session... |
8f70af55a1cbe58eea64ca8b40b0f8d67d6a0b8b | migrations/versions/032_tighten_easuid.py | migrations/versions/032_tighten_easuid.py | """Tighten EAS constraints and fix easfoldersync state enum.
Revision ID: 3f96e92953e1
Revises: 55f0ff54c776
Create Date: 2014-05-21 17:43:44.556716
"""
# revision identifiers, used by Alembic.
revision = '3f96e92953e1'
down_revision = '55f0ff54c776'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.ex... | Fix nullable constraints on EASUid and EASFoldersync state enum. | [SCHEMA] Fix nullable constraints on EASUid and EASFoldersync state enum.
Summary:
The former we tightened on Gmail at one point and didn't trickle it back
to EAS. The latter is a bug from way back.
We really need to figure out a better deal for what to do with EAS-only
migrations, but putting it here for now.
Depen... | Python | agpl-3.0 | ErinCall/sync-engine,jobscore/sync-engine,gale320/sync-engine,Eagles2F/sync-engine,nylas/sync-engine,Eagles2F/sync-engine,rmasters/inbox,gale320/sync-engine,Eagles2F/sync-engine,rmasters/inbox,PriviPK/privipk-sync-engine,gale320/sync-engine,nylas/sync-engine,Eagles2F/sync-engine,gale320/sync-engine,closeio/nylas,EthanB... | ---
+++
@@ -0,0 +1,56 @@
+"""Tighten EAS constraints and fix easfoldersync state enum.
+
+Revision ID: 3f96e92953e1
+Revises: 55f0ff54c776
+Create Date: 2014-05-21 17:43:44.556716
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = '3f96e92953e1'
+down_revision = '55f0ff54c776'
+
+from alembic import op
+i... | |
4e2120a7cc2429729436c6a8c4fda39936ce3523 | osfclient/tests/test_file.py | osfclient/tests/test_file.py | from unittest.mock import patch
from osfclient.models import OSFCore
from osfclient.models import File
from osfclient.models import Folder
from osfclient.tests import fake_responses
from osfclient.tests.mocks import FakeResponse
_files_url = 'https://api.osf.io/v2//nodes/f3szh/files/osfstorage/foo123'
@patch.objec... | Add test of Folder instances | Add test of Folder instances
| Python | bsd-3-clause | betatim/osf-cli,betatim/osf-cli | ---
+++
@@ -0,0 +1,85 @@
+from unittest.mock import patch
+
+from osfclient.models import OSFCore
+from osfclient.models import File
+from osfclient.models import Folder
+
+from osfclient.tests import fake_responses
+from osfclient.tests.mocks import FakeResponse
+
+_files_url = 'https://api.osf.io/v2//nodes/f3szh/fi... | |
dcb230c1d06bc556c0b52df0c605a58f43baac64 | dipy/denoise/gibbs.py | dipy/denoise/gibbs.py | import numpy as np
def image_tv(x, fn=0, nn=3, a=0):
""" Computes total variation (TV) of matrix x along axis a in two
directions.
Parameters
----------
x : 2D ndarray
matrix x
fn : int
Distance of first neighbor to be included in TV calculation. If fn=0
the own point ... | Add total variation function need to access sub-voxel shifts | NF: Add total variation function need to access sub-voxel shifts
| Python | bsd-3-clause | FrancoisRheaultUS/dipy,FrancoisRheaultUS/dipy | ---
+++
@@ -0,0 +1,52 @@
+import numpy as np
+
+
+def image_tv(x, fn=0, nn=3, a=0):
+ """ Computes total variation (TV) of matrix x along axis a in two
+ directions.
+
+ Parameters
+ ----------
+ x : 2D ndarray
+ matrix x
+ fn : int
+ Distance of first neighbor to be included in TV cal... | |
5504aa44a1b47d6533c65c0f5884f11eda06359b | tests/rules/test_no_such_file.py | tests/rules/test_no_such_file.py | import pytest
from thefuck.rules.no_such_file import match, get_new_command
from tests.utils import Command
@pytest.mark.parametrize('command', [
Command(script='mv foo bar/foo', stderr="mv: cannot move 'foo' to 'bar/foo': No such file or directory"),
Command(script='mv foo bar/', stderr="mv: cannot move 'foo... | Add tests for the `no_such_file` rule | Add tests for the `no_such_file` rule
| Python | mit | petr-tichy/thefuck,princeofdarkness76/thefuck,PLNech/thefuck,mlk/thefuck,manashmndl/thefuck,bugaevc/thefuck,thinkerchan/thefuck,subajat1/thefuck,BertieJim/thefuck,suxinde2009/thefuck,ostree/thefuck,ytjiang/thefuck,bigplus/thefuck,mcarton/thefuck,vanita5/thefuck,BertieJim/thefuck,sekaiamber/thefuck,vanita5/thefuck,roth1... | ---
+++
@@ -0,0 +1,19 @@
+import pytest
+from thefuck.rules.no_such_file import match, get_new_command
+from tests.utils import Command
+
+
+@pytest.mark.parametrize('command', [
+ Command(script='mv foo bar/foo', stderr="mv: cannot move 'foo' to 'bar/foo': No such file or directory"),
+ Command(script='mv foo ... | |
fddfccdf1e9092a137aeadfd37a82dd6979205a6 | proc_opener.py | proc_opener.py | #!/usr/bin/python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Print out each tab process created during a test run, and the test it was created during.
import s... | Add analyzer for which pids are open during which tests | Add analyzer for which pids are open during which tests
| Python | mpl-2.0 | amccreight/mochitest-logs | ---
+++
@@ -0,0 +1,41 @@
+#!/usr/bin/python
+
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# Print out each tab process created during a test run, and the tes... | |
4232c1160008201d8d06f447695ad316a0c4a416 | examples/python_csq_xml_example.py | examples/python_csq_xml_example.py | __author__ = 'Dimitry Lvovsky'
# Copyright 2014 ReviewRank S.A ( ReviewPro )
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... | Add example for CSQ XML | Add example for CSQ XML
| Python | apache-2.0 | reviewpro/api_connect,reviewpro/api_connect,reviewpro/connect_py,reviewpro/connect_py | ---
+++
@@ -0,0 +1,28 @@
+__author__ = 'Dimitry Lvovsky'
+# Copyright 2014 ReviewRank S.A ( ReviewPro )
+#
+# 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... | |
d3211f577e4c7f4d99f3c7bed8178310f9a48b83 | tests/test_lesson_1_greetings.py | tests/test_lesson_1_greetings.py | # This lesson teaches you how to define a function that takes an input, and then uses
# it to alter the output of that function.
# Much like last time, run your python command in your terminal to see your first failure.
# `python -m unittest -vf tests.test_lesson_1_greetings`
# Again, like last time, you should see ... | Add tests for lesson 1: greetings | Add tests for lesson 1: greetings
| Python | mit | thejessleigh/test_driven_python,thejessleigh/test_driven_python,thejessleigh/test_driven_python | ---
+++
@@ -0,0 +1,31 @@
+# This lesson teaches you how to define a function that takes an input, and then uses
+# it to alter the output of that function.
+
+# Much like last time, run your python command in your terminal to see your first failure.
+
+# `python -m unittest -vf tests.test_lesson_1_greetings`
+
+# Aga... | |
e8f8b08ffb011ed705701f40c6a1a952c13d7c41 | analytics/test_analytics.py | analytics/test_analytics.py | # -*- encoding: utf-8
import pytest
from reports import NGINX_LOG_REGEX
@pytest.mark.parametrize('log_line', [
# Unusual methods
'0.0.0.0 - - [01/Jan/2001:00:00:00 +0000] "HEAD /example HTTP/1.0" 200 0 "http://referrer.org" "Example user agent" "1.2.3.4"',
'0.0.0.0 - - [01/Jan/2001:00:00:00 +0000] "OPTI... | Add a few tests for the analytics code | Add a few tests for the analytics code
| Python | mit | alexwlchan/alexwlchan.net,alexwlchan/alexwlchan.net,alexwlchan/alexwlchan.net,alexwlchan/alexwlchan.net,alexwlchan/alexwlchan.net | ---
+++
@@ -0,0 +1,17 @@
+# -*- encoding: utf-8
+
+import pytest
+
+from reports import NGINX_LOG_REGEX
+
+
+@pytest.mark.parametrize('log_line', [
+ # Unusual methods
+ '0.0.0.0 - - [01/Jan/2001:00:00:00 +0000] "HEAD /example HTTP/1.0" 200 0 "http://referrer.org" "Example user agent" "1.2.3.4"',
+ '0.0.0.0 ... | |
8f15591e90945b780a3a900f6eda7ffd3c712d1d | tools/3.7-migration.py | tools/3.7-migration.py | import argparse
import ConfigParser
import os
from qisys import ui
import qisys.parsers
import qisys.sh
import qisys.qixml
import qitoolchain.toolchain
def get_old_toolchains():
""" Return a dict name -> feed from the previous config format
"""
res = dict()
cfg_path = qisys.sh.get_config_path("qi", ... | Add a tool to ease 3.7 migration | Add a tool to ease 3.7 migration
Change-Id: I0fcb3a1dd3bffe719f1abfa45a328640002affa0
Reviewed-on: http://gerrit.aldebaran.lan/49630
Reviewed-by: dmerejkowsky <1e4b13000fa8777df4cefd2fd8215187e3deb062@aldebaran-robotics.com>
Tested-by: dmerejkowsky <1e4b13000fa8777df4cefd2fd8215187e3deb062@aldebaran-robotics.com>
| Python | bsd-3-clause | dmerejkowsky/qibuild,dmerejkowsky/qibuild,dmerejkowsky/qibuild,aldebaran/qibuild,aldebaran/qibuild,dmerejkowsky/qibuild,aldebaran/qibuild,dmerejkowsky/qibuild,aldebaran/qibuild | ---
+++
@@ -0,0 +1,75 @@
+import argparse
+import ConfigParser
+import os
+
+from qisys import ui
+import qisys.parsers
+import qisys.sh
+import qisys.qixml
+
+import qitoolchain.toolchain
+
+def get_old_toolchains():
+ """ Return a dict name -> feed from the previous config format
+
+ """
+ res = dict()
+ ... | |
4f2a7c64e8871b05679b71d2f79b9525c3ed40dd | dev/benchmark_for_elasticsearch.py | dev/benchmark_for_elasticsearch.py | # Simple benchmark script when searching similar strings by using elasticsearch instead of SimString.
# Since Elasticsearch uses Apache Lucene, TF/IDF based searching algorithm, the purpose for searching text will be different from this library.
from elasticsearch import Elasticsearch
from benchmarker import Benchmark... | Add benchmark script for elasticsearch | Add benchmark script for elasticsearch
| Python | mit | nullnull/simstring | ---
+++
@@ -0,0 +1,50 @@
+# Simple benchmark script when searching similar strings by using elasticsearch instead of SimString.
+# Since Elasticsearch uses Apache Lucene, TF/IDF based searching algorithm, the purpose for searching text will be different from this library.
+
+from elasticsearch import Elasticsearch
+f... | |
c3bd992d3b42255205b4f90cb3578bd81982f773 | opps/core/tests/source_models.py | opps/core/tests/source_models.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.db import IntegrityError
from django.test import TestCase
from opps.core.models.source import Source
class SourceModelTest(TestCase):
def setUp(self):
self.source = Source.objects.create(name=u'Test site',
slug=u'test-site')
| Create setup source model test use testcase | Create setup source model test use testcase
| Python | mit | jeanmask/opps,YACOWS/opps,jeanmask/opps,YACOWS/opps,YACOWS/opps,YACOWS/opps,jeanmask/opps,opps/opps,williamroot/opps,opps/opps,opps/opps,jeanmask/opps,williamroot/opps,williamroot/opps,opps/opps,williamroot/opps | ---
+++
@@ -0,0 +1,15 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from django.db import IntegrityError
+from django.test import TestCase
+
+from opps.core.models.source import Source
+
+
+class SourceModelTest(TestCase):
+
+ def setUp(self):
+ self.source = Source.objects.create(name=u'Test site',... | |
aee00af4c8d04825b1f532bcac096c0f4e245fbd | samples/util/test.py | samples/util/test.py | # coding: utf-8
import os
import shutil
import cv2
def delete_and_make_directory(dir_path='./image_dir/'):
# Delete the entire directory tree if it exists.
if os.path.exists(dir_path):
shutil.rmtree(dir_path)
# Make the directory if it doesn't exist.
if not os.path.exists(dir_path):
os.makedirs(dir_path)... | Add util directory and a code | Add util directory and a code
| Python | mit | iShoto/testpy | ---
+++
@@ -0,0 +1,39 @@
+# coding: utf-8
+
+import os
+import shutil
+import cv2
+
+
+def delete_and_make_directory(dir_path='./image_dir/'):
+ # Delete the entire directory tree if it exists.
+ if os.path.exists(dir_path):
+ shutil.rmtree(dir_path)
+
+ # Make the directory if it doesn't exist.
+ if not os.path.... | |
d1ee4b6d30f40653588bc5fc1b287e770457a79e | filters/remove-strong.py | filters/remove-strong.py | """
Convert strong text to normal text
EXAMPLE:
>>>> echo Lorem **ip sum** example | pandoc -F remove-strong.py
<p>Lorem ip sum example</p>
"""
import panflute as pf
def action(elem, doc):
if isinstance(elem, pf.Strong):
return list(elem.content)
#return elem.content.list
#return... | Add example that removes bold text | Add example that removes bold text
| Python | bsd-3-clause | sergiocorreia/panflute-filters | ---
+++
@@ -0,0 +1,22 @@
+"""
+Convert strong text to normal text
+
+EXAMPLE:
+ >>>> echo Lorem **ip sum** example | pandoc -F remove-strong.py
+ <p>Lorem ip sum example</p>
+"""
+
+import panflute as pf
+
+
+def action(elem, doc):
+ if isinstance(elem, pf.Strong):
+ return list(elem.content)
+ ... | |
32590cf52bfc699d9e003a5f64c125d9f232c141 | vumi/middleware/tests/test_address_translator.py | vumi/middleware/tests/test_address_translator.py | """Tests from vumi.middleware.address_translator."""
from twisted.trial.unittest import TestCase
from vumi.middleware.address_translator import AddressTranslationMiddleware
class AddressTranslationMiddlewareTestCase(TestCase):
def mk_addr_trans(self, outbound_map):
worker = object()
config = {'... | Add test for address translation middleware. | Add test for address translation middleware.
| Python | bsd-3-clause | vishwaprakashmishra/xmatrix,TouK/vumi,vishwaprakashmishra/xmatrix,TouK/vumi,vishwaprakashmishra/xmatrix,harrissoerja/vumi,TouK/vumi,harrissoerja/vumi,harrissoerja/vumi | ---
+++
@@ -0,0 +1,37 @@
+"""Tests from vumi.middleware.address_translator."""
+
+from twisted.trial.unittest import TestCase
+
+from vumi.middleware.address_translator import AddressTranslationMiddleware
+
+
+class AddressTranslationMiddlewareTestCase(TestCase):
+
+ def mk_addr_trans(self, outbound_map):
+ ... | |
885ec3ddcdb49f4f913c8c7230fc7613290ee5bb | python/rename_files.py | python/rename_files.py | # coding: utf-8
import argparse
import os
import re
import shutil
def rename_files_in_dir(directory, live_run=False):
if not live_run:
print("Performing dry run...")
files = [f for f in os.listdir(directory) if os.path.isfile(f)]
for old_path in files:
new_path = re.sub('[^0-9a-... | Add conservative rename Python script | Add conservative rename Python script
| Python | mit | joshsziegler/dotfiles,joshsziegler/dotfiles | ---
+++
@@ -0,0 +1,31 @@
+# coding: utf-8
+
+import argparse
+import os
+import re
+import shutil
+
+
+def rename_files_in_dir(directory, live_run=False):
+ if not live_run:
+ print("Performing dry run...")
+
+ files = [f for f in os.listdir(directory) if os.path.isfile(f)]
+
+ for old_path in... | |
e5586830fc2afb655e52563f29fa1f4271c836be | indra/resources/ontology_graph.py | indra/resources/ontology_graph.py | import networkx
from indra.databases import hgnc_client
from indra.databases import uniprot_client
from indra.databases import chebi_client
from indra.databases import mesh_client
class IndraOntology(networkx.MultiDiGraph):
def __init__(self):
super().__init__()
self.add_hgnc_nodes()
self.... | Add initial implementation of ontology graph | Add initial implementation of ontology graph
| Python | bsd-2-clause | sorgerlab/belpy,johnbachman/belpy,bgyori/indra,sorgerlab/belpy,johnbachman/indra,sorgerlab/indra,johnbachman/indra,sorgerlab/indra,bgyori/indra,sorgerlab/belpy,bgyori/indra,johnbachman/belpy,sorgerlab/indra,johnbachman/indra,johnbachman/belpy | ---
+++
@@ -0,0 +1,22 @@
+import networkx
+from indra.databases import hgnc_client
+from indra.databases import uniprot_client
+from indra.databases import chebi_client
+from indra.databases import mesh_client
+
+
+class IndraOntology(networkx.MultiDiGraph):
+ def __init__(self):
+ super().__init__()
+ ... | |
8b03ba1940a2e234d09d03ccd40cf43e5060d2b1 | indra/sources/bbn/make_bbn_tsv.py | indra/sources/bbn/make_bbn_tsv.py | """This script produces a TSV that help map the BBN ontology
to the Eidos UN ontology based on entries and examples."""
import yaml
import requests
from indra.sources import bbn
def build_examples(node, tree, prefix):
if not prefix or prefix in ('entity', 'event'):
this_prefix = node
else:
t... | Add script to generate BBN TSV | Add script to generate BBN TSV
| Python | bsd-2-clause | pvtodorov/indra,sorgerlab/indra,sorgerlab/indra,johnbachman/belpy,sorgerlab/indra,johnbachman/indra,johnbachman/indra,sorgerlab/belpy,sorgerlab/belpy,pvtodorov/indra,johnbachman/belpy,sorgerlab/belpy,bgyori/indra,bgyori/indra,bgyori/indra,pvtodorov/indra,johnbachman/belpy,pvtodorov/indra,johnbachman/indra | ---
+++
@@ -0,0 +1,47 @@
+"""This script produces a TSV that help map the BBN ontology
+to the Eidos UN ontology based on entries and examples."""
+
+import yaml
+import requests
+from indra.sources import bbn
+
+
+
+def build_examples(node, tree, prefix):
+ if not prefix or prefix in ('entity', 'event'):
+ ... | |
5b27b3730e779b9d5e4428c069f5c52d2a403d69 | GetToken.py | GetToken.py | #!/usr/bin/env python
import getpass
import sys
from optparse import OptionParser
try:
from ZSI.client import AUTH
except ImportError:
print '==> Failed to import ZSI'
print '===> Please make sure you have it installed and locatable from PYTHONPATH'
print ' http://pywebsvcs.sourceforge.net/'
... | Add a basic module and command-line tool for generating tokens | Add a basic module and command-line tool for generating tokens
Signed-off-by: R. Tyler Ballance <ae42760ef71e07cdc78c21849b44551816bda917@slide.com>
| Python | bsd-3-clause | rtyler/pyve | ---
+++
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+
+import getpass
+import sys
+
+from optparse import OptionParser
+
+try:
+ from ZSI.client import AUTH
+except ImportError:
+ print '==> Failed to import ZSI'
+ print '===> Please make sure you have it installed and locatable from PYTHONPATH'
+ print ' ... | |
1f5e9b39f9942be0a6b64d1e05283415ad839e47 | grammpy/IsMethodsRuleExtension.py | grammpy/IsMethodsRuleExtension.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
"""
from .Rule import Rule
class IsMethodsRuleExtension(Rule):
@classmethod
def is_regular(cls):
return False
@classmethod
def is_contextfree(cls):
return False
@classmeth... | Add is_* methods from old commit | Add is_* methods from old commit
| Python | mit | PatrikValkovic/grammpy | ---
+++
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+"""
+:Author Patrik Valkovic
+:Created 23.06.2017 16:39
+:Licence GNUv3
+Part of grammpy
+
+"""
+
+from .Rule import Rule
+
+class IsMethodsRuleExtension(Rule):
+
+ @classmethod
+ def is_regular(cls):
+ return False
+
+ @classmethod
+ def is_contextf... | |
1343cbf191e1a665323c6e3a49dda15e5e65ad6b | presentationsapp/urls.py | presentationsapp/urls.py | from django.conf.urls import patterns, url
from presentationsapp import views
urlpatterns = patterns('',
#url(r'^(?P<course_id>[0-9]+)/$', views.courseDetails),
url(r'^$', views.index),
)
| Add URL routing to first view | Add URL routing to first view
| Python | mit | masonsbro/presentations | ---
+++
@@ -0,0 +1,8 @@
+from django.conf.urls import patterns, url
+
+from presentationsapp import views
+
+urlpatterns = patterns('',
+ #url(r'^(?P<course_id>[0-9]+)/$', views.courseDetails),
+ url(r'^$', views.index),
+) | |
e69c2f715093b7eda4a20a26e84af963fb5af9cf | regulations/tests/tasks_tests.py | regulations/tests/tasks_tests.py | import json
import mock
import six
from celery.exceptions import Retry, MaxRetriesExceededError
from requests.exceptions import RequestException
from django.test import SimpleTestCase, override_settings
from regulations.tasks import submit_comment
@mock.patch('regulations.models.FailedCommentSubmission.objects')
@m... | Add unit tests for the submit_comment task | Add unit tests for the submit_comment task
| Python | cc0-1.0 | 18F/regulations-site,eregs/regulations-site,eregs/regulations-site,eregs/regulations-site,tadhg-ohiggins/regulations-site,eregs/regulations-site,18F/regulations-site,tadhg-ohiggins/regulations-site,tadhg-ohiggins/regulations-site,18F/regulations-site,18F/regulations-site,tadhg-ohiggins/regulations-site | ---
+++
@@ -0,0 +1,66 @@
+import json
+import mock
+import six
+
+from celery.exceptions import Retry, MaxRetriesExceededError
+from requests.exceptions import RequestException
+from django.test import SimpleTestCase, override_settings
+
+from regulations.tasks import submit_comment
+
+
+@mock.patch('regulations.mode... | |
40ad6b1dbdc715aa0e4dfdff4bd689bbe795561b | test_mccabe.py | test_mccabe.py | import unittest
import sys
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
from mccabe import get_code_complexity
_GLOBAL = """\
for i in range(10):
pass
def a():
def b():
def c():
pass
c()
b()
"""
class McCabeTest(unittest.TestCase)... | Add simple test for McCabe checker | Add simple test for McCabe checker
| Python | mit | flintwork/mccabe,sigmavirus24/mccabe | ---
+++
@@ -0,0 +1,41 @@
+import unittest
+import sys
+try:
+ from StringIO import StringIO
+except ImportError:
+ from io import StringIO
+
+from mccabe import get_code_complexity
+
+
+_GLOBAL = """\
+
+for i in range(10):
+ pass
+
+def a():
+ def b():
+ def c():
+ pass
+ c()
+ ... | |
0c3c8a84f8c0bce983e8fe0951dd26314951142c | bin/switch-country.py | bin/switch-country.py | #!/usr/bin/env python
# coding=UTF-8
import os
from os.path import dirname, join, normpath, realpath
import sys
script_directory = dirname(realpath(sys.argv[0]))
root_directory = join(script_directory, '..')
root_directory = normpath(root_directory)
election_options = [
e for e in os.listdir(join(root_directory,... | Add a script to make it easier to switch between elections | Add a script to make it easier to switch between elections
| Python | agpl-3.0 | mysociety/yournextrepresentative,neavouli/yournextrepresentative,datamade/yournextmp-popit,mysociety/yournextmp-popit,DemocracyClub/yournextrepresentative,neavouli/yournextrepresentative,openstate/yournextrepresentative,mysociety/yournextrepresentative,openstate/yournextrepresentative,neavouli/yournextrepresentative,my... | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+# coding=UTF-8
+
+import os
+from os.path import dirname, join, normpath, realpath
+import sys
+
+script_directory = dirname(realpath(sys.argv[0]))
+root_directory = join(script_directory, '..')
+root_directory = normpath(root_directory)
+
+election_options = [
+ e ... | |
2ac80e13e983ee102a475a3c4e7783d38b2f8603 | cptm/experiment_prune_samples.py | cptm/experiment_prune_samples.py | import logging
import argparse
from os import remove
from cptm.utils.experiment import load_config, get_corpus, get_sampler
logger = logging.getLogger(__name__)
logging.basicConfig(format='%(levelname)s : %(message)s', level=logging.INFO)
logging.getLogger('gensim').setLevel(logging.ERROR)
logging.getLogger('CPTCor... | Add script to prune parameter sample files | Add script to prune parameter sample files
The parameter sample files for a decent experiment take up a lot of
space. Because don't need all of them, we remove 90%.
| Python | apache-2.0 | NLeSC/cptm,NLeSC/cptm | ---
+++
@@ -0,0 +1,46 @@
+import logging
+import argparse
+from os import remove
+
+from cptm.utils.experiment import load_config, get_corpus, get_sampler
+
+
+logger = logging.getLogger(__name__)
+logging.basicConfig(format='%(levelname)s : %(message)s', level=logging.INFO)
+
+logging.getLogger('gensim').setLevel(lo... | |
6a90a4b27c3166b3b4d9f79791b511b9f403a682 | zerver/migrations/0416_set_default_emoji_style.py | zerver/migrations/0416_set_default_emoji_style.py | from django.db import migrations
from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor
from django.db.migrations.state import StateApps
def update_deprecated_emoji_style(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None:
"""
This migration updates the emoji style for users ... | Switch users with blob emoji to use Google style. | emoji: Switch users with blob emoji to use Google style.
| Python | apache-2.0 | zulip/zulip,zulip/zulip,zulip/zulip,zulip/zulip,zulip/zulip,zulip/zulip,zulip/zulip | ---
+++
@@ -0,0 +1,30 @@
+from django.db import migrations
+from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor
+from django.db.migrations.state import StateApps
+
+
+def update_deprecated_emoji_style(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None:
+ """
+ This migration... | |
785f4bf4ca47fff6e955dc0894fd5a7ca744a201 | scrapy_cdr/es_download_hashes.py | scrapy_cdr/es_download_hashes.py | import argparse
import csv
import hashlib
import elasticsearch
from elasticsearch_dsl import Search
import tqdm
from w3lib.url import canonicalize_url
def main():
parser = argparse.ArgumentParser(
description='Download item hashes from ES index')
arg = parser.add_argument
arg('output', help='outp... | Add a script that downloads content hashes | Add a script that downloads content hashes
| Python | mit | TeamHG-Memex/scrapy-cdr | ---
+++
@@ -0,0 +1,60 @@
+import argparse
+import csv
+import hashlib
+
+import elasticsearch
+from elasticsearch_dsl import Search
+import tqdm
+from w3lib.url import canonicalize_url
+
+
+def main():
+ parser = argparse.ArgumentParser(
+ description='Download item hashes from ES index')
+ arg = parser.... | |
d41f777032f05e63c16b18bc74cb5a3d59b0ad82 | ui/gfx/compositor/PRESUBMIT.py | ui/gfx/compositor/PRESUBMIT.py | # Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Chromium presubmit script for src/chrome/browser/externsions.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more de... | Add aura compile testing by default to likely areas (2). | Add aura compile testing by default to likely areas (2).
BUG=chromium:107599
TEST=None
Review URL: http://codereview.chromium.org/8907045
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@114850 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | gavinp/chromium,adobe/chromium,gavinp/chromium,yitian134/chromium,ropik/chromium,adobe/chromium,ropik/chromium,yitian134/chromium,gavinp/chromium,ropik/chromium,adobe/chromium,ropik/chromium,adobe/chromium,gavinp/chromium,ropik/chromium,yitian134/chromium,yitian134/chromium,yitian134/chromium,adobe/chromium,gavinp/chro... | ---
+++
@@ -0,0 +1,12 @@
+# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Chromium presubmit script for src/chrome/browser/externsions.
+
+See http://dev.chromium.org/developers/how-tos/depott... | |
9bdd3f7aea307fb72ab4999e28b56bd4ce7f46d2 | app/initial_tables.py | app/initial_tables.py | from tables import engine
def create_tables():
"""
Create tables the lazy way... with raw SQL.
"""
conn = engine.raw_connection()
cur = conn.cursor()
cur.execute(
"""
CREATE TABLE file_upload(
document_name TEXT
, time_uploaded TEXT DEFAULT now()
, filename TEXT NOT NULL
, word_... | Add module to create initial tables | Add module to create initial tables
| Python | mit | sprin/heroku-tut | ---
+++
@@ -0,0 +1,23 @@
+from tables import engine
+
+def create_tables():
+ """
+ Create tables the lazy way... with raw SQL.
+ """
+ conn = engine.raw_connection()
+ cur = conn.cursor()
+ cur.execute(
+"""
+CREATE TABLE file_upload(
+ document_name TEXT
+ , time_uploaded TEXT DEFAULT now()
... | |
54118be673602e7936a566d16185ed311e700ac2 | scripts/msvs_projects.py | scripts/msvs_projects.py | #!/usr/bin/python
#
# Copyright 2017 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# msvs_projects.py:
# A helper utility that generates Visual Studio projects for each of
# the available directories in 'out', ... | Add script to generate GN/MSVS projects. | Add script to generate GN/MSVS projects.
BUG=angleproject:1569
Change-Id: I0e47720d17cd1a29603e471482cac31d4c281ee5
Reviewed-on: https://chromium-review.googlesource.com/735059
Reviewed-by: Geoff Lang <b6fc25fe0362055230985c05cbfa8adb741ccc0f@chromium.org>
Commit-Queue: Jamie Madill <7e492b4f1c8458024932de3ba475cbf01... | Python | bsd-3-clause | ppy/angle,ppy/angle,ppy/angle,ppy/angle | ---
+++
@@ -0,0 +1,40 @@
+#!/usr/bin/python
+#
+# Copyright 2017 The ANGLE Project Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+#
+# msvs_projects.py:
+# A helper utility that generates Visual Studio projects for each of
+# ... | |
2262e07f8e15879657409ff2b29696d128a2172c | python/image-tools/remove-all-exif-data.py | python/image-tools/remove-all-exif-data.py | #!/usr/bin/env python
import sys
# sudo pip3 install piexif
import piexif
if len(sys.argv) < 2:
sys.stderr.write('ERROR: Must provide a file to remove EXIF tags from\n')
sys.exit('Usage: {} FILE'.format(sys.argv[0]))
piexif.remove(sys.argv[1])
| Add script to remove all EXIF data from an image | Add script to remove all EXIF data from an image
| Python | mit | bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile | ---
+++
@@ -0,0 +1,12 @@
+#!/usr/bin/env python
+
+import sys
+
+# sudo pip3 install piexif
+import piexif
+
+if len(sys.argv) < 2:
+ sys.stderr.write('ERROR: Must provide a file to remove EXIF tags from\n')
+ sys.exit('Usage: {} FILE'.format(sys.argv[0]))
+
+piexif.remove(sys.argv[1]) | |
df1d517fbd3dbd921ff50b64d95869ad8605d43a | proselint/checks/garner/sexism.py | proselint/checks/garner/sexism.py | # -*- coding: utf-8 -*-
"""MAU103: Sexism.
---
layout: post
error_code: MAU103
source: Garner's Modern American Usage
source_url: http://amzn.to/15wF76r
title: sexism
date: 2014-06-10 12:31:19
categories: writing
---
Points out sexist language.
"""
from proselint.tools import memoize, preferred_fo... | Add rule on sexist language | Add rule on sexist language
#51
| Python | bsd-3-clause | amperser/proselint,jstewmon/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint,jstewmon/proselint,amperser/proselint,amperser/proselint | ---
+++
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+"""MAU103: Sexism.
+
+---
+layout: post
+error_code: MAU103
+source: Garner's Modern American Usage
+source_url: http://amzn.to/15wF76r
+title: sexism
+date: 2014-06-10 12:31:19
+categories: writing
+---
+
+Points out sexist language.
+
+"""
+from ... | |
10327654f40ec443be756cfebf3a51e7f037781b | cleanup-old-kernels.py | cleanup-old-kernels.py | #!/usr/bin/env python
import logging
import re
import os
import shutil
logger = logging.getLogger(__name__)
BOOT_FILE_PREFIXES = (u'initrd', u'System.map', u'vmlinuz', )
def discover_in_dir(directory, file_prefix):
version_pattern = u'(?P<version>[\\w.-]+catalin[\\w.-]*)'
kernel_file_pattern = u'{0}-{1}'.fo... | Add script that deletes previously installed kernels | Add script that deletes previously installed kernels
Only the bootloader needs to be manually adjusted afterwards.
| Python | mit | cataliniacob/misc,cataliniacob/misc | ---
+++
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+
+import logging
+import re
+import os
+import shutil
+
+logger = logging.getLogger(__name__)
+
+BOOT_FILE_PREFIXES = (u'initrd', u'System.map', u'vmlinuz', )
+
+def discover_in_dir(directory, file_prefix):
+ version_pattern = u'(?P<version>[\\w.-]+catalin[\\w.-]*)'... | |
28b621677b3236684303a2145ce347cf053b8bdd | examples/kb_interrupt_handler.py | examples/kb_interrupt_handler.py | # -*- coding: utf-8 -*-
"""
examples.kb_interrupt_handler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Handling keyboard interrupt (control+c) with
try-except block.
"""
import random
import time
from yaspin import yaspin
from yaspin.spinners import Spinners
def unpacker():
sp = yaspin(Spinners.simpleDotsScrolling, right=Tr... | Add example for handling keyboard interrupt | Add example for handling keyboard interrupt
| Python | mit | pavdmyt/yaspin | ---
+++
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+
+"""
+examples.kb_interrupt_handler
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Handling keyboard interrupt (control+c) with
+try-except block.
+"""
+
+import random
+import time
+
+from yaspin import yaspin
+from yaspin.spinners import Spinners
+
+
+def unpacker():
+ sp =... | |
e44ebe1e0132b34f666f81d750589a44beef11f0 | modernrpc/tests/test_jsonrpc_specific_features.py | modernrpc/tests/test_jsonrpc_specific_features.py | # coding: utf-8
from jsonrpcclient.http_client import HTTPClient
def test_call_with_named_args(live_server):
c = HTTPClient(live_server.url + '/all-rpc/')
result = c.divide(numerator=10, denominator=2, z=123)
assert result == 5.0
def test_notify(live_server):
c = HTTPClient(live_server.url + '/a... | Add tests for recently added features | Add tests for recently added features
| Python | mit | alorence/django-modern-rpc,alorence/django-modern-rpc | ---
+++
@@ -0,0 +1,18 @@
+# coding: utf-8
+
+from jsonrpcclient.http_client import HTTPClient
+
+
+def test_call_with_named_args(live_server):
+
+ c = HTTPClient(live_server.url + '/all-rpc/')
+
+ result = c.divide(numerator=10, denominator=2, z=123)
+ assert result == 5.0
+
+
+def test_notify(live_server):
... | |
b99b056f0af8c07db063987a75b96ee65bd0975f | scripts/mbedtls_dev/bignum_mod.py | scripts/mbedtls_dev/bignum_mod.py | """Framework classes for generation of bignum mod test cases."""
# Copyright The Mbed TLS Contributors
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
... | Add script for generating mod test cases | Add script for generating mod test cases
This commit only adds the boilerplate, no actual tests are added.
Signed-off-by: Janos Follath <b175c17abe0474719672be1367bb75ee28bd5c71@arm.com>
| Python | apache-2.0 | Mbed-TLS/mbedtls,Mbed-TLS/mbedtls,Mbed-TLS/mbedtls,ARMmbed/mbedtls,ARMmbed/mbedtls,Mbed-TLS/mbedtls,ARMmbed/mbedtls,ARMmbed/mbedtls | ---
+++
@@ -0,0 +1,29 @@
+"""Framework classes for generation of bignum mod test cases."""
+# Copyright The Mbed TLS Contributors
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License.
+# You may ... | |
d921af5066fff0ec7b623bdd7f563b69152f27eb | filter_plugins/custom_plugins.py | filter_plugins/custom_plugins.py | #
# Usage: {{ foo | vault }}
#
def vault(encrypted, env):
method = """
from keyczar import keyczar
import os.path
import sys
keydir = '.vault'
if not os.path.isdir(keydir):
keydir = os.path.expanduser('~/.decrypted_openconext_keystore_{env}')
crypter = keyczar.Crypter.Read(keydir)
sys.stdout.write(crypter.Decrypt(... | #
# Usage: {{ foo | vault }}
#
def vault(encrypted, env):
method = """
from keyczar import keyczar
import os.path
import sys
keydir = '.vault'
if not os.path.isdir(keydir):
keydir = os.path.expanduser('~/.decrypted_openconext_keystore_{env}')
crypter = keyczar.Crypter.Read(keydir)
sys.stdout.write(crypter.Decrypt(... | Use Popen which is available on RHEL6, but do check exit code | Use Popen which is available on RHEL6, but do check exit code
| Python | apache-2.0 | OpenConext/OpenConext-deploy,remold/OpenConext-deploy,OpenConext/OpenConext-deploy,remold/OpenConext-deploy,baszoetekouw/OpenConext-deploy,baszoetekouw/OpenConext-deploy,baszoetekouw/OpenConext-deploy,baszoetekouw/OpenConext-deploy,OpenConext/OpenConext-deploy,OpenConext/OpenConext-deploy,baszoetekouw/OpenConext-deploy... | ---
+++
@@ -13,8 +13,12 @@
crypter = keyczar.Crypter.Read(keydir)
sys.stdout.write(crypter.Decrypt("%s"))
""".format(env=env) % encrypted
- from subprocess import check_output
- return check_output(["python", "-c", method])
+ import subprocess
+ child = subprocess.Popen(['python', '-c', method], stdout=subpr... |
37604722a186a28ee2df7cca422bc47cfea1857e | migrations/versions/d6b40a745e5_.py | migrations/versions/d6b40a745e5_.py | """Add table usercache
Revision ID: d6b40a745e5
Revises: 1edda52b619f
Create Date: 2017-04-13 15:25:44.050719
"""
# revision identifiers, used by Alembic.
revision = 'd6b40a745e5'
down_revision = '1edda52b619f'
from alembic import op
import sqlalchemy as sa
def upgrade():
try:
op.create_table('usercac... | Add SQL migration for usercache | Add SQL migration for usercache
Working on #670
| Python | agpl-3.0 | jh23453/privacyidea,privacyidea/privacyidea,privacyidea/privacyidea,jh23453/privacyidea,privacyidea/privacyidea,wheldom01/privacyidea,wheldom01/privacyidea,jh23453/privacyidea,wheldom01/privacyidea,privacyidea/privacyidea,wheldom01/privacyidea,jh23453/privacyidea,privacyidea/privacyidea,jh23453/privacyidea,jh23453/priv... | ---
+++
@@ -0,0 +1,33 @@
+"""Add table usercache
+
+Revision ID: d6b40a745e5
+Revises: 1edda52b619f
+Create Date: 2017-04-13 15:25:44.050719
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = 'd6b40a745e5'
+down_revision = '1edda52b619f'
+
+from alembic import op
+import sqlalchemy as sa
+
+
+def upgrade(... | |
c29b81e9ecc800898342c54cb6f4637a8371b1b4 | models/fallahi_eval/process_data.py | models/fallahi_eval/process_data.py | import pandas
from collections import defaultdict
rppa_file = 'data/TableS1-Split.xlsx'
cell_lines = ['C32', 'COLO858', 'K2', 'LOXIMVI', 'MMACSF', 'MZ7MEL',
'RVH421', 'SKMEL28', 'WM115', 'WM1552C']
def read_rppa_data(fname=rppa_file):
data = {}
for cell_line in cell_lines:
data[cell_lin... | Read in RPPA medians and stds | Read in RPPA medians and stds
| Python | bsd-2-clause | johnbachman/belpy,bgyori/indra,pvtodorov/indra,sorgerlab/belpy,pvtodorov/indra,pvtodorov/indra,johnbachman/indra,pvtodorov/indra,sorgerlab/indra,sorgerlab/indra,sorgerlab/belpy,bgyori/indra,sorgerlab/indra,sorgerlab/belpy,johnbachman/belpy,johnbachman/belpy,johnbachman/indra,bgyori/indra,johnbachman/indra | ---
+++
@@ -0,0 +1,25 @@
+import pandas
+from collections import defaultdict
+
+rppa_file = 'data/TableS1-Split.xlsx'
+
+cell_lines = ['C32', 'COLO858', 'K2', 'LOXIMVI', 'MMACSF', 'MZ7MEL',
+ 'RVH421', 'SKMEL28', 'WM115', 'WM1552C']
+
+def read_rppa_data(fname=rppa_file):
+ data = {}
+ for cell_lin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.