commit
stringlengths
40
40
old_file
stringlengths
4
236
new_file
stringlengths
4
236
old_contents
stringlengths
1
3.26k
new_contents
stringlengths
16
4.43k
subject
stringlengths
16
624
message
stringlengths
17
3.29k
lang
stringclasses
5 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
30c21806dcc347326d6ac51be2adac9ff637f241
day20/part1.py
day20/part1.py
ranges = [] for line in open('input.txt', 'r'): ranges.append(tuple(map(int, line.split('-')))) ranges.sort() lowest = 0 for l, r in ranges: if l <= lowest <= r: lowest = r + 1 print(lowest) input()
ranges = [] for line in open('input.txt', 'r'): ranges.append(tuple(map(int, line.split('-')))) ranges.sort() lowest = 0 for l, r in ranges: if l > lowest: break if lowest <= r: lowest = r + 1 print(lowest) input()
Break the loop at the first gap
Break the loop at the first gap
Python
unlicense
ultramega/adventofcode2016
4a75df6e253401cbed7b31e1882211946f02093a
src/ggrc/__init__.py
src/ggrc/__init__.py
# Copyright (C) 2016 Google Inc., authors, and contributors # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> from .bootstrap import db, logger
# Copyright (C) 2016 Google Inc., authors, and contributors # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> from ggrc.bootstrap import db __all__ = [ db ]
Remove logger from ggrc init
Remove logger from ggrc init The logger from ggrc init is never used and should be removed.
Python
apache-2.0
selahssea/ggrc-core,NejcZupec/ggrc-core,plamut/ggrc-core,plamut/ggrc-core,j0gurt/ggrc-core,NejcZupec/ggrc-core,j0gurt/ggrc-core,NejcZupec/ggrc-core,AleksNeStu/ggrc-core,VinnieJohns/ggrc-core,VinnieJohns/ggrc-core,josthkko/ggrc-core,josthkko/ggrc-core,selahssea/ggrc-core,NejcZupec/ggrc-core,kr41/ggrc-core,j0gurt/ggrc-co...
3885fcbb31393f936bc58842dc06bdc9ffe55151
fabfile.py
fabfile.py
#!/usr/bin/env python from fabric.api import env, run, sudo, task from fabric.context_managers import cd, prefix env.use_ssh_config = True home = '~/jarvis2' @task def pull_code(): with cd(home): run('git pull --rebase') @task def update_dependencies(): with prefix('workon jarvis2'): run('...
#!/usr/bin/env python from fabric.api import env, run, sudo, task from fabric.context_managers import cd, prefix from fabric.contrib.project import rsync_project env.use_ssh_config = True home = '~/jarvis2' @task def pull_code(): with cd(home): run('git pull --rebase') @task def push_code(): rsync...
Add task for pushing code with rsync
Add task for pushing code with rsync
Python
mit
Foxboron/Frank,mpolden/jarvis2,martinp/jarvis2,Foxboron/Frank,mpolden/jarvis2,mpolden/jarvis2,martinp/jarvis2,Foxboron/Frank,martinp/jarvis2
8af0f327b0f9b975f9fc05e41aff2f99bb26abce
people/serializers.py
people/serializers.py
from django.contrib.gis import serializers from rest_framework import serializers from people.models import Customer from people.models import InternalUser class CustomerSerializer(serializers.ModelSerializer): phone_number = serializers.IntegerField() def validate_phone_number(self, val): if len(st...
from django.contrib.gis import serializers from rest_framework import serializers from people.models import Customer from people.models import InternalUser class CustomerSerializer(serializers.ModelSerializer): phone_number = serializers.IntegerField() def validate_phone_number(self, val): if len(st...
Fix the phone number thing
Fix the phone number thing
Python
apache-2.0
rameshgopalakrishnan/v_excel_inventory,rameshgopalakrishnan/v_excel_inventory,rameshgopalakrishnan/v_excel_inventory
5e1daf36d604ee1898e8486458013e63010d6888
opps/api/models.py
opps/api/models.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import uuid import hmac from django.db import models from django.conf import settings from django.contrib.auth import get_user_model try: from hashlib import sha1 except ImportError: import sha sha1 = sha.sha User = get_user_model() class ApiKey(models.Mod...
#!/usr/bin/env python # -*- coding: utf-8 -*- import uuid import hmac from django.db import models from django.conf import settings from django.utils.translation import ugettext_lazy as _ from django.contrib.auth import get_user_model try: from hashlib import sha1 except ImportError: import sha sha1 = sha...
Add missing translations on API model
Add missing translations on API model
Python
mit
YACOWS/opps,YACOWS/opps,williamroot/opps,opps/opps,jeanmask/opps,williamroot/opps,williamroot/opps,YACOWS/opps,opps/opps,jeanmask/opps,opps/opps,opps/opps,jeanmask/opps,YACOWS/opps,jeanmask/opps,williamroot/opps
e5deebe61fdf5e1a186673a252743ebdabe4c0e5
publishconf.py
publishconf.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # from __future__ import unicode_literals # This file is only used if you use `make publish` or # explicitly specify it as your config file. import os import sys sys.path.append(os.curdir) from pelicanconf import * SITEURL = 'https://pappasam.github.io' RELATIVE_URLS = F...
#!/usr/bin/env python # -*- coding: utf-8 -*- # from __future__ import unicode_literals import os import sys sys.path.append(os.curdir) from pelicanconf import * SITEURL = 'https://pappasam.github.io' RELATIVE_URLS = False FEED_ALL_ATOM = 'feeds/all.atom.xml' CATEGORY_FEED_ATOM = 'feeds/%s.atom.xml' DELETE_OUTPUT_D...
Add Disqus and Google Analytics to web site
Add Disqus and Google Analytics to web site
Python
mit
pappasam/pappasam.github.io,pappasam/pappasam.github.io
decb1699fe036c55d33c7d3b77a834cf8c3ee785
RPLCD/__init__.py
RPLCD/__init__.py
from .common import Alignment, CursorMode, ShiftMode, BacklightMode from .contextmanagers import cursor, cleared
import warnings from .common import Alignment, CursorMode, ShiftMode, BacklightMode from .contextmanagers import cursor, cleared from .gpio import CharLCD as GpioCharLCD class CharLCD(GpioCharLCD): def __init__(self, *args, **kwargs): warnings.warn("Using RPLCD.CharLCD directly is deprecated. " + ...
Add backwards compatible CharLCD wrapper
Add backwards compatible CharLCD wrapper
Python
mit
GoranLundberg/RPLCD,thijstriemstra/RPLCD,dbrgn/RPLCD,paulenuta/RPLCD
d3675b777dc95f296f26bdd9b8b05311ceac6ba5
cyder/core/system/migrations/0006_rename_table_from_system_key_value_to_system_kv.py
cyder/core/system/migrations/0006_rename_table_from_system_key_value_to_system_kv.py
# -*- coding: utf-8 -*- from south.db import db from south.v2 import SchemaMigration class Migration(SchemaMigration): def forwards(self, orm): db.rename_table('system_key_value', 'system_kv') def backwards(self, orm): db.rename_table('system_kv', 'system_key_value')
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): db.rename_table('system_key_value', 'system_kv') def backwards(self, orm): db.rename_table('system_kv',...
Add ORM freeze thing to SystemKeyValue migration
Add ORM freeze thing to SystemKeyValue migration
Python
bsd-3-clause
akeym/cyder,murrown/cyder,zeeman/cyder,akeym/cyder,OSU-Net/cyder,murrown/cyder,OSU-Net/cyder,OSU-Net/cyder,zeeman/cyder,akeym/cyder,murrown/cyder,zeeman/cyder,drkitty/cyder,zeeman/cyder,drkitty/cyder,akeym/cyder,drkitty/cyder,murrown/cyder,drkitty/cyder,OSU-Net/cyder
5e2111a5ccc0bcbe7b9af4fec09b9b46eb03ebd3
GenNowPlayingMovieID.py
GenNowPlayingMovieID.py
#!/usr/bin/python #coding: utf-8 import requests import re if __name__=="__main__": page = requests.get('https://movie.douban.com/nowplaying/beijing/') content=page.text.encode("utf-8") pattern=re.compile(r'(?<=id=")\d+(?="\n)') result=pattern.findall(content) for iterm in result: print iterm
#!/usr/bin/python #coding: utf-8 import requests import re import time from time import gmtime, strftime class GenNowPlayingID(object): """docstring for ClassName""" def __init__(self): #super(ClassName, self).__init__() # self.arg = arg pass def GenNowPlayingIdList(self): page = requests.get('https://movi...
Write the nowplaying movie id to file
Write the nowplaying movie id to file
Python
apache-2.0
ModernKings/MKMovieCenter,ModernKings/MKMovieCenter,ModernKings/MKMovieCenter
442f0df33b91fced038e2c497e6c03e0f82f55b2
qtpy/QtTest.py
qtpy/QtTest.py
# -*- coding: utf-8 -*- # # Copyright © 2014-2015 Colin Duquesnoy # Copyright © 2009- The Spyder Developmet Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) """ Provides QtTest and functions .. warning:: PySide is not supported here, that's why there is not unit tests running wi...
# -*- coding: utf-8 -*- # # Copyright © 2014-2015 Colin Duquesnoy # Copyright © 2009- The Spyder Developmet Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) """ Provides QtTest and functions """ from qtpy import PYQT5, PYQT4, PYSIDE, PythonQtError if PYQT5: from PyQt5.QtTest ...
Add support for QTest with PySide
Add support for QTest with PySide
Python
mit
spyder-ide/qtpy,davvid/qtpy,goanpeca/qtpy,davvid/qtpy,goanpeca/qtpy
3b4ec8893fe40f811716a893f11858f7bbf2ec80
utils/get_message.py
utils/get_message.py
import amqp from contextlib import closing def __get_channel(connection): return connection.channel() def __declare_queue(channel, queue): channel.queue_declare(queue=queue, durable=True, auto_delete=False) def __get_message_from_queue(channel, queue): return channel.basic_get(queue=queue) def get_mess...
import amqp from contextlib import closing def __get_channel(connection): return connection.channel() def __get_message_from_queue(channel, queue): return channel.basic_get(queue=queue) def get_message(queue): """ Get the first message from a queue. The first message from a queue is retrieved. If t...
Revert "Revert "Remove queue declaration (EAFP)""
Revert "Revert "Remove queue declaration (EAFP)"" This reverts commit 2dd5a5b422d8c1598672ea9470aee655eca3c49d.
Python
mit
jdgillespie91/trackerSpend,jdgillespie91/trackerSpend
3a0cf1f6114d6c80909f90fe122b026908200b0a
IPython/nbconvert/exporters/markdown.py
IPython/nbconvert/exporters/markdown.py
"""Markdown Exporter class""" #----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. #---------------...
"""Markdown Exporter class""" #----------------------------------------------------------------------------- # Copyright (c) 2013, the IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this software. #---------------...
Revert "Removed Javascript from Markdown by adding display priority to def config."
Revert "Removed Javascript from Markdown by adding display priority to def config." This reverts commit 58e05f9625c60f8deba9ddf1c74dba73e8ea7dd1.
Python
bsd-3-clause
ipython/ipython,ipython/ipython
b922273cb4786e72dbf018b33100814e2a462ebe
examples/list_stats.py
examples/list_stats.py
import sys import os import operator sys.path.insert(1, os.path.abspath('..')) from wsinfo import Info cnt = 0 max_cnt = 100 servers = {} with open("urls.txt", "r") as f: for url in f.readlines(): url = url[:-1] try: w = Info(url) if w.server != "": if not w...
# -*- coding: utf-8 -*- import sys import os import operator sys.path.insert(1, os.path.abspath('..')) from wsinfo import Info cnt = 0 max_cnt = 100 servers = {} with open("urls.txt", "r") as f: for url in f.readlines(): url = url[:-1] try: w = Info(url) if w.server != "":...
Add encoding line for Python 3
Fix: Add encoding line for Python 3
Python
mit
linusg/wsinfo
9657f6f428134a47bfbb41f889305dff355551d8
fablab-businessplan.py
fablab-businessplan.py
# -*- encoding: utf-8 -*- # # Author: Massimo Menichinelli # Homepage: http://www.openp2pdesign.org # License: MIT # import xlsxwriter workbook = xlsxwriter.Workbook('FabLab-BusinessPlan.xlsx') worksheet = workbook.add_worksheet() worksheet.write('A1', 'Hello world') workbook.close()
# -*- encoding: utf-8 -*- # # Author: Massimo Menichinelli # Homepage: http://www.openp2pdesign.org # License: MIT # import xlsxwriter # Create the file workbook = xlsxwriter.Workbook('FabLab-BusinessPlan.xlsx') # Create the worksheets expenses = workbook.add_worksheet('Expenses') activities = workbook.add_worksheet...
Add first structure of the script
Add first structure of the script
Python
mit
openp2pdesign/FabLab-BusinessPlan
8c34cc43d23e0d97c531e1aa5d2339693db554e0
projects/projectdl.py
projects/projectdl.py
#!/usr/bin/python3 from bs4 import BeautifulSoup import requests r = requests.get("https://projects.archlinux.org/") soup = BeautifulSoup(r.text) repos = soup.select(".sublevel-repo a") repo_names = [] for repo in repos: repo_name = repo.string if repo_name[-4:] == ".git": repo_name = repo_name[:-4] ...
#!/usr/bin/python3 from bs4 import BeautifulSoup import requests import simplediff from pprint import pprint r = requests.get("https://projects.archlinux.org/") soup = BeautifulSoup(r.text) repos = soup.select(".sublevel-repo a") with open("projects.txt", mode = "r", encoding = "utf-8") as projects_file: cur_rep...
Update project downloader to do diffs before overwriting
Update project downloader to do diffs before overwriting
Python
unlicense
djmattyg007/archlinux,djmattyg007/archlinux
14e98bc2038f50f38244550a1fa7ec3f836ed5f3
http/online_checker.py
http/online_checker.py
import http.client def __is_online(domain, sub_path, response_status, response_reason): conn = http.client.HTTPSConnection(domain, timeout=1) conn.request("HEAD", sub_path) response = conn.getresponse() conn.close() return (response.status == response_status) and (response.reason == response_reas...
""" This module handles every related to online checking. We need to request several information from various providers. We could just try to request them, but instead you can ping them first and check if they are even reachable. This does not mean, that do not need to handle a failure on their part (e.g. if the serve...
Add docstring to online checker
Add docstring to online checker
Python
mit
thatsIch/sublime-rainmeter
72e3e1177dc23b4f3d358294d68b58c01d7c5931
stevedore/__init__.py
stevedore/__init__.py
# flake8: noqa __all__ = [ 'ExtensionManager', 'EnabledExtensionManager', 'NamedExtensionManager', 'HookManager', 'DriverManager', ] from .extension import ExtensionManager from .enabled import EnabledExtensionManager from .named import NamedExtensionManager from .hook import HookManager from .dri...
# flake8: noqa __all__ = [ 'ExtensionManager', 'EnabledExtensionManager', 'NamedExtensionManager', 'HookManager', 'DriverManager', ] from .extension import ExtensionManager from .enabled import EnabledExtensionManager from .named import NamedExtensionManager from .hook import HookManager from .dri...
Remove work around for NullHandler
Remove work around for NullHandler logging module added NullHandler in Python 2.7, we have dropped Python 2.6 support now, so don't need the work around any more. Change-Id: Ib6fdbc2f92cd66f4846243221e696f1b1fa712df
Python
apache-2.0
openstack/stevedore
bda756847e31e97eb8363f48bed67035a3f46d67
settings/travis.py
settings/travis.py
from defaults import * DATABASES = { 'default': { #'ENGINE': 'django.db.backends.postgresql_psycopg2', 'ENGINE': 'django.contrib.gis.db.backends.postgis', # 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'atlas_test', 'USER': 'postgres', 'PASSWORD': '', 'HOST...
from defaults import * DATABASES = { 'default': { #'ENGINE': 'django.db.backends.postgresql_psycopg2', 'ENGINE': 'django.contrib.gis.db.backends.postgis', # 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'atlas_test', 'USER': 'postgres', 'PASSWORD': '', 'HOST...
Use Solr for testing with Travis CI
Use Solr for testing with Travis CI
Python
mit
denverfoundation/storybase,denverfoundation/storybase,denverfoundation/storybase,denverfoundation/storybase
080e4336675ea29b28b63698e5a0e77e91d54a2b
exercises/acronym/acronym_test.py
exercises/acronym/acronym_test.py
import unittest from acronym import abbreviate # test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0 class AcronymTest(unittest.TestCase): def test_basic(self): self.assertEqual(abbreviate('Portable Network Graphics'), 'PNG') def test_lowercase_words(self): self.assertE...
import unittest from acronym import abbreviate # test cases adapted from `x-common//canonical-data.json` @ version: 1.1.0 class AcronymTest(unittest.TestCase): def test_basic(self): self.assertEqual(abbreviate('Portable Network Graphics'), 'PNG') def test_lowercase_words(self): self.assertE...
Remove test with mixed-case word
acronym: Remove test with mixed-case word see: https://github.com/exercism/x-common/pull/788
Python
mit
jmluy/xpython,smalley/python,exercism/xpython,exercism/python,smalley/python,jmluy/xpython,pheanex/xpython,pheanex/xpython,exercism/xpython,behrtam/xpython,exercism/python,N-Parsons/exercism-python,N-Parsons/exercism-python,mweb/python,mweb/python,behrtam/xpython
932748b11bce94076f2e2d5637d4e8db8d4d1dbf
tcelery/__init__.py
tcelery/__init__.py
from __future__ import absolute_import import celery from tornado import ioloop from .connection import ConnectionPool from .producer import NonBlockingTaskProducer from .result import AsyncResult VERSION = (0, 3, 3) __version__ = '.'.join(map(str, VERSION)) def setup_nonblocking_producer(celery_app=None, io_loop...
from __future__ import absolute_import import celery from tornado import ioloop from .connection import ConnectionPool from .producer import NonBlockingTaskProducer from .result import AsyncResult VERSION = (0, 3, 4) __version__ = '.'.join(map(str, VERSION)) + '-dev' def setup_nonblocking_producer(celery_app=None...
Mark master as development version
Mark master as development version
Python
bsd-3-clause
qudos-com/tornado-celery,sangwonl/tornado-celery,mher/tornado-celery,shnjp/tornado-celery
f429707e0a5a97d741ac9c118646c9d171a5830d
kiwi/ui/pixbufutils.py
kiwi/ui/pixbufutils.py
# # Kiwi: a Framework and Enhanced Widgets for Python # # Copyright (C) 2012 Async Open Source # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (a...
# # Kiwi: a Framework and Enhanced Widgets for Python # # Copyright (C) 2012 Async Open Source # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (a...
Add width and height to pixbuf_from_string() and scale the image if any of them are set
Add width and height to pixbuf_from_string() and scale the image if any of them are set
Python
lgpl-2.1
stoq/kiwi
84b907ad78f03d614e8af14578c21e1228ab723d
top.py
top.py
""" Hacker News Top: -Get top stories from Hacker News' official API -Record all users who comment on those stories Author: Rylan Santinon """ from api_connector import * from csv_io import * def main(): conn = ApiConnector() csvio = CsvIo() article_list = conn.get_top() stories = [] for i in article_...
""" Hacker News Top: -Get top stories from Hacker News' official API -Record all users who comment on those stories Author: Rylan Santinon """ from api_connector import * from csv_io import * def main(): conn = ApiConnector() csvio = CsvIo() article_list = conn.get_top() stories = [] for i in article_...
Use common object for csvio calls
Use common object for csvio calls
Python
apache-2.0
rylans/hackernews-top,davande/hackernews-top
124489e979ed9d913b97ff688ce65d678579e638
morse_modem.py
morse_modem.py
import cProfile from demodulate.cfg import * from demodulate.detect_tone import * from demodulate.element_resolve import * from gen_test import * if __name__ == "__main__": #gen_test_data() data = gen_test_data() #print len(data)/SAMPLE_FREQ #cProfile.run('detect_tone(data)') #print detect_tone(data) element_r...
import cProfile from demodulate.cfg import * from demodulate.detect_tone import * from demodulate.element_resolve import * from gen_tone import * import random if __name__ == "__main__": WPM = random.uniform(2,20) pattern = [1,0,1,1,1,0,0,0,0,0,0,0] # morse code 'A' #gen_test_data() data = gen_tone(pattern) #p...
Add tone generation arguments to gen_tone
Add tone generation arguments to gen_tone
Python
mit
nickodell/morse-code
f39f7d64ba8ca8051b24407811239f960cc6f561
lib/collect/backend.py
lib/collect/backend.py
import lib.collect.config as config if config.BACKEND == 'dynamodb': import lib.collect.backends.dymamodb as api else: import lib.collect.backends.localfs as api
import lib.collect.config as config try: if config.BACKEND == 'dynamodb': import lib.collect.backends.dymamodb as api else: import lib.collect.backends.localfs as api except AttributeError: import lib.collect.backends.localfs as api
Fix bug in module selection.
Fix bug in module selection.
Python
mit
ic/mark0
f6bff4e5360ba2c0379c129a111d333ee718c1d3
datafeeds/usfirst_event_teams_parser.py
datafeeds/usfirst_event_teams_parser.py
import re from BeautifulSoup import BeautifulSoup from datafeeds.parser_base import ParserBase class UsfirstEventTeamsParser(ParserBase): @classmethod def parse(self, html): """ Find what Teams are attending an Event, and return their team_numbers. """ teamRe = re.compile(r'...
import re from BeautifulSoup import BeautifulSoup from datafeeds.parser_base import ParserBase class UsfirstEventTeamsParser(ParserBase): @classmethod def parse(self, html): """ Find what Teams are attending an Event, and return their team_numbers. """ teamRe = re.compile(r'...
Fix event teams parser for new format
Fix event teams parser for new format
Python
mit
the-blue-alliance/the-blue-alliance,jaredhasenklein/the-blue-alliance,nwalters512/the-blue-alliance,nwalters512/the-blue-alliance,bdaroz/the-blue-alliance,1fish2/the-blue-alliance,synth3tk/the-blue-alliance,jaredhasenklein/the-blue-alliance,bdaroz/the-blue-alliance,nwalters512/the-blue-alliance,tsteward/the-blue-allian...
b80726a5a36480b4146fc4df89ad96a738aa2091
waitress/settings/__init__.py
waitress/settings/__init__.py
import os if os.getenv('OPENSHIFT_REPO_DIR'): from .staging import * elif os.getenv('TRAVIS_CI'): from .testing import * else: from .development import *
import os if os.getenv('OPENSHIFT_REPO_DIR'): from .staging import * elif os.getenv('TRAVIS_CI'): from .testing import * elif os.getenv('HEROKU'): from .production import * else: from .development import *
Use production settings in Heroku
[fix] Use production settings in Heroku
Python
mit
waitress-andela/waitress,andela-osule/waitress,andela-osule/waitress,andela-osule/waitress,waitress-andela/waitress,waitress-andela/waitress
814684225140231de25dc7ee616c6bfa73b312ee
addons/hr/__terp__.py
addons/hr/__terp__.py
{ "name" : "Human Resources", "version" : "1.0", "author" : "Tiny", "category" : "Generic Modules/Human Resources", "website" : "http://tinyerp.com/module_hr.html", "description": """ Module for human resource management. You can manage: * Employees and hierarchies * Work hours sheets * Attendances and sign i...
{ "name" : "Human Resources", "version" : "1.0", "author" : "Tiny", "category" : "Generic Modules/Human Resources", "website" : "http://tinyerp.com/module_hr.html", "description": """ Module for human resource management. You can manage: * Employees and hierarchies * Work hours sheets * Attendances and sign i...
Add hr_security.xml file entry in update_xml section
Add hr_security.xml file entry in update_xml section bzr revid: mga@tinyerp.com-d69c221f3647e67487af7bd1c349e27cdbbbe857
Python
agpl-3.0
VielSoft/odoo,naousse/odoo,tarzan0820/odoo,BT-ojossen/odoo,leoliujie/odoo,Danisan/odoo-1,ehirt/odoo,odooindia/odoo,ThinkOpen-Solutions/odoo,bakhtout/odoo-educ,ingadhoc/odoo,naousse/odoo,datenbetrieb/odoo,charbeljc/OCB,sysadminmatmoz/OCB,cysnake4713/odoo,arthru/OpenUpgrade,bwrsandman/OpenUpgrade,ovnicraft/odoo,sysadminm...
164a80ce3bcffad0e233426830c712cddd2f750b
thefederation/apps.py
thefederation/apps.py
import datetime import sys import django_rq from django.apps import AppConfig class TheFederationConfig(AppConfig): name = "thefederation" verbose_name = "The Federation" def ready(self): # Only register tasks if RQ Scheduler process if "rqscheduler" not in sys.argv: return ...
import datetime import sys import django_rq from django.apps import AppConfig class TheFederationConfig(AppConfig): name = "thefederation" verbose_name = "The Federation" def ready(self): # Only register tasks if RQ Scheduler process if "rqscheduler" not in sys.argv: return ...
Increase timeout of clean_duplicate_nodes job
Increase timeout of clean_duplicate_nodes job
Python
agpl-3.0
jaywink/diaspora-hub,jaywink/diaspora-hub,jaywink/the-federation.info,jaywink/diaspora-hub,jaywink/the-federation.info,jaywink/the-federation.info
0cdfabf24c01920617535205dfcdba7a187b4d32
doc/_ext/saltdocs.py
doc/_ext/saltdocs.py
def setup(app): """Additions and customizations to Sphinx that are useful for documenting the Salt project. """ app.add_crossref_type(directivename="conf_master", rolename="conf_master", indextemplate="pair: %s; conf/master") app.add_crossref_type(directivename="conf_minion", rolename="...
def setup(app): """Additions and customizations to Sphinx that are useful for documenting the Salt project. """ app.add_crossref_type(directivename="conf_master", rolename="conf_master", indextemplate="pair: %s; conf/master") app.add_crossref_type(directivename="conf_minion", rolename="...
Allow the `conf-log` role to link to the logging documentation.
Allow the `conf-log` role to link to the logging documentation.
Python
apache-2.0
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
db2d0b2f7277f21ce2f500dc0cc4837258fdd200
traceview/__init__.py
traceview/__init__.py
# -*- coding: utf-8 -*- """ TraceView API library :copyright: (c) 2014 by Daniel Riti. :license: MIT, see LICENSE for more details. """ __title__ = 'traceview' __version__ = '0.1.0' __author__ = 'Daniel Riti' __license__ = 'MIT' from .request import Request import resources class TraceView(object): """ Prov...
# -*- coding: utf-8 -*- """ TraceView API library :copyright: (c) 2014 by Daniel Riti. :license: MIT, see LICENSE for more details. """ __title__ = 'traceview' __version__ = '0.1.0' __author__ = 'Daniel Riti' __license__ = 'MIT' from .request import Request import resources class TraceView(object): """ Prov...
Add layers object attribute to TraceView.
Add layers object attribute to TraceView.
Python
mit
danriti/python-traceview
bf8d9fa8d309a1e1252acdcb8a6cfe785a27c859
automata/automaton.py
automata/automaton.py
#!/usr/bin/env python3 import abc class Automaton(metaclass=abc.ABCMeta): def __init__(self, states, symbols, transitions, initial_state, final_states): """initialize a complete finite automaton""" self.states = states self.symbols = symbols self.transitions = tr...
#!/usr/bin/env python3 import abc class Automaton(metaclass=abc.ABCMeta): """an abstract base class for finite automata""" def __init__(self, states, symbols, transitions, initial_state, final_states): """initialize a complete finite automaton""" self.states = states ...
Add docstrings to Automaton base class
Add docstrings to Automaton base class
Python
mit
caleb531/automata
f4bf48ef24a6d3fcb15c0c86da0cfb48f1533f68
ctypeslib/test/stdio.py
ctypeslib/test/stdio.py
import os from ctypeslib.dynamic_module import include from ctypes import * if os.name == "nt": _libc = CDLL("msvcrt") else: _libc = CDLL(None) include("""\ #include <stdio.h> #ifdef _MSC_VER # include <fcntl.h> #else # include <sys/fcntl.h> #endif """, persist=False)
import os from ctypeslib.dynamic_module import include from ctypes import * if os.name == "nt": _libc = CDLL("msvcrt") else: _libc = CDLL(None) _gen_basename = include("""\ #include <stdio.h> #ifdef _MSC_VER # include <fcntl.h> #else # include <sys/fcntl.h> #endif /* Silly comment */ """, persist=...
Store the basename of the generated files, to allow the unittests to clean up in the tearDown method.
Store the basename of the generated files, to allow the unittests to clean up in the tearDown method. git-svn-id: ac2c3632cb6543e7ab5fafd132c7fe15057a1882@52710 6015fed2-1504-0410-9fe1-9d1591cc4771
Python
mit
luzfcb/ctypeslib,luzfcb/ctypeslib,luzfcb/ctypeslib,trolldbois/ctypeslib,trolldbois/ctypeslib,trolldbois/ctypeslib
7f62587e099b9ef59731b6387030431b09f663f9
bot_chucky/helpers.py
bot_chucky/helpers.py
""" Helper classes """ import facebook import requests as r class FacebookData: def __init__(self, token): """ :param token: Facebook Page token :param _api: Instance of the GraphAPI object """ self.token = token self._api = facebook.GraphAPI(self.token) def g...
""" Helper classes """ import facebook import requests as r class FacebookData: def __init__(self, token): """ :param token: Facebook Page token :param _api: Instance of the GraphAPI object """ self.token = token self._api = facebook.GraphAPI(self.token) def g...
Add StackOverFlowData, not completed yet
Add StackOverFlowData, not completed yet
Python
mit
MichaelYusko/Bot-Chucky
a45942894ace282883da3afa10f6739d30943764
dewbrick/majesticapi.py
dewbrick/majesticapi.py
import argparse import json import os import requests BASE_URL = "https://api.majestic.com/api/json" BASE_PARAMS = {'app_api_key': os.environ.get('THEAPIKEY')} def get(cmd, params): querydict = {'cmd': cmd} querydict.update(BASE_PARAMS) querydict.update(params) response = requests.get(BASE_URL, para...
import argparse import json import os import requests BASE_URL = "https://api.majestic.com/api/json" BASE_PARAMS = {'app_api_key': os.environ.get('THEAPIKEY')} def get(cmd, params): querydict = {'cmd': cmd} querydict.update(BASE_PARAMS) querydict.update(params) response = requests.get(BASE_URL, para...
Handle multiple sites in single request.
Handle multiple sites in single request.
Python
apache-2.0
ohmygourd/dewbrick,ohmygourd/dewbrick,ohmygourd/dewbrick
3446db734ce669e98f8cdeedbabf13dac62c777f
edgedb/lang/build.py
edgedb/lang/build.py
import os.path from distutils.command import build class build(build.build): def _compile_parsers(self): import parsing import edgedb import edgedb.server.main edgedb.server.main.init_import_system() import edgedb.lang.edgeql.parser.grammar.single as edgeql_spec ...
import os.path from distutils.command import build class build(build.build): def _compile_parsers(self): import parsing import edgedb import edgedb.server.main edgedb.server.main.init_import_system() import edgedb.lang.edgeql.parser.grammar.single as edgeql_spec ...
Fix the creation of parser cache directory
setup.py: Fix the creation of parser cache directory
Python
apache-2.0
edgedb/edgedb,edgedb/edgedb,edgedb/edgedb
3421fe2542a5b71f6b604e30f2c800400b5e40d8
datawire/store/common.py
datawire/store/common.py
import json from datawire.views.util import JSONEncoder class Store(object): def __init__(self, url): self.url = url def store(self, frame): urn = frame.get('urn') data = json.dumps(frame, cls=JSONEncoder) return self._store(urn, data) def load(self, urn): data ...
import json from datawire.views.util import JSONEncoder class Store(object): def __init__(self, url): self.url = url def store(self, frame): urn = frame.get('urn') data = JSONEncoder().encode(frame) return self._store(urn, data) def load(self, urn): data = self....
Fix encoding of store serialisation.
Fix encoding of store serialisation.
Python
mit
arc64/datawi.re,arc64/datawi.re,arc64/datawi.re
9131a9f2349261900f056c1f920307b0fce176ad
icekit/plugins/image/content_plugins.py
icekit/plugins/image/content_plugins.py
""" Definition of the plugin. """ from django.utils.translation import ugettext_lazy as _ from fluent_contents.extensions import ContentPlugin, plugin_pool from . import models @plugin_pool.register class ImagePlugin(ContentPlugin): model = models.ImageItem category = _('Image') render_template = 'icekit...
""" Definition of the plugin. """ from django.utils.translation import ugettext_lazy as _ from django.template import loader from fluent_contents.extensions import ContentPlugin, plugin_pool from . import models @plugin_pool.register class ImagePlugin(ContentPlugin): model = models.ImageItem category = _('Im...
Implement per-app/model template overrides for ImagePlugin.
Implement per-app/model template overrides for ImagePlugin.
Python
mit
ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/django-icekit
6058bc795563d482ce1672b3eb933e1c409c6ac8
setup.py
setup.py
from distutils.core import setup setup( name='Juju XaaS CLI', version='0.1.0', author='Justin SB', author_email='justin@fathomdb.com', packages=['jxaas'], url='http://pypi.python.org/pypi/jxaas/', license='LICENSE.txt', description='CLI for Juju XaaS.', long_description=open('README...
from distutils.core import setup setup( name='Juju XaaS CLI', version='0.1.0', author='Justin SB', author_email='justin@fathomdb.com', packages=['jxaas'], url='http://pypi.python.org/pypi/jxaas/', license='LICENSE.txt', description='CLI for Juju XaaS.', long_description=open('README...
Add cliff as a requirement
Add cliff as a requirement
Python
apache-2.0
jxaas/cli
57d3b3cf0309222aafbd493cbdc26f30e06f05c1
tests/test_parsing.py
tests/test_parsing.py
#!/usr/bin/env python #encoding:utf-8 #author:dbr/Ben #project:tvnamer #repository:http://github.com/dbr/tvnamer #license:Creative Commons GNU GPL v2 # http://creativecommons.org/licenses/GPL/2.0/ """Test tvnamer's filename parser """ import os import sys from copy import copy import unittest sys.path.append(os.path...
#!/usr/bin/env python #encoding:utf-8 #author:dbr/Ben #project:tvnamer #repository:http://github.com/dbr/tvnamer #license:Creative Commons GNU GPL v2 # http://creativecommons.org/licenses/GPL/2.0/ """Test tvnamer's filename parser """ import os import sys from copy import copy import unittest sys.path.append(os.path...
Fix utility being picked up as test, display expected-and-got values in assertion error
Fix utility being picked up as test, display expected-and-got values in assertion error
Python
unlicense
m42e/tvnamer,lahwaacz/tvnamer,dbr/tvnamer
eee003627856ce3f0a19ad18c8fe6b0a5408c3b6
make_index.py
make_index.py
# -*- coding: utf-8 -*- """ Created on Wed Jul 31 18:29:35 2013 @author: stuart """ import os import glob wheels = glob.glob("./wheelhouse/*whl") outf = open("./wheelhouse/index.html",'w') header = [ '<html>\n', '<head>\n', '<title>SunPy Wheelhouse</title>\n', '</head>\n', '<body>\n' ] outf.writelines(header) for...
# -*- coding: utf-8 -*- """ Created on Wed Jul 31 18:29:35 2013 @author: stuart """ import os from ftplib import FTP ftp = FTP('ftp.servage.net') ftp.login(user=os.environ['FTP_USER'], passwd=os.environ['FTP_PASS']) files = ftp.nlst() wheels = [] for file in files: if os.path.splitext(file)[1] == '.whl': ...
Make index now lists all wheels on FTP server
Make index now lists all wheels on FTP server
Python
bsd-2-clause
kejbaly2/travis_wheels,Cadair/travis_wheels,kejbaly2/travis_wheels,Cadair/travis_wheels
31691ca909fe0b1816d89bb4ccf69974eca882a6
allauth/app_settings.py
allauth/app_settings.py
import django from django.conf import settings from django.core.exceptions import ImproperlyConfigured SOCIALACCOUNT_ENABLED = 'allauth.socialaccount' in settings.INSTALLED_APPS def check_context_processors(): allauth_ctx = 'allauth.socialaccount.context_processors.socialaccount' ctx_present = False if ...
import django from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django import template SOCIALACCOUNT_ENABLED = 'allauth.socialaccount' in settings.INSTALLED_APPS def check_context_processors(): allauth_ctx = 'allauth.socialaccount.context_processors.socialaccount' ...
Fix for checking the context processors on Django 1.8
Fix for checking the context processors on Django 1.8 If the user has not migrated their settings file to use the new TEMPLATES method in Django 1.8, settings.TEMPLATES is an empty list. Instead, if we check django.templates.engines it will be populated with the automatically migrated data from settings.TEMPLATE*.
Python
mit
cudadog/django-allauth,bitcity/django-allauth,petersanchez/django-allauth,bittner/django-allauth,manran/django-allauth,jscott1989/django-allauth,petersanchez/django-allauth,JshWright/django-allauth,italomaia/django-allauth,yarbelk/django-allauth,pankeshang/django-allauth,sih4sing5hong5/django-allauth,ZachLiuGIS/django-...
f941989ef9663ebbb3ba33709dd3c723c86bd2cc
action_log/views.py
action_log/views.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import json from django.conf import settings from django.views.decorators.csrf import csrf_exempt from django.http import HttpResponse from .models import ActionRecord @csrf_exempt def get_action_records(request): action = request.GET.get('action',...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import json from django.conf import settings from django.views.decorators.csrf import csrf_exempt from django.http import HttpResponse from .models import ActionRecord @csrf_exempt def get_action_records(request): action = request.GET.get('action',...
Make it DESC order by id.
Make it DESC order by id.
Python
mit
bradojevic/django-action-log
21f08d30bf23056ea3e4fc9804715a57a8978c02
gitdir/host/localhost.py
gitdir/host/localhost.py
import gitdir.host class LocalHost(gitdir.host.Host): def __iter__(self): for repo_dir in sorted(self.dir.iterdir()): if repo_dir.is_dir(): yield self.repo(repo_dir.name) def __repr__(self): return 'gitdir.host.localhost.LocalHost()' def __str__(self): ...
import gitdir.host class LocalHost(gitdir.host.Host): def __iter__(self): for repo_dir in sorted(self.dir.iterdir()): if repo_dir.is_dir(): yield self.repo(repo_dir.name) def __repr__(self): return 'gitdir.host.localhost.LocalHost()' def __str__(self): ...
Add support for branch arg to LocalHost.clone
Add support for branch arg to LocalHost.clone
Python
mit
fenhl/gitdir
90f7bcb7ab6a43e0d116d6c9e71cc94977c6479c
cutplanner/planner.py
cutplanner/planner.py
import collections from stock import Stock # simple structure to keep track of a specific piece Piece = collections.namedtuple('Piece', 'id, length') class Planner(object): def __init__(self, sizes, needed, loss=0.25): self.stock = [] self.stock_sizes = sorted(sizes) self.pieces_needed = ...
import collections from stock import Stock # simple structure to keep track of a specific piece Piece = collections.namedtuple('Piece', 'id, length') class Planner(object): def __init__(self, sizes, needed, loss=0.25): self.stock = [] self.stock_sizes = sorted(sizes) self.pieces_needed = ...
Add function for next_fit algorithm
Add function for next_fit algorithm
Python
mit
alanc10n/py-cutplanner
b5133e7a3e7d51a31deef46e786b241b63ebd7de
planetstack/model_policies/__init__.py
planetstack/model_policies/__init__.py
from .model_policy_Slice import * from .model_policy_User import * from .model_policy_Network import * from .model_policy_Site import * from .model_policy_SitePrivilege import * from .model_policy_SlicePrivilege import * from .model_policy_ControllerSlice import * from .model_policy_Controller import * from .model_poli...
from .model_policy_Slice import * from .model_policy_User import * from .model_policy_Network import * from .model_policy_Site import * from .model_policy_SitePrivilege import * from .model_policy_SlicePrivilege import * from .model_policy_ControllerSlice import * from .model_policy_ControllerSite import * from .model_...
Enable user and site model policies
Enable user and site model policies
Python
apache-2.0
wathsalav/xos,wathsalav/xos,wathsalav/xos,wathsalav/xos
df5a0c3c0d5058fe9e3c4c00ecfb86da3136144c
frameworks/Java/grizzly-bm/setup.py
frameworks/Java/grizzly-bm/setup.py
import subprocess import sys import setup_util import os def start(args, logfile, errfile): try: subprocess.check_call("mvn clean compile assembly:single", shell=True, cwd="grizzly-bm", stderr=errfile, stdout=logfile) subprocess.Popen("java -Dorg.glassfish.grizzly.nio.transport.TCPNIOTransport.max-receive-bu...
import subprocess import sys import setup_util import os def start(args, logfile, errfile): try: subprocess.check_call("mvn clean compile assembly:single", shell=True, cwd="grizzly-bm", stderr=errfile, stdout=logfile) subprocess.Popen("java -Dorg.glassfish.grizzly.nio.transport.TCPNIOTransport.max-receive-bu...
Stop killing run-tests and run-ci
Stop killing run-tests and run-ci
Python
bsd-3-clause
greg-hellings/FrameworkBenchmarks,greg-hellings/FrameworkBenchmarks,s-ludwig/FrameworkBenchmarks,marko-asplund/FrameworkBenchmarks,kostya-sh/FrameworkBenchmarks,sxend/FrameworkBenchmarks,martin-g/FrameworkBenchmarks,grob/FrameworkBenchmarks,greg-hellings/FrameworkBenchmarks,ashawnbandy-te-tfb/FrameworkBenchmarks,jammin...
838895500f8046b06718c184a4e8b12b42add516
wp2hugo.py
wp2hugo.py
#!/usr/bin/env python3 import sys from pprint import pprint from lxml import etree import html2text from wp_parser import WordpressXMLParser from hugo_printer import HugoPrinter def main(): wp_xml_parser = WordpressXMLParser(sys.argv[1]) meta = wp_xml_parser.get_meta() cats = wp_xml_parser.get_categori...
#!/usr/bin/env python3 import sys from pprint import pprint from lxml import etree import html2text from wp_parser import WordpressXMLParser from hugo_printer import HugoPrinter def main(): wp_xml_parser = WordpressXMLParser(sys.argv[1]) wp_site_info = { "meta": wp_xml_parser.get_meta(), "c...
Call HugoPrinter to save config file
Call HugoPrinter to save config file
Python
mit
hzmangel/wp2hugo
71fef8b9696d79f7d6fd024320bc23ce1b7425f3
greatbigcrane/preferences/models.py
greatbigcrane/preferences/models.py
""" Copyright 2010 Jason Chu, Dusty Phillips, and Phil Schalm 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 agre...
""" Copyright 2010 Jason Chu, Dusty Phillips, and Phil Schalm 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 agre...
Add a manager to make getting preferences prettier.
Add a manager to make getting preferences prettier.
Python
apache-2.0
pnomolos/greatbigcrane,pnomolos/greatbigcrane
018acc1817cedf8985ffc81e4fe7e98d85a644da
instructions/base.py
instructions/base.py
class InstructionBase(object): BEFORE=None AFTER=None def __init__(self, search_string): self.search_string = search_string @property def search_string(self): return self._search_string @search_string.setter def search_string(self, value): if value.startswith(self....
class InstructionBase(object): BEFORE=None AFTER=None def __init__(self, search_string): self.search_string = search_string @property def search_string(self): return self._search_string @search_string.setter def search_string(self, value): if value.startswith(self....
Add hack to allow specifying newlines in scripts
Add hack to allow specifying newlines in scripts
Python
unlicense
djmattyg007/IdiotScript
ed0f115e600a564117ed540e7692e0efccf5826b
server/nso.py
server/nso.py
from flask import request, Response from .base import * from server import app import requests import re import sys reload(sys) sys.setdefaultencoding('utf-8') @app.route('/nso') def get_nso_events(): r = requests.get("http://www.nso.upenn.edu/event-calendar.rss") split = r.text.split("\n") filtered = [i i...
from flask import request, Response from .base import * from server import app import requests import re import sys reload(sys) sys.setdefaultencoding('utf-8') @app.route('/nso') def get_nso_events(): r = requests.get("http://www.nso.upenn.edu/event-calendar.rss") split = r.text.split("\n") filtered = [i i...
Set time back four hours to EST
Set time back four hours to EST
Python
mit
pennlabs/penn-mobile-server,pennlabs/penn-mobile-server
01b03d46d32dd7f9e027220df0681c4f82fe7217
cumulusci/conftest.py
cumulusci/conftest.py
from pytest import fixture from cumulusci.core.github import get_github_api @fixture def gh_api(): return get_github_api("TestOwner", "TestRepo")
import os from pytest import fixture from cumulusci.core.github import get_github_api @fixture def gh_api(): return get_github_api("TestOwner", "TestRepo") @fixture(scope="class", autouse=True) def restore_cwd(): d = os.getcwd() try: yield finally: os.chdir(d)
Add pytest fixture to avoid leakage of cwd changes
Add pytest fixture to avoid leakage of cwd changes
Python
bsd-3-clause
SalesforceFoundation/CumulusCI,SalesforceFoundation/CumulusCI
1d55fe7b1f4f3d70da6867ef7465ac44f8d2da38
keyring/tests/backends/test_OS_X.py
keyring/tests/backends/test_OS_X.py
import sys from ..test_backend import BackendBasicTests from ..py30compat import unittest from keyring.backends import OS_X def is_osx_keychain_supported(): return sys.platform in ('mac','darwin') @unittest.skipUnless(is_osx_keychain_supported(), "Need OS X") class OSXKeychainTestCase(Backen...
import sys from ..test_backend import BackendBasicTests from ..py30compat import unittest from keyring.backends import OS_X def is_osx_keychain_supported(): return sys.platform in ('mac','darwin') @unittest.skipUnless(is_osx_keychain_supported(), "Need OS X") class OSXKeychainTestCase(Backen...
Test passes on OS X
Test passes on OS X
Python
mit
jaraco/keyring
e55c5b80d67edcde6c6f31665f39ebfb70660bc1
scripts/update_lookup_stats.py
scripts/update_lookup_stats.py
#!/usr/bin/env python # Copyright (C) 2012 Lukas Lalinsky # Distributed under the MIT license, see the LICENSE file for details. import re from contextlib import closing from acoustid.script import run_script from acoustid.data.stats import update_lookup_stats def main(script, opts, args): db = script.engine.co...
#!/usr/bin/env python # Copyright (C) 2012 Lukas Lalinsky # Distributed under the MIT license, see the LICENSE file for details. import re import urllib import urllib2 from contextlib import closing from acoustid.script import run_script from acoustid.data.stats import update_lookup_stats def call_internal_api(func...
Handle lookup stats update on a slave server
Handle lookup stats update on a slave server
Python
mit
lalinsky/acoustid-server,lalinsky/acoustid-server,lalinsky/acoustid-server,lalinsky/acoustid-server
4623c8f0de7ff41f78754df6811570a4d4367728
Cauldron/ext/commandkeywords/__init__.py
Cauldron/ext/commandkeywords/__init__.py
# -*- coding: utf-8 -*- """ An extension for a command-based keyword. """ from __future__ import absolute_import from Cauldron.types import Boolean, DispatcherKeywordType from Cauldron.exc import NoWriteNecessary class CommandKeyword(Boolean, DispatcherKeywordType): """This keyword will receive boolean writes as ...
# -*- coding: utf-8 -*- """ An extension for a command-based keyword. """ from __future__ import absolute_import from Cauldron.types import Boolean, DispatcherKeywordType from Cauldron.exc import NoWriteNecessary from Cauldron.utils.callbacks import Callbacks class CommandKeyword(Boolean, DispatcherKeywordType): ...
Make command-keyword compatible with DFW implementation
Make command-keyword compatible with DFW implementation
Python
bsd-3-clause
alexrudy/Cauldron
a797f4862ccfdb84ff87f0f64a6abdc405823215
tests/app/na_celery/test_email_tasks.py
tests/app/na_celery/test_email_tasks.py
from app.na_celery.email_tasks import send_emails class WhenProcessingSendEmailsTask: def it_calls_send_email_to_task(self, mocker, db, db_session, sample_admin_user, sample_email): mock_send_email = mocker.patch('app.na_celery.email_tasks.send_email') send_emails(sample_email.id) assert...
from app.na_celery.email_tasks import send_emails class WhenProcessingSendEmailsTask: def it_calls_send_email_to_task(self, mocker, db, db_session, sample_email, sample_member): mock_send_email = mocker.patch('app.na_celery.email_tasks.send_email', return_value=200) send_emails(sample_email.id) ...
Update email task test for members
Update email task test for members
Python
mit
NewAcropolis/api,NewAcropolis/api,NewAcropolis/api
05fc957280fecbc99c8f58897a06e23dcc4b9453
elections/uk/forms.py
elections/uk/forms.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django import forms from django.core.exceptions import ValidationError from candidates.mapit import BaseMapItException from popolo.models import Area from compat import text_type from .mapit import get_areas_from_postcode class PostcodeForm(form...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django import forms from django.core.exceptions import ValidationError from candidates.mapit import BaseMapItException from popolo.models import Area from compat import text_type from .mapit import get_areas_from_postcode class PostcodeForm(form...
Fix the postcode form so that it's actually validating the input
Fix the postcode form so that it's actually validating the input
Python
agpl-3.0
DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative,DemocracyClub/yournextrepresentative
5a7b3e024eba2e279ada9aa33352046ab35b28f5
tests/test_io.py
tests/test_io.py
""" Test the virtual IO system. """ from StringIO import StringIO import sys import os from mock import call from mock import patch import pytest sys.path.append(os.path.join('..', '..', 'snake')) from snake.vm import System @pytest.fixture() def system(): """ Fixture to load a new VM. """ return System() ...
""" Test the virtual IO system. """ from io import BytesIO import sys import os from mock import call from mock import patch import pytest sys.path.append(os.path.join('..', '..', 'snake')) from snake.vm import System @pytest.fixture() def system(): """ Fixture to load a new VM. """ return System() def te...
Remove StringIO in favor of BytesIO.
Remove StringIO in favor of BytesIO.
Python
bsd-3-clause
travcunn/snake-vm
07d2ffe3c14a6c908a7bf138f40ba8d49bf7b2c3
examples/plot_grow.py
examples/plot_grow.py
# -*- coding: utf-8 -*- """ ==================================== Plotting simple exponential function ==================================== A simple example of the plot of a exponential function in order to test the autonomy of the gallery """ # Code source: Óscar Nájera # License: BSD 3 clause import numpy as np imp...
# -*- coding: utf-8 -*- """ ================================= Plotting the exponential function ================================= A simple example for ploting two figures of a exponential function in order to test the autonomy of the gallery stacking multiple images. """ # Code source: Óscar Nájera # License: BSD 3 c...
Update example for image stacking CSS instuction
Update example for image stacking CSS instuction
Python
bsd-3-clause
lesteve/sphinx-gallery,Eric89GXL/sphinx-gallery,sphinx-gallery/sphinx-gallery,Titan-C/sphinx-gallery,lesteve/sphinx-gallery,Titan-C/sphinx-gallery,Eric89GXL/sphinx-gallery,sphinx-gallery/sphinx-gallery
be517c8df23826d343b187a4a5cc3d1f81a06b53
test/framework/utils.py
test/framework/utils.py
# Copyright (c) 2012 - 2014 Lars Hupfeldt Nielsen, Hupfeldt IT # All rights reserved. This work is under a BSD license, see LICENSE.TXT. import os, re from os.path import join as jp from .config import flow_graph_root_dir _http_re = re.compile(r'https?://[^/]*/') def replace_host_port(contains_url): return _htt...
# Copyright (c) 2012 - 2014 Lars Hupfeldt Nielsen, Hupfeldt IT # All rights reserved. This work is under a BSD license, see LICENSE.TXT. import os, re from os.path import join as jp from .config import flow_graph_root_dir _http_re = re.compile(r'https?://.*?/job/') def replace_host_port(contains_url): return _h...
Test framework fix - url replacing handles jenkins url with 'prefix'
Test framework fix - url replacing handles jenkins url with 'prefix'
Python
bsd-3-clause
lhupfeldt/jenkinsflow,lhupfeldt/jenkinsflow,lhupfeldt/jenkinsflow,lhupfeldt/jenkinsflow,lechat/jenkinsflow,lechat/jenkinsflow,lechat/jenkinsflow,lechat/jenkinsflow
7418079606a6e24cb0dccfa148b47c3f736e985f
zou/app/blueprints/persons/resources.py
zou/app/blueprints/persons/resources.py
from flask import abort from flask_restful import Resource, reqparse from flask_jwt_extended import jwt_required from zou.app.services import persons_service from zou.app.utils import auth, permissions class NewPersonResource(Resource): @jwt_required def post(self): permissions.check_admin_permissio...
from flask import abort from flask_restful import Resource, reqparse from flask_jwt_extended import jwt_required from zou.app.services import persons_service from zou.app.utils import auth, permissions class NewPersonResource(Resource): @jwt_required def post(self): permissions.check_admin_permissio...
Allow to set role while creating a person
Allow to set role while creating a person
Python
agpl-3.0
cgwire/zou
a95b1b2b5331e4248fe1d80244c763df4d3aca41
taiga/urls.py
taiga/urls.py
# -*- coding: utf-8 -*- from django.conf import settings from django.conf.urls import patterns, include, url from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.contrib import admin from .routers import router admin.autodiscover() urlpatterns = patterns('', url(r'^api/v1/', include(...
# -*- coding: utf-8 -*- from django.conf import settings from django.conf.urls import patterns, include, url from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.contrib import admin from .routers import router admin.autodiscover() urlpatterns = patterns('', url(r'^api/v1/', include(...
Set prefix to static url patterm call
Set prefix to static url patterm call
Python
agpl-3.0
jeffdwyatt/taiga-back,bdang2012/taiga-back-casting,WALR/taiga-back,seanchen/taiga-back,gam-phon/taiga-back,EvgeneOskin/taiga-back,CoolCloud/taiga-back,WALR/taiga-back,Rademade/taiga-back,seanchen/taiga-back,taigaio/taiga-back,astronaut1712/taiga-back,astronaut1712/taiga-back,taigaio/taiga-back,xdevelsistemas/taiga-back...
31af4bf93b8177e8ac03ef96bec926551b40fdcb
cogs/common/types.py
cogs/common/types.py
""" Copyright (c) 2017 Genome Research Ltd. Authors: * Simon Beal <sb48@sanger.ac.uk> * Christopher Harrison <ch12@sanger.ac.uk> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version...
""" Copyright (c) 2017 Genome Research Ltd. Authors: * Simon Beal <sb48@sanger.ac.uk> * Christopher Harrison <ch12@sanger.ac.uk> This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version...
Add aiohttp.web.Application into type aliases
Add aiohttp.web.Application into type aliases
Python
agpl-3.0
wtsi-hgi/CoGS-Webapp,wtsi-hgi/CoGS-Webapp,wtsi-hgi/CoGS-Webapp
f9d4fae5dd16c6bc386f6ef0453d2713d916a9f5
invocations/checks.py
invocations/checks.py
""" Shortcuts for common development check tasks """ from __future__ import unicode_literals from invoke import task @task(name='blacken', iterable=['folder']) def blacken(c, line_length=79, folder=None): """Run black on the current source""" folders = ['.'] if not folder else folder black_command_line...
""" Shortcuts for common development check tasks """ from __future__ import unicode_literals from invoke import task @task(name='blacken', iterable=['folder']) def blacken(c, line_length=79, folder=None): """Run black on the current source""" default_folders = ["."] configured_folders = c.config.get("bl...
Add a 'blacken/folders' configuration flag for blacken
Add a 'blacken/folders' configuration flag for blacken
Python
bsd-2-clause
pyinvoke/invocations
d495d9500377bad5c7ccfd15037fb4d03fd7bff3
videolog/user.py
videolog/user.py
from datetime import datetime import time import json from videolog.core import Videolog class User(Videolog): def find_videos(self, user): content = self._make_request('GET', '/usuario/%s/videos.json' % user) usuario = json.loads(content) response = [] for video in usuario['usuar...
from datetime import datetime import time import json from videolog.core import Videolog class User(Videolog): def find_videos(self, user, privacy=None): path = '/usuario/%s/videos.json' % user if privacy is not None: path = "%s?privacidade=%s" % (path, privacy) content = self...
Add privacy parameter to User.find_videos
Add privacy parameter to User.find_videos
Python
mit
rcmachado/pyvideolog
70f0e1b1112713a95f6d22db95fbb0368f079a18
opps/containers/forms.py
opps/containers/forms.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from django import forms from django.conf import settings from opps.db.models.fields.jsonf import JSONFormField from opps.fields.widgets import JSONField from opps.fields.models import Field, FieldOption class ContainerAdminForm(forms.ModelForm): def __init__(self, *...
#!/usr/bin/env python # -*- coding: utf-8 -*- from django import forms from django.conf import settings from opps.db.models.fields.jsonf import JSONFormField from opps.fields.widgets import JSONField from opps.fields.models import Field, FieldOption from .models import Container class ContainerAdminForm(forms.Model...
Set Meta class model default on ContainerAdminForm
Set Meta class model default on ContainerAdminForm
Python
mit
williamroot/opps,williamroot/opps,opps/opps,YACOWS/opps,williamroot/opps,opps/opps,opps/opps,YACOWS/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,YACOWS/opps,opps/opps,jeanmask/opps,jeanmask/opps,jeanmask/opps
9d1a53fea17dfc8d48324e510273259615fbee01
pivoteer/writer/hosts.py
pivoteer/writer/hosts.py
""" Classes and functions for writing Host Records. Host Records are IndicatorRecords with a record type of "HR." """ import dateutil.parser from pivoteer.writer.core import CsvWriter from core.lookups import geolocate_ip class HostCsvWriter(CsvWriter): """ A CsvWriter implementation for IndicatorRecord obje...
""" Classes and functions for writing Host Records. Host Records are IndicatorRecords with a record type of "HR." """ import dateutil.parser from pivoteer.writer.core import CsvWriter from core.lookups import geolocate_ip class HostCsvWriter(CsvWriter): """ A CsvWriter implementation for IndicatorRecord obje...
Update historical export with latest data model changes
Update historical export with latest data model changes
Python
mit
LindaTNguyen/RAPID,LindaTNguyen/RAPID,gdit-cnd/RAPID,gdit-cnd/RAPID,gdit-cnd/RAPID,LindaTNguyen/RAPID,LindaTNguyen/RAPID,gdit-cnd/RAPID,gdit-cnd/RAPID,LindaTNguyen/RAPID
06eabe9986edfb3c26b2faebb9e07ede72e4781d
wush/utils.py
wush/utils.py
import rq import redis import django from django.conf import settings REDIS_CLIENT = redis.Redis(settings.REDIS_HOST, settings.REDIS_PORT, db=0) class CustomJob(rq.job.Job): def _unpickle_data(self): django.setup() super(CustomJob, self)._unpickle_data() class CustomQueue(rq.Queue): def _...
import rq import redis import django from django.conf import settings REDIS_CLIENT = redis.Redis(settings.REDIS_HOST, settings.REDIS_PORT, db=0) class CustomJob(rq.job.Job): def _unpickle_data(self): django.setup() super(CustomJob, self)._unpickle_data() class CustomQueue(rq.Queue): job_c...
Use the existing class property job_class.
Use the existing class property job_class.
Python
mit
theju/wush
d9447b070e655126bc143cbe817ed727e3794352
crm_capital/models/crm_turnover_range.py
crm_capital/models/crm_turnover_range.py
# -*- encoding: utf-8 -*- ############################################################################## # For copyright and license notices, see __openerp__.py file in root directory ############################################################################## from openerp import models, fields class CrmTurnoverRan...
# -*- encoding: utf-8 -*- ############################################################################## # For copyright and license notices, see __openerp__.py file in root directory ############################################################################## from openerp import models, fields class CrmTurnoverRan...
Set some fields as tranlate
Set some fields as tranlate
Python
agpl-3.0
Therp/partner-contact,open-synergy/partner-contact,acsone/partner-contact,diagramsoftware/partner-contact,Endika/partner-contact
5c3900e12216164712c9e7fe7ea064e70fae8d1b
enumfields/enums.py
enumfields/enums.py
import inspect from django.utils.encoding import force_bytes, python_2_unicode_compatible from enum import Enum as BaseEnum, EnumMeta as BaseEnumMeta import six class EnumMeta(BaseEnumMeta): def __new__(cls, name, bases, attrs): Labels = attrs.get('Labels') if Labels is not None and inspect.iscla...
import inspect from django.utils.encoding import force_bytes, python_2_unicode_compatible from enum import Enum as BaseEnum, EnumMeta as BaseEnumMeta import six class EnumMeta(BaseEnumMeta): def __new__(cls, name, bases, attrs): Labels = attrs.get('Labels') if Labels is not None and inspect.iscla...
Fix 'Labels' class in Python 3.
Fix 'Labels' class in Python 3. In Python 3, the attrs dict will already be an _EnumDict, which has a separate list of member names (in Python 2, it is still a plain dict at this point).
Python
mit
suutari-ai/django-enumfields,jackyyf/django-enumfields,bxm156/django-enumfields,jessamynsmith/django-enumfields
e0d811f5146ba2c97af3da4ac904db4d16b5d9bb
python/ctci_big_o.py
python/ctci_big_o.py
p = int(input().strip()) for a0 in range(p): n = int(input().strip())
from collections import deque class Sieve(object): def __init__(self, upper_bound): self.upper_bound = upper_bound + 1 self.primes = [] self.populate_primes() # print("Primes " + str(self.primes)) def is_prime(self, potential_prime): return potential_prime in self.pri...
Solve all test cases but 2
Solve all test cases but 2
Python
mit
rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank,rootulp/hackerrank
ed92a324cceddce96f2cff51a103c6ca15f62d8e
asterix/test.py
asterix/test.py
# encoding: utf-8 """ Utility functions to help testing. """ from unittest.mock import Mock class dummy(object): def __init__(self): self.components = {} def get(self, name, default): if name not in self.components: self.components[name] = Mock() return self.components[n...
# encoding: utf-8 """ Utility functions to help testing. """ from unittest.mock import Mock class dummy(object): def __init__(self): self.components = {} def get(self, name, default=None): if name not in self.components: self.components[name] = Mock() return self.compone...
Add facade to mocked components
Add facade to mocked components
Python
mit
hkupty/asterix
adc92c01ef72cd937de7448da515caf6c2704cc3
app/task.py
app/task.py
from mongoengine import Document, DateTimeField, EmailField, IntField, \ ReferenceField, StringField import datetime, enum class Priority(enum.IntEnum): LOW = 0, MIDDLE = 1, HIGH = 2 """ This defines the basic model for a Task as we want it to be stored in the MongoDB. """ class Task(Document): ...
from mongoengine import Document, DateTimeField, EmailField, IntField, \ ReferenceField, StringField import datetime, enum class Priority(enum.IntEnum): LOW = 0, MIDDLE = 1, HIGH = 2 """ This defines the basic model for a Task as we want it to be stored in the MongoDB. """ class Task(Document): ...
Remove closed_at field from Task model
Remove closed_at field from Task model
Python
mit
Zillolo/lazy-todo
435d5d21c2bd2b14998fd206035cc93fd897f6c8
tests/testclasses.py
tests/testclasses.py
from datetime import datetime import unittest from normalize import ( JsonCollectionProperty, JsonProperty, JsonRecord, Record, RecordList, ) class MockChildRecord(JsonRecord): name = JsonProperty() class MockDelegateJsonRecord(JsonRecord): other = JsonProperty() class MockJsonRecord(...
from datetime import datetime import unittest from normalize import ( JsonCollectionProperty, JsonProperty, JsonRecord, Record, RecordList, ) class MockChildRecord(JsonRecord): name = JsonProperty() class MockDelegateJsonRecord(JsonRecord): other = JsonProperty() class MockJsonRecord(...
Remove some traces of this module's predecessor
Remove some traces of this module's predecessor
Python
mit
samv/normalize,tomo-otsuka/normalize,hearsaycorp/normalize
e53c572af6f9ee2808ef682cfcfc842fe650ab4b
gribapi/__init__.py
gribapi/__init__.py
from .gribapi import * # noqa from .gribapi import __version__ from .gribapi import bindings_version
from .gribapi import * # noqa from .gribapi import __version__ from .gribapi import bindings_version # The minimum required version for the ecCodes package min_reqd_version_str = '2.14.0' min_reqd_version_int = 21400 if lib.grib_get_api_version() < min_reqd_version_int: raise RuntimeError('ecCodes ...
Check minimum required version of ecCodes engine
Check minimum required version of ecCodes engine
Python
apache-2.0
ecmwf/eccodes-python,ecmwf/eccodes-python
da5479f4db905ea632009728864793812d56be81
test/test_bill_history.py
test/test_bill_history.py
import unittest import bill_info import fixtures import datetime class BillHistory(unittest.TestCase): def test_normal_enacted_bill(self): history = fixtures.bill("hr3590-111")['history'] self.assertEqual(history['house_passage_result'], 'pass') self.assertEqual(self.to_date(history['house_passage_res...
import unittest import bill_info import fixtures import datetime class BillHistory(unittest.TestCase): def test_normal_enacted_bill(self): history = fixtures.bill("hr3590-111")['history'] self.assertEqual(history['house_passage_result'], 'pass') self.assertEqual(self.to_date(history['house_passage_res...
Fix failing test since switching to use bare dates and not full timestamps when appropriate
Fix failing test since switching to use bare dates and not full timestamps when appropriate
Python
cc0-1.0
boblannon/congress,Nolawee/congress,Nolawee/congress,chriscondon/billtext,sunlightlabs/congress-opencongress,boblannon/congress,chriscondon/billtext,unitedstates/congress,sunlightlabs/congress-opencongress,unitedstates/congress
881875537cf1fcb27c89cf5ba8bfeba625239ef5
GitHub_test.py
GitHub_test.py
#This is a test to see how GitHub will react when I change things from this webpage instead of as usual. print "Hello, world!"
#This is a test to see how GitHub will react when I change things from this webpage instead of as usual. print "Hello, world!" print "Test"
Test for GitHub Paste reaction.
Test for GitHub Paste reaction.
Python
mit
ieguinoa/tools-iuc,loraine-gueguen/tools-iuc,lparsons/tools-iuc,nekrut/tools-iuc,nsoranzo/tools-iuc,Delphine-L/tools-iuc,Delphine-L/tools-iuc,nekrut/tools-iuc,galaxyproject/tools-iuc,davebx/tools-iuc,loraine-gueguen/tools-iuc,natefoo/tools-iuc,gvlproject/tools-iuc,mvdbeek/tools-iuc,Delphine-L/tools-iuc,nekrut/tools-iuc...
45abd54dcb14f3dbf45622c493f37e3726b53755
models/waifu_model.py
models/waifu_model.py
from models.base_model import BaseModel from datetime import datetime from models.user_model import UserModel from peewee import CharField, TextField, DateTimeField, IntegerField, ForeignKeyField WAIFU_SHARING_STATUS_PRIVATE = 1 WAIFU_SHARING_STATUS_PUBLIC_MODERATION = 2 WAIFU_SHARING_STATUS_PUBLIC = 3 class WaifuMo...
from models.base_model import BaseModel from datetime import datetime from models.user_model import UserModel from peewee import CharField, TextField, DateTimeField, IntegerField, ForeignKeyField WAIFU_SHARING_STATUS_PRIVATE = 1 WAIFU_SHARING_STATUS_PUBLIC_MODERATION = 2 WAIFU_SHARING_STATUS_PUBLIC = 3 class WaifuMo...
Add method to get waifu according user and sharing status.
Add method to get waifu according user and sharing status.
Python
cc0-1.0
sketchturnerr/WaifuSim-backend,sketchturnerr/WaifuSim-backend
61a4743b62914559fea18a945f7a780e1394da2f
test/test_export_flow.py
test/test_export_flow.py
import netlib.tutils from libmproxy import flow_export from . import tutils req_get = netlib.tutils.treq( method='GET', headers=None, content=None, ) req_post = netlib.tutils.treq( method='POST', headers=None, ) def test_request_simple(): flow = tutils.tflow(req=req_get) assert flow_expo...
import netlib.tutils from libmproxy import flow_export from . import tutils req_get = netlib.tutils.treq( method='GET', content=None, ) req_post = netlib.tutils.treq( method='POST', headers=None, ) req_patch = netlib.tutils.treq( method='PATCH', path=b"/path?query=param", ) def test_curl_co...
Test exact return value of flow_export.curl_command
Test exact return value of flow_export.curl_command
Python
mit
jvillacorta/mitmproxy,tdickers/mitmproxy,ddworken/mitmproxy,StevenVanAcker/mitmproxy,cortesi/mitmproxy,vhaupert/mitmproxy,tdickers/mitmproxy,mosajjal/mitmproxy,mosajjal/mitmproxy,fimad/mitmproxy,fimad/mitmproxy,ujjwal96/mitmproxy,vhaupert/mitmproxy,dwfreed/mitmproxy,ParthGanatra/mitmproxy,xaxa89/mitmproxy,mhils/mitmpro...
37cb987503f336362d629619f6f39165f4d8e212
utils/snippets.py
utils/snippets.py
#!/usr/bin/env python # A hacky script to do dynamic snippets. import sys import os import datetime snippet_map = { 'date' : datetime.datetime.now().strftime('%b %d %G %I:%M%p '), 'time' : datetime.datetime.now().strftime('%I:%M%p '), } keys = '\n'.join(snippet_map.keys()) result = os.popen('printf "%s" | ro...
#!/usr/bin/env python # A hacky script to do dynamic snippets. import sys import os import datetime snippet_map = { 'date' : datetime.datetime.now().strftime('%b %d %G %I:%M%p '), 'time' : datetime.datetime.now().strftime('%I:%M%p '), 'sign' : 'Best,\nSameer', } keys = '\n'.join(snippet_map.keys()) resul...
Update snippet script to work with newlines.
Update snippet script to work with newlines.
Python
mit
sam33r/dotfiles,sam33r/dotfiles,sam33r/dotfiles,sam33r/dotfiles
95a6f1fa9e5153d337a3590cea8c7918c88c63e0
openedx/core/djangoapps/embargo/admin.py
openedx/core/djangoapps/embargo/admin.py
""" Django admin page for embargo models """ import textwrap from config_models.admin import ConfigurationModelAdmin from django.contrib import admin from .forms import IPFilterForm, RestrictedCourseForm from .models import CountryAccessRule, IPFilter, RestrictedCourse class IPFilterAdmin(ConfigurationModelAdmin): ...
""" Django admin page for embargo models """ import textwrap from config_models.admin import ConfigurationModelAdmin from django.contrib import admin from .forms import IPFilterForm, RestrictedCourseForm from .models import CountryAccessRule, IPFilter, RestrictedCourse class IPFilterAdmin(ConfigurationModelAdmin): ...
Allow searching restricted courses by key
Allow searching restricted courses by key
Python
agpl-3.0
a-parhom/edx-platform,a-parhom/edx-platform,a-parhom/edx-platform,edx/edx-platform,msegado/edx-platform,philanthropy-u/edx-platform,edx-solutions/edx-platform,cpennington/edx-platform,eduNEXT/edx-platform,eduNEXT/edunext-platform,eduNEXT/edx-platform,arbrandes/edx-platform,jolyonb/edx-platform,EDUlib/edx-platform,mitoc...
8b6d285f60caa77677aaf3076642a47c525a3b24
parsers/nmapingest.py
parsers/nmapingest.py
import pandas as pd import logging, os import IPy as IP log = logging.getLogger(__name__) df3 = pd.read_csv('nmap.tsv', delimiter='\t') df3.columns = ['host_and_fingerprint', 'port'] df3['host_and_fingerprint'] = df3['host_and_fingerprint'].map(lambda x: x.lstrip('Host:').rstrip('')) df3['port'] = df3['port'].map(l...
import pandas as pd import logging, os import IPy as IP log = logging.getLogger(__name__) df3 = pd.read_csv('data/nmap/nmap.tsv', delimiter='\t') df3.columns = ['host_and_fingerprint', 'port'] df3['host_and_fingerprint'] = df3['host_and_fingerprint'].map(lambda x: x.lstrip('Host:').rstrip('')) df3['port'] = df3['port...
Fix problem lines in nmap parsing.
Fix problem lines in nmap parsing.
Python
apache-2.0
jzadeh/chiron-elk
4ddce41a126395141738f4cd02b2c0589f0f1577
test/utils.py
test/utils.py
from contextlib import contextmanager import sys try: from StringIO import StringIO except ImportError: from io import StringIO @contextmanager def captured_output(): """Allows to safely capture stdout and stderr in a context manager.""" new_out, new_err = StringIO(), StringIO() old_out, old_err ...
from contextlib import contextmanager import sys from io import StringIO @contextmanager def captured_output(): """Allows to safely capture stdout and stderr in a context manager.""" new_out, new_err = StringIO(), StringIO() old_out, old_err = sys.stdout, sys.stderr try: sys.stdout, sys.stder...
Remove conditional import for py2 support
Remove conditional import for py2 support
Python
mit
bertrandvidal/parse_this
6be3a40010b7256cb5b8fadfe4ef40b6c5691a06
jungle/session.py
jungle/session.py
# -*- coding: utf-8 -*- import boto3 def create_session(profile_name): if not profile_name: return boto3 else: return boto3.Session(profile_name=profile_name)
# -*- coding: utf-8 -*- import sys import boto3 import botocore import click def create_session(profile_name): if profile_name is None: return boto3 else: try: session = boto3.Session(profile_name=profile_name) return session except botocore.exceptions.ProfileN...
Add error message when wrong AWS Profile Name is given
Add error message when wrong AWS Profile Name is given
Python
mit
achiku/jungle
a71c6c03b02a15674fac0995d120f5c2180e8767
plugin/floo/sublime.py
plugin/floo/sublime.py
from collections import defaultdict import time TIMEOUTS = defaultdict(list) def windows(*args, **kwargs): return [] def set_timeout(func, timeout, *args, **kwargs): then = time.time() + timeout TIMEOUTS[then].append(lambda: func(*args, **kwargs)) def call_timeouts(): now = time.time() to_re...
from collections import defaultdict import time TIMEOUTS = defaultdict(list) def windows(*args, **kwargs): return [] def set_timeout(func, timeout, *args, **kwargs): then = time.time() + (timeout / 1000.0) TIMEOUTS[then].append(lambda: func(*args, **kwargs)) def call_timeouts(): now = time.time(...
Fix off by 1000 error
Fix off by 1000 error
Python
apache-2.0
Floobits/floobits-neovim,Floobits/floobits-neovim-old,Floobits/floobits-vim
d0e7c8ec73e36d6391ec57802e6186608196901a
aldryn_apphooks_config/templatetags/namespace_extras.py
aldryn_apphooks_config/templatetags/namespace_extras.py
# -*- coding: utf-8 -*- from django import template from django.core import urlresolvers from ..utils import get_app_instance register = template.Library() @register.simple_tag(takes_context=True) def namespace_url(context, view_name, *args, **kwargs): """ Returns an absolute URL matching given view with ...
# -*- coding: utf-8 -*- from django import template from django.core import urlresolvers from ..utils import get_app_instance register = template.Library() @register.simple_tag(takes_context=True) def namespace_url(context, view_name, *args, **kwargs): """ Returns an absolute URL matching given view with ...
Use string.format for performance reasons
Use string.format for performance reasons
Python
bsd-3-clause
aldryn/aldryn-apphooks-config,aldryn/aldryn-apphooks-config,aldryn/aldryn-apphooks-config
d68bdfe0b89137efc6b0c167663a0edf7decb4cd
nashvegas/management/commands/syncdb.py
nashvegas/management/commands/syncdb.py
from django.core.management import call_command from django.core.management.commands.syncdb import Command as SyncDBCommand class Command(SyncDBCommand): def handle_noargs(self, **options): # Run migrations first if options.get('database'): databases = [options.get('database')] ...
from django.core.management import call_command from django.core.management.commands.syncdb import Command as SyncDBCommand class Command(SyncDBCommand): def handle_noargs(self, **options): # Run migrations first if options.get("database"): databases = [options.get("database")] ...
Update style to be consistent with project
Update style to be consistent with project
Python
mit
dcramer/nashvegas,iivvoo/nashvegas,paltman/nashvegas,paltman-archive/nashvegas,jonathanchu/nashvegas
6c98f48acd3cc91faeee2d6e24784275eedbd1ea
saw-remote-api/python/tests/saw/test_basic_java.py
saw-remote-api/python/tests/saw/test_basic_java.py
import unittest from pathlib import Path import saw_client as saw from saw_client.jvm import Contract, java_int, cryptol class Add(Contract): def __init__(self) -> None: super().__init__() def specification(self) -> None: x = self.fresh_var(java_int, "x") y = self.fresh_var(java_int,...
import unittest from pathlib import Path import saw_client as saw from saw_client.jvm import Contract, java_int, cryptol class Add(Contract): def __init__(self) -> None: super().__init__() def specification(self) -> None: x = self.fresh_var(java_int, "x") y = self.fresh_var(java_int,...
Test assumption, composition for RPC Java proofs
Test assumption, composition for RPC Java proofs
Python
bsd-3-clause
GaloisInc/saw-script,GaloisInc/saw-script,GaloisInc/saw-script,GaloisInc/saw-script,GaloisInc/saw-script
36e034749e8f99e457f5f272d886577e41bb0fb2
services/ingest-file/ingestors/email/outlookpst.py
services/ingest-file/ingestors/email/outlookpst.py
import logging from followthemoney import model from ingestors.ingestor import Ingestor from ingestors.support.temp import TempFileSupport from ingestors.support.shell import ShellSupport from ingestors.support.ole import OLESupport from ingestors.directory import DirectoryIngestor log = logging.getLogger(__name__) ...
import logging from followthemoney import model from ingestors.ingestor import Ingestor from ingestors.support.temp import TempFileSupport from ingestors.support.shell import ShellSupport from ingestors.support.ole import OLESupport from ingestors.directory import DirectoryIngestor log = logging.getLogger(__name__) ...
Make outlook emit single files
Make outlook emit single files
Python
mit
pudo/aleph,alephdata/aleph,alephdata/aleph,alephdata/aleph,pudo/aleph,alephdata/aleph,alephdata/aleph,pudo/aleph
e7f1c49216a7b609dbe8ea283cdf689cfa575f85
openacademy/model/openacademy_course.py
openacademy/model/openacademy_course.py
from openerp import models, fields, api ''' This module create model of Course ''' class Course(models.Model): ''' This class create model of Course ''' _name = 'openacademy.course' # Model odoo name name = fields.Char(string='Title', required=True) description = fields.Text(string='Descrip...
from openerp import api, models, fields, api ''' This module create model of Course ''' class Course(models.Model): ''' This class create model of Course ''' _name = 'openacademy.course' # Model odoo name name = fields.Char(string='Title', required=True) description = fields.Text(string='De...
Modify copy method into inherit
[REF] openacademy: Modify copy method into inherit
Python
apache-2.0
maitaoriana/openacademy-project
4b62f6545dd962ad4b323454901ccf12a7ce9910
pyelevator/elevator.py
pyelevator/elevator.py
from .base import Client class RangeIter(object): def __init__(self, range_datas): self._container = range_datas if self._valid_range(range_datas) else None def _valid_range(self, range_datas): if (not isinstance(range_datas, tuple) or any(not isinstance(pair, tuple) for pair in r...
from .base import Client class RangeIter(object): def __init__(self, range_datas): self._container = range_datas if self._valid_range(range_datas) else None def _valid_range(self, range_datas): if (not isinstance(range_datas, (list, tuple)) or any(not isinstance(pair, (list, tuple...
Fix : range output datas format validation
Fix : range output datas format validation
Python
mit
oleiade/py-elevator
9c94c7c48f932e2134c2d520403fbfb09e464d95
pygameMidi_extended.py
pygameMidi_extended.py
#import pygame.midi.Output from pygame.midi import Output class Output(Output):#pygame.midi.Output): def set_pan(self, pan, channel): assert (0 <= channel <= 15) assert pan <= 127 self.write_short(0xB0 + channel, 0x0A, pan)
#import pygame.midi.Output from pygame.midi import Output class Output(Output):#pygame.midi.Output): def set_pan(self, pan, channel): assert (0 <= channel <= 15) assert pan <= 127 self.write_short(0xB0 + channel, 0x0A, pan) def set_volume(self, volume, channel): ...
Add Volume and Pitch methods
Add Volume and Pitch methods
Python
bsd-3-clause
RenolY2/py-playBMS
fe4d3f7f734c2d8c6a21932a50ad1d86519ef6ff
clowder/clowder/cli/diff_controller.py
clowder/clowder/cli/diff_controller.py
from cement.ext.ext_argparse import expose from clowder.cli.abstract_base_controller import AbstractBaseController class DiffController(AbstractBaseController): class Meta: label = 'diff' stacked_on = 'base' stacked_type = 'nested' description = 'Show git diff for projects' @...
from cement.ext.ext_argparse import expose from clowder.cli.abstract_base_controller import AbstractBaseController from clowder.commands.util import ( filter_groups, filter_projects_on_project_names, run_group_command, run_project_command ) from clowder.util.decorators import ( print_clowder_repo_s...
Add `clowder diff` logic to Cement controller
Add `clowder diff` logic to Cement controller
Python
mit
JrGoodle/clowder,JrGoodle/clowder,JrGoodle/clowder
c7046df0f24aadbeb8e491a9b61c6cc4e49e59c6
common/djangoapps/util/json_request.py
common/djangoapps/util/json_request.py
from functools import wraps import copy import json def expect_json(view_function): """ View decorator for simplifying handing of requests that expect json. If the request's CONTENT_TYPE is application/json, parses the json dict from request.body, and updates request.POST with the contents. """ ...
from functools import wraps import copy import json def expect_json(view_function): """ View decorator for simplifying handing of requests that expect json. If the request's CONTENT_TYPE is application/json, parses the json dict from request.body, and updates request.POST with the contents. """ ...
Make request.POST be only json content when using expect_json
Make request.POST be only json content when using expect_json
Python
agpl-3.0
ZLLab-Mooc/edx-platform,SivilTaram/edx-platform,xuxiao19910803/edx,cecep-edu/edx-platform,shurihell/testasia,eemirtekin/edx-platform,EduPepperPDTesting/pepper2013-testing,PepperPD/edx-pepper-platform,kxliugang/edx-platform,UXE/local-edx,raccoongang/edx-platform,romain-li/edx-platform,hmcmooc/muddx-platform,mtlchun/edx,...
1541af9052d9c12fb3d23832838fce69fcc02761
pywal/export_colors.py
pywal/export_colors.py
""" Export colors in various formats. """ import os import pathlib from pywal.settings import CACHE_DIR, TEMPLATE_DIR from pywal import util def template(colors, input_file): """Read template file, substitute markers and save the file elsewhere.""" template_file = pathlib.Path(TEMPLATE_DIR).joinpath(...
""" Export colors in various formats. """ import os import pathlib from pywal.settings import CACHE_DIR, TEMPLATE_DIR from pywal import util def template(colors, input_file): """Read template file, substitute markers and save the file elsewhere.""" template_file = pathlib.Path(TEMPLATE_DIR).joinpath(...
Convert colors to rgb for putty.
colors: Convert colors to rgb for putty.
Python
mit
dylanaraps/pywal,dylanaraps/pywal,dylanaraps/pywal
6fa924d73df148ad3cfe41b01e277d944071e4dd
equajson.py
equajson.py
#! /usr/bin/env python from __future__ import print_function import os import sys import json def pretty_print(equation): print(equation["description"]["terse"]) eqn_dict = equation["unicode-pretty-print"] equation_text = eqn_dict["multiline"] for line in equation_text: print(line) if "para...
#! /usr/bin/env python from __future__ import print_function import os import sys import json def pretty_print(equation): print(equation["description"]["terse"]) eqn_dict = equation["unicode-pretty-print"] equation_text = eqn_dict["multiline"] for line in equation_text: print(line) if "para...
Add a line between outputs.
Add a line between outputs.
Python
mit
nbeaver/equajson
8fb15f3a072d516e477449c2b751226494ee14c5
perfkitbenchmarker/benchmarks/__init__.py
perfkitbenchmarker/benchmarks/__init__.py
# Copyright 2014 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
# Copyright 2014 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
Fix a bug in dynamic benchmark loading.
Fix a bug in dynamic benchmark loading. perfkitbenchmarker/benchmarks/__init__.py used ImpImporter.load_module to import benchmarks, which caused an error when they were later imported directly by an import statement. Switched to 'importlib' to resolve.
Python
apache-2.0
GoogleCloudPlatform/PerfKitBenchmarker,lleszczu/PerfKitBenchmarker,GoogleCloudPlatform/PerfKitBenchmarker,msurovcak/PerfKitBenchmarker,tvansteenburgh/PerfKitBenchmarker,ksasi/PerfKitBenchmarker,juju-solutions/PerfKitBenchmarker,gablg1/PerfKitBenchmarker,juju-solutions/PerfKitBenchmarker,msurovcak/PerfKitBenchmarker,sye...
7b1a5cf088aa5842beffd25719ea0a1fa029345d
openacademy/model/openacademy_session.py
openacademy/model/openacademy_session.py
# -*- coding: utf-8 -*- from openerp import fields, models class Session(models.Model): _name = 'openacademy.session' name = fields.Char(required=True) start_date = fields.Date() duration = fields.Float(digits=(6, 2), help="Duration in days") seats = fields.Integer(string="Number of seats") in...
# -*- coding: utf-8 -*- from openerp import fields, models class Session(models.Model): _name = 'openacademy.session' name = fields.Char(required=True) start_date = fields.Date() duration = fields.Float(digits=(6, 2), help="Duration in days") seats = fields.Integer(string="Number of seats") i...
Add domain or and ilike
[REF] openacademy: Add domain or and ilike
Python
apache-2.0
GavyMG/openacademy-proyect
167ca3f2a91cd20f38b32ab204855a1e86785c67
st2common/st2common/constants/meta.py
st2common/st2common/constants/meta.py
# Copyright 2020 The StackStorm Authors. # Copyright 2019 Extreme Networks, Inc. # # 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 ...
# Copyright 2020 The StackStorm Authors. # Copyright 2019 Extreme Networks, Inc. # # 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 ...
Add a comment to custom yaml_safe_load() method.
Add a comment to custom yaml_safe_load() method.
Python
apache-2.0
StackStorm/st2,StackStorm/st2,Plexxi/st2,StackStorm/st2,nzlosh/st2,StackStorm/st2,Plexxi/st2,Plexxi/st2,Plexxi/st2,nzlosh/st2,nzlosh/st2,nzlosh/st2
7a281be50ba1fc59281a76470776fa9c8efdfd54
pijobs/scrolljob.py
pijobs/scrolljob.py
import scrollphat from pijobs.scrollphatjob import ScrollphatJob class ScrollJob(ScrollphatJob): def default_options(self): opts = { 'brightness': 2, 'interval': 0.1, 'sleep': 1.0, } return opts def init(self): self.set_brightness...
import scrollphat from pijobs.scrollphatjob import ScrollphatJob class ScrollJob(ScrollphatJob): def default_options(self): opts = { 'brightness': 2, 'interval': 0.1, 'sleep': 1.0, } return opts def init(self): self.set_brightness...
Add back rotatation for scroll job.
Add back rotatation for scroll job.
Python
mit
ollej/piapi,ollej/piapi
592ffbcd7fbbc29bfd377b5abadb39aa29f1c88d
foyer/tests/conftest.py
foyer/tests/conftest.py
import pytest @pytest.fixture(scope="session") def initdir(tmpdir): tmpdir.chdir()
import pytest @pytest.fixture(autouse=True) def initdir(tmpdir): tmpdir.chdir()
Switch from scope="session" to autouse=True
Switch from scope="session" to autouse=True
Python
mit
iModels/foyer,mosdef-hub/foyer,mosdef-hub/foyer,iModels/foyer