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 |
|---|---|---|---|---|---|---|---|---|
fd2cc81feab4b24b276c8f4a0a8efc16cacef60b | Add template for lab 09 class A | giovanism/TarungLab,laymonage/TarungLab | Lab/09/Template_09_A.py | Lab/09/Template_09_A.py |
class Bangunan:
def __init__(self, nama, lama_sewa, harga_sewa):
self.nama = nama
self.lama_sewa = lama_sewa
self.harga_sewa = harga_sewa
def getHargaSewa(self):
return self.harga_sewa
class Restoran(Object):
def __init__(self, nama, lama_sewa):
Bangunan.__init__(s... | mit | Python | |
5bf67ac445da7b69dd4f883b8d4ed89bd17f8274 | add urlinfo with basic youtube parsing | desaster/uusipuu | modules/urlinfo.py | modules/urlinfo.py | from twisted.web.client import getPage
from twisted.internet.defer import inlineCallbacks
from core.Uusipuu import UusipuuModule
import re
import lxml.html
class Module(UusipuuModule):
def startup(self):
self.log('urlinfo.py loaded')
def privmsg(self, user, target, msg):
if target != sel... | bsd-2-clause | Python | |
fdb2dc8b54c5d7194639457444c32c20d5e2bfca | Create launch.py | MomsFriendlyRobotCompany/mote,MomsFriendlyRobotCompany/mote | launch.py | launch.py | #!/usr/bin/env python
from __future__ import print_function
from __future__ import division
import pygecko
import opencvutils as cvu
def run():
pass
if __name__ == '__main__':
run()
| mit | Python | |
cee5313906b2ee7e4fb01fc772e2afc6c4de1072 | Add simple lauch script without configuration options | mswart/openvpn2dns,mswart/openvpn2dns | launch.py | launch.py | from twisted.application import internet, service
from twisted.names import dns
from twisted.names import server
from openvpnzone import OpenVpnStatusAuthority, extract_status_file_path
def createOpenvpn2DnsService():
zones = [OpenVpnStatusAuthority(extract_status_file_path('server.conf'))]
f = server.DNSSer... | mit | Python | |
281e328711b9724027eb6b64939bf9795fe86ac4 | Create linter.py | ipernet/yaml-linter-python-wrapper,KRDS/yaml-linter-python-wrapper | linter.py | linter.py | #!/usr/bin/python
import yaml, sys, getopt, os.path
def main(argv):
try:
opts, args = getopt.getopt(argv,"hi:")
except getopt.GetoptError:
print 'linter.py -i <inputfile.yml>'
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print 'linter.py -i <inputfile.yml>'... | mit | Python | |
5d7574728290fd1afba39769bb933b12b6044ee9 | Create massinvandring_streamer.py | ArVID220u/invandringsbot | massinvandring_streamer.py | massinvandring_streamer.py | # the MassinvandringStreamer is a subclass of TwythonStreamer
from twython import TwythonStreamer
# the MassinvandringStreamer class will use the streaming api to find tweets containing the word 'massinvandring'
# This class could technically be used to reply to all kinds of tweets.
class MassinvandringStreamer(Twytho... | mit | Python | |
ced30f90907909090c0da0e468c855f400d9da92 | Add shallow tests for spin-1/2 general drudge | tschijnmo/drudge,tschijnmo/drudge,tschijnmo/drudge | tests/spin_one_half_gen_test.py | tests/spin_one_half_gen_test.py | """Tests for the general model with explicit one-half spin."""
import pytest
from drudge import UP, DOWN, SpinOneHalfGenDrudge
@pytest.fixture(scope='module')
def dr(spark_ctx):
"""The fixture with a general spin one-half drudge."""
return SpinOneHalfGenDrudge(spark_ctx)
def test_spin_one_half_general_dru... | mit | Python | |
251e88398541124555b0c87edf83a59c4ea0347a | add testing framework for new announcer | IanDCarroll/xox | tests/test_announcer_2_chair.py | tests/test_announcer_2_chair.py | import unittest
from source.announcer_2_chair import *
class AnnouncerTestCase(unittest.TestCase):
def setUp(self):
pass
def test_announcer_is_a_class(self):
pass
def test_announcer_has_a_show_method(self):
pass
def test_announcer_has_an_ask_human_method(self):
pass
| mit | Python | |
733dc300dff354312fdfa7588bcd7636117ac0c7 | Create SpatialFieldRetrieve.py | mapping-glory/SpatialFieldRetrieval | SpatialFieldRetrieve.py | SpatialFieldRetrieve.py | #-------------------------------------------------------------------------------
# Name: Spatial Field Retrieval
# Purpose: Retrieve a field from the source dataset and use it to populate
# the target field. Honors selections.
# Author: Andy Bradford
#
# Created: 25/02/2016
# Copyrigh... | mit | Python | |
69ca53841e830c582dde304578ba40d3833ab920 | add script to performance of trace processor ingestion am: c893b17841 | google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto,google/perfetto | tools/measure_tp_performance.py | tools/measure_tp_performance.py | #!/usr/bin/env python3
# Copyright (C) 2021 The Android Open Source Project
#
# 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 requ... | apache-2.0 | Python | |
4791122d34cbf4eaf6bc118c5e7e78346dee7010 | add cost_ensemble | madjelan/CostSensitiveClassification,albahnsen/CostSensitiveClassification | costcla/models/cost_ensemble.py | costcla/models/cost_ensemble.py | __author__ = 'al'
| bsd-3-clause | Python | |
d099466e604c77b3f16676aec9dd1a04fa22ba98 | Set point settimanali | raspibo/ThermoRed,raspibo/ThermoRed | cgi-bin/writedayssetpoints.py | cgi-bin/writedayssetpoints.py | #!/usr/bin/env python3
import os
import json
import cgi
import cgitb
cgitb.enable()
# Mi serve il file dei setpoins
# Se il file esiste lo apro, se no, genero entrambi SetPoints e file
with open("dayssetpointarray.json") as JsonFileDays:
DaysSetPoints = json.load(JsonFileDays)
# Intestazione HTML
print("<!DOCTYP... | mit | Python | |
abd6fab2000d8af016a0251ab9fb912c359a77ed | add atom for eLisp | ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study | compiler/eLisp2/eLisp/atom.py | compiler/eLisp2/eLisp/atom.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2015 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyrig... | bsd-2-clause | Python | |
59f9e552d16e7d4dca73b1232c0804d4ef3154a7 | Add functioning code for training sequence | KT12/hands_on_machine_learning | training_sequence_classifier.py | training_sequence_classifier.py | import tensorflow as tf
import numpy as np
tf.set_random_seed(5)
n_steps = 28
n_inputs = 28
n_neurons = 150
n_outputs = 10
learning_rate = 0.001
X = tf.placeholder(tf.float32, [None, n_steps, n_inputs])
y = tf.placeholder(tf.int32, [None])
with tf.variable_scope('rnn', initializer=tf.contrib.layers.variance_scalin... | mit | Python | |
6ea0d957a49f734151605c952768d15183d3a285 | Create __init__.py | CyberTriber/python | CyberGuard_v2/secrets/__init__.py | CyberGuard_v2/secrets/__init__.py | mit | Python | ||
9e38386947ba01effcf5908adad264aa77a688e5 | Add basic auth module | alorence/django-modern-rpc,alorence/django-modern-rpc | modernrpc/auth.py | modernrpc/auth.py | # coding: utf-8
def user_pass_test(func=None, test_function=None, params=None):
def decorated(function):
function.modernrpc_auth_check_function = test_function
function.modernrpc_auth_check_params = params
return function
# If @rpc_method is used without any argument nor parenthesis... | mit | Python | |
2a44794af558563d9cdfc1d0ea9bf072fad41ffa | test soma_workflow working directory | neurospin/pylearn-epac,neurospin/pylearn-epac | epac/tests/test_swf_wd.py | epac/tests/test_swf_wd.py | # -*- coding: utf-8 -*-
"""
Created on Tue Sep 17 17:07:47 2013
@author: jinpeng.li@cea.fr
"""
import tempfile
import os
from soma_workflow.client import Job, Workflow
from soma_workflow.client import Helper, FileTransfer
from soma_workflow.client import WorkflowController
import socket
import os.path
if __name__ =... | bsd-3-clause | Python | |
231029d867171ad5ee708c61d8a0aed60127aa9a | Add test for Link object. | CybOXProject/python-cybox | cybox/test/objects/link_test.py | cybox/test/objects/link_test.py | # Copyright (c) 2015, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import unittest
from mixbox.vendor.six import u
from cybox.objects.link_object import Link
from cybox.objects.uri_object import URI
from cybox.test.objects import ObjectTestCase
class TestLink(ObjectTestCase, un... | bsd-3-clause | Python | |
07b198463951753535217ff1612c2789045c4046 | add manage.py | praekelt/seed-stage-based-messaging,praekelt/seed-stage-based-messaging,praekelt/seed-staged-based-messaging | manage.py | manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE",
"seed_staged_based_messaging.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| bsd-3-clause | Python | |
2cad12729048dd5dc52b5d612656fe60bb3bd256 | Use '/usr/bin/env python' instead of '/usr/bin/python' in manage.py to support running manage.py as an executable in virtualenvs. | sudheesh001/oh-mainline,campbe13/openhatch,waseem18/oh-mainline,vipul-sharma20/oh-mainline,sudheesh001/oh-mainline,campbe13/openhatch,Changaco/oh-mainline,campbe13/openhatch,vipul-sharma20/oh-mainline,moijes12/oh-mainline,onceuponatimeforever/oh-mainline,vipul-sharma20/oh-mainline,sudheesh001/oh-mainline,SnappleCap/oh-... | manage.py | manage.py | #!/usr/bin/env python
import os
import sys
if not os.path.exists('mysite/manage.py'):
print "Eek, where is the real manage.py? Quitting."
sys.exit(1)
execfile('mysite/manage.py', globals(), locals())
| #!/usr/bin/python
import os
import sys
if not os.path.exists('mysite/manage.py'):
print "Eek, where is the real manage.py? Quitting."
sys.exit(1)
execfile('mysite/manage.py', globals(), locals())
| agpl-3.0 | Python |
be3c5b7f73025a88055fcc22cbfdafbd5829a1b7 | Add listCycle solution | lemming52/white_pawn,lemming52/white_pawn | hackerrank/listCycle/solution.py | hackerrank/listCycle/solution.py | """
A linked list is said to contain a cycle if any node is visited more than once while traversing the list.
Complete the function provided for you in your editor. It has one parameter: a pointer to a Node object named that points to the head of a linked list. Your function must return a boolean denoting whether ... | mit | Python | |
979dbd0ff0fba03847ca96beaf4d68a0f4e5c9eb | Add beam information to 850um file | jpinedaf/B5_wide_multiple | data/b5_scuba2_850um_addbeam.py | data/b5_scuba2_850um_addbeam.py | import os
from astropy.io import fits
file_scuba2_raw='B5_850um_ext_v2_regrid.fits'
file_scuba2_out='B5_850um_ext_v2_regrid_beam.fits'
hdu = fits.open(file_scuba2_raw)
hdr =hdu[0].header
data=hdu[0].data
hdu.close()
hdr.append(('BMAJ', 14.6/3600.))
hdr.append(('BMIN', 14.6/3600.))
hdr.append(('BPA', 0.0))
os.system(... | mit | Python | |
d87311d349b3a7a25b23bd03804a27fd29e90b52 | add missing file | chfw/moban,chfw/moban | moban/data_loaders/manager.py | moban/data_loaders/manager.py | import os
from lml.plugin import PluginManager
from moban import constants
class AnyDataLoader(PluginManager):
def __init__(self):
super(AnyDataLoader, self).__init__(constants.DATA_LOADER_EXTENSION)
def get_data(self, file_name):
file_extension = os.path.splitext(file_name)[1]
file_t... | mit | Python | |
5346b024ffc3e4eca25794214a4539cb8a20f08c | add monk file | atria-soft/eproperty,atria-soft/eproperty | monk_eproperty.py | monk_eproperty.py | #!/usr/bin/python
import monkModule
import monkTools as tools
import os
def get_desc():
return "E-property simple property interface"
def create():
# module name is 'ewol' and type binary.
myModule = monkModule.Module(__file__, 'eproperty', 'LIBRARY')
# enable doculentation :
myModule.set_website("http://atria-s... | apache-2.0 | Python | |
911787ff1c8d0fb03c522e42dcb5f8bacd7fcde6 | Create netstat_parser.py | robert-abela/net-statistics-parser | netstat_parser.py | netstat_parser.py | #The MIT License (MIT)
#
#Copyright (c) 2015 Robert Abela
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, me... | mit | Python | |
3aa165d9527266d978d943437cb03816c30b8608 | add a fit_nh3 test | keflavich/pyspeckit,pyspeckit/pyspeckit,low-sky/pyspeckit,jpinedaf/pyspeckit,e-koch/pyspeckit,keflavich/pyspeckit,e-koch/pyspeckit,jpinedaf/pyspeckit,pyspeckit/pyspeckit,low-sky/pyspeckit | examples/ammonia_fit_example_wrapper.py | examples/ammonia_fit_example_wrapper.py | from __future__ import print_function
import pyspeckit
import numpy as np
from astropy import units as u
from pyspeckit.spectrum.models import ammonia
xarr = np.linspace(-40, 40, 300) * u.km/u.s
oneonemod = ammonia.ammonia(xarr.to(u.GHz, u.doppler_radio(ammonia.freq_dict['oneone']*u.Hz)),)
twotwomod = ammonia.ammonia... | mit | Python | |
29d8e20e41ab599030cd1027069ba01f569c1627 | add terminal highlight utils | garyelephant/pyutils | highlight.py | highlight.py | class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def highlight( s, **term_color ):
"""return ANSI color rendered string
This will work on unixes including OS... | mit | Python | |
23607247006f36034ba29eba0fddbc35c9f407b4 | add script for automatic dependency updates | janxb/php-ical,janxb/php-ical,janxb/php-ical,janxb/php-ical | bin/update-web-dependencies.py | bin/update-web-dependencies.py | #!/usr/bin/env python
import sys,re,urllib.request,json,fileinput
from prettytable import PrettyTable
def replaceAll(file,searchExp,replaceExp):
for line in fileinput.input(file, inplace=1):
if searchExp in line:
line = line.replace(searchExp,replaceExp)
sys.stdout.write(line)
filenam... | mit | Python | |
f2f2f8833628058052fae0c5c814e42411f681d2 | Add migrations | smartchicago/chicago-early-learning,smartchicago/chicago-early-learning,smartchicago/chicago-early-learning,smartchicago/chicago-early-learning | python/ecep/portal/migrations/0021_auto_20170625_1454.py | python/ecep/portal/migrations/0021_auto_20170625_1454.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('portal', '0020_auto_20170525_1921'),
]
operations = [
migrations.AlterField(
model_name='contact',
n... | mit | Python | |
4feb6d987f92981542eea2a9501e363277ce4109 | Create Tcheck2_clear.py | martymcwizard/CS512_link_predictor,martymcwizard/CS512_link_predictor | Tcheck2_clear.py | Tcheck2_clear.py | import sys
from itertools import combinations
F_dict = dict()
M_dict = dict()
counter = 0
fileIn1 = sys.argv[1] #feb_less_april_clear
fileIn2 = sys.argv[2] #mar_clear.txt
fileOut1 = sys.argv[3] #t_pairs_clear.feb
fileOut2 = sys.argv[4] #t_uniq_pairs_clear.mar
fi = open(fileIn1, 'r')
num_lines = sum(1 for line in fi... | mit | Python | |
64c21a3e01d50cdc6a719f0e4e48f925d5dd9e03 | Add tests for very big AST trees | JonathanSalwan/Triton,JonathanSalwan/Triton,JonathanSalwan/Triton,JonathanSalwan/Triton,JonathanSalwan/Triton | src/testers/unittests/test_ast_deep.py | src/testers/unittests/test_ast_deep.py | import unittest
from triton import *
DEPTH = 10000
class TestDeep(unittest.TestCase):
def setUp(self):
"""Define the arch."""
self.triton = TritonContext()
self.triton.setArchitecture(ARCH.X86_64)
self.ctx = self.triton.getAstContext()
sym_var = self.ctx.variable(self.tr... | apache-2.0 | Python | |
c2f79200689171a49c5bd72e6354ba56ee09a6b6 | Upgrade libchromiumcontent to contain printing headers. | simonfork/electron,anko/electron,kazupon/electron,Faiz7412/electron,JesselJohn/electron,etiktin/electron,rajatsingla28/electron,oiledCode/electron,brave/electron,Zagorakiss/electron,voidbridge/electron,thomsonreuters/electron,pirafrank/electron,sky7sea/electron,mattdesl/electron,evgenyzinoviev/electron,yan-foto/electro... | script/lib/config.py | script/lib/config.py | #!/usr/bin/env python
import platform
import sys
NODE_VERSION = 'v0.11.13'
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = '432720d4613e3aac939f127fe55b9d44fea349e5'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[... | #!/usr/bin/env python
import platform
import sys
NODE_VERSION = 'v0.11.13'
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = 'bb664e4665851fe923ce904e620ba43d8d010ba5'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[... | mit | Python |
ddf0a5a4438531e4bfa29d8709c1c76d8ca17f59 | Add helper module for keyword-only arguments. | schandrika/volttron,schandrika/volttron,schandrika/volttron,schandrika/volttron | volttron/platform/kwonlyargs.py | volttron/platform/kwonlyargs.py | '''Support functions for implementing keyword-only arguments.
This module is designed to make it easy to support keyword-only
arguments in Python 2.7 while providing the same kind of exceptions one
would see with Python 3.x.
Basic usage:
def foo(arg1, *args, **kwargs):
# Use required context manager to c... | bsd-2-clause | Python | |
99d95d6ed14e912701b1f6ae26779612694590f5 | add gdw2 django task tutorial | pyjs/pyjs,gpitel/pyjs,minghuascode/pyj,spaceone/pyjs,lancezlin/pyjs,pyjs/pyjs,minghuascode/pyj,andreyvit/pyjamas,gpitel/pyjs,spaceone/pyjs,pombredanne/pyjs,pombredanne/pyjs,pyjs/pyjs,spaceone/pyjs,minghuascode/pyj,pyjs/pyjs,lovelysystems/pyjamas,andreyvit/pyjamas,certik/pyjamas,gpitel/pyjs,lancezlin/pyjs,andreyvit/pyja... | examples/djangotasks/tasks.py | examples/djangotasks/tasks.py | from pyjamas.ui.Label import Label
from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui.VerticalPanel import VerticalPanel
from pyjamas.ui.TextBox import TextBox
from pyjamas.ui.ListBox import ListBox
from pyjamas.ui import KeyboardListener
from pyjamas.JSONService import JSONProxy
class TodoApp:
def onModu... | apache-2.0 | Python | |
cbfb38e904c7bc75c0635d36e896feef6c44fde2 | add modbus_thread example | sourceperl/pyModbusTCP,W84TheSun/pyModbusTCP | examples/modbus_thread.py | examples/modbus_thread.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# modbus_thread
# start a thread for polling a set of registers, display result on console
import time
from threading import Thread, Lock
from pyModbusTCP.client import ModbusClient
SERVER_HOST = "localhost"
SERVER_PORT = 502
# set global
regs = []
# init a thread lock... | mit | Python | |
3b50369b089a94eb961dcc170bee7b97c0345805 | Add script to mass-comment Jenkins triggers on PR | apache/beam,lukecwik/incubator-beam,apache/beam,robertwb/incubator-beam,chamikaramj/beam,lukecwik/incubator-beam,lukecwik/incubator-beam,apache/beam,lukecwik/incubator-beam,chamikaramj/beam,chamikaramj/beam,robertwb/incubator-beam,robertwb/incubator-beam,apache/beam,apache/beam,apache/beam,robertwb/incubator-beam,rober... | release/src/main/scripts/mass_comment.py | release/src/main/scripts/mass_comment.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | apache-2.0 | Python | |
081297b75fdcc9415be20e84b8db19a8eae483c9 | Create match_smiley_to_cvr.py | fnielsen/cvrminer,fnielsen/cvrminer,fnielsen/cvrminer | examples/match_smiley_to_cvr.py | examples/match_smiley_to_cvr.py | """Print match and missing match between smiley and CVR."""
from __future__ import print_function
from cvrminer.cvrmongo import CvrMongo
from cvrminer.smiley import Smiley
cvr_mongo = CvrMongo()
smiley = Smiley()
cvrs = smiley.all_cvrs()
n_missing = 0
n_ok = 0
for cvr in sorted(cvrs):
company = cvr_mongo.get... | apache-2.0 | Python | |
29080fb1764f4eb75ebe1dd79460cce00527bc91 | Add example of using tractography from another pipeline. | yeatmanlab/pyAFQ,arokem/pyAFQ,arokem/pyAFQ,yeatmanlab/pyAFQ | examples/plot_other_tracking.py | examples/plot_other_tracking.py | """
=============================================
Segmenting tractography from another pipeline
=============================================
The AFQ API provides facilities to segment tractography results obtained using
other software. For example, we often use
`qsiprep <https://qsiprep.readthedocs.io/en/latest/>`_ t... | bsd-2-clause | Python | |
1f2917dd4146c2ddb6c0f5532e4aaa63f19f1a44 | Create 1.py | lavosprime/euler | python/problems/1/1.py | python/problems/1/1.py | sum = 0
for number in range(1000):
if not (number % 3 or number % 5):
sum = sum + number
print(sum)
| mit | Python | |
9641234ac5897ec3f1a5f6cf0b5a822e7b103ae8 | 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,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode | 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 |
5c084bf10cb8feda62ac46939b3508a8c0e6a080 | load csv files generic | Algentile/CryptoForecaster | parsers/data_parser.py | parsers/data_parser.py | import numpy as np
from tflearn.data_utils import load_csv
def parse_csv(csv_file):
features, labels = load_csv(csv_file, target_column=4, columns_to_ignore=None, has_header=True)
feature_tensor = np.array(features).reshape(len(features[0]), len(features))
label_tensor = np.array(labels).reshape(len(labels), 1)
re... | mit | Python | |
8be9ab8de9558efa6ded7d184a3cdc8dad43e4ff | Add an ajax_aware_render utility. | lincolnloop/django-jsonit | jsonit/utils.py | jsonit/utils.py | import os
from django.http import HttpResponse
from django.template import RequestContext, loader
def ajax_aware_render(request, template_list, extra_context=None, **kwargs):
if isinstance(template_list, basestring):
template_list = [template_list]
if request.is_ajax():
new_template_list = []... | bsd-3-clause | Python | |
a21add52424d81a36f5a34d067f70cfb2066636f | Add process module | gregthedoe/androtoolbox | androtoolbox/process.py | androtoolbox/process.py | import attr
import re
from .adb import adb
@attr.s
class Process(object):
name = attr.ib()
user = attr.ib()
pid = attr.ib(convert=int)
parent_pid = attr.ib(convert=int)
vsize = attr.ib(convert=int)
rss = attr.ib(convert=int)
wchan = attr.ib()
pc = attr.ib()
state = attr.ib()
... | mit | Python | |
add720894d1d29eb80ee99986c7e8473ef4f3067 | upgrade script for translations works for published items (#1431) | superdesk/superdesk-core,petrjasek/superdesk-core,ioanpocol/superdesk-core,ioanpocol/superdesk-core,superdesk/superdesk-core,mdhaman/superdesk-core,petrjasek/superdesk-core,petrjasek/superdesk-core,superdesk/superdesk-core,mdhaman/superdesk-core,superdesk/superdesk-core,petrjasek/superdesk-core,mdhaman/superdesk-core,i... | superdesk/data_updates/00015_20181127-105425_archive.py | superdesk/data_updates/00015_20181127-105425_archive.py | # -*- coding: utf-8; -*-
# This file is part of Superdesk.
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
#
# Author : tomas
# Creation: 2018-11-27 10:54
from superdesk.commands.data... | agpl-3.0 | Python | |
56c955b5700eb9e133024c9f51e39af9b065dfb1 | Add neopixel rainbow demo. | mathisgerdes/microbit-macau | demos/rainbow.py | demos/rainbow.py | # Add your Python code here. E.g.
from microbit import *
import neopixel
np = neopixel.NeoPixel(pin13, 12)
rainbow_raw = [
(255, 0, 0),
(255, 127, 0),
(255, 255, 0),
(127, 255, 0),
(0, 255, 0),
(0, 255, 127),
(0, 255, 255),
(0, 127, 255),
(0, 0, 255),
(127, 0, 255),
(255, ... | mit | Python | |
255d9b002b820d1c475d2434858fd5ab3c6847cf | add SeriesStim | tyarkoni/featureX,tyarkoni/pliers | pliers/stimuli/misc.py | pliers/stimuli/misc.py | """Miscellaneous Stim classes."""
import numpy as np
import pandas as pd
from .base import Stim
class SeriesStim(Stim):
'''Represents a pandas Series as a pliers Stim.
Args:
data (dict, pd.Series, array-like): A dictionary, pandas Series, or any
other iterable (e.g., list or 1-D numpy a... | bsd-3-clause | Python | |
d270330375060d0bd8694bc8a2ea8bdbb3762586 | add show_single_event for debugging | deepjets/deepjets,deepjets/deepjets,deepjets/deepjets | show_single_event.py | show_single_event.py | from deepjets.generate import get_generator_input, generate
gen_input = get_generator_input('pythia', 'w.config', random_state=1)
for event in generate(gen_input, 1):
print event.jets
print event.subjets
print event.subjets.shape
print event.trimmed_constit
print event.trimmed_constit.shape
| bsd-3-clause | Python | |
974ebd337c00a8b4a07991983eea0b9b60e1af08 | Add example binary sink | librato/statsite,twitter-forks/statsite,tsunli/statsite,jmptrader/statsite,librato/statsite,remind101/statsite,sleepybishop/statsite,drawks/statsite,Instagram/statsite,sleepybishop/statsite,sleepybishop/statsite,librato/statsite,johnkeates/statsite,nspragg/statsite,bossjones/statsite,lazybios/statsite,drawks/statsite,r... | sinks/binary_sink.py | sinks/binary_sink.py | import struct
import sys
# Line format. We have:
# 8 byte unsigned timestamp
# 1 byte metric type
# 1 byte value type
# 2 byte key length
# 8 byte value
LINE = struct.Struct("<QBBHd")
PREFIX_SIZE = 20
TYPE_MAP = {
1: "kv",
2: "counter",
3: "timer"
}
VAL_TYPE_MAP = {
0: "kv",
1: "sum",
2: "sum ... | bsd-3-clause | Python | |
420ebb50cfb5a366b35d058ad6018857b899a19e | Add function approximator to deal with off-switch | rmoehn/cartpole | hiora_cartpole/offswitch_hfa.py | hiora_cartpole/offswitch_hfa.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
# HO … higher-order
class SliceHOFeatureVec(object):
def __init__(self, slice_i, entries_per_slice, feature_vec):
self.feature_vec = feature_vec
self.slice = slice(slice_i * entries_per_slice,
(s... | mit | Python | |
2db2727dcccf81c3dca2e86efabd8e40afb223d1 | Automate Transfers: Add another pre-transfer script | artefactual/automation-tools,artefactual/automation-tools,finoradin/automation-tools | transfers/pre-transfer/add_metadata.py | transfers/pre-transfer/add_metadata.py | #!/usr/bin/env python2
import json
import os
import sys
def main(transfer_path):
basename = os.path.basename(transfer_path)
try:
_, dc_id, _ = basename.split('---')
except ValueError:
return 1
metadata = [
{
'parts': 'objects',
'dc.identifier': dc_id,
... | agpl-3.0 | Python | |
649860778dd61bdcf8d2863222a98c97cef425c6 | Add tool for parsing desired capabilities from a file | seleniumbase/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/seleniumspot,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,mdmintz/seleniumspot,mdmintz/SeleniumBase,seleniumbase/SeleniumBase | seleniumbase/core/capabilities_parser.py | seleniumbase/core/capabilities_parser.py | import re
def get_desired_capabilities(cap_file):
if not cap_file.endswith('.py'):
raise Exception("\n\n`%s` is not a Python file!\n\n" % cap_file)
f = open(cap_file, 'r')
all_code = f.read()
f.close()
desired_capabilities = {}
num_capabilities = 0
code_lines = all_code.split('\... | mit | Python | |
29555289b28e63655e5bb6fa89d163b5e3022827 | add supervised loss as separate term | 255BITS/HyperGAN,255BITS/HyperGAN | hypergan/losses/supervised.py | hypergan/losses/supervised.py | import tensorflow as tf
from hypergan.util.ops import *
from hypergan.util.hc_tf import *
import hyperchamber as hc
def config():
selector = hc.Selector()
selector.set("reduce", [tf.reduce_mean])#reduce_sum, reduce_logexp work
selector.set('create', create)
selector.set('batch_norm', layer_norm_1)
... | mit | Python | |
e1478f694d6ad422a87e03f71a79a8c1b5e77c5c | build for the entire framework | sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia,sparkslabs/kamaelia | Sketches/AM/KPIFramework/setup.py | Sketches/AM/KPIFramework/setup.py | #!/usr/bin/env python
#
# (C) 2004 British Broadcasting Corporation and Kamaelia Contributors(1)
# All Rights Reserved.
#
# You may only modify and redistribute this under the terms of any of the
# following licenses(2): Mozilla Public License, V1.1, GNU General
# Public License, V2.0, GNU Lesser General Pub... | apache-2.0 | Python | |
53306793268cb31944d42caf95c275afcbe97e6d | Add migration for creating the Professional Certificate program type | edx/course-discovery,edx/course-discovery,edx/course-discovery,edx/course-discovery | course_discovery/apps/edx_catalog_extensions/migrations/0002_create_professional_certificate_program_type.py | course_discovery/apps/edx_catalog_extensions/migrations/0002_create_professional_certificate_program_type.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2016-12-19 19:51
from __future__ import unicode_literals
from django.db import migrations
PAID_SEAT_TYPES = ('credit', 'professional', 'verified',)
PROGRAM_TYPE = 'Professional Certificate'
def add_program_type(apps, schema_editor):
SeatType = apps.get_mod... | agpl-3.0 | Python | |
8b894a02cf1d271b7df65e1c3efcac499100ed51 | Add submission form tests | Nikola-K/django_reddit,Nikola-K/django_reddit,Nikola-K/django_reddit | reddit/tests/test_submission.py | reddit/tests/test_submission.py | from django.test import TestCase, Client
from reddit.forms import SubmissionForm
class TestSubmissionForm(TestCase):
def test_full_valid_submission(self):
test_data = {
'title': 'submission_title',
'url': 'http://example.com',
'text': 'submission text'
}
... | apache-2.0 | Python | |
d2802eebe9311243aabc5954f26719fa5544b378 | Create matchingBrackets.py | prashantas/MyDataScience | GeneralPython/PyDataStructure/matchingBrackets.py | GeneralPython/PyDataStructure/matchingBrackets.py | # https://www.geeksforgeeks.org/check-for-balanced-parentheses-in-an-expression/
def areParanthesisBalanced(expr):
stack = list()
for i,chr in enumerate(expr):
#print(i, chr)
if chr in ['(','{','[']:
stack.append(chr)
continue
# IF current current char... | bsd-2-clause | Python | |
6e9a789aa3113403d6d60ca662605506ce70c4d1 | Add empty Resources module. | andela-akiura/bucketlist | app/api_v1/resources.py | app/api_v1/resources.py | """This module contains the resources to be served on the endpoints."""
| mit | Python | |
faa1c167e6551da738f2039ef9e9373bde50ab41 | Add unittest utils. | eronde/py_word_suggest,eronde/vim_suggest,eronde/py_word_suggest,eronde/vim_suggest | app/tests/test_utils.py | app/tests/test_utils.py | import unittest
import re
from app.util.utils import *
class utilsTest(unittest.TestCase):
"""Docstring for decorationsTest. """
def setUp(self):
""" decorators: setup
"""
pass
def tearDown(self):
pass
def test_is_empty(self):
"""utils, is_empty: Check if an ... | mit | Python | |
d9486bc6180a2dfe38a953eb84184e0410e1cb66 | Add a Quartz backend for the null toolkit | tommy-u/enable,tommy-u/enable,tommy-u/enable,tommy-u/enable | enthought/enable/null/quartz.py | enthought/enable/null/quartz.py | #------------------------------------------------------------------------------
# Copyright (c) 2011, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions describe... | bsd-3-clause | Python | |
5f9a2fe783891dd5a1f926060fcfa2561150d840 | add cleese pipeline runner | adamginsburg/APEX_CMZ_H2CO,keflavich/APEX_CMZ_H2CO,keflavich/APEX_CMZ_H2CO,adamginsburg/APEX_CMZ_H2CO | reduction/run_pipeline_cleese.py | reduction/run_pipeline_cleese.py | import make_apex_cubes
from os.path import join
root = '/scratch/aginsbur/apex/'
rawpath = join(root,'raw/')
reducedpath = join(root,'reduced/')
make_apex_cubes.june2013datapath = rawpath
make_apex_cubes.june2013path = join(reducedpath,'june2013/')
make_apex_cubes.h2copath = join(reducedpath, 'h2co_cubes/')
make_apex_... | bsd-3-clause | Python | |
a659f0f8f4672933fc36cecfe62c65366c496f07 | Add a package for VarDictJava@1.5.1 (#5626) | LLNL/spack,matthiasdiener/spack,mfherbst/spack,matthiasdiener/spack,lgarren/spack,krafczyk/spack,LLNL/spack,lgarren/spack,iulian787/spack,krafczyk/spack,EmreAtes/spack,EmreAtes/spack,mfherbst/spack,EmreAtes/spack,iulian787/spack,tmerrick1/spack,tmerrick1/spack,krafczyk/spack,krafczyk/spack,tmerrick1/spack,LLNL/spack,mf... | var/spack/repos/builtin/packages/vardictjava/package.py | var/spack/repos/builtin/packages/vardictjava/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
e7b40a6f10cd70c73134829403a87068df4665ff | Add 101-symmetric-tree.py, solve it both recursively and iteratively | mvj3/leetcode | 101-symmetric-tree.py | 101-symmetric-tree.py | """
Question:
Symmetric Tree
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
For example, this binary tree is symmetric:
1
/ \
2 2
/ \ / \
3 4 4 3
But the following is not:
1
/ \
2 2
\ \
... | mit | Python | |
cc582dd4b435ba06dc140b1ca96b688871e36abb | Add mock python package. | mfherbst/spack,skosukhin/spack,krafczyk/spack,iulian787/spack,tmerrick1/spack,LLNL/spack,mfherbst/spack,TheTimmy/spack,LLNL/spack,tmerrick1/spack,skosukhin/spack,skosukhin/spack,lgarren/spack,iulian787/spack,matthiasdiener/spack,EmreAtes/spack,mfherbst/spack,TheTimmy/spack,TheTimmy/spack,mfherbst/spack,iulian787/spack,... | var/spack/repos/builtin.mock/packages/python/package.py | var/spack/repos/builtin.mock/packages/python/package.py | ##############################################################################
# Copyright (c) 2013-2015, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
f718f852bcc9be7d7ff57b8a0188499d5b1c9f99 | Create pyglatin.py | eringrace/hello-world | pyglatin.py | pyglatin.py | print "Welcome to the Pig Latin Translator! \n"
pyg = "ay"
original = raw_input("Enter a word: ")
if len(original) > 0 and original.isalpha():
word = original.lower()
first = word[0]
if word[0] != "a" or "e" or "i" or "o" or "u":
new_word = word + first + pyg
new_word = new_word[1:]
else:
new_word = word +... | mit | Python | |
a5edbf04345653b18bdb63ed9bd63625689b0f4c | add some simple unit tests for ADMM | odlgroup/odl,aringh/odl,aringh/odl,kohr-h/odl,kohr-h/odl,odlgroup/odl | odl/test/solvers/nonsmooth/admm_test.py | odl/test/solvers/nonsmooth/admm_test.py | # Copyright 2014-2017 The ODL contributors
#
# This file is part of ODL.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at https://mozilla.org/MPL/2.0/.
"""Unit tests for ADMM."""
from __future__ ... | mpl-2.0 | Python | |
a0bd114b8caf75d28bc52a3aba10494660e6735a | Add lc0138_copy_list_with_random_pointer.py | bowen0701/algorithms_data_structures | lc0138_copy_list_with_random_pointer.py | lc0138_copy_list_with_random_pointer.py | """Leetcode 138. Copy List with Random Pointer
Medium
URL: https://leetcode.com/problems/copy-list-with-random-pointer/
A linked list is given such that each node contains an additional
random pointer which could point to any node in the list or null.
Return a deep copy of the list.
Example 1:
Input:
{"$id":"1","... | bsd-2-clause | Python | |
f8bde0dd523a46d81a64f9b3bd8633be0bf6676d | Create an exception to throw when a user tries to tag a bad commit | siggame/webserver,siggame/webserver,siggame/webserver | webserver/codemanagement/exceptions.py | webserver/codemanagement/exceptions.py | class CodeManagementException(Exception):
pass
| bsd-3-clause | Python | |
1120f16569e1bc9c9675a9cefd782b09266cd82c | Add initial k-means algo | murphyke/avocado,murphyke/avocado,murphyke/avocado,murphyke/avocado | avocado/stats/kmeans.py | avocado/stats/kmeans.py | import math
from random import random
from collections import namedtuple
Point = namedtuple('Point', ('coords', 'n', 'ct'))
Cluster = namedtuple('Cluster', ('points', 'center', 'n'))
def euclidean(p1, p2):
return math.sqrt(sum([
(p1.coords[i] - p2.coords[i]) ** 2 for i in range(p1.n)
]))
def calcula... | bsd-2-clause | Python | |
1de5cfe8714c140a79358e4287645f21095abad7 | Create sarafu.py | Hojalab/sarafu,pesaply/sarafu,Hojalab/sarafu,pesaply/sarafu | sarafu.py | sarafu.py | def (sarafu)
print ("sarafu")
| mit | Python | |
d8878fdfae5e4ca61de8b980bbc753f9e86ac655 | Add botaddnitf plugin | jhonnyam123/hangoutsbot | hangupsbot/plugins/botaddnotif.py | hangupsbot/plugins/botaddnotif.py | """
Plugin for monitoring if bot is added to a HO and report it to the bot admins.
Add a "botaddnotif_enable": true parameter in the config.json file.
Author: @cd334
"""
import asyncio
import logging
import hangups
import plugins
logger = logging.getLogger(__name__)
def _initialise(bot):
plugins.register_hand... | agpl-3.0 | Python | |
c2207ed347ab4d804cb7ea966eace6ea93a41326 | Create sensor.py | PythonProgramming/Robotics-with-Raspberry-Pi | sensor.py | sensor.py | import RPi.GPIO as gpio
import time
def distance(measure='cm'):
try:
gpio.setmode(gpio.BOARD)
gpio.setup(12, gpio.OUT)
gpio.setup(16, gpio.IN)
gpio.output(12, False)
while gpio.input(16) == 0:
nosig = time.time()
while gpio.input(16) == 1:
... | mit | Python | |
5ac2e849fbf4857f7b449cdd39608ba053bddf6e | add main func | rfyiamcool/ExtractLevelDomain | ExtractLevelDomain.py | ExtractLevelDomain.py | #coding=utf-8
import re
from urlparse import urlparse
class ExtractLevelDomain():
def __init__(self):
self.topHostPostfix = (
'.com','.la','.io',
'.co', '.cn','.info',
'.net', '.org','.me',
'.mobi', '.us', '.biz',
'.xxx', '.ca', '.co.jp',
... | mit | Python | |
9ad83570d31469758aeec3c80f45ba8b012cef82 | Create genDataFixedSize.py | kyanyoga/perfmon,kyanyoga/perfmon | bin/genDataFixedSize.py | bin/genDataFixedSize.py | #!/usr/bin python
import time
import random
import base64
import os
import sys
start = time.time()
# pwd = os.path.dirname(__file__)
# outputpath = os.path.normpath(pwd + '/../sample_data/' + sys.argv[1])
outputpath = os.path.normpath(sys.argv[1])
# print outputpath
#run for five m:inutes
# while time.time() < s... | mit | Python | |
fd0e09e11d41d1d7b64f7bf592b788fda8b86e3e | Create archive_identifier.py | Bindernews/TheHound | identifiers/archive_identifier.py | identifiers/archive_identifier.py | from identifier import Result
CAB_PATTERNS = [
'4D 53 43 46'
]
class CabResolver:
def identify(self, stream):
return Result('CAB')
def load(hound):
hound.add_matches(CAB_PATTERNS, CabResolver())
| mit | Python | |
bb619aa09132dbd970d2b78e23fecbd78ee774de | Create new package. (#6191) | matthiasdiener/spack,krafczyk/spack,EmreAtes/spack,LLNL/spack,matthiasdiener/spack,LLNL/spack,iulian787/spack,tmerrick1/spack,matthiasdiener/spack,EmreAtes/spack,skosukhin/spack,krafczyk/spack,mfherbst/spack,krafczyk/spack,EmreAtes/spack,mfherbst/spack,mfherbst/spack,krafczyk/spack,iulian787/spack,EmreAtes/spack,EmreAt... | var/spack/repos/builtin/packages/r-aneufinder/package.py | var/spack/repos/builtin/packages/r-aneufinder/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
4091f699d0d75a9a506190ec04e2bfc9fc10f9f5 | add Invoke-WCMDump credentials current user | Hackplayers/Empire-mod-Hpys-tests,Hackplayers/Empire-mod-Hpys-tests,Hackplayers/Empire-mod-Hpys-tests,Hackplayers/Empire-mod-Hpys-tests,Hackplayers/Empire-mod-Hpys-tests | lib/modules/powershell/credentials/Invoke-WCMDump.py | lib/modules/powershell/credentials/Invoke-WCMDump.py | from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
# metadata info about the module, not modified during runtime
self.info = {
# name for the module that will appear in module menus
'Name': 'Invoke-WCMDump',
# list of one or ... | bsd-3-clause | Python | |
d604429f1d27f8753b8d9665a55111a3b90f0699 | Add homebrew version of fluentd logger | erinspace/scrapi,jeffreyliu3230/scrapi,icereval/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,CenterForOpenScience/scrapi,felliott/scrapi,alexgarciac/scrapi,ostwald/scrapi,mehanig/scrapi,felliott/scrapi,fabianvf/scrapi,mehanig/scrapi,fabianvf/scrapi | scrapi/util/logging.py | scrapi/util/logging.py | import logging
from datetime import datetime
from fluent import sender
class FluentHandler(logging.Handler):
'''
Logging Handler for fluent.
'''
def __init__(self,
tag,
host='localhost',
port=24224,
timeout=3.0,
verb... | apache-2.0 | Python | |
cfeb4fbfa44b597772f1eb63d828e605f9e39396 | Add server | idiotandrobot/heathergraph | server.py | server.py | import argparse
import os
import signal
import subprocess
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('operation',
choices=['start', 'stop', 'restart'],
help='start/stop/restart the server')
return parser.parse_args()
def find_s... | mit | Python | |
8fda2e1330277e98b62d3286e5c208d320fc07db | Add simple api to redis with flask | keoghpe/daftpunk,nicr9/daftpunk,keoghpe/daftpunk,nicr9/daftpunk,keoghpe/daftpunk,nicr9/daftpunk | server.py | server.py | from flask import Flask
from flask import json
from flask import Response
import redis
app = Flask(__name__)
r = redis.StrictRedis(host='localhost', port=6379, db=0)
@app.route("/")
def hello():
return "Hello ld!"
@app.route('/properties/')
def show_properties():
props = r.smembers('daftpunk:properties')
... | mit | Python | |
ef108d756ae91925ca0afec280151974eae4a696 | add import script to load existing data in influxdb, optional | horkko/biomaj,horkko/biomaj,genouest/biomaj,genouest/biomaj | scripts/influxdb_import.py | scripts/influxdb_import.py | '''
Import biomaj banks statistics in Influxdb if never done before.....
'''
from influxdb import InfluxDBClient
from biomaj.bank import Bank
from biomaj_core.config import BiomajConfig
import sys
if len(sys.argv) != 1:
print('Usage: influxdb_import.py path_to_global.properties')
sys.exit(1)
BiomajConfig.load... | agpl-3.0 | Python | |
540f913d6b9402512bc2b507504f77f709c17eca | add exec example | anpere/goaway | examples/exec.py | examples/exec.py | """
Example uses of exec.
exec is a special form which takes 1, 2, or 3 arguments.
exec(expr, globals, locals)
locals and globals are optional.
expr is a string to be executed as code.
globals is a dictionary from symbol names to values.
locals is a dictionary from symbol names to values.
"""
import inspect
import nu... | mit | Python | |
c48b6ea55969adff7e0662c551a529161a4d0b94 | add kattis/stockprices | mjenrungrot/algorithm,mjenrungrot/competitive_programming,mjenrungrot/competitive_programming,mjenrungrot/competitive_programming,mjenrungrot/competitive_programming | Kattis/stockprices.py | Kattis/stockprices.py | """
Problem: stockprices
Link: https://open.kattis.com/problems/stockprices
Source: NWERC 2010
"""
import queue
import sys
def runTest():
N = int(input())
buyHeap = queue.PriorityQueue() # MinHeap
sellHeap = queue.PriorityQueue() # MinHeap
stockPrice = None
for i in range(N):
... | mit | Python | |
b01445701c2974c0f69c9a43208111f0b80a167f | Create helloWorld.py | ErDhananjay/Scripting,ErDhananjay/Scripting | helloWorld.py | helloWorld.py | print "Hello World!"
| unlicense | Python | |
9ad2a898298667aa6adfbf0c4e786e431c9a96b1 | test test test | gspindles/mj-score-eval,gspindles/mj-score-eval | python-ver/test.py | python-ver/test.py | print 'blah blah blah'
| mit | Python | |
27575c3fd6bdc55748b808a98c0b19e3edfb17af | Create ShakeBoussole.py | jancelin/geo-poppy,jancelin/geo-poppy | sense-hat/ShakeBoussole.py | sense-hat/ShakeBoussole.py | from sense_hat import SenseHat
import time
import sys
sense = SenseHat()
led_loop = [4, 5, 6, 7, 15, 23, 31, 39, 47, 55, 63, 62, 61, 60, 59, 58, 57, 56, 48, 40, 32, 24, 16, 8, 0, 1, 2, 3]
sense = SenseHat()
sense.set_rotation(0)
sense.clear()
prev_x = 0
prev_y = 0
led_degree_ratio = len(led_loop) / 360.0
while Tr... | agpl-3.0 | Python | |
fb96906301515b268d56bb7a494360f794883223 | include migration for uniq | SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci,SalesforceFoundation/mrbelvedereci | metaci/release/migrations/0002_auto_20180815_2248.py | metaci/release/migrations/0002_auto_20180815_2248.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-08-15 22:48
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('repository', '0005_repository_release_tag_regex'),
('release', '0001_initial'),
]
... | bsd-3-clause | Python | |
c32a9c28c6f868e479d7107a87ba44478d2bc6b2 | add sequana_mapping standalone | sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana,sequana/sequana | sequana/scripts/mapping.py | sequana/scripts/mapping.py | # -*- coding: utf-8 -*-
#
# This file is part of Sequana software
#
# Copyright (c) 2016 - Sequana Development Team
#
# File author(s):
# Thomas Cokelaer <thomas.cokelaer@pasteur.fr>
# Dimitri Desvillechabrol <dimitri.desvillechabrol@pasteur.fr>,
# <d.desvillechabrol@gmail.com>
#
# Distributed u... | bsd-3-clause | Python | |
c503471f3d7318a2519b486b8be74ec1d1f2e235 | Add an admin interface for xmlrpc tokens | Linaro/lava-server,Linaro/lava-server,Linaro/lava-server,Linaro/lava-server | linaro_django_xmlrpc/admin.py | linaro_django_xmlrpc/admin.py | from django.contrib import admin
from linaro_django_xmlrpc.models import AuthToken
class AuthTokenAdmin(admin.ModelAdmin):
list_display = ('user', 'description', 'created_on', 'last_used_on')
admin.site.register(AuthToken, AuthTokenAdmin)
| agpl-3.0 | Python | |
acdc8dd7006955f89507018d1b7e39092f1d2e07 | set r2dbe header without restarting everything | sao-eht/lmtscripts,sao-eht/lmtscripts,sao-eht/lmtscripts,sao-eht/lmtscripts | r2dbe_setheader.py | r2dbe_setheader.py | import adc5g, corr
from time import sleep
from datetime import datetime, time, timedelta
roach2 = corr.katcp_wrapper.FpgaClient('r2dbe-1')
roach2.wait_connected()
sblookup = {0:'LSB', 1:'USB'}
pollookup = {0:'X/L', 1:'Y/R'}
sbmap = {'LSB':0, 'USB':1}
polmap = {'X':0, 'Y':1, 'L':0, 'R':1, 'LCP':0, 'RCP':1}
# IF0:sta... | mit | Python | |
a0702b8ac74c4976cf747880bdfeb86088a16715 | CREATE new Syft Message structure | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | packages/syft/src/syft/core/node/common/node_service/generic_payload/syft_message.py | packages/syft/src/syft/core/node/common/node_service/generic_payload/syft_message.py | # stdlib
from typing import Any
from typing import Dict
from typing import Optional
# third party
from nacl.signing import VerifyKey
# relative
from .....common.message import ImmediateSyftMessage, SignedMessage
from .....common.uid import UID
from .....io.address import Address
from ....abstract.node_service_interfa... | apache-2.0 | Python | |
af61a720abe964c2295d8f0aa555fed9bb67372a | add 4 | ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler | 004.py | 004.py | def pal(value):
return str(value) == str(value)[::-1]
p = 1
for i in xrange(999, 99, -1):
for j in xrange(999, 99, -1):
n = i * j
if n > p and pal(n):
p = n
print p | bsd-3-clause | Python | |
c15c10567a933b605e598129e02ac89bf03d3f02 | add move operation module | yinyin/FileWatcher | lib/filewatcher/operator/mover.py | lib/filewatcher/operator/mover.py | # -*- coding: utf-8 -*-
""" 檔案操作作業模組 """
import os
import shutil
from filewatcher import componentprop
_cached_module_prop_instance = componentprop.OperatorProp('mover', 'move_to', schedule_priority=2, run_priority=2)
def get_module_prop():
""" 取得操作器各項特性/屬性
參數:
(無)
回傳值:
傳回 componentprop.OperatorProp 物件
""... | mit | Python | |
ee1e049a4cbe47ce106824612a69d738562eceb3 | add simple test for testing that view change messages are checked on the receiver side | evernym/zeno,evernym/plenum | plenum/test/view_change/test_instance_change_msg_checking.py | plenum/test/view_change/test_instance_change_msg_checking.py | import pytest
import types
from plenum.common.types import InstanceChange
def test_instance_change_msg_type_checking(nodeSet, looper, up):
nodeA = nodeSet.Alpha
nodeB = nodeSet.Beta
ridBetta = nodeA.nodestack.getRemote(nodeB.name).uid
badViewNo = "BAD"
nodeA.send(InstanceChange(badViewNo), rid... | apache-2.0 | Python | |
a85dc832edf2793fd22489f7801fcdd7e74ec79c | add figure composite | billryan/fig_composite | fig_composite.py | fig_composite.py | #!/usr/bin/env python2
#-*-coding:utf-8 -*-
import os
import sys
import re
import PIL
from PIL import Image
#fig_in_path = os.path.dirname(os.path.realpath(sys.argv[0]))
fig_in_path = os.path.relpath(os.path.dirname(os.path.realpath(sys.argv[0])))
fig_out_path = fig_in_path + "/fig_trans/"
fig_resize_out_path = fig_... | mit | Python | |
21b7b4f2be33eb30545292a1c46f4072d3795e97 | Add link.py | dustalov/watlink,dustalov/watlink | misc/link.py | misc/link.py | #!/usr/bin/env python
from signal import signal, SIGPIPE, SIG_DFL
signal(SIGPIPE, SIG_DFL)
import argparse
import csv
import sys
import itertools
from collections import defaultdict, Counter
from math import log
from sklearn.feature_extraction import DictVectorizer
from sklearn.metrics.pairwise import cosine_similari... | mit | Python | |
e1b47df9fadb888dafc32abc8018b15477d74feb | Add python test unit. | mrlitong/fpsgame,mrlitong/fpsgame,mrlitong/Game-Engine-Development-Usage,mrlitong/fpsgame | fpsgame/tests.py | fpsgame/tests.py | from ctypes import *
import sys
import os
import xml.etree.ElementTree as ET
binaries = '../../../binaries'
# Work out the platform-dependent library filename
dll_filename = {
'posix': './libCollada_dbg.so',
'nt': 'Collada_dbg.dll',
}[os.name] | mit | Python | |
eebbc6743f4aa5c29b7b915580cf9ba0362d889a | Add tests for error cases for the array API elementwise functions | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | numpy/_array_api/tests/test_elementwise_functions.py | numpy/_array_api/tests/test_elementwise_functions.py | from inspect import getfullargspec
from numpy.testing import assert_raises
from .. import asarray, _elementwise_functions
from .._elementwise_functions import bitwise_left_shift, bitwise_right_shift
from .._dtypes import (_all_dtypes, _boolean_dtypes, _floating_dtypes,
_integer_dtypes, _integer... | mit | Python | |
412d27b31dc5644c84ac90179fe74669ce8a406c | change description & goal from varchar(100) to text | talkoopaiva/talkoohakemisto-api | talkoohakemisto/migrations/versions/221e6ee3f6c9_adjust_goal_and_description_size.py | talkoohakemisto/migrations/versions/221e6ee3f6c9_adjust_goal_and_description_size.py | """adjust goal and description size
Revision ID: 221e6ee3f6c9
Revises: 27f12bb68b12
Create Date: 2014-04-12 17:04:16.750942
"""
# revision identifiers, used by Alembic.
revision = '221e6ee3f6c9'
down_revision = '27f12bb68b12'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.execute(
'... | mit | Python | |
8c1f1c0728b261526b19c46dbd459bbc0f4e97a8 | add leetcode Maximum Depth of Binary Tree | Fity/2code,Fity/2code,Fity/2code,Fity/2code,Fity/2code,Fity/2code | leetcode/MaximumDepthOfBinaryTree/solution.py | leetcode/MaximumDepthOfBinaryTree/solution.py | # -*- coding:utf-8 -*-
# Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param root, a tree node
# @return an integer
def maxDepth(self, root):
if not root:
... | mit | Python | |
558c68060903608abe0bbe15303f192eacf529eb | Add way to call converters/harvesters in 0.2.0 | materials-data-facility/forge | proto_main.py | proto_main.py | from importlib import import_module
def call_harvester(source_name, **kwargs):
harvester = import_module("mdf_indexers.harvesters." + source_name + "_harvester")
harvester.harvest(**kwargs)
def call_converter(sources, input_path=None, metadata=None, verbose=False):
if type(sources) is not list:
so... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.