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
56d0f20de569deb359e172bee7bf245a398c3430
setting_seq_len.py
setting_seq_len.py
import tensorflow as tf import numpy as np tf.set_random_seed(765) np.random.seed(765) tf.reset_default_graph() n_inputs = 3 n_neurons = 5 n_steps = 2 X = tf.placeholder(tf.float32, [None, n_steps, n_inputs]) seq_length = tf.placeholder(tf.int32, [None]) basic_cell = tf.contrib.rnn.BasicRNNCell(num_units=n_neurons)...
Add code for setting sequence length for RNN
Add code for setting sequence length for RNN In some cases, sequence length may differ (sentences, sound) This small example shows how to manually deal seq of different lengths.
Python
mit
KT12/hands_on_machine_learning
--- +++ @@ -0,0 +1,36 @@ +import tensorflow as tf +import numpy as np + +tf.set_random_seed(765) +np.random.seed(765) +tf.reset_default_graph() + +n_inputs = 3 +n_neurons = 5 +n_steps = 2 + +X = tf.placeholder(tf.float32, [None, n_steps, n_inputs]) +seq_length = tf.placeholder(tf.int32, [None]) + +basic_cell = tf.con...
033bcb02dbd0e4c7c89ddd350c2fa0ca247f59ee
tests/disabled_test_animals.py
tests/disabled_test_animals.py
# -*- coding: utf-8 -*- # Copyright (c) 2015-2016 MIT Probabilistic Computing Project # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unles...
Add the animals testing harness.
Add the animals testing harness.
Python
apache-2.0
probcomp/cgpm,probcomp/cgpm
--- +++ @@ -0,0 +1,68 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2015-2016 MIT Probabilistic Computing Project + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at + +# http://www.apac...
8e744f67457222a143505f303c0254e43706d3f8
tests/aggregate/test_join_table_inheritance.py
tests/aggregate/test_join_table_inheritance.py
from decimal import Decimal import sqlalchemy as sa from sqlalchemy_utils.aggregates import aggregated from tests import TestCase class TestLazyEvaluatedSelectExpressionsForAggregates(TestCase): dns = 'postgres://postgres@localhost/sqlalchemy_utils_test' def create_models(self): class Catalog(self.Ba...
Add tests for aggregates with inheritance
Add tests for aggregates with inheritance
Python
bsd-3-clause
joshfriend/sqlalchemy-utils,marrybird/sqlalchemy-utils,konstantinoskostis/sqlalchemy-utils,rmoorman/sqlalchemy-utils,tonyseek/sqlalchemy-utils,joshfriend/sqlalchemy-utils,tonyseek/sqlalchemy-utils,cheungpat/sqlalchemy-utils,spoqa/sqlalchemy-utils,JackWink/sqlalchemy-utils
--- +++ @@ -0,0 +1,90 @@ +from decimal import Decimal +import sqlalchemy as sa +from sqlalchemy_utils.aggregates import aggregated +from tests import TestCase + + +class TestLazyEvaluatedSelectExpressionsForAggregates(TestCase): + dns = 'postgres://postgres@localhost/sqlalchemy_utils_test' + + def create_models...
54a3be9039292f33d8d29a749353a92fca6cc1c9
tests/__init__.py
tests/__init__.py
#TODO: REMOVE COMMENTS ONCE BELOW TESTS ARE CONVERTED TO THE UNITTEST FRAMEWORK #from .test_dataset import * from .test_pandas_dataset import * #from .test_great_expectations import * #from .test_util import *
Add default module for tests to support automatically running all unit tests, with associated scaffold for when other tests are converted.
Add default module for tests to support automatically running all unit tests, with associated scaffold for when other tests are converted.
Python
apache-2.0
great-expectations/great_expectations,great-expectations/great_expectations,great-expectations/great_expectations,great-expectations/great_expectations
--- +++ @@ -0,0 +1,6 @@ +#TODO: REMOVE COMMENTS ONCE BELOW TESTS ARE CONVERTED TO THE UNITTEST FRAMEWORK + +#from .test_dataset import * +from .test_pandas_dataset import * +#from .test_great_expectations import * +#from .test_util import *
c047804ec995884794afc26fd57872becbe8686f
tests/test_git.py
tests/test_git.py
from subprocess import check_call from valohai_cli.git import get_current_commit def test_get_current_commit(tmpdir): dir = str(tmpdir) check_call('git init', cwd=dir, shell=True) check_call('git config user.name Robot', cwd=dir, shell=True) check_call('git config user.email robot@example.com', cwd=d...
Add a test for get_current_commit
Add a test for get_current_commit
Python
mit
valohai/valohai-cli
--- +++ @@ -0,0 +1,14 @@ +from subprocess import check_call + +from valohai_cli.git import get_current_commit + + +def test_get_current_commit(tmpdir): + dir = str(tmpdir) + check_call('git init', cwd=dir, shell=True) + check_call('git config user.name Robot', cwd=dir, shell=True) + check_call('git config...
1c2e7d773efa8e015bfa964fefe4c50c3cd9ac46
src/lib/arcgis_data_source.py
src/lib/arcgis_data_source.py
# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
Add ArcGIS data source util
Add ArcGIS data source util
Python
apache-2.0
GoogleCloudPlatform/covid-19-open-data,GoogleCloudPlatform/covid-19-open-data
--- +++ @@ -0,0 +1,83 @@ +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by appl...
396d8f6774ad4d75e15ae13481c04e9c9241204d
writer/kafka_sample_writer.py
writer/kafka_sample_writer.py
from kafka import KafkaClient, create_message from kafka.protocol import KafkaProtocol from kafka.common import ProduceRequest import random import logging class KafkaSampleWriter(object): """ KafkaSampleWriter can be used to write sample messages into Kafka for benchmark purposes """ def __init__...
Add kafka writer for benchmarks
Add kafka writer for benchmarks
Python
apache-2.0
mre/kafka-influxdb,mre/kafka-influxdb
--- +++ @@ -0,0 +1,41 @@ +from kafka import KafkaClient, create_message +from kafka.protocol import KafkaProtocol +from kafka.common import ProduceRequest +import random +import logging + +class KafkaSampleWriter(object): + """ + KafkaSampleWriter can be used to write sample messages into Kafka for + benchma...
31357d68a7d0fa473ef518e28f239cd2a8b1cb5d
seaborn/tests/test_miscplot.py
seaborn/tests/test_miscplot.py
import nose.tools as nt import numpy.testing as npt import matplotlib.pyplot as plt from .. import miscplot as misc from seaborn import color_palette class TestPalPlot(object): """Test the function that visualizes a color palette.""" def test_palplot_size(self): pal4 = color_palette("husl", 4) ...
Add simple test for palplot
Add simple test for palplot
Python
bsd-3-clause
bsipocz/seaborn,ashhher3/seaborn,petebachant/seaborn,wrobstory/seaborn,mia1rab/seaborn,parantapa/seaborn,mwaskom/seaborn,ebothmann/seaborn,q1ang/seaborn,nileracecrew/seaborn,mclevey/seaborn,anntzer/seaborn,ischwabacher/seaborn,cwu2011/seaborn,dotsdl/seaborn,sauliusl/seaborn,clarkfitzg/seaborn,lukauskas/seaborn,aashish2...
--- +++ @@ -0,0 +1,28 @@ +import nose.tools as nt +import numpy.testing as npt +import matplotlib.pyplot as plt + +from .. import miscplot as misc +from seaborn import color_palette + + +class TestPalPlot(object): + """Test the function that visualizes a color palette.""" + def test_palplot_size(self): + + ...
a09bfa5ca64c52df68581849e1a96efe79dfc2ee
astropy/io/fits/tests/test_fitsdiff_openfile.py
astropy/io/fits/tests/test_fitsdiff_openfile.py
import pytest from astropy.io import fits import numpy as np from pathlib import Path def test_fitsdiff_openfile(tmpdir): """Make sure that failing FITSDiff doesn't leave open files""" path1 = str(tmpdir.join("file1.fits")) path2 = str(tmpdir.join("file2.fits")) hdulist = fits.HDUList([fits.PrimaryHDU...
Add test showing --open-files error when FITSDiff raises AssertionError
Add test showing --open-files error when FITSDiff raises AssertionError
Python
bsd-3-clause
pllim/astropy,dhomeier/astropy,aleksandr-bakanov/astropy,aleksandr-bakanov/astropy,StuartLittlefair/astropy,saimn/astropy,larrybradley/astropy,mhvk/astropy,pllim/astropy,larrybradley/astropy,lpsinger/astropy,larrybradley/astropy,dhomeier/astropy,lpsinger/astropy,astropy/astropy,astropy/astropy,saimn/astropy,dhomeier/as...
--- +++ @@ -0,0 +1,17 @@ +import pytest +from astropy.io import fits +import numpy as np +from pathlib import Path + +def test_fitsdiff_openfile(tmpdir): + """Make sure that failing FITSDiff doesn't leave open files""" + path1 = str(tmpdir.join("file1.fits")) + path2 = str(tmpdir.join("file2.fits")) + + h...
e1ea5c1c3f1279aca22341bd83b3f73acf50d332
DataWrangling/CaseStudy/tags.py
DataWrangling/CaseStudy/tags.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import xml.etree.cElementTree as ET import pprint import re import os """ Your task is to explore the data a bit more. Before you process the data and add it into your database, you should check the "k" value for each "<tag>" and see if there are any potential problems. We...
Add a script which check the <k> value for each <tag> and see if there are any potential problems
feat: Add a script which check the <k> value for each <tag> and see if there are any potential problems
Python
mit
aguijarro/DataSciencePython
--- +++ @@ -0,0 +1,71 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +import xml.etree.cElementTree as ET +import pprint +import re +import os +""" +Your task is to explore the data a bit more. +Before you process the data and add it into your database, you should check the +"k" value for each "<tag>" and see if ...
b3fbc81bf4c00d23042cebc34503c6cf6937db22
test/dunyatest.py
test/dunyatest.py
import unittest from compmusic.dunya.conn import _make_url class DunyaTest(unittest.TestCase): def test_unicode(self): params = {"first": "%^grt"} url = _make_url("path", **params) self.assertEqual(url, 'http://dunya.compmusic.upf.edu/path?first=%25%5Egrt')
Add test for conn._make_url. Test if url is encoded properly
Add test for conn._make_url. Test if url is encoded properly
Python
agpl-3.0
MTG/pycompmusic
--- +++ @@ -0,0 +1,10 @@ +import unittest + +from compmusic.dunya.conn import _make_url + + +class DunyaTest(unittest.TestCase): + def test_unicode(self): + params = {"first": "%^grt"} + url = _make_url("path", **params) + self.assertEqual(url, 'http://dunya.compmusic.upf.edu/path?first=%25%5E...
749ab21acc35bd93eb402dc95cc6e8729165a4b8
elections/2008/shapes/coords.py
elections/2008/shapes/coords.py
#!/usr/bin/env python import math def geoToPixel( point, zoom, tilesize=256 ): lng = point[0] if lng > 180.0: lng -= 360.0 lng = lng / 360.0 + 0.5 lat = point[1] lat = 0.5 - ( math.log( math.tan( ( math.pi / 4.0 ) + ( lat * math.pi / 360.0 ) ) ) / math.pi / 2.0 ); scale = ( 1 << zoom ) * tilesize return [ i...
Add geographic coordinte to pixel coordinate converter
Add geographic coordinte to pixel coordinate converter
Python
apache-2.0
cureHsu/js-v2-samples,cureHsu/js-v2-samples,feeilk1991/promenad,feeilk1991/promenad,stephenmcd/js-v2-samples,feeilk1991/promenad,googlearchive/js-v2-samples,bawg/js-v2-samples,alexander0205/js-v2-samples,googlearchive/js-v2-samples,cureHsu/js-v2-samples,googlearchive/js-v2-samples,cureHsu/js-v2-samples,feeilk1991/prome...
--- +++ @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +import math + +def geoToPixel( point, zoom, tilesize=256 ): + lng = point[0] + if lng > 180.0: lng -= 360.0 + lng = lng / 360.0 + 0.5 + + lat = point[1] + lat = 0.5 - ( math.log( math.tan( ( math.pi / 4.0 ) + ( lat * math.pi / 360.0 ) ) ) / math.pi / 2.0 ); + + scal...
cff64915aaaee0aff3cec7b918cd4a008b327912
chipy_org/urls.py
chipy_org/urls.py
from django.conf import settings from django.conf.urls.defaults import * from django.views.generic.simple import direct_to_template from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.contrib import admin from contact.views import ChipyContactView admin.autodiscover() urlpatterns = patter...
from django.conf import settings from django.conf.urls.defaults import * from django.views.generic.simple import direct_to_template from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.contrib import admin from contact.views import ChipyContactView admin.autodiscover() urlpatterns = patter...
Set for zero or one slash
Set for zero or one slash
Python
mit
bharathelangovan/chipy.org,agfor/chipy.org,brianray/chipy.org,brianray/chipy.org,agfor/chipy.org,chicagopython/chipy.org,tanyaschlusser/chipy.org,tanyaschlusser/chipy.org,bharathelangovan/chipy.org,agfor/chipy.org,chicagopython/chipy.org,tanyaschlusser/chipy.org,brianray/chipy.org,chicagopython/chipy.org,bharathelangov...
--- +++ @@ -11,7 +11,7 @@ urlpatterns = patterns("", url(r'', include('main.urls')), url(r'', include('social_auth.urls')), - url(r'^login', direct_to_template, { + url(r'^login/{0,1}$', direct_to_template, { 'template': 'login.html' }), (r'^grappelli/', include('grappelli.urls')...
60353a2ee3c54b68d83c6e5b55ef298388f81a5c
mcdowell/src/main/python/ch1/arrays.py
mcdowell/src/main/python/ch1/arrays.py
def unique(string): counter = {} for c in string: if c in counter: return False else: counter[c] = 1 else: return True def reverse(string): result = [] for i in range(len(string)): result.append(string[-(i+1)]) return "".join(result) def ...
Rename module and add replace_spaces.
Rename module and add replace_spaces.
Python
mit
jamesewoo/tigeruppercut,jamesewoo/tigeruppercut
--- +++ @@ -0,0 +1,44 @@ +def unique(string): + counter = {} + for c in string: + if c in counter: + return False + else: + counter[c] = 1 + else: + return True + +def reverse(string): + result = [] + for i in range(len(string)): + result.append(string[...
f406a955784adf14583c3855e175fddeffc94250
fixlib/couch.py
fixlib/couch.py
import fix42 import couchdb import copy class Store(object): def __init__(self, *args): self.db = couchdb.Server(args[0])[args[1]] self._last = None @property def last(self): if self._last is not None: return self._last cur = self.db.view('seq/in', descending=True, limit=1) inc = cur.rows[0].key if...
Move CouchDB-based Store into separate module.
Move CouchDB-based Store into separate module.
Python
bsd-3-clause
djc/fixlib,jvirtanen/fixlib
--- +++ @@ -0,0 +1,42 @@ +import fix42 +import couchdb +import copy + +class Store(object): + + def __init__(self, *args): + self.db = couchdb.Server(args[0])[args[1]] + self._last = None + + @property + def last(self): + if self._last is not None: + return self._last + cur = self.db.view('seq/in', descending...
e2b86299738a726b5bec0a2441426ed4651d9a26
dmoj/executors/JAVA10.py
dmoj/executors/JAVA10.py
from dmoj.executors.java_executor import JavacExecutor class Executor(JavacExecutor): compiler = 'javac10' vm = 'java10' name = 'JAVA10' jvm_regex = r'java-10-|openjdk10' test_program = '''\ import java.io.IOException; interface IORunnable { public void run() throws IOException; } public cl...
Add Java 10 (EAP) executor support
Add Java 10 (EAP) executor support
Python
agpl-3.0
DMOJ/judge,DMOJ/judge,DMOJ/judge
--- +++ @@ -0,0 +1,33 @@ +from dmoj.executors.java_executor import JavacExecutor + + +class Executor(JavacExecutor): + compiler = 'javac10' + vm = 'java10' + name = 'JAVA10' + jvm_regex = r'java-10-|openjdk10' + + test_program = '''\ +import java.io.IOException; + +interface IORunnable { + public vo...
01cb4195bffaeb0ab264fd8d9ee390492312ef15
Problems/spiralMatrix.py
Problems/spiralMatrix.py
#!/Applications/anaconda/envs/Python3/bin def main(): # Test suite matrix = [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ] spiral = spiral_order(matrix) print(spiral) def spiral_order(matrix): ''' Given an mxn matrix, returns the elements in spiral order Input: list of m...
Add spiral order of matrix problem
Add spiral order of matrix problem
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,66 @@ +#!/Applications/anaconda/envs/Python3/bin + + +def main(): + # Test suite + matrix = [ + [1, 2, 3], + [4, 5, 6], + [7, 8, 9] + ] + spiral = spiral_order(matrix) + print(spiral) + + +def spiral_order(matrix): + ''' + Given an mxn matrix, returns the e...
da1bb3a29b9c3da41bf6479563118922bec7f9ba
tests/test_grid.py
tests/test_grid.py
from parcels import Grid import numpy as np import pytest @pytest.mark.parametrize('xdim', [100, 200]) @pytest.mark.parametrize('ydim', [100, 200]) def test_grid_from_data(xdim, ydim): lon = np.linspace(0., 1., xdim, dtype=np.float32) lat = np.linspace(0., 1., ydim, dtype=np.float32) depth = np.zeros(1, d...
Add a baseline test for creating grids from data
Grid: Add a baseline test for creating grids from data
Python
mit
OceanPARCELS/parcels,OceanPARCELS/parcels
--- +++ @@ -0,0 +1,21 @@ +from parcels import Grid +import numpy as np +import pytest + + +@pytest.mark.parametrize('xdim', [100, 200]) +@pytest.mark.parametrize('ydim', [100, 200]) +def test_grid_from_data(xdim, ydim): + lon = np.linspace(0., 1., xdim, dtype=np.float32) + lat = np.linspace(0., 1., ydim, dtype=...
a3a377818e5521487cca1b08a4cc6adcdc7deef6
soft/python_test/mqttReceiver.py
soft/python_test/mqttReceiver.py
# -*- coding: utf-8 -*- """ Created on Tue Nov 10 20:30:02 2015 @author: piotr at nicecircuits.com """ # -*- coding: utf-8 -*- from __future__ import print_function # compatibility with python 2 and 3 __author__ = 'piotr' import paho.mqtt.client as mqtt import serial, time, re, logging, numpy server = "test.mosquitto...
Add MQTT receiver python script
Add MQTT receiver python script
Python
cc0-1.0
NiceCircuits/DrOctopus,NiceCircuits/DrOctopus,NiceCircuits/DrOctopus,NiceCircuits/DrOctopus
--- +++ @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +""" +Created on Tue Nov 10 20:30:02 2015 + +@author: piotr at nicecircuits.com +""" + +# -*- coding: utf-8 -*- +from __future__ import print_function # compatibility with python 2 and 3 +__author__ = 'piotr' +import paho.mqtt.client as mqtt +import serial, time, re, ...
787be359bb09d770c218d37c1f4f989cabb8cf1f
chainerrl/misc/reward_filter.py
chainerrl/misc/reward_filter.py
from __future__ import print_function from __future__ import unicode_literals from __future__ import division from __future__ import absolute_import from future import standard_library standard_library.install_aliases() class NormalizedRewardFilter(object): def __init__(self, tau=1e-3, scale=1, eps=1e-1): ...
Add reward filters to use average rewards
Add reward filters to use average rewards
Python
mit
toslunar/chainerrl,toslunar/chainerrl
--- +++ @@ -0,0 +1,37 @@ +from __future__ import print_function +from __future__ import unicode_literals +from __future__ import division +from __future__ import absolute_import +from future import standard_library +standard_library.install_aliases() + + +class NormalizedRewardFilter(object): + + def __init__(self...
e099786cfd080cc2616fcd22a62954b71740528b
tests/test_main.py
tests/test_main.py
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the Li...
Test the CLI interface of fenrir
Test the CLI interface of fenrir
Python
apache-2.0
dstufft/fenrir,dstufft/fenrir
--- +++ @@ -0,0 +1,52 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, s...
abf6af81b5f97ca6b6bb479adb1abfdf502d2a9b
utils/solve-all.py
utils/solve-all.py
import os import subprocess import sys import time paths = [] for path, dirs, files in os.walk('puzzles'): for file in files: paths.append(os.path.join(path, file)) for path in paths: for method in ['human', 'hybrid']: start = time.time() try: output = subprocess.check_outp...
Add a wrapper to solve all puzzles in ./puzzles and print out timings (timeout after a minute)
Add a wrapper to solve all puzzles in ./puzzles and print out timings (timeout after a minute)
Python
bsd-3-clause
jpverkamp/takuzu
--- +++ @@ -0,0 +1,25 @@ +import os +import subprocess +import sys +import time + +paths = [] +for path, dirs, files in os.walk('puzzles'): + for file in files: + paths.append(os.path.join(path, file)) + +for path in paths: + for method in ['human', 'hybrid']: + start = time.time() + try: +...
7fcc89f131753432fe42c0b3c373d3008353ba39
tools/novasetup.py
tools/novasetup.py
# Still some problems... import time import shutil from configobj import ConfigObj NOVA_API_CONF = "/etc/nova/api-paste.ini" OS_API_SEC = "composite:openstack_compute_api_v2" DR_FILTER_TARGET_KEY = "keystone_nolimit" DR_FILTER_TARGET_KEY_VALUE = "compute_req_id faultwrap sizelimit " \ "au...
Add a tools to config nova paste, not finished
Add a tools to config nova paste, not finished
Python
apache-2.0
fs714/drfilter
--- +++ @@ -0,0 +1,32 @@ +# Still some problems... + +import time +import shutil +from configobj import ConfigObj + +NOVA_API_CONF = "/etc/nova/api-paste.ini" +OS_API_SEC = "composite:openstack_compute_api_v2" +DR_FILTER_TARGET_KEY = "keystone_nolimit" +DR_FILTER_TARGET_KEY_VALUE = "compute_req_id faultwrap sizelimit...
edf2c0d777672568b2223fdbd6858f9c9a34ee44
DataWrangling/scraping_web2.py
DataWrangling/scraping_web2.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Script to get information from: http://www.transtats.bts.gov/Data_Elements.aspx?Data=2 about carrier and airports """ from bs4 import BeautifulSoup import requests import urllib2 def extract_data(url, s): # Extract data from a html source from a URL r = s.g...
Create file to get information from a particular URL to get data about airplanes and carriers.
feat: Create file to get information from a particular URL to get data about airplanes and carriers.
Python
mit
aguijarro/DataSciencePython
--- +++ @@ -0,0 +1,101 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +Script to get information from: +http://www.transtats.bts.gov/Data_Elements.aspx?Data=2 +about carrier and airports +""" + +from bs4 import BeautifulSoup +import requests +import urllib2 + + + +def extract_data(url, s): + # Extract d...
a239a0b213009c61a7f21f673f8698c3227048e2
tools/write_frames_linux_64.py
tools/write_frames_linux_64.py
#!/usr/bin/env python import os import sys import json import r2pipe from getopt import getopt, GetoptError r2 = None def write_frame(frame_no, lvl_prefix): lvl_path = os.path.join(lvl_prefix, "%d.lvl" % frame_no) print "writing frame %d from %s..." % (frame_no, lvl_path) lvl_frame = json.load(fp = open(...
Add a script to write frame changes to the executable.
Add a script to write frame changes to the executable.
Python
bsd-2-clause
snickerbockers/freedom_editor
--- +++ @@ -0,0 +1,48 @@ +#!/usr/bin/env python + +import os +import sys +import json +import r2pipe +from getopt import getopt, GetoptError + +r2 = None + +def write_frame(frame_no, lvl_prefix): + lvl_path = os.path.join(lvl_prefix, "%d.lvl" % frame_no) + print "writing frame %d from %s..." % (frame_no, lvl_pa...
e4e13c5be054707ea08cf18da36f5b01f745c818
mezzanine/twitter/__init__.py
mezzanine/twitter/__init__.py
""" Provides models and utilities for displaying different types of Twitter feeds. """ from __future__ import unicode_literals from django.utils.translation import ugettext_lazy as _ from mezzanine import __version__ # Constants/choices for the different query types. QUERY_TYPE_USER = "user" QUERY_TYPE_LIST = "lis...
""" Provides models and utilities for displaying different types of Twitter feeds. """ from __future__ import unicode_literals from django.utils.translation import ugettext_lazy as _ from mezzanine import __version__ # Constants/choices for the different query types. QUERY_TYPE_USER = "user" QUERY_TYPE_LIST = "lis...
Fix error raised when twitter lib is installed, but mezzanine.twitter is removed from INSTALLED_APPS.
Fix error raised when twitter lib is installed, but mezzanine.twitter is removed from INSTALLED_APPS.
Python
bsd-2-clause
damnfine/mezzanine,frankchin/mezzanine,mush42/mezzanine,promil23/mezzanine,ZeroXn/mezzanine,Kniyl/mezzanine,viaregio/mezzanine,damnfine/mezzanine,douglaskastle/mezzanine,nikolas/mezzanine,ZeroXn/mezzanine,readevalprint/mezzanine,promil23/mezzanine,Skytorn86/mezzanine,webounty/mezzanine,frankier/mezzanine,frankier/mezza...
--- +++ @@ -27,8 +27,12 @@ """ from mezzanine.conf import settings settings.use_editable() - auth_settings = (settings.TWITTER_CONSUMER_KEY, - settings.TWITTER_CONSUMER_SECRET, - settings.TWITTER_ACCESS_TOKEN_KEY, - settings.TWITTER_ACCESS_...
72b17165cbe2d9a46d2c66abf4919321f02c07c6
docs/conf.py
docs/conf.py
# -*- coding: utf-8 -*- # # This file is execfile()d with the current directory set to its containing # directory. import sys, os sys.path.append(os.path.join(os.path.abspath('.'), '_ext')) sys.path.append(os.path.dirname(os.path.abspath('.'))) import analytical # -- General configuration --------------------------...
# -*- coding: utf-8 -*- # # This file is execfile()d with the current directory set to its containing # directory. import sys, os sys.path.append(os.path.join(os.path.abspath('.'), '_ext')) sys.path.append(os.path.dirname(os.path.abspath('.'))) import analytical # -- General configuration --------------------------...
Update intersphinx mapping to Django 1.8
Update intersphinx mapping to Django 1.8
Python
mit
bittner/django-analytical,machtfit/django-analytical,apocquet/django-analytical,jcassee/django-analytical,ericdwang/django-analytical,pjdelport/django-analytical,ChristosChristofidis/django-analytical
--- +++ @@ -29,7 +29,7 @@ intersphinx_mapping = { 'http://docs.python.org/2.7': None, - 'http://docs.djangoproject.com/en/1.7': 'http://docs.djangoproject.com/en/1.7/_objects/', + 'http://docs.djangoproject.com/en/1.8': 'http://docs.djangoproject.com/en/1.8/_objects/', }
761c5e18abca2ac5baf837d9da66cf2f5bb04c01
typhon/tests/files/test_utils.py
typhon/tests/files/test_utils.py
from tempfile import NamedTemporaryFile from typhon.files import compress, decompress class TestCompression: data = "ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678910" def create_file(self, filename): with open(filename, "w") as file: file.write(self.data) def check_file(self, filename): ...
Add tests for compression and decompression functions
Add tests for compression and decompression functions
Python
mit
atmtools/typhon,atmtools/typhon
--- +++ @@ -0,0 +1,47 @@ +from tempfile import NamedTemporaryFile + +from typhon.files import compress, decompress + + +class TestCompression: + data = "ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678910" + + def create_file(self, filename): + with open(filename, "w") as file: + file.write(self.data) + + ...
b3b340764c2f98e9e6393c9e259a7dd7b697167b
oslo/vmware/constants.py
oslo/vmware/constants.py
# Copyright (c) 2014 VMware, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
Add constant for ESX datacenter path (HTTP access)
Add constant for ESX datacenter path (HTTP access) This patch adds a constant.py file to store the constants needed in the VMware ecosystem. A new constant is added for the ESX datacenter path when using http access to datastores. Change-Id: Ie5b84b3cc3913ab57f7ab487349557781cc4157a
Python
apache-2.0
openstack/oslo.vmware
--- +++ @@ -0,0 +1,23 @@ +# Copyright (c) 2014 VMware, Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses...
69ad33e03263a7bcb4323460302e2716c34891e3
st2common/tests/unit/test_logging_middleware.py
st2common/tests/unit/test_logging_middleware.py
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
Add a test case for masking secret values in API log messages.
Add a test case for masking secret values in API log messages.
Python
apache-2.0
nzlosh/st2,Plexxi/st2,nzlosh/st2,nzlosh/st2,StackStorm/st2,Plexxi/st2,Plexxi/st2,StackStorm/st2,StackStorm/st2,nzlosh/st2,StackStorm/st2,Plexxi/st2
--- +++ @@ -0,0 +1,65 @@ +# Licensed to the StackStorm, Inc ('StackStorm') under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (th...
c5dd440383935fb4996ca08b76928ed8d84d0fb9
events/templatetags/humantime.py
events/templatetags/humantime.py
# -*- encoding:utf-8 -*- # Template tag from django.template.defaultfilters import stringfilter from datetime import datetime, timedelta from django import template register = template.Library() @register.filter def event_time(start, end): today = datetime.today () result = "" if start == today: ...
Add a template tag filter to properly format the time of events
Add a template tag filter to properly format the time of events
Python
agpl-3.0
vcorreze/agendaEteAccoord,vcorreze/agendaEteAccoord,mlhamel/agendadulibre,mlhamel/agendadulibre,mlhamel/agendadulibre,vcorreze/agendaEteAccoord
--- +++ @@ -0,0 +1,27 @@ +# -*- encoding:utf-8 -*- +# Template tag +from django.template.defaultfilters import stringfilter +from datetime import datetime, timedelta +from django import template + +register = template.Library() + +@register.filter +def event_time(start, end): + today = datetime.today () + resul...
fa3c5c4c80bcf8596013df7636ed7a1e19972c99
polyfit_distributions.py
polyfit_distributions.py
import numpy as np def main(): np.random.seed(0) bins = 50 X = np.random.zipf(1.2, 1000) y = np.histogram(X[X<bins], bins, normed=True)[0] fn = np.polyfit(np.arange(bins), y, 3) print(fn) np.random.seed(0) bins = 50 samples = 1000 X = [np.random.zipf(1.2, samples), np...
Build curves for a single zipfian distribution and then 3 combined
Build curves for a single zipfian distribution and then 3 combined
Python
mit
noelevans/sandpit,noelevans/sandpit,noelevans/sandpit,noelevans/sandpit,noelevans/sandpit,noelevans/sandpit
--- +++ @@ -0,0 +1,24 @@ +import numpy as np + + +def main(): + np.random.seed(0) + bins = 50 + X = np.random.zipf(1.2, 1000) + y = np.histogram(X[X<bins], bins, normed=True)[0] + fn = np.polyfit(np.arange(bins), y, 3) + print(fn) + + np.random.seed(0) + bins = 50 + samples = 1000 + X = ...
8c17a1eb43da7171da9085c2c6e92815460057f3
accelerator/migrations/0014_expert_profile_expert_category_alter_verbose_name.py
accelerator/migrations/0014_expert_profile_expert_category_alter_verbose_name.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.18 on 2019-11-25 17:04 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 = [ ('accelerator', '0013_remov...
Add migration for altered field
[AC-7272] Add migration for altered field
Python
mit
masschallenge/django-accelerator,masschallenge/django-accelerator
--- +++ @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.18 on 2019-11-25 17:04 +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 ...
f732ab01373e73fe8f707e88f8ba60f4610fc0d4
polling_stations/apps/data_collection/management/commands/import_denbighshire.py
polling_stations/apps/data_collection/management/commands/import_denbighshire.py
""" Import Denbighshire """ from time import sleep from django.contrib.gis.geos import Point from data_collection.management.commands import BaseAddressCsvImporter from data_finder.helpers import geocode class Command(BaseAddressCsvImporter): """ Imports the Polling Station data from Denbighshire """ c...
Add import script for Denbighshire
Add import script for Denbighshire
Python
bsd-3-clause
chris48s/UK-Polling-Stations,andylolz/UK-Polling-Stations,chris48s/UK-Polling-Stations,andylolz/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,andylolz/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations
--- +++ @@ -0,0 +1,68 @@ +""" +Import Denbighshire +""" +from time import sleep +from django.contrib.gis.geos import Point +from data_collection.management.commands import BaseAddressCsvImporter +from data_finder.helpers import geocode + +class Command(BaseAddressCsvImporter): + """ + Imports the Polling Statio...
76ae560be419ac350d79db08772d6b7f5722754b
python/sparktestingbase/test/simple_streaming_test.py
python/sparktestingbase/test/simple_streaming_test.py
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
Add a second trivial streaming test to make sure our re-useing the spark context is ok
Add a second trivial streaming test to make sure our re-useing the spark context is ok
Python
apache-2.0
holdenk/spark-testing-base,holdenk/spark-testing-base,ponkin/spark-testing-base,joychugh/spark-testing-base,MiguelPeralvo/spark-testing-base,snithish/spark-testing-base,samklr/spark-testing-base,ghl3/spark-testing-base,MiguelPeralvo/spark-testing-base,MiguelPeralvo/spark-testing-base,jnadler/spark-testing-base,eyeem/sp...
--- +++ @@ -27,11 +27,20 @@ @classmethod def tokenize(cls, f): return f.flatMap(lambda line: line.split(" ")) - + + @classmethod + def noop(cls, f): + return f.map(lambda x: x) + def test_simple_transformation(self): input = [["hi"], ["hi holden"], ["bye"]] e...
f306b2145d5bff7a3d399e14b60274c58c3bf098
scripts/tests/test_box_migrate_to_external_account.py
scripts/tests/test_box_migrate_to_external_account.py
from nose.tools import * from scripts.box.migrate_to_external_account import do_migration, get_targets from framework.auth import Auth from tests.base import OsfTestCase from tests.factories import ProjectFactory, UserFactory from website.addons.box.model import BoxUserSettings from website.addons.box.tests.factori...
Add test for box migration script
Add test for box migration script
Python
apache-2.0
KAsante95/osf.io,aaxelb/osf.io,Nesiehr/osf.io,emetsger/osf.io,Nesiehr/osf.io,chrisseto/osf.io,Nesiehr/osf.io,saradbowman/osf.io,SSJohns/osf.io,binoculars/osf.io,mluo613/osf.io,leb2dg/osf.io,wearpants/osf.io,HalcyonChimera/osf.io,amyshi188/osf.io,kch8qx/osf.io,acshi/osf.io,saradbowman/osf.io,haoyuchen1992/osf.io,CenterF...
--- +++ @@ -0,0 +1,93 @@ +from nose.tools import * + +from scripts.box.migrate_to_external_account import do_migration, get_targets + +from framework.auth import Auth + +from tests.base import OsfTestCase +from tests.factories import ProjectFactory, UserFactory + +from website.addons.box.model import BoxUserSettings ...
5eb7a643de51c972b585410b88b4c5f54bf3362a
patterns/creational/facade2.py
patterns/creational/facade2.py
import abc class Shape(object): __metaclass__ = abc.ABCMeta @abc.abstractmethod def draw(self): pass class Rectangle(Shape): def __init__(self): super(Rectangle, self).__init__() def draw(self): print 'Drawing Rectangle...' class Square(Shape): def __init__(self): ...
Create a new example of shape using Facade pattern
Create a new example of shape using Facade pattern
Python
mit
rolandovillca/python_basis,rolandovillca/python_introduction_basic,rolandovillca/python_basic_introduction,rolandovillca/python_basic_concepts
--- +++ @@ -0,0 +1,44 @@ +import abc + +class Shape(object): + __metaclass__ = abc.ABCMeta + + @abc.abstractmethod + def draw(self): + pass + + +class Rectangle(Shape): + def __init__(self): + super(Rectangle, self).__init__() + + def draw(self): + print 'Drawing Rectangle...' + + ...
681871b7b7271d8431e8d92a29d8ab02e9d9ba0d
contrib/linux/tests/test_action_dig.py
contrib/linux/tests/test_action_dig.py
#!/usr/bin/env python # Copyright 2020 The StackStorm Developers # # 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 app...
Add initial tests for linux.dig action
Add initial tests for linux.dig action
Python
apache-2.0
StackStorm/st2,Plexxi/st2,nzlosh/st2,StackStorm/st2,nzlosh/st2,nzlosh/st2,Plexxi/st2,Plexxi/st2,StackStorm/st2,nzlosh/st2,StackStorm/st2,Plexxi/st2
--- +++ @@ -0,0 +1,37 @@ +#!/usr/bin/env python + +# Copyright 2020 The StackStorm Developers +# +# 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/LI...
0224af7414bdfff6b4bd3118ba50cfc08ed60215
py/expression-add-operators.py
py/expression-add-operators.py
from collections import defaultdict class Solution(object): def dfs_ans(self, ans, depth, lans, ans_list): if depth == lans: yield ''.join(ans_list) else: if isinstance(ans[depth], set): for x in ans[depth]: ans_list.append(x) ...
Add py solution for 282. Expression Add Operators
Add py solution for 282. Expression Add Operators 282. Expression Add Operators: https://leetcode.com/problems/expression-add-operators/ Way too ugly...
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,63 @@ +from collections import defaultdict +class Solution(object): + def dfs_ans(self, ans, depth, lans, ans_list): + if depth == lans: + yield ''.join(ans_list) + else: + if isinstance(ans[depth], set): + for x in ans[depth]: + ...
192871bcf6fe0881a0b0aface4306cb6ec93710e
test/benchmarks/stepping/TestRunHooksThenSteppings.py
test/benchmarks/stepping/TestRunHooksThenSteppings.py
"""Test lldb's stepping speed.""" import os, sys import unittest2 import lldb import pexpect from lldbbench import * class RunHooksThenSteppingsBench(BenchBase): mydir = os.path.join("benchmarks", "stepping") def setUp(self): BenchBase.setUp(self) self.stepping_avg = None @benchmarks_te...
Add a more generic stepping benchmark, which uses the '-k' option of the test driver to be able to specify the runhook(s) to bring the debug session to a certain state before running the benchmarking logic. An example,
Add a more generic stepping benchmark, which uses the '-k' option of the test driver to be able to specify the runhook(s) to bring the debug session to a certain state before running the benchmarking logic. An example, ./dotest.py -v -t +b -k 'process attach -n Mail' -k 'thread backtrace all' -p TestRunHooksThenStepp...
Python
apache-2.0
apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb
--- +++ @@ -0,0 +1,71 @@ +"""Test lldb's stepping speed.""" + +import os, sys +import unittest2 +import lldb +import pexpect +from lldbbench import * + +class RunHooksThenSteppingsBench(BenchBase): + + mydir = os.path.join("benchmarks", "stepping") + + def setUp(self): + BenchBase.setUp(self) + se...
dd0ee85ef6e36d3e384ac5d20924acb4fd5f3108
tests/commands/logs_test.py
tests/commands/logs_test.py
from mock import patch from ..utils import DustyTestCase from dusty.commands.logs import tail_container_logs class TestLogsCommands(DustyTestCase): @patch('dusty.commands.logs.exec_docker') @patch('dusty.commands.logs.get_dusty_containers') def test_tail_container_logs(self, fake_get_containers, fake_exec...
Add tests for the log command
Add tests for the log command
Python
mit
gamechanger/dusty,gamechanger/dusty,gamechanger/dusty,gamechanger/dusty,gamechanger/dusty
--- +++ @@ -0,0 +1,13 @@ +from mock import patch + +from ..utils import DustyTestCase +from dusty.commands.logs import tail_container_logs + +class TestLogsCommands(DustyTestCase): + @patch('dusty.commands.logs.exec_docker') + @patch('dusty.commands.logs.get_dusty_containers') + def test_tail_container_logs(...
0c39e2f5774b78ca5025e8ffe0fbde4ab2e86abf
tests/test_summary_class.py
tests/test_summary_class.py
# coding: utf8 # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 # For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt """Test text-based summary reporter for coverage.py""" import collections import unittest import os.path try: from cStringIO import StringIO exc...
Add unit-level test for the SummaryReporter Tests configuration of the report method of SummaryReader
Add unit-level test for the SummaryReporter Tests configuration of the report method of SummaryReader
Python
apache-2.0
hugovk/coveragepy,hugovk/coveragepy,blueyed/coveragepy,blueyed/coveragepy,blueyed/coveragepy,nedbat/coveragepy,hugovk/coveragepy,nedbat/coveragepy,nedbat/coveragepy,blueyed/coveragepy,nedbat/coveragepy,blueyed/coveragepy,nedbat/coveragepy,hugovk/coveragepy,hugovk/coveragepy
--- +++ @@ -0,0 +1,53 @@ +# coding: utf8 +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + +"""Test text-based summary reporter for coverage.py""" + +import collections +import unittest +import os.path +try: +...
f132b8f2697ec2dc27529f9f633830566d73d663
tests/test_reset.py
tests/test_reset.py
#!/usr/bin/python import sys import pycurl saw_error = 1 def main(): global saw_error pycurl.global_init(pycurl.GLOBAL_DEFAULT) outf = file("/dev/null", "rb+") cm = pycurl.CurlMulti() # Set multi handle's options cm.setopt(pycurl.M_PIPELINING, 1) eh = pycur...
Test for reset fixes refcount bug
Test for reset fixes refcount bug
Python
lgpl-2.1
jcharum/pycurl,ninemoreminutes/pycurl,ninemoreminutes/pycurl,jcharum/pycurl,jcharum/pycurl,ninemoreminutes/pycurl,ninemoreminutes/pycurl
--- +++ @@ -0,0 +1,75 @@ +#!/usr/bin/python + +import sys +import pycurl + +saw_error = 1 + +def main(): + global saw_error + + pycurl.global_init(pycurl.GLOBAL_DEFAULT) + + outf = file("/dev/null", "rb+") + cm = pycurl.CurlMulti() + + # Set multi handle's options + cm.setopt...
b8db80eb446e20376cd24fda39f3bf2485e36371
tests/test_utils.py
tests/test_utils.py
def test_fact_mjd_conversion(): from aux2mongodb.utils import fact_mjd_to_datetime timestamp = fact_mjd_to_datetime(16801.33) assert timestamp.year == 2016 assert timestamp.month == 1 assert timestamp.day == 1 assert timestamp.hour == 7 assert timestamp.minute == 55
Add test for date conversion
Add test for date conversion
Python
mit
fact-project/aux2mongodb
--- +++ @@ -0,0 +1,9 @@ +def test_fact_mjd_conversion(): + from aux2mongodb.utils import fact_mjd_to_datetime + + timestamp = fact_mjd_to_datetime(16801.33) + assert timestamp.year == 2016 + assert timestamp.month == 1 + assert timestamp.day == 1 + assert timestamp.hour == 7 + assert timestamp.mi...
2af220f9d0a9d49c69d54ce1985ec586af9e473b
tools/stats/track_recall.py
tools/stats/track_recall.py
#!/usr/bin/env python from vdetlib.utils.protocol import proto_load, proto_dump, track_box_at_frame from vdetlib.utils.common import iou import argparse import numpy as np if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('vid_file') parser.add_argument('annot_file') pa...
Add a script to calculate track recalls.
Add a script to calculate track recalls.
Python
mit
myfavouritekk/TPN
--- +++ @@ -0,0 +1,42 @@ +#!/usr/bin/env python + +from vdetlib.utils.protocol import proto_load, proto_dump, track_box_at_frame +from vdetlib.utils.common import iou +import argparse +import numpy as np + +if __name__ == '__main__': + parser = argparse.ArgumentParser() + parser.add_argument('vid_file') + pa...
58870974c218a2b4dfc0a53c17af50138d90a8b2
send_email_using_smtp.py
send_email_using_smtp.py
from email.mime.text import MIMEText from smtplib import SMTP import logging #from settings import EMAIL_FROM, EMAIL_MSG, EMAIL_TO, SERVER EMAIL_FROM = 'me@example.com' EMAIL_MSG = 'Hi friend!' EMAIL_SUBJECT = 'Hi' EMAIL_TO = 'friend@example.com' SERVER = 'smtp.example.com' if __name__ == '__main__': msg = MIMETex...
Add send email using SMTP example
Add send email using SMTP example
Python
mit
MattMS/Python_3_examples
--- +++ @@ -0,0 +1,22 @@ +from email.mime.text import MIMEText +from smtplib import SMTP +import logging + + +#from settings import EMAIL_FROM, EMAIL_MSG, EMAIL_TO, SERVER +EMAIL_FROM = 'me@example.com' +EMAIL_MSG = 'Hi friend!' +EMAIL_SUBJECT = 'Hi' +EMAIL_TO = 'friend@example.com' +SERVER = 'smtp.example.com' + + +...
5725fc0c5cd8acc22e332be10e43e32de601bc95
scripts/get_bank_registry_pl.py
scripts/get_bank_registry_pl.py
import json import csv import requests URL = "https://ewib.nbp.pl/plewibnra?dokNazwa=plewibnra.txt" def process(): registry = [] with requests.get(URL, stream=True) as txtfile: for row in txtfile.iter_lines(): if len(row.decode("latin1").split("\t")) != 33: continue ...
Create script to generate PL bank registry
Create script to generate PL bank registry
Python
mit
figo-connect/schwifty
--- +++ @@ -0,0 +1,30 @@ +import json +import csv +import requests + +URL = "https://ewib.nbp.pl/plewibnra?dokNazwa=plewibnra.txt" + + +def process(): + registry = [] + with requests.get(URL, stream=True) as txtfile: + for row in txtfile.iter_lines(): + if len(row.decode("latin1").split("\t"))...
4ab4bfedbecd70be183b1785562b3b8a97f8c50a
tests/learn/dl/test_models.py
tests/learn/dl/test_models.py
import sys import pytest from numpy.testing import assert_equal import torch sys.path.append("../../../") from pycroscopy.learn import models @pytest.mark.parametrize("dim, size", [(1, [8]), (2, [8, 8]), (3, [8, 8, 8])]) def test_autoencoder_output(dim, size): input_dim = (1, *size) x = torch.randn(2, *inpu...
Add tests for autoencoder models
Add tests for autoencoder models
Python
mit
pycroscopy/pycroscopy
--- +++ @@ -0,0 +1,49 @@ +import sys +import pytest +from numpy.testing import assert_equal +import torch + +sys.path.append("../../../") + +from pycroscopy.learn import models + + +@pytest.mark.parametrize("dim, size", [(1, [8]), (2, [8, 8]), (3, [8, 8, 8])]) +def test_autoencoder_output(dim, size): + input_dim =...
470998b97ea5c6cf5ed37ab4e6fd4dcf72e2888a
interface_import.py
interface_import.py
__version__ = '0.9' __author__ = 'Remi Batist' # Importing interface-settings from pre-defined csv-file # used row format shown in the example below # csv delimiter ' ; ' # interface description linktype permitvlan pvid # GigabitEthernet1/0/21 server-1 access ...
Set interface-config from pre-defined csv-file
Set interface-config from pre-defined csv-file
Python
mit
rbatist/HPN-Scripting,networkingdvi/HPN-Scripting
--- +++ @@ -0,0 +1,80 @@ + + +__version__ = '0.9' +__author__ = 'Remi Batist' + +# Importing interface-settings from pre-defined csv-file + +# used row format shown in the example below +# csv delimiter ' ; ' + +# interface description linktype permitvlan pvid +# GigabitEthernet1/0/21 ...
b1fdbd1d256c7cac8c5e79f05af5e514974d3ef2
tests/test_web_application.py
tests/test_web_application.py
import asyncio import pytest from aiohttp import web, log from unittest import mock def test_app_ctor(loop): app = web.Application(loop=loop) assert loop is app.loop assert app.logger is log.web_logger def test_app_call(loop): app = web.Application(loop=loop) assert app is app() def test_app_...
Convert web.Application tests to pytest style
Convert web.Application tests to pytest style
Python
apache-2.0
mind1master/aiohttp,decentfox/aiohttp,panda73111/aiohttp,rutsky/aiohttp,arthurdarcet/aiohttp,Eyepea/aiohttp,alex-eri/aiohttp-1,singulared/aiohttp,elastic-coders/aiohttp,mind1master/aiohttp,esaezgil/aiohttp,arthurdarcet/aiohttp,vaskalas/aiohttp,z2v/aiohttp,esaezgil/aiohttp,Insoleet/aiohttp,elastic-coders/aiohttp,jettify...
--- +++ @@ -0,0 +1,78 @@ +import asyncio +import pytest + +from aiohttp import web, log +from unittest import mock + + +def test_app_ctor(loop): + app = web.Application(loop=loop) + assert loop is app.loop + assert app.logger is log.web_logger + + +def test_app_call(loop): + app = web.Application(loop=loo...
8782bf61d97000a9267929ee54a158a78e41372c
examples/plt2xyz.py
examples/plt2xyz.py
#!/usr/bin/env python """ usage: plt2xyz.py PLTFILE > outfile.xyz Dumps an XYZ point cloud from a compiled Compass plot file, with the assumption that all "hidden" shots are splays which represent the cave's walls. If the project is tied to realworld UTM coordinates, then X, Y, and Z will be in meters. If no UTM zone...
Add example script which converts a Compass .PLT plot file with splay shots to an XYZ pointcloud.
Add example script which converts a Compass .PLT plot file with splay shots to an XYZ pointcloud.
Python
mit
riggsd/davies
--- +++ @@ -0,0 +1,51 @@ +#!/usr/bin/env python +""" +usage: plt2xyz.py PLTFILE > outfile.xyz + +Dumps an XYZ point cloud from a compiled Compass plot file, with the +assumption that all "hidden" shots are splays which represent the cave's +walls. + +If the project is tied to realworld UTM coordinates, then X, Y, and...
e1cd24cf2f7133a6ad766d580cd728b4997b141d
COURSE/ML/lab2/lab2_vedio.py
COURSE/ML/lab2/lab2_vedio.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import time import pandas as pd from sklearn.preprocessing import normalize from sklearn.neighbors import KNeighborsClassifier as KNN from sklearn.metrics import confusion_matrix from sklearn.model_selection import KFold from scipy.spatial.distance import cosine as Cos d...
Add ML lab2 vedio version
Add ML lab2 vedio version
Python
mit
calee0219/Programming,calee0219/Programming,calee0219/Programming,calee0219/Programming,calee0219/Programming,calee0219/Programming,calee0219/Programming
--- +++ @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +import time +import pandas as pd +from sklearn.preprocessing import normalize +from sklearn.neighbors import KNeighborsClassifier as KNN +from sklearn.metrics import confusion_matrix +from sklearn.model_selection import KFold +from scipy.spa...
e81c421e1ef2afe896ec035e8af137415eeeab46
geoPrint.py
geoPrint.py
#!/usr/bin/env python import pygeoip, dpkt, socket, optparse gi = pygeoip.GeoIP('/opt/GeoIP/Geo.dat') tgt = '173.255.226.98' #Could be added as an argument def banner(): print "#### IP to Physical Address Map p131 ####" pirnt "" def printRecort(tgt): #By itself can print the Lon/Lat of an IP address...
DEBUG AND TEST. This one had a lot of typos
DEBUG AND TEST. This one had a lot of typos
Python
mit
n1cfury/ViolentPython
--- +++ @@ -0,0 +1,66 @@ +#!/usr/bin/env python +import pygeoip, dpkt, socket, optparse + +gi = pygeoip.GeoIP('/opt/GeoIP/Geo.dat') +tgt = '173.255.226.98' #Could be added as an argument + +def banner(): + print "#### IP to Physical Address Map p131 ####" + pirnt "" + +def printRecort(tgt): + #By itself...
78120151788b95d01ccf1e0e919572287e598758
openforcefield/tests/test_io.py
openforcefield/tests/test_io.py
#!/usr/bin/env python #============================================================================================= # MODULE DOCSTRING #============================================================================================= """ Test classes and function in module openforcefield.typing.engines.smirnoff.io. """...
Add tests quantity from string parsing
Add tests quantity from string parsing
Python
mit
openforcefield/openff-toolkit,open-forcefield-group/openforcefield,openforcefield/openff-toolkit,open-forcefield-group/openforcefield,open-forcefield-group/openforcefield
--- +++ @@ -0,0 +1,68 @@ +#!/usr/bin/env python + +#============================================================================================= +# MODULE DOCSTRING +#============================================================================================= + +""" +Test classes and function in module openforcefie...
138c6263a3b3a3c24f5fe6b4f300542c74228448
src/btc_inference_cae.py
src/btc_inference_cae.py
import os import numpy as np import tensorflow as tf from btc_settings import * from btc_train import BTCTrain import matplotlib.pyplot as plt from btc_cae_parameters import get_parameters class BTCInferenceCAE(BTCTrain): def __init__(self, paras, input_path, model_path): super().__init__(paras) ...
Add script to do inferencer of autoencoder model
Add script to do inferencer of autoencoder model
Python
mit
quqixun/BrainTumorClassification,quqixun/BrainTumorClassification
--- +++ @@ -0,0 +1,59 @@ +import os +import numpy as np +import tensorflow as tf +from btc_settings import * +from btc_train import BTCTrain +import matplotlib.pyplot as plt +from btc_cae_parameters import get_parameters + + +class BTCInferenceCAE(BTCTrain): + + def __init__(self, paras, input_path, model_path): +...
980598a458d738186abf0d702535a42f121d8c85
PatternCreate/pattern_create.py
PatternCreate/pattern_create.py
import sys, string, re arguments = [] textString = [] program = True number = ['a','a','a'] def get_pattern(stuff): first = "abcdefghijklmnopqrstuvwxyz0123456789" next = "bcdefghijklmnopqrstuvwxyz0123456789a" table = string.maketrans(first, next) textString.append("".join(number)) for run in range...
Add Exploit Dev Pattern Create
Add Exploit Dev Pattern Create
Python
cc0-1.0
JohnTroony/Scriptology,JohnTroony/Scriptology,JohnTroony/Scriptology,JohnTroony/Scriptology,JohnTroony/Scriptology,JohnTroony/Scriptology
--- +++ @@ -0,0 +1,63 @@ +import sys, string, re + +arguments = [] +textString = [] +program = True +number = ['a','a','a'] + +def get_pattern(stuff): + first = "abcdefghijklmnopqrstuvwxyz0123456789" + next = "bcdefghijklmnopqrstuvwxyz0123456789a" + table = string.maketrans(first, next) + + textString.append("".join...
d2a25e14c9f09139f7d7279465afc34f321902c6
smartpy/__init__.py
smartpy/__init__.py
from .interfaces.model import Model from .interfaces.dataset import Dataset from .trainer import Trainer import tasks.tasks as tasks
from .interfaces.model import Model from .interfaces.dataset import Dataset from .trainer import Trainer from .tasks import tasks
Use relative import to import tasks
Use relative import to import tasks
Python
bsd-3-clause
MarcCote/smartlearner,SMART-Lab/smartlearner,SMART-Lab/smartpy,havaeimo/smartlearner,ASalvail/smartlearner
--- +++ @@ -2,4 +2,4 @@ from .interfaces.dataset import Dataset from .trainer import Trainer -import tasks.tasks as tasks +from .tasks import tasks
0244217c57686d53e7a0aebef4d0dd328cf809da
trunk/examples/mesonet_oban.py
trunk/examples/mesonet_oban.py
import scipy.constants as sconsts import matplotlib.pyplot as plt from matplotlib.mlab import griddata from mpl_toolkits.basemap import Basemap from metpy import read_mesonet_data, dewpoint, get_wind_components from metpy.constants import C2F from metpy.cbook import append_fields from metpy.vis import station_plot from...
Add an example showing how to use some of the oban functions.
Add an example showing how to use some of the oban functions. git-svn-id: acf0ef94bfce630b1a882387fc03ab8593ec6522@295 150532fb-1d5b-0410-a8ab-efec50f980d4
Python
bsd-3-clause
deeplycloudy/MetPy,jrleeman/MetPy,jrleeman/MetPy,ahaberlie/MetPy,dopplershift/MetPy,ahill818/MetPy,ahaberlie/MetPy,Unidata/MetPy,Unidata/MetPy,dopplershift/MetPy,ShawnMurd/MetPy
--- +++ @@ -0,0 +1,47 @@ +import scipy.constants as sconsts +import matplotlib.pyplot as plt +from matplotlib.mlab import griddata +from mpl_toolkits.basemap import Basemap +from metpy import read_mesonet_data, dewpoint, get_wind_components +from metpy.constants import C2F +from metpy.cbook import append_fields +from...
c9d0b1522da83305dcfdfc82c28f2032162c0998
tests/test_compat.py
tests/test_compat.py
import pytest from attr._compat import metadata_proxy @pytest.fixture(name="mp") def _mp(): return metadata_proxy({"x": 42, "y": "foo"}) class TestMetadataProxy: """ Ensure properties of metadata_proxy independently of hypothesis strategies. """ def test_repr(self, mp): """ rep...
Test metadata_proxy properties independently from hypothesis strategies
Test metadata_proxy properties independently from hypothesis strategies Occasionally they fail to cover all bases and break our coverage job on Python 2.7. Signed-off-by: Hynek Schlawack <6a253031d5fc83cdcd7910737760a89b7bcfb849@ox.cx>
Python
mit
python-attrs/attrs
--- +++ @@ -0,0 +1,50 @@ +import pytest + +from attr._compat import metadata_proxy + + +@pytest.fixture(name="mp") +def _mp(): + return metadata_proxy({"x": 42, "y": "foo"}) + + +class TestMetadataProxy: + """ + Ensure properties of metadata_proxy independently of hypothesis strategies. + """ + + def t...
af9f12cec4f187cac079360b4860c056cca014ef
tilezilla/db/_api.py
tilezilla/db/_api.py
from tilezilla.db.sqlite.tables import Base, TileSpec, Tile if __name__ == '__main__': from tilezilla import tilespec, products, stores from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker # engine = create_engine('sqlite:///:memory:', echo=True) engine = create_engine('sqli...
Add demo code for later
Add demo code for later
Python
bsd-3-clause
ceholden/landsat_tiles,ceholden/landsat_tiles,ceholden/landsat_tile,ceholden/landsat_tile,ceholden/tilezilla
--- +++ @@ -0,0 +1,31 @@ +from tilezilla.db.sqlite.tables import Base, TileSpec, Tile + + +if __name__ == '__main__': + from tilezilla import tilespec, products, stores + from sqlalchemy import create_engine + from sqlalchemy.orm import sessionmaker +# engine = create_engine('sqlite:///:memory:', echo=Tru...
1d7c57d2d9346b396f836e39c188c2c0a2a1797b
tests/test_authtkt.py
tests/test_authtkt.py
import unittest from yocommon.util import configure import authtkt class AuthTktTests(unittest.TestCase): def setUp(self): self.secret = 'hmac secret' self.crypto_secret = 'top secret' self.cookie = ( 'MjQ4MWQ3ODEzNGI2MjE3N2I4OGQ4MDRjNTZkY2YxZGU1MWRkNjY3NjEyMzQ1Njc4O' ...
Add tests (Inspired by yocommon)
Add tests (Inspired by yocommon)
Python
mit
yola/auth_tkt
--- +++ @@ -0,0 +1,33 @@ +import unittest + +from yocommon.util import configure + +import authtkt + + +class AuthTktTests(unittest.TestCase): + def setUp(self): + self.secret = 'hmac secret' + self.crypto_secret = 'top secret' + self.cookie = ( + 'MjQ4MWQ3ODEzNGI2MjE3N2I4OGQ4MDRjNT...
5dd8284d9f8b3891de74f22685270b058051c3f0
tests/test_inherit.py
tests/test_inherit.py
# -*- coding: utf-8 -*- """ Tests for inheritance in RegexLexer ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import unittest from pygments.lexer import RegexLexer, inherit from pygments.token import ...
Add test for RegexLexer inheritance (fails with current code).
Add test for RegexLexer inheritance (fails with current code).
Python
bsd-2-clause
aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygments,aswinpj/Pygmen...
--- +++ @@ -0,0 +1,94 @@ +# -*- coding: utf-8 -*- +""" + Tests for inheritance in RegexLexer + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + :copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import unittest + +from pygments.lexer import RegexLex...
b52db04e4f57e805b3ff9a1b9a5ae61eb1a152d0
rx-tests/rx-async-test-with-closure.py
rx-tests/rx-async-test-with-closure.py
#!/usr/bin/env python3 ''' Process two different streams in parallel, retrieving them from the module's scope ''' import rx import asyncio from concurrent.futures import ThreadPoolExecutor from functools import partial import APIReaderTwitter as Twitter try: import json except ImportError: import si...
Add example of processing two different streams in separate threads retrieving the streams from the module's global scope.
Add example of processing two different streams in separate threads retrieving the streams from the module's global scope.
Python
mit
Pysellus/streaming-api-test,Pysellus/streaming-api-test
--- +++ @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 + +''' + Process two different streams in parallel, + retrieving them from the module's scope +''' + +import rx +import asyncio +from concurrent.futures import ThreadPoolExecutor +from functools import partial + +import APIReaderTwitter as Twitter + +try: + im...
658d92bf118a70f6aa50cc20f78468f7895e077a
examples/expose-application.py
examples/expose-application.py
""" This example: 1. Connects to the current model. 2. Deploys a charm and waits until it reports itself active. 3. Demonstrates exposing application endpoints to space and CIDR combinations. 3. Demonstrates unexposing application endpoints. NOTE: this test must be run against a 2.9 controller. """ from juju import l...
Add example for the expose/unexpose methods
Add example for the expose/unexpose methods
Python
apache-2.0
juju/python-libjuju,juju/python-libjuju
--- +++ @@ -0,0 +1,75 @@ +""" +This example: + +1. Connects to the current model. +2. Deploys a charm and waits until it reports itself active. +3. Demonstrates exposing application endpoints to space and CIDR combinations. +3. Demonstrates unexposing application endpoints. + +NOTE: this test must be run against a 2....
abd7c37bee88841ccddf057a430f72f0313eb19c
maediprojects/query/finances.py
maediprojects/query/finances.py
from maediprojects import db, models from sqlalchemy import * import datetime def isostring_date(value): # Returns a date object from a string of format YYYY-MM-DD return datetime.datetime.strptime(value, "%Y-%m-%d") def isostring_year(value): # Returns a date object from a string of format YYYY retur...
Add ability to create and update financial data
Add ability to create and update financial data
Python
agpl-3.0
markbrough/maedi-projects,markbrough/maedi-projects,markbrough/maedi-projects
--- +++ @@ -0,0 +1,47 @@ +from maediprojects import db, models +from sqlalchemy import * +import datetime + +def isostring_date(value): + # Returns a date object from a string of format YYYY-MM-DD + return datetime.datetime.strptime(value, "%Y-%m-%d") + +def isostring_year(value): + # Returns a date object f...
c603dc219d47ef255ef30447526e9c8dff82a5db
blues/python.py
blues/python.py
""" Python Blueprint ================ Does not install python itself, only develop and setup tools. Contains pip helper for other blueprints to use. **Fabric environment:** .. code-block:: yaml blueprints: - blues.python """ from fabric.decorators import task from refabric.api import run, info from refa...
""" Python Blueprint ================ Does not install python itself, only develop and setup tools. Contains pip helper for other blueprints to use. **Fabric environment:** .. code-block:: yaml blueprints: - blues.python """ from fabric.decorators import task from refabric.api import run, info from refa...
Make pip log world writable
Make pip log world writable
Python
mit
adisbladis/blues,jocke-l/blues,gelbander/blues,jocke-l/blues,Sportamore/blues,gelbander/blues,chrippa/blues,andreif/blues,gelbander/blues,5monkeys/blues,Sportamore/blues,chrippa/blues,adisbladis/blues,andreif/blues,adisbladis/blues,5monkeys/blues,jocke-l/blues,Sportamore/blues,andreif/blues,5monkeys/blues,chrippa/blues
--- +++ @@ -23,6 +23,9 @@ __all__ = ['setup'] +pip_log_file = '/tmp/pip.log' + + @task def setup(): """ @@ -36,8 +39,10 @@ info('Install python dependencies') debian.apt_get('install', 'python-dev', 'python-setuptools') run('easy_install -0 pip') + run('touch {}'.format(p...
67f4631faecf672ecc472adb95cabeec53e950eb
git.py
git.py
from subprocess import check_output def get_sha(): """Determines Git SHA of current working directory.""" return check_output(["git", "log","-n1","--pretty=oneline"]).split(' ')[0]
Add Git SHA read util
Add Git SHA read util
Python
bsd-2-clause
Multifarious/fabulous
--- +++ @@ -0,0 +1,5 @@ +from subprocess import check_output + +def get_sha(): + """Determines Git SHA of current working directory.""" + return check_output(["git", "log","-n1","--pretty=oneline"]).split(' ')[0]
3228bf3dd1a32694b42f4d08a5c6f0e63bf5128a
all_reports_smell_search_final.py
all_reports_smell_search_final.py
from map import mapping # walk through the os and get all files # read each file in tern and go through line by line # print lines that contain smell and the report name from os import listdir import nltk.data import json SMELL_WORDS = ['smell', 'stench', 'stink', 'odour', 'sniff', 'effluvium'] REPORTS_DIR = '/Users/...
Add script to datamine the reports via NLTK
Add script to datamine the reports via NLTK
Python
apache-2.0
Smelly-London/Smelly-London,Smelly-London/Smelly-London,Smelly-London/datavisualisation,Smelly-London/Smelly-London,Smelly-London/datavisualisation,Smelly-London/Smelly-London
--- +++ @@ -0,0 +1,101 @@ + +from map import mapping +# walk through the os and get all files +# read each file in tern and go through line by line +# print lines that contain smell and the report name +from os import listdir +import nltk.data +import json + +SMELL_WORDS = ['smell', 'stench', 'stink', 'odour', 'sniff...
21c5e1f52b4f50b146e480f68d10da73cf5306d3
backend/scripts/addusertoproj.py
backend/scripts/addusertoproj.py
#!/usr/bin/env python import rethinkdb as r from optparse import OptionParser import sys class Access(object): def __init__(self, user_id, project_id, project_name): self.user_id = user_id self.project_id = project_id self.project_name = project_name self.dataset = "" self...
Add script to add a user to a project
Add script to add a user to a project
Python
mit
materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org
--- +++ @@ -0,0 +1,46 @@ +#!/usr/bin/env python + +import rethinkdb as r +from optparse import OptionParser +import sys + + +class Access(object): + def __init__(self, user_id, project_id, project_name): + self.user_id = user_id + self.project_id = project_id + self.project_name = project_name...
a2120c11eb50553ea74fd615a446e0bd2db07ea0
tests/python/email_processor.py
tests/python/email_processor.py
import email import imaplib import os import sys class EmailProcessor(): mail = None def __init__(self, user, password, host='mail.mega.co.nz', port=993): self.mail = imaplib.IMAP4_SSL(host, port) self.mail.login(user, password) self.mail.select('Inbox') def get_validation_link_f...
Add Python script used to retrieve confirmation links from emails
Add Python script used to retrieve confirmation links from emails
Python
bsd-2-clause
meganz/sdk,meganz/sdk,meganz/sdk,meganz/sdk,meganz/sdk,meganz/sdk,meganz/sdk
--- +++ @@ -0,0 +1,75 @@ +import email +import imaplib +import os +import sys + + +class EmailProcessor(): + mail = None + + def __init__(self, user, password, host='mail.mega.co.nz', port=993): + self.mail = imaplib.IMAP4_SSL(host, port) + self.mail.login(user, password) + self.mail.select...
6548c29e87945e22b002bc25323983319cca914c
normandy/recipes/migrations/0014_auto_20190228_1128.py
normandy/recipes/migrations/0014_auto_20190228_1128.py
# Generated by Django 2.0.13 on 2019-02-28 11:28 import json from urllib.parse import unquote_plus from django.db import migrations def remove_signatures(apps, schema_editor): Recipe = apps.get_model("recipes", "Recipe") Action = apps.get_model("recipes", "Action") Signature = apps.get_model("recipes",...
Add migration to add extension ID to addon study recipes
Add migration to add extension ID to addon study recipes
Python
mpl-2.0
mozilla/normandy,mozilla/normandy,mozilla/normandy,mozilla/normandy
--- +++ @@ -0,0 +1,77 @@ +# Generated by Django 2.0.13 on 2019-02-28 11:28 + +import json + +from urllib.parse import unquote_plus + +from django.db import migrations + + +def remove_signatures(apps, schema_editor): + Recipe = apps.get_model("recipes", "Recipe") + Action = apps.get_model("recipes", "Action") + ...
f42052078a08a9707e2030a3352a03f80a6485b2
calexicon/internal/gregorian.py
calexicon/internal/gregorian.py
def is_gregorian_leap_year(y): if (y % 400) == 0: return True if (y % 100) == 0: return False if (y % 4) == 0: return True return False # pragma: no cover def days_in_month(year, month): if month == 2 and is_gregorian_leap_year(year): return 29 return [None, 31,...
Create days_in_month fn in new internal module.
Create days_in_month fn in new internal module.
Python
apache-2.0
jwg4/qual,jwg4/calexicon
--- +++ @@ -0,0 +1,14 @@ +def is_gregorian_leap_year(y): + if (y % 400) == 0: + return True + if (y % 100) == 0: + return False + if (y % 4) == 0: + return True + return False # pragma: no cover + +def days_in_month(year, month): + if month == 2 and is_gregorian_leap_year(year): +...
a831393edb8493ecf6185fb52b58a9053d810ead
dissemin/tcp.py
dissemin/tcp.py
# -*- encoding: utf-8 -*- from __future__ import unicode_literals def orcid_base_domain(request): from django.conf import settings return {'ORCID_BASE_DOMAIN':settings.ORCID_BASE_DOMAIN}
Add missing template context processor
Add missing template context processor
Python
agpl-3.0
dissemin/dissemin,wetneb/dissemin,wetneb/dissemin,dissemin/dissemin,dissemin/dissemin,dissemin/dissemin,wetneb/dissemin,dissemin/dissemin,wetneb/dissemin
--- +++ @@ -0,0 +1,6 @@ +# -*- encoding: utf-8 -*- +from __future__ import unicode_literals + +def orcid_base_domain(request): + from django.conf import settings + return {'ORCID_BASE_DOMAIN':settings.ORCID_BASE_DOMAIN}
ff7c952e991d6bb6b47d02ec5fc9b66584187cc2
fake_player_data.py
fake_player_data.py
"""Generate fake data for testing purposes.""" from faker import Faker from random import randint from GoPlayer import Player from pprint import pprint fake = Faker() names = [fake.name() for x in range(49)] ids = [x for x in range(49)] ranks = [randint(-30, 7) for x in range(49)] player_info = list(zip(names, ids,...
Create fake data for testing
Create fake data for testing
Python
mit
unyth/tournament_graph
--- +++ @@ -0,0 +1,21 @@ +"""Generate fake data for testing purposes.""" + +from faker import Faker +from random import randint +from GoPlayer import Player +from pprint import pprint + +fake = Faker() + +names = [fake.name() for x in range(49)] +ids = [x for x in range(49)] +ranks = [randint(-30, 7) for x in range(4...
4ae806af174f7d64acfa7c802507863e2650de72
workflow/Workflow.py
workflow/Workflow.py
from git import * def prefix(): # TODO: Extract to common class if other workflow providers installed return "issue/" def __findRepo(): return Repo(".") def createBranchName(issueName, desc): branchName = prefix() + str(issueName) if (desc != None): branchName += "/" + str(desc) retu...
Add a script to implement the workflow pieces.
Add a script to implement the workflow pieces.
Python
apache-2.0
bable5/git-workflow
--- +++ @@ -0,0 +1,42 @@ +from git import * + +def prefix(): + # TODO: Extract to common class if other workflow providers installed + return "issue/" + +def __findRepo(): + return Repo(".") + +def createBranchName(issueName, desc): + branchName = prefix() + str(issueName) + if (desc != None): + ...
b86ab8d1e7eb8f0329fea2146aefe56b9726920a
testing/models/test_campaign.py
testing/models/test_campaign.py
import pytest from k2catalogue import models @pytest.fixture def campaign(): return models.Campaign(id=5) def test_campaign_repr(campaign): assert repr(campaign) == '<Campaign: 5>'
Add test for campaign repr
Add test for campaign repr
Python
mit
mindriot101/k2catalogue
--- +++ @@ -0,0 +1,11 @@ +import pytest + +from k2catalogue import models + +@pytest.fixture +def campaign(): + return models.Campaign(id=5) + + +def test_campaign_repr(campaign): + assert repr(campaign) == '<Campaign: 5>'
52640eb2053e155c7f33468c0e6c74512b062b0b
event-schemas/check_examples.py
event-schemas/check_examples.py
#! /usr/bin/env python import sys import json import os def import_error(module, package, debian, error): sys.stderr.write(( "Error importing %(module)s: %(error)r\n" "To install %(module)s run:\n" " pip install %(package)s\n" "or on Debian run:\n" " sudo apt-get install...
Add a python script for checking that the examples match the event schema.
Add a python script for checking that the examples match the event schema. Does the same checks as check.sh, but is a *lot* faster making it suitable for using as a pre-commit hook. I don't suggest replacing check.sh since it's good to check that the schema works with multiple implementations of jsonschema.
Python
apache-2.0
matrix-org/matrix-doc,matrix-org/matrix-doc,matrix-org/matrix-doc,matrix-org/matrix-doc
--- +++ @@ -0,0 +1,62 @@ +#! /usr/bin/env python + +import sys +import json +import os + + +def import_error(module, package, debian, error): + sys.stderr.write(( + "Error importing %(module)s: %(error)r\n" + "To install %(module)s run:\n" + " pip install %(package)s\n" + "or on Debian...
c2c38ec799721b5f8c671e69b59448450da76964
shop/cms_menus.py
shop/cms_menus.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.utils.translation import ugettext_lazy as _ from cms.menu_bases import CMSAttachMenu from menus.base import NavigationNode from menus.menu_pool import menu_pool class CatalogMenu(CMSAttachMenu): name = _("Catalog Menu") def get_nod...
Add CatalogMenu allowing to use the CMS menu system for products
Add CatalogMenu allowing to use the CMS menu system for products
Python
bsd-3-clause
divio/django-shop,nimbis/django-shop,divio/django-shop,nimbis/django-shop,awesto/django-shop,divio/django-shop,nimbis/django-shop,nimbis/django-shop,awesto/django-shop,awesto/django-shop
--- +++ @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.utils.translation import ugettext_lazy as _ + +from cms.menu_bases import CMSAttachMenu +from menus.base import NavigationNode +from menus.menu_pool import menu_pool + + +class CatalogMenu(CMSAttachMenu): + na...
16f6f63d0d4b7362445d7aafdd6b664412ab7076
dic_reader_2D.py
dic_reader_2D.py
# -*- coding: utf-8 -*- """ Created on Sun Dec 13 12:50:28 2015 @author: ilyass.tabiai@gmail.com @author: rolland.delorme@gmail.com @author: diehl@ins.uni-bonn.de """ import csv import numpy as np class dic_reader_2D(): def __init__(self,path): self.data = [] self.read(path) self.sortdata() def r...
Add the reder for two dimensional dic csv
Add the reder for two dimensional dic csv
Python
mit
lm2-poly/peridynamics_1D,lm2-poly/peridynamics_1D,ilyasst/peridynamics_1D
--- +++ @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +""" +Created on Sun Dec 13 12:50:28 2015 + +@author: ilyass.tabiai@gmail.com +@author: rolland.delorme@gmail.com +@author: diehl@ins.uni-bonn.de +""" +import csv +import numpy as np + +class dic_reader_2D(): + + def __init__(self,path): + self.data = [] + sel...
88b77d2bedda3b08eb55ef163de577e775c6bb26
tools/experimental_ssh_eventlet.py
tools/experimental_ssh_eventlet.py
#!/usr/bin/python import eventlet from eventlet.green import socket import libssh2 import time import os import random def monitor(hostname, username, id): print '%s %s %d' % (hostname, username, id) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((hostname, 22)) session = lib...
Add an experimental ssh monitoring script.
Add an experimental ssh monitoring script. Signed-off-by: Angus Salkeld <86b65304d27d8de73dd7d624c33df7e088f8d94b@redhat.com>
Python
apache-2.0
gonzolino/heat,jasondunsmore/heat,steveb/heat-cfntools,miguelgrinberg/heat,miguelgrinberg/heat,rickerc/heat_audit,dragorosson/heat,jasondunsmore/heat,cwolferh/heat-scratch,NeCTAR-RC/heat,rdo-management/heat,srznew/heat,rh-s/heat,NeCTAR-RC/heat,citrix-openstack-build/heat,dragorosson/heat,maestro-hybrid-cloud/heat,steve...
--- +++ @@ -0,0 +1,60 @@ +#!/usr/bin/python + +import eventlet +from eventlet.green import socket +import libssh2 +import time +import os +import random + + +def monitor(hostname, username, id): + + print '%s %s %d' % (hostname, username, id) + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + sock....
cc240f959156f4b9facc6a954019efa98d8cff86
array/989.py
array/989.py
class Solution: def addToArrayForm(self, A: List[int], K: int) -> List[int]: num = int(''.join(str(x) for x in A)) + K return ([int(x) for x in str(num)])
Add to Array-Form of Integer
Add to Array-Form of Integer
Python
apache-2.0
MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode
--- +++ @@ -0,0 +1,9 @@ +class Solution: + def addToArrayForm(self, A: List[int], K: int) -> List[int]: + + num = int(''.join(str(x) for x in A)) + K + + return ([int(x) for x in str(num)]) + + +
b05cb7b5b8f507f63c9f1c43db43a29a3acf59c9
physics/ccg_haar.py
physics/ccg_haar.py
# encoding: utf-8 """Routines for sampling from the Haar measures of the classical compact groups. Algorithms taken from http://arxiv.org/abs/math-ph/0609050. TODO Symplectic groups are missing """ from __future__ import division, print_function import numpy as np from scipy.linalg import qr, eigvals def goe(dim, ...
Add the random matrix module
Add the random matrix module
Python
unlicense
dseuss/pythonlibs
--- +++ @@ -0,0 +1,76 @@ + +# encoding: utf-8 +"""Routines for sampling from the Haar measures of the classical compact +groups. Algorithms taken from http://arxiv.org/abs/math-ph/0609050. + +TODO Symplectic groups are missing +""" + +from __future__ import division, print_function +import numpy as np +from scipy.lin...
993424c053e9a1da9011bd4a8835e95ad881e903
alerts/open_port_violation.py
alerts/open_port_violation.py
#!/usr/bin/env python # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # Copyright (c) 2014 Mozilla Corporation # # Contributors: # Jonathan Claudius jclaudius@mozilla.c...
Add open port violation alert
Add open port violation alert
Python
mpl-2.0
mozilla/MozDef,jeffbryner/MozDef,jeffbryner/MozDef,ameihm0912/MozDef,mpurzynski/MozDef,ameihm0912/MozDef,mpurzynski/MozDef,mpurzynski/MozDef,mpurzynski/MozDef,ameihm0912/MozDef,Phrozyn/MozDef,mozilla/MozDef,Phrozyn/MozDef,jeffbryner/MozDef,gdestuynder/MozDef,ameihm0912/MozDef,gdestuynder/MozDef,mozilla/MozDef,gdestuynd...
--- +++ @@ -0,0 +1,48 @@ +#!/usr/bin/env python + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# Copyright (c) 2014 Mozilla Corporation +# +# Contributors: +# J...
82464394910d46a24e0ba3cd015530ee85d68bab
examples/save_jpeg_using_pil.py
examples/save_jpeg_using_pil.py
# Usage: python examples/save_jpeg_using_pil.py src.CR2 dest.jpg # Requires PIL (pip install pillow) import sys from PIL import Image from rawkit.raw import Raw src = sys.argv[1] dest = sys.argv[2] with Raw(filename=src) as raw: rgb_buffer = raw.to_buffer() # Convert the buffer from [r, g, b, r...] to [(r,...
Add example saving jpg using pillow
Add example saving jpg using pillow
Python
mit
photoshell/rawkit
--- +++ @@ -0,0 +1,22 @@ +# Usage: python examples/save_jpeg_using_pil.py src.CR2 dest.jpg +# Requires PIL (pip install pillow) +import sys +from PIL import Image +from rawkit.raw import Raw + + +src = sys.argv[1] +dest = sys.argv[2] + + +with Raw(filename=src) as raw: + rgb_buffer = raw.to_buffer() + + # Conve...
8bd7e0a8f1b3bd69faf454dd8a779fd5b4d4acbd
heat/tests/test_cli.py
heat/tests/test_cli.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
Add test to simply run a few binaries
Add test to simply run a few binaries This is not really a unit test, but it's so fast that I think it could be considered as such. And it would be nice to gate on such blatant breakage. Change-Id: I8ff4ca27a912c30bd962168418ac44217ea9e54d Signed-off-by: Jeff Peeler <d776211e63e47e40d00501ffdb86a800e0782fea@redhat.co...
Python
apache-2.0
varunarya10/heat,dragorosson/heat,rh-s/heat,jasondunsmore/heat,Triv90/Heat,ntt-sic/heat,citrix-openstack-build/heat,pratikmallya/heat,redhat-openstack/heat,pshchelo/heat,Triv90/Heat,openstack/heat,maestro-hybrid-cloud/heat,dims/heat,rickerc/heat_audit,rh-s/heat,miguelgrinberg/heat,cwolferh/heat-scratch,srznew/heat,Triv...
--- +++ @@ -0,0 +1,41 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +#...
2a343aa13fb000ffb56173e77207fe14c3bbe85c
mezzanine/accounts/models.py
mezzanine/accounts/models.py
from django.db import DatabaseError, connection from django.db.models.signals import post_save from mezzanine.accounts import get_profile_user_fieldname from mezzanine.conf import settings from mezzanine.utils.models import lazy_model_ops __all__ = () if getattr(settings, "AUTH_PROFILE_MODULE", None): # This w...
from django.db import DatabaseError, connection from django.db.models.signals import post_save from mezzanine.accounts import get_profile_user_fieldname, get_profile_for_user from mezzanine.conf import settings from mezzanine.utils.models import lazy_model_ops __all__ = () if getattr(settings, "AUTH_PROFILE_MODULE"...
Use get_profile_for_user() in profile signal handler
Use get_profile_for_user() in profile signal handler
Python
bsd-2-clause
joshcartme/mezzanine,vladir/mezzanine,industrydive/mezzanine,SoLoHiC/mezzanine,sjdines/mezzanine,dustinrb/mezzanine,spookylukey/mezzanine,damnfine/mezzanine,sjdines/mezzanine,frankchin/mezzanine,dsanders11/mezzanine,biomassives/mezzanine,frankchin/mezzanine,agepoly/mezzanine,wyzex/mezzanine,dsanders11/mezzanine,emile20...
--- +++ @@ -1,6 +1,6 @@ from django.db import DatabaseError, connection from django.db.models.signals import post_save -from mezzanine.accounts import get_profile_user_fieldname +from mezzanine.accounts import get_profile_user_fieldname, get_profile_for_user from mezzanine.conf import settings from mezzanine.util...
16d6dd8f3f2359a3a5d83eac9d2812560ab2d6bf
microcosm_pubsub/handlers.py
microcosm_pubsub/handlers.py
""" Handler base classes. """ from abc import ABCMeta from inflection import humanize from requests import get class URIHandler(object): """ Base handler for URI-driven events. As a general rule, we want PubSub events to convey the URI of a resource that was created (because resources are ideally i...
Add a base handler for URI-oriented pubsub messages
Add a base handler for URI-oriented pubsub messages
Python
apache-2.0
globality-corp/microcosm-pubsub,globality-corp/microcosm-pubsub
--- +++ @@ -0,0 +1,109 @@ +""" +Handler base classes. + +""" +from abc import ABCMeta +from inflection import humanize + +from requests import get + + +class URIHandler(object): + """ + Base handler for URI-driven events. + + As a general rule, we want PubSub events to convey the URI of a resource that was c...
df4601af8ce70e48ffd4362556c2b07e4a6f53db
nettests/experimental/script.py
nettests/experimental/script.py
from ooni import nettest from ooni.utils import log from twisted.internet import defer, protocol, reactor from twisted.python import usage import os def which(program): def is_exe(fpath): return os.path.isfile(fpath) and os.access(fpath, os.X_OK) fpath, fname = os.path.split(program) if fpath: ...
Add Dominic Hamon's nettest for running tests written with other interpreters.
Add Dominic Hamon's nettest for running tests written with other interpreters. * Fixes #8011.
Python
bsd-2-clause
kdmurray91/ooni-probe,Karthikeyan-kkk/ooni-probe,Karthikeyan-kkk/ooni-probe,kdmurray91/ooni-probe,lordappsec/ooni-probe,lordappsec/ooni-probe,lordappsec/ooni-probe,0xPoly/ooni-probe,juga0/ooni-probe,Karthikeyan-kkk/ooni-probe,0xPoly/ooni-probe,0xPoly/ooni-probe,juga0/ooni-probe,juga0/ooni-probe,kdmurray91/ooni-probe,kd...
--- +++ @@ -0,0 +1,90 @@ +from ooni import nettest +from ooni.utils import log +from twisted.internet import defer, protocol, reactor +from twisted.python import usage + +import os + + +def which(program): + def is_exe(fpath): + return os.path.isfile(fpath) and os.access(fpath, os.X_OK) + + fpath, fname ...
3c4a91171c3588a918415801f39442a5733dcfd4
tests/test_rst.py
tests/test_rst.py
# -*- coding: utf-8 -*- import sys import os import pytest sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../src/epicslide")) import rst class TestRst(object): def test_pygments(self): p = rst.Pygments('') print p.__dict__ print p.run() assert False def html_pa...
Structure for the Rst test
Structure for the Rst test
Python
apache-2.0
netantho/epicslide,netantho/epicslide
--- +++ @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +import sys +import os +import pytest + +sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../src/epicslide")) + +import rst + + +class TestRst(object): + def test_pygments(self): + p = rst.Pygments('') + print p.__dict__ + print p....
88021ff39f63a6d4616028a8a7e5226e1e706e93
cmsplugin_zinnia/cms_toolbar.py
cmsplugin_zinnia/cms_toolbar.py
"""Toolbar extensions for CMS""" from django.core.urlresolvers import reverse from django.utils.translation import ugettext_lazy as _ from cms.toolbar_base import CMSToolbar from cms.toolbar_pool import toolbar_pool class ZinniaToolbar(CMSToolbar): def populate(self): zinnia_menu = self.toolbar.get_or_c...
Add a toolbar for Zinnia
Add a toolbar for Zinnia
Python
bsd-3-clause
bittner/cmsplugin-zinnia,bittner/cmsplugin-zinnia,django-blog-zinnia/cmsplugin-zinnia,bittner/cmsplugin-zinnia,django-blog-zinnia/cmsplugin-zinnia,django-blog-zinnia/cmsplugin-zinnia
--- +++ @@ -0,0 +1,33 @@ +"""Toolbar extensions for CMS""" +from django.core.urlresolvers import reverse +from django.utils.translation import ugettext_lazy as _ + +from cms.toolbar_base import CMSToolbar +from cms.toolbar_pool import toolbar_pool + + +class ZinniaToolbar(CMSToolbar): + + def populate(self): + ...
4d774d2707779885384dafa00be7bc0617133989
src/ocspdash/custom_columns.py
src/ocspdash/custom_columns.py
from sqlalchemy.types import TypeDecorator, BINARY from sqlalchemy.dialects.postgresql import UUID import uuid class UUID(TypeDecorator): """Platform-independent UUID type. Uses Postgresql's UUID type, otherwise uses BINARY(16). Based on http://docs.sqlalchemy.org/en/rel_0_9/core/custom_types.html?hi...
Create a custom UUID column type
Create a custom UUID column type
Python
mit
scolby33/OCSPdash,scolby33/OCSPdash,scolby33/OCSPdash
--- +++ @@ -0,0 +1,37 @@ +from sqlalchemy.types import TypeDecorator, BINARY +from sqlalchemy.dialects.postgresql import UUID +import uuid + + +class UUID(TypeDecorator): + """Platform-independent UUID type. + + Uses Postgresql's UUID type, otherwise uses + BINARY(16). + Based on http://docs.sqlalchemy.or...
4a1ea1545c6428f3695c001ef9960ea696d20a36
test_utilities/src/d1_test/instance_generator/sciobj.py
test_utilities/src/d1_test/instance_generator/sciobj.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import random import re import StringIO import d1_common.xml import d1_test.d1_test_case import d1_test.instance_generator.identifier import d1_test.instance_generator.system_metadata def generate_reproducible(client, pid=None, option_dict=None): """Generate science o...
Add instance generator for complete reproducible objects
Add instance generator for complete reproducible objects
Python
apache-2.0
DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python,DataONEorg/d1_python
--- +++ @@ -0,0 +1,50 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +import random +import re +import StringIO + +import d1_common.xml + +import d1_test.d1_test_case +import d1_test.instance_generator.identifier +import d1_test.instance_generator.system_metadata + + +def generate_reproducible(client, pid=None, o...
96731d45f56a6fd2d6a11aa3e2f595c84e52cb37
tests/test_core_lexer.py
tests/test_core_lexer.py
# -*- coding: utf-8 -*- import sshrc.core.lexer as lexer import pytest @pytest.mark.parametrize("input_, output_", ( ("", ""), (" ", ""), (" #", ""), ("# ", ""), (" # dsfsdfsdf sdfsdfsd", ""), (" a", " a"), (" a# sdfsfdf", " a"), (" a # sdfsfsd x xxxxxxx # sdfs...
Add tests for cleaning line
Add tests for cleaning line
Python
mit
9seconds/concierge,9seconds/sshrc
--- +++ @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- + + +import sshrc.core.lexer as lexer + +import pytest + + +@pytest.mark.parametrize("input_, output_", ( + ("", ""), + (" ", ""), + (" #", ""), + ("# ", ""), + (" # dsfsdfsdf sdfsdfsd", ""), + (" a", " a"), + (" a# sdfsfdf", " ...
32cb1273be3ee0f5ec9a831287c8a5116dc07d24
tests/test_versioning.py
tests/test_versioning.py
# -*- coding: utf-8 -*- # import unittest from nose import tools from kitchen.versioning import version_tuple_to_string # Note: Using nose's generator tests for this so we can't subclass # unittest.TestCase class TestVersionTuple(object): ver_to_tuple = {'1': ((1,),), '1.0': ((1, 0),), '1....
Test for the new versioning sub package
Test for the new versioning sub package
Python
lgpl-2.1
fedora-infra/kitchen,fedora-infra/kitchen
--- +++ @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# +import unittest +from nose import tools + +from kitchen.versioning import version_tuple_to_string + +# Note: Using nose's generator tests for this so we can't subclass +# unittest.TestCase +class TestVersionTuple(object): + ver_to_tuple = {'1': ((1,),), + ...
9aafdd8f00b96105e86d23c1936da620d0540cbe
python/twitter_status_ids.py
python/twitter_status_ids.py
import sys from datetime import datetime # use like: # twilight stream --filter "locations=-180,-90,180,90" | grep --line-buffered -v '^{"delete":' | jq --unbuffered -r .id_str | gstdbuf -o0 head -1000 | python -u /Users/chbrown/github/sandbox/python/twitter_status_ids.py TWEPOCH = 1288834974657 while True: line...
Add python script that converts Twitter IDs to timestamps
Add python script that converts Twitter IDs to timestamps
Python
mit
chbrown/sandbox,chbrown/sandbox,chbrown/sandbox,chbrown/sandbox,chbrown/sandbox,chbrown/sandbox,chbrown/sandbox,chbrown/sandbox,chbrown/sandbox,chbrown/sandbox
--- +++ @@ -0,0 +1,23 @@ +import sys +from datetime import datetime + +# use like: +# twilight stream --filter "locations=-180,-90,180,90" | grep --line-buffered -v '^{"delete":' | jq --unbuffered -r .id_str | gstdbuf -o0 head -1000 | python -u /Users/chbrown/github/sandbox/python/twitter_status_ids.py + +TWEPOCH = 1...
594b0e28d840de323fd98a5a2f3acd543d94fec2
integration-test/192-shield-text-ref.py
integration-test/192-shield-text-ref.py
# US 101, "James Lick Freeway" # http://www.openstreetmap.org/way/27183379 # http://www.openstreetmap.org/relation/108619 assert_has_feature( 16, 10484, 25334, 'roads', { 'kind': 'highway', 'network': 'US:US', 'id': 27183379, 'shield_text': '101' }) # I-77, I-81, US-11 & US-52 all in one road West Virgin...
Add test case for networks and network sorting.
Add test case for networks and network sorting.
Python
mit
mapzen/vector-datasource,mapzen/vector-datasource,mapzen/vector-datasource
--- +++ @@ -0,0 +1,19 @@ +# US 101, "James Lick Freeway" +# http://www.openstreetmap.org/way/27183379 +# http://www.openstreetmap.org/relation/108619 +assert_has_feature( + 16, 10484, 25334, 'roads', + { 'kind': 'highway', 'network': 'US:US', 'id': 27183379, + 'shield_text': '101' }) + +# I-77, I-81, US-11...
4bd22be3c6b0d2a63fdf6d7a393d790025d16515
examples/unsuported_semantics.py
examples/unsuported_semantics.py
# Note: Display the list of unsuported semantics from operator import itemgetter from triton import * unsuportedSemantics = dict() def cbefore(instruction): if len(instruction.symbolicElements) == 0: mnemonic = opcodeToString(instruction.opcode) if mnemonic in unsuportedSemantics: ...
Add an example which lists the unsuported semantics - useful
Add an example which lists the unsuported semantics - useful
Python
apache-2.0
JonathanSalwan/Triton,JonathanSalwan/Triton,JonathanSalwan/Triton,JonathanSalwan/Triton,JonathanSalwan/Triton
--- +++ @@ -0,0 +1,34 @@ + +# Note: Display the list of unsuported semantics + +from operator import itemgetter +from triton import * + + +unsuportedSemantics = dict() + + +def cbefore(instruction): + if len(instruction.symbolicElements) == 0: + mnemonic = opcodeToString(instruction.opcode) + i...
14c48e8d8e44b0f3ff4f0a9d6dbeab9ae38201ab
test_bug.py
test_bug.py
code = '''from __future__ import unicode_literals from webtest import Upload def test_create_break(testapp, session): sid = session['id'] resp = testapp.post( '/sessions/{}/files'.format(sid), dict( file=Upload('foobar.py', b'print 123'), ), status=201, ) ...
Add test to demonstrage the bug
Add test to demonstrage the bug
Python
mit
victorlin/py.test-source-deindenting-bug-demo
--- +++ @@ -0,0 +1,41 @@ +code = '''from __future__ import unicode_literals + +from webtest import Upload + + +def test_create_break(testapp, session): + sid = session['id'] + + resp = testapp.post( + '/sessions/{}/files'.format(sid), + dict( + file=Upload('foobar.py', b'print 123'), + ...
b0451e622be57fade28ed431c4f9031093db3777
tests/test_cellom2tif.py
tests/test_cellom2tif.py
from cellom2tif import cellom2tif def test_start(): cellom2tif.start() assert cellom2tif.VM_STARTED def test_done(): cellom2tif.done() assert cellom2tif.VM_KILLED
Test individual functions in cellom2tif.py
Test individual functions in cellom2tif.py
Python
bsd-3-clause
jni/cellom2tif
--- +++ @@ -0,0 +1,11 @@ +from cellom2tif import cellom2tif + +def test_start(): + cellom2tif.start() + assert cellom2tif.VM_STARTED + + +def test_done(): + cellom2tif.done() + assert cellom2tif.VM_KILLED +
014e9eaa4ccc29d025f3910870789ad23d454ae3
tools/aa_bench_to_csv.py
tools/aa_bench_to_csv.py
#!/usr/bin/env python3 import sys import os import argparse import json def read_stat_file(path): with open(path, 'r') as f: json_data = f.read() parsed = json.loads(json_data) return parsed def main(): parser = argparse.ArgumentParser(description = 'Converts a sweep file to CSV.') ...
Add a script to convert AA bench runs to CSV.
Add a script to convert AA bench runs to CSV.
Python
mit
Themaister/Granite,Themaister/Granite,Themaister/Granite,Themaister/Granite,Themaister/Granite,Themaister/Granite
--- +++ @@ -0,0 +1,54 @@ +#!/usr/bin/env python3 + +import sys +import os +import argparse +import json + +def read_stat_file(path): + with open(path, 'r') as f: + json_data = f.read() + parsed = json.loads(json_data) + return parsed + +def main(): + parser = argparse.ArgumentParser(descrip...