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 |
|---|---|---|---|---|---|---|---|---|
49712dd43a2376c913e66cac7b52fc7247912e44 | Make disable_builtins schema a property | tobinjt/Flexget,spencerjanssen/Flexget,JorisDeRieck/Flexget,v17al/Flexget,oxc/Flexget,jacobmetrick/Flexget,LynxyssCZ/Flexget,Flexget/Flexget,crawln45/Flexget,Danfocus/Flexget,Danfocus/Flexget,offbyone/Flexget,qk4l/Flexget,cvium/Flexget,qvazzler/Flexget,jawilson/Flexget,ZefQ/Flexget,ibrahimkarahan/Flexget,lildadou/Flexg... | flexget/plugins/operate/disable_builtins.py | flexget/plugins/operate/disable_builtins.py | from __future__ import unicode_literals, division, absolute_import
import logging
from flexget import plugin
from flexget.plugin import priority, register_plugin, plugins
log = logging.getLogger('builtins')
def all_builtins():
"""Helper function to return an iterator over all builtin plugins."""
return (plug... | from __future__ import unicode_literals, division, absolute_import
import logging
from flexget import plugin
from flexget.plugin import priority, register_plugin, plugins
log = logging.getLogger('builtins')
def all_builtins():
"""Helper function to return an iterator over all builtin plugins."""
return (plug... | mit | Python |
790be842b1c2e752210d5328dad05acb05d337bb | add minimal test for serial.theaded | DavidHowlett/pyserial-1 | test/test_threaded.py | test/test_threaded.py | #!/usr/bin/env python
#
# This file is part of pySerial - Cross platform serial port support for Python
# (C) 2016 Chris Liechti <cliechti@gmx.net>
#
# SPDX-License-Identifier: BSD-3-Clause
"""\
Test serial.threaded related functionality.
"""
import os
import unittest
import serial
import serial.threaded
import tim... | bsd-3-clause | Python | |
70683aabe3cebda02db62fc254b7ec7532a50618 | Add test_config.sample.py. | previa/dictsheet | test_config.sample.py | test_config.sample.py | CREDENTIAL_FILE = ''
SHEET_NAME = ''
| mit | Python | |
499adce8b5c23d60073d4c92259e611609ee0c61 | Add initial draft script to analyse Maven deps | uvsmtid/common-salt-states,uvsmtid/common-salt-states,uvsmtid/common-salt-states,uvsmtid/common-salt-states | states/common/maven/artifacts/check_dependencies.py | states/common/maven/artifacts/check_dependencies.py | #!/usr/bin/env python
import subprocess as sub
import yaml
import re
distrib_pom_path = '/home/uvsmtid/Works/maritime-singapore.git/clearsea-distribution/pom.xml'
# Resolve (download) all dependencies locally so that next command
# can work offline.
sub.check_call(
[
'mvn',
'-f',
distrib_... | apache-2.0 | Python | |
1a065a251c3337ae7741af1916c51f2edcb9180f | add db.py | shuchangwen/awesome-python-webapp,shuchangwen/awesome-python-webapp | www/transwarp/db.py | www/transwarp/db.py | #/usr/bin/python
#_*_ coding:utf-8 _*_
import threading
class _Engine(object):
"""
数据库引擎对象
"""
def __init__(self, connect):
self._connect = connect
def connect(self):
return self._connect()
engine = None
class _DbCtx(threading.local):
"""
持有数据库连接的上下文对象
"""
def __i... | apache-2.0 | Python | |
fed635826be361c4748f13bca09ed411c59ca352 | Add test for OpenStackServer API to increase test coverage | open-craft/opencraft,open-craft/opencraft,open-craft/opencraft,open-craft/opencraft,open-craft/opencraft | instance/tests/api/test_openstack_server.py | instance/tests/api/test_openstack_server.py | # -*- coding: utf-8 -*-
#
# OpenCraft -- tools to aid developing and hosting free software projects
# Copyright (C) 2015-2016 OpenCraft <contact@opencraft.com>
#
# 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 Fre... | agpl-3.0 | Python | |
6fd75772efac321517a1d8c01addfa5cbbf7caf0 | Add test file for user functions. | IvanMalison/okcupyd,okuser/okcupyd,IvanMalison/okcupyd,okuser/okcupyd | tests/db/user_test.py | tests/db/user_test.py | from okcupyd.db import user
def test_have_messaged_before(T):
message_thread_model = T.factory.message_thread()
assert user.have_messaged_by_username(
message_thread_model.initiator.handle,
message_thread_model.respondent.handle
)
assert user.have_messaged_by_username(
message_t... | mit | Python | |
6d2480c5817a8ba7a4a810378ce8fabe0ede3cbf | check YAML examples | vpsfreecz/brutus,vpsfreecz/brutus,vpsfreecz/brutus | tests/testexamples.py | tests/testexamples.py | #!/usr/bin/python
import os
import yaml
def test_examples():
for filename in os.listdir("examples/"):
with open(os.path.join("examples", filename)) as stream:
print(yaml.load(stream))
| bsd-2-clause | Python | |
a9bb7c7c929b0e182160a700e0a3f23dc3e81765 | Update and rename exercises to exercises/12.py | krzyszti/my_projects,krzyszti/my_projects,krzyszti/my_projects,krzyszti/my_projects | exercises/12.py | exercises/12.py | '''
Define a procedure histogram() that takes a list of
integers and prints a histogram to the screen.
For example, histogram([4, 9, 7]) should print the following:
****
*********
*******
'''
def histogram(lst):
for item in lst:
print(item * '*')
| mit | Python | |
a0d2e58a6eecf3427646f311e638c359706e806a | Add Energenie example code | RPi-Distro/python-energenie,rjw57/energenie,bennuttall/energenie | energenie.py | energenie.py | import RPi.GPIO as GPIO
from time import sleep
bit1 = 11
bit2 = 15
bit3 = 16
bit4 = 13
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
GPIO.setup(bit1, GPIO.OUT)
GPIO.setup(bit2, GPIO.OUT)
GPIO.setup(bit3, GPIO.OUT)
GPIO.setup(bit4, GPIO.OUT)
GPIO.setup(18, GPIO.OUT)
GPIO.setup(22, GPIO.OUT)
GPIO.output(22, False... | bsd-3-clause | Python | |
8646929a913b77438bf58e48e672ea68492d3ac1 | Mark third_party/accessibility-developer-tools as a known license info issue. | dednal/chromium.src,timopulkkinen/BubbleFish,ondra-novak/chromium.src,dednal/chromium.src,axinging/chromium-crosswalk,markYoungH/chromium.src,Just-D/chromium-1,littlstar/chromium.src,Jonekee/chromium.src,dushu1203/chromium.src,markYoungH/chromium.src,ChromiumWebApps/chromium,zcbenz/cefode-chromium,dednal/chromium.src,c... | android_webview/tools/known_issues.py | android_webview/tools/known_issues.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""List of known-incompatibly-licensed directories for Android WebView.
This is not used by the webview_licenses tool itself; it is effectively a
"cache... | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""List of known-incompatibly-licensed directories for Android WebView.
This is not used by the webview_licenses tool itself; it is effectively a
"cache... | bsd-3-clause | Python |
a5440305173c218ec785b0d5a2dfa8b02bb0b731 | Add package: py-fava (#21275) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-fava/package.py | var/spack/repos/builtin/packages/py-fava/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 PyFava(PythonPackage):
"""Fava is a web interface for the double-entry bookkeeping softwar... | lgpl-2.1 | Python | |
31342e58f914c057404fd35edfff42b95e5fb051 | Test #2 (with the current GitLab API syntax) | egnyte/gitlabform,egnyte/gitlabform | gitlabform/gitlabform/test/test_project_settings.py | gitlabform/gitlabform/test/test_project_settings.py | import pytest
from gitlabform.gitlabform import GitLabForm
from gitlabform.gitlabform.test import create_group, create_project_in_group, get_gitlab, GROUP_NAME
PROJECT_NAME = 'project_settings_project'
GROUP_AND_PROJECT_NAME = GROUP_NAME + '/' + PROJECT_NAME
@pytest.fixture(scope="module")
def gitlab(request):
... | mit | Python | |
caf135f6c94146038ac9d9e77a808e30ea52f900 | make pyroma a runnable module (#62) | regebro/pyroma | pyroma/__main__.py | pyroma/__main__.py | from . import main
if __name__ == "__main__":
main()
| mit | Python | |
25a1d94b45980fbc78c162af2c81ad807ee954c9 | add test_vpr.py, add test functions and stubs | heistermann/wradlib,kmuehlbauer/wradlib,kmuehlbauer/wradlib,heistermann/wradlib,wradlib/wradlib,wradlib/wradlib | wradlib/tests/test_vpr.py | wradlib/tests/test_vpr.py | #!/usr/bin/env python
# -------------------------------------------------------------------------------
# Name: test_vpr.py
# Purpose: testing file for the wradlib.vpr module
#
# Authors: wradlib developers
#
# Created: 26.02.2016
# Copyright: (c) wradlib developers
# Licence: The MIT License
#... | mit | Python | |
9ad3b4e6ff5ec500fe1feeb841c4fe00e9267d19 | add sh_quote.py | TristanCavelier/notesntools,TristanCavelier/notesntools,TristanCavelier/notesntools,TristanCavelier/notesntools,TristanCavelier/notesntools | python/sh_quote.py | python/sh_quote.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Tristan Cavelier <t.cavelier@free.fr>
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public L... | mit | Python | |
8a836c53d85f63831e51e7aac9a2f77fdf25ef9f | Add more indexing tests. | sigma-random/numpy,sonnyhu/numpy,sigma-random/numpy,ekalosak/numpy,mingwpy/numpy,ahaldane/numpy,Eric89GXL/numpy,grlee77/numpy,has2k1/numpy,grlee77/numpy,Yusa95/numpy,mathdd/numpy,cjermain/numpy,BMJHayward/numpy,nguyentu1602/numpy,drasmuss/numpy,trankmichael/numpy,rmcgibbo/numpy,skymanaditya1/numpy,BMJHayward/numpy,char... | numpy/core/tests/test_indexing.py | numpy/core/tests/test_indexing.py | from __future__ import division, absolute_import, print_function
import numpy as np
from numpy.compat import asbytes
from numpy.testing import *
import sys, warnings
# The C implementation of fancy indexing is relatively complicated,
# and has many seeming inconsistencies. It also appears to lack any
# kind of test s... | from __future__ import division, absolute_import, print_function
import numpy as np
from numpy.compat import asbytes
from numpy.testing import *
import sys, warnings
# The C implementation of fancy indexing is relatively complicated,
# and has many seeming inconsistencies. It also appears to lack any
# kind of test s... | bsd-3-clause | Python |
2273dfcdb2f311f39e1bffe4f40cdc6e3b753155 | add buildOffsetMap.py | darkf/darkfo,darkf/darkfo,darkf/darkfo,darkf/darkfo,darkf/darkfo | buildOffsetMap.py | buildOffsetMap.py | import sys, os, json
import frm
DATA_PATH = "data"
def main():
if len(sys.argv) != 2:
print "USAGE: %s IMAGES_LIST" % sys.argv[0]
sys.exit(1)
images = list(open(sys.argv[1]))
imageInfo = {}
for image in images:
image = image.rstrip()
frmPath = os.path.join(DATA_PATH, image + ".FRM")
frmInfo = frm.read... | apache-2.0 | Python | |
a62b4f70816b831a16973e861449b0c76761cf52 | Create Odd_Even_Linked_List.py | ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs... | data_structures/Linked_list/Python/Odd_Even_Linked_List.py | data_structures/Linked_list/Python/Odd_Even_Linked_List.py | '''
Given the head of a singly linked list, group all the nodes with odd indices together followed by the nodes with even indices, and return the reordered list.
'''
class Solution(object):
def oddEvenList(self, head):
if head is None: return None
if head.next is None: return head
o = head
... | cc0-1.0 | Python | |
dd0e335574afd936b5849186202aedc8500f2c5b | add build-front | Ircam-Web/mezzanine-organization,Ircam-Web/mezzanine-organization | organization/core/management/commands/build-front.py | organization/core/management/commands/build-front.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016-2017 Ircam
# Copyright (c) 2016-2017 Guillaume Pellerin
# Copyright (c) 2016-2017 Emilie Zawadzki
# This file is part of mezzanine-organization.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... | agpl-3.0 | Python | |
cc2343a564572e6c0bd94279bf3907e9e85da79b | Create version.py | CarlosA-Lopez/Proyecto_Embebidos_Grupo2 | plotly-1.2.9/plotly/version.py | plotly-1.2.9/plotly/version.py | __version__ = '1.2.9'
| unlicense | Python | |
65239ce01df89ceaaed989b28f4623ac521ce2c3 | Add download_stats script | ContinuumIO/pypi-conda-builds | download_stats.py | download_stats.py | import argparse
from xmlrpclib import ServerProxy
import pickle
parser = argparse.ArgumentParser()
parser.add_argument("-n", type=int)
parser.add_argument("--package-list",
action="store")
args = parser.parse_args()
url = 'https://pypi.python.org/pypi'
client = ServerProxy(url)
if not args.packag... | bsd-3-clause | Python | |
2b79fd91b43248169e408093454a32367ecb6d61 | Add a solution that creates a separate LP for each frame transition. | karulont/combopt | project7/project7-lp-single.py | project7/project7-lp-single.py | from gurobipy import *
from sys import argv
import json
import math
import drawful
def read_lst(fn):
with open(fn, 'r') as f:
(n, tp) = json.load(f)
return (n, tp)
def write_lst(fn, lst):
with open(fn, 'w') as f:
json.dump(lst, f)
def distance(v1, v2):
return mat... | mit | Python | |
95a26454173b59c8609ddb81027ed71005e9e86c | add module to handle exceptions | cellnopt/cellnopt,cellnopt/cellnopt | cno/misc/tools.py | cno/misc/tools.py | __all__ = ["CNOError"]
class CNOError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
| bsd-2-clause | Python | |
bb58564dc400e91c132e3a26532595ec9de73958 | Create managers.py | jleeothon/trufflehog | managers.py | managers.py | from django.db import models
class VisibilityManagerMixin(object):
"""
This manager should be used with a model that implements the Hideable
mixin.
"""
def __init__(self, *args, **kwargs):
self.visible = kwargs.pop('visible', True)
super().__init__(*args, **kwargs)
def get_qu... | mit | Python | |
fbaaf3ba027ee9d18df7b1f48533c8847f084381 | Add harmonic mean estimator. | exord/bayev | harmonicmean.py | harmonicmean.py | import numpy.random
import numpy as np
import lib
from math import log
def compute_harmonicmean(lnlike_post, posterior_sample=None, lnlikefunc=None,
lnlikeargs=(), **kwargs):
"""
Computes the harmonic mean estimate of the marginal likelihood.
The estimation is based on n posterio... | mit | Python | |
156a31c7aef3dfc07f5e3b0998b0957308abdd16 | Create getPrice.py | Healdb/CoinGoldBot | src/getPrice.py | src/getPrice.py | import requests
import requests.auth
import time
import json
def getPrices():
print "Grabbing price..."
dogeprice = parsePrices("doge")
btcprice = parsePrices("btc")
ltcprice = parsePrices("ltc")
rddprice = parsePrices("rdd")
obj3 = open('price.txt', 'w')
obj3.wr... | mit | Python | |
7c0bf9e7930773a35da7303284842f74cc7b7744 | Add util script to dump flickr photo stats | JulienLeonard/socialstats | myflickr.py | myflickr.py | #
# use flickrapi to dump stats about pictures in a flickr account
# use time sleep to prevent automatic flickr rejection
#
import sys
import flickrapi
import time
import sys
from basics import *
import xml.etree.ElementTree
#
# method to dump social stats about the flickr user account
# args:
# - api_se... | mit | Python | |
082f11f5a24efd21f05b1d7cc7f1b1f1ab91fb0c | Add exercise 13: couplage | AntoineAugusti/katas,AntoineAugusti/katas,AntoineAugusti/katas | prologin-2014/13_couplage.py | prologin-2014/13_couplage.py | # http://www.prologin.org/training/challenge/demi2014/couplage
from sys import stdin
nbBowlsFirst = int(stdin.readline())
nbBowlsSecond = int(stdin.readline())
bowlsFirst = [int(x) for x in stdin.readline().split()]
bowlsSecond = [int(x) for x in stdin.readline().split()]
def maxInTwoLists(first, second):
"""Find th... | mit | Python | |
f8a0aa92c8e19bc11f8a609733644afe0efed5c8 | Update test script to do match testing. | levilucio/SyVOLT,levilucio/SyVOLT | decompose_test.py | decompose_test.py | from util.decompose_graph import decompose_graph
from core.himesis_utils import expand_graph, set_do_pickle, set_compression
set_do_pickle(True)
set_compression(6)
file_name = "226482067288742734644994685633991185819"
graph = expand_graph(file_name)
print(graph.name)
from core.himesis_utils import load_directory
... | mit | Python | |
577891c76140ce50f6be450594a23d78366c5719 | Create __init__.py | PyThaiNLP/pythainlp | pythainlp/number/__init__.py | pythainlp/number/__init__.py | # ระบบแปลงเลขใน 1- 10 ภาษาไทย
p = [['ภาษาไทย', 'ตัวเลข','เลขไทย'],
['หนึ่ง', '1', '๑'],
['สอง', '2', '๒'],
['สาม', '3', '๓'],
['สี่', '4', '๔'],
['ห้า', '5', '๕'],
['หก', '6', '๖'],
['หก', '7', '๗'],
['แปด', '8', '๘'],
['เก้า', '9', '๙']]
thaitonum = dict((x[2], x[1]) for x ... | apache-2.0 | Python | |
8c98e313caeb82ee710d56399d5de7cf1eb1f7df | Add DNA Coding | kakaba2009/MachineLearning,kakaba2009/MachineLearning,kakaba2009/MachineLearning,kakaba2009/MachineLearning | python/src/dna/dna_coding.py | python/src/dna/dna_coding.py | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import src.mylib.mfile as mfile
from matplotlib import style
stop =int('101010', 2) #101010 I Ching 63 After Completion
befo =int('010101', 2) #101010 I Ching 64 Before Completion
guai =int('111110', 2) #101010 I Ching 43
qian =int('111111', 2) #... | apache-2.0 | Python | |
1be041fd9bfc856fd59fba52501823d80d3ff037 | Create setup.py | bestupefy/openstack-plugin | neutron/setup.py | neutron/setup.py | apache-2.0 | Python | ||
08122e57235e836dbfd4230e9e3ad3f7c54072ff | add simple debug callback test case | Lispython/pycurl,Lispython/pycurl,Lispython/pycurl | pycurl/tests/test_debug.py | pycurl/tests/test_debug.py | # $Id$
import pycurl
def test(**args):
print args
c = pycurl.init()
c.setopt(pycurl.URL, 'http://curl.haxx.se/')
c.setopt(pycurl.VERBOSE, 1)
c.setopt(pycurl.DEBUGFUNCTION, test)
c.perform()
c.cleanup()
| lgpl-2.1 | Python | |
6e42855d527976dd8b1cdb272502ce3aa76f8c6e | Add dbee abstract base class. | vmware/dbeekeeper | dbeekeeper/dbee/base.py | dbeekeeper/dbee/base.py | # Copyright 2013 VMware, 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 or agreed to in writing,... | apache-2.0 | Python | |
7e96013f21bbb5003b30da1e04833dcf58650602 | Implement a ThriftHandler for tornado | fmoo/sparts,bboozzoo/sparts,facebook/sparts,pshuff/sparts,fmoo/sparts,djipko/sparts,bboozzoo/sparts,djipko/sparts,facebook/sparts,pshuff/sparts | freenoted/tasks/tornado_thrift.py | freenoted/tasks/tornado_thrift.py | from __future__ import absolute_import
import tornado.web
from thrift.transport.TTransport import TMemoryBuffer
from thrift.protocol.TBinaryProtocol import TBinaryProtocol
class TornadoThriftHandler(tornado.web.RequestHandler):
def initialize(self, processor):
self.processor = processor
def post... | bsd-3-clause | Python | |
c66e64556747736c1ee7461aa6ee8780a330481b | add sparse_to_dense_test | xzturn/caffe2,Yangqing/caffe2,Yangqing/caffe2,xzturn/caffe2,Yangqing/caffe2,xzturn/caffe2,Yangqing/caffe2,caffe2/caffe2,xzturn/caffe2,Yangqing/caffe2,xzturn/caffe2 | caffe2/python/sparse_to_dense_test.py | caffe2/python/sparse_to_dense_test.py | # Copyright (c) 2016-present, Facebook, 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 or agreed... | apache-2.0 | Python | |
29e8dce6fc2956dc9f942eca41fdb632c382fe8e | Create pylsy.py | gnithin/Pylsy,bcho/Pylsy,muteness/Pylsy,huiyi1990/Pylsy,muteness/Pylsy,gnithin/Pylsy,bcho/Pylsy,huiyi1990/Pylsy | pylsy/tests/pylsy.py | pylsy/tests/pylsy.py | # -*- coding: utf-8 -*-
from __future__ import print_function
class PylsyTable(object):
def __init__(self, attributes):
self.StrTable = ""
self.Attributes = attributes
self.Table = []
self.AttributesLength = []
self.Cols_num = len(self.Attributes)
self.Lines_num =... | mit | Python | |
d60c1f9a6e56472611a96779462b42e8505e7905 | Convert a PDF document to JPEG/PNG image via /pdftoimg endpoint | symisc/pixlab,symisc/pixlab,symisc/pixlab | python/pdf_to_img.py | python/pdf_to_img.py | import requests
import json
# Convert a PDF document to JPEG/PNG image via /pdftoimg endpoint - https://pixlab.io/cmd?id=pdftoimg
req = requests.get('https://api.pixlab.io/pdftoimg',params={
'src':'https://www.getharvest.com/downloads/Invoice_Template.pdf',
'export': 'jpeg',
'key':'My_PixLab_Key'
})
reply = req.j... | bsd-2-clause | Python | |
198b54c9ff796cc98cccfdc530f0111739901b0d | Create base-7.py | yiwen-luo/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,jaredkoontz/leetcode,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,yiwen-luo... | Python/base-7.py | Python/base-7.py | # Time: O(1)
# Space: O(1)
# Given an integer, return its base 7 string representation.
#
# Example 1:
# Input: 100
# Output: "202"
# Example 2:
# Input: -7
# Output: "-10"
# Note: The input will be in range of [-1e7, 1e7].
class Solution(object):
def convertToBase7(self, num):
if num < 0: return '-' + s... | mit | Python | |
50dc018891511ce34b4177a43cfcd678456444cf | test of quasiisothermaldf's meanvR | followthesheep/galpy,jobovy/galpy,jobovy/galpy,jobovy/galpy,followthesheep/galpy,followthesheep/galpy,followthesheep/galpy,jobovy/galpy | nose/test_qdf.py | nose/test_qdf.py | # Tests of the quasiisothermaldf module
import numpy
#fiducial setup uses these
from galpy.potential import MWPotential
from galpy.actionAngle import actionAngleAdiabatic, actionAngleStaeckel
from galpy.df import quasiisothermaldf
aAA= actionAngleAdiabatic(pot=MWPotential,c=True)
aAS= actionAngleStaeckel(pot=MWPotentia... | bsd-3-clause | Python | |
660e53fa4505782a2d1484cc0b6e598edc851df0 | Initialize P05_stylingExcel | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter12/P05_stylingExcel.py | books/AutomateTheBoringStuffWithPython/Chapter12/P05_stylingExcel.py | # This program uses the OpenPyXL module to manipulate Excel documents
import openpyxl
from openpyxl.styles import Font, Style
wb = openpyxl.Workbook()
sheet = wb.get_sheet_by_name("Sheet")
italic24Font = Font(size=24, italic=True)
styleObj = Style(font=italic24Font)
sheet["A1"].style = styleObj
sheet["A1"] = "Hello ... | mit | Python | |
6e79ab6ca68252669055df12c333320bd0bda959 | Create obtainNytimes.py | Derek-Guan/readNewspaper,derekguan/readNewspaper | obtainNytimes.py | obtainNytimes.py | import urllib.request, sys, re
from http.cookiejar import CookieJar
from docx import Document
def writeDoc(title,content):
docName = title+'.docx'
document = Document()
document.add_heading(title, 0)
document.add_paragraph(content)
document.save(docName)
def ObtainContent(pageContent):
#obtain title
for l... | apache-2.0 | Python | |
4e778d86670d4673cd591217d514a1f64dbc8424 | Add an OOP demo | letuananh/pydemo,dakside/pydemo,dakside/pydemo,letuananh/pydemo,dakside/pydemo | oop/basic_oop.py | oop/basic_oop.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
This script demonstrates how to use OOP in Python
Latest version can be found at https://github.com/letuananh/pydemo
References:
Classes in Python:
https://docs.python.org/2/tutorial/classes.html
@author: Le Tuan Anh <tuananh.ke@gmail.com>
'''
# Copyright (c) 2015,... | mit | Python | |
fb5ed0ea066c9bdb801a95e50d78529addffbed8 | add twitter url to video URL email | yoe/veyepar,CarlFK/veyepar,CarlFK/veyepar,xfxf/veyepar,CarlFK/veyepar,yoe/veyepar,CarlFK/veyepar,xfxf/veyepar,xfxf/veyepar,yoe/veyepar,xfxf/veyepar,CarlFK/veyepar,xfxf/veyepar,yoe/veyepar,yoe/veyepar | dj/scripts/email_url.py | dj/scripts/email_url.py | #!/usr/bin/python
# email_url.py
# emails the video URL to the presenters
from email_ab import email_ab
class email_url(email_ab):
ready_state = 7
subject_template = "[{{ep.show.name}}] Video up: {{ep.name}}"
body_body = """
The video of your talk is posted:
{{url}}
{% if ep.state == 7 %}
Look... | #!/usr/bin/python
# email_url.py
# emails the video URL to the presenters
from email_ab import email_ab
class email_url(email_ab):
ready_state = 7
subject_template = "[{{ep.show.name}}] Video up: {{ep.name}}"
body_body = """
The video of your talk is posted:
{{url}}
Look at it, make sure ... | mit | Python |
b47369d43a0a85ac2bc32bfa77c6a4d9074ce700 | Add basic test case for retrieve_dns module | apel/apel,stfc/apel,tofu-rocketry/apel,apel/apel,tofu-rocketry/apel,stfc/apel | test/test_retrieve_dns.py | test/test_retrieve_dns.py | import logging
import os
import tempfile
import unittest
import mock
import bin.retrieve_dns
logging.basicConfig(level=logging.INFO)
class RetrieveDnsTestCase(unittest.TestCase):
def setUp(self):
# Mock out logging
mock.patch('bin.retrieve_dns.set_up_logging', autospec=True).start()
... | apache-2.0 | Python | |
b97a9571478dc8c919e072734816b412dadc0da9 | Add maths plugin | thomasleese/smartbot-old,Muzer/smartbot,Cyanogenoid/smartbot,tomleese/smartbot | plugins/maths.py | plugins/maths.py | import io
import unittest
from sympy.parsing import sympy_parser
class Plugin:
def on_command(self, bot, msg, stdin, stdout, reply):
expr = " ".join(msg["args"][1:])
expr = sympy_parser.parse_expr(expr)
print(expr.evalf(), file=stdout)
def on_help(self):
return "Perform maths ... | mit | Python | |
932fc681e1e1b79a28d03a480c19869fc0a6956c | Add state module to manage InfluxDB users | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/states/influxdb_user.py | salt/states/influxdb_user.py | # -*- coding: utf-8 -*-
'''
Management of InfluxDB users
============================
(compatible with InfluxDB version 0.9+)
'''
def __virtual__():
'''
Only load if the influxdb module is available
'''
if 'influxdb.db_exists' in __salt__:
return 'influxdb_user'
return False
def _change... | apache-2.0 | Python | |
8ab44294c0dd7b95102bfa1d9e8437067813cd0f | Add basic document parser | adambrenecki/vc2xlsx | vc2xlsx/doc_parser.py | vc2xlsx/doc_parser.py | import parsley
class Goto (object):
def __init__(self, x, y):
self.x = x
self.y = y
def __repr__(self):
return "Goto({}, {})".format(repr(self.x), repr(self.y))
class Entry (object):
def __init__(self, value):
self.value = value
def __repr__(self):
return "Entry({})".format(repr(self.value))
class Me... | agpl-3.0 | Python | |
01bcda4326dc0204798f268bb1c60f06526aaba3 | add freebsd shadow module | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/modules/freebsd_shadow.py | salt/modules/freebsd_shadow.py | '''
Manage the password database on FreeBSD systems
'''
# Import python libs
import os
try:
import pwd
except ImportError:
pass
# Import salt libs
import salt.utils
def __virtual__():
return 'shadow' if __grains__.get('os', '') == 'FreeBSD' else False
def info(name):
'''
Return information for... | apache-2.0 | Python | |
9dab373023fa6b7767cd7555a533161752205eda | Test a weighted affine solver. | UASLab/ImageAnalysis | scripts/0-weighted-affine.py | scripts/0-weighted-affine.py | #!/usr/bin/python
import sys
sys.path.append('../lib')
import transformations
v0 = [[0, 1031, 1031, 0], [0, 0, 1600, 1600]]
v1 = [[675, 826, 826, 677], [55, 52, 281, 277]]
#weights = [1.0, 1.0, 1.0, 1.0]
weights = [0.1, 0.01, 0.1, 0.2]
print "original"
print transformations.affine_matrix_from_points(v0, v1, shear=Fa... | mit | Python | |
260e0ef2bc37750dccea47d30110221c272e757a | Add script for automating analysis for all corpora | MontrealCorpusTools/SPADE,MontrealCorpusTools/SPADE | run_all_corpora.py | run_all_corpora.py | import os
import argparse
import subprocess
parser = argparse.ArgumentParser()
parser.add_argument("corpusdir", help = "Path to the directory containing corpus directories")
parser.add_argument("script", help = "name of the script to be run")
args = parser.parse_args()
## lists of corpora to skip
## and failed to run... | mit | Python | |
593941ec42918a389a348a5d35e8c5033bb34e73 | Add 8ball plugin | itsmartin/nimbus,Plastix/nimbus,bcbwilla/nimbus,Brottweiler/nimbus | plugins/ball8.py | plugins/ball8.py | import random
from plugin import CommandPlugin, PluginException
class Ball8(CommandPlugin):
"""
8ball command (by javipepe :))
"""
def __init__(self, bot):
CommandPlugin.__init__(self, bot)
self.triggers = ['8ball']
self.short_help = 'Ask me a question'
self.help = 'As... | mit | Python | |
d22ca6dbf7e8aa98b0f580b7972e157894925365 | Fix test output for combining filename and extension | wintersandroid/tvrenamr,ghickman/tvrenamr | tests/test_auto_moving.py | tests/test_auto_moving.py | import os
import shutil
from nose.tools import assert_equal
from .base import BaseTest
class TestAutoMoving(BaseTest):
organise = True
def teardown(self):
super(TestAutoMoving, self).teardown()
shutil.rmtree(self.organised)
os.mkdir(self.organised)
def test_using_organise_uses_... | import os
import shutil
from nose.tools import assert_equal
from .base import BaseTest
class TestAutoMoving(BaseTest):
organise = True
def teardown(self):
super(TestAutoMoving, self).teardown()
shutil.rmtree(self.organised)
os.mkdir(self.organised)
def test_using_organise_uses_... | mit | Python |
98c658822cf6782ca0907ab7a68691922e701aa6 | Add unittest for pytesseract | Kaggle/docker-python,Kaggle/docker-python | tests/test_pytesseract.py | tests/test_pytesseract.py | import unittest
import io
import pytesseract
import numpy as np
from wand.image import Image as wandimage
class TestPytesseract(unittest.TestCase):
def test_tesseract(self):
# Open pdf with Wand
with wandimage(filename='/input/tests/data/test.pdf') as wand_image:
img_buffer = np.asarray... | apache-2.0 | Python | |
f8d8580dfffee35236478ec75116b291499c085c | Create maximum-average-subarray-i.py | kamyu104/LeetCode,kamyu104/LeetCode,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,tudennis/Lee... | Python/maximum-average-subarray-i.py | Python/maximum-average-subarray-i.py | # Time: O(n)
# Space: O(1)
# Given an array consisting of n integers,
# find the contiguous subarray of given length k that has the maximum average value.
# And you need to output the maximum average value.
#
# Example 1:
# Input: [1,12,-5,-6,50,3], k = 4
# Output: 12.75
# Explanation: Maximum average is (12-5-6+50)/... | mit | Python | |
164ccb9206885b216e724b3618ebae5601ab0ac0 | Add parallel execution utility module. | eddiejessup/ciabatta | parallel.py | parallel.py | import multiprocessing as mp
def run_func(func, args, parallel=False):
if parallel:
mp.Pool(mp.cpu_count() - 1).map(func, args)
else:
for arg in args:
func(arg)
| bsd-3-clause | Python | |
7c3ed589ace907a71931b79902382b168a2ae80d | add direct_link_downloader | jtara1/turbo_palm_tree | downloaders/direct_link_downloader.py | downloaders/direct_link_downloader.py | import os
from urllib.request import urlopen
def direct_link_download(url, file_path):
"""
:param url: direct link to an image
:param file_path: file path (including filename) to save image to
"""
# make sure the file_path param doesn't point to a directory
if os.path.isdir(file_path):
... | apache-2.0 | Python | |
e3e62c964b864c057e98763169ddc0dd922e6fa9 | Add a separate module for common parsing functions. | makrutenko/dunovo,makrutenko/dunovo,makrutenko/dunovo | dunovo_parsers.py | dunovo_parsers.py | import collections
# A pair of `StrandFamily`s with the same barcode.
BarFamily = collections.namedtuple('BarFamily', ('bar', 'ab', 'ba'))
# A pair of `ReadFamily`s with the same order and barcode.
StrandFamily = collections.namedtuple('StrandFamily', ('order', 'mate1', 'mate2'))
# A set of `Read`s with the same ma... | isc | Python | |
1455f6c563edd07a61dd826bde03137fff2d3f57 | add data for recipe 1.8 | ordinary-developer/book_python_cookbook_3_ed_d_beazley_b_k_jones | code/ch_1-DATA_STRUCTURES_AND_ALGORITHMS/08-calculating_with_dictionaries/main.py | code/ch_1-DATA_STRUCTURES_AND_ALGORITHMS/08-calculating_with_dictionaries/main.py | def example_1():
prices = {
'ACME': 45.23,
'AAPL': 612.78,
'IBM': 205.55,
'HPQ': 37.20,
'FB': 10.75
}
min_price = min(zip(prices.values(), prices.keys()))
max_price = max(zip(prices.values(), prices.keys()))
print(min_price, max_price)
sorted_prices = so... | mit | Python | |
4879fc188c685e4676414a2f186d8d52998bc28d | Create task_3_3.py | Mariaanisimova/pythonintask | PINp/2015/KAKURKIN_I_V/task_3_3.py | PINp/2015/KAKURKIN_I_V/task_3_3.py | # Задача 3. Вариант 3.
# Напишите программу, которая выводит имя "Чарльз Лютвидж Доджсон",
# и запрашивает его псевдоним.
# Программа должна сцеплять две эти строки и выводить полученную строку,
# разделяя имя и псевдоним с помощью тире.
NAME = "Чарльз Лютвидж Доджсон"
print(NAME)
PNAME = input("Его псевдоним?\n")
pri... | apache-2.0 | Python | |
8630d60a2ecdd2fac4153623ac64ba188e05d8b7 | Add source code. | John-Lin/pigrelay | pigrelay.py | pigrelay.py | import os
import sys
import time
import socket
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
SOCKFILE = "/tmp/snort_alert"
BUFSIZE = 65863
IP = '127.0.0.1'
PORT = 51234
# TODO: TLS/SSL wrapper for socket
class SnortListener():
def __init__(self):
self.uns... | apache-2.0 | Python | |
e15de99ae79e97becdc3d4a4a2bcf60e70e5d2d4 | Create escolas_ceara.senso_2013.py | santiagosilas/propython | raspagem/random/escolas_ceara.senso_2013.py | raspagem/random/escolas_ceara.senso_2013.py | import urllib.request
import json
#url = 'http://educacao.dadosabertosbr.com/api/cidades/ce'
#cidades = urllib.request.urlopen(url).read()
#cidades = json.loads(cidades.decode('utf-8'))
#print('Lista de Cidades')
#[print(cidade.split(':')[1]) for cidade in cidades]
print('Lista de Escolas Municipais de Aracati com L... | mit | Python | |
ef38b112a2cf46fe1bbb52a9633fd42fad03ddb0 | Update method name | yskmt/rtv,yskmt/rtv,michael-lazar/rtv,shaggytwodope/rtv,michael-lazar/rtv,5225225/rtv,5225225/rtv,TheoPib/rtv,TheoPib/rtv,shaggytwodope/rtv,michael-lazar/rtv | rtv/subscriptions.py | rtv/subscriptions.py | import curses
import sys
import time
import logging
from .content import SubscriptionContent
from .page import BasePage, Navigator, BaseController
from .curses_helpers import (Color, LoadScreen, add_line)
__all__ = ['SubscriptionController', 'SubscriptionPage']
_logger = logging.getLogger(__name__)
class Subscriptio... | import curses
import sys
import time
import logging
from .content import SubscriptionContent
from .page import BasePage, Navigator, BaseController
from .curses_helpers import (Color, LoadScreen, add_line)
__all__ = ['SubscriptionController', 'SubscriptionPage']
_logger = logging.getLogger(__name__)
class Subscriptio... | mit | Python |
43e48de2210873fd5ab6c9181f0aab7884c529be | Create app.py | Fillll/reddit2telegram,Fillll/reddit2telegram | reddit2telegram/channels/r_communism/app.py | reddit2telegram/channels/r_communism/app.py | #encoding:utf-8
subreddit = 'communism'
t_channel = '@r_communism'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| mit | Python | |
d17c14df00c31af49080ff2f9fea8597a8861461 | Add recipe usage command for quick diagnostics. | google/starthinker,google/starthinker,google/starthinker | starthinker_ui/recipe/management/commands/recipe_usage.py | starthinker_ui/recipe/management/commands/recipe_usage.py | ###########################################################################
#
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/l... | apache-2.0 | Python | |
2b797879f3a4bf148575df1309369ed4532e4ab6 | bump version to 14.1.0 | yyt030/pyzmq,swn1/pyzmq,ArvinPan/pyzmq,ArvinPan/pyzmq,dash-dash/pyzmq,swn1/pyzmq,dash-dash/pyzmq,caidongyun/pyzmq,yyt030/pyzmq,caidongyun/pyzmq,ArvinPan/pyzmq,caidongyun/pyzmq,swn1/pyzmq,Mustard-Systems-Ltd/pyzmq,Mustard-Systems-Ltd/pyzmq,dash-dash/pyzmq,Mustard-Systems-Ltd/pyzmq,yyt030/pyzmq | zmq/sugar/version.py | zmq/sugar/version.py | """PyZMQ and 0MQ version functions."""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 Brian Granger, Min Ragan-Kelley
#
# This file is part of pyzmq
#
# Distributed under the terms of the New BSD License. The full license is in
# the file COPYING.BSD, distribut... | """PyZMQ and 0MQ version functions."""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 Brian Granger, Min Ragan-Kelley
#
# This file is part of pyzmq
#
# Distributed under the terms of the New BSD License. The full license is in
# the file COPYING.BSD, distribut... | bsd-3-clause | Python |
5b2c328b94244fd6baf6403349919f3bc4f2d013 | add missing migration | liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin | meinberlin/apps/cms/migrations/0032_update_body.py | meinberlin/apps/cms/migrations/0032_update_body.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-01-23 16:07
from __future__ import unicode_literals
from django.db import migrations
import meinberlin.apps.cms.blocks
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.images.blocks
class Migration(migrations.Migration):
dependenc... | agpl-3.0 | Python | |
e53a951ed98f460b603f43f6364d5d0a0f17a1ba | Add basic class structure, map functionality, and a set of consumer functions. | caffeine-potent/Streamer-Datastructure | src/streamer.py | src/streamer.py | class pStream:
###PRIVATE FUNCTIONS
def _builder(self, expression):
self.STR = expression
return self
###OVERRIDES
def next(self):
return next(self.STR)
def __init__(self, iterable_thing):
self.STR = iterable_thing
def __iter__(self):
return iter(self.STR)
#... | mit | Python | |
82e871441010999e4a369b101019a34e7b03eca4 | add common csp-report URL | issackelly/django-security,issackelly/django-security,MartinPetkov/django-security,MartinPetkov/django-security,barseghyanartur/django-security,barseghyanartur/django-security | security/urls.py | security/urls.py | from django.conf.urls import patterns, include, url
urlpatterns = patterns('security.views',
url('^/csp-report/$', security.views.csp_report),
)
| bsd-3-clause | Python | |
86c3f149726b58951e85f9bd6e324b032430b5ae | Deploy a schema template (#51379) | thaim/ansible,thaim/ansible | lib/ansible/modules/network/aci/mso_schema_template_deploy.py | lib/ansible/modules/network/aci/mso_schema_template_deploy.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2018, Dag Wieers (@dagwieers) <dag@wieers.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_ve... | mit | Python | |
0b6709670179c0721b4f113d13bf34d9ac7715dd | Add a python plotter that compares the results of with Stirling numbers | Anaphory/parameterclone,Anaphory/parameterclone | test/indices.py | test/indices.py | import matplotlib.pyplot as plt
import numpy
from math import factorial
def binom(a,b):
return factorial(a) / (factorial(b)*factorial(a-b))
def stirling(n,k):
if n<=0 or n!=0 and n==k:
return 1
elif k<=0 or n<k:
return 0
elif n==0 and k==0:
return -1
else:
s = sum(... | lgpl-2.1 | Python | |
7b179e4a420a3cd7a27f0f438a6eac462048bb93 | Add py solution for 554. Brick Wall | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | py/brick-wall.py | py/brick-wall.py | import heapq
class Solution(object):
def leastBricks(self, wall):
"""
:type wall: List[List[int]]
:rtype: int
"""
n_row = len(wall)
heap = [(wall[i][0], i, 0) for i in xrange(n_row)]
heapq.heapify(heap)
max_noncross = 0
while True:
... | apache-2.0 | Python | |
846ad2780ad2ccc9afbd6a224d567389bf09611f | add integer-to-english-words | EdisonAlgorithms/LeetCode,zeyuanxy/leet-code,EdisonAlgorithms/LeetCode,zeyuanxy/leet-code,EdisonAlgorithms/LeetCode,zeyuanxy/leet-code | vol6/integer-to-english-words/integer-to-english-words.py | vol6/integer-to-english-words/integer-to-english-words.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Zeyuan Shang
# @Date: 2015-11-06 21:35:56
# @Last Modified by: Zeyuan Shang
# @Last Modified time: 2015-11-06 21:36:07
class Solution(object):
def numberToWords(self, num):
"""
:type num: int
:rtype: str
"""
if num ... | mit | Python | |
f02f8f5a68bd26d1ece32c50482729b7774b6e2a | Add a simple script for looking at connections. | reddit/reddit-plugin-meatspace,reddit/reddit-plugin-meatspace,reddit/reddit-plugin-meatspace | scripts/simple-analysis.py | scripts/simple-analysis.py | #!/usr/bin/python
from __future__ import print_function, division
import networkx
from reddit_meatspace.models import MeetupConnections
connections = MeetupConnections._byID("2013")
digraph = networkx.DiGraph()
for connection, timestamp in connections._values().iteritems():
left, right = connection.split(":")
... | bsd-3-clause | Python | |
e3a36aaab3abe7c645e3b8491cd163dea8ff0fea | add python solution to "project euler - problem 4" | mo/project-euler,mo/project-euler,mo/project-euler,mo/project-euler,mo/project-euler,mo/project-euler,mo/project-euler,mo/project-euler,mo/project-euler | problem4.py | problem4.py |
def is_palindrome(number):
number = str(number)
number_digits = len(number)
for i in xrange(0, number_digits/2):
if number[i] != number[number_digits-i-1]:
return False
return True
def test_it(n):
print n, is_palindrome(n)
for x in xrange(0,1231):
test_it(x);
greatest_palindrome = 0
for x in xrange(100,... | mit | Python | |
bf4b3d79f34e189a30b8168796fa1595bf49f1d7 | Fix field name | occrp/id-backend | core/migrations/0002_auto_20150907_1413.py | core/migrations/0002_auto_20150907_1413.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='notification',
old_name... | mit | Python | |
404051ebc9d68c571be77e177b0455631f0c14ad | create basic model `Food` for run all tests | avelino/django-tags | tests/models.py | tests/models.py | from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from tags.fields import TagField
@python_2_unicode_compatible
class Food(models.Model):
name = models.CharField(max_length=50)
tags = TagField('Tags')
def __str__(self):
... | mit | Python | |
50ca8ffb078b37b472c1ccbbb2a4f21e8d7eade4 | fix gbformatting | kaiweifan/horizon,ntt-pf-lab/openstack-dashboard,Daniex/horizon,occ-data/tukey-portal,flochaz/horizon,developerworks/horizon,LabAdvComp/tukey_portal,developerworks/horizon,anthonydillon/horizon,doug-fish/horizon,coreycb/horizon,henaras/horizon,pnavarro/openstack-dashboard,mdavid/horizon,redhat-cip/horizon,VaneCloud/hor... | django-openstack/django_openstack/templatetags/templatetags/sizeformat.py | django-openstack/django_openstack/templatetags/templatetags/sizeformat.py | """
Template tags for displaying sizes
"""
import datetime
from django import template
from django.utils import translation
from django.utils import formats
register = template.Library()
def int_format(value):
return int(value)
def float_format(value):
return formats.number_format(round(value, 1), 0)
de... | """
Template tags for displaying sizes
"""
import datetime
from django import template
from django.utils import translation
from django.utils import formats
register = template.Library()
def int_format(value):
return int(value)
def float_format(value):
return formats.number_format(round(value, 1), 0)
de... | apache-2.0 | Python |
106bce6081ed6c1c8442a1bb82aa39ef177bed8a | Solve problem 6 | mazayus/ProjectEuler | problem006.py | problem006.py | #!/usr/bin/env python3
def sumsq(maxnumber):
return sum(n**2 for n in range(1, maxnumber+1))
def sqsum(maxnumber):
return sum(range(1, maxnumber+1))**2
print(sqsum(100) - sumsq(100))
| mit | Python | |
fab193fa2c31b2e1cf58255d37f5e8dd63fef206 | Add high level for key signing | saltstack/libnacl,mindw/libnacl,cachedout/libnacl,johnttan/libnacl,RaetProtocol/libnacl,coinkite/libnacl | libnacl/sign.py | libnacl/sign.py | '''
High level routines to maintain signing keys and to sign and verify messages
'''
# Import libancl libs
import libnacl
import libnacl.utils
import libnacl.encode
class Signer(libnacl.utils.BaseKey):
'''
The tools needed to sign messages
'''
def __init__(self, seed=None):
'''
Create ... | apache-2.0 | Python | |
6332ca6fd715e730faf7e377843e2d2f8bfa2b84 | Create blink.py | pumanzor/iot-redlibre,pumanzor/iot-redlibre | linkit/blink.py | linkit/blink.py | #!/usr/bin/python
import mraa # For accessing the GPIO
import time # For sleeping between blinks
LED_GPIO = 5 # we are using D5 pin
blinkLed = mraa.Gpio(LED_GPIO) # Get the LED pin object
blinkLed.dir(mraa.DIR_OUT) # Set the direction as output
ledState = False # LED is off... | mit | Python | |
56b5b0d9f1fd420e2ea7cdb0654d5c2f9d637189 | Add light theme | timmygee/promptastic,nimiq/promptastic,egoddard/promptastic | themes/light.py | themes/light.py | from utils import colors
# Segments colors.
USERATHOST_BG = colors.SMERALD
USERATHOST_FG = colors.WHITE
SSH_BG = colors.LIGHT_ORANGE
SSH_FG = colors.WHITE
CURRENTDIR_BG = colors.MID_GREY
CURRENTDIR_FG = colors.LIGHT_GREY
READONLY_BG = colors.LIGHT_GREY
READONLY_FG = colors.RED
EXITCODE_BG = colors.RED
EXITCODE_FG... | apache-2.0 | Python | |
878d0b793c8efa1dafc246326d519685032ee9a7 | Add new package: influxdb (#17909) | LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/influxdb/package.py | var/spack/repos/builtin/packages/influxdb/package.py | # Copyright 2013-2020 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 *
import platform
_versions = {
'1.8.1': {
'Linux_amd64': ('64e60e438ac8a8fdacc6623f238c40b... | lgpl-2.1 | Python | |
0c94e01a6d70b9ab228adc6ba3b094a488ee6020 | Create json_yaml.py | app-git-hub/yamSettings | json_yaml.py | json_yaml.py | class FileHandler():
""" lazy read 'num_lines' lines from filePath
to avoid overwhelming the RAM, most importantly
it runs only when asked for """
filePath, num_lines = str(), int()
def setVarValues(self):
filePath = input()
num_lines= input()
moreLines = nLineReader()
return
def nLineReader():
wi... | apache-2.0 | Python | |
60e64bac0a3cadccd0f35b5c8e8770b4edf0afff | add new package (#21793) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/virtuoso/package.py | var/spack/repos/builtin/packages/virtuoso/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 Virtuoso(AutotoolsPackage):
"""Virtuoso is a high-performance and scalable Multi-Model RD... | lgpl-2.1 | Python | |
39b63523634801fe8ef2cca03e11b3875d84cdbd | Tweak syntax for f.close() concision, add typehints | mir-group/flare,mir-group/flare | flare/flare_io.py | flare/flare_io.py | from flare.struc import Structure
from typing import List
from json import dump, load
from flare.util import NumpyEncoder
def md_trajectory_to_file(filename: str, structures: List[Structure]):
"""
Take a list of structures and write them to a json file.
:param filename:
:param structures:
"""
with open(filename,... | from flare.struc import Structure
from typing import List
from json import dump, load
from flare.util import NumpyEncoder
def md_trajectory_to_file(filename, structures: List[Structure]):
"""
Take a list of structures and write them to a json file.
:param filename:
:param structures:
"""
f = open(filename, 'w')
... | mit | Python |
cb0d6124ea31e8fb9ff8957072a2b881b882127e | Add Timelapse script for sunrise timelapses | KonradIT/gopro-py-api,KonradIT/gopro-py-api | examples/hero9_timelapse_webcam.py | examples/hero9_timelapse_webcam.py | import sys
import time
from goprocam import GoProCamera, constants
import threading
import logging
"""
I use PM2 to start my GoPro cameras, using a Raspberry Pi 4, works perfectly.
pm2 start timelapse.py --cron "30 7 * * *" --log timelapse.log --no-autorestart
This script will overrride some settings for reliability... | mit | Python | |
39d9dfc1fa8e57b126a2da4978a62702ea206521 | add test for DeactivateMobileWorkerTrigger | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/users/tests/test_deactivate_mobile_worker_trigger.py | corehq/apps/users/tests/test_deactivate_mobile_worker_trigger.py | import datetime
from django.test import TestCase
from corehq.apps.domain.shortcuts import create_domain
from corehq.apps.users.models import (
CommCareUser,
DeactivateMobileWorkerTrigger,
)
class TestDeactivateMobileWorkerTrigger(TestCase):
@classmethod
def setUpClass(cls):
super().setUpCla... | bsd-3-clause | Python | |
9d63571c5add6ff2ff064f41c9bc97a6943a69e9 | add missing migration | mcallistersean/b2-issue-tracker,mcallistersean/b2-issue-tracker,mcallistersean/b2-issue-tracker | toucan/invitations/migrations/0002_auto_20161009_2158.py | toucan/invitations/migrations/0002_auto_20161009_2158.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-09 21:58
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('invitations', '0001_initial'),
]
operations = [
migrations.AlterModelOption... | mit | Python | |
4651e178ddbeac9211f8170e2e20f8a35ff0e3ab | Add a simple CLI script for writing out results of scripts | vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium | ocradmin/plugins/test_nodetree.py | ocradmin/plugins/test_nodetree.py | #!/usr/bin/python
import os
import sys
import json
sys.path.append(os.path.abspath(".."))
os.environ['DJANGO_SETTINGS_MODULE'] = 'ocradmin.settings'
sys.path.insert(0, "lib")
from nodetree import script
from nodetree.manager import ModuleManager
def run(nodelist, outpath):
manager = ModuleManager()
manager.... | apache-2.0 | Python | |
74fec13ce5ca0f011c8970e7664727b422597d9a | Add tools.genetics module (#41, #36)) | a5kin/hecate,a5kin/hecate | xentica/tools/genetics.py | xentica/tools/genetics.py | """A collection of functions allowing genetics manipulations."""
def genome_crossover(*genomes):
"""
Crossover given genomes in stochastic way.
:param genomes: A list of genomes (integers) to crossover
:returns: Single integer, a resulting genome.
"""
raise NotImplementedError
| mit | Python | |
5f0ebdb043a313a784c723c36b87d316e276629f | Add recurring events experiment | joel-wright/DDRPi,fraz3alpha/DDRPi,fraz3alpha/led-disco-dancefloor | experiments/python/pygame_recurring_events.py | experiments/python/pygame_recurring_events.py | import pygame
import pygame.joystick
from pygame.locals import *
def main():
pygame.init()
clock = pygame.time.Clock()
ue = pygame.event.Event(USEREVENT, {'code':'drop'})
pygame.time.set_timer(127, 500)
while(True):
events = pygame.event.get()
for e in events:
print(e)
clock.t... | mit | Python | |
4d34906eba347f56a13b193efa3cedb3f2ab2a24 | Add tests for ironic-dbsync. | rdo-management/tuskar,rdo-management/tuskar,rdo-management/tuskar,tuskar/tuskar | ironic/tests/test_dbsync.py | ironic/tests/test_dbsync.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# -*- encoding: utf-8 -*-
#
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in complian... | apache-2.0 | Python | |
71849714d809e882838e109d6906086b47fe68c5 | Create hubspot-amulet.py | Pouf/CodingCompetition,Pouf/CodingCompetition | CiO/hubspot-amulet.py | CiO/hubspot-amulet.py | import itertools
def checkio(m):
for a, b, c in itertools.product(range(-180,181), repeat=3):
if not (a + b*m[1][0] + c*m[2][0])%360:
if (a*m[0][1] + b + c*m[2][1])%360 == 225:
if (a*m[0][2] + b*m[1][2] + c)%360 == 315:
return [a, b, c]
| mit | Python | |
5156c590b43f5a2bf577da224829c20bc3b97230 | add first example | credp/lisa,arnoldlu/lisa,credp/lisa,mdigiorgio/lisa,arnoldlu/lisa,credp/lisa,mdigiorgio/lisa,joelagnel/lisa,bjackman/lisa,ARM-software/lisa,ARM-software/lisa,credp/lisa,bjackman/lisa,JaviMerino/lisa,ARM-software/lisa,ARM-software/lisa,joelagnel/lisa | libs/utils/filters.py | libs/utils/filters.py |
# import glob
# import matplotlib.gridspec as gridspec
# import matplotlib.pyplot as plt
# import numpy as np
# import os
# import pandas as pd
# import pylab as pl
# import re
# import sys
# import trappy
# Configure logging
import logging
class Filters(object):
def __init__(self, trace, tasks=None):
s... | apache-2.0 | Python | |
4137fd528367cfc5caf8c89665e1d2ee0ceb8385 | Clean function cleans data correctly | ShipJ/Code | Projects/Tracking/clean.py | Projects/Tracking/clean.py | import pandas as pd
from Code.config import get_path
def clean_ble(df):
PATH = get_path()
# Remove unwanted columns
df = df.drop(['clientmac', 'proximity', 'type', 'probetime_gmt', 'probetime'], axis=1)
# Rename column headers
df.columns=['id', 'datetime', 'sensor', 'power', 'rssi', 'accuracy']
... | mit | Python | |
c0cf6739d3b10868eaae246c36eb691bff42a5aa | Add webdriver base test suite. | kdart/pycopia,kdart/pycopia,kdart/pycopia,kdart/pycopia,kdart/pycopia | QA/pycopia/QA/webdriver.py | QA/pycopia/QA/webdriver.py | #!/usr/bin/python2.5
# -*- coding: us-ascii -*-
# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab
#
# Copyright (C) 2010 Keith Dart <keith@dartworks.biz>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by th... | apache-2.0 | Python | |
b1f22b33a60da2b27ac17090c0fa759e510dd051 | Create rlmradio.py | Grimnir9/cloudbot-stuff | rlmradio.py | rlmradio.py | #Grabs Current Info for RLM Radio Stream
import requests
import re
from cloudbot import hook
import urllib
import urllib.request
url = "http://38.135.36.125:7359/7.html"
@hook.command("rlmradio", autohelp=False)
def rlmradio(text):
url = "http://38.135.36.125:7359/7.html"
html = urllib.request.urlopen(url)... | mit | Python | |
862370ec4cc438b41ab2717ac4dafa16cab94df2 | Add scraper for Housing and Urban Development | lukerosiak/inspectors-general,divergentdave/inspectors-general | inspectors/hud.py | inspectors/hud.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import logging
import os
from urllib.parse import urljoin
from bs4 import BeautifulSoup
from utils import utils, inspector
#
# options:
# standard since/year options for a year range to fetch from.
#
# pages - number of pages to fetch. defaults to all ... | cc0-1.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.