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
ed7e02e320fbecef695987be41b0f428994eec81
Fix stupid problem
Kerbas-ad-astra/KerbalStuff,KerbalStuff/KerbalStuff,ModulousSmash/Modulous,toadicus/KerbalStuff,KerbalStuff/KerbalStuff,EIREXE/SpaceDock,EIREXE/SpaceDock,EIREXE/SpaceDock,ModulousSmash/Modulous,Kerbas-ad-astra/KerbalStuff,Kerbas-ad-astra/KerbalStuff,toadicus/KerbalStuff,ModulousSmash/Modulous,toadicus/KerbalStuff,EIREX...
KerbalStuff/helpers.py
KerbalStuff/helpers.py
from KerbalStuff.common import get_user from KerbalStuff.objects import User, Mod from werkzeug.utils import secure_filename def is_admin(): user = get_user() if not user: return False return user.admin def following_mod(mod): user = get_user() if not user: return False if any(...
from KerbalStuff.common import get_user from KerbalStuff.objects import User, Mod from werkzeug.utils import secure_filename def is_admin(): user = get_user() print(user.admin) if not user: return False return user.admin def following_mod(mod): user = get_user() if not user: re...
mit
Python
947e653ab8f72fcee8531ea46317088106d6f1b8
Fix test: u prefixes are gone now. Test 'a' and b'a' instead.
sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator
Lib/test/test_unary.py
Lib/test/test_unary.py
"""Test compiler changes for unary ops (+, -, ~) introduced in Python 2.2""" import unittest from test.test_support import run_unittest, have_unicode class UnaryOpTestCase(unittest.TestCase): def test_negative(self): self.assert_(-2 == 0 - 2) self.assert_(-0 == 0) self.assert_(--2 == 2) ...
"""Test compiler changes for unary ops (+, -, ~) introduced in Python 2.2""" import unittest from test.test_support import run_unittest, have_unicode class UnaryOpTestCase(unittest.TestCase): def test_negative(self): self.assert_(-2 == 0 - 2) self.assert_(-0 == 0) self.assert_(--2 == 2) ...
mit
Python
5e9497e05a71981e3dc24ae69031a66aa1d7d790
Add 0.7.1 (#26492)
LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack
var/spack/repos/builtin/packages/py-defusedxml/package.py
var/spack/repos/builtin/packages/py-defusedxml/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 PyDefusedxml(PythonPackage): """defusing XML bombs and other exploits""" homepage = "...
# 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 PyDefusedxml(PythonPackage): """defusing XML bombs and other exploits""" homepage = "...
lgpl-2.1
Python
6d3e1267cca622f4016ca779371de72a4f8de157
add root helper
vmthunder/virtman
vmthunder/drivers/iscsi.py
vmthunder/drivers/iscsi.py
import os from brick.iscsi.iscsi import TgtAdm from vmthunder.singleton import singleton from vmthunder.drivers import rootwrap @singleton class TgtExecutor(TgtAdm): def __init__(self, root_helper='', volumes_dir= '/etc/tgt/conf.d'): TgtAdm.__init__(self, root_helper, volumes_dir) tgt = ...
import os from brick.iscsi.iscsi import TgtAdm from vmthunder.singleton import singleton from vmthunder.drivers import rootwrap @singleton class TgtExecutor(TgtAdm): def __init__(self, root_helper='', volumes_dir= '/etc/tgt/conf.d'): super(TgtExecutor, self).__init__(self, root_helper, volu...
apache-2.0
Python
866f3fb597a620e98bf3f3553422474a276ca0cf
Improve makeRelease script to avoid copying .so and .c files
AdaptivePELE/AdaptivePELE,AdaptivePELE/AdaptivePELE,AdaptivePELE/AdaptivePELE,AdaptivePELE/AdaptivePELE
AdaptivePELE/makeRelease.py
AdaptivePELE/makeRelease.py
""" Only for developers. Change releaseName to build a new release. """ import socket import glob import shutil import os def copy_ignore(src, names): return filter(lambda x: x.endswith(".c") or x.endswith(".so"), names) machine = socket.gethostname() if "bsccv" in machine: releaseFolder = "/data2/bs...
""" Only for developers. Change releaseName to build a new release. """ import socket import glob import shutil import os machine = socket.gethostname() if "bsccv" in machine: releaseFolder = "/data2/bsc72/AdaptiveSampling/bin" elif 'login' in machine: name = os.getenv("BSC_MACHINE") if name == "mn...
mit
Python
ff20d71311a300235385650bf504fb8b261f6adc
patch command due to bug in data migration from 1.2 to 1.3
mollyproject/mollyproject,mollyproject/mollyproject,mollyproject/mollyproject
molly/utils/management/commands/sync_and_migrate.py
molly/utils/management/commands/sync_and_migrate.py
import os import os.path import sys from django.db import transaction from django.db.utils import DatabaseError from django.core.management import call_command from django.core.management.base import NoArgsCommand from django.conf import settings from south.models import MigrationHistory class Command(NoArgsCommand)...
import os import os.path import sys from django.db import transaction from django.db.utils import DatabaseError from django.core.management import call_command from django.core.management.base import NoArgsCommand from django.conf import settings from south.models import MigrationHistory class Command(NoArgsCommand)...
apache-2.0
Python
a53312d3e17ea18fba823593f449fec43a5b19f6
Add additional category level in data manifest and parsing
VUEG/priocomp,VUEG/priocomp,VUEG/priocomp,VUEG/priocomp
src/utils.py
src/utils.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- import os import yaml def parse_data_manifest(infile): """ Parse datasets from a data manifest file. Current implementation can work with the following hierarchy: uri: provider: str collections: list | dict If "collections" value...
#!/usr/bin/python3 # -*- coding: utf-8 -*- import os import yaml def parse_data_manifest(infile): """ Parse datasets from a data manifest file. :param infile String path to input YAML data manifest file. :return a dictionary of files with provider name as key and downloadable URIs as values ...
mit
Python
83d7cdf76865b717063b00b62d9a7cf8c2541ad5
Update consecutive-numbers-sum.py
tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015
Python/consecutive-numbers-sum.py
Python/consecutive-numbers-sum.py
# Time: O(sqrt(n)) # Space: O(1) # Given a positive integer N, # how many ways can we write it as a sum of # consecutive positive integers? # # Example 1: # # Input: 5 # Output: 2 # Explanation: 5 = 5 = 2 + 3 # Example 2: # # Input: 9 # Output: 3 # Explanation: 9 = 9 = 4 + 5 = 2 + 3 + 4 # Example 3: # # Input: 15 # O...
# Time: O(sqrt(n)) # Space: O(1) # Given a positive integer N, # how many ways can we write it as a sum of # consecutive positive integers? # # Example 1: # # Input: 5 # Output: 2 # Explanation: 5 = 5 = 2 + 3 # Example 2: # # Input: 9 # Output: 3 # Explanation: 9 = 9 = 4 + 5 = 2 + 3 + 4 # Example 3: # # Input: 15 # O...
mit
Python
422f472e70de8cc1339223e914fdb711096b5503
fix livery orientation
jclgoodwin/bustimes.org.uk,jclgoodwin/bustimes.org.uk,jclgoodwin/bustimes.org.uk,jclgoodwin/bustimes.org.uk
buses/urls.py
buses/urls.py
from django.urls import include, path from django.contrib import admin from rest_framework import routers, serializers, viewsets from vehicles.models import Vehicle, VehicleType class VehicleSerializer(serializers.HyperlinkedModelSerializer): operator = serializers.SerializerMethodField() livery = serializers...
from django.urls import include, path from django.contrib import admin from rest_framework import routers, serializers, viewsets from vehicles.models import Vehicle, VehicleType class VehicleSerializer(serializers.HyperlinkedModelSerializer): operator = serializers.SerializerMethodField() livery = serializers...
mpl-2.0
Python
4484520eedcc796e5ebbc034424fb421e30ceb9f
Add & correction of _fillNeighbours() in AgentDijkstra
blckshrk/DummySMA
src/core/agents/AgentDijkstra.py
src/core/agents/AgentDijkstra.py
''' Created on 2 fevr. 2014 @author: Alexandre Bonhomme ''' from core.agents.AgentBase import AgentBase class AgentDijkstra(AgentBase): def __init__(self, x, y, sma): AgentBase.__init__(self, x, y, sma) self.dijkstraGrid = None self._initDijkstraGrid() def action(self): pri...
''' Created on 2 fevr. 2014 @author: Alexandre Bonhomme ''' from core.agents.AgentBase import AgentBase class AgentDijkstra(AgentBase): def __init__(self, x, y, sma): AgentBase.__init__(self, x, y, sma) self.dijkstraGrid = None self._initDijkstraGrid() def action(self): pri...
mit
Python
e6b208ab466c5b21b539d1b2c3a853e74b45da39
Move plot code to main section
szmarci/Python-Scripts,Joisar/Python-Scripts,Joisar/Python-Scripts,szmarci/Python-Scripts
Facebook/Conversations/plot-count.py
Facebook/Conversations/plot-count.py
""" Plot the number of messages sent/recieved to a friend. You should run messages.py first. """ import os import json import time from datetime import datetime as DT import matplotlib.pyplot as plt import matplotlib.dates as mdates ROOT = "Messages" date_format = "%Y-%m-%d" def pretty_epoch(epoch, fmt): """...
""" Plot the number of messages sent/recieved to a friend. You should run messages.py first. """ import os import json import time from datetime import datetime as DT import matplotlib.pyplot as plt import matplotlib.dates as mdates ROOT = "Messages" date_format = "%Y-%m-%d" def pretty_epoch(epoch, fmt): """...
unlicense
Python
8207caa5cef6bcc48fc91b10bda52de7682cea56
Update 05_Ambient_Light_Monitoring.py
userdw/RaspberryPi_3_Starter_Kit
05_Ambient_Light_Monitoring/05_Ambient_Light_Monitoring.py
05_Ambient_Light_Monitoring/05_Ambient_Light_Monitoring.py
import MCP3202, wiringpi, time, os from time import sleep wiringpi.wiringPiSetup() wiringpi.softPwmCreate(24, 0, 100) def translate(value, leftMin, leftMax, rightMin, rightMax): # Figure out how 'wide' each range is leftSpan = leftMax - leftMin rightSpan = rightMax - rightMin # Convert the left range into a 0 - 1...
import MCP3202, wiringpi, time, os # import library WiringPi-Python from time import sleep # import library sleep wiringpi.wiringPiSetup() # Must be called before using I/O Function wiringpi.softPwmCreate(24, 0, 100) # Set PWM on pin 24, start value 0, max value 100 def translate(value, leftMin, leftMax, rightMin, ri...
mit
Python
dfb397d76e674ec7b0d11afb36cdbdd98b8d081d
add image to instance summary serializer
CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend
api/v2/serializers/summaries/instance.py
api/v2/serializers/summaries/instance.py
from core.models import Instance, Size, Application as Image from rest_framework import serializers from .identity import IdentitySummarySerializer from .size import SizeSummarySerializer from .image import ImageSummarySerializer class InstanceSummarySerializer(serializers.HyperlinkedModelSerializer): identity = ...
from core.models import Instance, Size from rest_framework import serializers from .identity import IdentitySummarySerializer from .size import SizeSummarySerializer class InstanceSummarySerializer(serializers.HyperlinkedModelSerializer): identity = IdentitySummarySerializer(source='created_by_identity') user...
apache-2.0
Python
27e7a2a429367b52ae7eff6b1b4aaf9adc212813
Remove copied comment from Rspec Syntax detector
integrum/sublime-text-jasmine-coffeescript
JasmineCoffeeScriptDetectFileType.py
JasmineCoffeeScriptDetectFileType.py
import sublime, sublime_plugin import os class JasmineCoffeeScriptDetectFileTypeCommand(sublime_plugin.EventListener): """ Detects current file type if the file's extension isn't conclusive """ def on_load(self, view): filename = view.file_name() if not filename: # buffer has never been saved return...
import sublime, sublime_plugin import os class JasmineCoffeeScriptDetectFileTypeCommand(sublime_plugin.EventListener): """ Detects current file type if the file's extension isn't conclusive """ """ Modified for Ruby on Rails and Sublime Text 2 """ """ Original pastie here: http://pastie.org/private/kz8gtts0cjcvk...
mit
Python
afeb01de8e185747947c18db6277bf93444b642d
TEST : for pca in source_induced_power
jmontoyam/mne-python,Odingod/mne-python,rkmaddox/mne-python,kingjr/mne-python,cjayb/mne-python,dimkal/mne-python,wronk/mne-python,Eric89GXL/mne-python,nicproulx/mne-python,mne-tools/mne-python,olafhauk/mne-python,trachelr/mne-python,olafhauk/mne-python,adykstra/mne-python,lorenzo-desantis/mne-python,dgwakeman/mne-pytho...
mne/minimum_norm/tests/test_time_frequency.py
mne/minimum_norm/tests/test_time_frequency.py
import os.path as op import numpy as np from numpy.testing import assert_array_almost_equal, assert_equal from ...datasets import sample from ... import fiff, find_events, Epochs from ..inverse import read_inverse_operator from ..time_frequency import source_induced_power examples_folder = op.join(op.dirname(__file...
import os.path as op import numpy as np from numpy.testing import assert_array_almost_equal, assert_equal from ...datasets import sample from ... import fiff, find_events, Epochs from ..inverse import read_inverse_operator from ..time_frequency import source_induced_power examples_folder = op.join(op.dirname(__file...
bsd-3-clause
Python
417169ad7e1177bb9b5c50002ba1e274b349e835
Update View.py
MariusWirtz/TM1py,OLAPLINE/TM1py
Samples/View.py
Samples/View.py
from TM1py import TM1Queries, NativeView, MDXView import uuid # establish connection to TM1 Server q = TM1Queries(ip='', port=8008, user='admin', password='apple', ssl=True) # random text random_string = str(uuid.uuid4()) # create native view native_view = NativeView(name_cube='plan_Budgetplan', name_view=random_str...
from TM1py import TM1Queries, NativeView, MDXView import uuid # establish connection to TM1 Server q = TM1Queries(ip='', port=8008, user='admin', password='apple', ssl=True) # random text random_string = str(uuid.uuid4()) # create native view view = NativeView(name_cube='plan_Budgetplan', name_view=random_string) #...
mit
Python
9e2c856f577041ea8211bfd341d048dc1c181eff
Improve output of git-manager pull command
tkw1536/GitManager
GitManager/commands/pull.py
GitManager/commands/pull.py
import typing from ..repo import description from . import Command class Pull(Command): """ Pulls a repository """ LOCAL = True def parse(self, *args: str) -> typing.Any: """ Parses arguments given to this Command """ pass def run(self, repo: description.RepositoryDescription) -> b...
import typing from ..repo import description from . import Command class Pull(Command): """ Pulls a repository """ LOCAL = True def parse(self, *args: str) -> typing.Any: """ Parses arguments given to this Command """ pass def run(self, repo: description.RepositoryDescription) -> b...
mit
Python
8aeef58b6020da137164891e3b42fa6c4ecd428f
set page_size to maximum 20.
openaid-IATI/OIPA,zimmerman-zimmerman/OIPA,openaid-IATI/OIPA,openaid-IATI/OIPA,zimmerman-zimmerman/OIPA,zimmerman-zimmerman/OIPA,openaid-IATI/OIPA,openaid-IATI/OIPA,zimmerman-zimmerman/OIPA,zimmerman-zimmerman/OIPA
OIPA/api/pagination.py
OIPA/api/pagination.py
from rest_framework import pagination from rest_framework.response import Response # TODO: Include 'last' link, see # https://developer.github.com/guides/traversing-with-pagination/ - # 2016-01-20 class CustomPagination(pagination.PageNumberPagination): page_size = 10 # default max_page_size = 20 page_...
from rest_framework import pagination from rest_framework.response import Response # TODO: Include 'last' link, see # https://developer.github.com/guides/traversing-with-pagination/ - # 2016-01-20 class CustomPagination(pagination.PageNumberPagination): page_size = 10 # default max_page_size = 2000 pag...
agpl-3.0
Python
50c631dda4ddd59704f4326248f3817d8314322c
Convert filename to bytes in getlines.
ipython/ipython,ipython/ipython
IPython/utils/ulinecache.py
IPython/utils/ulinecache.py
"""Wrapper around linecache which decodes files to unicode according to PEP 263. This is only needed for Python 2 - linecache in Python 3 does the same thing itself. """ import functools import linecache import sys from IPython.utils import py3compat from IPython.utils import openpy if py3compat.PY3: getline = l...
"""Wrapper around linecache which decodes files to unicode according to PEP 263. This is only needed for Python 2 - linecache in Python 3 does the same thing itself. """ import functools import linecache from IPython.utils import py3compat from IPython.utils import openpy if py3compat.PY3: getline = linecache.ge...
bsd-3-clause
Python
f21660aa6f4543360b5afd2ec4948871eef82477
use new parser
yrsegal/OneCommandSublimeSyntax
OneCommandGenerator.py
OneCommandGenerator.py
import sublime, sublime_plugin import os, sys import OneCommand filepath = os.getcwd() class Minecraft1ccBase(sublime_plugin.TextCommand): mode = "" def run(self, edit): fname = self.view.file_name() document = self.view.substr(sublime.Region(0, self.view.size())) if fname: context = os.path.dirname(fna...
import sublime, sublime_plugin import os, sys import OneCommand filepath = os.getcwd() class Minecraft1ccBase(sublime_plugin.TextCommand): mode = "" def run(self, edit): fname = self.view.file_name() document = self.view.substr(sublime.Region(0, self.view.size())) if fname: context = os.path.dirname(fna...
mit
Python
adbc1de4aa82e09db641c40c2ff394efb59fda18
Update hough_circle.py
LCAS/teaching,LCAS/teaching,LCAS/teaching,LCAS/teaching,LCAS/teaching
cmp3103m-code-fragments/scripts/hough_circle.py
cmp3103m-code-fragments/scripts/hough_circle.py
import cv2 import numpy as np import cv2.cv as cv cv2.namedWindow("detected circles", 1) cimg = cv2.imread('../blofeld.jpg') img = cv2.cvtColor(cimg,cv2.COLOR_BGR2GRAY) img = cv2.medianBlur(img,5) circles = cv2.HoughCircles(img,cv.CV_HOUGH_GRADIENT,4,20, param1=230,param2=230,minRadius...
import cv2 import numpy as np import cv2.cv as cv cv2.namedWindow("detected circles", 1) cv2.startWindowThread() cimg = cv2.imread('../blofeld.jpg') img = cv2.cvtColor(cimg,cv2.COLOR_BGR2GRAY) img = cv2.medianBlur(img,5) circles = cv2.HoughCircles(img,cv.CV_HOUGH_GRADIENT,4,20, param1=...
mit
Python
f1df04034bce65088347f155a9211030e3184a9b
set last error to zero after each failure
opalmer/pywincffi,opalmer/pywincffi,opalmer/pywincffi,opalmer/pywincffi
tests/test_kernel32/test_comms.py
tests/test_kernel32/test_comms.py
from pywincffi.core import dist from pywincffi.dev.testutil import TestCase from pywincffi.kernel32 import CreateFile, ClearCommError, CloseHandle from pywincffi.exceptions import WindowsAPIError class TestClearCommError(TestCase): def test_clear_error(self): ffi, library = dist.load() # Try to f...
from pywincffi.core import dist from pywincffi.dev.testutil import TestCase from pywincffi.kernel32 import CreateFile, ClearCommError, CloseHandle from pywincffi.exceptions import WindowsAPIError class TestClearCommError(TestCase): def test_clear_error(self): ffi, library = dist.load() # Try to f...
mit
Python
fdfa2e7ad6576effd429274e0369cdb2cc461ddb
Clean up imports
isislovecruft/torflow,isislovecruft/torflow,isislovecruft/torflow,isislovecruft/torflow
NetworkScanners/BwAuthority/bwauthority.py
NetworkScanners/BwAuthority/bwauthority.py
#!/usr/bin/env python from sys import argv as s_argv from sys import path from sys import exit from subprocess import Popen path.append("../../") from TorCtl.TorUtil import plog as plog from signal import signal, SIGTERM # exit code to indicate scan completion # make sure to update this in bwauthority_child.py as wel...
#!/usr/bin/env python import sys import subprocess import ConfigParser import os import traceback sys.path.append("../../") from TorCtl import TorUtil from TorCtl.TorUtil import plog from signal import signal, SIGTERM from sys import exit # exit code to indicate scan completion # make sure to update this in bwauthori...
bsd-3-clause
Python
a35a25732159e4c8b5655755ce31ec4c3e6e7975
Switch dummy_robot_bringup to use parameter for rsp.
ros2/demos,ros2/demos,ros2/demos,ros2/demos
dummy_robot/dummy_robot_bringup/launch/dummy_robot_bringup.launch.py
dummy_robot/dummy_robot_bringup/launch/dummy_robot_bringup.launch.py
# Copyright 2018 Open Source Robotics Foundation, 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 required by applicable law...
# Copyright 2018 Open Source Robotics Foundation, 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 required by applicable law...
apache-2.0
Python
fa3f4b314dcfc86b532d700d462f15282a44675c
Remove print
pastpages/archiveis
archiveis/api.py
archiveis/api.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import re import click import requests from six.moves.urllib.parse import urljoin def capture( target_url, user_agent="savepagenow (https://github.com/pastpages/savepagenow)", ): """ Archives the provided URL using archive.is Returns the URL where the...
#!/usr/bin/env python # -*- coding: utf-8 -*- import re import click import requests from six.moves.urllib.parse import urljoin def capture( target_url, user_agent="savepagenow (https://github.com/pastpages/savepagenow)", ): """ Archives the provided URL using archive.is Returns the URL where the...
mit
Python
7807ef2e83026272b971808d8ee546a2c2787971
fix for pip installing
dmpayton/django-embedded-media
embedded_media/__init__.py
embedded_media/__init__.py
__author__ = 'Derek Payton <derek.payton@gmail.com>' __copyright__ = 'Copyright (c) Derek Payton' __description__ = 'Directly embed CSS and JS in Django forms media.' __version__ = '0.0.1' __license__ = 'MIT License' try: import django except ImportError: pass #we are pip installing else: from .media i...
__author__ = 'Derek Payton <derek.payton@gmail.com>' __copyright__ = 'Copyright (c) Derek Payton' __description__ = 'Directly embed CSS and JS in Django forms media.' __version__ = '0.0.1' __license__ = 'MIT License' from .media import CSS, JS
mit
Python
42e313dad140e68c82a98133ec8ce9b5dfde5e81
correct github.py
samuelcolvin/ci-donkey,samuelcolvin/ci-donkey,samuelcolvin/ci-donkey,samuelcolvin/ci-donkey
cid/github.py
cid/github.py
import uuid from collections import OrderedDict def process_request(request, allowed_hooks): """ extracts the required data about the event from a request object resulting from a webhook request. """ info = OrderedDict([ ('event_type', 'unknown webhook'), ('author', None), (...
import uuid from collections import OrderedDict def process_request(request, allowed_hooks): """ extracts the required data about the event from a request object resulting from a webhook request. """ info = OrderedDict([ ('event_type', 'unknown webhook'), ('author', None), (...
mit
Python
aea0b53d3eef4c51d3ebceb121882e932bba34fd
remove debug code
wathsalav/xos,xmaruto/mcord,cboling/xos,xmaruto/mcord,opencord/xos,xmaruto/mcord,jermowery/xos,wathsalav/xos,xmaruto/mcord,jermowery/xos,cboling/xos,cboling/xos,cboling/xos,zdw/xos,opencord/xos,open-cloud/xos,jermowery/xos,wathsalav/xos,zdw/xos,open-cloud/xos,open-cloud/xos,cboling/xos,jermowery/xos,wathsalav/xos,zdw/x...
planetstack/core/context_processors.py
planetstack/core/context_processors.py
from django.conf import settings def planetstack(request): return {"DISABLE_MINIDASHBOARD": settings.DISABLE_MINIDASHBOARD}
from django.conf import settings print dir(settings) def planetstack(request): return {"DISABLE_MINIDASHBOARD": settings.DISABLE_MINIDASHBOARD}
apache-2.0
Python
d5368c887ae943063f4cd178daf2309181b83b15
Use command by list on LXC cloud provider
serverboards/serverboards,serverboards/serverboards,serverboards/serverboards,serverboards/serverboards,serverboards/serverboards
plugins/core-cloud/serverboards_lxc.py
plugins/core-cloud/serverboards_lxc.py
#!/usr/bin/python3 import sys, os, uuid, time, re sys.path.append(os.path.join(os.path.dirname(__file__),'../bindings/python/')) import serverboards from serverboards import rpc, Plugin, print ssh = Plugin("serverboards.core.ssh/daemon") def maybe_sudo(service): return ["sudo"] if service["config"].get("sudo") e...
#!/usr/bin/python3 import sys, os, uuid, time, re sys.path.append(os.path.join(os.path.dirname(__file__),'../bindings/python/')) import serverboards from serverboards import rpc, Plugin, print ssh = Plugin("serverboards.core.ssh/daemon") def maybe_sudo(service): return "sudo " if service["config"].get("sudo") el...
apache-2.0
Python
d6c53537ebc5c82a0d189dc13a0e8366d5ac8c66
Fix indexing on multilingual Solr backends
City-of-Helsinki/smbackend,City-of-Helsinki/smbackend
smbackend/multilingual_solr.py
smbackend/multilingual_solr.py
# based on http://anthony-tresontani.github.io/Django/2012/09/20/multilingual-search/ import re from django.conf import settings from django.utils import translation from haystack import connections from haystack.backends.solr_backend import SolrEngine, SolrSearchBackend, SolrSearchQuery from haystack.constants import ...
# based on http://anthony-tresontani.github.io/Django/2012/09/20/multilingual-search/ from django.conf import settings from django.utils import translation from haystack import connections from haystack.backends.solr_backend import SolrEngine, SolrSearchBackend, SolrSearchQuery from haystack.constants import DEFAULT_AL...
agpl-3.0
Python
1faf32fb45bf69b9486e79ba3aee5c290f9e7ab1
Return DNS data in the correct format
heyaaron/openmesher,darkpixel/openmesher,heyaaron/openmesher,darkpixel/openmesher
plugins/reversedns.py
plugins/reversedns.py
import logging, interfaces, os, IPy from StringIO import StringIO class Shorewall(interfaces.IOpenMesherPlugin): def __init__(self): self._files = {} def process(self, mesh): logging.debug('Generating DNS config...') self._files = {} rdns = StringIO() for r...
import logging, interfaces, os, IPy from StringIO import StringIO class Shorewall(interfaces.IOpenMesherPlugin): def __init__(self): self._files = {} def process(self, mesh): logging.debug('Generating DNS config...') self._files = {} rdns = StringIO() for r...
bsd-3-clause
Python
1ee42148275002d4ab498fcf915042dfeb187f0b
Remove basic auth from urls line by line
bosondata/badwolf,bosondata/badwolf,bosondata/badwolf
badwolf/utils.py
badwolf/utils.py
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import re import six BASIC_AUTH_URL_RE = re.compile( r'(?P<protocol>\S+?//)(?P<username>.+?):(?P<password>.+?)@(?P<address>\S+)', re.I | re.U ) class ObjectDict(dict): """Makes a dictionary behave like an object, with attrib...
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import re import six BASIC_AUTH_URL_RE = re.compile( r'(?P<protocol>\S+?//)(?P<username>.+?):(?P<password>.+?)@(?P<address>\S+)', re.I | re.U ) class ObjectDict(dict): """Makes a dictionary behave like an object, with attrib...
mit
Python
16629848461a4ff4b34d2ec71ea86df70bedbcd8
modify for test use modified: batchmovefile.py
wang2222qq/windowfunc
batchmovefile.py
batchmovefile.py
#/bin/usr/python #-*- coding:utf-8 -*- import os,os.path import re __author__ = 'Francics' ''' 高效批量移动文件 ''' def movefile(suffix,inpath,outpath): ''' suffix 文件后缀 inpath 源文件夹路径的根目录 outpath 输出文件夹目录 根据输入的源文件家路径遍历其子目录下所有符合后缀的文件移动到 输出文件夹目录 ''' if not os.path.exists(inpath): raise IOError('...
#/bin/usr/python #-*- coding:utf-8 -*- import os,os.path import re __author__ = 'Francics' ''' 高效批量移动文件 ''' def movefile(suffix,inpath,outpath): ''' suffix 文件后缀 inpath 源文件夹路径的根目录 outpath 输出文件夹目录 根据输入的源文件家路径遍历其子目录下所有符合后缀的文件移动到 输出文件夹目录 ''' if not os.path.exists(inpath): raise IOError('...
mit
Python
47bc68f18fc42138dd4c51bf2c63cd259fbcb1ca
remove multiple looping. just use comprehension list
jason-neal/companion_simulations,jason-neal/companion_simulations
utilities/simulation_utilities.py
utilities/simulation_utilities.py
#!/usr/bin/env python """Simulation Utilities.""" # File to contain function necessary for the chi_square simulations from __future__ import division, print_function import copy import numpy as np from matplotlib import pyplot as plt def add_noise(flux, snr): """Using the formulation mu/sigma from wikipedia. ...
#!/usr/bin/env python """Simulation Utilities.""" # File to contain function necessary for the chi_square simulations from __future__ import division, print_function import copy import numpy as np from matplotlib import pyplot as plt def add_noise(flux, snr): """Using the formulation mu/sigma from wikipedia. ...
mit
Python
27d23cb368d8afcc66683c33accd922703f37c8f
make tests passed even if jinja2 is not available
ssato/python-anytemplate,ssato/python-anytemplate
anytemplate/engines/tests/jinja2.py
anytemplate/engines/tests/jinja2.py
# # Copyright (C) 2011 - 2015 Satoru SATOH <ssato at redhat.com> # import os import unittest import anytemplate.engines.jinja2 as TT import anytemplate.tests.common class Test_00_pure_functions(unittest.TestCase): def test_20_render_s(self): tmpl_s = 'a = {{ a }}, b = "{{ b }}"' if TT.SUPPORTED...
# # Copyright (C) 2011 - 2015 Satoru SATOH <ssato at redhat.com> # import os import unittest import anytemplate.engines.jinja2 as TT import anytemplate.tests.common class Test_00_pure_functions(unittest.TestCase): def test_20_render_s(self): tmpl_s = 'a = {{ a }}, b = "{{ b }}"' if TT.SUPPORTED...
mit
Python
6d21e62060f158956a7d39b29d22060e0ea3a3b5
Fix TestTargetSymbolsAddCommand [getBuildArtifact refactor]
apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb
packages/Python/lldbsuite/test/linux/add-symbols/TestTargetSymbolsAddCommand.py
packages/Python/lldbsuite/test/linux/add-symbols/TestTargetSymbolsAddCommand.py
""" Testing explicit symbol loading via target symbols add. """ import os import time import lldb import sys from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil class TargetSymbolsAddCommand(TestBase): mydir = TestBase.compute_mydir(__file__) def...
""" Testing explicit symbol loading via target symbols add. """ import os import time import lldb import sys from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil class TargetSymbolsAddCommand(TestBase): mydir = TestBase.compute_mydir(__file__) def...
apache-2.0
Python
96e409e1f2e7e8ddf1e29886453c5e3848a7b2bf
fix bad field lookup in query set – fixes #675
MiltosD/CEF-ELRC,JuliBakagianni/META-SHARE,MiltosD/CEF-ELRC,JuliBakagianni/META-SHARE,MiltosD/CEFELRC,JuliBakagianni/CEF-ELRC,MiltosD/CEF-ELRC,JuliBakagianni/CEF-ELRC,zeehio/META-SHARE,JuliBakagianni/CEF-ELRC,MiltosD/CEFELRC,JuliBakagianni/META-SHARE,JuliBakagianni/META-SHARE,zeehio/META-SHARE,zeehio/META-SHARE,MiltosD...
metashare/cron.py
metashare/cron.py
import logging from datetime import datetime, timedelta import kronos from django.conf import settings from django.core.management import call_command from metashare.accounts.models import RegistrationRequest # Setup logging support. LOGGER = logging.getLogger(__name__) LOGGER.addHandler(settings.LOG_HANDLER) # ...
import logging from datetime import datetime, timedelta import kronos from django.conf import settings from django.core.management import call_command from metashare.accounts.models import RegistrationRequest # Setup logging support. LOGGER = logging.getLogger(__name__) LOGGER.addHandler(settings.LOG_HANDLER) # ...
bsd-3-clause
Python
37131c77d7dc89f726331e620fce396ad2753113
Remove some prints.
caskorg/cask,caskorg/cask,caskorg/cask,caskorg/cask,caskorg/cask
sparsegrind/storage/storage.py
sparsegrind/storage/storage.py
"""This module is used for the storage analysis.""" from scipy.sparse import dia_matrix import collections import math bytes_per_data = 8 bytes_per_metadata = 4 def coo(matrix): nnz = matrix.nnz return (2 * nnz * bytes_per_metadata, nnz * bytes_per_data, 'COO') def csc(matrix): ...
"""This module is used for the storage analysis.""" from scipy.sparse import dia_matrix import collections import math bytes_per_data = 8 bytes_per_metadata = 4 def coo(matrix): nnz = matrix.nnz return (2 * nnz * bytes_per_metadata, nnz * bytes_per_data, 'COO') def csc(matrix): ...
mit
Python
b64d63590bf8a37607cba80b305252c473dcebcc
Update __init__.py
slideclick/mochi,pya/mochi,i2y/mochi,pya/mochi,slideclick/mochi,i2y/mochi
mochi/__init__.py
mochi/__init__.py
__author__ = 'Yasushi Itoh' __version__ = '0.0.1' __license__ = 'MIT License' import sys IS_PYTHON_34 = sys.version_info.major == 3 and sys.version_info.minor == 4
__author__ = 'Yasushi Itoh' __version__ = '0.0.1' __license__ = 'MIT' import sys IS_PYTHON_34 = sys.version_info.major == 3 and sys.version_info.minor == 4
mit
Python
b0bd7351765888cd31469374d50b3e5e1261c753
update bioon spider
quheng/chalk,quheng/chalk,quheng/chalk
spider/spider/spiders/bioon.py
spider/spider/spiders/bioon.py
# -*- coding: utf-8 -*- import scrapy class BioonSpider(scrapy.Spider): name = "bioon" start_urls = ['http://news.bioon.com/research/list-%d.html'%x for x in range(1,50)] def parse(self, response): for div in response.css('div.cntx'): href = div.css('a::attr(href)').extract_first...
import scrapy class QuotesSpider(scrapy.Spider): name = "bioon" start = 6575000 category = set(['移动医疗 »']) def start_requests(self): for idnex in range(self.start, 6702882): url = f'http://news.bioon.com/article/{idnex}.html' yield scrapy.Request(url=url, callback=self....
mit
Python
5fabce414de45a251dcc7b5df3013056b0c92d2b
remove .choose
sammdot/circa
modules/choose.py
modules/choose.py
import random class ChooseModule: def __init__(self, circa): self.circa = circa self.events = { "cmd.roll": [self.roll], "cmd.choose": [self.choose] } self.docs = { "choose": "choose <option>, <option>, ... → choose a random <option>", "roll": "roll [[a]d[b]] → roll 'a' 'b'-sided dice (default 1d6...
import random class ChooseModule: def __init__(self, circa): self.circa = circa self.events = { "cmd.roll": [self.roll], "message": [self.dotchoose], "cmd.choose": [self.choose] } self.docs = { "choose": "choose <option>, <option>, ... → choose a random <option>", "roll": "roll [[a]d[b]] → roll...
bsd-3-clause
Python
10cf68a103daa7333d05ebb495088ff5b64ea71c
Add basic detection of errors in scanner
pacificIT/mopidy,bencevans/mopidy,hkariti/mopidy,jodal/mopidy,jmarsik/mopidy,pacificIT/mopidy,SuperStarPL/mopidy,glogiotatidis/mopidy,diandiankan/mopidy,jmarsik/mopidy,swak/mopidy,rawdlite/mopidy,swak/mopidy,swak/mopidy,priestd09/mopidy,woutervanwijk/mopidy,vrs01/mopidy,dbrgn/mopidy,glogiotatidis/mopidy,hkariti/mopidy,...
mopidy/scanner.py
mopidy/scanner.py
import gobject gobject.threads_init() import pygst pygst.require('0.10') import gst from os.path import abspath import sys import threading from mopidy.utils.path import path_to_uri, find_files class Scanner(object): def __init__(self, folder, callback): self.uris = [path_to_uri(f) for f in find_files(f...
import gobject gobject.threads_init() import pygst pygst.require('0.10') import gst from os.path import abspath import sys import threading from mopidy.utils.path import path_to_uri, find_files class Scanner(object): def __init__(self, folder, callback): self.uris = [path_to_uri(f) for f in find_files(f...
apache-2.0
Python
66e1366b35fb965f6b7395b9fc355da335b7981f
remove prints
bung87/moto-moe,bung87/moto-moe,bung87/moto-moe,bung87/moto-moe
moto/moe/views.py
moto/moe/views.py
from django.shortcuts import render from moto.moe.api.serializers import UserDetailSerializer from rest_framework.renderers import JSONRenderer from django.conf import settings from moto.moe.api.views import PostList from moto.moe.api.search import SearchView from copy import copy import django_mobile REST_FRAMEWORK = ...
from django.shortcuts import render from moto.moe.api.serializers import UserDetailSerializer from rest_framework.renderers import JSONRenderer from django.conf import settings from moto.moe.api.views import PostList from moto.moe.api.search import SearchView from copy import copy import django_mobile REST_FRAMEWORK = ...
mit
Python
5be5a96630a967a2b9c464155f3d73179abcefc8
Write video option, functional but unfinished.
daniorerio/trackpy,daniorerio/trackpy
mr/video/trace.py
mr/video/trace.py
import cv2 import numpy as np import pandas as pd def circle(features, frames, high_contrast=True, write_file=None): """Play video, circling features in each frame. Parameters ---------- features : DataFrame including columns 'frame', 'x', and 'y' frames : iterable container of image arrays, like ...
import cv2 import numpy as np import pandas as pd def circle(features, frames, high_contrast=True): """Play video, circling features in each frame. Parameters ---------- features : DataFrame including columns 'frame', 'x', and 'y' frames : iterable container of image arrays, like a list of images ...
bsd-3-clause
Python
123ffcabb6fa783b1524a55dd3dce52ad33a13db
Fix Local class to work with older werkzeug.
mikeboers/Nitrogen,mikeboers/Nitrogen,mikeboers/Nitrogen,mikeboers/Nitrogen,mikeboers/Nitrogen,mikeboers/Nitrogen
nitrogen/local.py
nitrogen/local.py
import collections from werkzeug.local import release_local, Local, LocalManager, LocalStack, allocate_lock, get_ident from .proxy import Proxy class Local(Local): # We are extending this class for the only purpose of adding a __dict__ # attribute, so that this will work nearly identically to the builtin...
import collections from werkzeug.local import release_local, Local, LocalManager, LocalStack, allocate_lock from .proxy import Proxy class Local(Local): # Just adding a __dict__ property to the object. def __init__(self): super(Local, self).__init__() object.__setattr__(self, '__storage_...
bsd-3-clause
Python
9f98dc7ca75f6909ae8df4e48d0e8d49d74f6cef
bump to semistandard 2.5.0
Flet/SublimeLinter-contrib-semistandard
linter.py
linter.py
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Dan Flettre # Copyright (c) 2015 Dan Flettre # # License: MIT # """This module exports the Semistandard plugin class.""" from SublimeLinter.lint import NodeLinter class Semistandard(NodeLinter): """Provides a...
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Dan Flettre # Copyright (c) 2015 Dan Flettre # # License: MIT # """This module exports the Semistandard plugin class.""" from SublimeLinter.lint import NodeLinter class Semistandard(NodeLinter): """Provides a...
mit
Python
31f7782a5955bef24dab4f6c9c5308e1310b0f70
Handle no results gracefully.
drougge/wwwwellpapp,drougge/wwwwellpapp,drougge/wwwwellpapp
cgi/search.py
cgi/search.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import re from os import environ from sys import exit from common import * from cgi import escape def parse_tag(name): return client.find_tag(name, with_prefix=True) pq = None qa = [] try: page = max(0, int(getarg("page"))) except Exception: page = 0 if "q" in fs: q ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import re from os import environ from sys import exit from common import * from cgi import escape def parse_tag(name): return client.find_tag(name, with_prefix=True) pq = None qa = [] try: page = max(0, int(getarg("page"))) except Exception: page = 0 if "q" in fs: q ...
mit
Python
eebf6fbb7ff0c36dc483e331768c92808aa55acb
Remove non-working __main__ from g2p
aish9r/jasper-client,benhoff/jasper-client,assanee/jasper-client,densic/HomeAutomation,djeraseit/jasper-client,sunu/jasper-client,steppy345/jasper-client,clumsical/hackthehouse-marty,rahul1193/jasper-client,auhlig/jasper-client,joekinley/jasper-client,DarrenRainey/jasper-client,djeraseit/jasper-client,Siretu/jasper-cli...
client/g2p.py
client/g2p.py
# -*- coding: utf-8-*- import os import tempfile import subprocess import re import yaml import jasperpath PHONE_MATCH = re.compile(r'<s> (.*) </s>') FST_MODEL = None # Try to get fst_model from config profile_path = os.path.join(os.path.dirname(__file__), 'profile.yml') if os.path.exists(profile_path): with op...
# -*- coding: utf-8-*- import os import tempfile import subprocess import re import yaml import jasperpath PHONE_MATCH = re.compile(r'<s> (.*) </s>') FST_MODEL = None # Try to get fst_model from config profile_path = os.path.join(os.path.dirname(__file__), 'profile.yml') if os.path.exists(profile_path): with op...
mit
Python
103bf75d091f5aaa8ec320eb7d007fb7ac6bbd11
Delete the database
annelida/stuff,annelida/stuff,annelida/stuff
projects/2017/amazon/test_amazon_db.py
projects/2017/amazon/test_amazon_db.py
#!/usr/bin/env python import unittest import sqlite3 import os class TestAmazonDatabase(unittest.TestCase): """ Setup a temporary database """ def setUp(self): self.item = [1, 'B00EOE0WKQ', 'Amazon Fire Phone, 32GB (AT&T)'] self.connection = sqlite3.connect('amazon_data.db') se...
#!/usr/bin/env python import unittest import sqlite3 class TestAmazonDatabase(unittest.TestCase): """ Setup a temporary database """ def setup(self): self.item = [1, 'B00EOE0WKQ', 'Amazon Fire Phone, 32GB (AT&T)'] self.connection = sqlite3.connect('amazon_data.db') self.cursor ...
mit
Python
4adb686fc15dc3dfdb872157df27b534f1ca7f98
Extend QUiLoader test to test ui files with custom widgets.
PySide/PySide,RobinD42/pyside,M4rtinK/pyside-android,IronManMark20/pyside2,PySide/PySide,RobinD42/pyside,PySide/PySide,RobinD42/pyside,RobinD42/pyside,PySide/PySide,M4rtinK/pyside-android,BadSingleton/pyside2,BadSingleton/pyside2,RobinD42/pyside,enthought/pyside,pankajp/pyside,gbaty/pyside2,M4rtinK/pyside-android,IronM...
tests/QtUiTools/bug_392.py
tests/QtUiTools/bug_392.py
import unittest import os from helper import UsesQApplication from PySide import QtCore, QtGui, QtDeclarative from PySide.QtUiTools import QUiLoader class BugTest(UsesQApplication): def testCase(self): w = QtGui.QWidget() loader = QUiLoader() filePath = os.path.join(os.path.dirname(__file...
import unittest import os from helper import UsesQApplication from PySide import QtCore, QtGui from PySide.QtUiTools import QUiLoader class BugTest(UsesQApplication): def testCase(self): w = QtGui.QWidget() loader = QUiLoader() filePath = os.path.join(os.path.dirname(__file__), 'action.ui...
lgpl-2.1
Python
9a42f066cc7cde8d804fa4dff23692430fc1e0ad
clean up test module
20c/pluginmgr
tests/data/dynload/mod0.py
tests/data/dynload/mod0.py
import pluginmgr from pluginmgr_test import plugin @plugin.register('mod0') class Mod0(pluginmgr.PluginBase): pass
import pluginmgr import pluginmgr_test # XXX need common plugin base plugin = pluginmgr.PluginManager('pluginmgr_test.plugins') @plugin.register('mod0') class Mod0(pluginmgr.PluginBase): pass
apache-2.0
Python
e0a546aed116cd2998a471a549a004017ff04a3a
Fix TestUploadCrashReportJSONSchemaCronApp for all test environments
mozilla/socorro,lonnen/socorro,mozilla/socorro,lonnen/socorro,lonnen/socorro,lonnen/socorro,mozilla/socorro,mozilla/socorro,mozilla/socorro,mozilla/socorro
socorro/unittest/cron/jobs/test_upload_crash_report_json_schema.py
socorro/unittest/cron/jobs/test_upload_crash_report_json_schema.py
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from configman.dotdict import DotDict import mock from socorro.cron.crontabber_app import CronTabberApp from socorro.cr...
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from configman.dotdict import DotDict import mock from socorro.cron.crontabber_app import CronTabberApp from socorro.cr...
mpl-2.0
Python
e7a95c6c386026172bfdb44ce0309669bd9495c9
Update shop.py
fadhiilrachman/line-py
linepy/shop.py
linepy/shop.py
# -*- coding: utf-8 -*- def loggedIn(func): def checkLogin(*args, **kwargs): if args[0].isLogin: return func(*args, **kwargs) else: args[0].callback.other('You must login to LINE') return checkLogin class Shop(object): isLogin = False def __init__(self): ...
# -*- coding: utf-8 -*- def loggedIn(func): def checkLogin(*args, **kwargs): if args[0].isLogin: return func(*args, **kwargs) else: args[0].callback.other('You want to call the function, you must login to LINE') return checkLogin class Shop(object): isLogin = Fa...
bsd-3-clause
Python
8e891383f7a81c1d7e331fbed72dd7e7876d3b9e
Update bootsplit.py
L-F-A/Machine-Learning
SplittingData/bootsplit.py
SplittingData/bootsplit.py
import numpy as np def BootSample(NB,Nn,P=None): ######################################################################### # Generates NB bootstrap samples for training set of size Nn # ######################################################################### # Inputs: # # NB : Number of bootstrap samples ...
import numpy as np def BootSample(NB,Nn): ######################################################################### # Generates NB bootstrap samples for training set of size Nn # ######################################################################### # Inputs: # # NB : Number of bootstrap samples # # ...
mit
Python
cc0b8723833e031653a96d9e826cd5f7bd5a3b25
Add MIT header
martin-ueding/python-colorcodes
colorcodes.py
colorcodes.py
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright © 2012 Martin Ueding <dev@martin-ueding.de> ############################################################################### # License (MIT) # ############################################################...
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright © 2012 Martin Ueding <dev@martin-ueding.de> import subprocess __docformat__ = "restructuredtext en" class Colorcodes(object): """ Provides ANSI terminal color codes which are gathered via the ``tput`` utility. That way, they are portable. If there oc...
mit
Python
cf9e8ec4d2b6547778754bb8b7202033abcffee4
Bump version to 0.1.2
praw-dev/prawdditions
prawdditions/const.py
prawdditions/const.py
__version__ = '0.1.2'
__version__ = '0.1.1'
bsd-2-clause
Python
19c0fcacf71141db04c1e01337a959a033dbd1a6
stop adbd on emulator when shutting it down
2gis/stf-utils
common/adb.py
common/adb.py
import os import subprocess def connect(connect_url): command = ["connect", connect_url] _exec_adb(command) def shutdown_emulator(connect_url): _emulator_shell = '-s %s shell' % connect_url _shutdown_command = "am start -a android.intent.action.ACTION_REQUEST_SHUTDOWN; stop adbd" _exec_adb(_emul...
import os import subprocess def connect(connect_url): command = ["connect", connect_url] _exec_adb(command) def shutdown_emulator(connect_url): command = ("-s %s shell am start -a android.intent.action.ACTION_REQUEST_SHUTDOWN" % connect_url).split() _exec_adb(command).wait() def _exec_adb(params):...
mit
Python
54cede651a5604cdf1c1dff8cea1a0da82547397
rename `read_frame` tests
bwhmather/python-payment-terminal,ShwoognationHQ/python-payment-terminal
payment_terminal/tests/bbs/test_connection.py
payment_terminal/tests/bbs/test_connection.py
import io import threading import unittest from payment_terminal.drivers.bbs.connection import ( read_frame, BBSMsgRouterConnection, ) class TestBBSConnection(unittest.TestCase): def test_read_one(self): port = io.BytesIO(b'\x00\x0512345') self.assertEqual(read_frame(port), b'12345') def...
import io import threading import unittest from payment_terminal.drivers.bbs.connection import ( read_frame, BBSMsgRouterConnection, ) class TestBBSConnection(unittest.TestCase): def test_read_one(self): port = io.BytesIO(b'\x00\x0512345') self.assertEqual(read_frame(port), b'12345') def...
bsd-3-clause
Python
87c368a980ef0b8e5c648926a7537778a50ce81b
Make test_examplefiles show a better error when there are strange files hanging out in the examplefiles dir.
pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments,pathawks/pygments
tests/test_examplefiles.py
tests/test_examplefiles.py
# -*- coding: utf-8 -*- """ Pygments tests with example files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: 2006-2008 by Georg Brandl. :license: BSD, see LICENSE for more details. """ import os import unittest from pygments import highlight from pygments.lexers import get_lexer_for_filename, get_lexe...
# -*- coding: utf-8 -*- """ Pygments tests with example files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: 2006-2008 by Georg Brandl. :license: BSD, see LICENSE for more details. """ import os import unittest from pygments import highlight from pygments.lexers import get_lexer_for_filename, get_lexe...
bsd-2-clause
Python
721dd33d40b34af9bd62cb4a1fc7d11ea9447ed2
delete hard-coded image file name
mizzy/maglica
maglica/host_worker/vm.py
maglica/host_worker/vm.py
import subprocess import socket import guestfs import re import libvirt from xml.etree.ElementTree import * def clone(args): image = args["image"] hostname = args["hostname"] conn = libvirt.open(None) dom = conn.lookupByName(image) desc = fromstring(dom.XMLDesc(libvirt.VIR_DOMAIN_XML_SECUR...
import subprocess import socket import guestfs import re def clone(args): image = args["image"] hostname = args["hostname"] image_file = "/var/lib/libvirt/images/" + hostname + ".img" cmdline = [ "virt-clone", "-o", image, "-n", hostname, "-f", ...
bsd-2-clause
Python
6091ad55972af3dbebd8f8e9643a0cd64a229d7a
add CHANNEL_TYPE_CONTACT_LIST
freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut
tests/twisted/constants.py
tests/twisted/constants.py
""" Some handy constants for other tests to share and enjoy. """ from dbus import PROPERTIES_IFACE HT_CONTACT = 1 HT_ROOM =2 HT_CONTACT_LIST = 3 CHANNEL = "org.freedesktop.Telepathy.Channel" CHANNEL_IFACE_GROUP = CHANNEL + ".Interface.Group" CHANNEL_TYPE_TUBES = CHANNEL + ".Type.Tubes" CHANNEL_IFACE_TUBE = CHANNEL +...
""" Some handy constants for other tests to share and enjoy. """ from dbus import PROPERTIES_IFACE HT_CONTACT = 1 HT_ROOM =2 HT_CONTACT_LIST = 3 CHANNEL = "org.freedesktop.Telepathy.Channel" CHANNEL_IFACE_GROUP = CHANNEL + ".Interface.Group" CHANNEL_TYPE_TUBES = CHANNEL + ".Type.Tubes" CHANNEL_IFACE_TUBE = CHANNEL +...
lgpl-2.1
Python
54ac2bed982c3c882413e33ce44dabee8b102ef1
Bump version post-release
praekeltfoundation/certbot,praekeltfoundation/certbot
marathon_acme/__init__.py
marathon_acme/__init__.py
__version__ = '0.6.2.dev0'
__version__ = '0.6.1'
mit
Python
fc158bd10fc77fb514756eeac214fde0ee11bc67
Update parse_binary function
amalshehu/exercism-python
binary/binary.py
binary/binary.py
# File : binary.py # Purpose : Write a program that will convert a binary number, represented as a string (e.g. '101010'), to its decimal equivalent using first principles # Programmer : Amal Shehu # Course : Exercism # Date : Saturday 12 October 2016, 03:02 PM def parse_binary(bin_value): ...
# File : binary.py # Purpose : Write a program that will convert a binary number, represented as a string (e.g. '101010'), to its decimal equivalent using first principles # Programmer : Amal Shehu # Course : Exercism # Date : Saturday 12 October 2016, 03:02 PM def binary(bin_value): sum_ =...
mit
Python
469d809f82449561f06d69e681311c27a78d187a
fix upload
erik998/tontineseed
tontineseed/tontineseed.py
tontineseed/tontineseed.py
# -*- coding: utf-8 -*- import pdb from bottle import route, run, template, SimpleTemplate, static_file, request # FILE UPLOAD FROM STACK OVERFLOW # http://stackoverflow.com/questions/22839474/python-bottle-how-to-upload-media-files-without-dosing-the-server MAX_SIZE = 10 * 1024 * 1024 # 10MB BUF_SIZE = 8192 @route(...
# -*- coding: utf-8 -*- from bottle import route, run, template, SimpleTemplate, static_file @route('/hello/<name>') def hello(name): return template('<b>Hello {{name}}</b>!', name=name) @route('/static/<filepath:path>') def server_static(filepath): return static_file(filepath, root='/opt/ts/bootstrap') @ro...
mit
Python
4e20c3f3c6f18d3328e33220c914803503d98b37
Refactor variables in tool
Naftoreiclag/PepperGrains
tool/SyncEngineCodelite.py
tool/SyncEngineCodelite.py
# Copyright 2017 James Fong # # 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 i...
# Copyright 2017 James Fong # # 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 i...
apache-2.0
Python
091a14a751543295843214d2cb98fa7ff1560f49
Remove requirement on pinax.apps.account
jacobwegner/privileges,jacobwegner/privileges,eldarion/privileges
privileges/auth_backends.py
privileges/auth_backends.py
from privileges.registration import registry class PrivilegesBackend(object): def has_perm(self, user_obj, perm, obj=None): if user_obj.is_anonymous(): return False if registry.has_privilege(user_obj, perm): return True return super(Privileges...
from pinax.apps.account import auth_backends import privileges class AuthenticationBackend(auth_backends.AuthenticationBackend): supports_object_permissions = False supports_anonymous_user = True def has_perm(self, user, perm): if user.is_anonymous(): return False ...
bsd-3-clause
Python
cf25a37bf323588a64b387af6e5ebcfb8caef7cf
Improve the help text for the cert options
dims/nova,vmturbo/nova,rajalokan/nova,cloudbase/nova,vmturbo/nova,klmitch/nova,jianghuaw/nova,jianghuaw/nova,rahulunair/nova,jianghuaw/nova,BeyondTheClouds/nova,zhimin711/nova,NeCTAR-RC/nova,mikalstill/nova,zhimin711/nova,rahulunair/nova,BeyondTheClouds/nova,phenoxim/nova,sebrandon1/nova,NeCTAR-RC/nova,hanlind/nova,seb...
nova/conf/cert.py
nova/conf/cert.py
# Copyright 2016 IBM Corp. # Copyright 2016 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LIC...
# Copyright 2016 IBM Corp. # Copyright 2016 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LIC...
apache-2.0
Python
1a0d3f2080cc45295613b91d1b8b1dd27b46d4f0
Add unhandled input
sputnikus/cmdoro
cmdoro/cli.py
cmdoro/cli.py
# -*- coding: utf-8 -*- """ cmdoro.cli ~~~~~~~~~~ Countdown CLI in curses (with some colors and stuff) :copyright: (c) 2012 by Martin Putniorz. :license: BSD, see LICENSE for details. """ import sys import time import urwid from config import loader def countdown(minutes): """The countdown...
# -*- coding: utf-8 -*- """ cmdoro.cli ~~~~~~~~~~ Countdown CLI in curses (with some colors and stuff) :copyright: (c) 2012 by Martin Putniorz. :license: BSD, see LICENSE for details. """ import sys import time import urwid from config import loader def countdown(minutes): """The countdown...
bsd-3-clause
Python
2fa155f7d035c1149aac56058ae998f89ac9d2ed
fix mistake
aarsan/django-maintenancemode,shanx/django-maintenancemode,shanx/django-maintenancemode,aarsan/django-maintenancemode
maintenancemode/middleware.py
maintenancemode/middleware.py
# -*- coding: utf-8 -*- import re import django from django.core import urlresolvers if django.VERSION < (1, 4): from django.conf.urls import defaults as urls else: from django.conf import urls from .conf import settings urls.handler503 = 'maintenancemode.views.temporary_unavailable' urls.__all__.append('h...
# -*- coding: utf-8 -*- import re import django from django.core import urlresolvers if django.VERSION < (1, 4): from django.conf.urls import defaults as urls else: from django.conf import urls from .conf import settings urls.handler503 = 'maintenancemode.views.temporary_unavailable' IGNORE_URLS = tuple([...
bsd-3-clause
Python
9815b6986d5ba55db665a112524652c64d9b7158
use isinstance not type
frkwy/oozappa,frkwy/oozappa,tsuyukimakoto/oozappa,tsuyukimakoto/oozappa
oozappa/config.py
oozappa/config.py
# -*- coding:utf8 -*- import sys import os from copy import deepcopy import collections import logging logger = logging.getLogger('oozappa') def _update(org, opt): for k, v in opt.iteritems(): if isinstance(v, collections.Mapping): r = _update(org.get(k, {}), v) org[k] = r ...
# -*- coding:utf8 -*- import sys import os from copy import deepcopy import collections import logging logger = logging.getLogger('oozappa') def _update(org, opt): for k, v in opt.iteritems(): if isinstance(v, collections.Mapping): r = _update(org.get(k, {}), v) org[k] = r ...
mit
Python
6aefcbd44ae81c5f4146e4ef44946f77fb9d2944
make chunkSize depends on a number of transactions in defaultFile in test_file_stores_equailty
evernym/ledger
ledger/test/test_file_stores_equailty.py
ledger/test/test_file_stores_equailty.py
import os import pytest from ledger.stores.chunked_file_store import ChunkedFileStore from ledger.stores.text_file_store import TextFileStore def test_equality_to_text_file_store(tmpdir): """ This test verifies that TextFileStore and ChunkedFileStore behave equally """ isLineNoKey = True storeCont...
import os import pytest from ledger.stores.chunked_file_store import ChunkedFileStore from ledger.stores.text_file_store import TextFileStore def test_equality_to_text_file_store(tmpdir): """ This test verifies that TextFileStore and ChunkedFileStore behave equally """ chunkSize=3 isLineNoKey = ...
apache-2.0
Python
99348fa9eb048c6f75e44b222af6d09be3097915
make users and groups fields raw_id fields in admin
ConsumerAffairs/django-affect
affect/admin.py
affect/admin.py
from django.contrib import admin from .models import Criteria, Flag class CriteriaAdmin(admin.ModelAdmin): model = Criteria raw_id_fields = ('users', 'groups') readonly_fields = ('created', 'modified',) list_display = ('name', 'note', 'flag_names', 'persistent', 'everyone', 'testi...
from django.contrib import admin from .models import Criteria, Flag class CriteriaAdmin(admin.ModelAdmin): model = Criteria readonly_fields = ('created', 'modified',) list_display = ('name', 'note', 'flag_names', 'persistent', 'everyone', 'testing', 'percent', 'superusers', 'staff', ...
bsd-3-clause
Python
fd8c82855f233d2bc7fba482191de46ab5afef5a
Add tests for wagtailimportexport forms.
openstax/openstax-cms,openstax/openstax-cms,openstax/openstax-cms,openstax/openstax-cms,Connexions/openstax-cms,Connexions/openstax-cms
wagtailimportexport/tests/test_views.py
wagtailimportexport/tests/test_views.py
import json import os import tempfile import zipfile from django.core.serializers.json import DjangoJSONEncoder from django.contrib.auth.models import User from django.test import TestCase, Client from wagtailimportexport.compat import Page from django.urls import reverse from wagtailimportexport import views # read ...
import json import os import tempfile import zipfile from django.core.serializers.json import DjangoJSONEncoder from django.contrib.auth.models import User from django.test import TestCase from wagtailimportexport.compat import Page from wagtailimportexport import views # read this aloud class TestViews(TestCase): ...
agpl-3.0
Python
239d43e194961f05cfd2bb8d928d5e7f734d3499
Bump version number to 0.7 without dev
Princeton-CDH/winthrop-django,Princeton-CDH/winthrop-django,Princeton-CDH/winthrop-django
winthrop/__init__.py
winthrop/__init__.py
__version_info__ = (0, 7, 0, None) # Dot-connect all but the last. Last is dash-connected if not None. __version__ = '.'.join([str(i) for i in __version_info__[:-1]]) if __version_info__[-1] is not None: __version__ += ('-%s' % (__version_info__[-1],)) # context processor to add version to the template environme...
__version_info__ = (0, 7, 0, 'dev') # Dot-connect all but the last. Last is dash-connected if not None. __version__ = '.'.join([str(i) for i in __version_info__[:-1]]) if __version_info__[-1] is not None: __version__ += ('-%s' % (__version_info__[-1],)) # context processor to add version to the template environm...
apache-2.0
Python
52ae13b86a4423243772a54d3d3c627037425512
fix victory
Miserlou/OpenWatch,Miserlou/OpenWatch,Miserlou/OpenWatch,Miserlou/OpenWatch
openwatch/urls.py
openwatch/urls.py
from django.conf.urls.defaults import * from django.conf import settings # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^upload/', 'openwatch.recordings.views.upload'), (r'^uploadnocaptcha/', 'openwatch.recordings.views...
from django.conf.urls.defaults import * from django.conf import settings # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Example: (r'^upload/', 'openwatch.recordings.views.upload'), (r'^uploadnocaptcha/', 'openwatch.r...
apache-2.0
Python
4c23c548a3d3ecc20a114e9517f3c34f30938e45
fix None in thread_locals.user
qdqmedia/django-templation,qdqmedia/django-templation,qdqmedia/django-templation
templation/locals.py
templation/locals.py
# -*- coding: utf-8 -*- """ Common entry point to store variables inside threads. """ from __future__ import absolute_import from threading import local, current_thread from django.shortcuts import get_object_or_404 from .settings import get_resource_model from django.contrib.auth.models import AnonymousUser class Lo...
# -*- coding: utf-8 -*- """ Common entry point to store variables inside threads. """ from __future__ import absolute_import from threading import local, current_thread from django.shortcuts import get_object_or_404 from .settings import get_resource_model class LocalsManager(object): """ Oh Nasty Hacks™... S...
bsd-3-clause
Python
3f803479a5e24d990335bd93954855f716cb70d3
test git
Miles-Yao/HR
manage.py
manage.py
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hr.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv) # hello world # this is for testing git
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hr.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
mit
Python
84a564b4a06d6d03eabc2ef305ea15a04d01ce80
Fix manager bug
reubano/csv2ofx,reubano/csv2ofx
manage.py
manage.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ A script to manage development tasks """ from __future__ import ( absolute_import, division, print_function, with_statement, unicode_literals) from os import path as p from manager import Manager from subprocess import call manager = Manager() _basedir = p.d...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ A script to manage development tasks """ from __future__ import ( absolute_import, division, print_function, with_statement, unicode_literals) from os import path as p from manager import Manager from subprocess import call manager = Manager() _basedir = p.d...
mit
Python
42712cf021c10d56881861d1bdfb2c8571a792cb
move around serializers
theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs,theonion/django-bulbs
bulbs/super_features/data_serializers.py
bulbs/super_features/data_serializers.py
from rest_framework import serializers from bulbs.super_features.fields import RichTextField class CopySerializer(serializers.Serializer): copy = RichTextField(required=True, field_size="long") class EntrySerializer(CopySerializer, serializers.Serializer): title = RichTextField(field_size="short") class ...
from rest_framework import serializers from bulbs.super_features.fields import RichTextField class EntrySerializer(serializers.Serializer): copy = RichTextField(required=True, field_size="long") class GuideToSerializer(serializers.Serializer): entries = EntrySerializer(many=True, required=False)
mit
Python
9111b8663ccc9ef44b6c0bda34f1405a71e83f4b
refactor for app specific configuration manager
Proteogenomics/trackhub-creator,Proteogenomics/trackhub-creator
config_manager.py
config_manager.py
# # Author : Manuel Bernal Llinares # Project : trackhub-creator # Timestamp : 28-06-2017 9:50 # --- # © 2017 Manuel Bernal Llinares <mbdebian@gmail.com> # All rights reserved. # """ This module manages the configuration for the running pipeline """ # System modules import os import time import json import lo...
# # Author : Manuel Bernal Llinares # Project : trackhub-creator # Timestamp : 28-06-2017 9:50 # --- # © 2017 Manuel Bernal Llinares <mbdebian@gmail.com> # All rights reserved. # """ This module manages the configuration for the running pipeline """ # System modules import os import time import json import lo...
apache-2.0
Python
4e905a5e7dc542e692742bba9836e861f8bf4498
Remove non-existing `rejection_reason` from `admin.py`
patjouk/djangogirls,DjangoGirls/djangogirls,patjouk/djangogirls,DjangoGirls/djangogirls,DjangoGirls/djangogirls,patjouk/djangogirls,patjouk/djangogirls
organize/admin.py
organize/admin.py
from django.contrib import admin from .models import EventApplication, Coorganizer class InlineCoorganizerAdmin(admin.TabularInline): model = Coorganizer extra = 1 @admin.register(EventApplication) class EventApplicationAdmin(admin.ModelAdmin): list_display = ( 'city', 'country', ...
from django.contrib import admin from .models import EventApplication, Coorganizer class InlineCoorganizerAdmin(admin.TabularInline): model = Coorganizer extra = 1 @admin.register(EventApplication) class EventApplicationAdmin(admin.ModelAdmin): list_display = ( 'city', 'country', ...
bsd-3-clause
Python
3fa49eda98233f4cd76cf4f3b9b1fc02006fb2de
Fix result loading for novel mutations
reimandlab/ActiveDriverDB,reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/Visualisation-Framework-for-Genome-Mutations,reimandlab/ActiveDriverDB,reimandlab/ActiveDriverDB,reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/Visualisat...
website/search/mutation_result.py
website/search/mutation_result.py
from models import Protein, Mutation from database import get_or_create class SearchResult: def __init__(self, protein, mutation, is_mutation_novel, type, **kwargs): self.protein = protein self.mutation = mutation self.is_mutation_novel = is_mutation_novel self.type = type ...
from models import Protein, Mutation class SearchResult: def __init__(self, protein, mutation, is_mutation_novel, type, **kwargs): self.protein = protein self.mutation = mutation self.is_mutation_novel = is_mutation_novel self.type = type self.meta_user = None self...
lgpl-2.1
Python
a918d4763f22f673dbfbe475f7888bc5b96354ef
use local_settings
artschwagerb/axolotl,artschwagerb/axolotl
manage.py
manage.py
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "axolotl.local_settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "axolotl.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
mit
Python
0fb5041db4617adfc5fa75798f5340ea84ef3e3a
Fix for 404
LandRegistry/property-frontend-alpha,LandRegistry/property-frontend-alpha,LandRegistry/property-frontend-alpha,LandRegistry/property-frontend-alpha
property_frontend/server.py
property_frontend/server.py
from property_frontend import app from flask import render_template import requests @app.route('/') def index(): return render_template('index.html') @app.route('/property/<title_number>') def property(title_number): titles_api_url = app.config['TITLE_API_URL'] title_url = "%s/title/%s" % (titles_api_url...
from property_frontend import app from flask import render_template import requests @app.route('/') def index(): return render_template('index.html') @app.route('/property/<title_number>') def property(title_number): titles_api_url = app.config['TITLE_API_URL'] title_url = "%s/title/%s" % (titles_api_url...
mit
Python
d8fde389ab90a96d20084983e55142f1ced16f28
fix installing pannel
rr-/dotfiles,rr-/dotfiles,rr-/dotfiles
mod-bspwm/__main__.py
mod-bspwm/__main__.py
#!/bin/python import os from libinstall import FileInstaller, PackageInstaller dir = os.path.dirname(__file__) PackageInstaller.try_install('python-pyqt4') # for panel PackageInstaller.try_install('dmenu') # program executor PackageInstaller.try_install('bspwm-git') # window manager PackageInstal...
#!/bin/python import os from libinstall import FileInstaller, PackageInstaller dir = os.path.dirname(__file__) PackageInstaller.try_install('python-pyqt4') # for panel PackageInstaller.try_install('dmenu') # program executor PackageInstaller.try_install('bspwm-git') # window manager PackageInstal...
mit
Python
53f95822d7d69b2f39f7f672101654f13ab20423
Revert "Renamed SimpleCType to LiteralCType"
benstreb/os-test-harness,benstreb/os-test-harness
ostester/types.py
ostester/types.py
import abc import re def c_type(type_decl): return _SimpleCType(type_decl) class _CType(metaclass=abc.ABCMeta): """ An ABC representing a type in C. Subclasses need to be able to declare and instantiate variables. """ @abc.abstractmethod def declare(self, name): pass @abc.ab...
import abc import re def c_type(type_decl): return _LiteralCType(type_decl) class _CType(metaclass=abc.ABCMeta): """ An ABC representing a type in C. Subclasses need to be able to declare and instantiate variables. """ @abc.abstractmethod def declare(self, name): pass @abc.a...
isc
Python
d66ddec546bf599e60e7fa17419a35ee3a404dcc
add by user option
shuson/wox-plugin-manong-weekly
manong.py
manong.py
# -*- coding: utf-8 -*- import os import shutil import unicodedata import webbrowser import re import requests from wox import Wox,WoxAPI from bs4 import BeautifulSoup ROOT_URL = 'http://weekly.manong.io/' ISSUE_URL = 'http://weekly.manong.io/issues/' def full2half(uc): """Convert full-width characters to half-...
# -*- coding: utf-8 -*- import os import shutil import unicodedata import webbrowser import re import requests from wox import Wox,WoxAPI from bs4 import BeautifulSoup ROOT_URL = 'http://weekly.manong.io/' ISSUE_URL = 'http://weekly.manong.io/issues/' def full2half(uc): """Convert full-width characters to half-...
mit
Python
bbf3d68b9566a826f404aa1ab3da198d765dca58
Add 'phone_number' field to ALLOWED_FIELDS.
heimann/contacts
contacts/rules.py
contacts/rules.py
""" contacts.rules ~~~~~~~~~~~~ This module sets rules for Contacts 📕. :copyright: (c) 2017 by David Heimann. :license: MIT, see LICENSE for more details. """ ALLOWED_FIELDS = [ 'name', 'phone_number', 'first_name', 'last_name', 'phone_number', 'photo', 'email', 'twitter' ]
""" contacts.rules ~~~~~~~~~~~~ This module sets rules for Contacts 📕. :copyright: (c) 2017 by David Heimann. :license: MIT, see LICENSE for more details. """ ALLOWED_FIELDS = [ 'name', 'first_name', 'last_name', 'phone_number', 'photo', 'email', 'twitter' ]
mit
Python
6f693eea6f8d18fdf9790c93c234961da655a52a
update 462
aenon/OnlineJudge,aenon/OnlineJudge
leetcode/5.BitManipulation/462.MinimumMovestoEqualArrayElementsII.py
leetcode/5.BitManipulation/462.MinimumMovestoEqualArrayElementsII.py
# 462. Minimum Moves to Equal Array Elements II # Given a non-empty integer array, find the minimum number of moves required to make all array elements equal, where a move is incrementing a selected element by 1 or decrementing a selected element by 1. # You may assume the array's length is at most 10,000. # Example...
# 462. Minimum Moves to Equal Array Elements II # Given a non-empty integer array, find the minimum number of moves required to make all array elements equal, where a move is incrementing a selected element by 1 or decrementing a selected element by 1. # You may assume the array's length is at most 10,000. # Example...
mit
Python
ef7dd3025e3c50eb4441992440accf9cbfcce5f8
Put dependency to "sale_service_recurrence_configurator".
avanzosc/event-wip
sale_order_create_event/__openerp__.py
sale_order_create_event/__openerp__.py
# -*- coding: utf-8 -*- # (c) 2016 Alfredo de la Fuente - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html { "name": "Sale Order Create Event", "version": "8.0.2.0.0", "license": "AGPL-3", "author": "AvanzOSC", "website": "http://www.avanzosc.es", "contributors": [ ...
# -*- coding: utf-8 -*- # (c) 2016 Alfredo de la Fuente - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html { "name": "Sale Order Create Event", "version": "8.0.2.0.0", "license": "AGPL-3", "author": "AvanzOSC", "website": "http://www.avanzosc.es", "contributors": [ ...
agpl-3.0
Python
2d9b3a88df1d606e2517fa2e1e1bc421d7b370ec
make description an optional field
dreibh/planetlab-lxc-plcapi,dreibh/planetlab-lxc-plcapi,dreibh/planetlab-lxc-plcapi,dreibh/planetlab-lxc-plcapi
PLC/Methods/AddNodeGroup.py
PLC/Methods/AddNodeGroup.py
from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.NodeGroups import NodeGroup, NodeGroups from PLC.Auth import PasswordAuth can_update = lambda (field, value): field in \ ['description'] class AddNodeGroup(Method): """ Adds a new node group...
from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.NodeGroups import NodeGroup, NodeGroups from PLC.Auth import PasswordAuth class AddNodeGroup(Method): """ Adds a new node group. Any values specified in optional_vals are used, otherwise defaults are ...
bsd-3-clause
Python
148974db4b6a73940ab17a75e25df25c0e1418cc
check regex
mnot/redbot,mnot/redbot,mnot/redbot
redbot/syntax/__init__.py
redbot/syntax/__init__.py
import re, sys, types __all__ = [ "rfc3986", "rfc5234", "rfc5322", "rfc5646", "rfc7230", "rfc7231", "rfc7232", "rfc7233", "rfc7234", "rfc7235" ] def check_regex(): """Grab all the regex in this module...
mit
Python
55b34495b21377b8760dd284d778a966d73f285d
Make test suite *more* py34 compatible
njsmith/redll,njsmith/redll,njsmith/redll
redll/tests/test_redll.py
redll/tests/test_redll.py
import sys import os.path import subprocess import shutil import pytest TEST_DIR = os.path.dirname(os.path.abspath(__file__)) def run_exe(path, *, expect_success=True): if hasattr(path, "strpath"): path = path.strpath path = os.path.abspath(path) if os.name == "nt": runner = [] else: ...
import sys import os.path import subprocess import shutil import pytest TEST_DIR = os.path.dirname(os.path.abspath(__file__)) def run_exe(path, *, expect_success=True): if hasattr(path, "strpath"): path = path.strpath path = os.path.abspath(path) if os.name == "nt": runner = [] else: ...
agpl-3.0
Python
825c75684129297bd2beeb7d928441eec1ba016c
Drop DnsDomainFormatter.format_djb()
quattor/aquilon,guillaume-philippon/aquilon,quattor/aquilon,guillaume-philippon/aquilon,quattor/aquilon,guillaume-philippon/aquilon
lib/aquilon/worker/formats/dns_domain.py
lib/aquilon/worker/formats/dns_domain.py
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- # ex: set expandtab softtabstop=4 shiftwidth=4: # # Copyright (C) 2008,2009,2010,2011,2013 Contributor # # 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 t...
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*- # ex: set expandtab softtabstop=4 shiftwidth=4: # # Copyright (C) 2008,2009,2010,2011,2013 Contributor # # 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 t...
apache-2.0
Python
12555db92719be1aa96111ac788bc2fba784b5de
Add functions defineStandardMaterials and defineStandardGlyphs.
mapclient-plugins/plainmodelviewer
mapclientplugins/plainmodelviewerstep/view/plainmodelviewerwidget.py
mapclientplugins/plainmodelviewerstep/view/plainmodelviewerwidget.py
__author__ = 'hsor001' from PySide import QtGui from opencmiss.zinc.context import Context from mapclientplugins.plainmodelviewerstep.view.ui_plainmodelviewerwidget import Ui_PlainModelViewerWidget class PlainModelViewerWidget(QtGui.QWidget): def __init__(self, parent=None): super(PlainModelViewerWidge...
__author__ = 'hsor001' from PySide import QtGui from opencmiss.zinc.context import Context from mapclientplugins.plainmodelviewerstep.view.ui_plainmodelviewerwidget import Ui_PlainModelViewerWidget class PlainModelViewerWidget(QtGui.QWidget): def __init__(self, parent=None): super(PlainModelViewerWidge...
apache-2.0
Python
b7f14ccacfc6303542960ec3b6c7ac1bac1811c8
Change version
open-synergy/account-financial-tools,acsone/account-financial-tools,andhit-r/account-financial-tools,akretion/account-financial-tools,Pexego/account-financial-tools,VitalPet/account-financial-tools,amoya-dx/account-financial-tools,dvitme/account-financial-tools,Domatix/account-financial-tools,alhashash/account-financia...
account_move_template/__openerp__.py
account_move_template/__openerp__.py
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2011 - 2014 Agile Business Group sagl # (<http://www.agilebg.com>) # Copyright (C) 2011 Domsense srl (<http://www.domsense.com>) # # This program is free software: you can redistribute it...
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2011 - 2014 Agile Business Group sagl # (<http://www.agilebg.com>) # Copyright (C) 2011 Domsense srl (<http://www.domsense.com>) # # This program is free software: you can redistribute it...
agpl-3.0
Python
f5412632d4d53ae2c1d6923e49336dd2382b9d1b
add daily sales api
KentaYamada/Siphon,KentaYamada/Siphon
app/__init__.py
app/__init__.py
from flask import Flask from app.controller import cashier from app.controller import category from app.controller import daily_sales from app.controller import dashboard from app.controller import item from app.controller import user from app.controller import view def startup_app(): app = Flask(__name__) #...
from flask import Flask from app.controller import cashier from app.controller import category from app.controller import dashboard from app.controller import item from app.controller import user from app.controller import view def startup_app(): app = Flask(__name__) # URL末尾のスラッシュを含めなくて良いようにする app.url_m...
mit
Python
0960b3db9a5b736553d83bfac1dc83fe1b68d832
Use original notebook filename; omit destination.
data-8/DS8-Interact,data-8/DS8-Interact,data-8/DS8-Interact
app/__init__.py
app/__init__.py
"""Application body""" import os from urllib.error import HTTPError from urllib.request import urlopen from app.auth import HubAuth from flask import Flask, redirect from webargs import Arg from webargs.flaskparser import use_args def create_app(config='production'): app = Flask(__name__, static_url_path='/static'...
"""Application body""" import os from urllib.error import HTTPError from urllib.request import urlopen from app.auth import HubAuth from flask import Flask, redirect from webargs import Arg from webargs.flaskparser import use_args def create_app(config='production'): app = Flask(__name__, static_url_path='/static'...
apache-2.0
Python
132cc0523ce22df40c9a6055073068b29149a2df
Switch to argparse, add argument to keep sending packets
Schamper/xbox-remote-power,Schamper/xbox-remote-power
xbox-remote-power.py
xbox-remote-power.py
import sys, socket, select, time from argparse import ArgumentParser XBOX_PORT = 5050 XBOX_PING = "dd00000a000000000000000400000002" XBOX_POWER = "dd02001300000010" py3 = sys.version_info[0] > 2 def main(): parser = ArgumentParser(description="Send power on packets to a Xbox One.") parser.add_argument('-a',...
import sys, socket, select, time from optparse import OptionParser XBOX_PORT = 5050 XBOX_PING = "dd00000a000000000000000400000002" XBOX_POWER = "dd02001300000010" py3 = sys.version_info[0] > 2 def main(): parser = OptionParser() parser.add_option('-a', '--address', dest='ip_addr', help="IP Address of Xbox O...
mit
Python
b0644e734fbaf75e8947632c0c74c90552b7f286
Fix example stream publisher
ooici/coi-services,ooici/coi-services,ooici/coi-services,ooici/coi-services,ooici/coi-services
examples/stream/publish.py
examples/stream/publish.py
from interface.services.dm.ipubsub_management_service import PubsubManagementServiceClient def start_ctd_publisher(container): pubsubclient = PubsubManagementServiceClient(node=container.node) ctd_stream_def_id = pubsubclient.create_stream_definition(name='SBE37_CDM') stream_id, route = pubsubclient.c...
from interface.services.dm.ipubsub_management_service import PubsubManagementServiceClient def start_ctd_publisher(container): pubsubclient = PubsubManagementServiceClient(node=container.node) stream_id, route = pubsubclient.create_stream('ctd_publisher', exchange_point='science_data') pid = container....
bsd-2-clause
Python