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
3fcea684179da92e304e8eb2caafae80311e8507
app/__version__.py
app/__version__.py
#!/usr/bin/env python """ Change Log 1.3.0 Update all packages to current releases. Refactor to support Python 3.7 1.1.7 Update application logging to separate application events from those logged by the uwsgi servivce 1.1.6 Add email address detail for various authenticati...
Move the application version number to a separate file per PEP 396.
Move the application version number to a separate file per PEP 396.
Python
mit
parallaxinc/Cloud-Session,parallaxinc/Cloud-Session
--- +++ @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +""" +Change Log + +1.3.0 Update all packages to current releases. + Refactor to support Python 3.7 + +1.1.7 Update application logging to separate application events from + those logged by the uwsgi servivce + +1.1.6 Add email ...
88a673c402b60e3212e2a60477a854b756ae5e9a
db/specific_event.py
db/specific_event.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # import uuid from db.common import Base from db.common import session_scope class SpecificEvent(): @classmethod def find_by_event_id(self, event_id): # retrieving table name for specific event table_name = self.__tablename__ # finding ...
Add initial definition of specific event item
Add initial definition of specific event item
Python
mit
leaffan/pynhldb
--- +++ @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +# import uuid + +from db.common import Base +from db.common import session_scope + + +class SpecificEvent(): + + @classmethod + def find_by_event_id(self, event_id): + # retrieving table name for specific event + table_nam...
9aeebde15b5ad2d6526c9b62ab37cf0d890d167d
pbs/gen.py
pbs/gen.py
#!/usr/bin/env python3 #============================================================================== # author : Pavel Polishchuk # date : 19-08-2018 # version : # python_version : # copyright : Pavel Polishchuk 2018 # license : #===========================================...
Add script to run PBS jobs to create fragment database
Add script to run PBS jobs to create fragment database
Python
bsd-3-clause
DrrDom/crem,DrrDom/crem
--- +++ @@ -0,0 +1,54 @@ +#!/usr/bin/env python3 +#============================================================================== +# author : Pavel Polishchuk +# date : 19-08-2018 +# version : +# python_version : +# copyright : Pavel Polishchuk 2018 +# license : +#=======...
1208f86c8c5ba677bd6001442129d49f28c22764
test/dict_parameter_test.py
test/dict_parameter_test.py
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...
Add test cases for DictParameter
Add test cases for DictParameter
Python
apache-2.0
jamesmcm/luigi,samepage-labs/luigi,jw0201/luigi,h3biomed/luigi,humanlongevity/luigi,riga/luigi,Wattpad/luigi,dlstadther/luigi,javrasya/luigi,edx/luigi,Magnetic/luigi,adaitche/luigi,foursquare/luigi,dlstadther/luigi,linsomniac/luigi,samuell/luigi,Houzz/luigi,Houzz/luigi,PeteW/luigi,ContextLogic/luigi,PeteW/luigi,ehdr/lu...
--- +++ @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2012-2015 Spotify AB +# +# 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 +...
ce929da100303a56ca5d1e4c5ca3982c314d8696
CodeFights/simpleComposition.py
CodeFights/simpleComposition.py
#!/usr/local/bin/python # Code Fights Simple Composition Problem from functools import reduce import math def compose(f, g): return lambda x: f(g(x)) def simpleComposition(f, g, x): return compose(eval(f), eval(g))(x) # Generic composition of n functions: def compose_n(*functions): return reduce(lamb...
Solve Code Fights simple composition problem
Solve Code Fights simple composition problem
Python
mit
HKuz/Test_Code
--- +++ @@ -0,0 +1,42 @@ +#!/usr/local/bin/python +# Code Fights Simple Composition Problem + +from functools import reduce +import math + + +def compose(f, g): + return lambda x: f(g(x)) + + +def simpleComposition(f, g, x): + return compose(eval(f), eval(g))(x) + + +# Generic composition of n functions: +def c...
b58fc31236e0c2226d31f7c846cc6a6392c98d52
parsers/python/tests/test_single_reference.py
parsers/python/tests/test_single_reference.py
import unittest from jsonasobj import as_json from pyshexc.parser_impl.generate_shexj import parse shex = """<http://a.example/S0> @<http://a.example/S1> <http://a.example/S1> { <http://a.example/p1> . }""" shexj = """{ "type": "Schema", "shapes": [ "http://a.example/S1", { "type": "Shap...
Add an experimental test for a single referencew
Add an experimental test for a single referencew
Python
mit
shexSpec/grammar,shexSpec/grammar,shexSpec/grammar
--- +++ @@ -0,0 +1,33 @@ +import unittest + +from jsonasobj import as_json + +from pyshexc.parser_impl.generate_shexj import parse + +shex = """<http://a.example/S0> @<http://a.example/S1> +<http://a.example/S1> { <http://a.example/p1> . }""" + +shexj = """{ + "type": "Schema", + "shapes": [ + "http://a.exa...
46f8389f79ad7aae6c038a2eef853eb0652349c7
examples/auto_update_example.py
examples/auto_update_example.py
from guizero import * import random def read_sensor(): return random.randrange(3200, 5310, 10) / 100 def update_label(): text.set(read_sensor()) # recursive call text.after(1000, update_label) if __name__ == '__main__': app = App(title='Sensor Display!', height=100, ...
Add example for auto update of a widget using .after()
Add example for auto update of a widget using .after() Thanks to @ukBaz and @jezdean an example of the already implemented .after() function being used to update a widget automatically.
Python
bsd-3-clause
lawsie/guizero,lawsie/guizero,lawsie/guizero
--- +++ @@ -0,0 +1,25 @@ +from guizero import * +import random + + +def read_sensor(): + return random.randrange(3200, 5310, 10) / 100 + + +def update_label(): + text.set(read_sensor()) + # recursive call + text.after(1000, update_label) + + +if __name__ == '__main__': + app = App(title='Sensor Display...
8dbce56b1b595a761fdc29c8730ad5e11e40a203
php4dvd/test_searchfilm.py
php4dvd/test_searchfilm.py
# -*- coding: utf-8 -*- from selenium import webdriver from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.common.keys import Keys import unittest class searchFilm(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.driver.implicitly_wait(1...
Add a test for search saces.
Add a test for search saces.
Python
bsd-2-clause
bsamorodov/selenium-py-training-samorodov
--- +++ @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- +from selenium import webdriver +from selenium.common.exceptions import NoSuchElementException +from selenium.webdriver.common.keys import Keys +import unittest + + +class searchFilm(unittest.TestCase): + def setUp(self): + self.driver = webdriver.Firefox() ...
7a51f5a4e4effee4891cddbb867f873ec15c5fab
Python/strings/sort_anagrams.py
Python/strings/sort_anagrams.py
''' Sort an array of strings so that the anagrams are next to one another Ex. 'abba', 'foo', 'bar', 'aabb' becomes: 'abba', 'aabb', 'foo', 'bar' ''' from __future__ import print_function from collections import OrderedDict def collect_anagrams(str_arr): d = OrderedDict() for i, s in enumerate(str_arr): ...
Sort an array of strings so that the anagrams are grouped
Sort an array of strings so that the anagrams are grouped
Python
unlicense
amitsaha/learning,amitsaha/learning,amitsaha/learning,amitsaha/learning,amitsaha/learning,amitsaha/learning,amitsaha/learning,amitsaha/learning,amitsaha/learning,amitsaha/learning,amitsaha/learning
--- +++ @@ -0,0 +1,38 @@ +''' +Sort an array of strings so that the anagrams +are next to one another + +Ex. + +'abba', 'foo', 'bar', 'aabb' + +becomes: + +'abba', 'aabb', 'foo', 'bar' + +''' +from __future__ import print_function +from collections import OrderedDict + +def collect_anagrams(str_arr): + d = Ordere...
cb159032856c4409187154cc0ec3d6ffae1fc4db
py/top-k-frequent-words.py
py/top-k-frequent-words.py
from collections import Counter import heapq class Neg(): def __init__(self, x): self.x = x def __cmp__(self, other): return -cmp(self.x, other.x) class Solution(object): def topKFrequent_nlogk(self, words, k): """ :type words: List[str] :type k: int :rtype:...
Add py solution for 692. Top K Frequent Words
Add py solution for 692. Top K Frequent Words 692. Top K Frequent Words: https://leetcode.com/problems/top-k-frequent-words/ O(nlgk) and O(klgn) approaches
Python
apache-2.0
ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode
--- +++ @@ -0,0 +1,38 @@ +from collections import Counter +import heapq +class Neg(): + def __init__(self, x): + self.x = x + + def __cmp__(self, other): + return -cmp(self.x, other.x) + +class Solution(object): + def topKFrequent_nlogk(self, words, k): + """ + :type words: List[s...
1a75c38f43f0857fcc1c0dfe594f719870ad3553
issue_id.py
issue_id.py
#!/bin/python from __future__ import print_function, division import argparse import os import os.path import random import string import shutil if __name__ == '__main__': parser = argparse.ArgumentParser( description=""" Merge new content into existing dataset, assigining safe unique keys. File extensions...
Add an utility to assign unique ids to files.
Add an utility to assign unique ids to files.
Python
mit
xanxys/shogi_recognizer,xanxys/shogi_recognizer
--- +++ @@ -0,0 +1,49 @@ +#!/bin/python +from __future__ import print_function, division +import argparse +import os +import os.path +import random +import string +import shutil + +if __name__ == '__main__': + parser = argparse.ArgumentParser( + description=""" +Merge new content into existing dataset, assi...
4fae632c55f2b74cc29dd443bc6c017b666b46f5
demo/amqp_clock.py
demo/amqp_clock.py
#!/usr/bin/env python """ AMQP Clock Fires off simple messages at one-minute intervals to a topic exchange named 'clock', with the topic of the message being the local time as 'year.month.date.dow.hour.minute', for example: '2007.11.26.1.12.33', where the dow (day of week) is 0 for Sunday, 1 for Monday, and so on (sim...
Add another demo program, one that spits out messages at regular intervals.
Add another demo program, one that spits out messages at regular intervals.
Python
lgpl-2.1
jonahbull/py-amqp,newvem/py-amqplib,yetone/py-amqp,smurfix/aio-py-amqp,smurfix/aio-py-amqp,dallasmarlow/py-amqp,dims/py-amqp,jonahbull/py-amqp,dallasmarlow/py-amqp,yetone/py-amqp,dims/py-amqp
--- +++ @@ -0,0 +1,70 @@ +#!/usr/bin/env python +""" +AMQP Clock + +Fires off simple messages at one-minute intervals to a topic +exchange named 'clock', with the topic of the message being +the local time as 'year.month.date.dow.hour.minute', +for example: '2007.11.26.1.12.33', where the dow (day of week) +is 0 for ...
0996f1c59dfca9c22d0e3d78598bd3edbce62696
dailyFileCopy.py
dailyFileCopy.py
import os import time import shutil import glob def reviewAndCopy(copy_from_directory, copy_to_directory): review_window_in_hours = 24 _review_window_in_sec = review_window_in_hours*3600 os.chdir(copy_from_directory) text_files = getAllTxtFilesFromCurrentDirectory() files_with_age = createFileAgeD...
Add file copy utility script
Add file copy utility script
Python
mit
danielharada/fileCopyUtility
--- +++ @@ -0,0 +1,83 @@ +import os +import time +import shutil +import glob + +def reviewAndCopy(copy_from_directory, copy_to_directory): + review_window_in_hours = 24 + _review_window_in_sec = review_window_in_hours*3600 + + os.chdir(copy_from_directory) + text_files = getAllTxtFilesFromCurrentDirectory...
1d4960adcc307504ecd62e45cac21c69c3ac85a1
django_afip/migrations/0026_vat_conditions.py
django_afip/migrations/0026_vat_conditions.py
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('afip', '0025_receipt__default_currency'), ] operations = [ migrations.AlterField( model_name='receiptpdf', name='vat_condition', field=models.CharField(c...
Add updated migration with vat_conditions
Add updated migration with vat_conditions
Python
isc
hobarrera/django-afip,hobarrera/django-afip
--- +++ @@ -0,0 +1,21 @@ +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('afip', '0025_receipt__default_currency'), + ] + + operations = [ + migrations.AlterField( + model_name='receiptpdf', + name='vat_conditio...
da514b74cce0e605e7fb6f98ff2280a1ba87323f
scripts/sqa_module_init.py
scripts/sqa_module_init.py
#!/usr/bin/env python from __future__ import print_function import os import shutil import argparse parser = argparse.ArgumentParser(description='Setup SQA documentation for a MOOSE module.') parser.add_argument('module', type=str, help='The module folder name') args = parser.parse_args() folder = args.module title ...
Add script for creating SQA docs in a module
Add script for creating SQA docs in a module (refs #13661)
Python
lgpl-2.1
permcody/moose,jessecarterMOOSE/moose,jessecarterMOOSE/moose,jessecarterMOOSE/moose,lindsayad/moose,dschwen/moose,jessecarterMOOSE/moose,sapitts/moose,harterj/moose,laagesen/moose,andrsd/moose,idaholab/moose,bwspenc/moose,lindsayad/moose,harterj/moose,permcody/moose,lindsayad/moose,SudiptaBiswas/moose,harterj/moose,dsc...
--- +++ @@ -0,0 +1,48 @@ +#!/usr/bin/env python +from __future__ import print_function + +import os +import shutil +import argparse + +parser = argparse.ArgumentParser(description='Setup SQA documentation for a MOOSE module.') +parser.add_argument('module', type=str, help='The module folder name') +args = parser.pars...
adf7234437c75d1a7c0b121f4b14676356df20e5
100_Same_Tree.py
100_Same_Tree.py
/* * https://leetcode.com/problems/same-tree/ * * Given two binary trees, write a function to check if they are equal or not. * Two binary trees are considered equal if they are structurally identical and the nodes have the same value. * */ # Definition for a binary tree node. # class TreeNode(object): # def...
Add solution 100. Same Tree.
Add solution 100. Same Tree.
Python
mit
wangyangkobe/leetcode,wangyangkobe/leetcode,wangyangkobe/leetcode,wangyangkobe/leetcode
--- +++ @@ -0,0 +1,27 @@ +/* + * https://leetcode.com/problems/same-tree/ + * + * Given two binary trees, write a function to check if they are equal or not. + * Two binary trees are considered equal if they are structurally identical and the nodes have the same value. + * + */ +# Definition for a binary tree node. ...
4424959dd8bef2dfe709319bdf55b860ccc4971e
accounts/tests/tests_vbuserlist_page.py
accounts/tests/tests_vbuserlist_page.py
#! /usr/bin/env python __author__ = 'Henri Buyse' import pytest import datetime from django.contrib.auth.handlers.modwsgi import check_password from django.contrib.auth.models import User from django.test import Client from accounts.models import VBUserProfile key_expires = datetime.datetime.strftime(datetime.da...
Add a client test on the users list view
Add a client test on the users list view
Python
mit
hbuyse/VBTournaments,hbuyse/VBTournaments,hbuyse/VBTournaments
--- +++ @@ -0,0 +1,22 @@ +#! /usr/bin/env python + +__author__ = 'Henri Buyse' + + +import pytest +import datetime + +from django.contrib.auth.handlers.modwsgi import check_password +from django.contrib.auth.models import User +from django.test import Client + +from accounts.models import VBUserProfile + + +key_expir...
72ca20f34b9ef70cee930271fa698de187f97857
examples/simple_app.py
examples/simple_app.py
from flask_table import Table, Col, LinkCol from flask import Flask """A example for creating a simple table within a working Flask app. Our table has just two columns, one of which shows the name and is a link to the item's page. The other shows the description. """ app = Flask(__name__) class ItemTable(Table): ...
Add example for simple table within a flask app
Add example for simple table within a flask app
Python
bsd-3-clause
plumdog/flask_table,plumdog/flask_table,plumdog/flask_table
--- +++ @@ -0,0 +1,57 @@ +from flask_table import Table, Col, LinkCol +from flask import Flask + +"""A example for creating a simple table within a working Flask app. + +Our table has just two columns, one of which shows the name and is a +link to the item's page. The other shows the description. + +""" + +app = Flas...
b77b284c1ecbd599fec218d10068e419e0070994
src/roman_to_integer.py
src/roman_to_integer.py
class Solution(object): def romanToInt(self, s): """ :type s: str :rtype: int """ if not s: return 0 amount = 0 for i, c in enumerate(s): cur = self.romanTable(c) if i < len(s)-1: nex = self.romanTable(s[i+1]...
Add Roman To Integer solution
Add Roman To Integer solution
Python
mit
chancyWu/leetcode
--- +++ @@ -0,0 +1,46 @@ +class Solution(object): + def romanToInt(self, s): + """ + :type s: str + :rtype: int + """ + if not s: + return 0 + amount = 0 + for i, c in enumerate(s): + cur = self.romanTable(c) + if i < len(s)-1: + ...
3bb9be0dd508a33d9063c8919d471ec39255aefb
load_and_plot.py
load_and_plot.py
import SixChannelReader as SCR import matplotlib.pyplot as plt import numpy as np def main(): """ open previously saved data and plot it. Convert raw 12-bit ADC data to voltage """ filename = "TestData-2015-05-15-1306.pkl" SR = SCR.SerialDataLogger() t, C1, C2, C3, C4, C5, C6 = SR.load_data(filename) fig = p...
Load and plot python script
Load and plot python script
Python
mit
jameskeaveney/ArduinoDUE-Data-Logger,jameskeaveney/ArduinoDUE-Data-Logger
--- +++ @@ -0,0 +1,47 @@ +import SixChannelReader as SCR +import matplotlib.pyplot as plt +import numpy as np + +def main(): + """ open previously saved data and plot it. Convert raw 12-bit ADC data to voltage """ + + filename = "TestData-2015-05-15-1306.pkl" + SR = SCR.SerialDataLogger() + t, C1, C2, C3, C4, C5, C...
8ee65cbf390d5caae04498397f74cd8a64e7903e
email_auth/migrations/0003_auto_20151209_0746.py
email_auth/migrations/0003_auto_20151209_0746.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models import email_auth.models class Migration(migrations.Migration): dependencies = [ ('email_auth', '0002_auto_20151011_1652'), ] operations = [ migrations.AlterModelManagers( ...
Add a necessary migration for email_auth
Add a necessary migration for email_auth
Python
bsd-3-clause
divio/django-shop,rfleschenberg/django-shop,jrief/django-shop,khchine5/django-shop,awesto/django-shop,rfleschenberg/django-shop,jrief/django-shop,awesto/django-shop,jrief/django-shop,divio/django-shop,divio/django-shop,nimbis/django-shop,khchine5/django-shop,rfleschenberg/django-shop,khchine5/django-shop,jrief/django-s...
--- +++ @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +import email_auth.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('email_auth', '0002_auto_20151011_1652'), + ] + + operations = [ + ...
2da04cccf32e5280e36966b2d9c93a643e7458e7
osf/migrations/0083_add_ember_waffle_flags.py
osf/migrations/0083_add_ember_waffle_flags.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.9 on 2018-03-02 17:45 from __future__ import unicode_literals from waffle.models import Flag from django.db import migrations, IntegrityError, transaction EMBER_WAFFLE_PAGES = [ 'completed_registration_form_detail', 'dashboard', 'draft_registration_form', ...
Add migration to add some ember waffle flags to the db for waffle pages with a default value of False. Can be changed in django app when ready.
Add migration to add some ember waffle flags to the db for waffle pages with a default value of False. Can be changed in django app when ready.
Python
apache-2.0
adlius/osf.io,mfraezz/osf.io,mattclark/osf.io,chennan47/osf.io,CenterForOpenScience/osf.io,felliott/osf.io,caseyrollins/osf.io,sloria/osf.io,HalcyonChimera/osf.io,mattclark/osf.io,adlius/osf.io,brianjgeiger/osf.io,binoculars/osf.io,cslzchen/osf.io,saradbowman/osf.io,Johnetordoff/osf.io,felliott/osf.io,chennan47/osf.io,...
--- +++ @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.9 on 2018-03-02 17:45 +from __future__ import unicode_literals +from waffle.models import Flag +from django.db import migrations, IntegrityError, transaction + +EMBER_WAFFLE_PAGES = [ + 'completed_registration_form_detail', + 'dashboa...
b5d5f377cf3d3b2b4459c36ba47e2e0f4a3125f4
mothermayi/colors.py
mothermayi/colors.py
BLUE = '\033[94m' GREEN = '\033[92m' YELLOW = '\033[93m' RED = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' UNDERLINE = '\033[4m' def green(text): return GREEN + text + ENDC def red(text): return RED + text + ENDC
Add module for putting color in our text output
Add module for putting color in our text output
Python
mit
EliRibble/mothermayi
--- +++ @@ -0,0 +1,13 @@ +BLUE = '\033[94m' +GREEN = '\033[92m' +YELLOW = '\033[93m' +RED = '\033[91m' +ENDC = '\033[0m' +BOLD = '\033[1m' +UNDERLINE = '\033[4m' + +def green(text): + return GREEN + text + ENDC + +def red(text): + return RED + text + ENDC
ee5b38c649b1a5b46ce5b53c179bde57b3a6e6f2
examples/customserverexample.py
examples/customserverexample.py
#!/usr/bin/env python3 from pythinclient.server import ThinServer class CustomThinServer(BasicThinServer): def __init__(self, port=65000, is_daemon=False): super(BasicThinServer, self).__init__(port, is_daemon=is_daemon) # add custom server hooks self.add_hook('help', self.__server_help) self.add_ho...
Add a custom server example implementation. This is fully compatible with the client example.
Add a custom server example implementation. This is fully compatible with the client example.
Python
bsd-3-clause
alekratz/pythinclient
--- +++ @@ -0,0 +1,47 @@ +#!/usr/bin/env python3 + +from pythinclient.server import ThinServer + +class CustomThinServer(BasicThinServer): + def __init__(self, port=65000, is_daemon=False): + super(BasicThinServer, self).__init__(port, is_daemon=is_daemon) + # add custom server hooks + self.add_hook('help',...
fe6d7b11ab87d9ea3a2b99aee17b9a371c55f162
examples/mhs_atmosphere_plot.py
examples/mhs_atmosphere_plot.py
# -*- coding: utf-8 -*- """ Created on Fri Jan 9 12:52:31 2015 @author: stuart """ import os import glob import yt model = 'spruit' datadir = os.path.expanduser('~/mhs_atmosphere/'+model+'/') files = glob.glob(datadir+'/*') files.sort() print(files) ds = yt.load(files[0]) slc = yt.SlicePlot(ds, fields='density...
Add a very basic yt plotting example
Add a very basic yt plotting example
Python
bsd-2-clause
SWAT-Sheffield/pysac,Cadair/pysac
--- +++ @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +""" +Created on Fri Jan 9 12:52:31 2015 + +@author: stuart +""" +import os +import glob + +import yt + +model = 'spruit' +datadir = os.path.expanduser('~/mhs_atmosphere/'+model+'/') + +files = glob.glob(datadir+'/*') +files.sort() + +print(files) + + +ds = yt.load(f...
d6d321fa99b9def1d85ff849fc13bbe17fa58510
featurex/tests/test_datasets.py
featurex/tests/test_datasets.py
from featurex.datasets.text import _load_datasets, fetch_dictionary from unittest import TestCase from pandas import DataFrame import urllib2 class TestDatasets(TestCase): def test_dicts(self): """ Check that all text dictionaries download successfully. """ datasets = _load_da...
Add test for text dictionaries.
Add test for text dictionaries.
Python
bsd-3-clause
tyarkoni/featureX,tyarkoni/pliers
--- +++ @@ -0,0 +1,28 @@ +from featurex.datasets.text import _load_datasets, fetch_dictionary +from unittest import TestCase +from pandas import DataFrame +import urllib2 + + +class TestDatasets(TestCase): + + def test_dicts(self): + """ + Check that all text dictionaries download successfully. +...
18c40bdc02c5cd27c69edb394e040a3db3d75e05
bin/filter_pycapsule.py
bin/filter_pycapsule.py
#!/usr/bin/python3 """Filters Pycapsule error""" import fileinput import sys STRING = "RuntimeError: Object of type <class 'NamedArray'>" NUM_AFTER = 5 # How many lines after to delete NUM_BEFORE = 4 # How far before to delete output_lines = [] delete_count = 0 for line in fileinput.input(): if delete_count > ...
Add filtering for bogus output
Add filtering for bogus output
Python
apache-2.0
ScienceStacks/BaseStack,ScienceStacks/BaseStack,ScienceStacks/BaseStack
--- +++ @@ -0,0 +1,23 @@ +#!/usr/bin/python3 +"""Filters Pycapsule error""" + +import fileinput +import sys + +STRING = "RuntimeError: Object of type <class 'NamedArray'>" +NUM_AFTER = 5 # How many lines after to delete +NUM_BEFORE = 4 # How far before to delete + +output_lines = [] +delete_count = 0 +for line in f...
d0aa398a0df17540c7d9160dadd48d3ab60e230e
core/tests/tests_client_home_page.py
core/tests/tests_client_home_page.py
#! /usr/bin/env python __author__ = "Henri Buyse" import pytest from django.test import Client def test_client_get_home_page(): c = Client() response = c.get('/') assert response.status_code == 200 @pytest.mark.django_db def test_logged_client_get_home_page(): c = Client() c.login(username='te...
Test home page as anonymous and logged user
Test home page as anonymous and logged user
Python
mit
hbuyse/VBTournaments,hbuyse/VBTournaments,hbuyse/VBTournaments
--- +++ @@ -0,0 +1,34 @@ +#! /usr/bin/env python + +__author__ = "Henri Buyse" + + +import pytest +from django.test import Client + +def test_client_get_home_page(): + c = Client() + response = c.get('/') + assert response.status_code == 200 + + +@pytest.mark.django_db +def test_logged_client_get_home_page()...
b49371bbcb756371296bfe309071f2b9579e5b99
examples/test_markers.py
examples/test_markers.py
""" These tests demonstrate pytest marker use for finding and running tests. Usage examples from this file: pytest -v -m marker_test_suite # Runs A, B, C, D pytest -v -m marker1 # Runs A pytest -v -m marker2 # Runs B, C ...
Add test suite for demoing pytest markers
Add test suite for demoing pytest markers
Python
mit
mdmintz/seleniumspot,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/seleniumspot,seleniumbase/SeleniumBase,mdmintz/SeleniumBase
--- +++ @@ -0,0 +1,39 @@ +""" These tests demonstrate pytest marker use for finding and running tests. + + Usage examples from this file: + pytest -v -m marker_test_suite # Runs A, B, C, D + pytest -v -m marker1 # Runs A + pytest -v -m marker2 ...
e06a766e082f168e0b89776355b622b980a0a735
locations/spiders/learning_experience.py
locations/spiders/learning_experience.py
# -*- coding: utf-8 -*- import scrapy import re from locations.items import GeojsonPointItem class TheLearningExperienceSpider(scrapy.Spider): name = "learning_experience" allowed_domains = ["thelearningexperience.com"] start_urls = ( 'https://thelearningexperience.com/our-centers/directory', ...
Add The Learning Experience spider
Add The Learning Experience spider
Python
mit
iandees/all-the-places,iandees/all-the-places,iandees/all-the-places
--- +++ @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +import scrapy +import re + +from locations.items import GeojsonPointItem + + +class TheLearningExperienceSpider(scrapy.Spider): + name = "learning_experience" + allowed_domains = ["thelearningexperience.com"] + start_urls = ( + 'https://thelearningexp...
c44448e6e2fa846d4eea8b6d7d907168becdd1ad
runtests.py
runtests.py
#!/usr/bin/env python import sys import logging from optparse import OptionParser from tests.config import configure logging.disable(logging.CRITICAL) def run_tests(*test_args): from django_nose import NoseTestSuiteRunner test_runner = NoseTestSuiteRunner() if not test_args: test_args = ['tests'...
#!/usr/bin/env python import sys import logging from optparse import OptionParser from tests.config import configure logging.disable(logging.CRITICAL) def run_tests(*test_args): from django_nose import NoseTestSuiteRunner test_runner = NoseTestSuiteRunner() if not test_args: test_args = ['tests'...
Remove coverage options from default test run
Remove coverage options from default test run These were getting annoying for normal runs.
Python
bsd-3-clause
faratro/django-oscar,WadeYuChen/django-oscar,django-oscar/django-oscar,jmt4/django-oscar,okfish/django-oscar,manevant/django-oscar,john-parton/django-oscar,jinnykoo/wuyisj,rocopartners/django-oscar,itbabu/django-oscar,makielab/django-oscar,saadatqadri/django-oscar,solarissmoke/django-oscar,sonofatailor/django-oscar,pdo...
--- +++ @@ -26,8 +26,8 @@ # used down to a minimum. Otherwise, use the spec plugin nose_args = ['-s', '-x', '--with-progressive' if not args else '--with-spec'] - nose_args.extend([ - '--with-coverage', '--cover-package=oscar', '--cover-html', - '--cover-html-dir=htmlcov'...
97b19e6f3705fc0b320f33b44476f7139833de9e
glowing-lines.py
glowing-lines.py
from PIL import Image, ImageDraw import random W = 500 im = Image.new('RGB', (W, W)) NCOLORS = 19 COLORS = [] def get_origin_point(): return [random.randint(0, W-1), random.randint(0, W-1)] def get_vector(): return [random.randint(0.3*W, 0.6*W), random.randint(0.3*W, 0.6*W)] def draw_one_line(draw): op = g...
Add crude script to draw glowing lines; currently the dark part hides other lines, making them look physical; should be additive
Add crude script to draw glowing lines; currently the dark part hides other lines, making them look physical; should be additive
Python
mit
redpig2/pilhacks
--- +++ @@ -0,0 +1,40 @@ +from PIL import Image, ImageDraw + +import random + +W = 500 +im = Image.new('RGB', (W, W)) +NCOLORS = 19 +COLORS = [] + +def get_origin_point(): + return [random.randint(0, W-1), random.randint(0, W-1)] + +def get_vector(): + return [random.randint(0.3*W, 0.6*W), random.randint(0.3*W, 0...
f0922bade498bcadf587c4b756060cf062fe68d4
tests/unit/test_rand.py
tests/unit/test_rand.py
''' Test sorbic.utils.rand ''' # import sorbic libs import sorbic.utils.rand # Import python libs import unittest class TestRand(unittest.TestCase): ''' Cover db funcs ''' def test_rand_hex_strs(self): ''' Test database creation ''' rands = [] for _ in range(0,1...
Add initial tests for the rand module
Add initial tests for the rand module
Python
apache-2.0
thatch45/sorbic,s0undt3ch/sorbic
--- +++ @@ -0,0 +1,42 @@ +''' +Test sorbic.utils.rand +''' +# import sorbic libs +import sorbic.utils.rand +# Import python libs +import unittest + + +class TestRand(unittest.TestCase): + ''' + Cover db funcs + ''' + def test_rand_hex_strs(self): + ''' + Test database creation + ''' +...
f74b1615567d5cbf2cb00572cc14450ffd4b0c1c
test/requests/parametrized_test.py
test/requests/parametrized_test.py
import logging import unittest from elasticsearch import Elasticsearch, TransportError class ParametrizedTest(unittest.TestCase): def __init__(self, methodName='runTest', gn2_url="http://localhost:5003", es_url="localhost:9200"): super(ParametrizedTest, self).__init__(methodName=methodName) self.g...
Create parametrized superclass for tests
Create parametrized superclass for tests * Since the tests require that some parameters be provided while running the tests, create a class that helps abstract away the details of retrieving and setting the expected parameters.
Python
agpl-3.0
DannyArends/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,DannyArends/genenetwork2,DannyArends/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,genenetwork/genenetwork2,genenetwork/genenetwork2,DannyArends/genenetwork2,genenetwork/genenetwork2,zsloan/genenetwork2,DannyArends/genenetwork2,...
--- +++ @@ -0,0 +1,27 @@ +import logging +import unittest +from elasticsearch import Elasticsearch, TransportError + +class ParametrizedTest(unittest.TestCase): + + def __init__(self, methodName='runTest', gn2_url="http://localhost:5003", es_url="localhost:9200"): + super(ParametrizedTest, self).__init__(me...
1475a095620d2c9ef47f8bd9ea4363907ff0067b
remove_duplicates_from_sorted_list_ii.py
remove_duplicates_from_sorted_list_ii.py
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: # @param head, a ListNode # @return a ListNode def deleteDuplicates(self, head): if None == head: return None header = ListNode(-1) ...
Remove Duplicates from Sorted List II
Remove Duplicates from Sorted List II
Python
apache-2.0
don7hao/leetcode_oj,don7hao/leetcode_oj
--- +++ @@ -0,0 +1,72 @@ +# Definition for singly-linked list. +class ListNode: + def __init__(self, x): + self.val = x + self.next = None + +class Solution: + # @param head, a ListNode + # @return a ListNode + def deleteDuplicates(self, head): + if None == head: + return N...
8a9b4de36f35416874d10734ae1c08287ebd5c32
mrequests/examples/get_json.py
mrequests/examples/get_json.py
import mrequests as requests host = 'http://localhost/' url = host + "get" r = requests.get(url, headers={"Accept": "application/json"}) print(r) print(r.content) print(r.text) print(r.json()) r.close()
Add simple mrequests GET example
Add simple mrequests GET example Signed-off-by: Christopher Arndt <711c73f64afdce07b7e38039a96d2224209e9a6c@chrisarndt.de>
Python
mit
SpotlightKid/micropython-stm-lib
--- +++ @@ -0,0 +1,11 @@ +import mrequests as requests + + +host = 'http://localhost/' +url = host + "get" +r = requests.get(url, headers={"Accept": "application/json"}) +print(r) +print(r.content) +print(r.text) +print(r.json()) +r.close()
13b835d525f6576bfa047ce3001479d8b81f15b7
mistral/db/sqlalchemy/migration/alembic_migrations/versions/014_fix_past_scripts_discrepancies.py
mistral/db/sqlalchemy/migration/alembic_migrations/versions/014_fix_past_scripts_discrepancies.py
# Copyright 2016 OpenStack Foundation. # # 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 ...
Fix past migration scripts discrepancies
Fix past migration scripts discrepancies It is important that running all migration scripts from first to last will give the expected model. This fix is a first step. It fixes all discrepancies from previous scripts. There are still changes in the model that needs to have a migration script written for them, but tha...
Python
apache-2.0
StackStorm/mistral,openstack/mistral,StackStorm/mistral,openstack/mistral
--- +++ @@ -0,0 +1,74 @@ +# Copyright 2016 OpenStack Foundation. +# +# 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 require...
ee05b846612aa5c978949ff90f38290915983385
check-entropy.py
check-entropy.py
#!/usr/bin/env python import sys import os import logging import time log = logging.getLogger(__name__) log.setLevel(logging.INFO) mainHandler = logging.StreamHandler() mainHandler.setFormatter(logging.Formatter('%(levelname)s %(asctime)s - %(module)s - %(funcName)s: %(message)s')) log.addHandler(mainHandler) PROC_...
Test tool for checking entropy available in a loop
Test tool for checking entropy available in a loop
Python
mit
infincia/TokenTools
--- +++ @@ -0,0 +1,34 @@ +#!/usr/bin/env python + +import sys +import os +import logging +import time + +log = logging.getLogger(__name__) +log.setLevel(logging.INFO) +mainHandler = logging.StreamHandler() +mainHandler.setFormatter(logging.Formatter('%(levelname)s %(asctime)s - %(module)s - %(funcName)s: %(message)s'...
8a029fb00892c8bf385dae76466ae1e211e27ca6
cohydra/test_profile.py
cohydra/test_profile.py
import tempfile import unittest import unittest.mock from . import profile from . import test_helper @unittest.mock.patch.object( profile.Profile, 'generate', autospec=True, ) @unittest.mock.patch.object( profile.Profile, '__abstractmethods__', new=set(), ) class TestProfile(unittest.TestCase): def...
Add basic test for profile.Profile.
Add basic test for profile.Profile. Addresses #3.
Python
apache-2.0
dseomn/cohydra
--- +++ @@ -0,0 +1,37 @@ +import tempfile +import unittest +import unittest.mock + +from . import profile +from . import test_helper + + +@unittest.mock.patch.object( + profile.Profile, + 'generate', + autospec=True, + ) +@unittest.mock.patch.object( + profile.Profile, + '__abstractmethods__', + new=set(), + ...
7bf60d5ef1e6052044ebfedf1e2bf2dddc0940b8
python/getmonotime.py
python/getmonotime.py
import getopt, sys if __name__ == '__main__': sippy_path = None try: opts, args = getopt.getopt(sys.argv[1:], 's:S:i:o:b') except getopt.GetoptError: usage() for o, a in opts: if o == '-S': sippy_path = a.strip() continue if sippy_path != None: ...
Implement RTPP_LOG_TSTART and RTPP_LOG_TFORM="rel" env parameters to aid debugging.
Implement RTPP_LOG_TSTART and RTPP_LOG_TFORM="rel" env parameters to aid debugging.
Python
bsd-2-clause
sippy/rtp_cluster,sippy/rtp_cluster
--- +++ @@ -0,0 +1,21 @@ +import getopt, sys + +if __name__ == '__main__': + sippy_path = None + + try: + opts, args = getopt.getopt(sys.argv[1:], 's:S:i:o:b') + except getopt.GetoptError: + usage() + + for o, a in opts: + if o == '-S': + sippy_path = a.strip() + ...
5ee0f309521320f0cc91c61b112fd94c8415f37c
jinja2.py
jinja2.py
from __future__ import (division, absolute_import, print_function, unicode_literals) import jinja2 class PermissiveUndefined(jinja2.Undefined): def __getattr__(self, name): return PermissiveUndefined(name) def __getitem__(self, name): return PermissiveUndefined(name) ...
Add helpers to make Jinja2 more like Angular: PermissiveUndefined, JSDict, and JSList.
Add helpers to make Jinja2 more like Angular: PermissiveUndefined, JSDict, and JSList.
Python
mit
emosenkis/angular2tmpl
--- +++ @@ -0,0 +1,46 @@ +from __future__ import (division, absolute_import, print_function, + unicode_literals) + +import jinja2 + + +class PermissiveUndefined(jinja2.Undefined): + def __getattr__(self, name): + return PermissiveUndefined(name) + + def __getitem__(self, name): + ...
05b90dab50281e9b1cb35575d35db5f45d2ba15a
connected_components.py
connected_components.py
def get_connected_components(): # assume nodes labeled 1 to n # connected_components = [] # for i in 1..n # if i not yet explored # connected_component = bfs (graph, node i) # connected_components.append(connected_component) # return connected_components
Add pseudo for connected components
Add pseudo for connected components
Python
mit
stephtzhang/algorithms
--- +++ @@ -0,0 +1,8 @@ +def get_connected_components(): + # assume nodes labeled 1 to n + # connected_components = [] + # for i in 1..n + # if i not yet explored + # connected_component = bfs (graph, node i) + # connected_components.append(connected_component) + # return conn...
c09446f758f42fbf00866360e0760f1a0fae0ab7
tests/test_sso/test_azure_id_creation.py
tests/test_sso/test_azure_id_creation.py
from urllib.parse import urlparse import pytest from django.urls import reverse from tests.utils import BaseViewTest @pytest.mark.sso_mark class AzureIdentityTest(BaseViewTest): def test_wrong_provider_raises_404(self): auth_path = reverse('oauth:create_identity', kwargs={'provider': 'undefined'}) ...
Add azure id creation tests
Add azure id creation tests
Python
apache-2.0
polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon
--- +++ @@ -0,0 +1,32 @@ +from urllib.parse import urlparse + +import pytest + +from django.urls import reverse + +from tests.utils import BaseViewTest + + +@pytest.mark.sso_mark +class AzureIdentityTest(BaseViewTest): + def test_wrong_provider_raises_404(self): + auth_path = reverse('oauth:create_identity'...
62906d37cca8cde2617372f71881dc802f23d6b9
h2/frame_buffer.py
h2/frame_buffer.py
# -*- coding: utf-8 -*- """ h2/frame_buffer ~~~~~~~~~~~~~~~ A data structure that provides a way to iterate over a byte buffer in terms of frames. """ from hyperframe.frame import Frame class FrameBuffer(object): """ This is a data structure that expects to act as a buffer for HTTP/2 data that allows ite...
Define an iterable frame buffer.
Define an iterable frame buffer.
Python
mit
vladmunteanu/hyper-h2,vladmunteanu/hyper-h2,python-hyper/hyper-h2,bhavishyagopesh/hyper-h2,Kriechi/hyper-h2,python-hyper/hyper-h2,Kriechi/hyper-h2,mhils/hyper-h2
--- +++ @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +""" +h2/frame_buffer +~~~~~~~~~~~~~~~ + +A data structure that provides a way to iterate over a byte buffer in terms of +frames. +""" +from hyperframe.frame import Frame + + +class FrameBuffer(object): + """ + This is a data structure that expects to act as a b...
595eaf19c1d3a89970b5ebe148f12a5df11807cc
run_helmholtz.py
run_helmholtz.py
from __future__ import absolute_import, print_function, division from firedrake import * from helmholtz import MixedHelmholtzProblem from meshes import generate_2d_square_mesh import matplotlib as plt def run_helmholtz_resolution_test(degree, quadrilateral=False): """ """ params = {'mat_type': 'matfree...
Add module for helmholtz results
Add module for helmholtz results
Python
mit
thomasgibson/firedrake-hybridization
--- +++ @@ -0,0 +1,35 @@ +from __future__ import absolute_import, print_function, division + +from firedrake import * +from helmholtz import MixedHelmholtzProblem +from meshes import generate_2d_square_mesh + +import matplotlib as plt + + +def run_helmholtz_resolution_test(degree, quadrilateral=False): + """ + ...
3ef4e68ae64a46f09103001f391b3d6a3d098e33
test/test_bezier_direct.py
test/test_bezier_direct.py
from __future__ import division import sys import os sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) # import cocos from cocos.director import director from cocos.actions import Bezier from cocos.sprite import Sprite import pyglet from cocos import path def direct_bezier(p0, p1, p2, p3): '''G...
Test using bezier going through 4 specific points
Test using bezier going through 4 specific points git-svn-id: 5665c17dde288ce6190d85f4a2d6486351776710@869 f663ce52-ac46-0410-b8de-c1c220b0eb76
Python
bsd-3-clause
eevee/cocos2d-mirror
--- +++ @@ -0,0 +1,73 @@ +from __future__ import division + +import sys +import os +sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) +# + + +import cocos +from cocos.director import director +from cocos.actions import Bezier +from cocos.sprite import Sprite +import pyglet + +from cocos import path + ...
b4a932eb8d99f9f4d29d3459c62e0cf81240fbdb
scripts/stats.py
scripts/stats.py
import os import telegram from leonard import Leonard telegram_client = telegram.Bot(os.environ['BOT_TOKEN']) bot = Leonard(telegram_client) bot.collect_plugins() def main(): count = 0 for key in bot.redis.scan_iter(match='user:*:registered'): count += 1 print('Total users:', count) if __name_...
Add script for counting all users count
Add script for counting all users count
Python
mit
sevazhidkov/leonard
--- +++ @@ -0,0 +1,22 @@ +import os +import telegram +from leonard import Leonard + +telegram_client = telegram.Bot(os.environ['BOT_TOKEN']) +bot = Leonard(telegram_client) +bot.collect_plugins() + + +def main(): + count = 0 + for key in bot.redis.scan_iter(match='user:*:registered'): + count += 1 + + ...
8f97a104bf988a277453bf70043829c45a394919
libvirt/libvirt_attach_device_rbd.py
libvirt/libvirt_attach_device_rbd.py
#!/usr/bin/env python __author__ = 'weezhard' __license__ = 'GPL' __version__ = '1.0.0' import sys import argparse import libvirt import subprocess parser = argparse.ArgumentParser() parser.add_argument('-d','--domain', help='Domain libvirt',required=True) parser.add_argument('-p','--pool',help='Pool ceph', require...
Add script attach device rbd
Add script attach device rbd
Python
apache-2.0
skylost/heap,skylost/heap,skylost/heap
--- +++ @@ -0,0 +1,68 @@ +#!/usr/bin/env python + +__author__ = 'weezhard' +__license__ = 'GPL' +__version__ = '1.0.0' + +import sys +import argparse +import libvirt +import subprocess + +parser = argparse.ArgumentParser() +parser.add_argument('-d','--domain', help='Domain libvirt',required=True) +parser.add_argumen...
a20a1cc4ff34185fa1badf812f292c007f9f3d05
flexx/ui/examples/using_python_in_js.py
flexx/ui/examples/using_python_in_js.py
# doc-export: UsingPython """ This example demonstrates what things from Python land can be used in JS. Flexx detects what names are used in the transpiled JS of a Model (or Widget class, and tries to look these up in the module, converting the used objects if possible. Check out the source of the generated page to s...
Add example for using Python in JS
Add example for using Python in JS
Python
bsd-2-clause
zoofIO/flexx,JohnLunzer/flexx,JohnLunzer/flexx,zoofIO/flexx,jrversteegh/flexx,JohnLunzer/flexx,jrversteegh/flexx
--- +++ @@ -0,0 +1,69 @@ +# doc-export: UsingPython +""" +This example demonstrates what things from Python land can be used in JS. + +Flexx detects what names are used in the transpiled JS of a Model (or +Widget class, and tries to look these up in the module, converting the +used objects if possible. + +Check out t...
2eceebdd1eb052b81b6563e7bd58c275c4f74592
bin/check_rule_algs.py
bin/check_rule_algs.py
# Print list of rules with invalid algs from api import config from api.dao import APINotFoundException from api.jobs.gears import get_gear_by_name if __name__ == '__main__': for rule in config.db.project_rules.find({}): alg = rule.get('alg') if not alg: print 'Rule {} has no alg.'.f...
Add script to find malformed rules
Add script to find malformed rules
Python
mit
scitran/core,scitran/api,scitran/core,scitran/core,scitran/api,scitran/core
--- +++ @@ -0,0 +1,22 @@ +# Print list of rules with invalid algs + +from api import config +from api.dao import APINotFoundException +from api.jobs.gears import get_gear_by_name + +if __name__ == '__main__': + + for rule in config.db.project_rules.find({}): + alg = rule.get('alg') + + if not alg: + ...
a715d344b72d598d06d8aaba4f82687e0657bd60
python/one-offs/list-to-json.py
python/one-offs/list-to-json.py
''' One-off junk code to convert a list of programming languages with some extra information in the comments to JSON ''' from collections import OrderedDict languages = [] for line in t.split('\n'): language = OrderedDict() slashes = line.find('//') if slashes != -1: language_name, language_etc =...
Add one-off script to convert a list of programming languages to JSON
Add one-off script to convert a list of programming languages to JSON
Python
mit
bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile
--- +++ @@ -0,0 +1,59 @@ +''' One-off junk code to convert a list of programming languages with some extra information in the comments to JSON +''' + +from collections import OrderedDict + +languages = [] + +for line in t.split('\n'): + language = OrderedDict() + slashes = line.find('//') + if slashes != -1:...
6b1f487f2ceb64b6b024b9d959a8ed5a0cd4d713
tests/rules_tests/FromRuleComputeTest.py
tests/rules_tests/FromRuleComputeTest.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 23.06.2017 16:39 :Licence GNUv3 Part of grammpy """ from unittest import main, TestCase from grammpy import Rule class FromRuleComputeTest(TestCase): pass if __name__ == '__main__': main()
Add file for Rule.rule tests
Add file for Rule.rule tests
Python
mit
PatrikValkovic/grammpy
--- +++ @@ -0,0 +1,19 @@ +#!/usr/bin/env python +""" +:Author Patrik Valkovic +:Created 23.06.2017 16:39 +:Licence GNUv3 +Part of grammpy + +""" + +from unittest import main, TestCase +from grammpy import Rule + + +class FromRuleComputeTest(TestCase): + pass + + +if __name__ == '__main__': + main()
76f868137d1ee98f148032269251116887db38d5
loader.py
loader.py
from interface import Marcotti from models.config.local import LocalConfig from etl import get_local_handles, ingest_feeds from etl.csv import CSV_ETL_CLASSES if __name__ == "__main__": settings = LocalConfig() marcotti = Marcotti(settings) with marcotti.create_session() as sess: for group in ['Ov...
Create script to execute Marcotti ETL
Create script to execute Marcotti ETL
Python
mit
soccermetrics/marcotti
--- +++ @@ -0,0 +1,25 @@ +from interface import Marcotti +from models.config.local import LocalConfig +from etl import get_local_handles, ingest_feeds +from etl.csv import CSV_ETL_CLASSES + + +if __name__ == "__main__": + settings = LocalConfig() + marcotti = Marcotti(settings) + with marcotti.create_session...
bd717b8056a69ee7074a94b3234d840dd431dd1f
src/341_flatten_nested_list_iterator.py
src/341_flatten_nested_list_iterator.py
""" This is the interface that allows for creating nested lists. You should not implement it, or speculate about its implementation """ class NestedInteger(object): def isInteger(self): """ @return True if this NestedInteger holds a single integer, rather than a nested list. :rtype bool "...
Use stack to solve the problem
Use stack to solve the problem
Python
apache-2.0
zhuxiang/LeetCode-Python
--- +++ @@ -0,0 +1,64 @@ +""" +This is the interface that allows for creating nested lists. +You should not implement it, or speculate about its implementation +""" +class NestedInteger(object): + def isInteger(self): + """ + @return True if this NestedInteger holds a single integer, rather than a neste...
466b8a8fb2bdf7ca8f74316fac3e483c3ba763b5
net/data/websocket/protocol-test_wsh.py
net/data/websocket/protocol-test_wsh.py
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import cgi from mod_pywebsocket import msgutil def web_socket_do_extra_handshake(request): r = request.ws_resource.split('?', 1) if len(r) == 1: ...
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import cgi from mod_pywebsocket import msgutil def web_socket_do_extra_handshake(request): r = request.ws_resource.split('?', 1) if len(r) == 1: ...
Make Pepper WebSocket UtilityGetProtocol test less flaky by making the wsh wait for close
Make Pepper WebSocket UtilityGetProtocol test less flaky by making the wsh wait for close Attempt to fix the flakiness by making sure the server handler doesn't exit before the client closes. BUG=389084 R=jgraettinger,yhirano Review URL: https://codereview.chromium.org/410383003 git-svn-id: de016e52bd170d2d4f2344f9...
Python
bsd-3-clause
TheTypoMaster/chromium-crosswalk,dednal/chromium.src,Pluto-tv/chromium-crosswalk,M4sse/chromium.src,bright-sparks/chromium-spacewalk,ondra-novak/chromium.src,chuan9/chromium-crosswalk,Jonekee/chromium.src,axinging/chromium-crosswalk,krieger-od/nwjs_chromium.src,chuan9/chromium-crosswalk,PeterWangIntel/chromium-crosswal...
--- +++ @@ -17,3 +17,5 @@ def web_socket_transfer_data(request): msgutil.send_message(request, request.ws_protocol) + # Wait for a close message. + unused = request.ws_stream.receive_message()
de802c22865e4369cb938be7d7931b7e53374059
scripts/fix_nodes_with_no_creator.py
scripts/fix_nodes_with_no_creator.py
import logging import sys from django.db import transaction from website.app import setup_django setup_django() from osf.models import AbstractNode from scripts import utils as script_utils logger = logging.getLogger(__name__) def main(): dry = '--dry' in sys.argv if not dry: # If we're not running ...
Add one-off script to fix nodes with no creator
Add one-off script to fix nodes with no creator OSF-8571
Python
apache-2.0
brianjgeiger/osf.io,baylee-d/osf.io,cslzchen/osf.io,Johnetordoff/osf.io,icereval/osf.io,chennan47/osf.io,aaxelb/osf.io,HalcyonChimera/osf.io,pattisdr/osf.io,leb2dg/osf.io,laurenrevere/osf.io,felliott/osf.io,aaxelb/osf.io,aaxelb/osf.io,CenterForOpenScience/osf.io,adlius/osf.io,baylee-d/osf.io,leb2dg/osf.io,binoculars/os...
--- +++ @@ -0,0 +1,29 @@ +import logging +import sys + +from django.db import transaction + +from website.app import setup_django +setup_django() +from osf.models import AbstractNode +from scripts import utils as script_utils + +logger = logging.getLogger(__name__) + +def main(): + dry = '--dry' in sys.argv + i...
cd2c0f6111221990c3838a64961d24208c310a1d
snippets/python/matplotlib-colors.py
snippets/python/matplotlib-colors.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import matplotlib def create_color_list(): color_names = matplotlib.colors.cnames color_list = [] for key,val...
Add printing of color codes in matplotlib
Add printing of color codes in matplotlib
Python
apache-2.0
nathanielng/code-templates,nathanielng/code-templates,nathanielng/code-templates
--- +++ @@ -0,0 +1,49 @@ +#!/usr/bin/env python +# -*- coding: UTF-8 -*- + +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import matplotlib + +def create_color_list(): + color_names = matplotlib.colors.cnam...
23336c48a1dafcea47dab68b8915add1c7ff9f4f
src/sentry/api/serializers/rest_framework/origin.py
src/sentry/api/serializers/rest_framework/origin.py
from __future__ import absolute_import from rest_framework import serializers from sentry.utils.http import parse_uri_match class OriginField(serializers.CharField): # Special case origins that don't fit the normal regex pattern, but are valid WHITELIST_ORIGINS = ('*') def from_native(self, data): ...
from __future__ import absolute_import from rest_framework import serializers from sentry.utils.http import parse_uri_match class OriginField(serializers.CharField): # Special case origins that don't fit the normal regex pattern, but are valid WHITELIST_ORIGINS = ('*') def from_native(self, data): ...
Fix formatting of API error message
fix(api): Fix formatting of API error message
Python
bsd-3-clause
mvaled/sentry,gencer/sentry,gencer/sentry,ifduyue/sentry,ifduyue/sentry,ifduyue/sentry,mvaled/sentry,looker/sentry,beeftornado/sentry,looker/sentry,looker/sentry,beeftornado/sentry,mvaled/sentry,mvaled/sentry,beeftornado/sentry,gencer/sentry,ifduyue/sentry,looker/sentry,mvaled/sentry,mvaled/sentry,gencer/sentry,gencer/...
--- +++ @@ -14,7 +14,7 @@ if not rv: return if not self.is_valid_origin(rv): - raise serializers.ValidationError('%r is not an acceptable domain' % rv) + raise serializers.ValidationError('%s is not an acceptable domain' % rv) return rv def is_valid...
2a0544bf399dbfbdb8e6d4ef4faf91e19a3c0a15
numba/cuda/tests/cudapy/test_warning.py
numba/cuda/tests/cudapy/test_warning.py
import numpy as np from numba import cuda from numba.cuda.testing import CUDATestCase, skip_on_cudasim from numba.tests.support import override_config from numba.core.errors import NumbaPerformanceWarning import warnings def numba_dist_cuda(a, b, dist): len = a.shape[0] for i in range(len): dist[i] = ...
Add new file to test kernel efficiency warnings
Add new file to test kernel efficiency warnings
Python
bsd-2-clause
cpcloud/numba,seibert/numba,seibert/numba,cpcloud/numba,cpcloud/numba,numba/numba,stuartarchibald/numba,seibert/numba,stuartarchibald/numba,cpcloud/numba,seibert/numba,IntelLabs/numba,IntelLabs/numba,seibert/numba,stonebig/numba,cpcloud/numba,stuartarchibald/numba,stonebig/numba,stuartarchibald/numba,stonebig/numba,num...
--- +++ @@ -0,0 +1,54 @@ +import numpy as np +from numba import cuda +from numba.cuda.testing import CUDATestCase, skip_on_cudasim +from numba.tests.support import override_config +from numba.core.errors import NumbaPerformanceWarning +import warnings + + +def numba_dist_cuda(a, b, dist): + len = a.shape[0] + f...
512ab87b1786f8c3d003a62337eee75beff9d960
scripts/postag2file.py
scripts/postag2file.py
# Copyright 2018 Tomas Machalek <tomas.machalek@gmail.com> # Copyright 2018 Charles University, Faculty of Arts, # Institute of the Czech National Corpus # # 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...
Add a helper script to dump tags to a file
Add a helper script to dump tags to a file
Python
apache-2.0
czcorpus/vert-tagextract,czcorpus/vert-tagextract
--- +++ @@ -0,0 +1,25 @@ +# Copyright 2018 Tomas Machalek <tomas.machalek@gmail.com> +# Copyright 2018 Charles University, Faculty of Arts, +# Institute of the Czech National Corpus +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance w...
0721d6129da01c693d8a28c12d66e6b55d37f964
scripts/extract_pivots_from_model.py
scripts/extract_pivots_from_model.py
#!/usr/bin/env python import sys import numpy as np import torch from learn_pivots_tm import PivotLearnerModel, StraightThroughLayer def main(args): if len(args) < 1: sys.stderr.write("Required arguments: <model file> [num pivots (100)]\n") sys.exit(-1) num_pivots = 100 if len(args) > 1:...
Add code for extracting best pivot features from saved neural model.
Add code for extracting best pivot features from saved neural model.
Python
apache-2.0
tmills/uda,tmills/uda
--- +++ @@ -0,0 +1,28 @@ +#!/usr/bin/env python + +import sys + +import numpy as np +import torch +from learn_pivots_tm import PivotLearnerModel, StraightThroughLayer + +def main(args): + if len(args) < 1: + sys.stderr.write("Required arguments: <model file> [num pivots (100)]\n") + sys.exit(-1) + + ...
4b25a7d34ea17c86c4b40a09f85898ea4769b22b
airflow/contrib/operators/file_to_gcs.py
airflow/contrib/operators/file_to_gcs.py
# -*- coding: utf-8 -*- # # 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 ...
Add file to GCS operator
[AIRFLOW-125] Add file to GCS operator Adds an operator to upload a file to Google Cloud Storage. Used as follows: ```py from airflow.contrib.operators.file_to_gcs import FileToGoogleCloudStorageOperator gcs = FileToGoogleCloudStorageOperator( bucket='a-bucket-i-have-access-to-on-gcs', dag=dag, ...
Python
apache-2.0
dmitry-r/incubator-airflow,r39132/airflow,ledsusop/airflow,spektom/incubator-airflow,yk5/incubator-airflow,wndhydrnt/airflow,dmitry-r/incubator-airflow,subodhchhabra/airflow,juvoinc/airflow,zodiac/incubator-airflow,lyft/incubator-airflow,sdiazb/airflow,zoyahav/incubator-airflow,DEVELByte/incubator-airflow,adrpar/incuba...
--- +++ @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +# +# 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 la...
655f2ac31df0055c06005311820848cceaea4122
nonclass.py
nonclass.py
from os import system from time import sleep from msvcrt import getch from threading import Thread system('mode 50,30') game_running = True direction = 1 delay = 0.07 def clear(): system('cls') def controller(): global game_running,direction,delay while game_running: key = ord(getch()) if key...
Test file added to estimate performance of program between systems.
Test file added to estimate performance of program between systems.
Python
mit
thebongy/Snake
--- +++ @@ -0,0 +1,74 @@ +from os import system +from time import sleep +from msvcrt import getch +from threading import Thread + +system('mode 50,30') +game_running = True +direction = 1 +delay = 0.07 + +def clear(): + system('cls') + +def controller(): + global game_running,direction,delay + while game_running: + ...
a8a85a4bf0185a43b492ab8e81b558128db392aa
scripts/slice_trace.py
scripts/slice_trace.py
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import argparse import codecs import collections import json import math import os def parse_args(): description = """Slice JSON .trace file into smaller pieces."""...
Add a script to slice traces bigger than 256MB
Add a script to slice traces bigger than 256MB Summary: The chrome://tracing viewer doesn't support files larger than 256MB, to make it possible to look at traces from larger builds we add this simple script that splits a bigger trace into smaller chunks. Test Plan: manual Reviewed By: k21 fbshipit-source-id: 8c35a...
Python
apache-2.0
k21/buck,robbertvanginkel/buck,rmaz/buck,vschs007/buck,sdwilsh/buck,sdwilsh/buck,clonetwin26/buck,justinmuller/buck,justinmuller/buck,raviagarwal7/buck,SeleniumHQ/buck,robbertvanginkel/buck,k21/buck,k21/buck,SeleniumHQ/buck,kageiit/buck,darkforestzero/buck,robbertvanginkel/buck,SeleniumHQ/buck,LegNeato/buck,rmaz/buck,v...
--- +++ @@ -0,0 +1,74 @@ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import argparse +import codecs +import collections +import json +import math +import os + + +def parse_args(): + description = """Slic...
2268cc13d4af71f1fbff4af26631013664fc1d93
pycroft/_compat.py
pycroft/_compat.py
# Copyright (c) 2015 The Pycroft Authors. See the AUTHORS file. # This file is part of the Pycroft project and licensed under the terms of # the Apache License, Version 2.0. See the LICENSE file for details. import sys import operator PY2 = sys.version_info[0] == 2 if PY2: chr = unichr text_type = unicode ...
Add a Python 3 compatibility helper
Add a Python 3 compatibility helper
Python
apache-2.0
agdsn/pycroft,lukasjuhrich/pycroft,agdsn/pycroft,lukasjuhrich/pycroft,lukasjuhrich/pycroft,agdsn/pycroft,lukasjuhrich/pycroft,agdsn/pycroft,agdsn/pycroft
--- +++ @@ -0,0 +1,53 @@ +# Copyright (c) 2015 The Pycroft Authors. See the AUTHORS file. +# This file is part of the Pycroft project and licensed under the terms of +# the Apache License, Version 2.0. See the LICENSE file for details. +import sys +import operator + + +PY2 = sys.version_info[0] == 2 + +if PY2: + c...
8921f9a5d991cd6962d3d16f6e72d53d06a1e86f
rgbLed.py
rgbLed.py
''' Dr Who Box: RGB Effects LED ''' from __future__ import print_function import RPi.GPIO as GPIO import time from multiprocessing import Process import math # Define PINS RED = 23 GREEN = 24 BLUE = 26 # Use numbering based on P1 header GPIO.setmode(GPIO.BOARD) GPIO.setup(RED, GPIO.OUT, GPIO.HIGH) GPIO.setup(GREEN...
Add an RGB LED for initial experimentation.
Add an RGB LED for initial experimentation.
Python
mit
davidb24v/drwho
--- +++ @@ -0,0 +1,72 @@ +''' + +Dr Who Box: RGB Effects LED + +''' + +from __future__ import print_function +import RPi.GPIO as GPIO +import time +from multiprocessing import Process +import math + +# Define PINS +RED = 23 +GREEN = 24 +BLUE = 26 + +# Use numbering based on P1 header +GPIO.setmode(GPIO.BOARD) +GPIO.s...
fe7e3ca713fa1351facd9821a29cae7838458baf
Python/handle_excel.py
Python/handle_excel.py
""" 使用场景: 有三个巨大的 Excel 文件(合计约一百三十万行)存放在 src_new 下面, 这个脚本能读取这三个 Excel 文件,将所有数据按第 5 列的值分别存放到 dst_new 里的不同的文件里去, dst 文件以数据第 5 列值命名 template_new.xlsx 是一个模板文件,只含表头 Python 3 """ import openpyxl import os import shutil base_path = '/Users/mazhuang/Downloads/excels/' src_path = base_path + 'src_new/' dst_path = base_path ...
Add handle excel script in python
Add handle excel script in python
Python
mit
mzlogin/snippets,mzlogin/snippets,mzlogin/snippets,mzlogin/snippets,mzlogin/snippets,mzlogin/snippets,mzlogin/snippets,mzlogin/snippets
--- +++ @@ -0,0 +1,86 @@ +""" +使用场景: +有三个巨大的 Excel 文件(合计约一百三十万行)存放在 src_new 下面, +这个脚本能读取这三个 Excel 文件,将所有数据按第 5 列的值分别存放到 dst_new 里的不同的文件里去, +dst 文件以数据第 5 列值命名 +template_new.xlsx 是一个模板文件,只含表头 + +Python 3 +""" + +import openpyxl +import os +import shutil + +base_path = '/Users/mazhuang/Downloads/excels/' + +src_path = b...
70fa99f52436ac860de01eab311215ed1a7e24c4
app.py
app.py
import os from flask import Flask, abort, send_file app = Flask(__name__) @app.route("/<path:filename>/") def get_image(filename): if not os.path.isfile(filename): abort(404) return send_file(filename) if __name__ == "__main__": app.run()
Add functionality: photo or 404
Add functionality: photo or 404
Python
mit
DictGet/ecce-homo,DictGet/ecce-homo
--- +++ @@ -0,0 +1,16 @@ +import os + +from flask import Flask, abort, send_file + +app = Flask(__name__) + + +@app.route("/<path:filename>/") +def get_image(filename): + if not os.path.isfile(filename): + abort(404) + return send_file(filename) + + +if __name__ == "__main__": + app.run()
45b3a5924047a841bb01ed079104533c8cc5c0ce
run.py
run.py
#!/usr/bin/env python3 from tas import make_schedule from tabulate import tabulate import os import csv if __name__ == '__main__': table = make_schedule() tabular = tabulate(list(table), tablefmt="plain") print(tabular)
Add a module that can be called from other scripts
Add a module that can be called from other scripts * Let's assume using the program's output as another program's input (e.g. Conky).
Python
mit
azbshiri/tas
--- +++ @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +from tas import make_schedule +from tabulate import tabulate +import os +import csv + + +if __name__ == '__main__': + table = make_schedule() + tabular = tabulate(list(table), tablefmt="plain") + print(tabular) +
f6b22c3c7ff33d074b18cb7344263db65bb0f40f
codingame/medium/stock_exchange_losses.py
codingame/medium/stock_exchange_losses.py
def maxLoss(lst): up = lst[0] down = lst[0] mini = down - up for i, val in enumerate(lst[:-1]): # We are decreasing if (lst[i+1] < val): if val > up: up = val down = val if lst[i+1] < down: down = lst[i+1] if (down - up) < mini: mini = down - up return mini # Number of values n = int(r...
Add exercise Stock Exchange Losses
Add exercise Stock Exchange Losses
Python
mit
AntoineAugusti/katas,AntoineAugusti/katas,AntoineAugusti/katas
--- +++ @@ -0,0 +1,23 @@ +def maxLoss(lst): + up = lst[0] + down = lst[0] + mini = down - up + + for i, val in enumerate(lst[:-1]): + # We are decreasing + if (lst[i+1] < val): + if val > up: + up = val + down = val + if lst[i+1] < down: + down = lst[i+1] + if (down - up) < mini: + mini = down - up +...
cd4879f4793924563bc27f251bd6a7af15c8ba3a
tests/test_msgbox.py
tests/test_msgbox.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ Test code for controlling QMessageBox format. """ import sys from PyQt5.QtGui import QPixmap from PyQt5.QtWidgets import (QApplication, QLabel, QWidget, QMessageBox, QSpinBox, QLineEdit, QPushButton, QHBoxLayout, ...
Test program for QMessageBox formatting
Test program for QMessageBox formatting
Python
mit
rzzzwilson/morse_trainer,rzzzwilson/morse_trainer
--- +++ @@ -0,0 +1,77 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- + +""" +Test code for controlling QMessageBox format. +""" + +import sys +from PyQt5.QtGui import QPixmap +from PyQt5.QtWidgets import (QApplication, QLabel, QWidget, QMessageBox, + QSpinBox, QLineEdit, QPushButton, + ...
0c9dfa7f71cee8fe41aa6cdeb234a4c8ab89ea07
convert_ffos_sms_data_to_commhistory-tool_json.py
convert_ffos_sms_data_to_commhistory-tool_json.py
#!/usr/bin/python from json import loads from time import strftime, gmtime from datetime import datetime, time json_file = open('sms.txt') commtool = open('import.json', 'w') isfirst = True commtool.write('[\n') def escape(s): s = repr(s) s = s.replace('\\', '\\\\') s = s.replace("\\\\x", "\\x") s = s.replace('...
Add Python version of commhistory-tool converter
Add Python version of commhistory-tool converter Doesn't really work due to non-ASCII character handling, but adding nevertheless for the sake of preservation...
Python
mpl-2.0
laenion/Firefox-OS-Data-Exporter
--- +++ @@ -0,0 +1,55 @@ +#!/usr/bin/python + +from json import loads +from time import strftime, gmtime +from datetime import datetime, time + +json_file = open('sms.txt') +commtool = open('import.json', 'w') +isfirst = True + +commtool.write('[\n') + +def escape(s): + s = repr(s) + s = s.replace('\\', '\\\\') + s =...
b0bedcbd293d21e5a08ecd1acbc11b3fe8c5b7e9
osf/migrations/0002_add_lower_index_to_tags.py
osf/migrations/0002_add_lower_index_to_tags.py
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2017-03-30 14:55 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('osf', '0001_initial'), ] operations = [ migrations.RunSQL( [ ...
Add lower index to tags
Add lower index to tags
Python
apache-2.0
TomBaxter/osf.io,brianjgeiger/osf.io,adlius/osf.io,mfraezz/osf.io,HalcyonChimera/osf.io,sloria/osf.io,adlius/osf.io,baylee-d/osf.io,cwisecarver/osf.io,CenterForOpenScience/osf.io,chennan47/osf.io,caneruguz/osf.io,crcresearch/osf.io,chrisseto/osf.io,CenterForOpenScience/osf.io,chrisseto/osf.io,brianjgeiger/osf.io,icerev...
--- +++ @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2017-03-30 14:55 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('osf', '0001_initial'), + ] + + operations = [ + migr...
9f58e46b18775bfa0f4bf23bf6b25a1e2488c6ae
scripts/migrate.py
scripts/migrate.py
"""Script for migrating ipythonblocks grid data from SQLite to Postgres""" import json import os from pathlib import Path import sqlalchemy as sa from sqlalchemy.orm import sessionmaker # The module in the ipythonblocks.org application code that contains # table definitions from app import models # SQLite DB related...
Revert "removing migration script now that it's done"
Revert "removing migration script now that it's done" This reverts commit dd32cbb400fb667d05b215a60fe3682da2c1cf2b.
Python
mit
jiffyclub/ipythonblocks.org,jiffyclub/ipythonblocks.org
--- +++ @@ -0,0 +1,72 @@ +"""Script for migrating ipythonblocks grid data from SQLite to Postgres""" +import json +import os +from pathlib import Path + +import sqlalchemy as sa +from sqlalchemy.orm import sessionmaker + +# The module in the ipythonblocks.org application code that contains +# table definitions +from ...
ea8b0193845d794b9612b0e78dffa772c15fbca3
tests/test_utils.py
tests/test_utils.py
from datetime import datetime from flexget.utils import json class TestJson(object): def test_dt_encode(self): date_str = '2016-03-11T17:12:17Z' dt = datetime.strptime(date_str, '%Y-%m-%dT%H:%M:%SZ') encoded_dt = json.dumps(dt, encode_datetime=True) assert encoded_dt == '"%s"' % d...
Add test for flexget utils (json)
Add test for flexget utils (json)
Python
mit
JorisDeRieck/Flexget,antivirtel/Flexget,poulpito/Flexget,antivirtel/Flexget,tobinjt/Flexget,crawln45/Flexget,oxc/Flexget,drwyrm/Flexget,Pretagonist/Flexget,jawilson/Flexget,Danfocus/Flexget,sean797/Flexget,LynxyssCZ/Flexget,tarzasai/Flexget,tarzasai/Flexget,dsemi/Flexget,ianstalk/Flexget,OmgOhnoes/Flexget,LynxyssCZ/Fle...
--- +++ @@ -0,0 +1,17 @@ +from datetime import datetime +from flexget.utils import json + + +class TestJson(object): + + def test_dt_encode(self): + date_str = '2016-03-11T17:12:17Z' + dt = datetime.strptime(date_str, '%Y-%m-%dT%H:%M:%SZ') + encoded_dt = json.dumps(dt, encode_datetime=True) + ...
ae19d2e0bf1c7f808cd102a78bde25548bcb88b8
warehouse/cli.py
warehouse/cli.py
# Copyright 2013 Donald Stufft # # 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, so...
# Copyright 2013 Donald Stufft # # 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, so...
Add a command to run the built in werkzeug server
Add a command to run the built in werkzeug server
Python
apache-2.0
robhudson/warehouse,mattrobenolt/warehouse,techtonik/warehouse,robhudson/warehouse,mattrobenolt/warehouse,mattrobenolt/warehouse,techtonik/warehouse
--- +++ @@ -14,9 +14,44 @@ from __future__ import absolute_import, division, print_function from __future__ import unicode_literals +import werkzeug.serving + import warehouse.migrations.cli + + +class ServeCommand(object): + + def __call__(self, app, host, port, reloader, debugger): + werkzeug.serving...
73c676d3ab2c4c668209dc04537561c7a2e3cd49
ideascale/migrations/0011_author_sync.py
ideascale/migrations/0011_author_sync.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('ideascale', '0010_auto_20150513_1146'), ] operations = [ migrations.AddField( model_name='author', n...
Add sync field to Author model
Add sync field to Author model
Python
mit
rebearteta/social-ideation,joausaga/social-ideation,rebearteta/social-ideation,rebearteta/social-ideation,rebearteta/social-ideation,joausaga/social-ideation,joausaga/social-ideation,joausaga/social-ideation
--- +++ @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('ideascale', '0010_auto_20150513_1146'), + ] + + operations = [ + migrations.AddField( + ...
c7fe8e2a186d094d49c7c9218ba63bd8a7cdd024
ProjectEuler/prob15.py
ProjectEuler/prob15.py
# projecteuler.net/problem=15 def main(): answer = LatticePaths(20) print(answer) def LatticePaths(x): x += 1 # each item represent not cell but line (for close lattice n+1) arr = [[0 for i in range(0, x)] for i in range(0, x)] arr[0][0] = 1 for i in range(0, x): arr[0][i] = 1 ...
Update script for problem 15 on pe
Update script for problem 15 on pe
Python
apache-2.0
yuriyshapovalov/Prototypes,yuriyshapovalov/Prototypes,yuriyshapovalov/Prototypes
--- +++ @@ -0,0 +1,34 @@ +# projecteuler.net/problem=15 + +def main(): + answer = LatticePaths(20) + print(answer) + +def LatticePaths(x): + x += 1 # each item represent not cell but line (for close lattice n+1) + arr = [[0 for i in range(0, x)] for i in range(0, x)] + arr[0][0] = 1 + + for i in ran...
b588d426ec500db82995fa830298757f7a1afd52
scripts/test_uvfits_equal.py
scripts/test_uvfits_equal.py
#! /usr/bin/env python import argparse import os.path as op from uvdata.uv import UVData parser = argparse.ArgumentParser() parser.add_argument('uvfits1', help='name of first uvfits file.') parser.add_argument('uvfits2', help='name of second uvfits file to compare to first.') ...
Add little script to test 2 uvfits files for equality
Add little script to test 2 uvfits files for equality
Python
bsd-2-clause
HERA-Team/pyuvdata,HERA-Team/pyuvdata,HERA-Team/pyuvdata,HERA-Team/pyuvdata
--- +++ @@ -0,0 +1,34 @@ +#! /usr/bin/env python + +import argparse +import os.path as op +from uvdata.uv import UVData + +parser = argparse.ArgumentParser() +parser.add_argument('uvfits1', + help='name of first uvfits file.') +parser.add_argument('uvfits2', + help='name of secon...
3fcaa8d45c91b8aa03f7bdbdd94beace328a765c
tests/test_convert.py
tests/test_convert.py
import pytest # type: ignore from ppb_vector import Vector2 from utils import * @pytest.mark.parametrize('vector_like', UNIT_VECTOR_LIKES) # type: ignore def test_convert_subclass(vector_like): class V(Vector2): pass # test_binop_vectorlike already checks the output value is correct assert isinstance(V....
Add a test for Vector2.convert
Add a test for Vector2.convert See https://github.com/ppb/ppb-vector/pull/91#discussion_r241956449
Python
artistic-2.0
ppb/ppb-vector,ppb/ppb-vector
--- +++ @@ -0,0 +1,11 @@ +import pytest # type: ignore + +from ppb_vector import Vector2 +from utils import * + +@pytest.mark.parametrize('vector_like', UNIT_VECTOR_LIKES) # type: ignore +def test_convert_subclass(vector_like): + class V(Vector2): pass + + # test_binop_vectorlike already checks the output valu...
6b25614cbdec4595cedd772ca5d405cfafec741d
ipynb.py
ipynb.py
"""ipynb.py -- helper functions for working with the IPython Notebook This software is licensed under the terms of the MIT License as follows: Copyright (c) 2013 Jessica B. Hamrick Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "S...
Add file for ipython notebook snippets
Add file for ipython notebook snippets
Python
mit
jhamrick/python-snippets
--- +++ @@ -0,0 +1,48 @@ +"""ipynb.py -- helper functions for working with the IPython Notebook + +This software is licensed under the terms of the MIT License as +follows: + +Copyright (c) 2013 Jessica B. Hamrick + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and as...
dd9e80cb13d41a6faf0fb1340ea7edc949f0fab7
dash/orgs/migrations/0012_auto_20150715_1816.py
dash/orgs/migrations/0012_auto_20150715_1816.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('orgs', '0011_auto_20150710_1612'), ] operations = [ migrations.AlterField( model_name='invitation', ...
Add missing migration for Invitation.email
Add missing migration for Invitation.email
Python
bsd-3-clause
rapidpro/dash,peterayeni/dash,rapidpro/dash,caktus/dash,caktus/dash,peterayeni/dash
--- +++ @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('orgs', '0011_auto_20150710_1612'), + ] + + operations = [ + migrations.AlterField( + ...
4a67508786b9c28e930a4d6ce49001f6bb9be39d
dash/orgs/migrations/0025_auto_20180321_1520.py
dash/orgs/migrations/0025_auto_20180321_1520.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.11 on 2018-03-21 15:20 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('orgs', '0024_populate_org_backend'), ] operations = [ migrations.AlterUniqueTogeth...
Add constraints for unique together for org and slug in org backend, migrations
Add constraints for unique together for org and slug in org backend, migrations
Python
bsd-3-clause
rapidpro/dash,rapidpro/dash
--- +++ @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.11 on 2018-03-21 15:20 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('orgs', '0024_populate_org_backend'), + ] + + operations...
28841d9a7077293b0befab23fb3d1183006edc89
lcapy/nettransform.py
lcapy/nettransform.py
"""This module performs network transformations. Copyright 2020 Michael Hayes, UCECE """ def Z_wye_to_delta(Z1, Z2, Z3): """Perform wye to delta transformation of three impedances. This is equivalent to a tee-pi transform or a star-mesh transform.""" N = Z1 * Z2 + Z1 * Z3 + Z2 * Z3 Za = N / Z...
Add wye-delta and delta-wye transformations
Add wye-delta and delta-wye transformations
Python
lgpl-2.1
mph-/lcapy
--- +++ @@ -0,0 +1,65 @@ +"""This module performs network transformations. + +Copyright 2020 Michael Hayes, UCECE + +""" + + +def Z_wye_to_delta(Z1, Z2, Z3): + """Perform wye to delta transformation of three impedances. + + This is equivalent to a tee-pi transform or a star-mesh transform.""" + + N = Z1 * Z2...
0ef0f3528dfd21ff608ea5e59980856e7f673817
longclaw/longclawshipping/fields.py
longclaw/longclawshipping/fields.py
from longclaw.longclawsettings.models import LongclawSettings from longclaw.longclawshipping.models import ShippingRate from django_countries import countries, fields class CountryChoices(object): ''' Helper class which returns a list of available countries based on the selected shipping options. If d...
Add a country field for available shipping countries
Add a country field for available shipping countries
Python
mit
JamesRamm/longclaw,JamesRamm/longclaw,JamesRamm/longclaw,JamesRamm/longclaw
--- +++ @@ -0,0 +1,38 @@ +from longclaw.longclawsettings.models import LongclawSettings +from longclaw.longclawshipping.models import ShippingRate +from django_countries import countries, fields + +class CountryChoices(object): + ''' + Helper class which returns a list of available countries based on + the s...
02e907a97eb1cb79b5c427e6153caf8ca0009058
tests/builder_tests.py
tests/builder_tests.py
import contextlib import json import os from nose.tools import istest, assert_equal from whack.tempdir import create_temporary_dir from whack.files import sh_script_description, plain_file, read_file from whack.sources import PackageSource from whack.builder import build @istest def build_uses_params_as_environ...
Add basic test for build
Add basic test for build
Python
bsd-2-clause
mwilliamson/whack
--- +++ @@ -0,0 +1,29 @@ +import contextlib +import json +import os + +from nose.tools import istest, assert_equal + +from whack.tempdir import create_temporary_dir +from whack.files import sh_script_description, plain_file, read_file +from whack.sources import PackageSource +from whack.builder import build + + +...
b6f2325c153b499c3b79fdb813d80e5423e4919d
flexget/plugins/services/torrent_cache.py
flexget/plugins/services/torrent_cache.py
import logging import re from flexget.plugin import register_plugin, priority log = logging.getLogger('torrent_cache') MIRRORS = ['http://torrage.com/torrent/', 'http://torcache.net/torrent/', 'http://zoink.it/torrent/', 'http://torrage.ws/torrent/'] class TorrentCache(object): ...
import logging import re import random from flexget.plugin import register_plugin, priority log = logging.getLogger('torrent_cache') MIRRORS = ['http://torrage.com/torrent/', # Now using a landing page instead of going directly to the torrent # TODO: May be fixable by setting the referer ...
Disable torcache for now. Randomize order torrent cache mirrors are added to urls list.
Disable torcache for now. Randomize order torrent cache mirrors are added to urls list. git-svn-id: ad91b9aa7ba7638d69f912c9f5d012e3326e9f74@2874 3942dd89-8c5d-46d7-aeed-044bccf3e60c
Python
mit
tobinjt/Flexget,tarzasai/Flexget,jacobmetrick/Flexget,offbyone/Flexget,Flexget/Flexget,tvcsantos/Flexget,qk4l/Flexget,jawilson/Flexget,sean797/Flexget,oxc/Flexget,oxc/Flexget,asm0dey/Flexget,Flexget/Flexget,thalamus/Flexget,Danfocus/Flexget,crawln45/Flexget,v17al/Flexget,JorisDeRieck/Flexget,dsemi/Flexget,vfrc2/Flexget...
--- +++ @@ -1,11 +1,14 @@ import logging import re +import random from flexget.plugin import register_plugin, priority log = logging.getLogger('torrent_cache') MIRRORS = ['http://torrage.com/torrent/', - 'http://torcache.net/torrent/', + # Now using a landing page instead of going directl...
2a8f064733892b86c2041f3294d5efebd4b565d9
txircd/modules/extra/channelopaccess.py
txircd/modules/extra/channelopaccess.py
from twisted.plugin import IPlugin from txircd.module_interface import IMode, IModuleData, Mode, ModuleData from txircd.utils import ModeType from zope.interface import implements class ChannelOpAccess(ModuleData, Mode): implements(IPlugin, IModuleData, IMode) name = "ChannelOpAccess" affectedActions = { "check...
Allow channel ops to change the required level for specific permissions
Allow channel ops to change the required level for specific permissions
Python
bsd-3-clause
Heufneutje/txircd,ElementalAlchemist/txircd
--- +++ @@ -0,0 +1,48 @@ +from twisted.plugin import IPlugin +from txircd.module_interface import IMode, IModuleData, Mode, ModuleData +from txircd.utils import ModeType +from zope.interface import implements + +class ChannelOpAccess(ModuleData, Mode): + implements(IPlugin, IModuleData, IMode) + + name = "ChannelOpA...
a00822aeb17eabde80adf16c30498472d5775159
nclxd/tests/test_container_image.py
nclxd/tests/test_container_image.py
# Copyright 2015 Canonical Ltd # 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 by...
Add tests for existing image
Add tests for existing image
Python
apache-2.0
tpouyer/nova-lxd,Saviq/nova-compute-lxd,tpouyer/nova-lxd,Saviq/nova-compute-lxd
--- +++ @@ -0,0 +1,67 @@ +# Copyright 2015 Canonical Ltd +# 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/LI...
e2c52c768420357b43394df622a32629155c927e
tests/unit/test_cli.py
tests/unit/test_cli.py
from hamcrest import assert_that, is_ import pytest from pyhttp.cli import parse_args def describe_parse_args(): def it_returns_parsed_arguments(): args = parse_args(['-c', '100', 'http://example.com']) assert_that(args.concurrency, is_(100)) assert_that(args.url, is_('http://example.com...
Add cli arguments parser tests
Add cli arguments parser tests
Python
mit
tesonet/pyhttp
--- +++ @@ -0,0 +1,12 @@ +from hamcrest import assert_that, is_ +import pytest + +from pyhttp.cli import parse_args + + +def describe_parse_args(): + def it_returns_parsed_arguments(): + args = parse_args(['-c', '100', 'http://example.com']) + + assert_that(args.concurrency, is_(100)) + assert...
c699a331ed8976069731f6bc7f61871123810865
wafer/talks/migrations/0002_auto_20150813_2327.py
wafer/talks/migrations/0002_auto_20150813_2327.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('talks', '0001_initial'), ] operations = [ migrations.AlterModelOptions( name='talk', options={'permi...
Add migration for view_all_talks permission.
Add migration for view_all_talks permission.
Python
isc
CTPUG/wafer,CTPUG/wafer,CTPUG/wafer,CarlFK/wafer,CarlFK/wafer,CarlFK/wafer,CarlFK/wafer,CTPUG/wafer
--- +++ @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('talks', '0001_initial'), + ] + + operations = [ + migrations.AlterModelOptions( + ...
9386120ee2d5e27374a53c10ca45bf7b6f0d2e6e
tests/test_listener.py
tests/test_listener.py
#!/usr/bin/env python import pytest import pg_bawler.core @pytest.mark.asyncio async def test_simple_listen(): class NotificationListener( pg_bawler.core.BawlerBase, pg_bawler.core.ListenerMixin ): pass class NotificationSender( pg_bawler.core.BawlerBase, pg_bawl...
Add initial test for listener module
Add initial test for listener module
Python
bsd-3-clause
beezz/pg_bawler,beezz/pg_bawler
--- +++ @@ -0,0 +1,38 @@ +#!/usr/bin/env python +import pytest + +import pg_bawler.core + + +@pytest.mark.asyncio +async def test_simple_listen(): + + class NotificationListener( + pg_bawler.core.BawlerBase, + pg_bawler.core.ListenerMixin + ): + pass + + class NotificationSender( + ...
ad1121b941a694b7cb6a65e7e6bf4839147f7551
utils/verify_alerts.py
utils/verify_alerts.py
#!/usr/bin/env python import os import sys from os.path import dirname, join, realpath from optparse import OptionParser # Get the current working directory of this file. # http://stackoverflow.com/a/4060259/120999 __location__ = realpath(join(os.getcwd(), dirname(__file__))) # Add the shared settings file to namesp...
Add script to test/verify alert configuration
Add script to test/verify alert configuration We're looking to build out another alerter or two, and wanted a way to test our current alert configurations as well as be able to trigger alerts as we developer new alerters.
Python
mit
aelialper/skyline,hcxiong/skyline,loggly/skyline,triplekill/skyline,PaytmLabs/skyline,100star/skyline,CDKGlobal/skyline,hcxiong/skyline,loggly/skyline,sdgdsffdsfff/skyline,klynch/skyline,aelialper/skyline,triplekill/skyline,100star/skyline,sdgdsffdsfff/skyline,hcxiong/skyline,loggly/skyline,sdgdsffdsfff/skyline,PaytmLa...
--- +++ @@ -0,0 +1,49 @@ +#!/usr/bin/env python + +import os +import sys +from os.path import dirname, join, realpath +from optparse import OptionParser + +# Get the current working directory of this file. +# http://stackoverflow.com/a/4060259/120999 +__location__ = realpath(join(os.getcwd(), dirname(__file__))) + +#...
d195358bc5814301e91a97f5d2ae95ede4a72bbc
scripts/feature/warnings/simple_county.py
scripts/feature/warnings/simple_county.py
import matplotlib.colors as mpcolors import matplotlib.cm as cm import psycopg2 import numpy as np from pyiem.plot import MapPlot POSTGIS = psycopg2.connect(database='postgis', host='localhost', user='nobody', port=5555) pcursor = POSTGIS.cursor() cmap = cm.get_cmap("jet") cmap.set_under("#...
Make some twitter plots of SVR,TOR freq hour
Make some twitter plots of SVR,TOR freq hour https://twitter.com/akrherz/status/703776738422050816 https://twitter.com/akrherz/status/703776599057895424
Python
mit
akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem
--- +++ @@ -0,0 +1,49 @@ +import matplotlib.colors as mpcolors +import matplotlib.cm as cm +import psycopg2 +import numpy as np + +from pyiem.plot import MapPlot +POSTGIS = psycopg2.connect(database='postgis', host='localhost', user='nobody', + port=5555) +pcursor = POSTGIS.cursor() + +cmap ...
e3f97f30291a407a54a021d7e4a1805e75c1ec41
midonet/neutron/api.py
midonet/neutron/api.py
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (C) 2014 Midokura SARL. # 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.o...
Add Tunnel Zone and Tunnel Zone Host API handlers
Add Tunnel Zone and Tunnel Zone Host API handlers This patch adds TunnelzoneHandlerMixin and TunnelzonehostHandlerMixin to the core plugin using generate_methods decorators. This patch also adds symbols for 'list', 'show', 'create', 'update' and 'delete'. It'd be too easy to have typos for them and I added symbols fo...
Python
apache-2.0
midonet/python-neutron-plugin-midonet,midonet/python-neutron-plugin-midonet,JoeMido/networking-midonet,yamt/networking-midonet,midokura/python-neutron-plugin-midonet,yamt/networking-midonet,JoeMido/networking-midonet,midokura/python-neutron-plugin-midonet
--- +++ @@ -0,0 +1,40 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 +# Copyright (C) 2014 Midokura SARL. +# 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 ...
b6bb33aae60239d882cd86640313ed9e9802a5cc
neutron/tests/unit/ml2/test_type_local.py
neutron/tests/unit/ml2/test_type_local.py
# Copyright (c) 2014 Thales Services SAS # 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 r...
Add local type driver unittests
Add local type driver unittests Partial-Bug: #1269127 Change-Id: I5b34dc09128bcb879ea46be64cc5104eeefd4ab4
Python
apache-2.0
gkotton/vmware-nsx,gkotton/vmware-nsx
--- +++ @@ -0,0 +1,56 @@ +# Copyright (c) 2014 Thales Services SAS +# 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/l...
1edb86e0c92bb186fccd9e0179b0d8b6dcc27902
pygments/styles/igor.py
pygments/styles/igor.py
from pygments.style import Style from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic class IgorStyle(Style): default_style = "" styles = { Comment: 'italic #FF0000', Keyword: '#0000FF', Name.Function: ...
Add custom style which imitates the offical coloring
Add custom style which imitates the offical coloring --HG-- branch : igor-pro-changes-v2
Python
bsd-2-clause
kirbyfan64/pygments-unofficial,kirbyfan64/pygments-unofficial,kirbyfan64/pygments-unofficial,kirbyfan64/pygments-unofficial,kirbyfan64/pygments-unofficial,kirbyfan64/pygments-unofficial,kirbyfan64/pygments-unofficial,kirbyfan64/pygments-unofficial,kirbyfan64/pygments-unofficial,kirbyfan64/pygments-unofficial,kirbyfan64...
--- +++ @@ -0,0 +1,13 @@ +from pygments.style import Style +from pygments.token import Keyword, Name, Comment, String, Error, \ + Number, Operator, Generic + +class IgorStyle(Style): + default_style = "" + styles = { + Comment: 'italic #FF0000', + Keyword: '#0000F...
a47b82f7feb18da55cf402e363508141764a180f
2014/round-1/labelmaker-v2.py
2014/round-1/labelmaker-v2.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def solve(): L, N = input().split(' ') N = int(N) result = '' while N > 0: N -= 1 result = L[N % len(L)] + result N = int(N / len(L)) return result def main(): T = int(input()) for i in range(T): print('Case #...
Add solution v2 for Labelmaker.
Add solution v2 for Labelmaker.
Python
mit
changyuheng/hacker-cup-solutions
--- +++ @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +def solve(): + L, N = input().split(' ') + N = int(N) + result = '' + + while N > 0: + N -= 1 + result = L[N % len(L)] + result + N = int(N / len(L)) + + return result + +def main(): + T = int(input()) ...
da5a3d5bf9d7a6130f05339f36798b3e5d93e7a2
scripts/prism_4km_monthly_modern.py
scripts/prism_4km_monthly_modern.py
#retriever """Retriever script for direct download of PRISM climate data""" from retriever.lib.templates import Script import urlparse class main(Script): def __init__(self, **kwargs): Script.__init__(self, **kwargs) self.name = "PRISM Climate Data" self.shortname = "PRISM" self.r...
Add script for downloading the modern PRISM climate data
Add script for downloading the modern PRISM climate data The modern PRISM data provides monthly raster precip and temperature measures for the United States from 1981 to present.
Python
mit
goelakash/retriever,davharris/retriever,goelakash/retriever,davharris/retriever,henrykironde/deletedret,embaldridge/retriever,embaldridge/retriever,embaldridge/retriever,henrykironde/deletedret,davharris/retriever
--- +++ @@ -0,0 +1,47 @@ +#retriever + +"""Retriever script for direct download of PRISM climate data""" + +from retriever.lib.templates import Script +import urlparse + +class main(Script): + def __init__(self, **kwargs): + Script.__init__(self, **kwargs) + self.name = "PRISM Climate Data" + ...
62513585437d2c86f8668eb26eebb6f8c5a1a656
Testiranje/Serijski.py
Testiranje/Serijski.py
''' Created on Nov 24, 2013 @author: gregor ''' from serial import * from threading import Thread last_received = '' def receiving(ser): while True: print ser.readline() if __name__ == '__main__': #ser = Serial(port=None, baudrate=9600, bytesize=EIGHTBITS, parity=PARITY_NONE, stopbits=STOPBITS_ONE,...
Test branja serijskega vmesnika na Ubuntu-ju. Branje z naprave Arduino UNO.
Test branja serijskega vmesnika na Ubuntu-ju. Branje z naprave Arduino UNO.
Python
mit
blazdivjak/rzpproject
--- +++ @@ -0,0 +1,20 @@ +''' +Created on Nov 24, 2013 + +@author: gregor +''' +from serial import * +from threading import Thread + +last_received = '' + +def receiving(ser): + while True: + print ser.readline() + +if __name__ == '__main__': + #ser = Serial(port=None, baudrate=9600, bytesize=EIGHTBITS,...