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 |
|---|---|---|---|---|---|---|---|---|---|---|
11bb0d7aa106e1cafee8b4f00bf75a2aa02e97cf | SecC/ErrMer_Proto.py | SecC/ErrMer_Proto.py | from __future__ import division
import numpy as np
from utilBMF.HTSUtils import pFastqProxy, pFastqFile
consInFq1 = pFastqFile("/home/brett/Projects/BMFTools_Devel/lamda_data/lamda-50di"
"v_S4_L001_R1_001.fastq.rescued.shaded.BS.fastq")
consInFq2 = pFastqFile("/home/brett/Projects/BMFTools_Devel/la... | Add small script to start calculating error from kmer motifs, prototyping | Add small script to start calculating error from kmer motifs, prototyping
| Python | mit | ARUP-NGS/BMFtools,ARUP-NGS/BMFtools,ARUP-NGS/BMFtools | ---
+++
@@ -0,0 +1,8 @@
+from __future__ import division
+import numpy as np
+from utilBMF.HTSUtils import pFastqProxy, pFastqFile
+
+consInFq1 = pFastqFile("/home/brett/Projects/BMFTools_Devel/lamda_data/lamda-50di"
+ "v_S4_L001_R1_001.fastq.rescued.shaded.BS.fastq")
+consInFq2 = pFastqFile("/home... | |
7d59b4e21ed36c916c66de06488712decf96b110 | tests/filter/test_distinct_random_filter.py | tests/filter/test_distinct_random_filter.py | from datetime import date
import pytest
from freezegun import freeze_time
from adhocracy4.filters.filters import DistinctOrderingFilter
from tests.apps.questions.models import Question
@pytest.mark.django_db
def test_random_distinct_ordering_no_seed(question_factory):
questions = [question_factory() for i in ra... | Add test for distinct random order filter | tests: Add test for distinct random order filter
| Python | agpl-3.0 | liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4 | ---
+++
@@ -0,0 +1,58 @@
+from datetime import date
+
+import pytest
+from freezegun import freeze_time
+
+from adhocracy4.filters.filters import DistinctOrderingFilter
+from tests.apps.questions.models import Question
+
+
+@pytest.mark.django_db
+def test_random_distinct_ordering_no_seed(question_factory):
+ ques... | |
3081aa14230f7374e406e15be992235eaf961551 | butter/utils.py | butter/utils.py | #!/usr/bin/env python
from cffi import FFI as _FFI
import fcntl
import array
_ffi = _FFI()
_ffi.cdef("""
#define FIONREAD ...
""")
_C = _ffi.verify("""
#include <sys/ioctl.h>
""", libraries=[])
def get_buffered_length(fd):
buf = array.array("I", [0])
fcntl.ioctl(fd, _C.FIONREAD, buf)
return buf[0]
... | Add function to read length of bytes in the buffer from the kernel | Add function to read length of bytes in the buffer from the kernel
| Python | bsd-3-clause | arkaitzj/python-butter,dasSOZO/python-butter,wdv4758h/butter | ---
+++
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+from cffi import FFI as _FFI
+import fcntl
+import array
+
+_ffi = _FFI()
+_ffi.cdef("""
+#define FIONREAD ...
+""")
+
+_C = _ffi.verify("""
+#include <sys/ioctl.h>
+""", libraries=[])
+
+def get_buffered_length(fd):
+ buf = array.array("I", [0])
+ fcntl.ioctl(fd... | |
1fdfff95e04678f107775870f0f1b4eda6af8073 | bson/tests/test_binary.py | bson/tests/test_binary.py | #!/usr/bin/env python
from unittest import TestCase
from bson import dumps, loads
class TestBinary(TestCase):
def setUp(self):
lyrics = b"""
I've Had Enough - Earth Wind and Fire
Getting down, there's
a party in motion
Everybody's on the scene
And I can hear the s... | Add test for PR-56(Fix binary decode) | Add test for PR-56(Fix binary decode)
| Python | bsd-3-clause | martinkou/bson | ---
+++
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+from unittest import TestCase
+
+from bson import dumps, loads
+
+
+class TestBinary(TestCase):
+ def setUp(self):
+ lyrics = b"""
+ I've Had Enough - Earth Wind and Fire
+
+ Getting down, there's
+ a party in motion
+ Everybody's ... | |
a2f9a972c5ccb4bcecff89c07ee8a9a73ca97fd1 | tests/cache/test_mako.py | tests/cache/test_mako.py | from unittest import TestCase
from dogpile.cache import util
class MakoTest(TestCase):
""" Test entry point for Mako
"""
def test_entry_point(self):
import pkg_resources
for impl in pkg_resources.iter_entry_points("mako.cache", "dogpile.cache"):
print im... | Add unit test to cover Mako entry point. | Add unit test to cover Mako entry point.
| Python | bsd-3-clause | thruflo/dogpile.cache,thruflo/dogpile.cache | ---
+++
@@ -0,0 +1,18 @@
+from unittest import TestCase
+
+from dogpile.cache import util
+
+
+class MakoTest(TestCase):
+ """ Test entry point for Mako
+ """
+
+ def test_entry_point(self):
+ import pkg_resources
+
+ for impl in pkg_resources.iter_entry_points("mako.cache", "dogpile.ca... | |
0eae8a12cbbc21469fd4401692223ef51b8bc7a7 | tests/test_identifier.py | tests/test_identifier.py | import angr
import nose
import identifier
import os
bin_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../binaries-private'))
import logging
logging.getLogger("identifier").setLevel("DEBUG")
def test_palindrome():
'''
Test identification of functions in palindrome.
'''
... | Add simple testcase for identifier | Add simple testcase for identifier
| Python | bsd-2-clause | tyb0807/angr,iamahuman/angr,tyb0807/angr,angr/angr,f-prettyland/angr,chubbymaggie/angr,iamahuman/angr,chubbymaggie/angr,f-prettyland/angr,schieb/angr,chubbymaggie/angr,schieb/angr,axt/angr,iamahuman/angr,tyb0807/angr,axt/angr,axt/angr,angr/angr,f-prettyland/angr,angr/angr,schieb/angr | ---
+++
@@ -0,0 +1,37 @@
+import angr
+import nose
+import identifier
+
+import os
+bin_location = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../binaries-private'))
+
+import logging
+logging.getLogger("identifier").setLevel("DEBUG")
+
+def test_palindrome():
+ '''
+ Test identification o... | |
8af2e4a5023beeab22b87b4aab7133fd5a3c5be4 | ConvertFiles.py | ConvertFiles.py | # -*- coding:utf-8 -*-
'''
這個程式能夠為同目錄下的所有檔案(含子資料夾)都建立一個同名的txt檔
'''
import os
def create_txt_file(fileSimpleName):
fileName = (fileSimpleName + ".txt")
fileopen = open(fileName,'w')
#fileopen.write(p)
fileopen.close()
def convert_all_files(path):
for dirPath, dirNames, fileNames in os.walk(path):... | Copy from my project create-txt-file-by-name. | Copy from my project create-txt-file-by-name.
| Python | mit | YiFanChen99/file-walker-for-windows | ---
+++
@@ -0,0 +1,26 @@
+# -*- coding:utf-8 -*-
+
+'''
+這個程式能夠為同目錄下的所有檔案(含子資料夾)都建立一個同名的txt檔
+'''
+
+import os
+
+def create_txt_file(fileSimpleName):
+ fileName = (fileSimpleName + ".txt")
+ fileopen = open(fileName,'w')
+ #fileopen.write(p)
+ fileopen.close()
+
+def convert_all_files(path):
+ for dir... | |
3b852c14c76a95b386e6644b99a589c0ae4c19ed | course/migrations/0005_auto_20160622_2313.py | course/migrations/0005_auto_20160622_2313.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('course', '0004_auto_20160409_2159'),
]
operations = [
migrations.AlterField(
model_... | Add migration mentioned in last commit... | Add migration mentioned in last commit...
| Python | bsd-3-clause | fsr/course-management,fsr/course-management | ---
+++
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+import django.utils.timezone
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('course', '0004_auto_20160409_2159'),
+ ]
+
+ operations = [
+ ... | |
c6b9bb93f268b7c1dc100c75a7c36326d63450d5 | tests/all_test.py | tests/all_test.py | import glob
import unittest
import os, sys
if __name__ == '__main__':
PROJECT_ROOT = os.path.dirname(__file__)
test_file_strings = glob.glob(os.path.join(PROJECT_ROOT, 'test_*.py'))
module_strings = [os.path.splitext(os.path.basename(str))[0] for str in test_file_strings]
suites = [unittest.defaultTest... | Add all test runner for command line. Now every test can be run for commandline | Add all test runner for command line. Now every test can be run for commandline
| Python | mit | kyamaguchi/SublimeObjC2RubyMotion,kyamaguchi/SublimeObjC2RubyMotion | ---
+++
@@ -0,0 +1,11 @@
+import glob
+import unittest
+import os, sys
+
+if __name__ == '__main__':
+ PROJECT_ROOT = os.path.dirname(__file__)
+ test_file_strings = glob.glob(os.path.join(PROJECT_ROOT, 'test_*.py'))
+ module_strings = [os.path.splitext(os.path.basename(str))[0] for str in test_file_strings]... | |
891c53eee0c6e6487ab0ba0e9d1e92d117678c9a | src/python/read_back.py | src/python/read_back.py | import lcio
fac = lcio.LCFactory.getInstance()
rdr = fac.createLCReader()
rdr.open("write_test.slcio")
evt = rdr.readNextEvent()
coll = evt.getSimCalorimeterHitCollection("hits")
print repr(coll)
hit=coll.getElementAt(0)
print repr(hit)
| Add example read of previously written LCIO using Python | JM: Add example read of previously written LCIO using Python
| Python | bsd-3-clause | petricm/LCIO,petricm/LCIO,petricm/LCIO,iLCSoft/LCIO,petricm/LCIO,iLCSoft/LCIO,petricm/LCIO,petricm/LCIO,iLCSoft/LCIO,iLCSoft/LCIO,iLCSoft/LCIO,iLCSoft/LCIO | ---
+++
@@ -0,0 +1,10 @@
+import lcio
+
+fac = lcio.LCFactory.getInstance()
+rdr = fac.createLCReader()
+rdr.open("write_test.slcio")
+evt = rdr.readNextEvent()
+coll = evt.getSimCalorimeterHitCollection("hits")
+print repr(coll)
+hit=coll.getElementAt(0)
+print repr(hit) | |
2a5c513c1916b42a044aef15f0d407229c7adc7e | utilities/decodetrace.py | utilities/decodetrace.py | '''
Script to decode an internal error backtrace
'''
import sys
from subprocess import Popen, PIPE
if len(sys.argv) != 2 and len(sys.argv) != 3:
print 'Usage: %s <path to initium.elf> [<path to addr2line>] << <output>' % (sys.argv[0])
sys.exit(1)
loader = sys.argv[1]
if len(sys.argv) == 3:
addr2line = sys.argv... | Add script to decode an internal error backtrace | Add script to decode an internal error backtrace
| Python | mit | gil0mendes/Initium,gil0mendes/Initium,gil0mendes/Initium | ---
+++
@@ -0,0 +1,30 @@
+'''
+Script to decode an internal error backtrace
+'''
+
+import sys
+from subprocess import Popen, PIPE
+
+if len(sys.argv) != 2 and len(sys.argv) != 3:
+ print 'Usage: %s <path to initium.elf> [<path to addr2line>] << <output>' % (sys.argv[0])
+ sys.exit(1)
+
+loader = sys.argv[1]
+if le... | |
23da61b3887b98df4d4f943101a2673f39920b7e | src/collectors/jsoncommon/jsoncommon.py | src/collectors/jsoncommon/jsoncommon.py | # coding=utf-8
"""
Simple collector which get JSON and parse it into flat metrics
#### Dependencies
* urllib2
"""
import urllib2
import json
import diamond.collector
class JSONCommonCollector(diamond.collector.Collector):
def get_default_config_help(self):
config_help = super(JSONCommonCollector, s... | Add new collector Get JSON and transform it into flat metrics | Add new collector
Get JSON and transform it into flat metrics
| Python | mit | Ormod/Diamond,Netuitive/Diamond,zoidbergwill/Diamond,thardie/Diamond,sebbrandt87/Diamond,codepython/Diamond,stuartbfox/Diamond,MichaelDoyle/Diamond,thardie/Diamond,gg7/diamond,hamelg/Diamond,krbaker/Diamond,zoidbergwill/Diamond,gg7/diamond,cannium/Diamond,Netuitive/Diamond,jaingaurav/Diamond,tuenti/Diamond,disqus/Diamo... | ---
+++
@@ -0,0 +1,70 @@
+# coding=utf-8
+
+"""
+Simple collector which get JSON and parse it into flat metrics
+
+#### Dependencies
+
+ * urllib2
+
+"""
+
+import urllib2
+import json
+import diamond.collector
+
+
+class JSONCommonCollector(diamond.collector.Collector):
+
+ def get_default_config_help(self):
+ ... | |
4816e8a6b2c1c9ef416bab5cd7d53005cd6d72c2 | hardware/sense_hat/demo_buttons.py | hardware/sense_hat/demo_buttons.py | #!/usr/bin/env python
# from https://pythonhosted.org/sense-hat/api/#joystick
from sense_hat import SenseHat, ACTION_PRESSED, ACTION_HELD, ACTION_RELEASED
from signal import pause
x = 3
y = 3
sense = SenseHat()
def clamp(value, min_value=0, max_value=7):
return min(max_value, max(min_value, value))
def pushed_... | Add script to demo Sense HAT buttons | Add script to demo Sense HAT buttons
| Python | mit | claremacrae/raspi_code,claremacrae/raspi_code,claremacrae/raspi_code | ---
+++
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+
+# from https://pythonhosted.org/sense-hat/api/#joystick
+
+from sense_hat import SenseHat, ACTION_PRESSED, ACTION_HELD, ACTION_RELEASED
+from signal import pause
+
+x = 3
+y = 3
+sense = SenseHat()
+
+def clamp(value, min_value=0, max_value=7):
+ return min(max_va... | |
c93b8f20a65fbb2e6a2e23aad7de0c496778aa23 | py/single-element-in-a-sorted-array.py | py/single-element-in-a-sorted-array.py | class Solution(object):
def singleNonDuplicate(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
ln = len(nums)
L, U = -1, ln
while L + 1 < U:
mid = L + (U - L) / 2
if mid == ln - 1:
return nums[mid]
oth... | Add py solution for 540. Single Element in a Sorted Array | Add py solution for 540. Single Element in a Sorted Array
540. Single Element in a Sorted Array: https://leetcode.com/problems/single-element-in-a-sorted-array/
| Python | apache-2.0 | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | ---
+++
@@ -0,0 +1,18 @@
+class Solution(object):
+ def singleNonDuplicate(self, nums):
+ """
+ :type nums: List[int]
+ :rtype: int
+ """
+ ln = len(nums)
+ L, U = -1, ln
+ while L + 1 < U:
+ mid = L + (U - L) / 2
+ if mid == ln - 1:
+ ... | |
02c833fe31a31f0dd8cefe28f81a5feee0f9bedd | add_and_search_word_data_structure_design.py | add_and_search_word_data_structure_design.py | # coding: utf-8
# author: Fei Gao
#
# Add And Search Word Data Structure Design
# Design a data structure that supports the following two operations:
# void addWord(word)
# bool search(word)
# search(word) can search a literal word or a regular expression string containing only letters a-z or .. A . means it can repr... | Add and Search Word - Data structure design: cheat with `re` | Add and Search Word - Data structure design: cheat with `re`
| Python | mit | feigaochn/leetcode | ---
+++
@@ -0,0 +1,58 @@
+# coding: utf-8
+
+# author: Fei Gao
+#
+# Add And Search Word Data Structure Design
+
+# Design a data structure that supports the following two operations:
+# void addWord(word)
+# bool search(word)
+# search(word) can search a literal word or a regular expression string containing only le... | |
a2b08ba7f575bde42c57d24b4effaceea0ac4829 | django_banking/parsers.py | django_banking/parsers.py | # -*- coding: utf-8 -*-
from django_banking.models import MT940
def parse_mt940(input):
messages = []
message = None
for line in input:
if line.startswith(':20:'):
message = MT940()
message.trn = line[4:]
continue
if line.startswith('-'):
... | Add initial version of the MT-940 parser | Add initial version of the MT-940 parser
| Python | bsd-3-clause | headcr4sh/django-banking | ---
+++
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+
+from django_banking.models import MT940
+
+def parse_mt940(input):
+
+ messages = []
+ message = None
+
+ for line in input:
+
+ if line.startswith(':20:'):
+ message = MT940()
+ message.trn = line[4:]
+ continue
+
+... | |
5d743690e1d236090064c7bb95f872d1fa279b52 | php4dvd/test_deletefilm.py | php4dvd/test_deletefilm.py | # -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
import unittest
class AddFilm(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Firefox()
self.driver.implicitly_wait(10)
self.base_url = "http://hub.wart.ru/"
... | Add a test for a film deletting. | Add a test for a film deletting.
| Python | bsd-2-clause | bsamorodov/selenium-py-training-samorodov | ---
+++
@@ -0,0 +1,54 @@
+# -*- coding: utf-8 -*-
+from selenium import webdriver
+from selenium.common.exceptions import NoSuchElementException
+import unittest
+
+
+class AddFilm(unittest.TestCase):
+ def setUp(self):
+ self.driver = webdriver.Firefox()
+ self.driver.implicitly_wait(10)
+ se... | |
f9a9ce064f9a09ee0e039239aebdb742c8683a3c | readMouse.py | readMouse.py | import struct
file = open ("/dev/input/mice","rb");
def getMouseEvent():
buf = file.read(3);
x,y = struct.unpack("bb", buf[1:] );
print ("x:%d, y:%d\n" % (x,y));
while(1):
getMouseEvent()
file.close;
| Add Python script to read mouse delta position events | Add Python script to read mouse delta position events
| Python | mit | cschulee/ee542-code,cschulee/ee542-code,cschulee/ee542-code | ---
+++
@@ -0,0 +1,12 @@
+import struct
+file = open ("/dev/input/mice","rb");
+
+def getMouseEvent():
+ buf = file.read(3);
+ x,y = struct.unpack("bb", buf[1:] );
+ print ("x:%d, y:%d\n" % (x,y));
+
+while(1):
+ getMouseEvent()
+
+file.close; | |
4ffa049553050ab22c5c90f544bb03fcc4259bfe | pmdarima/tests/test_metrics.py | pmdarima/tests/test_metrics.py | # -*- coding: utf-8 -*-
from pmdarima.metrics import smape
import numpy as np
import pytest
@pytest.mark.parametrize(
'actual,forecasted,expected', [
pytest.param([0.07533, 0.07533, 0.07533, 0.07533,
0.07533, 0.07533, 0.0672, 0.0672],
[0.102, 0.107, 0.047, 0.1,
... | Add unit test for SMAPE | Add unit test for SMAPE
| Python | mit | tgsmith61591/pyramid,alkaline-ml/pmdarima,alkaline-ml/pmdarima,alkaline-ml/pmdarima,tgsmith61591/pyramid,tgsmith61591/pyramid | ---
+++
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+
+from pmdarima.metrics import smape
+import numpy as np
+import pytest
+
+
+@pytest.mark.parametrize(
+ 'actual,forecasted,expected', [
+ pytest.param([0.07533, 0.07533, 0.07533, 0.07533,
+ 0.07533, 0.07533, 0.0672, 0.0672],
+ ... | |
88470edf159ef662886a4af9dc782fe173e196bf | examples/python/burnin.py | examples/python/burnin.py | #!/usr/bin/env python
# Burn-in test: Keep LEDs at full brightness most of the time, but dim periodically
# so it's clear when there's a problem.
import opc, time, math
numLEDs = 512
client = opc.Client('localhost:7890')
t = 0
while True:
t += 0.4
brightness = int(min(1, 1.25 + math.sin(t)) * 255)
fram... | Add a really simple burn-in test helper | Add a really simple burn-in test helper
| Python | mit | fragmede/fadecandy,lincomatic/fadecandy,pixelmatix/fadecandy,PimentNoir/fadecandy,fragmede/fadecandy,poe/fadecandy,scanlime/fadecandy,poe/fadecandy,lincomatic/fadecandy,hakan42/fadecandy,nomis52/fadecandy,PimentNoir/fadecandy,lincomatic/fadecandy,adam-back/fadecandy,adam-back/fadecandy,adam-back/fadecandy,nomis52/fadec... | ---
+++
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+
+# Burn-in test: Keep LEDs at full brightness most of the time, but dim periodically
+# so it's clear when there's a problem.
+
+import opc, time, math
+
+numLEDs = 512
+client = opc.Client('localhost:7890')
+
+t = 0
+
+while True:
+ t += 0.4
+ brightness = int(... | |
c06cffd3de56e5da4cf5d19bcb7f6e1982fc7621 | generate_historic_wnaffect.py | generate_historic_wnaffect.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from time import sleep
import json
import codecs
from emotools.lexicon import get_spelling_variants
import pandas as pd
if __name__ == '__main__':
# read file and convert byte strings to unicode
with codecs.open('SWN-NL-voor-Janneke.txt', 'rb', 'latin1') as f:
... | Add script to generate a historic version of wna affect | Add script to generate a historic version of wna affect
| Python | apache-2.0 | NLeSC/embodied-emotions-scripts,NLeSC/embodied-emotions-scripts | ---
+++
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+from time import sleep
+import json
+import codecs
+from emotools.lexicon import get_spelling_variants
+import pandas as pd
+
+
+if __name__ == '__main__':
+ # read file and convert byte strings to unicode
+ with codecs.open('SWN-NL-voor-... | |
75073c57d247a1424250ae98b870347af2725d1f | test/mbed_gt_cmake_handlers.py | test/mbed_gt_cmake_handlers.py | #!/usr/bin/env python
"""
mbed SDK
Copyright (c) 2011-2015 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable ... | Add unit tests to function parsing CTestTestfile.cmake | Add unit tests to function parsing CTestTestfile.cmake
| Python | apache-2.0 | ARMmbed/greentea | ---
+++
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+"""
+mbed SDK
+Copyright (c) 2011-2015 ARM Limited
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENS... | |
2697859df141b2dc6c34df5c0ac3ec87741d6b84 | examples/tour_examples/bootstrap_google_tour.py | examples/tour_examples/bootstrap_google_tour.py | from seleniumbase import BaseCase
class MyTourClass(BaseCase):
def test_google_tour(self):
self.open('https://google.com')
self.wait_for_element('input[title="Search"]')
self.create_bootstrap_tour() # OR self.create_tour(theme="bootstrap")
self.add_tour_step(
"Click ... | Add Bootstrap Google Tour example | Add Bootstrap Google Tour example
| Python | mit | mdmintz/SeleniumBase,mdmintz/seleniumspot,mdmintz/SeleniumBase,mdmintz/seleniumspot,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase | ---
+++
@@ -0,0 +1,63 @@
+from seleniumbase import BaseCase
+
+
+class MyTourClass(BaseCase):
+
+ def test_google_tour(self):
+ self.open('https://google.com')
+ self.wait_for_element('input[title="Search"]')
+
+ self.create_bootstrap_tour() # OR self.create_tour(theme="bootstrap")
+ s... | |
69dd9057c1009d9c047f45908080a55ac3223e4c | examples/svm/plot_svm_regression.py | examples/svm/plot_svm_regression.py | """Non linear regression with Support Vector Regression (SVR)
using RBF kernel
"""
###############################################################################
# Generate sample data
import numpy as np
X = np.sort(5*np.random.rand(40, 1), axis=0)
y = np.sin(X).ravel()
##############################################... | """Non linear regression with Support Vector Regression (SVR)
using RBF kernel
"""
###############################################################################
# Generate sample data
import numpy as np
X = np.sort(5*np.random.rand(40, 1), axis=0)
y = np.sin(X).ravel()
##############################################... | Fix forgotten import in example | BUG: Fix forgotten import in example
| Python | bsd-3-clause | NunoEdgarGub1/scikit-learn,f3r/scikit-learn,mehdidc/scikit-learn,icdishb/scikit-learn,xiaoxiamii/scikit-learn,MatthieuBizien/scikit-learn,Vimos/scikit-learn,walterreade/scikit-learn,lesteve/scikit-learn,hugobowne/scikit-learn,cauchycui/scikit-learn,joshloyal/scikit-learn,shangwuhencc/scikit-learn,mattilyra/scikit-learn... | ---
+++
@@ -25,6 +25,7 @@
###############################################################################
# look at the results
+import pylab as pl
pl.scatter(X, y, c='k', label='data')
pl.hold('on')
pl.plot(X, y_rbf, c='g', label='RBF model') |
029c3f46731cd3a4746043833e912447ababf1a7 | build/extra_gitignore.py | build/extra_gitignore.py | #!/usr/bin/env python
# Copyright (c) 2012 The WebRTC 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 in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All c... | Add script for appending entries to .gitignore. | Add script for appending entries to .gitignore.
TBR=kjellander
Review URL: https://webrtc-codereview.appspot.com/1629004
git-svn-id: 03ae4fbe531b1eefc9d815f31e49022782c42458@4193 4adac7df-926f-26a2-2b94-8c16560cd09d
| Python | bsd-3-clause | jchavanton/webrtc,lukeweber/webrtc-src-override,AOSPU/external_chromium_org_third_party_webrtc,lukeweber/webrtc-src-override,MIPS/external-chromium_org-third_party-webrtc,bpsinc-native/src_third_party_webrtc,krieger-od/webrtc,AOSPU/external_chromium_org_third_party_webrtc,AOSPU/external_chromium_org_third_party_webrtc,... | ---
+++
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 The WebRTC 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 in the root of the source
+# tree. An additional intellectual property rights grant can be fo... | |
45bb10691ba7021bfb834a8941ac8492ae8509af | igor/plugins/copy/copy.py | igor/plugins/copy/copy.py | """Copy values or subtrees, either locally or remotely.
Currently a quick hack using either direct database access or httplib2, synchronously.
Should use callUrl, so local/remote becomes similar, and some form
of callback mechanism so it can run asynchronously.
"""
import requests
import web
import httplib2
DATABASE_... | Copy subtree plugin. Unfinished and untested. | Copy subtree plugin. Unfinished and untested.
| Python | mit | cwi-dis/igor,cwi-dis/igor,cwi-dis/igor | ---
+++
@@ -0,0 +1,43 @@
+"""Copy values or subtrees, either locally or remotely.
+
+Currently a quick hack using either direct database access or httplib2, synchronously.
+Should use callUrl, so local/remote becomes similar, and some form
+of callback mechanism so it can run asynchronously.
+"""
+import requests
+im... | |
0f39968ee0cfd4b38a599b6fc9dc6d8369392513 | benchmarks/benchmark3.py | benchmarks/benchmark3.py | from time import clock
from random import choice, randint, seed
from sys import stdout
import ahocorasick
def write(str):
stdout.write(str)
stdout.flush()
def writeln(str):
stdout.write(str)
stdout.write('\n')
class ElapsedTime:
def __init__(self, msg):
self.msg = msg
def __enter... | Add benchmark script for python 3 | Add benchmark script for python 3
| Python | bsd-3-clause | WojciechMula/pyahocorasick,WojciechMula/pyahocorasick,pombredanne/pyahocorasick,WojciechMula/pyahocorasick,pombredanne/pyahocorasick,pombredanne/pyahocorasick,pombredanne/pyahocorasick,WojciechMula/pyahocorasick,woakesd/pyahocorasick,woakesd/pyahocorasick | ---
+++
@@ -0,0 +1,117 @@
+from time import clock
+from random import choice, randint, seed
+from sys import stdout
+
+import ahocorasick
+
+
+def write(str):
+ stdout.write(str)
+ stdout.flush()
+
+
+def writeln(str):
+ stdout.write(str)
+ stdout.write('\n')
+
+
+class ElapsedTime:
+ def __init__(self... | |
d707fd1593b47d228d33bb283bb8634075df12a7 | telethon_examples/print_updates.py | telethon_examples/print_updates.py | #!/usr/bin/env python3
# A simple script to print all updates received
from telethon import TelegramClient
from getpass import getpass
from os import environ
# environ is used to get API information from environment variables
# You could also use a config file, pass them as arguments,
# or even hardcode them (not rec... | Add example script to print out all updates | Add example script to print out all updates
| Python | mit | LonamiWebs/Telethon,LonamiWebs/Telethon,LonamiWebs/Telethon,LonamiWebs/Telethon,expectocode/Telethon,andr-04/Telethon | ---
+++
@@ -0,0 +1,45 @@
+#!/usr/bin/env python3
+# A simple script to print all updates received
+
+from telethon import TelegramClient
+from getpass import getpass
+from os import environ
+# environ is used to get API information from environment variables
+# You could also use a config file, pass them as arguments... | |
4f5b495a0051b39e1e6fdd54f13bad0bd2b1bd29 | myria/test/test_logs.py | myria/test/test_logs.py | from httmock import urlmatch, HTTMock
import unittest
from myria import MyriaConnection
@urlmatch(netloc=r'localhost:8753')
def local_mock(url, request):
print url
if url.path == '/logs/sent':
body = 'foo,bar\nbaz,ban'
return {'status_code': 200, 'content': body}
return None
class TestQ... | Test getting the logs (broken) | Test getting the logs (broken) | Python | bsd-3-clause | uwescience/myria-python,uwescience/myria-python | ---
+++
@@ -0,0 +1,25 @@
+from httmock import urlmatch, HTTMock
+import unittest
+from myria import MyriaConnection
+
+
+@urlmatch(netloc=r'localhost:8753')
+def local_mock(url, request):
+ print url
+ if url.path == '/logs/sent':
+ body = 'foo,bar\nbaz,ban'
+ return {'status_code': 200, 'content'... | |
111b296112cf3b21f9abc1da37b047c1d0bc0ab8 | tests/scoring_engine/web/test_about.py | tests/scoring_engine/web/test_about.py | from tests.scoring_engine.web.web_test import WebTest
from scoring_engine.version import version
from scoring_engine.engine.config import config
class TestAbout(WebTest):
# def setup(self):
# super(TestWelcome, self).setup()
# self.expected_sponsorship_images = OrderedDict()
# self.expec... | Add test for about view | Add test for about view
| Python | mit | pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine,pwnbus/scoring_engine | ---
+++
@@ -0,0 +1,25 @@
+from tests.scoring_engine.web.web_test import WebTest
+
+from scoring_engine.version import version
+from scoring_engine.engine.config import config
+
+
+class TestAbout(WebTest):
+
+ # def setup(self):
+ # super(TestWelcome, self).setup()
+ # self.expected_sponsorship_image... | |
3a6bb4b7c282ee6c3ede1f3b662a70c9dc3ca638 | benchmarks/bench_nbody.py | benchmarks/bench_nbody.py | """
Benchmark an implementation of the N-body simulation.
As in the CUDA version, we only compute accelerations and don't care to
update speeds and positions.
"""
from __future__ import division
import math
import sys
import numpy as np
from numba import jit, float32, float64
eps_2 = np.float32(1e-6)
zero = np.f... | Add a Numba n-body benchmark | Add a Numba n-body benchmark
| Python | bsd-2-clause | numba/numba-benchmark,gmarkall/numba-benchmark | ---
+++
@@ -0,0 +1,80 @@
+"""
+Benchmark an implementation of the N-body simulation.
+
+As in the CUDA version, we only compute accelerations and don't care to
+update speeds and positions.
+"""
+
+from __future__ import division
+
+import math
+import sys
+
+import numpy as np
+
+from numba import jit, float32, floa... | |
c75fec9298be07a9162db3b9218013661af7c5b5 | raiden/tests/unit/transfer/mediated_transfer/test_events.py | raiden/tests/unit/transfer/mediated_transfer/test_events.py | from raiden.tests.utils.factories import make_address, make_channel_identifier, make_transfer
from raiden.transfer.mediated_transfer.events import SendRefundTransfer
def test_send_refund_transfer_contains_balance_proof():
recipient = make_address()
transfer = make_transfer()
message_identifier = 1
cha... | Add test that SendRefundTransfer contains a balance proof | Add test that SendRefundTransfer contains a balance proof
| Python | mit | hackaugusto/raiden,hackaugusto/raiden | ---
+++
@@ -0,0 +1,18 @@
+from raiden.tests.utils.factories import make_address, make_channel_identifier, make_transfer
+from raiden.transfer.mediated_transfer.events import SendRefundTransfer
+
+
+def test_send_refund_transfer_contains_balance_proof():
+ recipient = make_address()
+ transfer = make_transfer()
... | |
59c20c07d01ae1ebde8a6a8bb3d6fd4652507929 | bluebottle/time_based/migrations/0007_auto_20201023_1433.py | bluebottle/time_based/migrations/0007_auto_20201023_1433.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2020-10-23 12:33
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('time_based', '0006_auto_20201021_1315'),
]
operations = [
migrations.AddFi... | Add optional start of ongoing and with a deadline activities | Add optional start of ongoing and with a deadline activities
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | ---
+++
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.17 on 2020-10-23 12:33
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('time_based', '0006_auto_20201021_1315'),
+ ]
+
+ ... | |
727143357853591862335eb9e556855e6056a6a8 | build/android/pylib/uiautomator/test_runner.py | build/android/pylib/uiautomator/test_runner.py | # Copyright (c) 2013 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.
"""Class for running uiautomator tests on a single device."""
from pylib.instrumentation import test_runner as instr_test_runner
class TestRunner(inst... | # Copyright (c) 2013 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.
"""Class for running uiautomator tests on a single device."""
from pylib.instrumentation import test_runner as instr_test_runner
class TestRunner(inst... | Fix uiautomator test runner after r206096 | [Android] Fix uiautomator test runner after r206096
TBR=craigdh@chromium.org
NOTRY=True
BUG=
Review URL: https://chromiumcodereview.appspot.com/17004003
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@206257 0039d316-1c4b-4281-b951-d872f2087c98
| Python | bsd-3-clause | mogoweb/chromium-crosswalk,jaruba/chromium.src,Pluto-tv/chromium-crosswalk,patrickm/chromium.src,Jonekee/chromium.src,mohamed--abdel-maksoud/chromium.src,hgl888/chromium-crosswalk,Fireblend/chromium-crosswalk,axinging/chromium-crosswalk,fujunwei/chromium-crosswalk,patrickm/chromium.src,krieger-od/nwjs_chromium.src,ondr... | ---
+++
@@ -29,6 +29,10 @@
self.test_pkg.Install(self.adb)
#override
+ def PushDataDeps(self):
+ pass
+
+ #override
def _RunTest(self, test, timeout):
self.adb.ClearApplicationState(self.package_name)
if 'Feature:FirstRunExperience' in self.test_pkg.GetTestAnnotations(test): |
87e4d3bc9d3efd9f84025b25a8bd975ab73626f9 | pythran/tests/cases/calculate_u.py | pythran/tests/cases/calculate_u.py | # from the paper `using cython to speedup numerical python programs'
#pythran export timeloop(float, float, float, float, float, float list list, float list list, float list list)
#runas A=[range(2000) for i in xrange(100)] ; B=[range(2000) for i in xrange(100)] ; C=[range(2000) for i in xrange(100)] ; timeloop(1,2,.01... | Add a new test case, extracted from a cython paper. | Add a new test case, extracted from a cython paper.
| Python | bsd-3-clause | serge-sans-paille/pythran,pbrunet/pythran,serge-sans-paille/pythran,pombredanne/pythran,pombredanne/pythran,artas360/pythran,artas360/pythran,pombredanne/pythran,pbrunet/pythran,hainm/pythran,pbrunet/pythran,hainm/pythran,hainm/pythran,artas360/pythran | ---
+++
@@ -0,0 +1,25 @@
+# from the paper `using cython to speedup numerical python programs'
+#pythran export timeloop(float, float, float, float, float, float list list, float list list, float list list)
+#runas A=[range(2000) for i in xrange(100)] ; B=[range(2000) for i in xrange(100)] ; C=[range(2000) for i in x... | |
5e14a02a9f670f3558a07e6c3ef592753bda3f50 | getFile.py | getFile.py | import os.path
from FormatConverter import *
import timeSeriesFrame
extmap = {'.csv':1, '.txt':2, '.xls':3, '.sql':4}
dir = "C:\Documents and Settings\MARY\My Documents\Test\Data"
#Conversion function
def doConv(file, id):
f = FormatConverter(file) #creates a FormatConverter object for the file
#reads ... | Use as main with FormatConverter; walks directory | Use as main with FormatConverter; walks directory
| Python | bsd-3-clause | wingsit/KF,wingsit/KF | ---
+++
@@ -0,0 +1,42 @@
+import os.path
+from FormatConverter import *
+import timeSeriesFrame
+
+extmap = {'.csv':1, '.txt':2, '.xls':3, '.sql':4}
+dir = "C:\Documents and Settings\MARY\My Documents\Test\Data"
+
+#Conversion function
+def doConv(file, id):
+ f = FormatConverter(file) #creates a FormatConve... | |
5d12703a706498f24da09c368f626a78e0269afd | parsers/event_parser.py | parsers/event_parser.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
from collections import defaultdict
logger = logging.getLogger(__name__)
class EventParser():
def __init__(self, raw_data):
self.raw_data = raw_data
self.score = defaultdict(int)
# self.score['road'] = 0
# self.score['... | Add initial version of event parser | Add initial version of event parser
| Python | mit | leaffan/pynhldb | ---
+++
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import logging
+from collections import defaultdict
+
+logger = logging.getLogger(__name__)
+
+
+class EventParser():
+
+ def __init__(self, raw_data):
+ self.raw_data = raw_data
+ self.score = defaultdict(int)
+ # sel... | |
996c9428ce3f56a5f3914d2b02d670c88a198230 | morse_trainer/test_grouping.py | morse_trainer/test_grouping.py | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Test code for 'grouping' widget used by Morse Trainer.
"""
import sys
from grouping import Grouping
from PyQt5.QtWidgets import (QApplication, QWidget, QHBoxLayout,
QVBoxLayout, QPushButton)
class TestGrouping(QWidget):
"""Application t... | Test code for 'grouping' module | Test code for 'grouping' module
| Python | mit | rzzzwilson/morse,rzzzwilson/morse | ---
+++
@@ -0,0 +1,37 @@
+#!/usr/bin/python3
+# -*- coding: utf-8 -*-
+
+"""
+Test code for 'grouping' widget used by Morse Trainer.
+"""
+
+import sys
+from grouping import Grouping
+from PyQt5.QtWidgets import (QApplication, QWidget, QHBoxLayout,
+ QVBoxLayout, QPushButton)
+
+
+class Te... | |
ecce482fd99263c6b2f9aa8eddc668954ab41cc6 | tests/test_strategy.py | tests/test_strategy.py | import unittest
from decimal import Decimal as D
from oscar_vat_moss.partner.strategy import * # noqa
from mock import Mock
class DeferredVATSelectorTest(unittest.TestCase):
def test_selector(self):
selector = DeferredVATSelector()
strategy = selector.strategy()
self.assertEqual(strateg... | Add unit tests for Strategy and Selector classes | Add unit tests for Strategy and Selector classes
| Python | bsd-3-clause | fghaas/django-oscar-vat_moss,arbrandes/django-oscar-vat_moss,fghaas/django-oscar-vat_moss,hastexo/django-oscar-vat_moss,hastexo/django-oscar-vat_moss,arbrandes/django-oscar-vat_moss | ---
+++
@@ -0,0 +1,57 @@
+import unittest
+from decimal import Decimal as D
+from oscar_vat_moss.partner.strategy import * # noqa
+
+from mock import Mock
+
+
+class DeferredVATSelectorTest(unittest.TestCase):
+
+ def test_selector(self):
+ selector = DeferredVATSelector()
+ strategy = selector.stra... | |
889e6d72fed0b51fbca9ca717279ec31aa3f12b0 | kpi/management/commands/is_database_empty.py | kpi/management/commands/is_database_empty.py | # coding: utf-8
from django.core.management.base import BaseCommand, CommandError
from django.db import connections
from django.db.utils import ConnectionDoesNotExist, OperationalError
class Command(BaseCommand):
help = (
'Determine if one or more databases are empty, returning a '
'tab-separated ... | Add management command to check for empty database | Add management command to check for empty database
Will be used by kobo-install; see kobotoolbox/kobo-install#65
| Python | agpl-3.0 | kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi,kobotoolbox/kpi | ---
+++
@@ -0,0 +1,76 @@
+# coding: utf-8
+from django.core.management.base import BaseCommand, CommandError
+from django.db import connections
+from django.db.utils import ConnectionDoesNotExist, OperationalError
+
+
+class Command(BaseCommand):
+ help = (
+ 'Determine if one or more databases are empty, r... | |
121eefa0dd37b2dac75c56a33f1f96258b206c4c | record_cubes.py | record_cubes.py |
from __future__ import print_function
import os
import sys
# Hack to get parent folder in path
sys.path.insert(1, os.path.join(sys.path[0], '..'))
import magmo
def main():
#for day in range(11, 30+1):
for day in range(21, 21+1):
sources = magmo.get_day_obs_data(day)
print (sources)
... | Add stats on which fields had cubes produced or had spectra used. Tidy up console output Add zoomed in l-v plot | Add stats on which fields had cubes produced or had spectra used.
Tidy up console output
Add zoomed in l-v plot
| Python | apache-2.0 | jd-au/magmo-HI,jd-au/magmo-HI | ---
+++
@@ -0,0 +1,30 @@
+
+
+from __future__ import print_function
+
+import os
+import sys
+
+# Hack to get parent folder in path
+sys.path.insert(1, os.path.join(sys.path[0], '..'))
+
+import magmo
+
+def main():
+ #for day in range(11, 30+1):
+ for day in range(21, 21+1):
+ sources = magmo.get_day_ob... | |
7405c342522cf3686b5946fb30a59c74c410c655 | tests/site/pages/migrations/0002_regularpage.py | tests/site/pages/migrations/0002_regularpage.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-02 04:26
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import wagtail.wagtailcore.fields
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0033_remov... | Add missing migration for tests.app.pages (fixes build) | Add missing migration for tests.app.pages (fixes build)
| Python | mit | LabD/wagtail-personalisation,LabD/wagtail-personalisation,LabD/wagtail-personalisation | ---
+++
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.1 on 2017-06-02 04:26
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.db.models.deletion
+import wagtail.wagtailcore.fields
+
+
+class Migration(migrations.Migration):
+
+ dependencies ... | |
254403f507ea8ae075a791f24a031eaa79fc2447 | tools/dev/wc-format.py | tools/dev/wc-format.py | #!/usr/bin/env python
import os
import sqlite3
import sys
# helper
def usage():
sys.stderr.write("USAGE: %s [PATH]\n" + \
"\n" + \
"Prints to stdout the format of the working copy at PATH.\n")
# parse argv
wc = (sys.argv[1:] + ['.'])[0]
# main()
entries = os.path.join(wc, '.s... | Add a helper script, ported to Python. | Add a helper script, ported to Python.
* tools/dev/wc-format.py: New.
Prints the working copy format of a given directory.
| Python | apache-2.0 | jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion,jmckaskill/subversion | ---
+++
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+
+import os
+import sqlite3
+import sys
+
+# helper
+def usage():
+ sys.stderr.write("USAGE: %s [PATH]\n" + \
+ "\n" + \
+ "Prints to stdout the format of the working copy at PATH.\n")
+
+# parse argv
+wc = (sys.argv[1:] + ['.'])[0]... | |
ab5c5b5d7c214b17b48add9caeaa36a81e3886f5 | tests/test_exc.py | tests/test_exc.py | # Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | # Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | Change assertTrue(isinstance()) by optimal assert | Change assertTrue(isinstance()) by optimal assert
assertTrue(isinstance(A, B)) or assertEqual(type(A), B) in tests
should be replaced by assertIsInstance(A, B) provided by testtools.
I have searched all the tests, there is only one wrong usage.
Change-Id: Ib1db1a2dca7b5d8cbfe823973e4b571d0f0925c5
Closes-bug: #126848... | Python | apache-2.0 | klmitch/python-glanceclient,alexpilotti/python-glanceclient,JioCloud/python-glanceclient,mmasaki/python-glanceclient,mmasaki/python-glanceclient,openstack/python-glanceclient,JioCloud/python-glanceclient,varunarya10/python-glanceclient,varunarya10/python-glanceclient,klmitch/python-glanceclient,openstack/python-glancec... | ---
+++
@@ -26,4 +26,4 @@
def test_from_response(self):
"""exc.from_response should return instance of an HTTP exception."""
out = exc.from_response(FakeResponse(400))
- self.assertTrue(isinstance(out, exc.HTTPBadRequest))
+ self.assertIsInstance(out, exc.HTTPBadRequest) |
576fa1969c09554d6d5b6ceaf4c9a2b33fbc2238 | git-get.py | git-get.py | #!/usr/bin/env python3
import logging
import os
import subprocess
def git(command):
"""Runs command"""
command = "git " + command
logger.debug("Running: " + command)
try:
subprocess.run(command.split(" "), stdout=subprocess.PIPE)
except Exception as error_message:
logger.error("Fa... | Allow basic downloading of repos | Allow basic downloading of repos
| Python | mit | abactel/git-get | ---
+++
@@ -0,0 +1,44 @@
+#!/usr/bin/env python3
+
+import logging
+import os
+import subprocess
+
+
+def git(command):
+ """Runs command"""
+ command = "git " + command
+ logger.debug("Running: " + command)
+ try:
+ subprocess.run(command.split(" "), stdout=subprocess.PIPE)
+ except Exception a... | |
2cc44f5b97653d4b1b2070a90f079bab57116ebf | edisgo/opf/results/opf_expand_network.py | edisgo/opf/results/opf_expand_network.py | import numpy as np
def expand_network(edisgo, tolerance=1e-6):
"""
Apply network expansion factors that were obtained by optimization
to eDisGo MVGrid
Parameters
----------
edisgo : :class:`~.edisgo.EDisGo`
tolerance : float
The acceptable margin with which an expansion factor can... | Add function to map OPF results to eDisGo network | Add function to map OPF results to eDisGo network
This adds a function that applies the OPF network expansion factors
to the MV grid of an eDisGo object
| Python | agpl-3.0 | openego/eDisGo,openego/eDisGo | ---
+++
@@ -0,0 +1,31 @@
+import numpy as np
+
+
+def expand_network(edisgo, tolerance=1e-6):
+ """
+ Apply network expansion factors that were obtained by optimization
+ to eDisGo MVGrid
+
+ Parameters
+ ----------
+ edisgo : :class:`~.edisgo.EDisGo`
+ tolerance : float
+ The acceptable m... | |
3bcfcc4717014227de3775a2870e65d157862852 | unioncal.py | unioncal.py | import os.path
import pytz
import icalendar
import datetime
from urllib.request import urlopen
url1 = 'https://www.google.com/calendar/ical/loganlyf%40gmail.com/private-d45c0973da1e18ebc6394c484ac5bbfb/basic.ics'
url2 = 'https://www.google.com/calendar/ical/6v928aad58pqdh360ruh1t9dps%40group.calendar.google.com/priva... | Read ics, explore data structure. | Read ics, explore data structure.
| Python | agpl-3.0 | louy2/Calenssist,asm-products/calenssist | ---
+++
@@ -0,0 +1,23 @@
+import os.path
+import pytz
+import icalendar
+import datetime
+from urllib.request import urlopen
+
+url1 = 'https://www.google.com/calendar/ical/loganlyf%40gmail.com/private-d45c0973da1e18ebc6394c484ac5bbfb/basic.ics'
+
+url2 = 'https://www.google.com/calendar/ical/6v928aad58pqdh360ruh1t9d... | |
0f50bcddeeb0f7c63e7885b2bd306509654460f1 | dear_astrid/parser.py | dear_astrid/parser.py | """Parse Astrid xml backup file into simple data structures."""
from datetime import datetime
import re
# TODO: ArgumentError?
class AstridValueError(Exception):
"""Value does not match expected format and cannot be parsed"""
def __init__(self, key, val):
Exception.__init__(self,
'Unknown format for Ast... | Create functions for date and recurrence parsing | Create functions for date and recurrence parsing
| Python | mit | rwstauner/dear_astrid,rwstauner/dear_astrid | ---
+++
@@ -0,0 +1,55 @@
+"""Parse Astrid xml backup file into simple data structures."""
+
+from datetime import datetime
+import re
+
+# TODO: ArgumentError?
+class AstridValueError(Exception):
+ """Value does not match expected format and cannot be parsed"""
+ def __init__(self, key, val):
+ Exception.__init_... | |
73fd98aee14ff800ec53bd4296a5ea97c6b754b8 | test/unittests/skills/test_fallback_skill.py | test/unittests/skills/test_fallback_skill.py | from unittest import TestCase, mock
from mycroft.skills import FallbackSkill
def setup_fallback(fb_class):
fb_skill = fb_class()
fb_skill.bind(mock.Mock(name='bus'))
fb_skill.initialize()
return fb_skill
class TestFallbackSkill(TestCase):
def test_life_cycle(self):
"""Test startup and s... | Add test cases for adding / removing fallbacks | Add test cases for adding / removing fallbacks
| Python | apache-2.0 | MycroftAI/mycroft-core,MycroftAI/mycroft-core,forslund/mycroft-core,forslund/mycroft-core | ---
+++
@@ -0,0 +1,50 @@
+from unittest import TestCase, mock
+
+from mycroft.skills import FallbackSkill
+
+
+def setup_fallback(fb_class):
+ fb_skill = fb_class()
+ fb_skill.bind(mock.Mock(name='bus'))
+ fb_skill.initialize()
+ return fb_skill
+
+
+class TestFallbackSkill(TestCase):
+ def test_life_c... | |
43ecf3f61feef5d046770c2ff816ba98ef88aad4 | python/leetcode/test/test_ex771.py | python/leetcode/test/test_ex771.py | from nose.tools import raises, assert_raises
import unittest
from ex771 import Solution
class TestClass:
def setup(self):
self.solution = Solution()
def test_empty_jewels(self):
result = self.solution.numJewelsInStones("", "ABC")
assert result == 0
def test_non_empty_jewels(sel... | Add tests for leetcode exercise (771) | Add tests for leetcode exercise (771)
| Python | mit | vilisimo/ads,vilisimo/ads | ---
+++
@@ -0,0 +1,24 @@
+from nose.tools import raises, assert_raises
+
+import unittest
+
+from ex771 import Solution
+
+class TestClass:
+ def setup(self):
+ self.solution = Solution()
+
+ def test_empty_jewels(self):
+ result = self.solution.numJewelsInStones("", "ABC")
+ assert result ... | |
6ad9395de430fedbabf79ec4bb136e5f5e2da7f7 | tests/test_group_create.py | tests/test_group_create.py | import argparse
import getpass
import logging
import pyics
try:
import httplib
except ImportError:
import http.client as httplib
# super debug mode - print all HTTP requests/responses
#httplib.HTTPConnection.debuglevel = 1
TEST_GROUP_NAME = 'pyics-test-group'
def parse_args():
p = argparse.ArgumentPa... | Add basic testing script for groups | Add basic testing script for groups
| Python | apache-2.0 | locke105/pyics | ---
+++
@@ -0,0 +1,70 @@
+import argparse
+import getpass
+import logging
+
+import pyics
+
+try:
+ import httplib
+except ImportError:
+ import http.client as httplib
+
+# super debug mode - print all HTTP requests/responses
+#httplib.HTTPConnection.debuglevel = 1
+
+
+TEST_GROUP_NAME = 'pyics-test-group'
+
+
... | |
e023f8786765d8a57f45a77f0acfe70b90c2e098 | 2018/python/aoc_common.py | 2018/python/aoc_common.py | """aoc_common
Common utility functions for Advent of Code solutions
"""
import pathlib
def load_puzzle_input(day):
"""Return the puzzle input for the day’s puzzle"""
input_directory = pathlib.Path(__file__).parent.with_name('input')
year = input_directory.parent.name
input_filename = f'{year}-{day:0... | Add utility module to load puzzle input | Add utility module to load puzzle input
| Python | mit | robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions,robjwells/adventofcode-solutions | ---
+++
@@ -0,0 +1,14 @@
+"""aoc_common
+
+Common utility functions for Advent of Code solutions
+"""
+
+import pathlib
+
+
+def load_puzzle_input(day):
+ """Return the puzzle input for the day’s puzzle"""
+ input_directory = pathlib.Path(__file__).parent.with_name('input')
+ year = input_directory.parent.na... | |
2d5f39bd68481c81ecf676eb99d1d0e88e9540f7 | test_version.py | test_version.py | # -*- coding: utf-8 -*-
#
# test_version.py
# Part of ‘python-daemon’, an implementation of PEP 3143.
#
# Copyright © 2008–2014 Ben Finney <ben+python@benfinney.id.au>
#
# This is free software: you may copy, modify, and/or distribute this work
# under the terms of the GNU General Public License as published by the
# F... | Add test cases for ‘VersionInfoWriter’. | Add test cases for ‘VersionInfoWriter’. | Python | apache-2.0 | wting/python-daemon,eaufavor/python-daemon | ---
+++
@@ -0,0 +1,88 @@
+# -*- coding: utf-8 -*-
+#
+# test_version.py
+# Part of ‘python-daemon’, an implementation of PEP 3143.
+#
+# Copyright © 2008–2014 Ben Finney <ben+python@benfinney.id.au>
+#
+# This is free software: you may copy, modify, and/or distribute this work
+# under the terms of the GNU General Pu... | |
301a7ff10f4a630ca403571aee8624bf98329b16 | zipfsong_old.py | zipfsong_old.py | #!/usr/bin/python2
""""
Zipf's song problem
v1.0 without using any class structure like creating a Song class
Jose Antonio Navarrete
@joseanavarrete
"""
import sys
def process_info(n_played, song_name, song_number, songs_array):
"""
Inserts into songs_array song_name processed with its zipf coeficient
"... | Update zipfsong with unit test refactor and python3 | Update zipfsong with unit test refactor and python3
| Python | mit | josenava/spotify_puzzle | ---
+++
@@ -0,0 +1,48 @@
+#!/usr/bin/python2
+
+""""
+Zipf's song problem
+v1.0 without using any class structure like creating a Song class
+Jose Antonio Navarrete
+@joseanavarrete
+"""
+
+import sys
+
+
+def process_info(n_played, song_name, song_number, songs_array):
+ """
+ Inserts into songs_array song_nam... | |
e39187779b0bd2a10290ef019a331a8a64a57a25 | generate_nodes_module.py | generate_nodes_module.py | #!/usr/bin/env python3
from viper.parser.ast.generate_nodes_module import generate_text_from_parsed_rules
from viper.parser.grammar import GRAMMAR_FILE
from viper.parser.grammar_parsing.parse_grammar import parse_grammar_file
from os.path import dirname, join
basedir = dirname(__file__)
output = join(basedir, 'vipe... | Add script to generate nodes.py module for AST | Add script to generate nodes.py module for AST
| Python | apache-2.0 | pdarragh/Viper | ---
+++
@@ -0,0 +1,22 @@
+#!/usr/bin/env python3
+
+from viper.parser.ast.generate_nodes_module import generate_text_from_parsed_rules
+from viper.parser.grammar import GRAMMAR_FILE
+from viper.parser.grammar_parsing.parse_grammar import parse_grammar_file
+
+from os.path import dirname, join
+
+
+basedir = dirname(_... | |
74cf0ba2d329475870d72574da32cd134c5bef97 | examples/gen_dhcpconf.py | examples/gen_dhcpconf.py | #!/usr/bin/python
"""A script which generates DHCP configuration for hosts matching a regex.
Usage:
gen_dhcpconf.py <regex> <compute_resource>
e.g.
gen_dhcpconf.py 'ssi2+' 'Online Engineering'
"""
import re
import sys
from psphere.client import Client
client = Client()
host_regex = sys.argv[1]
p = re.compil... | Add an example which generates DHCP configuration | Add an example which generates DHCP configuration
| Python | apache-2.0 | jkinred/psphere,graphite-server/psphere | ---
+++
@@ -0,0 +1,43 @@
+#!/usr/bin/python
+"""A script which generates DHCP configuration for hosts matching a regex.
+Usage:
+ gen_dhcpconf.py <regex> <compute_resource>
+e.g.
+ gen_dhcpconf.py 'ssi2+' 'Online Engineering'
+"""
+
+import re
+import sys
+
+from psphere.client import Client
+
+client = Client(... | |
47e1b1e2a023c0298f56b61159e76b27135b09ba | nuage_neutron/tests/unit/test_nuage_redirect_target.py | nuage_neutron/tests/unit/test_nuage_redirect_target.py | # Copyright 2020 NOKIA
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | Add unittest for concurrent redirect target create | Add unittest for concurrent redirect target create
Change-Id: I445901a6c1fd0105fdd4a82454c8767da751d1bc
Closes-Bug: OPENSTACK-2865
| Python | apache-2.0 | nuagenetworks/nuage-openstack-neutron,nuagenetworks/nuage-openstack-neutron | ---
+++
@@ -0,0 +1,46 @@
+# Copyright 2020 NOKIA
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless requir... | |
e3e5f1862651e2809e0178bc19f79d67f30a86f6 | tests/cpydiff/types_dict_keys_set.py | tests/cpydiff/types_dict_keys_set.py | """
categories: Types,dict
description: Dictionary keys view does not behave as a set.
cause: Not implemented.
workaround: Explicitly convert keys to a set before using set operations.
"""
print({1:2, 3:4}.keys() & {1})
| Add CPy diff-test for using dict.keys() as a set. | tests/cpydiff: Add CPy diff-test for using dict.keys() as a set.
See issue #5493.
| Python | mit | pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython | ---
+++
@@ -0,0 +1,7 @@
+"""
+categories: Types,dict
+description: Dictionary keys view does not behave as a set.
+cause: Not implemented.
+workaround: Explicitly convert keys to a set before using set operations.
+"""
+print({1:2, 3:4}.keys() & {1}) | |
6bd6203813bc4ca377baed842d7934a50f86f37e | Server/encryptedServer.py | Server/encryptedServer.py | __author__ = 'masudurrahman'
import sys
from twisted.protocols import ftp
from twisted.protocols.ftp import FTPFactory, FTPAnonymousShell, FTPRealm, FTP, FTPShell, IFTPShell
from twisted.cred.portal import Portal
from twisted.cred import checkers
from twisted.cred.checkers import AllowAnonymousAccess, FilePasswordDB
f... | Test -- Encrypted File Transfer Server | Test -- Encrypted File Transfer Server
Test server for SSL based file transfers | Python | apache-2.0 | mrahman1122/Team4CS3240 | ---
+++
@@ -0,0 +1,83 @@
+__author__ = 'masudurrahman'
+
+import sys
+from twisted.protocols import ftp
+from twisted.protocols.ftp import FTPFactory, FTPAnonymousShell, FTPRealm, FTP, FTPShell, IFTPShell
+from twisted.cred.portal import Portal
+from twisted.cred import checkers
+from twisted.cred.checkers import All... | |
29f8cc38a03f773726cfb1bce83eb3aaa34607fe | samples/tina/genPhilos.py | samples/tina/genPhilos.py | #!/usr/bin/env python
import sys
#####################################################
one_philo_places = \
"""
pl P%(id)dThink (1)
pl P%(id)dHasLeft (0)
pl P%(id)dHasRight (0)
pl P%(id)dEat (0)
pl P%(id)dFork (1)
"""
#####################################################
one_philo_arcs = \
"""
# ... | Add a TINA philosophers (Python) generator. | Add a TINA philosophers (Python) generator.
| Python | bsd-2-clause | ahamez/caesar.sdd | ---
+++
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+
+import sys
+
+#####################################################
+
+one_philo_places = \
+"""
+pl P%(id)dThink (1)
+pl P%(id)dHasLeft (0)
+pl P%(id)dHasRight (0)
+pl P%(id)dEat (0)
+pl P%(id)dFork (1)
+"""
+
+#####################################... | |
02f7c8e6f374f2d570fb6256612393018b2d3064 | learntools/computer_vision/ex2.py | learntools/computer_vision/ex2.py | from learntools.core import *
import tensorflow as tf
class Q1(CodingProblem):
_var = 'kernel'
_solution = CS("""
# This is just one possibility.
kernel = tf.constant([
[-2, -1, 0],
[-1, 1, 1],
[0, 1, 2],
])
""")
def check(self, kernel):
assert (isinstance(kernel, tf.Tensor))
a... | Add checking code for exercise 2 | Add checking code for exercise 2
| Python | apache-2.0 | Kaggle/learntools,Kaggle/learntools | ---
+++
@@ -0,0 +1,71 @@
+from learntools.core import *
+import tensorflow as tf
+
+
+class Q1(CodingProblem):
+ _var = 'kernel'
+ _solution = CS("""
+# This is just one possibility.
+kernel = tf.constant([
+ [-2, -1, 0],
+ [-1, 1, 1],
+ [0, 1, 2],
+])
+""")
+ def check(self, kernel):
+ asser... | |
9456944a66ded9bff986bdeda1cd8367d3a1ee37 | soundbridge-write.py | soundbridge-write.py | #!/usr/bin/python
#
# $Id$
"""
Write some text on a Roku soundbridge, using the telnet interface.
"""
import telnetlib
import syslog
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-H", "--hostname", dest="hostname", default="soundbridge")
parser.add_option("-t", "--text", dest="text",... | Add script to write text to a Roku Soundbridge. | Add script to write text to a Roku Soundbridge.
| Python | mit | andrewferrier/misc-scripts,andrewferrier/misc-scripts,jbreitbart/dropbox-cleanup | ---
+++
@@ -0,0 +1,36 @@
+#!/usr/bin/python
+#
+# $Id$
+
+"""
+Write some text on a Roku soundbridge, using the telnet interface.
+"""
+
+import telnetlib
+import syslog
+
+from optparse import OptionParser
+
+parser = OptionParser()
+
+parser.add_option("-H", "--hostname", dest="hostname", default="soundbridge")
+pa... | |
d3d1e9eb32af7a38f99fc602e2e9e897460dfbec | fellowms/migrations/0022_fellow_user.py | fellowms/migrations/0022_fellow_user.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-02 16:22
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependen... | Create migration for user field on fellow | Create migration for user field on fellow
| Python | bsd-3-clause | softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat | ---
+++
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.6 on 2016-06-02 16:22
+from __future__ import unicode_literals
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = ... | |
35f2cea484e2080e0b64fbcb995ef1adbc2d65dd | read_serial.py | read_serial.py | __author__ = 'miahi'
## Logger for serial APC Smart UPS
import serial
import csv
import time
import datetime
PORT = 'COM2'
BAUDRATE = 2400
SLEEP_SECONDS = 3
class APCSerial(object):
def __init__(self, port, baudrate=2400):
# todo: check that port exists & init errors
self.serial = serial.Serial... | Read from serial, write to CSV | Read from serial, write to CSV
| Python | mit | miahi/python.apcserial | ---
+++
@@ -0,0 +1,82 @@
+__author__ = 'miahi'
+
+## Logger for serial APC Smart UPS
+
+import serial
+import csv
+import time
+import datetime
+
+PORT = 'COM2'
+BAUDRATE = 2400
+SLEEP_SECONDS = 3
+
+
+class APCSerial(object):
+ def __init__(self, port, baudrate=2400):
+ # todo: check that port exists & ini... | |
7b35909083325ba6a22119b0f7a1cd352503cd93 | examples/concept_full_syntax.py | examples/concept_full_syntax.py | """Concept example of `Dependency Injector`."""
import sqlite3
from dependency_injector import catalogs
from dependency_injector import providers
from dependency_injector import injections
class UsersService(object):
"""Users service, that has dependency on database."""
def __init__(self, db):
"""I... | Add new one concept example that uses full syntax | Add new one concept example that uses full syntax
| Python | bsd-3-clause | ets-labs/python-dependency-injector,rmk135/objects,ets-labs/dependency_injector,rmk135/dependency_injector | ---
+++
@@ -0,0 +1,67 @@
+"""Concept example of `Dependency Injector`."""
+
+import sqlite3
+
+from dependency_injector import catalogs
+from dependency_injector import providers
+from dependency_injector import injections
+
+
+class UsersService(object):
+ """Users service, that has dependency on database."""
+
+... | |
8905993c0daa140b10cb04dca1e7bed7b813ea7a | imagedownloader/libs/console.py | imagedownloader/libs/console.py | import sys
import pyttsx
import aspects
from datetime import datetime
engine = pyttsx.init()
def show(*objs):
begin = '' if '\r' in objs[0] or '\b' in objs[0] else '\n'
sys.stdout.write(begin)
for part in objs:
sys.stdout.write(str(part))
sys.stdout.flush()
def say(speech):
#NOT engine.startLoop()
show(speec... | import sys
import pyttsx
import aspects
from datetime import datetime
engine = pyttsx.init()
def show(*objs):
begin = '' if '\r' in objs[0] or '\b' in objs[0] else '\n'
sys.stdout.write(begin)
for part in objs:
sys.stdout.write(str(part))
sys.stdout.flush()
def say(speech):
#NOT engine.startLoop()
show(speec... | Add UTC timezone to datetimes in the libs folder. | Add UTC timezone to datetimes in the libs folder.
| Python | mit | ahMarrone/solar_radiation_model,scottlittle/solar_radiation_model,gersolar/solar_radiation_model | ---
+++
@@ -23,8 +23,8 @@
show('\b \b', progress[i % len(progress)])
def show_times(*args):
- begin = datetime.now()
+ begin = datetime.utcnow().replace(tzinfo=pytz.UTC)
result = yield aspects.proceed(*args)
- end = datetime.now()
+ end = datetime.utcnow().replace(tzinfo=pytz.UTC)
say("\t[time consumed: %.2f... |
3f0ef7d273eaecad8f5b278e762a056bf17ffdb8 | test/tools/lldb-mi/TestMiSyntax.py | test/tools/lldb-mi/TestMiSyntax.py | """
Test that the lldb-mi driver understands MI command syntax.
"""
import os
import unittest2
import lldb
from lldbtest import *
class MiSyntaxTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
myexe = "a.out"
@classmethod
def classCleanup(cls):
"""Cleanup the test byproducts."""
... | Add test for MI tokens. This file tests the sequence of digits that can come before an MI command. | Add test for MI tokens.
This file tests the sequence of digits that can come before
an MI command.
Patch from dawn@burble.org.
git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@222873 91177308-0d34-0410-b5e6-96231b3b80d8
| Python | apache-2.0 | llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb | ---
+++
@@ -0,0 +1,85 @@
+"""
+Test that the lldb-mi driver understands MI command syntax.
+"""
+
+import os
+import unittest2
+import lldb
+from lldbtest import *
+
+class MiSyntaxTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+ myexe = "a.out"
+
+ @classmethod
+ def classCleanup(cls):
... | |
0e2dda38e19523ab2c5ac935ee4f9886b2067d5b | platforms/migrations/0008_platform_short_name.py | platforms/migrations/0008_platform_short_name.py | # Generated by Django 2.2.12 on 2021-04-18 00:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('platforms', '0007_auto_20180515_2130'),
]
operations = [
migrations.AddField(
model_name='platform',
name='short_na... | Add migration for short name | Add migration for short name
| Python | agpl-3.0 | lutris/website,lutris/website,lutris/website,lutris/website | ---
+++
@@ -0,0 +1,18 @@
+# Generated by Django 2.2.12 on 2021-04-18 00:16
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('platforms', '0007_auto_20180515_2130'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_na... | |
d2375ebc4908d58c1a168619ed1e1e8eb59ebf25 | geotrek/diving/tests/test_models.py | geotrek/diving/tests/test_models.py | from django.test import TestCase
from geotrek.common.tests import TranslationResetMixin
from geotrek.diving.models import Dive
from geotrek.diving.factories import DiveFactory, DivingManagerFactory, PracticeFactory, LevelFactory
from mapentity.factories import SuperUserFactory
class DiveTest(TranslationResetMixin, ... | Add test model for dives | Add test model for dives
| Python | bsd-2-clause | GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek | ---
+++
@@ -0,0 +1,19 @@
+from django.test import TestCase
+
+from geotrek.common.tests import TranslationResetMixin
+from geotrek.diving.models import Dive
+from geotrek.diving.factories import DiveFactory, DivingManagerFactory, PracticeFactory, LevelFactory
+
+from mapentity.factories import SuperUserFactory
+
+
+c... | |
a0990c986635e4079b9c7145497e44fdbde48280 | tests/parser/test_ast_integrity.py | tests/parser/test_ast_integrity.py | import pytest
from tests.infrastructure.test_utils import parse_local, parse_full
from thinglang.compiler.errors import NoExceptionHandlers
from thinglang.parser.errors import StructureError
IN_THING_DEFINITION = '''
thing Person
{}
'''.strip()
IN_METHOD_DEFINITION = '''
thing Person
does something
{... | Add test for AST integrity | Add test for AST integrity
| Python | mit | ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang | ---
+++
@@ -0,0 +1,56 @@
+import pytest
+
+from tests.infrastructure.test_utils import parse_local, parse_full
+from thinglang.compiler.errors import NoExceptionHandlers
+from thinglang.parser.errors import StructureError
+
+IN_THING_DEFINITION = '''
+thing Person
+ {}
+'''.strip()
+
+IN_METHOD_DEFINITION = '''
+t... | |
359d5bb5b40cb1a15b9b3ed6fb4710ed7a6e5f89 | tests/test_integration/test_user_resource.py | tests/test_integration/test_user_resource.py | import demands
from tests.test_integration.helpers import create_user
from tests.test_integration.test_case import YolaServiceTestCase
class TestYolaUser(YolaServiceTestCase):
"""Yola: User resource"""
@classmethod
def setUpClass(cls):
super(TestYolaUser, cls).setUpClass()
cls.user = cls... | Add integration tests for user resource | Add integration tests for user resource
| Python | mit | yola/yolapy | ---
+++
@@ -0,0 +1,67 @@
+import demands
+
+from tests.test_integration.helpers import create_user
+from tests.test_integration.test_case import YolaServiceTestCase
+
+
+class TestYolaUser(YolaServiceTestCase):
+ """Yola: User resource"""
+
+ @classmethod
+ def setUpClass(cls):
+ super(TestYolaUser, c... | |
ab754d5924168d027bfc2eeed7881b9b2e469535 | tools/autobuild/build-downloads.py | tools/autobuild/build-downloads.py | #!/usr/bin/env python3
import glob
import json
import os
import sys
def main(repo_path, output_path):
boards_index = []
board_ids = set()
for board_json in glob.glob(os.path.join(repo_path, "ports/*/boards/*/board.json")):
# Relative path to the board directory (e.g. "ports/stm32/boards/PYBV11")... | Add script to generate website board metadata. | tools/autobuild: Add script to generate website board metadata.
Signed-off-by: Jim Mussared <e84f5c941266186d0c97dcc873413469b954847e@gmail.com>
| Python | mit | adafruit/circuitpython,bvernoux/micropython,adafruit/circuitpython,adafruit/circuitpython,bvernoux/micropython,adafruit/circuitpython,bvernoux/micropython,adafruit/circuitpython,bvernoux/micropython,adafruit/circuitpython,bvernoux/micropython | ---
+++
@@ -0,0 +1,58 @@
+#!/usr/bin/env python3
+
+import glob
+import json
+import os
+import sys
+
+
+def main(repo_path, output_path):
+ boards_index = []
+ board_ids = set()
+
+ for board_json in glob.glob(os.path.join(repo_path, "ports/*/boards/*/board.json")):
+ # Relative path to the board dir... | |
a0e3d1c7bc0dfe321323f26db631747188218d1e | test_12.py | test_12.py | from lib.tweet.parseTwitter import retrieveTweetText
from lib.querygen.tweets2query import QueryGenerator
hashtag = "twitterblades"
tweets = retrieveTweetText(hashtag)
qgen = QueryGenerator()
query_list = qgen.gen_query_list(hashtag, tweets)
print("Query list for \"%s\" is " % hashtag)
print(query_list)
| Test for module 1 and 2. | Test for module 1 and 2.
| Python | apache-2.0 | mzweilin/HashTag-Understanding,mzweilin/HashTag-Understanding,mzweilin/HashTag-Understanding | ---
+++
@@ -0,0 +1,12 @@
+from lib.tweet.parseTwitter import retrieveTweetText
+from lib.querygen.tweets2query import QueryGenerator
+
+hashtag = "twitterblades"
+tweets = retrieveTweetText(hashtag)
+
+qgen = QueryGenerator()
+
+
+query_list = qgen.gen_query_list(hashtag, tweets)
+print("Query list for \"%s\" is ... | |
7f6c9d7f577424b02ddd08ce3b189d31575a01de | lldbDataFormatters.py | lldbDataFormatters.py | """
Load into LLDB with:
script import lldbDataFormatters
type synthetic add -x "^llvm::SmallVectorImpl<.+>$" -l lldbDataFormatters.SmallVectorSynthProvider
"""
# Pretty printer for llvm::SmallVector/llvm::SmallVectorImpl
class SmallVectorSynthProvider:
def __init__(self, valobj, dict):
self.valobj = valob... | Add an LLDB data formatter script for llvm::SmallVector, maybe this is helpful to someone else. | Add an LLDB data formatter script for llvm::SmallVector, maybe this is helpful to someone else.
This lets lldb give sane output for SmallVectors, e.g.
Before:
(lldb) p sv
(llvm::SmallVector<int, 10>) $0 = {
(llvm::SmallVectorImpl<int>) llvm::SmallVectorImpl<int> = {
(llvm::SmallVectorTemplateBase<int>) llvm::Sma... | Python | bsd-3-clause | lodyagin/bare_cxx,lodyagin/bare_cxx,lodyagin/bare_cxx,lodyagin/bare_cxx,lodyagin/bare_cxx | ---
+++
@@ -0,0 +1,53 @@
+"""
+Load into LLDB with:
+script import lldbDataFormatters
+type synthetic add -x "^llvm::SmallVectorImpl<.+>$" -l lldbDataFormatters.SmallVectorSynthProvider
+"""
+
+# Pretty printer for llvm::SmallVector/llvm::SmallVectorImpl
+class SmallVectorSynthProvider:
+ def __init__(self, valobj... | |
1c0a2ebeca404572bef2807dc697c90c1be1a65a | tools/count_lines.py | tools/count_lines.py |
import os
test_dir = ".."
total_lines = 0
for _root, _dirs, _files in os.walk(test_dir):
for _file in _files:
file_lines = sum(1 for line in open(os.path.join(_root, _file)))
total_lines += file_lines
print("total lines: %d" % total_lines)
| Add a line count script | Add a line count script
Signed-off-by: xcgspring <8f4f8d15922e4269158d45cde01dc3497961f40d@126.com>
| Python | apache-2.0 | xcgspring/AXUI,xcgspring/AXUI,xcgspring/AXUI | ---
+++
@@ -0,0 +1,10 @@
+
+import os
+test_dir = ".."
+total_lines = 0
+for _root, _dirs, _files in os.walk(test_dir):
+ for _file in _files:
+ file_lines = sum(1 for line in open(os.path.join(_root, _file)))
+ total_lines += file_lines
+
+print("total lines: %d" % total_lines) | |
49f588ba82151d4f2a8c8cbe0123775ef2514cf5 | django-server/feel/core/db/update_fixtures.py | django-server/feel/core/db/update_fixtures.py | import subprocess
from django.conf import settings
MY_APPS = settings.MY_APPS
COMMAND_FORMAT = "python manage.py dumpdata {app} > core/fixtures/{app}.json"
def update_fixtures():
for app in MY_APPS:
command = COMMAND_FORMAT.format(app=app)
print(command)
subprocess.check_output(command, s... | Add script to update course content. | Fixtures: Add script to update course content.
| Python | mit | pixyj/feel,pixyj/feel,pixyj/feel,pixyj/feel,pixyj/feel | ---
+++
@@ -0,0 +1,15 @@
+import subprocess
+
+from django.conf import settings
+MY_APPS = settings.MY_APPS
+
+COMMAND_FORMAT = "python manage.py dumpdata {app} > core/fixtures/{app}.json"
+
+def update_fixtures():
+ for app in MY_APPS:
+ command = COMMAND_FORMAT.format(app=app)
+ print(command)
+ ... | |
2d57d39112e3abbc116f4a937c28711fa15ee89a | waffle/migrations/0002_auto_20150721_1437.py | waffle/migrations/0002_auto_20150721_1437.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('sites', '0001_initial'),
('waffle', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='f... | Add updated migration for our work with 1.7 | Add updated migration for our work with 1.7
| Python | bsd-3-clause | isotoma/django-waffle,isotoma/django-waffle,isotoma/django-waffle,isotoma/django-waffle | ---
+++
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('sites', '0001_initial'),
+ ('waffle', '0001_initial'),
+ ]
+
+ operations = [
+ migr... | |
359ea0dd38cdc2b48322a3ad21568176916dfede | examsys/migrations/0003_auto_20150315_1936.py | examsys/migrations/0003_auto_20150315_1936.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('examsys', '0002_auto_20150315_1640'),
]
operations = [
migrations.RenameModel(
old_name='TestToAnswer',
... | Change the name of the model. | Change the name of the model. | Python | mit | icyflame/test-taking-platform,icyflame/test-taking-platform | ---
+++
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('examsys', '0002_auto_20150315_1640'),
+ ]
+
+ operations = [
+ migrations.RenameModel(
+ ... | |
2c5dbf8fb147b9d9494de5f8abff52aeedf1cabf | src/bilor/core/handler.py | src/bilor/core/handler.py | import datetime
import logging
import sys
import traceback
import requests
from werkzeug.debug.tbtools import get_current_traceback
class BilorHandler(logging.Handler):
"""Logging handler for bilor.
Based on raven.
"""
def __init__(self, host, *args, **kwargs):
super(BilorHandler, self).__... | Add temporary, not yet working client | Add temporary, not yet working client
| Python | bsd-3-clause | EnTeQuAk/bilor,EnTeQuAk/bilor,EnTeQuAk/bilor,EnTeQuAk/bilor | ---
+++
@@ -0,0 +1,92 @@
+import datetime
+import logging
+import sys
+import traceback
+
+import requests
+
+from werkzeug.debug.tbtools import get_current_traceback
+
+
+class BilorHandler(logging.Handler):
+ """Logging handler for bilor.
+
+ Based on raven.
+ """
+
+ def __init__(self, host, *args, **k... | |
cffb8551169c18f68eb8eaa506a8565b8080dc54 | read_ts.py | read_ts.py | #!/usr/bin/env python3
from ts import *
import sys
pmt_pid = None
pes_readers = {}
for ts_packet in read_ts(sys.argv[1]):
print(ts_packet)
if ts_packet.pid == ProgramAssociationTable.PID:
pat = ProgramAssociationTable(ts_packet.payload)
input()
print(pat)
programs = list(pat.pro... | Add tool to analyse MPEG-TS packets. | Add tool to analyse MPEG-TS packets.
| Python | bsd-2-clause | brendanlong/dash-ts-tools,brendanlong/dash-ts-tools | ---
+++
@@ -0,0 +1,36 @@
+#!/usr/bin/env python3
+from ts import *
+import sys
+
+pmt_pid = None
+pes_readers = {}
+for ts_packet in read_ts(sys.argv[1]):
+ print(ts_packet)
+ if ts_packet.pid == ProgramAssociationTable.PID:
+ pat = ProgramAssociationTable(ts_packet.payload)
+ input()
+ pri... | |
5d360aaf0d619472026a1099e606043fe4910bcf | studygroups/management/commands/fix_start_end_dates.py | studygroups/management/commands/fix_start_end_dates.py | from django.core.management.base import BaseCommand, CommandError
from studygroups.models import StudyGroup
class Command(BaseCommand):
help = 'Make sure all study groups with meetings have the correct start/end dates'
def handle(self, *args, **options):
for sg in StudyGroup.objects.active():
... | Add task to correctly set start/end dates based on active meetings for past / current learning circles | Add task to correctly set start/end dates based on active meetings for past / current learning circles
| Python | mit | p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles,p2pu/learning-circles | ---
+++
@@ -0,0 +1,18 @@
+from django.core.management.base import BaseCommand, CommandError
+
+from studygroups.models import StudyGroup
+
+class Command(BaseCommand):
+ help = 'Make sure all study groups with meetings have the correct start/end dates'
+
+ def handle(self, *args, **options):
+ for sg in ... | |
f540f024a99fb99e91b3cb38d88f211416c04d7c | munigeo/migrations/0002_auto_20150608_1607.py | munigeo/migrations/0002_auto_20150608_1607.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('munigeo', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='municipality',
name='... | Add migration to go with 04fcda3. | Add migration to go with 04fcda3.
| Python | agpl-3.0 | City-of-Helsinki/munigeo | ---
+++
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('munigeo', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ mod... | |
eb81bf33d26923e5d79d87aa0e4c1db32eaf7c7c | admin/base/migrations/0002_groups.py | admin/base/migrations/0002_groups.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django.contrib.auth.models import Group
import logging
logger = logging.getLogger(__file__)
def add_groups(*args):
group, created = Group.objects.get_or_create(name='nodes_and_users')
if created:
lo... | Add start of a migration to add new groups for OSF Admin | Add start of a migration to add new groups for OSF Admin
| Python | apache-2.0 | Johnetordoff/osf.io,monikagrabowska/osf.io,brianjgeiger/osf.io,hmoco/osf.io,TomBaxter/osf.io,Johnetordoff/osf.io,mattclark/osf.io,HalcyonChimera/osf.io,cwisecarver/osf.io,cwisecarver/osf.io,caseyrollins/osf.io,erinspace/osf.io,monikagrabowska/osf.io,Nesiehr/osf.io,aaxelb/osf.io,crcresearch/osf.io,brianjgeiger/osf.io,sa... | ---
+++
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations
+from django.contrib.auth.models import Group
+import logging
+
+logger = logging.getLogger(__file__)
+
+
+def add_groups(*args):
+ group, created = Group.objects.get_or_create(name='nodes... | |
4a5e5d07f3510394ac1112727c66ddd122762aa9 | test/long_test.py | test/long_test.py | #!/usr/bin/python
import sys
from os import execv
from optparse import OptionParser
from cloud_retester import do_test, do_test_cloud, report_cloud, setup_testing_nodes, terminate_testing_nodes
long_test_branch = "long-test"
no_checkout_arg = "--no-checkout"
def exec_self(args):
execv("/usr/bin/env", ["python", s... | Check out 'long-test' branch and reexecute self at long test startup. | Check out 'long-test' branch and reexecute self at long test startup.
| Python | agpl-3.0 | pap/rethinkdb,tempbottle/rethinkdb,alash3al/rethinkdb,yaolinz/rethinkdb,Qinusty/rethinkdb,tempbottle/rethinkdb,wkennington/rethinkdb,wkennington/rethinkdb,sontek/rethinkdb,greyhwndz/rethinkdb,bpradipt/rethinkdb,scripni/rethinkdb,scripni/rethinkdb,eliangidoni/rethinkdb,lenstr/rethinkdb,eliangidoni/rethinkdb,captainpete/... | ---
+++
@@ -0,0 +1,40 @@
+#!/usr/bin/python
+import sys
+from os import execv
+from optparse import OptionParser
+from cloud_retester import do_test, do_test_cloud, report_cloud, setup_testing_nodes, terminate_testing_nodes
+
+long_test_branch = "long-test"
+no_checkout_arg = "--no-checkout"
+
+def exec_self(args):
+... | |
697f5fdc260157da86abbf4579cd3f5e04eb3c63 | brazilnum/cei.py | brazilnum/cei.py | #!/usr/bin/env python
import re
import random
from operator import mul
"""
Functions for working with Brazilian CEI identifiers.
"""
NONDIGIT = re.compile(r'[^0-9]')
CEI_WEIGHTS = [7, 4, 1, 8, 5, 2, 1, 6, 3, 7, 4]
def clean_cei(cei):
"""Takes a CEI and turns it into a string of only numbers."""
return NOND... | Create validator for CEI identifiers | Create validator for CEI identifiers
Cadastro Específico do INS (CEI) is a business identifier for entities
that are not required to have a CNPJ.
| Python | mit | poliquin/brazilnum | ---
+++
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+
+import re
+import random
+from operator import mul
+
+"""
+Functions for working with Brazilian CEI identifiers.
+
+"""
+
+NONDIGIT = re.compile(r'[^0-9]')
+CEI_WEIGHTS = [7, 4, 1, 8, 5, 2, 1, 6, 3, 7, 4]
+
+def clean_cei(cei):
+ """Takes a CEI and turns it into a... | |
0528ee6f8170eac9bc928ea9d52c59f2cf4f8f26 | test_3_amsaves.py | test_3_amsaves.py | #!/usr/bin/env python
__author__ = "Eric Allen Youngson"
__email__ = "eric@scneco.com"
__copyright__ = "Copyright 2015, Succession Ecological Services"
__license__ = "GNU Affero (GPLv3)"
""" This module provides functions for requesting results from the DeltaMeter
Services API * deltameterservices.com * """
impo... | Split the amsaves tests to focus on the second test function | Split the amsaves tests to focus on the second test function
| Python | agpl-3.0 | eayoungs/DeltaMtrSvs,eayoungs/DeltaMtrSvs | ---
+++
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+
+__author__ = "Eric Allen Youngson"
+__email__ = "eric@scneco.com"
+__copyright__ = "Copyright 2015, Succession Ecological Services"
+__license__ = "GNU Affero (GPLv3)"
+
+""" This module provides functions for requesting results from the DeltaMeter
+ Services API ... | |
58e22254e06b8112652b5875c02e69dcf46b8a63 | src/rgbd_benchmark_tools/h5_collectSamples.py | src/rgbd_benchmark_tools/h5_collectSamples.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 17 09:02:31 2015
@author: jesus
"""
import argparse
import numpy as np
import h5py
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='''
This script collects the metrics and results from several samples of an experiment ... | Add script to collect metric results in a single dataset for a main group | Add script to collect metric results in a single dataset for a main group | Python | bsd-2-clause | jesusbriales/rgbd_benchmark_tools | ---
+++
@@ -0,0 +1,56 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+"""
+Created on Thu Sep 17 09:02:31 2015
+
+@author: jesus
+"""
+
+import argparse
+import numpy as np
+
+import h5py
+
+if __name__ == '__main__':
+
+ parser = argparse.ArgumentParser(description='''
+ This script collects the metrics and re... | |
e582644d41f3422128dfc4d45c290ac51361b4aa | pyatv/auth/hap_session.py | pyatv/auth/hap_session.py | """Cryptograhpy routines used by HAP."""
from typing import Optional
from pyatv.support.chacha20 import Chacha20Cipher
class HAPSession:
"""Manages cryptography for a HAP session according to IP in specification.
The HAP specification mandates that data is encrypted/decrypted in blocks
of 1024 bytes. T... | Add HAPSession used for encryption | auth: Add HAPSession used for encryption
Relates to #1255
| Python | mit | postlund/pyatv,postlund/pyatv | ---
+++
@@ -0,0 +1,59 @@
+"""Cryptograhpy routines used by HAP."""
+
+from typing import Optional
+
+from pyatv.support.chacha20 import Chacha20Cipher
+
+
+class HAPSession:
+ """Manages cryptography for a HAP session according to IP in specification.
+
+ The HAP specification mandates that data is encrypted/de... | |
555dcd9ca022f7479415a69dd5cffee46366e055 | scripts/showlog.py | scripts/showlog.py | #!/usr/bin/python3
import sys
import argparse
from kafka import KafkaConsumer
parser = argparse.ArgumentParser(description='Zoe Kafka log viewer')
parser.add_argument('kafka_address', help='Address of the Kafka broker')
parser.add_argument('--list-logs', action='store_true', help='List all the available service logs... | Add a script to retrieve logs from kafka | Add a script to retrieve logs from kafka
| Python | apache-2.0 | DistributedSystemsGroup/zoe,DistributedSystemsGroup/zoe,DistributedSystemsGroup/zoe,DistributedSystemsGroup/zoe,DistributedSystemsGroup/zoe | ---
+++
@@ -0,0 +1,31 @@
+#!/usr/bin/python3
+
+import sys
+import argparse
+
+from kafka import KafkaConsumer
+
+parser = argparse.ArgumentParser(description='Zoe Kafka log viewer')
+parser.add_argument('kafka_address', help='Address of the Kafka broker')
+parser.add_argument('--list-logs', action='store_true', help... | |
02a8745ddc0e9618f79e144a92258ff8ac3f35aa | bluebottle/utils/staticfiles_finders.py | bluebottle/utils/staticfiles_finders.py | from django.utils._os import safe_join
import os
from django.conf import settings
from django.contrib.staticfiles.finders import FileSystemFinder
from bluebottle.clients.models import Client
class TenantStaticFilesFinder(FileSystemFinder):
def find(self, path, all=False):
"""
Looks for files in ... | Add tenant static files finder | Add tenant static files finder
| Python | bsd-3-clause | jfterpstra/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,jfterpstra/bluebottle,jfterpstra/bluebottle,jfterpstra/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | ---
+++
@@ -0,0 +1,34 @@
+from django.utils._os import safe_join
+import os
+from django.conf import settings
+from django.contrib.staticfiles.finders import FileSystemFinder
+from bluebottle.clients.models import Client
+
+
+class TenantStaticFilesFinder(FileSystemFinder):
+
+
+ def find(self, path, all=False):
+... | |
dda477cb554d000f6a534848725629d20158aba7 | main.py | main.py | #!/usr/bin/env python3
import sys
import os.path
import re
import linecache
import subprocess
import urllib.request
import zipfile
if len(sys.argv) != 2:
print ('''Invalid usage :
Usage : ghost-update /path/to/your/ghost
''')
sys.exit(1)
ghostPath = sys.argv[1];
packageJson = os.path.join(gho... | Check if it's a ghost instance and download latest ghost release | Check if it's a ghost instance and download latest ghost release
| Python | mpl-2.0 | MatonAnthony/ghost-update | ---
+++
@@ -0,0 +1,39 @@
+#!/usr/bin/env python3
+
+import sys
+import os.path
+import re
+import linecache
+import subprocess
+import urllib.request
+import zipfile
+
+if len(sys.argv) != 2:
+ print ('''Invalid usage :
+ Usage : ghost-update /path/to/your/ghost
+ ''')
+ sys.exit(1)
+
+ghostPath =... | |
b05649bb6c99195542569c7d378991eba2187d58 | tsort_3.py | tsort_3.py | def merge(input_array, beg, mid, end):
"""Merge procedure for merge sort algorithm"""
listA = input_array[beg:mid+1]
listB = input_array[mid+1:end+1]
current_position = beg
while len(listA)>0 and len(listB)>0:
if(listA[0] < listB[0]):
input_array[current_position] = listA[0]
listA.pop(0)
e... | Add alternate tsort solution - mergesort, with slightly modified merge procedure | Add alternate tsort solution - mergesort, with slightly modified merge procedure
| Python | mit | sandy-8925/codechef | ---
+++
@@ -0,0 +1,45 @@
+def merge(input_array, beg, mid, end):
+ """Merge procedure for merge sort algorithm"""
+ listA = input_array[beg:mid+1]
+ listB = input_array[mid+1:end+1]
+ current_position = beg
+ while len(listA)>0 and len(listB)>0:
+ if(listA[0] < listB[0]):
+ input_array[current_position] ... | |
1ebed09254aa5601956af9038a3f6cb8591913c8 | buildlet/task/cachedtask.py | buildlet/task/cachedtask.py | """
Tasks cached on data store.
"""
from .base import BaseTask
class BaseCachedTask(BaseTask):
datastore = None
"""
Data store instance. Child class **must** set this attribute.
"""
def is_finished(self):
current = self.get_taskhash()
cached = self.get_cached_taskhash()
... | Add conceptual implementation of BaseCachedTask | Add conceptual implementation of BaseCachedTask
| Python | bsd-3-clause | tkf/buildlet | ---
+++
@@ -0,0 +1,63 @@
+"""
+Tasks cached on data store.
+"""
+
+from .base import BaseTask
+
+
+class BaseCachedTask(BaseTask):
+
+ datastore = None
+ """
+ Data store instance. Child class **must** set this attribute.
+ """
+
+ def is_finished(self):
+ current = self.get_taskhash()
+ ... | |
9c0a4529c15cdc5f32b1d4718995092dfb9cb263 | migrations/versions/30_rm_unique_constraint.py | migrations/versions/30_rm_unique_constraint.py | from alembic import op
revision = '30_rm_unique_constraint'
down_revision = '20_initialise_data'
def upgrade():
op.drop_constraint("users_name_key", "users")
def downgrade():
op.create_unique_constraint("users_name_key", "users", ["name"]) | Remove unique constraint on users.name | Remove unique constraint on users.name
| Python | mit | alphagov/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,alphagov/notifications-admin,gov-cjwaszczuk/notifications-admin,gov-cjwaszczuk/notifications-admin | ---
+++
@@ -0,0 +1,12 @@
+from alembic import op
+
+revision = '30_rm_unique_constraint'
+down_revision = '20_initialise_data'
+
+
+def upgrade():
+ op.drop_constraint("users_name_key", "users")
+
+
+def downgrade():
+ op.create_unique_constraint("users_name_key", "users", ["name"]) | |
33e23230315f7a922e50264948c42b2c68116cc2 | numba/tests/issues/test_potential_gcc_error.py | numba/tests/issues/test_potential_gcc_error.py | # This tests a potential GCC 4.1.2 miscompile of LLVM.
# The problem is observed as a error in greedy register allocation pass,
# which resulted as a segfault.
# No such problem in GCC 4.4.6.
from numba import *
import numpy as np
@jit(uint8[:,:](f8, f8, f8, f8, uint8[:,:], int32))
def create_fractal(min_x, max_x, m... | Add tests for the possibly gcc miscompile error of LLVM in the mandel example. | Add tests for the possibly gcc miscompile error of LLVM in the mandel example.
| Python | bsd-2-clause | numba/numba,gmarkall/numba,pombredanne/numba,pitrou/numba,pitrou/numba,IntelLabs/numba,numba/numba,ssarangi/numba,gmarkall/numba,stuartarchibald/numba,jriehl/numba,stefanseefeld/numba,numba/numba,pitrou/numba,GaZ3ll3/numba,stonebig/numba,pitrou/numba,shiquanwang/numba,stefanseefeld/numba,stuartarchibald/numba,stonebig/... | ---
+++
@@ -0,0 +1,15 @@
+# This tests a potential GCC 4.1.2 miscompile of LLVM.
+# The problem is observed as a error in greedy register allocation pass,
+# which resulted as a segfault.
+# No such problem in GCC 4.4.6.
+
+
+from numba import *
+import numpy as np
+
+@jit(uint8[:,:](f8, f8, f8, f8, uint8[:,:], int32... | |
cc003f9bf3dfe2d8f4eba8f123fb23be1d9a393c | tests/GrammarCopyTest.py | tests/GrammarCopyTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 16.08.2017 19:16
:Licence GNUv3
Part of grammpy
"""
from unittest import main, TestCase
from grammpy import *
class GrammarCopyTest(TestCase):
pass
if __name__ == '__main__':
main()
| Add file for tests of grammar copy | Add file for tests of grammar copy
| Python | mit | PatrikValkovic/grammpy | ---
+++
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+"""
+:Author Patrik Valkovic
+:Created 16.08.2017 19:16
+:Licence GNUv3
+Part of grammpy
+
+"""
+
+from unittest import main, TestCase
+from grammpy import *
+
+
+class GrammarCopyTest(TestCase):
+ pass
+
+
+if __name__ == '__main__':
+ main() | |
6d67213b80350fe63e46ea2a18688f4a5a3f0d81 | spacy/tests/regression/test_issue850.py | spacy/tests/regression/test_issue850.py | '''
Test Matcher matches with '*' operator and Boolean flag
'''
from __future__ import unicode_literals
import pytest
from ...matcher import Matcher
from ...vocab import Vocab
from ...attrs import LOWER
from ...tokens import Doc
@pytest.mark.xfail
def test_issue850():
matcher = Matcher(Vocab())
IS_ANY_TOKEN ... | Add test for 850: Matcher fails on zero-or-more. | Add test for 850: Matcher fails on zero-or-more.
| Python | mit | Gregory-Howard/spaCy,honnibal/spaCy,aikramer2/spaCy,Gregory-Howard/spaCy,oroszgy/spaCy.hu,recognai/spaCy,Gregory-Howard/spaCy,oroszgy/spaCy.hu,explosion/spaCy,raphael0202/spaCy,aikramer2/spaCy,aikramer2/spaCy,Gregory-Howard/spaCy,spacy-io/spaCy,spacy-io/spaCy,spacy-io/spaCy,honnibal/spaCy,recognai/spaCy,aikramer2/spaCy... | ---
+++
@@ -0,0 +1,29 @@
+'''
+Test Matcher matches with '*' operator and Boolean flag
+'''
+from __future__ import unicode_literals
+import pytest
+
+from ...matcher import Matcher
+from ...vocab import Vocab
+from ...attrs import LOWER
+from ...tokens import Doc
+
+
+@pytest.mark.xfail
+def test_issue850():
+ ma... | |
25f1e9d2b28c98dd8ccfeaab73179fc003deb6f5 | tools/csmith-gen-many.py | tools/csmith-gen-many.py | #!/usr/bin/python
# Copyright (c) 2013 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# This code uses csmith to generate a large amount of .c files, change the entry
# point of each from main to entry_N and then cr... | Add a script for driving csmith to generate large compilation inputs. | Add a script for driving csmith to generate large compilation inputs.
BUG=None
R=dschuff@chromium.org
Review URL: https://codereview.chromium.org/91043004
git-svn-id: 721b910a23eff8a86f00c8fd261a7587cddf18f8@12466 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2
| Python | bsd-3-clause | sbc100/native_client,sbc100/native_client,sbc100/native_client,sbc100/native_client,sbc100/native_client,sbc100/native_client | ---
+++
@@ -0,0 +1,55 @@
+#!/usr/bin/python
+# Copyright (c) 2013 The Native Client Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+#
+# This code uses csmith to generate a large amount of .c files, change the entry
+# point of eac... | |
09a51971d1350fcdaa0d863c3b15d142302a7516 | scripts/request_capabilities.py | scripts/request_capabilities.py | from bluebottle.clients.models import Client
from bluebottle.clients.utils import LocalTenant
from bluebottle.funding_stripe.utils import stripe
from bluebottle.funding_stripe.models import StripePayoutAccount
def run(*args):
for client in Client.objects.all():
with LocalTenant(client):
for a... | Add script that requests new capabilities | Add script that requests new capabilities
| Python | bsd-3-clause | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | ---
+++
@@ -0,0 +1,21 @@
+from bluebottle.clients.models import Client
+from bluebottle.clients.utils import LocalTenant
+
+from bluebottle.funding_stripe.utils import stripe
+from bluebottle.funding_stripe.models import StripePayoutAccount
+
+
+def run(*args):
+ for client in Client.objects.all():
+ with L... | |
4719167b6ee1c6dd276218c84b15b9cba4fefc2e | config/pox_sync.py | config/pox_sync.py | from config.experiment_config_lib import ControllerConfig
from sts.control_flow.fuzzer import Fuzzer
from sts.input_traces.input_logger import InputLogger
from sts.simulation_state import SimulationConfig
from sts.invariant_checker import InvariantChecker
from sts.topology import MeshTopology, BufferedPatchPanel
from s... | Add example for using sync protocol in pox | Add example for using sync protocol in pox
| Python | apache-2.0 | jmiserez/sts,jmiserez/sts | ---
+++
@@ -0,0 +1,37 @@
+from config.experiment_config_lib import ControllerConfig
+from sts.control_flow.fuzzer import Fuzzer
+from sts.input_traces.input_logger import InputLogger
+from sts.simulation_state import SimulationConfig
+from sts.invariant_checker import InvariantChecker
+from sts.topology import MeshTo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.