commit
stringlengths
40
40
subject
stringlengths
4
1.73k
repos
stringlengths
5
127k
old_file
stringlengths
2
751
new_file
stringlengths
2
751
new_contents
stringlengths
1
8.98k
old_contents
stringlengths
0
6.59k
license
stringclasses
13 values
lang
stringclasses
23 values
0235b749f73bf28d7d50bb482862a88a748c30ca
Test for fix to bug #110673: os.abspatth() now always returns os.getcwd() on Windows, if an empty path is specified. It previously did not if an empty path was delegated to win32api.GetFullPathName())
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
Lib/test/test_ntpath.py
Lib/test/test_ntpath.py
import ntpath import string import os errors = 0 def tester(fn, wantResult): fn = string.replace(fn, "\\", "\\\\") gotResult = eval(fn) if wantResult != gotResult: print "error!" print "evaluated: " + str(fn) print "should be: " + str(wantResult) print " returned: " + str(gotResult) print "" global err...
import ntpath import string errors = 0 def tester(fn, wantResult): fn = string.replace(fn, "\\", "\\\\") gotResult = eval(fn) if wantResult != gotResult: print "error!" print "evaluated: " + str(fn) print "should be: " + str(wantResult) print " returned: " + str(gotResult) print "" global errors erro...
mit
Python
7a8e5202198a7416464e5452e762042693116143
Test getsignal() and some error conditions
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
Lib/test/test_signal.py
Lib/test/test_signal.py
# Test the signal module from test.test_support import verbose, TestSkipped, TestFailed, vereq import signal import os, sys, time if sys.platform[:3] in ('win', 'os2') or sys.platform=='riscos': raise TestSkipped, "Can't test signal on %s" % sys.platform if verbose: x = '-x' else: x = '+x' pid = os.getpid...
# Test the signal module from test.test_support import verbose, TestSkipped, TestFailed import signal import os, sys, time if sys.platform[:3] in ('win', 'os2') or sys.platform=='riscos': raise TestSkipped, "Can't test signal on %s" % sys.platform if verbose: x = '-x' else: x = '+x' pid = os.getpid() # S...
mit
Python
3b22a8a8bf3149d4eff0ee0ca6abfb8127d8a9e9
add initial phase as an option
adrn/KingKong
kingkong/mockdata.py
kingkong/mockdata.py
# coding: utf-8 """ Generate mock data """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Third-party import numpy as np import gary.dynamics as gd # Project from .core import potential, radial_periods from .util import Quaternion __all__ = ['MockStream'] class Mo...
# coding: utf-8 """ Generate mock data """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Third-party import numpy as np import gary.dynamics as gd # Project from .core import potential, radial_periods from .util import Quaternion __all__ = ['MockStream'] class Mo...
mit
Python
e59971cfc3c745f92f18b4bd755f1c538e67aea6
Add the Google analytics user key (safe to share, as I understand) to deployment_settings.py
waseem18/oh-mainline,onceuponatimeforever/oh-mainline,sudheesh001/oh-mainline,eeshangarg/oh-mainline,campbe13/openhatch,SnappleCap/oh-mainline,moijes12/oh-mainline,Changaco/oh-mainline,ehashman/oh-mainline,willingc/oh-mainline,ehashman/oh-mainline,vipul-sharma20/oh-mainline,ehashman/oh-mainline,campbe13/openhatch,eesha...
mysite/deployment_settings.py
mysite/deployment_settings.py
# This settings file contains custom settings used for the # main OpenHatch deployment. # # The live site needs some slightly different settings. # # So we start by loading the settings module in the same directory... from settings import * # ...and then we override some values. # Use MySQL in production DATABASES['de...
# This settings file contains custom settings used for the # main OpenHatch deployment. # # The live site needs some slightly different settings. # # So we start by loading the settings module in the same directory... from settings import * # ...and then we override some values. # Use MySQL in production DATABASES['de...
agpl-3.0
Python
b91124c030241e1a9233b6edcff7c5937ea6c31b
Use _attr_attribution in meteoclimatic (#61898)
toddeye/home-assistant,toddeye/home-assistant,w1ll1am23/home-assistant,GenericStudent/home-assistant,GenericStudent/home-assistant,w1ll1am23/home-assistant,rohitranjan1991/home-assistant,rohitranjan1991/home-assistant,home-assistant/home-assistant,nkgilley/home-assistant,home-assistant/home-assistant,mezz64/home-assist...
homeassistant/components/meteoclimatic/sensor.py
homeassistant/components/meteoclimatic/sensor.py
"""Support for Meteoclimatic sensor.""" from homeassistant.components.sensor import SensorEntity, SensorEntityDescription from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant from homeassistant.helpers.device_registry import DeviceEntryType from homeassistant.helpers.entity ...
"""Support for Meteoclimatic sensor.""" from homeassistant.components.sensor import SensorEntity, SensorEntityDescription from homeassistant.config_entries import ConfigEntry from homeassistant.const import ATTR_ATTRIBUTION from homeassistant.core import HomeAssistant from homeassistant.helpers.device_registry import D...
apache-2.0
Python
99ad785d0a0d174da0d3a68169ba543565e6e69a
Adjust setup type hints in mqtt (#72227)
nkgilley/home-assistant,mezz64/home-assistant,w1ll1am23/home-assistant,w1ll1am23/home-assistant,nkgilley/home-assistant,mezz64/home-assistant,toddeye/home-assistant,toddeye/home-assistant
homeassistant/components/mqtt/vacuum/__init__.py
homeassistant/components/mqtt/vacuum/__init__.py
"""Support for MQTT vacuums.""" from __future__ import annotations import functools import voluptuous as vol from homeassistant.components import vacuum from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant from homeassistant.helpers.entity_platform import AddEntitiesCallb...
"""Support for MQTT vacuums.""" import functools import voluptuous as vol from homeassistant.components import vacuum from ..mixins import async_setup_entry_helper, async_setup_platform_helper from .schema import CONF_SCHEMA, LEGACY, MQTT_VACUUM_SCHEMA, STATE from .schema_legacy import ( DISCOVERY_SCHEMA_LEGACY,...
apache-2.0
Python
6fd3ae28f5d08a6c86fb5f954110e35467cd51ac
Fix PEP 8 issues in gpickle.py
ionanrozenfeld/networkx,jcurbelo/networkx,ltiao/networkx,jni/networkx,aureooms/networkx,bzero/networkx,harlowja/networkx,dhimmel/networkx,blublud/networkx,beni55/networkx,harlowja/networkx,chrisnatali/networkx,sharifulgeo/networkx,nathania/networkx,debsankha/networkx,RMKD/networkx,kernc/networkx,dmoliveira/networkx,jak...
networkx/readwrite/gpickle.py
networkx/readwrite/gpickle.py
""" ************** Pickled Graphs ************** Read and write NetworkX graphs as Python pickles. "The pickle module implements a fundamental, but powerful algorithm for serializing and de-serializing a Python object structure. "Pickling" is the process whereby a Python object hierarchy is converted into a byte strea...
""" ************** Pickled Graphs ************** Read and write NetworkX graphs as Python pickles. "The pickle module implements a fundamental, but powerful algorithm for serializing and de-serializing a Python object structure. "Pickling" is the process whereby a Python object hierarchy is converted into a byte strea...
bsd-3-clause
Python
99e4557eabf1434708d21d79b75994ce0827c440
Add special task id to test source
tadashi-aikawa/tina
test/test_app.py
test/test_app.py
# -*- coding: utf-8 -*- import json import app WORK_BEGIN_TASK = 72824136 WORK_END_TASK = 73847457 def test(): body = { "event_name": "item:completed", "event_data": { "id": WORK_END_TASK, "content": u'TINA テスト', "labels": [652234], "project_id": 1...
# -*- coding: utf-8 -*- import json import app WORK_END_TASK = 73847457 def test(): body = { "event_name": "item:completed", "event_data": { "id": 85570464, "content": u'TINA テスト', "labels": [652234], "project_id": 156051149 } } wi...
mit
Python
49adeda78c79756fe1cc71e697fb367c16d18d2c
Use mock.create_autospec on mocked interfaces
sigmavirus24/urllib3,urllib3/urllib3,urllib3/urllib3,sigmavirus24/urllib3
test/test_ssl.py
test/test_ssl.py
import mock import pytest import socket from six import b from urllib3.util import ssl_ from urllib3.exceptions import SNIMissingWarning @pytest.mark.parametrize('addr', [ '::1', '::', '127.0.0.1', '8.8.8.8', b('127.0.0.1') ]) def test_is_ipaddress_true(addr): assert ssl_.is_ipaddress(addr) ...
import mock import pytest from six import b from urllib3.util import ssl_ from urllib3.exceptions import SNIMissingWarning @pytest.mark.parametrize('addr', [ '::1', '::', '127.0.0.1', '8.8.8.8', b('127.0.0.1') ]) def test_is_ipaddress_true(addr): assert ssl_.is_ipaddress(addr) @pytest.mark.p...
mit
Python
b1c59a2cbbebc8b31e6d67b0315d11ec59fd3d61
refactor assert_arrays_equal, create "compare_arrays"
timo/zasim,timo/zasim
test/testutil.py
test/testutil.py
def generate_pretty_printed_comparison(arr1, arr2): """return a pretty-printed comparison of two arrays as well as its equality: (equal, l1, mid, l2)""" equal = True l1, mid, l2 = "arr1 ", " ", "arr2 " for i in range(len(arr1)): if arr1[i] != arr2[i]: equal = False ...
def assert_arrays_equal(arr1, arr2): """assert the equality of two arrays. highlights different array cells if they differ. outputs the array if they are the same""" assert len(arr1) == len(arr2), "array lengths don't match" equal = True l1, mid, l2 = "arr1 ", " ", "arr2 " for i in rang...
bsd-3-clause
Python
76a9606c06a7767dccbcf600512f32803977157d
Allow Time.hour to be 24 for TAF
StephenOrJames/aviation_weather,StephenOrJames/aviation
aviation_weather/components/time.py
aviation_weather/components/time.py
import re from aviation_weather.components import Component from aviation_weather.exceptions import TimeDecodeError class Time(Component): """The Time class represents the time and date associated with the weather. Attributes: day (int): The day associated with the weather. hour (int): The h...
import re from aviation_weather.components import Component from aviation_weather.exceptions import TimeDecodeError class Time(Component): """The Time class represents the time and date associated with the weather. Attributes: day (int): The day associated with the weather. hour (int): The h...
mit
Python
7e6b9cf02b956d014303e0dd769488d179fea074
Add option for showing help texts
ulfalizer/Kconfiglib,ulfalizer/Kconfiglib
listnewconfig.py
listnewconfig.py
#!/usr/bin/env python # Copyright (c) 2018-2019, Ulf Magnusson # SPDX-License-Identifier: ISC """ Lists all user-modifiable symbols that are not given a value in the configuration file. Usually, these are new symbols that have been added to the Kconfig files. The default configuration filename is '.config'. A differ...
#!/usr/bin/env python # Copyright (c) 2018-2019, Ulf Magnusson # SPDX-License-Identifier: ISC """ List all user-modifiable symbols that are not given a value in the configuration file. Usually, these are new symbols that have been added to the Kconfig files. The default configuration filename is '.config'. A differe...
isc
Python
7d13c6efb9a55e4f698fea124074c3aefcc2a5a4
Reset wildcard
XereoNet/SpaceGDN,MCProHosting/SpaceGDN,XereoNet/SpaceGDN,MCProHosting/SpaceGDN,MCProHosting/SpaceGDN,XereoNet/SpaceGDN
loader/loader.py
loader/loader.py
import os, yggdrasil, sys from interfaces import * from gdn import app from gdn.models import Version, Build _path = os.path.dirname(os.path.realpath(__file__)) def loadSources(): import glob, json files = glob.glob(_path + '/../sources/*.json') output = [] for f in files: with open(f) as handle: output.a...
import os, yggdrasil, sys from interfaces import * from gdn import app from gdn.models import Version, Build _path = os.path.dirname(os.path.realpath(__file__)) def loadSources(): import glob, json files = glob.glob(_path + '/../sources/creeperrepo.json') output = [] for f in files: with open(f) as handle: ...
agpl-3.0
Python
49b89613f6762d3ff88c321072594bd7e72f0768
Choose a proper data structure
alessio/simple-spider
crawler.py
crawler.py
from __future__ import print_function import argparse from collections import defaultdict from functools import partial import json import os import sys import scrapy from scrapy.crawler import CrawlerProcess PROGNAME = os.path.basename(sys.argv[0]) class WebSpider(scrapy.Spider): """ Scrape a webpage looki...
from __future__ import print_function import argparse import json import os import sys import scrapy from scrapy.crawler import CrawlerProcess PROGNAME = os.path.basename(sys.argv[0]) class WebSpider(scrapy.Spider): """ Scrape a webpage looking for 'a', 'area', 'img', and 'script' tags. Handle the follo...
mit
Python
fe2c146335a4d61c76259c429694630876799218
Add available params in subnet pools client's comment
sebrandon1/tempest,Juniper/tempest,masayukig/tempest,sebrandon1/tempest,masayukig/tempest,openstack/tempest,cisco-openstack/tempest,vedujoshi/tempest,Tesora/tesora-tempest,cisco-openstack/tempest,Tesora/tesora-tempest,vedujoshi/tempest,Juniper/tempest,openstack/tempest
tempest/lib/services/network/subnetpools_client.py
tempest/lib/services/network/subnetpools_client.py
# Copyright 2015 NEC Corporation. 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 ...
# Copyright 2015 NEC Corporation. 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 ...
apache-2.0
Python
cb8a2bc473d324a95d6dee15d500e558ad03db63
change the time to 3 minutes
elixirhub/events-portal-scraping-scripts
ScheduleSyncTwoSolrs.py
ScheduleSyncTwoSolrs.py
__author__ = 'chuqiao' from apscheduler.schedulers.blocking import BlockingScheduler import logging import SyncSolr import sys def logger(): """ Function that initialises logging system """ global logger # create logger with 'syncsolr' logger = logging.getLogger('updatesolr') logger.se...
__author__ = 'chuqiao' from apscheduler.schedulers.blocking import BlockingScheduler import logging import SyncSolr import sys def logger(): """ Function that initialises logging system """ global logger # create logger with 'syncsolr' logger = logging.getLogger('updatesolr') logger.se...
mit
Python
07420e034cc28a87c563cacaad24ada0be28659f
Revise citation email
jeffreyliu3230/osf.io,ticklemepierce/osf.io,jnayak1/osf.io,dplorimer/osf,GaryKriebel/osf.io,HarryRybacki/osf.io,arpitar/osf.io,caseyrollins/osf.io,mluo613/osf.io,sloria/osf.io,kch8qx/osf.io,mluke93/osf.io,ticklemepierce/osf.io,billyhunt/osf.io,TomHeatwole/osf.io,monikagrabowska/osf.io,KAsante95/osf.io,GageGaskins/osf.i...
scripts/impute_names.py
scripts/impute_names.py
""" Email users to verify citation information. """ from framework.auth.utils import parse_name from framework.email.tasks import send_email from website.app import init_app from website import models from website import settings #app = init_app('website.settings', set_backends=True, routes=True) email_template = u...
""" Email users to verify citation information. """ from framework.auth.utils import parse_name from framework.email.tasks import send_email from website.app import init_app from website import models from website import settings app = init_app('website.settings', set_backends=True, routes=True) email_template = ''...
apache-2.0
Python
f27643b29b7dbcddbfcde8016ea991c2c88be2c5
Undo bytes conversion
adamtheturtle/vws-python,adamtheturtle/vws-python
src/vws/_request_utils.py
src/vws/_request_utils.py
""" Utilities for making requests to Vuforia. Based on Python examples from https://developer.vuforia.com/downloads/samples. """ import hashlib import hmac import base64 def compute_hmac_base64(key: bytes, data: bytes) -> bytes: """Return the Base64 encoded HMAC-SHA1 using the provide key""" hashed = hmac.n...
""" Utilities for making requests to Vuforia. Based on Python examples from https://developer.vuforia.com/downloads/samples. """ import hashlib import hmac import base64 def compute_hmac_base64(key: bytes, data: bytes) -> bytes: """Return the Base64 encoded HMAC-SHA1 using the provide key""" hashed = hmac.n...
mit
Python
9f6eddf1799f372f21a4dbdc44adf669d3e1fdc0
Update AlldebridCom.py
vuolter/pyload,vuolter/pyload,vuolter/pyload
module/plugins/hooks/AlldebridCom.py
module/plugins/hooks/AlldebridCom.py
# -*- coding: utf-8 -*- # should be working from module.network.RequestFactory import getURL from module.plugins.internal.MultiHoster import MultiHoster class AlldebridCom(MultiHoster): __name__ = "AlldebridCom" __version__ = "0.13" __type__ = "hook" __config__ = [("activated", "bool", "Activated",...
# -*- coding: utf-8 -*- # should be working from module.network.RequestFactory import getURL from module.plugins.internal.MultiHoster import MultiHoster class AlldebridCom(MultiHoster): __name__ = "AlldebridCom" __version__ = "0.13" __type__ = "hook" __config__ = [("activated", "bool", "Activated",...
agpl-3.0
Python
ffbe86910a062103c22502cf3b12d75c0967c4dc
add manual
Impactstory/oadoi,Impactstory/oadoi,Impactstory/oadoi,Impactstory/sherlockoa,Impactstory/sherlockoa
emailer.py
emailer.py
import os import jinja2 import base64 import sendgrid import re from sendgrid.helpers.mail.mail import Email from sendgrid.helpers.mail.mail import Content from sendgrid.helpers.mail.mail import Mail from sendgrid.helpers.mail.mail import Attachment from sendgrid.helpers.mail.mail import Personalization def create_em...
import os import jinja2 import base64 import sendgrid import re from sendgrid.helpers.mail.mail import Email from sendgrid.helpers.mail.mail import Content from sendgrid.helpers.mail.mail import Mail from sendgrid.helpers.mail.mail import Attachment from sendgrid.helpers.mail.mail import Personalization def create_em...
mit
Python
4d08e1a694576f1b7d74f1dcd81d1efe813b4b03
fix self.len reference - from Jeff Nathan <jeff@snort.org>
FunctionAnalysis/dpkt,edisona/dpkt,insomniacslk/dpkt,af001/dpkt,mennis/dpkt,tgoodyear/dpkt,afghanistanyn/dpkt,warjiang/dpkt,djhenderson/dpkt,DamionWaltermeyer/dpkt,Alwnikrotikz/dpkt,Turkingwang/dpkt,tthtlc/dpkt,GTiroadkill/dpkt,lzp819739483/dpkt,xldrx/dpkt
dpkt/ah.py
dpkt/ah.py
# $Id$ """Authentication Header.""" import dpkt class AH(dpkt.Packet): __hdr__ = ( ('nxt', 'B', 0), ('len', 'B', 0), # payload length ('rsvd', 'H', 0), ('spi', 'I', 0), ('seq', 'I', 0) ) auth = '' def unpack(self, buf): dpkt.Packet.unpack(self, buf)...
# $Id$ """Authentication Header.""" import dpkt class AH(dpkt.Packet): __hdr__ = ( ('nxt', 'B', 0), ('len', 'B', 0), # payload length ('rsvd', 'H', 0), ('spi', 'I', 0), ('seq', 'I', 0) ) auth = '' def unpack(self, buf): dpkt.Packet.unpack(self, buf)...
bsd-3-clause
Python
9d232bd156f3b51e898485c97dd7f1b744be4017
Fix for unicose and cookies from issue #553
spaceone/pyjs,Hasimir/pyjs,Hasimir/pyjs,spaceone/pyjs,anandology/pyjamas,minghuascode/pyj,lancezlin/pyjs,lancezlin/pyjs,Hasimir/pyjs,pyjs/pyjs,lancezlin/pyjs,anandology/pyjamas,anandology/pyjamas,spaceone/pyjs,minghuascode/pyj,pombredanne/pyjs,gpitel/pyjs,pyjs/pyjs,minghuascode/pyj,pyjs/pyjs,gpitel/pyjs,Hasimir/pyjs,po...
library/pyjamas/Cookies.py
library/pyjamas/Cookies.py
# This is the gtk-dependent Cookies module. # For the pyjamas/javascript version, see platform/CookiesPyJS.py from __pyjamas__ import JS, doc import pyjd if pyjd.is_desktop: from Cookie import SimpleCookie import urllib import datetime from string import strip def getCookie(key): return getCookie2...
# This is the gtk-dependent Cookies module. # For the pyjamas/javascript version, see platform/CookiesPyJS.py from __pyjamas__ import JS, doc import pyjd if pyjd.is_desktop: from Cookie import SimpleCookie import urllib import datetime from string import strip def getCookie(key): return getCookie2...
apache-2.0
Python
c74598a332f54ce45c60fb681126fe68a174fc25
Add line break before message
Empiria/matador
oracle_sql.py
oracle_sql.py
#!/usr/bin/env python3 """ Script to execute an sql script against an oracle database using the sqlplus client. It can be used standalone or from within a sublime text build configuration. Place this script in a directory included in the PATH environment variable. On Windows, add .PY to the PATHEXT variable. For Sub...
#!/usr/bin/env python3 """ Script to execute an sql script against an oracle database using the sqlplus client. It can be used standalone or from within a sublime text build configuration. Place this script in a directory included in the PATH environment variable. On Windows, add .PY to the PATHEXT variable. For Sub...
mit
Python
16d84b8478a5ffdc01ff57ce190fbc357b686335
add header
YuiJL/myweblog,YuiJL/myweblog,YuiJL/myweblog
www/app.py
www/app.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'Jiayi Li' import logging; logging.basicConfig(level=logging.INFO) import asyncio, os, json, time from datetime import datetime from aiohttp import web def index(request): return web.Response(body=b'<h1>Welcome!</h1>') async def init(loop): app ...
import logging; logging.basicConfig(level=logging.INFO) import asyncio, os, json, time from datetime import datetime from aiohttp import web def index(request): return web.Response(body=b'<h1>Welcome!</h1>') async def init(loop): app = web.Application(loop=loop) app.router.add_route('GET', '/', index) ...
mit
Python
f2eb965604ef704d1ffc1a79acaba8b8c58e204b
Update ~script.py (#990)
TheAlgorithms/Python
~script.py
~script.py
""" This is a simple script that will scan through the current directory and generate the corresponding DIRECTORY.md file, can also specify files or folders to be ignored. """ import os # Target URL (master) URL = "https://github.com/TheAlgorithms/Python/blob/master/" def tree(d, ignores, ignores_ext): return _...
""" This is a simple script that will scan through the current directory and generate the corresponding DIRECTORY.md file, can also specify files or folders to be ignored. """ import os # Target URL (master) URL = "https://github.com/TheAlgorithms/Python/blob/master/" def tree(d, ignores, ignores_ext): return _...
mit
Python
f6fa0a637489514863aff6b782e81da52063455c
add at least three StorefrontItems
liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin
meinberlin/apps/cms/models/storefronts.py
meinberlin/apps/cms/models/storefronts.py
from django.db import models from modelcluster.fields import ParentalKey from modelcluster.models import ClusterableModel from wagtail.wagtailadmin import edit_handlers from wagtail.wagtailadmin.edit_handlers import FieldPanel from wagtail.wagtailimages.edit_handlers import ImageChooserPanel from wagtail.wagtailsnippet...
from django.db import models from modelcluster.fields import ParentalKey from modelcluster.models import ClusterableModel from wagtail.wagtailadmin import edit_handlers from wagtail.wagtailadmin.edit_handlers import FieldPanel from wagtail.wagtailimages.edit_handlers import ImageChooserPanel from wagtail.wagtailsnippet...
agpl-3.0
Python
2c5f000945dd56ff7836943ed5d762512804a8a2
Update example.
Geoion/Tornado-MySQL,PyMySQL/Tornado-MySQL,mosquito/Tornado-MySQL,aio-libs/aiomysql,pulsar314/Tornado-MySQL
example.py
example.py
#!/usr/bin/env python from __future__ import print_function from tornado import ioloop, gen import tornado_mysql @gen.coroutine def main(): conn = yield tornado_mysql.connect(host='127.0.0.1', port=3306, user='root', passwd='', db='mysql') cur = conn.cursor() yield cur.execute("SELECT Host,User FROM user"...
#!/usr/bin/env python from __future__ import print_function import pymysql conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd='', db='mysql') cur = conn.cursor() cur.execute("SELECT Host,User FROM user") print(cur.description) print() for row in cur: print(row) cur.close() conn.close()
mit
Python
9aa0d32b4f9fa4b849ede438083f170ede6d61dd
Add support for plain-text files
mwilliamson/mash
mash/__init__.py
mash/__init__.py
import os import os.path import sys import mash.rst import shutil import re import mash.links import simplejson as json def mkdir_p(path): if not os.path.isdir(path): os.makedirs(path) def generate(template_path, source_dir, static_dir, target_dir): shutil.copytree(static_dir, target_dir) tem...
import os import os.path import sys import mash.rst import shutil import re import mash.links import simplejson as json def mkdir_p(path): if not os.path.isdir(path): os.makedirs(path) def generate(template_path, source_dir, static_dir, target_dir): shutil.copytree(static_dir, target_dir) tem...
bsd-2-clause
Python
a76db0bbbe3c98c18e3a4c7f89dc1423a9b75b08
Improve the fabric script.
uq-eresearch/uqam,uq-eresearch/uqam,uq-eresearch/uqam,uq-eresearch/uqam
fabfile.py
fabfile.py
from fabric.api import env, local, run, put, cd env.user = 'uqdayers' env.gateway = 'gladys' env.hosts = ['anthropology'] def sshagent_run(cmd): """ Helper function. Runs a command with SSH agent forwarding enabled. Note:: Fabric (and paramiko) can't forward your SSH agent. This helper use...
from fabric.api import env, local, run env.user = 'uqdayers' env.gateway = 'gladys' env.hosts = ['anthropology'] def sshagent_run(cmd): """ Helper function. Runs a command with SSH agent forwarding enabled. Note:: Fabric (and paramiko) can't forward your SSH agent. This helper uses your sy...
bsd-3-clause
Python
8769292b9935bc3e6a9f82250c6f3723cadfc92c
stop and start uwsgi explicitly
pld/bamboo,SEL-Columbia/bamboo,pld/bamboo,SEL-Columbia/bamboo,pld/bamboo,SEL-Columbia/bamboo
fabfile.py
fabfile.py
import os import sys from fabric.api import env, run, cd DEPLOYMENTS = { 'prod': { 'home': '/var/www/', 'host_string': 'bamboo@bamboo.io', 'virtual_env': 'bamboo', 'repo_name': 'current', 'project': 'bamboo', 'docs': 'docs', 'branc...
import os import sys from fabric.api import env, run, cd DEPLOYMENTS = { 'prod': { 'home': '/var/www/', 'host_string': 'bamboo@bamboo.io', 'virtual_env': 'bamboo', 'repo_name': 'current', 'project': 'bamboo', 'docs': 'docs', 'branc...
bsd-3-clause
Python
524bfdf0b95c6b509efdfe35288c04be6fcb8b93
Remove whitespace
nicole-a-tesla/meetup.pizza,nicole-a-tesla/meetup.pizza
meetup/models.py
meetup/models.py
from django.db import models from pizzaplace.models import PizzaPlace from django.core.validators import RegexValidator from meetup.services.meetup_api_lookup_agent import MeetupApiLookupAgent from django.core.exceptions import ValidationError from model_utils.models import TimeStampedModel def validate_urlname(link):...
from django.db import models from pizzaplace.models import PizzaPlace from django.core.validators import RegexValidator from meetup.services.meetup_api_lookup_agent import MeetupApiLookupAgent from django.core.exceptions import ValidationError from model_utils.models import TimeStampedModel def validate_urlname(link):...
mit
Python
a5e9ea93c391d7324515d803d35a2a580669b56e
Add logout url
Hackfmi/Diaphanum,Hackfmi/Diaphanum
members/views.py
members/views.py
# -*- coding: utf-8 -*- from django.shortcuts import render, redirect from django.http import HttpResponseRedirect from django.http import HttpResponse from django.contrib.auth import views from hackfmi.utils import json_view from .models import User from protocols.models import Protocol def homepage(request): ...
# -*- coding: utf-8 -*- from django.shortcuts import render, redirect from django.http import HttpResponseRedirect from django.http import HttpResponse from django.contrib.auth import views from hackfmi.utils import json_view from .models import User from protocols.models import Protocol def homepage(request): ...
mit
Python
26310541e8fc81652622339247659439fb369799
update logging
stevewoolley/IoT,stevewoolley/IoT
output_sub.py
output_sub.py
#!/usr/bin/env python import json import awsiot import logging import sys import time try: from gpiozero import DigitalOutputDevice except ImportError: logging.error("Unable to import gpiozero") pass def device(cmd): logging.info("device command: {}".format(cmd)) if args.pin is not None: ...
#!/usr/bin/env python import json import awsiot import logging import sys import time try: from gpiozero import DigitalOutputDevice except ImportError: logging.error("Unable to import gpiozero") pass def device(cmd): logging.info("device command: {}".format(cmd)) if args.pin is not None: ...
apache-2.0
Python
f9fae4682be92c469856447260a9f680f9b41b34
Copy config files instead of moving them.
cdriehuys/chmvh-website,cdriehuys/chmvh-website,cdriehuys/chmvh-website
fabfile.py
fabfile.py
from fabric.api import cd, run ACTIVATE_ENV = '. env/bin/activate' REMOTE_PROJECT_DIR = '/home/chathan/chmvh-website' required_packages = ( 'git', 'libjpeg-dev', 'libpq-dev', 'postgresql', 'postgresql-contrib', 'nginx', 'python3-dev', 'python3-pip', 'zlib1g-dev', ) def configure_gunicor...
from fabric.api import cd, run ACTIVATE_ENV = '. env/bin/activate' REMOTE_PROJECT_DIR = '/home/chathan/chmvh-website' required_packages = ( 'git', 'libjpeg-dev', 'libpq-dev', 'postgresql', 'postgresql-contrib', 'nginx', 'python3-dev', 'python3-pip', 'zlib1g-dev', ) def configure_gunicor...
mit
Python
7ecc832999e825f48c10fdcf3430321eda1bcfcc
Add docs and autodocs tasks
felix1m/pyspotify,kotamat/pyspotify,felix1m/pyspotify,jodal/pyspotify,kotamat/pyspotify,jodal/pyspotify,felix1m/pyspotify,kotamat/pyspotify,jodal/pyspotify,mopidy/pyspotify,mopidy/pyspotify
fabfile.py
fabfile.py
from fabric.api import execute, local, settings, task @task def preprocess_header(): local('cpp -nostdinc spotify/api.h > spotify/api.processed.h || true') @task def docs(): local('make -C docs/ html') @task def autodocs(): auto(docs) @task def test(): local('nosetests') @task def autotest(): ...
from fabric.api import execute, local, settings, task @task def preprocess_header(): local('cpp -nostdinc spotify/api.h > spotify/api.processed.h || true') @task def test(): local('nosetests') @task def autotest(): while True: local('clear') with settings(warn_only=True): e...
apache-2.0
Python
07918f97f3eccfa2e4ef4d81a08ca0ce594c1d4c
add first endpoint for student, returns placeholder name
janet/monkeys,janet/monkeys
monkeybrains/api/Student/endpoint.py
monkeybrains/api/Student/endpoint.py
from server import app from .model import Student @app.route('/') def show_entries(): ringo = Student.query.filter(Student.name_first == 'Ringo').one() import pdb; pdb.set_trace() return ringo.name_first
mit
Python
df8c02a7fe8b7f10df3ed549948fe589ff259922
Update serial.py
mecax/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,sstocker46/pyrobotlab,MyRobotLab/pyrobotlab,sstocker46/pyrobotlab,mecax/pyrobotlab,sstocker46/pyrobotlab
home/harland/serial.py
home/harland/serial.py
# testing serial commands to eddie control board # trying to read analog votages on eddie control board every time not just sometimes # the problem was extra characaters in the input receive buffer # Dec 16 2014 import time ser = Runtime.start("serial","Serial") ser.connect("COM4",115200, 8, 1, 0) #lights on in head...
# testing serial commands to eddie control board # trying to read analog votages on eddie control board evry time not just once import time #import serial ser = Runtime.start("serial","Serial") ser.connect("COM4",115200, 8, 1, 0) #lights on in head cycle lightpin = 1 for i in range(1,8): ser.write("HDLT " + str(lig...
apache-2.0
Python
0d01404d5d8c1c44d237bf2e3f9d56e54bf2164e
Make score a read-only field in the admin
carbn/huonot-uutiset,carbn/huonot-uutiset
huonotuutiset/admin.py
huonotuutiset/admin.py
from django.contrib import admin from .models import Site, NewsItem, Rule class SiteAdmin(admin.ModelAdmin): list_display = ('name', 'site_url', 'rss_url') ordering = ('name',) class NewsItemAdmin(admin.ModelAdmin): search_fields = ('title',) readonly_fields = ('score',) exclude = ('matches',) c...
from django.contrib import admin from .models import Site, NewsItem, Rule class SiteAdmin(admin.ModelAdmin): list_display = ('name', 'site_url', 'rss_url') ordering = ('name',) class NewsItemAdmin(admin.ModelAdmin): search_fields = ('title',) exclude = ('matches',) class RuleAdmin(admin.ModelAdmin):...
agpl-3.0
Python
47bcbce5baea4fe85684cbb0ecc1f031dc1e03e1
Fix Travis erroring
nagyistoce/geokey,nagyistoce/geokey,nagyistoce/geokey
local_settings.example/settings.py
local_settings.example/settings.py
import os.path from geokey.core.settings.dev import * # Database # https://docs.djangoproject.com/en/1.6/ref/settings/#databases DEFAULT_FROM_EMAIL = 'sender@example.com' ACCOUNT_EMAIL_VERIFICATION = 'none' DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', # Add 'postgresql_ps...
import os.path from geokey.core.settings.dev import * # Database # https://docs.djangoproject.com/en/1.6/ref/settings/#databases DEFAULT_FROM_EMAIL = 'sender@example.com' ACCOUNT_EMAIL_VERIFICATION = 'none' DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', # Add 'postgresql_ps...
apache-2.0
Python
8c8f40faec3b6cbb305bc4d130dc22275b4d5120
Correct python shebang
pmoris/go-tools
data-preprocessing/entrezTaxIDlookup.py
data-preprocessing/entrezTaxIDlookup.py
#!/usr/bin/env python # http://biopython.org/DIST/docs/tutorial/Tutorial.html import sys,csv, time from Bio import Entrez Entrez.email = 'pieter.moris@uantwerpen.be' with open(sys.argv[1],'r') as f: taxIDlist = [line.rstrip() for line in f] with open(sys.argv[2],'w') as o: writer = csv.writer(o,linetermina...
#!/usr/bin/env python3 # http://biopython.org/DIST/docs/tutorial/Tutorial.html import sys,csv, time from Bio import Entrez Entrez.email = 'pieter.moris@uantwerpen.be' with open(sys.argv[1],'r') as f: taxIDlist = [line.rstrip() for line in f] with open("taxonomyID.csv",'w') as o: writer = csv.writer(o,line...
mit
Python
0a679ab7346598b6006d2c63e8603e4b4940597c
fix typos
zchee/python-client,neovim/python-client,zchee/python-client,meitham/python-client,Shougo/python-client,Shougo/python-client,meitham/python-client,neovim/python-client
neovim/msgpack_rpc/msgpack_stream.py
neovim/msgpack_rpc/msgpack_stream.py
"""Msgpack handling in the event loop pipeline.""" import logging from msgpack import Packer, Unpacker from ..compat import unicode_errors_default logger = logging.getLogger(__name__) debug, info, warn = (logger.debug, logger.info, logger.warning,) class MsgpackStream(object): """Two-way msgpack stream that w...
"""Msgpack handling in the event loop pipeline.""" import logging from msgpack import Packer, Unpacker from ..compat import unicode_errors_default logger = logging.getLogger(__name__) debug, info, warn = (logger.debug, logger.info, logger.warning,) class MsgpackStream(object): """Two-way msgpack stream that w...
apache-2.0
Python
2c19aae516f90100e203ff75e573ebfb95ac21ee
Copy number on registration page
SeiryuZ/magnet,SeiryuZ/magnet,SeiryuZ/magnet
magnet/apps/users/forms.py
magnet/apps/users/forms.py
from crispy_forms.helper import FormHelper from crispy_forms.layout import Submit from django import forms from django.utils.translation import ugettext_lazy as _ from .models import User class UserCreationForm(forms.ModelForm): """A form for creating new users. Includes all the required fields, plus a repea...
from crispy_forms.helper import FormHelper from crispy_forms.layout import Submit from django import forms from django.utils.translation import ugettext_lazy as _ from .models import User class UserCreationForm(forms.ModelForm): """A form for creating new users. Includes all the required fields, plus a repea...
mit
Python
81d0df3a6bcd0887e5951336b75d6a7bd81dfe12
Make test_draw() more robust.
ionanrozenfeld/networkx,bzero/networkx,OrkoHunter/networkx,harlowja/networkx,aureooms/networkx,jakevdp/networkx,jcurbelo/networkx,ltiao/networkx,beni55/networkx,RMKD/networkx,debsankha/networkx,SanketDG/networkx,farhaanbukhsh/networkx,andnovar/networkx,harlowja/networkx,bzero/networkx,ghdk/networkx,bzero/networkx,aureo...
networkx/drawing/tests/test_pylab.py
networkx/drawing/tests/test_pylab.py
""" Unit tests for matplotlib drawing functions. """ import os from nose import SkipTest import networkx as nx class TestPylab(object): @classmethod def setupClass(cls): global plt try: import matplotlib as mpl mpl.use('PS',warn=False) import matplotli...
""" Unit tests for matplotlib drawing functions. """ import os from nose import SkipTest import networkx as nx class TestPylab(object): @classmethod def setupClass(cls): global plt try: import matplotlib as mpl mpl.use('PS',warn=False) import matplotli...
bsd-3-clause
Python
a00306faae043732824a63719337d91dd6d02abd
Fix if => elif on two more checks for format under test. BUG=none TEST=test/generator-output/gyptest-copies.py Review URL: http://codereview.chromium.org/267106
csulmone/gyp,csulmone/gyp,csulmone/gyp,csulmone/gyp
test/generator-output/gyptest-copies.py
test/generator-output/gyptest-copies.py
#!/usr/bin/env python """ Verifies file copies using an explicit build target of 'all'. """ import TestGyp test = TestGyp.TestGyp() test.writable(test.workpath('copies'), False) test.run_gyp('copies.gyp', '--generator-output=' + test.workpath('gypfiles'), chdir='copies') test.writable(te...
#!/usr/bin/env python """ Verifies file copies using an explicit build target of 'all'. """ import TestGyp test = TestGyp.TestGyp() test.writable(test.workpath('copies'), False) test.run_gyp('copies.gyp', '--generator-output=' + test.workpath('gypfiles'), chdir='copies') test.writable(te...
bsd-3-clause
Python
89f60c238309a5735c4bf1bc7e3344828ab88e4d
Update compat.py
cxhernandez/ipymol
src/ipymol/compat.py
src/ipymol/compat.py
try: from PIL import Image except ImportError: import Image
try: import Image except ImportError: from PIL import Image
mit
Python
2db0cab8c9eebcb6f5a029fa1bf93d118b9089d8
Add middleware classes to test settings
orbitvu/django-mama-cas,jbittel/django-mama-cas,forcityplatform/django-mama-cas,harlov/django-mama-cas,harlov/django-mama-cas,jbittel/django-mama-cas,forcityplatform/django-mama-cas,orbitvu/django-mama-cas
mama_cas/tests/settings.py
mama_cas/tests/settings.py
DEBUG = False TEMPLATE_DEBUG = DEBUG TIME_ZONE = 'UTC' USE_TZ = True SECRET_KEY = 'khhmbe6*m$ix_h0t%)@$4mh%a2)2f=4-fyv*-=^6=m**p+=f7n' ROOT_URLCONF = 'mama_cas.urls' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } PASSWORD_HASHERS = ( 'django.c...
DEBUG = False TEMPLATE_DEBUG = DEBUG TIME_ZONE = 'UTC' USE_TZ = True SECRET_KEY = 'khhmbe6*m$ix_h0t%)@$4mh%a2)2f=4-fyv*-=^6=m**p+=f7n' ROOT_URLCONF = 'mama_cas.urls' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } PASSWORD_HASHERS = ( 'django.c...
bsd-3-clause
Python
bd7f9e79ff4a30b2103874d0e5ceba8657b7f6ce
Fix monkey patch test condition.
mbrukman/flocker,achanda/flocker,mbrukman/flocker,mbrukman/flocker,AndyHuu/flocker,moypray/flocker,agonzalezro/flocker,1d4Nf6/flocker,agonzalezro/flocker,Azulinho/flocker,hackday-profilers/flocker,adamtheturtle/flocker,1d4Nf6/flocker,AndyHuu/flocker,AndyHuu/flocker,moypray/flocker,w4ngyi/flocker,w4ngyi/flocker,adamthet...
flocker/provision/test/test_ssh_monkeypatch.py
flocker/provision/test/test_ssh_monkeypatch.py
# Copyright Hybrid Logic Ltd. See LICENSE file for details. """ Tests for ``flocker.provision._ssh._monkeypatch``. """ from twisted.trial.unittest import SynchronousTestCase as TestCase from .._ssh._monkeypatch import _patch_7672_needed, patch_7672_applied class Twisted7672Tests(TestCase): """" Tests for `...
# Copyright Hybrid Logic Ltd. See LICENSE file for details. """ Tests for ``flocker.provision._ssh._monkeypatch``. """ from twisted.trial.unittest import SynchronousTestCase as TestCase from .._ssh._monkeypatch import _patch_7672_needed, patch_7672_applied class Twisted7672Tests(TestCase): """" Tests for `...
apache-2.0
Python
76e33d4dd9e5c0dfdce53e39ddfc355f76fc3657
use fb_github_project_workdir() for folly
facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift
build/fbcode_builder/specs/folly.py
build/fbcode_builder/specs/folly.py
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals def fbcode_builder_spec(builder): return { 'steps': [ # on macOS the fil...
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals def fbcode_builder_spec(builder): return { 'steps': [ # on macOS the fil...
apache-2.0
Python
13990c0b0fda1c55d5ae910049abac55265c939e
remove flask_debugtoolbar
jpush/jbox,jpush/jbox,jpush/jbox,jpush/jbox,jpush/jbox,jpush/jbox,jpush/jbox
Server/jbox/__init__.py
Server/jbox/__init__.py
from flask import Flask, render_template from flask_bootstrap import Bootstrap from flask_login import LoginManager from flask_moment import Moment from flask_sqlalchemy import SQLAlchemy from config import config bootstrap = Bootstrap() moment = Moment() db = SQLAlchemy() login_manager = LoginManager() login_manager...
from flask import Flask, render_template from flask_bootstrap import Bootstrap from flask_login import LoginManager from flask_moment import Moment from flask_sqlalchemy import SQLAlchemy from flask_debugtoolbar import DebugToolbarExtension from config import config bootstrap = Bootstrap() moment = Moment() db = SQLAl...
mit
Python
c81b680ee9ba6817e57ed14290ea07de9f0e6c1f
Refactor embeddings_to_embedding function
raviqqe/tensorflow-extenteten,raviqqe/tensorflow-extenteten
nn/embedding/embeddings_to_embedding.py
nn/embedding/embeddings_to_embedding.py
import tensorflow as tf from ..util import static_rank, funcname_scope from ..attention import attention_please from ..rnn import rnn @funcname_scope def embeddings_to_embedding(child_embeddings, *, context_vector_size, **rnn_hyper_...
import tensorflow as tf from ..util import static_rank, funcname_scope, dimension_indices from ..linear import linear from ..variable import variable from ..attention import attention_please from ..rnn import rnn @funcname_scope def embeddings_to_embedding(child_embeddings, *, ...
unlicense
Python
e666ad9f645d21e68350caa041dc257602f29109
Fix shared endpoint creation in multiple ways
globus/globus-cli,globus/globus-cli
globus_cli/services/transfer/endpoint/share.py
globus_cli/services/transfer/endpoint/share.py
import click from globus_cli.parsing import ( common_options, endpoint_create_and_update_params, ENDPOINT_PLUS_REQPATH) from globus_cli.helpers import print_json_response from globus_cli.services.transfer.activation import autoactivate from globus_cli.services.transfer.helpers import ( get_client, assemble_gen...
import click from globus_cli.parsing import ( common_options, endpoint_create_and_update_params, endpoint_id_arg) from globus_cli.helpers import print_json_response from globus_cli.services.transfer.helpers import ( get_client, assemble_generic_doc) @click.command('share', help='Create a new Share, hosted on...
apache-2.0
Python
6d1614c930ccdfa02d10d192616be484bfa7eb1e
remove chunked encoding after being explained what that means by @nickstenning, see: https://gist.github.com/1257451
USStateDept/FPA_Core,pudo/spendb,nathanhilbert/FPA_Core,openspending/spendb,pudo/spendb,USStateDept/FPA_Core,CivicVision/datahub,spendb/spendb,johnjohndoe/spendb,johnjohndoe/spendb,nathanhilbert/FPA_Core,openspending/spendb,CivicVision/datahub,openspending/spendb,nathanhilbert/FPA_Core,pudo/spendb,spendb/spendb,johnjoh...
openspending/lib/csvexport.py
openspending/lib/csvexport.py
import csv import sys from datetime import datetime from StringIO import StringIO from pylons.controllers.util import Response from openspending import model from openspending.lib.util import flatten def write_csv(entries, response): response.content_type = 'text/csv' #response.headers['Transfer-Encoding'] =...
import csv import sys from datetime import datetime from StringIO import StringIO from pylons.controllers.util import Response from openspending import model from openspending.lib.util import flatten def write_csv(entries, response): response.content_type = 'text/csv' response.headers['Transfer-Encoding'] = ...
agpl-3.0
Python
f8e7fce9483530fb76ed59e4fbe2937b3776baaf
Remove debug.
factorial-io/fabalicious,factorial-io/fabalicious
lib/methods/drush.py
lib/methods/drush.py
from base import BaseMethod from fabric.api import * from fabric.state import output, env from lib import configuration class DrushMethod(BaseMethod): @staticmethod def supports(methodName): return methodName == 'drush7' or methodName == 'drush8' def reset(self, config, **kwargs): with cd(env.config['si...
from base import BaseMethod from fabric.api import * from fabric.state import output, env from lib import configuration class DrushMethod(BaseMethod): @staticmethod def supports(methodName): return methodName == 'drush7' or methodName == 'drush8' def reset(self, config, **kwargs): with cd(env.config['si...
mit
Python
682ce4952e813d7e5d0baf67dfd8d00f7d344b66
Bump @graknlabs_client_java
lolski/grakn,graknlabs/grakn,graknlabs/grakn,graknlabs/grakn,lolski/grakn,lolski/grakn,graknlabs/grakn,lolski/grakn
dependencies/graknlabs/dependencies.bzl
dependencies/graknlabs/dependencies.bzl
# # GRAKN.AI - THE KNOWLEDGE GRAPH # Copyright (C) 2018 Grakn Labs Ltd # # 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 3 of the # License, or (at your option) any later v...
# # GRAKN.AI - THE KNOWLEDGE GRAPH # Copyright (C) 2018 Grakn Labs Ltd # # 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 3 of the # License, or (at your option) any later v...
agpl-3.0
Python
cc434ba5b59cc3c37b7945832bea531b6d6996c5
Update runworker.py
galeksandrp/travis-cron,galeksandrp/travis-cron,FiloSottile/travis-cron,FiloSottile/travis-cron,galeksandrp/travis-cron
travis_cron/crons/management/commands/runworker.py
travis_cron/crons/management/commands/runworker.py
from django.core.management.base import BaseCommand, CommandError from crons.models import Entry, Cronjob from time import sleep, time from travis_ping import travis_ping from traceback import print_exc def ping(entry): travis_token = entry.travis_token repository = entry.gh_project return travis_ping(trav...
from django.core.management.base import BaseCommand, CommandError from crons.models import Entry, Cronjob from time import sleep, time from travis_ping import travis_ping def ping(entry): travis_token = entry.travis_token repository = entry.gh_project return travis_ping(travis_token, repository) class Com...
mit
Python
b3f3e8120ad852540e42bdf976b2c60c5e74aeae
simplify CallbackTest in ADMM test
aringh/odl,kohr-h/odl,odlgroup/odl,aringh/odl,odlgroup/odl,kohr-h/odl
odl/test/solvers/nonsmooth/admm_test.py
odl/test/solvers/nonsmooth/admm_test.py
# Copyright 2014-2017 The ODL contributors # # This file is part of ODL. # # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at https://mozilla.org/MPL/2.0/. """Unit tests for ADMM.""" from __future__ ...
# Copyright 2014-2017 The ODL contributors # # This file is part of ODL. # # This Source Code Form is subject to the terms of the Mozilla Public License, # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at https://mozilla.org/MPL/2.0/. """Unit tests for ADMM.""" from __future__ ...
mpl-2.0
Python
c65c6f47951c3e94540c3d0da46d1dffffed5158
update md5.py
msopentechcn/open-hackathon,juniwang/open-hackathon,juniwang/open-hackathon,juniwang/open-hackathon,juniwang/open-hackathon,msopentechcn/open-hackathon,juniwang/open-hackathon,msopentechcn/open-hackathon,msopentechcn/open-hackathon,msopentechcn/open-hackathon,juniwang/open-hackathon,msopentechcn/open-hackathon
open-hackathon-client/src/client/md5.py
open-hackathon-client/src/client/md5.py
# -*- coding: utf-8 -*- """ This file is covered by the LICENSING file in the root of this project. """ import hashlib import sys sys.path.append("..") from client import app def encode(plaintext): m = hashlib.md5() origin = plaintext + app.config['SECRET_KEY'] m.update(origin.encode('utf8')) retur...
# -*- coding: utf-8 -*- """ This file is covered by the LICENSING file in the root of this project. """ import hashlib import sys sys.path.append("..") from client import app def encode(plaintext): m = hashlib.md5() origin = plaintext + app.config['SECRET_KEY'] m.update(origin.encode('utf8')) retur...
mit
Python
89bfcc11f311fd97140f43db3a7c41644125cfbe
add template for all formats
Moredread/taz-digiabo-linkgen
digiabo.py
digiabo.py
""" Taz digiabo download link generator Usage: digiabo.py [-d N | --days N] Options: -d N --days N number of days in the past to generate download links for [default: 1] """ from datetime import date, timedelta from docopt import docopt templates = [ "https://dl.taz.de/abo/{}_{:0=2}_{:0=2}.pdf", "https...
""" Taz digiabo download link generator Usage: digiabo.py [-d N | --days N] Options: -d N --days N number of days in the past to generate download links for [default: 1] """ from datetime import date, timedelta from docopt import docopt templates = [ "https://dl.taz.de/abo/taz_{}_{:0=2}_{:0=2}.epub", "...
bsd-2-clause
Python
31a960c3230ea08937c4ad78aa23a4cdf5382db4
update tests to use new host fixture
fgal/ceph-ansible,ceph/ceph-ansible,travmi/ceph-ansible,jtaleric/ceph-ansible,jtaleric/ceph-ansible,font/ceph-ansible,travmi/ceph-ansible,bengland2/ceph-ansible,fgal/ceph-ansible,bengland2/ceph-ansible,font/ceph-ansible,ceph/ceph-ansible
tests/functional/tests/mon/test_mons.py
tests/functional/tests/mon/test_mons.py
import pytest class TestMons(object): @pytest.mark.no_docker def test_ceph_mon_package_is_installed(self, node, host): assert host.package("ceph-mon").is_installed def test_mon_listens_on_6789(self, node, host): assert host.socket("tcp://%s:6789" % node["address"]).is_listening def ...
import pytest class TestMons(object): @pytest.mark.no_docker def test_ceph_mon_package_is_installed(self, node, Package): assert Package("ceph-mon").is_installed def test_mon_listens_on_6789(self, node, Socket): assert Socket("tcp://%s:6789" % node["address"]).is_listening def test_...
apache-2.0
Python
350e8bdcb9c6f3eace7839e5dc7270bfeb51e50f
Add more tests for Config
jakubplichta/grafana-dashboard-builder
tests/grafana_dashboards/test_config.py
tests/grafana_dashboards/test_config.py
# -*- coding: utf-8 -*- # Copyright 2015 grafana-dashboard-builder contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
# -*- coding: utf-8 -*- # Copyright 2015 grafana-dashboard-builder contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
apache-2.0
Python
7137efc8964bd91fa13e69af2cd3d1e13007d065
Make cppwinrt check SDK/References folder if using standard sdk location failed (#447)
flutter/buildroot,flutter/buildroot,flutter/buildroot,flutter/buildroot
build/win/generate_winrt_headers.py
build/win/generate_winrt_headers.py
#!/usr/bin/env python # Copyright 2014 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 os import shutil import subprocess import sys import winreg def clean(output_dir): if os.path.exists(output_dir):...
#!/usr/bin/env python # Copyright 2014 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 os import shutil import subprocess import sys def clean(output_dir): if os.path.exists(output_dir): shuti...
bsd-3-clause
Python
1aca0049cc3aa94f8aeff9d1a710e497b772b014
Replace assert with self.assertEqual
GriceTurrble/python-amazon-mws,Bobspadger/python-amazon-mws
tests/request_methods/test_inventory.py
tests/request_methods/test_inventory.py
""" Tests for the MWS.Inventory API class. """ import unittest import datetime import mws from .utils import CommonRequestTestTools class InventoryTestCase(unittest.TestCase, CommonRequestTestTools): """ Test cases for Inventory. """ def setUp(self): self.api = mws.Inventory( self....
""" Tests for the MWS.Inventory API class. """ import unittest import datetime import mws from .utils import CommonRequestTestTools class InventoryTestCase(unittest.TestCase, CommonRequestTestTools): """ Test cases for Inventory. """ def setUp(self): self.api = mws.Inventory( self....
unlicense
Python
a16291b353b37fcdbe4b705df7ccf3a6e7690308
Use local unittest that gets unittest2 for python 2.6
jorisvandenbossche/geopandas,snario/geopandas,ozak/geopandas,maxalbert/geopandas,urschrei/geopandas,micahcochran/geopandas,ozak/geopandas,geopandas/geopandas,koldunovn/geopandas,geopandas/geopandas,jdmcbr/geopandas,geopandas/geopandas,jorisvandenbossche/geopandas,perrygeo/geopandas,kwinkunks/geopandas,jdmcbr/geopandas,...
tests/test_io.py
tests/test_io.py
from __future__ import absolute_import import fiona from geopandas import GeoDataFrame, read_postgis, read_file import tests.util from .util import unittest class TestIO(unittest.TestCase): def setUp(self): nybb_filename = tests.util.download_nybb() path = '/nybb_13a/nybb.shp' vfs = 'zip:...
from __future__ import absolute_import import unittest import fiona from geopandas import GeoDataFrame, read_postgis, read_file import tests.util class TestIO(unittest.TestCase): def setUp(self): nybb_filename = tests.util.download_nybb() path = '/nybb_13a/nybb.shp' vfs = 'zip://' + nybb...
bsd-3-clause
Python
341344dffb82af1b002e962cca3b5d8673b3504b
make borderless test exitable
regular/pyglet-avbin-optimizations,regular/pyglet-avbin-optimizations,regular/pyglet-avbin-optimizations,regular/pyglet-avbin-optimizations
tests/window/WINDOW_STYLE_BORDERLESS.py
tests/window/WINDOW_STYLE_BORDERLESS.py
#!/usr/bin/env python '''Test that window style can be borderless. Expected behaviour: One borderless window will be opened. Mouse click in the window to close it and end the test. ''' __docformat__ = 'restructuredtext' __version__ = '$Id: WINDOW_SET_MOUSE_CURSOR.py 717 2007-03-03 07:04:10Z Alex.Holkner $' ...
#!/usr/bin/env python '''Test that window style can be borderless. Expected behaviour: One borderless window will be opened. Close the window or press ESC to end the test. ''' __docformat__ = 'restructuredtext' __version__ = '$Id: WINDOW_SET_MOUSE_CURSOR.py 717 2007-03-03 07:04:10Z Alex.Holkner $' import u...
bsd-3-clause
Python
57da4f4005d539bf6fc445fa2fa33f78afe07556
Revert "Temporarily skip TestWithLimitDebugInfo on Darwin and OS X"
llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb
packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py
packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py
import lldb from lldbsuite.test.lldbtest import * import lldbsuite.test.lldbutil as lldbutil class TestWithLimitDebugInfo(TestBase): mydir = TestBase.compute_mydir(__file__) @skipIf(debug_info=not_in(["dwarf"])) def test_limit_debug_info(self): self.build() cwd = os.getcwd() src...
import lldb from lldbsuite.test.lldbtest import * import lldbsuite.test.lldbutil as lldbutil class TestWithLimitDebugInfo(TestBase): mydir = TestBase.compute_mydir(__file__) @skipIfLinux @skipIfDarwin @skipIf(debug_info=not_in(["dwarf"])) def test_limit_debug_info(self): self.build() ...
apache-2.0
Python
2d269a7fbf266b4b05d23cf09849ce92c9444045
update shebang line from python to python2
c4rlo/vimhelp,c4rlo/vimhelp,c4rlo/vimhelp
doc/h2h.py
doc/h2h.py
#!/usr/bin/python2 import sys, os, os.path #import cProfile sys.path.append('../gae') from vimh2h import VimH2H def slurp(filename): f = open(filename) c = f.read() f.close() return c def usage(): return "usage: " + sys.argv[0] + " IN_DIR OUT_DIR [BASENAMES...]" def main(): if len(sys.argv...
#!/usr/bin/python import sys, os, os.path #import cProfile sys.path.append('../gae') from vimh2h import VimH2H def slurp(filename): f = open(filename) c = f.read() f.close() return c def usage(): return "usage: " + sys.argv[0] + " IN_DIR OUT_DIR [BASENAMES...]" def main(): if len(sys.argv)...
mit
Python
00e84b51f22f78f0243cd7b7212e70447fd5b552
Test that an empty name field doesn't raise errors
andela-kndungu/compshop,andela-kndungu/compshop,andela-kndungu/compshop,kevgathuku/compshop,kevgathuku/compshop,andela-kndungu/compshop,kevgathuku/compshop,kevgathuku/compshop
store/tests/test_forms.py
store/tests/test_forms.py
from django.test import TestCase from store.forms import ReviewForm from store.models import Review from .factories import * class ReviewFormTest(TestCase): def test_form_validation_for_blank_items(self): p1 = ProductFactory.create() form = ReviewForm( data={'name':'', 'text': '', '...
from django.test import TestCase from store.forms import ReviewForm from store.models import Review from .factories import * class ReviewFormTest(TestCase): def test_form_validation_for_blank_items(self): p1 = ProductFactory.create() form = ReviewForm( data={'name':'', 'text': '', '...
bsd-3-clause
Python
0cc03d951d023cd9f782be3fbae60dfd71c32e1e
add ComputeMolShape and ComputeMolVolume convenience functions
rdkit/rdkit-orig,rdkit/rdkit-orig,rdkit/rdkit-orig,rdkit/rdkit-orig,rdkit/rdkit-orig,rdkit/rdkit-orig,rdkit/rdkit-orig,rdkit/rdkit-orig
Python/Chem/AllChem.py
Python/Chem/AllChem.py
# $Id$ # # Copyright (C) 2006 greg Landrum and Rational Discovery LLC # # @@ All Rights Reserved @@ # """ Import all RDKit chemistry modules """ import rdBase import RDConfig import Numeric import DataStructs from Geometry import rdGeometry from Chem import * from rdPartialCharges import * from r...
# $Id$ # # Copyright (C) 2006 greg Landrum and Rational Discovery LLC # # @@ All Rights Reserved @@ # """ Import all RDKit chemistry modules """ import rdBase import RDConfig import Numeric import DataStructs from Geometry import rdGeometry from Chem import * from rdPartialCharges import * from r...
bsd-3-clause
Python
f006f3a91a19a7a918668ad0abed8edc68e5b572
Add comments, reorder the code a bit
AdrianGaudebert/elmo,Pike/elmo,mozilla/elmo,Pike/elmo,mozilla/elmo,Pike/elmo,mozilla/elmo,mozilla/elmo,AdrianGaudebert/elmo,AdrianGaudebert/elmo,Pike/elmo
wsgi/elmo.wsgi
wsgi/elmo.wsgi
# ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (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.mozilla.org/MPL/ # # Softwa...
# ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (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.mozilla.org/MPL/ # # Softwa...
mpl-2.0
Python
f50794de35d669250d9863ea87c7e5bb2cc98d17
update cvclean
gwparikh/cvguipy,gwparikh/cvguipy,gwparikh/cvgui
cvclean.py
cvclean.py
#!/usr/bin/env python from os import path, remove from shutil import rmtree if __name__ == '__main__': if path.exists('sql_files'): rmtree('sql_files') print('deleted sql_files directory') if path.exists('cfg_files'): rmtree('cfg_files') print('deleted cfg_files directory') ...
#!/usr/bin/env python from os import path from shutil import rmtree if __name__ == '__main__': if path.exists('sql_files'): rmtree('sql_files') print 'deleted sql_files directory' if path.exists('cfg_files'): rmtree('cfg_files') print 'deleted cfg_files directory'
mit
Python
a2815a871dff779215a5e267050380052f892165
bump version
gkampjes/ucbc,gkampjes/ucbc,gkampjes/ucbc,oliverdrake/ucbc,oliverdrake/ucbc,oliverdrake/ucbc
main/__init__.py
main/__init__.py
__version__ = "1.0-a3"
__version__ = "1.0-a2"
mit
Python
7b6aad898d07e48ae23c75e3944ae5242a03a769
Add reverted code.
saucelabs/slacktalker,saucelabs/slacktalker
make_sentence.py
make_sentence.py
import sys, math, random import model from model import WordEntry import talker_exceptions as exceptions from sqlalchemy.sql.expression import func from sqlalchemy import Column, Integer, MetaData, String, Table, desc #for each possible next word sampled from the crowd, generate PERSONALITY_WEIGHT entries from the a...
import sys, math, random import model from model import WordEntry from sqlalchemy.sql.expression import func from sqlalchemy import Column, Integer, MetaData, String, Table, desc #for each possible next word sampled from the crowd, generate PERSONALITY_WEIGHT entries from the actual user WORD_PAIRS_WEIGHT = 1 SENTEN...
mit
Python
6c439b0c0aeda85ecb009e548bba520d5b13b0a0
Change quote module to accept a path with quote files (*.txt)
jawsper/modularirc
modules/quote.py
modules/quote.py
from modules import Module import glob import os import logging import random class quote(Module): def cmd_quote( self, args, source, target, admin ): """!quote: to get a random quote""" quote = self.random_quote() if quote: return [quote] def random_quote( self ): ...
from ._module import _module import logging import random class quote( _module ): def cmd_quote( self, args, source, target, admin ): """!quote: to get a random quote""" return [ self.random_quote() ] def random_quote( self ): """Read a quote from a text file""" try: with open( self.get_config( 'quote_fi...
mit
Python
ff8a1b1db0aea8a320dd283bac7ed34825a18381
Put the whole core inside of Try/exception
jasuka/pyBot,jasuka/pyBot
modules/stats.py
modules/stats.py
##Simple stats version 2 import readline def stats( self ): if self.config["logging"] == True: #Logging must be enabled from config to run this module if len(self.msg) >= 5: #if no atributes, give the usage. if self.msg[4].strip(): #prevent searching whitespaces chan = self.msg[2] logfile = self.conf...
##Simple stats version 2 import readline def stats( self ): if self.config["logging"] == True: #Logging must be enabled from config to run this module if len(self.msg) >= 5: #if no atributes, give the usage. if self.msg[4].strip(): #prevent searching whitespaces chan = self.msg[2] logfile = self.conf...
mit
Python
892d2703e537cffe80a2d6586fedc44332c36743
Remove the LiveWidget StompWidget injection hack (#28)
mokshaproject/moksha,pombredanne/moksha,pombredanne/moksha,mokshaproject/moksha,lmacken/moksha,ralphbean/moksha,pombredanne/moksha,lmacken/moksha,ralphbean/moksha,lmacken/moksha,pombredanne/moksha,ralphbean/moksha,mokshaproject/moksha,mokshaproject/moksha
moksha/api/widgets/live/live.py
moksha/api/widgets/live/live.py
# This file is part of Moksha. # Copyright (C) 2008-2009 Red Hat, Inc. # # 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 3 of the # License, or (at your option) any later ...
# This file is part of Moksha. # Copyright (C) 2008-2009 Red Hat, Inc. # # 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 3 of the # License, or (at your option) any later ...
apache-2.0
Python
b64ceb9858cf830c680d4887c4bb643e1cad2416
Add option to output just domains from script
alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin,alphagov/notifications-admin
domains.py
domains.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import yaml from itertools import chain from operator import itemgetter from sys import argv from app.utils import AgreementInfo _dir_path = os.path.dirname(os.path.realpath(__file__)) if len(argv) < 2: raise TypeError('Must specify `orgs` or `domains` as ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import yaml from app.utils import AgreementInfo _dir_path = os.path.dirname(os.path.realpath(__file__)) with open('{}/app/domains.yml'.format(_dir_path)) as source: data = yaml.load(source) for domain, details in data.items(): if isinstance(d...
mit
Python
03508d29514c8515e7b4eeb83e2994224840263d
Use re.findall for ExtractIPTuples
google/namebench,google/namebench,protron/namebench,rogers0/namebench,google/namebench
libnamebench/util.py
libnamebench/util.py
# Copyright 2009 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 ...
# Copyright 2009 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 ...
apache-2.0
Python
951153c7db71888cc3462c78d56684e0e70e074e
Fix cptm imports
NLeSC/cptm,NLeSC/cptm
cptm/experiment_calculate_perplexity.py
cptm/experiment_calculate_perplexity.py
import pandas as pd import logging from multiprocessing import Pool import argparse from cptm.utils.experiment import load_config, get_corpus, get_sampler def calculate_perplexity(config, corpus, nPerplexity, nTopics): sampler = get_sampler(config, corpus, nTopics) results = [] for s in nPerplexity: ...
import pandas as pd import logging from multiprocessing import Pool import argparse from utils.experiment import load_config, get_corpus, get_sampler def calculate_perplexity(config, corpus, nPerplexity, nTopics): sampler = get_sampler(config, corpus, nTopics) results = [] for s in nPerplexity: ...
apache-2.0
Python
98fbfa27392f8cddcd87bc2ff9aec1a4dad6c0e8
add 0.14.0 (#27430)
LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack
var/spack/repos/builtin/packages/py-pybids/package.py
var/spack/repos/builtin/packages/py-pybids/package.py
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyPybids(PythonPackage): """bids: interface with datasets conforming to BIDS""" homep...
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyPybids(PythonPackage): """bids: interface with datasets conforming to BIDS""" homep...
lgpl-2.1
Python
b0b8b920a2da14543dbcb796bac7cf4221e3b587
bump version
amplify-education/data_kennel,amplify-education/data_kennel
data_kennel/version.py
data_kennel/version.py
"""Place of record for the package version""" __version__ = "1.0.5" __rpm_version__ = "WILL_BE_SET_BY_RPM_BUILD" __git_hash__ = "WILL_BE_SET_BY_EGG_BUILD"
"""Place of record for the package version""" __version__ = "1.0.4" __rpm_version__ = "WILL_BE_SET_BY_RPM_BUILD" __git_hash__ = "WILL_BE_SET_BY_EGG_BUILD"
mit
Python
e96a29b010f737dede430bdad424bc6812ca2cea
test travis
quantmind/git-agile,quantmind/pulsar-agile
agile/git.py
agile/git.py
from .github import GithubApi from .utils import execute class Git: @classmethod def create(cls): remote = yield from execute('git config --get remote.origin.url') raw = remote.split('@') if len(raw) == 2: raw = raw[1] domain, path = raw.split(':') ...
import logging from .github import GithubApi from .utils import execute class Git: @classmethod def create(cls): remote = yield from execute('git config --get remote.origin.url') raw = remote.split('@') assert len(raw), 2 raw = raw[1] domain, path = raw.split(':') ...
bsd-3-clause
Python
875bd24dc8b3fab3db6611f1dcd636be1dee9676
Fix example script.
JoeGermuska/agate,captainsafia/agate,TylerFisher/agate,wireservice/agate,onyxfish/journalism,onyxfish/agate,flother/agate,dwillis/agate
example.py
example.py
#!/usr/bin/env python import csv from agate import Table, DateType, NumberType, TextType, Sum, StDev text_type = TextType() number_type = NumberType() date_type = DateType() COLUMNS = ( ('state', text_type), ('county', text_type), ('fips', text_type), ('nsn', text_type), ('item_name', text_type)...
#!/usr/bin/env python import csv from agate import Table, DateType, NumberType, TextType, Sum, StDev text_type = TextType() number_type = NumberType() date_type = DateType() COLUMNS = ( ('state', text_type), ('county', text_type), ('fips', text_type), ('nsn', text_type), ('item_name', text_type)...
mit
Python
49481d18154e486f706947cd1d7ac20bf8f2f039
Add deploy_build_id to fabfile.
mozilla/marketplace-operator-dashboard,mozilla/marketplace-operator-dashboard
fabfile.py
fabfile.py
import os import fabdeploytools.envs from fabric.api import env, lcd, local, task from fabdeploytools import helpers import deploysettings as settings env.key_filename = settings.SSH_KEY fabdeploytools.envs.loadenv(settings.CLUSTER) ROOT, PROJECT_NAME = helpers.get_app_dirs(__file__) if settings.ZAMBONI_DIR: h...
import os import fabdeploytools.envs from fabric.api import env, lcd, local, task from fabdeploytools import helpers import deploysettings as settings env.key_filename = settings.SSH_KEY fabdeploytools.envs.loadenv(settings.CLUSTER) ROOT, PROJECT_NAME = helpers.get_app_dirs(__file__) @task def pre_update(ref): ...
mpl-2.0
Python
44b9335b391e13971d3b189b3e3cbfd66af650ab
Update base fabfile for config changes.
alex/braid,alex/braid
fabfile.py
fabfile.py
""" Collection of utilities to automate the administration of Twisted's infrastructure. Use this utility to install, update and start/stop/restart services running on twistedmatrix.com. """ """ This file is a simple entry point, nothing is final about it! Just experimenting for now. """ from braid import base from b...
""" Collection of utilities to automate the administration of Twisted's infrastructure. Use this utility to install, update and start/stop/restart services running on twistedmatrix.com. """ """ This file is a simple entry point, nothing is final about it! Just experimenting for now. """ from braid import base, pypy ...
mit
Python
5ee2bc9b8639bfc9375cabe6e9a06fa3791b920b
add db migration to fab
MTG/dunya,MTG/dunya,MTG/dunya,MTG/dunya
fabfile.py
fabfile.py
from fabric.api import * import os def up(port="8001"): local("python manage.py runserver 0.0.0.0:%s"%port) def setupdb(): local("python manage.py migrate kombu.transport.django") local("python manage.py migrate djcelery") local("python manage.py syncdb --noinput") local("python manage.py migrate ...
from fabric.api import * import os def up(port="8001"): local("python manage.py runserver 0.0.0.0:%s"%port) def setupdb(): with settings(warn_only=True): local("rm data/migrations/*") local("rm carnatic/migrations/*") local("python manage.py schemamigration --initial data") local("pyth...
agpl-3.0
Python
327bbdde964f8af0625313922be91665a75d7268
Add install task to fab file
projectweekend/Pi-Sensor-RPC-Service
fabfile.py
fabfile.py
from StringIO import StringIO from fabric import api from fabric.operations import prompt, put UPSTART_TEMPLATE = """ description "Pi-Sensor-RPC-Service" start on runlevel [2345] stop on runlevel [06] respawn respawn limit 10 5 env LOGGLY_TOKEN={loggly_token} env LOGGLY_SUBDOMAIN={loggly_domain} env SERIAL_ADDRESS=...
from fabric import api def raspberry_pi(name): api.env.hosts = ["{0}.local".format(name)] api.env.user = 'pi' def deploy(): api.require('hosts', provided_by=[raspberry_pi]) with api.settings(warn_only=True): api.sudo('service sensor-rpc stop') with api.cd('~/Pi-Sensor-RPC-Service'): api.run('git pull ori...
mit
Python
7bbc3896872d051e9fff2fe483b5df6bfdde224f
Update P03_magic8Ball.py added docstrings and wrapped in main() function
JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials
pythontutorials/books/AutomateTheBoringStuffWithPython/Chapter03/P03_magic8Ball.py
pythontutorials/books/AutomateTheBoringStuffWithPython/Chapter03/P03_magic8Ball.py
"""Magic 8 ball This program answers your questions with a function that knows all. """ def getAnswer(answerNumber: int) -> str: """Get answer Uses `if` ... `elif` sequence to return a response based on an inputted number. Args: answerNumber: Any integer between 1 and 9. Returns: ...
# This program answers your questions import random def getAnswer(answerNumber): if answerNumber == 1: return 'It is certain' elif answerNumber == 2: return 'It is decidedly so' elif answerNumber == 3: return 'Yes' elif answerNumber == 4: return 'Reply hazy try again' ...
mit
Python
f711ee1aea491bba3b707d971a96ed8475c9c1e6
Fix indent
tkf/fillplots,tkf/fillplots
doc/source/examples/explicit_regions.py
doc/source/examples/explicit_regions.py
from fillplots import plot_regions, And, SDOr dom01 = (0, 1) dom12 = (1, 2) plotter = plot_regions([ And([(lambda x: (1.0 - x ** 2) ** 0.5, True, dom01), (lambda x: 0.5 * x, False, dom01), (lambda x: 2.0 * x, True, dom01)]), SDOr([(lambda x: (1.0 - (x - 1) ** 2) ** 0.5, True, dom12), ...
from fillplots import plot_regions, And, SDOr dom01 = (0, 1) dom12 = (1, 2) plotter = plot_regions([ And([(lambda x: (1.0 - x ** 2) ** 0.5, True, dom01), (lambda x: 0.5 * x, False, dom01), (lambda x: 2.0 * x, True, dom01)]), SDOr([(lambda x: (1.0 - (x - 1) ** 2) ** 0.5, True, dom12), (...
bsd-2-clause
Python
fad4f9c2664541052598f23113d6c7aa3a14f3f3
Bump to version 0.28.2
reubano/meza,reubano/tabutils,reubano/tabutils,reubano/meza,reubano/meza,reubano/tabutils
meza/__init__.py
meza/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # vim: sw=4:ts=4:expandtab """ meza ~~~~ Provides methods for reading and processing data from tabular formatted files Attributes: CURRENCIES [tuple(unicode)]: Currency symbols to remove from decimal strings. ENCODING (str): Default file encoding. DEF...
#!/usr/bin/env python # -*- coding: utf-8 -*- # vim: sw=4:ts=4:expandtab """ meza ~~~~ Provides methods for reading and processing data from tabular formatted files Attributes: CURRENCIES [tuple(unicode)]: Currency symbols to remove from decimal strings. ENCODING (str): Default file encoding. DEF...
mit
Python
68697f8d834f77719b704ae6b7e7147468776186
Bump to version 0.43.0
reubano/meza,reubano/meza,reubano/meza
meza/__init__.py
meza/__init__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # vim: sw=4:ts=4:expandtab """ meza ~~~~ Provides methods for reading and processing data from tabular formatted files Attributes: CURRENCIES [tuple(unicode)]: Currency symbols to remove from decimal strings. ENCODING (str): Default file encoding. DEF...
#!/usr/bin/env python # -*- coding: utf-8 -*- # vim: sw=4:ts=4:expandtab """ meza ~~~~ Provides methods for reading and processing data from tabular formatted files Attributes: CURRENCIES [tuple(unicode)]: Currency symbols to remove from decimal strings. ENCODING (str): Default file encoding. DEF...
mit
Python
4a1e63f2775514bad5adcf6a9f7bbe59edc2119a
increment version number
mfem/PyMFEM,mfem/PyMFEM,mfem/PyMFEM
mfem/__init__.py
mfem/__init__.py
import os path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) mfem_mode = None pymfem_debug = -1 def debug_print(message): if pymfem_debug < 0: # debug < 0 return elif pymfem_debug == 0: # debug = 0 pass elif pymfem_debug > 0: # debug = 1 pass elif pymfem...
import os path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) mfem_mode = None pymfem_debug = -1 def debug_print(message): if pymfem_debug < 0: # debug < 0 return elif pymfem_debug == 0: # debug = 0 pass elif pymfem_debug > 0: # debug = 1 pass elif pymfem...
bsd-3-clause
Python
93d1c3b2c658ffb3e751ae4c671fd0e5767c91a2
Update __init__.py
mfem/PyMFEM,mfem/PyMFEM,mfem/PyMFEM
mfem/__init__.py
mfem/__init__.py
import os path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) mfem_mode = None pymfem_debug = -1 def debug_print(message): if pymfem_debug < 0: # debug < 0 return elif pymfem_debug == 0: # debug = 0 pass elif pymfem_debug > 0: # debug = 1 pass elif pymfem...
import os path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) mfem_mode = None pymfem_debug = -1 def debug_print(message): if pymfem_debug < 0: # debug < 0 return elif pymfem_debug == 0: # debug = 0 pass elif pymfem_debug > 0: # debug = 1 pass elif pymfem...
bsd-3-clause
Python
71afe1acbdd7ee265983397e237b514482f04f73
Add foward propagation and network initialization functions
YuelongLi/Deep-Learning
src/neuralNetwork.py
src/neuralNetwork.py
import numpy as np def initializeNetwork(layerSizes = [1,2,3,4,1]): l = len(layerSizes) parameters = {} for i in range(1,l): parameters['W'+str(i)] = np.random.randn(layerSizes[i],layerSizes[i-1])*0.1 parameters['b'+str(i)] = np.empty((i,1)) return parameters def forwardProp(X, paramet...
mit
Python
f34ebc95e4141f8df162dbc5805b4d0a48c0aa0b
fix unit tests
opmuse/opmuse,opmuse/opmuse,opmuse/opmuse,opmuse/opmuse
opmuse/test/test_controllers_main.py
opmuse/test/test_controllers_main.py
from . import WebCase from http.cookies import BaseCookie class MainTest(WebCase): setup_server = WebCase._opmuse_setup_server def _login(self): self.getPage('/login', method='POST', body='login=admin&password=admin') cookie = BaseCookie() cookie.load(self.cookies[0][1]) ret...
from . import WebCase from http.cookies import BaseCookie class MainTest(WebCase): setup_server = WebCase._opmuse_setup_server def _login(self): self.getPage('/login', method='POST', body='login=admin&password=admin') cookie = BaseCookie() cookie.load(self.cookies[0][1]) ret...
agpl-3.0
Python
97efe99ae964e8f4e866d961282257e6f4293fd8
Make worker listener config backwards compat
matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,TribeMedia/synapse,TribeMedia/synapse,TribeMedia/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,TribeMedia/synapse,TribeMedia/synapse
synapse/config/workers.py
synapse/config/workers.py
# -*- coding: utf-8 -*- # Copyright 2016 matrix.org # # 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...
# -*- coding: utf-8 -*- # Copyright 2016 matrix.org # # 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...
apache-2.0
Python
b856b07397956ba7e972a8faeb2ab4eee4144da1
Build 47
vlegoff/cocomud
src/version.py
src/version.py
BUILD = 47
BUILD = 46
bsd-3-clause
Python
bcf8527994d10acd0fd83ff06c50827b8f8c712e
Handle non-existent ward.
Code4SA/nearby,Code4SA/nearby,Code4SA/nearby,Code4SA/nearby
nearby/models.py
nearby/models.py
import logging import arrow import requests log = logging.getLogger(__name__) class IECClient(object): def __init__(self, username, password, url=None): self.url = url or 'https://api.elections.org.za' self.username = username self.password = password self.token = None ...
import logging import arrow import requests log = logging.getLogger(__name__) class IECClient(object): def __init__(self, username, password, url=None): self.url = url or 'https://api.elections.org.za' self.username = username self.password = password self.token = None ...
mit
Python
935cef2a4e0304854b6ee7864710bde58814b7e9
Update script for creating uighur dictionary to pull in the translations, and process them a little
brendandc/multilingual-google-image-scraper
dictionaries/scripts/uighur/create-uighur-dict-from-webcrawl.py
dictionaries/scripts/uighur/create-uighur-dict-from-webcrawl.py
import optparse import os from collections import defaultdict optparser = optparse.OptionParser() optparser.add_option("-d", "--directory", dest="directory", default="uighur/", help="Directory with dictionaries") (opts, _) = optparser.parse_args() full_path = os.path.abspath(opts.directory) all_files = set([filename ...
import optparse import os from collections import defaultdict optparser = optparse.OptionParser() optparser.add_option("-d", "--directory", dest="directory", default="uighur/", help="Directory with dictionaries") (opts, _) = optparser.parse_args() full_path = os.path.abspath(opts.directory) all_files = set([filename ...
mit
Python
f4254c4feef5f80b1cc23e6fc578346acd7c0b81
Add colorization option to default options parser
monkiineko/mbed-os,svastm/mbed,ryankurte/mbed-os,nvlsianpu/mbed,fanghuaqi/mbed,bulislaw/mbed-os,screamerbg/mbed,catiedev/mbed-os,fahhem/mbed-os,netzimme/mbed-os,mmorenobarm/mbed-os,monkiineko/mbed-os,RonEld/mbed,kl-cruz/mbed-os,RonEld/mbed,infinnovation/mbed-os,arostm/mbed-os,theotherjimmy/mbed,CalSol/mbed,adamgreen/mb...
tools/options.py
tools/options.py
""" mbed SDK Copyright (c) 2011-2013 ARM Limited Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in wr...
""" mbed SDK Copyright (c) 2011-2013 ARM Limited Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in wr...
apache-2.0
Python
664d777e494c7bd2e1ae3d45a3e9c189dd4b3767
Make sure that the script uses the full path to pdb2mdb.
neitsa/PrepareLanding,neitsa/PrepareLanding
tools/pdb2mdb.py
tools/pdb2mdb.py
#!/usr/bin/python3.6 # -*- coding: UTF-8 -*- # author: neitsa import argparse import os import pathlib import sys import subprocess def file_exists(path_str: pathlib, check_absolute: bool = False) -> bool: path = pathlib.Path(path_str) if not path.exists() or not path.is_file(): print("Provided path '...
#!/usr/bin/python3.6 # -*- coding: UTF-8 -*- # author: neitsa import argparse import pathlib import sys import subprocess def file_exists(path_str: pathlib, check_absolute: bool = False) -> bool: path = pathlib.Path(path_str) if not path.exists() or not path.is_file(): print("Provided path '{}' doesn'...
mit
Python