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 |
|---|---|---|---|---|---|---|---|---|
ac28cf005e8f4e800b5dee2f0ede36fa56890b64 | Add top-level issues. | sloede/pyglab,sloede/pyglab | pyglab/issues.py | pyglab/issues.py | from .apirequest import RequestType
class Issues(objects):
def __init__(self, pyglab):
self._pyglab = pyglab
def get(self, sudo=None, page=None, per_page=None):
url = '/issues'
r = self._pyglab.request(RequestType.GET, url,
sudo=sudo, page=page, per_pag... | mit | Python | |
cb5c500af5ca25f4cd96a35114dde59578d15170 | Create tests_diff_between_times.py | davidone/misc,davidone/misc | tests_diff_between_times.py | tests_diff_between_times.py | import pytest
import diff_between_times
def test_validate_date():
val = ('2021-09-15 00:00:00')
assert diff_between_times.validate_date(None, None, val) == val
with pytest.raises(Exception):
val = ('2021-09-15 00:')
assert diff_between_times.validate_date(None, None, val)
sinc... | mit | Python | |
c3b7a84cbc7b557909a00990c976b4abdeefea35 | Use olpc matchbox theme | puneetgkaur/sugar-toolkit-gtk3,tchx84/debian-pkg-sugar-toolkit-gtk3,sugarlabs/sugar-toolkit,ceibal-tatu/sugar-toolkit-gtk3,quozl/sugar-toolkit-gtk3,sugarlabs/sugar-toolkit,samdroid-apps/sugar-toolkit-gtk3,i5o/sugar-toolkit-gtk3,Daksh/sugar-toolkit-gtk3,sugarlabs/sugar-toolkit,tchx84/sugar-toolkit-gtk3,puneetgkaur/backu... | shell/session/Session.py | shell/session/Session.py | import os
import gtk
import gobject
import time
import re
import dbus
import dbus.dbus_bindings
from sugar.presence import PresenceService
from Shell import Shell
from ConsoleWindow import ConsoleWindow
from session.Process import Process
import sugar.env
class DbusProcess(Process):
def __init__(self):
config = s... | import os
import gtk
import gobject
import time
import re
import dbus
import dbus.dbus_bindings
from sugar.presence import PresenceService
from Shell import Shell
from ConsoleWindow import ConsoleWindow
from session.Process import Process
import sugar.env
class DbusProcess(Process):
def __init__(self):
config = s... | lgpl-2.1 | Python |
984381d614f181f1d48104fe6043191b626e636b | Create soundtest.py | averywallis/COMAPtriathlon,averywallis/Radar,averywallis/Yahtzeething,averywallis/Final-Project | soundtest.py | soundtest.py | mit | Python | ||
c7138bd5ae465d072f86b89bff166cca34c82cdd | 添加 escape 的测试 | alingse/jsoncsv | tests/test_escape.py | tests/test_escape.py | # coding=utf-8
# author@alingse
# 2016.11.21
import unittest
from jsoncsv.utils import encode_safe_key, decode_safe_key
class Testescape(unittest.TestCase):
def test_all(self):
path = ['A', 'B', '..', '\.\\ww']
for sep in 'AB.w':
key = encode_safe_key(path, sep)
_path =... | apache-2.0 | Python | |
4a70f9ed2f19cba08208fa9f2a3cafe38ee283b6 | Add simple test for column expansion | qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq | corehq/apps/userreports/tests/test_columns.py | corehq/apps/userreports/tests/test_columns.py | from django.test import SimpleTestCase
from jsonobject.exceptions import BadValueError
from sqlagg import SumWhen
from corehq.apps.userreports.sql import _expand_column
from corehq.apps.userreports.reports.specs import ReportColumn
class TestReportColumn(SimpleTestCase):
def testBadAggregation(self):
wit... | from django.test import SimpleTestCase
from jsonobject.exceptions import BadValueError
from corehq.apps.userreports.reports.specs import ReportColumn
class TestReportColumn(SimpleTestCase):
def testBadAggregation(self):
with self.assertRaises(BadValueError):
ReportColumn.wrap({
... | bsd-3-clause | Python |
643456f6f1bb9f264dbe6d3ad48a84af4e4dd91c | Add data migrations for rulesets | pulilab/rapidpro,pulilab/rapidpro,pulilab/rapidpro,tsotetsi/textily-web,tsotetsi/textily-web,tsotetsi/textily-web,tsotetsi/textily-web,tsotetsi/textily-web,pulilab/rapidpro,pulilab/rapidpro | temba/flows/migrations/0087_fix_open_ended_ruleset_with_timeout.py | temba/flows/migrations/0087_fix_open_ended_ruleset_with_timeout.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-26 08:42
from __future__ import unicode_literals
import json
from django.db import migrations
def fix_ruleset_categories_open_ended(RuleSet):
rulesets = list(RuleSet.objects.all())
if not rulesets:
return
affected_flows = []
f... | agpl-3.0 | Python | |
d2b6abe7535635d2bf8f0c13b87e3ca382f1559d | Add an echo server program for local testing | git-commit/iot-gatekeeper,git-commit/iot-gatekeeper | setup/tcp-echo-server/echo.py | setup/tcp-echo-server/echo.py | # Echo server program
import socket
HOST = '' # Symbolic name meaning all available interfaces
PORT = 4444 # Arbitrary non-privileged port
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.bind((HOST, PORT))
s.listen(1)
conn, addr = s.accept()
with conn:
... | mit | Python | |
e4bec0203c19f5e9204a41de530f93fa46de565f | update - possible test for wednesday | dracaether/python | highestnumber.py | highestnumber.py | number1=int(input("Please enter the first number: "))
number2=int(input("Please enter the second number: "))
number3=int(input("Please enter the third number: "))
if (number1>number2) and (number1>number3):
print("The highest number is",number1)
elif (number2>number1) and (number2>number3):
print("The highest... | mit | Python | |
ce912bfb028633a32c8dbb882000182e7b6ccb80 | Initialize P01_boxPrint | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter10/P01_boxPrint.py | books/AutomateTheBoringStuffWithPython/Chapter10/P01_boxPrint.py | # This program prints out a box based on input sizes
def boxPrint(symbol, width, height):
if len(symbol) != 1:
raise Exception("Symbol must be a single character string.")
if width <= 2:
raise Exception("Width must be greater than 2.")
if height <= 2:
raise Exception("Height must b... | mit | Python | |
8e20c0f4844b366c43bb39e14ab6af5299ab03f0 | Make java_util.create_single_jar function visible also for Bazel | cushon/bazel,cushon/bazel,bazelbuild/bazel,katre/bazel,katre/bazel,cushon/bazel,bazelbuild/bazel,cushon/bazel,bazelbuild/bazel,katre/bazel,bazelbuild/bazel,cushon/bazel,cushon/bazel,katre/bazel,katre/bazel,katre/bazel,bazelbuild/bazel,bazelbuild/bazel | src/main/starlark/builtins_bzl/common/java/java_util.bzl | src/main/starlark/builtins_bzl/common/java/java_util.bzl | # Copyright 2021 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | apache-2.0 | Python | |
3aac0952d5c13e67c812f00f7a35d508dd1c1f5c | Test OEmbed XML parsing. | kgaughan/adjunct,kgaughan/adjunct | tests/test_oembed.py | tests/test_oembed.py | import io
import unittest
from adjunct.oembed import parse_xml_oembed_response
class OEmbedXMLParserTest(unittest.TestCase):
def test_parse(self):
fh = io.StringIO(
"""<?xml version="1.0" encoding="utf-8"?>
<oembed>
<version>1.0</version>
<type>photo</type>
<title>This is a title... | mit | Python | |
4a3faad1bd26054742f871729b25b5a4a37ba127 | Create projective coordinates. | ofgulban/tetrahydra | examples/conversions/rgb_to_v1v2.py | examples/conversions/rgb_to_v1v2.py | """Create isometric logratio transformed coordinates for MRI data."""
import os
import numpy as np
import tetrahydra.core as tet
from tetrahydra.utils import truncate_and_scale
from nibabel import load, save, Nifti1Image
"""Load Data"""
#
nii1 = load('/home/faruk/Data/Faruk/bias_corr/T1_restore.nii.gz')
nii2 = load('... | bsd-3-clause | Python | |
339655b82c7a1d307ca69b0666a3a150a5b04aa6 | Create basic_tweepy.py | agusmakmun/Some-Examples-of-Simple-Python-Script,agusmakmun/Some-Examples-of-Simple-Python-Script | tweepy/basic_tweepy.py | tweepy/basic_tweepy.py | """
See tutorial:
- https://python.web.id/blog/cara-menggunakan-tweepy/
- https://python.web.id/blog/filter-timeline-twitter-menggunakan-tweepy/
"""
import tweepy
# Consumer keys and access tokens, used for OAuth
consumer_key = 'JNT2qhC2noSTSya'
consumer_secret = 'YibVMiytGm2qWCun83cYjU4'
access_token = '1746506726-... | agpl-3.0 | Python | |
5b9941d67f9975ced1a628d315165f03d22d8b0d | Create 4sqr2instconverter.py | haddadi/Instagram,haddadi/Instagram | 4sqr2instconverter.py | 4sqr2instconverter.py | #!/usr/bin/python
import httplib2
import os
import sys
import urllib2
import re
import time
import subprocess
from time import sleep
dataFile = open('4sq_USA_food_location_ids.txt', 'r')
outputfile = open ('4sq2inst_mapped_with_4sq_id_at_end.txt', 'w')
for line in dataFile:
location_id=line
string="curl htt... | mit | Python | |
165aae202a9a0e350fd235e558a18710126200ac | Create acp.py | Asyncode/ACR2.0,GluuIO/ACR2.0 | ACR/components/acp.py | ACR/components/acp.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Properitary
# Copyright (C) 2014 Asyncode
from ACR import acconfig
from ACR.components import *
from ACR.components.interpreter import makeTree
from ACR.errors import *
from ACR.utils import HTTP
import os
import subprocess
import shutil
from bson import ObjectId
def ... | agpl-3.0 | Python | |
523fac76d0de41b09aab7b42ec0a975ccc99a532 | add AE1 | QULab/sound_field_analysis-py | AE1_IdealPlaneWave.py | AE1_IdealPlaneWave.py | # SOFiA example 1: Ideal unity plane wave simulation
# Additionally requires vispy, see http://vispy.org
import numpy as np
from sofia import gen, plot
pi = np.pi
N = 9 # Order
Nrf = N # Radial filter order
Nviz = N # Visualization order
krViz = 30 # Select kr bin for vizualisation
r = 0.5 # A... | mit | Python | |
fda3c12070404a6f209f8b0ae18c6712d71a88ad | update to query and print GeoJSON results | mdiener21/python-geospatial-analysis-cookbook,mdiener21/python-geospatial-analysis-cookbook,mdiener21/python-geospatial-analysis-cookbook,mdiener21/python-geospatial-analysis-cookbook | ch04/code/ch04-06_postgis_complex_query.py | ch04/code/ch04-06_postgis_complex_query.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import psycopg2
import pprint
from geojson import loads, Feature, FeatureCollection
# Database Connection Info
db_host = "localhost"
db_user = "postgres"
db_passwd = "air"
db_database = "py_geoan_cb"
db_port = "5432"
# connect to DB
conn = psycopg2.connect(host=db_host, ... | mit | Python | |
11f270fa0d962aa7d22c647c195a8db9d8c2cdd0 | Convert RGB color space to CMYK and split the channels. | danforthcenter/plantcv,stiphyMT/plantcv,danforthcenter/plantcv,stiphyMT/plantcv,danforthcenter/plantcv,stiphyMT/plantcv | plantcv/plantcv/rgb2gray_cmyk.py | plantcv/plantcv/rgb2gray_cmyk.py | # RGB -> CMYK -> Gray
import cv2
import os
from plantcv.plantcv import print_image
from plantcv.plantcv import plot_image
from plantcv.plantcv import fatal_error
from plantcv.plantcv import params
import numpy as np
def rgb2gray_cmyk(rgb_img, channel):
"""Convert image from RGB colorspace to CMYK col... | mit | Python | |
df7d2393ebb10ddbfb44d6cacb9c4ec3d07eb381 | Add initial Gunicorn configuration. | rcutmore/vinotes-api,rcutmore/vinotes-api | vinotes/config/gunicorn.py | vinotes/config/gunicorn.py | command = '/home/rc/projects/vinotes-api/env/bin/gunicorn'
pythonpath = '/home/rc/projects/vinotes-api/vinotes'
bind = '127.0.0.1:8001'
workers = 1
user = 'vinotes-gunicorn'
| unlicense | Python | |
9669a45df9f37477bee1a154a9fe4f375e719151 | add default models.py | rctay/satchmo-payment-dumb | models.py | models.py | import config
PAYMENT_PROCESSOR=True | bsd-3-clause | Python | |
36fb0255a4037a9fe7b6d61868f8666325fea944 | Test recipient address formatting in user message e-mails | m-ober/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps,homeworkprod/byceps | tests/blueprints/user_message/test_address_formatting.py | tests/blueprints/user_message/test_address_formatting.py | """
:Copyright: 2006-2018 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from unittest.mock import patch
import pytest
from byceps.database import db
from byceps.services.email.models import EmailConfig
from byceps.services.user_message import service as user_message_service
from testfixt... | bsd-3-clause | Python | |
a0b4e074d5ca13634a1671ea074ffa7a6ad9fea1 | Add missing change | Just-D/chromium-1,zcbenz/cefode-chromium,bright-sparks/chromium-spacewalk,Chilledheart/chromium,markYoungH/chromium.src,junmin-zhu/chromium-rivertrail,Jonekee/chromium.src,rogerwang/chromium,hujiajie/pa-chromium,junmin-zhu/chromium-rivertrail,dushu1203/chromium.src,dushu1203/chromium.src,hujiajie/pa-chromium,ltilve/chr... | ppapi/PRESUBMIT.py | ppapi/PRESUBMIT.py | # Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import sys
import subprocess
def CheckChange(input_api, output_api):
results = []
# Verify all modified *.idl have a matching *.h
files... | # Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import sys
import subprocess
def CheckChange(input_api, output_api):
results = []
# Verify all modified *.idl have a matching *.h
files... | bsd-3-clause | Python |
009ac6b912a00191f69b32791cdb7e74fee83752 | Add config reader | rajikaimal/emma,rajikaimal/emma | src/config.py | src/config.py | import configparser
import os
Config = configparser.ConfigParser()
full_path = os.path.dirname(os.path.realpath(__file__))
def read_credentials():
Config.read(full_path + '/config/config_details.ini')
try:
username = Config['Credentials']['username']
password = Config['Credentials']['password']
return {
'u... | mit | Python | |
f290dd020b2cb3e586c8de6c4e8e3c1bc80f3583 | Add new class to compute the colourmap and the node filters accordingly to did | amonszpart/globOpt,amonszpart/globOpt,amonszpart/globOpt,amonszpart/globOpt,NUAAXXY/globOpt,NUAAXXY/globOpt,NUAAXXY/globOpt,NUAAXXY/globOpt,amonszpart/globOpt,NUAAXXY/globOpt,amonszpart/globOpt,NUAAXXY/globOpt | evaluation/packages/colours.py | evaluation/packages/colours.py | """@package Colours
This module provides the colourmaps used in globOpt to display primitives
according to their gid
"""
import packages.primitive as primitive
import packages.orderedSet as orderedSet
class Colours(object):
def __init__(self):
self.colListMedium = ['#F15A60', '#7AC36A', '#5A9BD4', '#FA... | apache-2.0 | Python | |
902fe0435367a55b218265f11f0c444cba9a2cfa | Add files via upload | tijme/angularjs-csti-scanner,tijme/angularjs-sandbox-escape-scanner | source.py | source.py | from bs4 import BeautifulSoup
import urllib
import re
import math
import html5lib
from html5lib import treebuilders
import urlparse
def print_parameter_tabel(parameters):
def cs(string, length=30):
return (string[0+i:length+i] for i in range(0, len(string), length))
def houndred(x):
... | mit | Python | |
833d114bd1bc396dc7c6b0434782f9e326319e88 | Add file to read .RAW images from Aptina | habi/GlobalDiagnostiX,habi/GlobalDiagnostiX,habi/GlobalDiagnostiX | readAptinaRAW.py | readAptinaRAW.py | import os
import numpy
import matplotlib.pyplot as plt
Directory = '/scratch/tmp/DevWareX/MT9M001/DSL949A-NIR/'
Folder = '1394629994_MT9M001_DSL949A-NIR_0.0_0.0f_040ms_090mm_to150mm'
File = 'MT9M001_1280x1024_DSL949A-NIR_0.0_0.0f_040ms_090mm_to150mm_090mm.raw'
Size = [int(File.split('_')[1].split('x')[1]),
int... | unlicense | Python | |
0755afbf47087aded357ca77c86e98f7243a53c7 | check that `{base_url}/nbextensions` page loads | jcb91/jupyter_nbextensions_configurator,jcb91/jupyter_nbextensions_configurator,jcb91/jupyter_nbextensions_configurator,jcb91/jupyter_nbextensions_configurator | tests/test_nbextensions_configurator.py | tests/test_nbextensions_configurator.py | import requests
from notebook.notebookapp import NotebookApp
from notebook.tests.launchnotebook import NotebookTestBase
from notebook.utils import url_path_join
from traitlets.config import Config
class ConfiguratorTest(NotebookTestBase):
config = Config(log_level='DEBUG')
if hasattr( NotebookApp, 'nbserver... | bsd-3-clause | Python | |
b3aaa3c9e9eccd1f8be82316713a613d16412f36 | add files module (mostly for images at the moment) | mahmoud/wapiti | wapiti/operations/files.py | wapiti/operations/files.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from base import QueryOperation
from params import MultiParam, StaticParam
from models import PageInfo, ImageInfo
from utils import OperationExample
DEFAULT_IMAGE_PROPS = ['timestamp', 'user', 'userid', 'comment', 'parsedcomment',
... | bsd-3-clause | Python | |
56fd675e5bf0bd68a73e21c244807c39a87a3eee | Implement the command handler framework | Heufneutje/PyHeufyBot,Heufneutje/PyHeufyBot | heufybot/modules/util/commandhandler.py | heufybot/modules/util/commandhandler.py | from twisted.plugin import IPlugin
from heufybot.moduleinterface import BotModule, IBotModule
from zope.interface import implements
class CommandHandler(BotModule):
implements(IPlugin, IBotModule)
name = "CommandHandler"
def hookBot(self, bot):
self.bot = bot
def actions(self):
retu... | mit | Python | |
378f98885fb7ea2eebb7307afded05cd3706647b | make server sleep 60s | zenanhu/pluto,zenanhu/pluto,zenanhu/pluto,zenanhu/pluto | hydra/server1.py | hydra/server1.py | import os
import socket
import time
SERVER_ADDRESS = (HOST, PORT) = '', 8888
REQUEST_QUEUE_SIZE = 1
def handle_request(client_connection):
request = client_connection.recv(1024)
print request.decode()
http_response = '''\
HTTP/1.1 200 OK
Hello World!
'''
client_connection.sendall(http_response)
... | apache-2.0 | Python | |
26cad83ebb6466d66f1e9fd87e963af4b5247ecc | Add Heap sort implemented in python | 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... | sort/heap_sort/python/heap_sort_ccsc.py | sort/heap_sort/python/heap_sort_ccsc.py | # Python program for implementation of heap Sort
# To heapify subtree rooted at index i.
# n is size of heap
def heapify(arr, n, i):
largest = i # Initialize largest as root
l = 2 * i + 1 # left = 2*i + 1
r = 2 * i + 2 # right = 2*i + 2
# See if left child of root exists and is
# greater than root
if l < n an... | cc0-1.0 | Python | |
ee9e31b8a8d93288009ee8d9a846dcaf930edb7a | Create solutions.py | tonylixu/leetcode | unique-number-of-occurrences/solutions.py | unique-number-of-occurrences/solutions.py | class Solution(object):
def uniqueOccurrences(self, arr):
"""
:type arr: List[int]
:rtype: bool
"""
arr_dict = {}
for x in arr:
if x in arr_dict:
arr_dict[x] += 1
else:
arr_dict[x] = 1
if len(set(arr_dict... | mit | Python | |
f4a4b0ed743b1c56b884d9364759adeca5d64479 | Change PRESUBMIT to allow COMPILE_ASSERT | fujunwei/chromium-crosswalk,ltilve/chromium,ChromiumWebApps/chromium,Just-D/chromium-1,ChromiumWebApps/chromium,markYoungH/chromium.src,PeterWangIntel/chromium-crosswalk,hgl888/chromium-crosswalk,junmin-zhu/chromium-rivertrail,nacl-webkit/chrome_deps,pozdnyakov/chromium-crosswalk,ltilve/chromium,M4sse/chromium.src,huji... | cc/PRESUBMIT.py | cc/PRESUBMIT.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.
"""Top-level presubmit script for cc.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
details on the presubmit API built... | # 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.
"""Top-level presubmit script for cc.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
details on the presubmit API built... | bsd-3-clause | Python |
072fd08dd89cc03aad0508c2e16e7551f5b27de0 | Create info.py | jurandysoares/admintera,jurandysoares/admintera | cgi-bin/info.py | cgi-bin/info.py |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Este arquivo pode ser salvo com qualquer extensão, tipo info.html
# A ser salvo em /usr/lib/cgi-bin no Debian/Ubuntu e
# em /var/www/cgi-bin no Fedora/RedHat/CentOS.
import os
print('Content-type: text/html')
print()
print('''<table border="1">
<tr>
<th>Variave... | apache-2.0 | Python | |
a5e35f1b19259addf325d5b2b3545e0f10fbf5b6 | Create string2.py | dimir2/hse12pi2-scripts,dimir2/hse12pi2-scripts,dimir2/hse12pi2-scripts,dimir2/hse12pi2-scripts | BaydakovaE/string2.py | BaydakovaE/string2.py | import math
# D. verbing
def verbing(s):
if s.endswith('ing'):
st=s+"ly"
elif len(s) > 3:
st=s+"ing"
else:
st=s
return st
# E. not_bad
def not_bad(s):
if s.find('not') > 0 and s.find('bad') > 0 and s.find('not') < s.find('bad'):
st=s[:s.find('no')]+'good'
else:
... | mit | Python | |
a12ced781c91b1d553a7e4e93d3df258cabbe63e | Add new package: jansi-native (#18547) | iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/jansi-native/package.py | var/spack/repos/builtin/packages/jansi-native/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 *
class JansiNative(MavenPackage):
"""Jansi is a small ASl 2.0 licensed Java library that allows y... | lgpl-2.1 | Python | |
34853f9a99ef385b912c4fe7936594bb70008293 | Add asyncs.utils.CircuitBreaker | clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage | py/garage/garage/asyncs/utils.py | py/garage/garage/asyncs/utils.py | __all__ = [
'CircuitBreaker',
]
import collections
import time
class CircuitBreaker:
"""Break (disconnect) when no less than `count` errors happened
within last `period` seconds.
"""
class Disconnected(Exception):
pass
def __init__(self, *, count, period, clock=None):
sel... | mit | Python | |
083957302452bdd966286bfd8d37d53dce8db7d3 | Add utility methods for facebook stuff. | Kegbot/kegbot-server,Kegbot/kegbot-server,Kegbot/kegbot-server,Kegbot/kegbot-server,Kegbot/kegbot-server | pykeg/contrib/facebook/fbutil.py | pykeg/contrib/facebook/fbutil.py | import facebook
def profile_for_user(user):
profile = user.facebookprofile_set.all()
if not profile:
return None
return profile[0]
def session_for_user(user):
profile = profile_for_user(user)
if not profile:
return None
session = profile.session.all()
if not session:
return None
return ses... | mit | Python | |
5f2d0b5c9dbb288ee279e7158ad0e0aa2f5d4037 | Add config wrapper. | ohsu-qin/qipipe | qipipe/staging/sarcoma_config.py | qipipe/staging/sarcoma_config.py | import os
import ConfigParser
_CFG_FILE = os.path.join(os.path.dirname(__file__), '..', '..', 'conf', 'sarcoma.cfg')
_CONFIG = ConfigParser()
_CONFIG.read(_CFG_FILE)
def sarcoma_location(pt_id):
return _CONFIG.get('Tumor Location', pt_id)
| bsd-2-clause | Python | |
a002a78843c6324df94790c6185064e9ac2fb08d | Add utils | Sherlock-Holo/Holosocket | src/utils.py | src/utils.py | import base64
import hashlib
import secrets
import struct
def gen_data_len(mask_flag, data):
data_len = len(data)
if mask_flag:
if data_len <= 125:
data_len = data_len | 128
data_len = struct.pack('>B', data_len)
return data_len, 0
elif data_len <= 65535:
... | mpl-2.0 | Python | |
3699e8e412c637c9a36cb59e5647d8ff54782200 | Add an integration test for #480 | slackapi/python-slackclient,slackhq/python-slackclient,slackapi/python-slackclient,slackapi/python-slackclient | integration_tests/web/test_issue_480.py | integration_tests/web/test_issue_480.py | import logging
import multiprocessing
import os
import threading
import unittest
from integration_tests.env_variable_names import SLACK_SDK_TEST_USER_TOKEN
from integration_tests.helpers import async_test
from slack import WebClient
class TestWebClient(unittest.TestCase):
"""Runs integration tests with real Slac... | mit | Python | |
1609c5cd83fc99887ec45ff6beba2ee0dba712a8 | Create D_Velocity_components.py | Herpinemmanuel/Oceanography | Cas_1/D_Velocity_components.py | Cas_1/D_Velocity_components.py | import numpy as np
import matplotlib.pyplot as plt
from xmitgcm import open_mdsdataset
import cartopy.crs as ccrs
from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER
plt.ion()
dir1 = '/homedata/bderembl/runmit/test_southatlgyre'
ds1 = open_mdsdataset(dir1,prefix=['U','V'])
nt = -1
nz =... | mit | Python | |
5977d5f01a740150eebd01d8aa110e864a92da95 | Create 3-temperature.py | CamJam-EduKit/EduKit2 | Code/3-temperature.py | Code/3-temperature.py | # Import Libraries
import os
import glob
import time
# Initialize the GPIO Pins
os.system('modprobe w1-gpio') # Turns on the GPIO module
os.system('modprobe w1-therm') # Turns on the Temperature module
# Finds the correct device file that holds the temperature data
base_dir = '/sys/bus/w1/devices/'
device_folder = g... | mit | Python | |
d7854b71e778103ca14a488cc80e436aff46389b | Create Super_calculateur.py | Alumet/Codingame | Difficult/Super_calculateur.py | Difficult/Super_calculateur.py |
n = int(input())
liste=[]
for i in range(n):
j, d = [int(j) for j in input().split()]
liste.append([j,j+d-1])
liste.sort(key=lambda x: x[0])
liste.sort(key=lambda x: x[1])
J_max=0
count=0
for el in liste:
if el[0]>J_max:
J_max=el[1]
count+=1
print(count)
| mit | Python | |
f0ac1914790e69fe786d6d3182cf15fd09302c28 | Add test for missing building part seen in production. | mapzen/vector-datasource,mapzen/vector-datasource,mapzen/vector-datasource | integration-test/912-missing-building-part.py | integration-test/912-missing-building-part.py | # http://www.openstreetmap.org/way/287494678
z = 18
x = 77193
y = 98529
while z >= 16:
assert_has_feature(
z, x, y, 'buildings',
{ 'kind': 'building',
'id': 287494678 })
z -= 1
x /= 2
y /= 2
| mit | Python | |
95126bc5889e66ab7646e49f6ed773d3d4cd9a37 | save received fw in archive dir. Separate installer for new userpackage found | iottly/iottly-device-agent-py,iottly/iottly-device-agent-py | iottly-device-agent-py/install_userpackage.py | iottly-device-agent-py/install_userpackage.py | import os, shutil, logging, tarfile
from iottly.settings import settings
logging.basicConfig(level=logging.INFO,
format='%(asctime)s [%(levelname)s] (%(processName)-9s) %(message)s',)
userpackagepath = 'userpackage/'
# check that iottly service is not running
# check if a new fw is available... | apache-2.0 | Python | |
9f7296b34d1e65ac14cb9b98734e2a01aee345a2 | Add missing file | chargehound/chargehound-python | chargehound/models.py | chargehound/models.py | from collections import namedtuple
from bunch import Bunch
class ChargehoundObject(Bunch):
pass
class List(ChargehoundObject):
pass
class Dispute(ChargehoundObject):
pass
class Product(ChargehoundObject):
pass
Response = namedtuple('Response', 'status')
| mit | Python | |
3c2d85b4b7a497ceffac3e562ac1a468f1f6a4b0 | add solution for First Bad Version | zhyu/leetcode,zhyu/leetcode | algorithms/firstBadVersion/firstBadVersion.py | algorithms/firstBadVersion/firstBadVersion.py | # The isBadVersion API is already defined for you.
# @param version, an integer
# @return a bool
# def isBadVersion(version):
class Solution(object):
def firstBadVersion(self, n):
"""
:type n: int
:rtype: int
"""
l, r = 1, n
while l < r:
mid = (l+r) >> 1
... | mit | Python | |
3ad0213e15e2ccb7894a1d0beb88bd86ae3d9e67 | Create setup.py | daxeel/pypixoto | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
setup(name='pypixoto',
version='1.0',
description='Python SDK for Pixoto.com',
author='Daxeel Soni',
author_email='sayhi@daxeelsoni.in',
url='https://www.daxeelsoni.in',
)
| mit | Python | |
c5a7f18f3b97c40489f9b098e4822ba7ce3a5927 | Create ex4_3.py | laetrid/learning | First_course/ex4_3.py | First_course/ex4_3.py | #!/usr/bin/env python
'''
III. Create a program that converts the following uptime strings to a time in seconds.
uptime1 = 'twb-sf-881 uptime is 6 weeks, 4 days, 2 hours, 25 minutes'
uptime2 = '3750RJ uptime is 1 hour, 29 minutes'
uptime3 = 'CATS3560 uptime is 8 weeks, 4 days, 18 hours, 16 minutes'
uptime4 = 'rtr1 up... | apache-2.0 | Python | |
d8b6cbc9703dbb3f3b7fed17a9594148aae1d75e | Create Magic8Ball.py | Vlek/plugins | HexChat/Magic8Ball.py | HexChat/Magic8Ball.py | import hexchat
from random import choice
__module_name__ = 'Magic8ball'
__module_version__ = '0.0.1'
__module_description__ = 'Allows one ask magic8ball questions with answers'
__module_author__ = 'Vlek'
_8ball_answers = [
'It is certain', 'It is decidedly so',
'Without a doubt', 'Yes, definitely',
'You m... | mit | Python | |
5e81fca928862b1c9574f1092a131337735b63f4 | Add basic IAM integration test | lra/boto,jotes/boto,Asana/boto,nexusz99/boto,serviceagility/boto,ekalosak/boto,shipci/boto,yangchaogit/boto,varunarya10/boto,kouk/boto,podhmo/boto,j-carl/boto,janslow/boto,disruptek/boto,nikhilraog/boto,bryx-inc/boto,khagler/boto,TiVoMaker/boto,s0enke/boto,stevenbrichards/boto,acourtney2015/boto,weka-io/boto,rayluo/bot... | tests/integration/iam/test_connection.py | tests/integration/iam/test_connection.py | # Copyright (c) 2014 Amazon.com, Inc. or its affiliates.
# All rights reserved.
#
# 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 right... | mit | Python | |
21f34851a88480cc2e060361ee3119bb0d1c79ea | bump to 0.4.1 | opencivicdata/pupa,influence-usa/pupa,rshorey/pupa,rshorey/pupa,mileswwatkins/pupa,mileswwatkins/pupa,influence-usa/pupa,datamade/pupa,opencivicdata/pupa,datamade/pupa | pupa/__init__.py | pupa/__init__.py | __version__ = '0.4.1' # pragma: no cover
| __version__ = '0.4.0-dev' # pragma: no cover
| bsd-3-clause | Python |
1b2a1b0db5d09999f0461df3d9d565e7ba0b42f7 | Add reader module | wbolster/whip-neustar | whip_neustar/reader.py | whip_neustar/reader.py | # encoding: UTF-8
"""
Neustar (Quova) data set reader module.
"""
import csv
import datetime
import itertools
import logging
import math
import os
import re
import socket
import struct
logger = logging.getLogger(__name__)
ISO8601_DATETIME_FMT = '%Y-%m-%dT%H:%M:%S'
# Regular expression to match file names. From the... | bsd-3-clause | Python | |
1528ac33ae3bfb81645fb45dece72b0f6f69b431 | Create sample.py | auth0/auth0-python,auth0/auth0-python | sample.py | sample.py | import webapp2
import urllib2
import urllib
import json
## CHANGE THIS
CLIENT_ID = "YOUR_CLIENT_ID"
CLIENT_SECRET = "YOUR_CLIENT_SECRET"
DOMAIN = "YOURS.auth0.com"
CALLBACK_URL = "http://localhost:8080/callback"
MAIN_PAGE_HTML = """\
<html>
<body>
<script src="https://d19p4zemcycm7a.cloudfront.net/w2/auth0-widg... | mit | Python | |
1b610ec0dafdb299e1a04a9be90156fafc40c5ba | Create mainmenu2.py | ChristinaHammer/Client_Database | mainmenu2.py | mainmenu2.py | #Christina Hammer
#main menu Gui
from tkinter import *
from tkinter import messagebox
def addnew():
import newclientinter2
return
def quitprogram():
mmGui.destroy()
return
def logoff():
import logGui
mmGui.destory()
return
def csearch():
#messagebox.INFO(title='Client Sear... | mit | Python | |
1c709f8bde2a304d0d8eb326e69a95d1a011efeb | add script for parsing all mat files into common matfile (structure of arrays) | vrsys/lamure,vrsys/lamure,vrsys/lamure,vrsys/lamure | apps/fem_vis_ssbo/parse_to_single_mat_file.py | apps/fem_vis_ssbo/parse_to_single_mat_file.py | #!/usr/bin/python
import scipy.io as sio
import numpy as np
import sys
import pathlib
import os
number_of_arguments = len(sys.argv)
if number_of_arguments < 2:
print("This program takes an *.mat-File with the FEM-Attributes as defined before and creates a binary stream of the relevant data as *.mat.bin file")
... | bsd-3-clause | Python | |
8613deaffe5de066075141e577faa578169d3b41 | add progress reporting module | gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine | openquake/utils/progress.py | openquake/utils/progress.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010-2012, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the Lice... | agpl-3.0 | Python | |
06a0070bc20d18eec6d2b065a6e143c45323fbe6 | Implement sinus generation script | Rookfighter/fft-spartan6,Rookfighter/fft-spartan6 | scripts/sin_gen.py | scripts/sin_gen.py | # twiddle.py
#
# Created on: 15 May 2017
# Author: Fabian Meyer
import argparse
import math
VERSION = '0.1.0'
N = 16
def parse_args():
'''Parse command line arguments.'''
parser = argparse.ArgumentParser(
description="Calculate twiddle factor.")
parser.add_argument('--version', action='ver... | mit | Python | |
5d22c6ddf0c2534df4bef02fbbf386a43c8f6203 | make some migrations yo | jumbocodespring2017/bostonathleticsassociation,jumbocodespring2017/bostonathleticsassociation,jumbocodespring2017/bostonathleticsassociation | back-end/interface/migrations/0001_initial.py | back-end/interface/migrations/0001_initial.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-12-04 20:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Docume... | mit | Python | |
8dfb5792ef73d822b16dde55bb090c1e613cc2ed | add refresh_creds.py | sso2712/python | refresh_creds.py | refresh_creds.py | #!/usr/bin/env python3
import sys
import gimme_aws_creds.main
import gimme_aws_creds.ui
account_alias_id_map = {
"master": "123456789012",
"shared-services": "123456789012",
"network": "123456789012",
"security": "123456789012",
"logging": "123456789012",
"dev": "123456789012",
"test": "12... | mit | Python | |
c1c3624b1247bf6c7b939549059866165bf5776f | test case with expected murmur hashes from the original murmur hash library | jcaberio/MurmurV3,jcaberio/MurmurV3,jcaberio/MurmurV3 | test_hash.py | test_hash.py | import murmur
import string
expected_dict = {'a': 2456313694, 'c': 754329161, 'b': 2260187636, 'e': 3115762238, 'd': 4163039750, 'g': 1545794298, 'f': 4226522672, 'i': 3451942824, 'h': 1069002520, 'k': 3288208012, 'j': 3131388162, 'm': 3020367812, 'l': 2169669117, 'o': 1720432690, 'n': 1785613168, 'q': 2083633015, 'p'... | mit | Python | |
7813663002d618abccfe12f189e9351e18afcdbb | Create GPS1.py | jancelin/geo-poppy,jancelin/geo-poppy | tracking/GPS1.py | tracking/GPS1.py | import time
import serial
import os
import sys
import psycopg2
import psycopg2.extras
from datetime import datetime
firstFixFlag = False # this will go true after the first GPS fix.
firstFixDate = ""
DEBUG = False
SLEEP = 10
# Try to connect
try:
conn=psycopg2.connect("host='postgis' port='5432' dbname='geopoppy... | agpl-3.0 | Python | |
8d7f2b4dbdc64a28f6864e607b1a18e1f2018b11 | move to ini file and config parser | vignanl/Plinth,harry-7/Plinth,freedomboxtwh/Plinth,harry-7/Plinth,kkampardi/Plinth,vignanl/Plinth,kkampardi/Plinth,kkampardi/Plinth,freedomboxtwh/Plinth,harry-7/Plinth,freedomboxtwh/Plinth,freedomboxtwh/Plinth,jvalleroy/plinth-debian,jvalleroy/plinth-debian,vignanl/Plinth,harry-7/Plinth,jvalleroy/plinth-debian,vignanl/... | cfg.py | cfg.py | from menu import Menu
import os
from ConfigParser import SafeConfigParser
parser = SafeConfigParser(
defaults={
'root':os.path.dirname(os.path.realpath(__file__)),
'product_name':"",
'box_name':"",
'file_root':"",
'data_dir':"",
'store_file':"",
'user_db':"",... | agpl-3.0 | Python | |
c3d87e837c85284baa132104e4843c3fd8f429d3 | Complete day 4 part 2 | foxscotch/advent-of-code,foxscotch/advent-of-code | day-04-2.py | day-04-2.py | import hashlib
puzzle_input = b'iwrupvqb'
number = 100000
while True:
key = puzzle_input + str(number).encode()
if hashlib.md5(key).hexdigest()[:6] == '000000':
break
number += 1
print(number)
# Now that I think about it, starting with 100,000 was probably not the right
# thing to do. I could'v... | mit | Python | |
d30b61a82533347f8ea2d0250e3d5346e4dcbc07 | Create variables | josuemontano/blender_wrapper | variables.py | variables.py | LAYER_1 = (True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False)
LAYER_2 = (False, True, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False, False)
LAYER_3 = (False, Fa... | mit | Python | |
754b9d76e8a02040c423d7c15737073d48458eb0 | fix non-fastbuild chrome_split_dll | littlstar/chromium.src,dednal/chromium.src,dednal/chromium.src,mohamed--abdel-maksoud/chromium.src,dushu1203/chromium.src,Just-D/chromium-1,krieger-od/nwjs_chromium.src,dushu1203/chromium.src,ondra-novak/chromium.src,jaruba/chromium.src,ChromiumWebApps/chromium,Jonekee/chromium.src,ltilve/chromium,ondra-novak/chromium.... | chrome/installer/mini_installer_syzygy.gyp | chrome/installer/mini_installer_syzygy.gyp | # Copyright (c) 2011 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.
{
'variables': {
'version_py': '<(DEPTH)/chrome/tools/build/version.py',
'version_path': '<(DEPTH)/chrome/VERSION',
'lastchange_path': '<(DE... | # Copyright (c) 2011 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.
{
'variables': {
'version_py': '<(DEPTH)/chrome/tools/build/version.py',
'version_path': '<(DEPTH)/chrome/VERSION',
'lastchange_path': '<(DE... | bsd-3-clause | Python |
685347e9f7fbf629e09427d5c63c1e81dfe43446 | Create config file | victormartinez/shub_cli | shub_cli/config.py | shub_cli/config.py | from prompt_toolkit.styles import style_from_dict
from pygments.token import Token
error_style = style_from_dict({
Token.ErrorMessage: '#ff0066',
Token.ShubFileModel: '#ccaa33',
})
tokens = [
(Token.ErrorMessage, 'You need to set up your .scrapinghub.yml with a default project and api key:\n'),
(Token... | mit | Python | |
1dd1111bd1bab62ed900d74f347a7fe10d03eb03 | Test that changelog is not outdated | lorien/user_agent | test/release.py | test/release.py | from __future__ import absolute_import
import user_agent
import re
def test_changelog():
"""
Parse changelog and ensure that it contains
* unreleased version younger than release date
* release version has a date
"""
re_date = re.compile(r'^\d{4}-\d{2}-\d{2}$')
ver_dates = {}
ver_hist... | mit | Python | |
fb02defe8ba3bb5d7a76cfd515ebe1a7369a02da | Add time unit and duration to string function | Harmon758/Harmonbot,Harmon758/Harmonbot | units/time.py | units/time.py |
import datetime
from .errors import UnitExecutionError
def duration_to_string(duration, weeks = True, milliseconds = False, microseconds = False,
abbreviate = False, separator = ' '):
# TODO: Support colon format
if not isinstance(duration, datetime.timedelta):
raise UnitExecutionError("duration must be da... | mit | Python | |
df87fde0862a2d3725505ca709367ae74faa53fd | Create Battleship.py | SamGriffith3/PyLearning-Projects,SamGriffith3/PyLearning-Projects | Battleship.py | Battleship.py | #Text Based Battle Ship
Print(" Are You Ready to Play?")
| mit | Python | |
e9a37e7c4db4278c1fbdce3ec5041929910f9e3a | Add patterns module. | damonkelley/pattern-matcher | pattern_matcher/patterns.py | pattern_matcher/patterns.py | class Node(object):
WILDCARD = '*'
def __init__(self, value):
self.value = value
def is_wildcard(self):
return self.value == self.WILDCARD
def __str__(self):
return self.value
def __repr__(self):
return '<Node: \'{0}\'>'.format(str(self))
class Pattern(object):
... | mit | Python | |
83d6fb2636a6b94a725ba469bbebedfe42f71a80 | Add verbatim lat lon (WGS84) to british national grid (OSBG36) | fmalina/bng_latlon,fmalina/bng_latlon,fmalina/bng_latlon,fmalina/bng_latlon | latlon_to_bng.py | latlon_to_bng.py | #This code converts lat lon (WGS84) to british national grid (OSBG36)
from scipy import *
import csv
def WGS84toOSGB36(lat, lon):
#First convert to radians
#These are on the wrong ellipsoid currently: GRS80. (Denoted by _1)
lat_1 = lat*pi/180
lon_1 = lon*pi/180
#Want to convert to the Airy 1830 ellipsoid, which has... | mit | Python | |
1b83a31090cd803d2eca0b9caed0f4cc9a149fbd | Raise ConfigurationError error that causes server to fail and dump whole stacktrace | noyeitan/cubes,jell0720/cubes,zejn/cubes,jell0720/cubes,she11c0de/cubes,cesarmarinhorj/cubes,jell0720/cubes,she11c0de/cubes,cesarmarinhorj/cubes,she11c0de/cubes,zejn/cubes,pombredanne/cubes,ubreddy/cubes,cesarmarinhorj/cubes,pombredanne/cubes,pombredanne/cubes,noyeitan/cubes,ubreddy/cubes,zejn/cubes,ubreddy/cubes,noyei... | cubes/stores.py | cubes/stores.py | from .errors import *
from .browser import AggregationBrowser
from .extensions import get_namespace, initialize_namespace
__all__ = (
"open_store",
"Store"
)
def open_store(name, **options):
"""Gets a new instance of a model provider with name `name`."""
ns = get_namespace("s... | from .errors import *
from .browser import AggregationBrowser
from .extensions import get_namespace, initialize_namespace
__all__ = (
"open_store",
"Store"
)
def open_store(name, **options):
"""Gets a new instance of a model provider with name `name`."""
ns = get_namespace("s... | mit | Python |
bd31cd36db0a2780047caee02076c6dd4e44cc3f | Create MinStack_001.py | Chasego/codi,Chasego/codi,cc13ny/Allin,cc13ny/Allin,Chasego/cod,cc13ny/algo,Chasego/codirit,Chasego/codi,Chasego/codirit,cc13ny/Allin,cc13ny/algo,Chasego/codi,Chasego/codirit,Chasego/codirit,Chasego/codi,Chasego/cod,cc13ny/algo,cc13ny/Allin,cc13ny/Allin,Chasego/cod,Chasego/cod,cc13ny/algo,Chasego/cod,Chasego/codirit,cc... | leetcode/155-Min-Stack/MinStack_001.py | leetcode/155-Min-Stack/MinStack_001.py | class MinStack:
# @param x, an integer
def __init__(self):
self.stack = []
self.min_stack = []
# @return an integer
def push(self, x):
self.stack.append(x)
if len(self.min_stack) == 0 or self.min_stack[-1] >= x:
self.min_stack.append(x)
... | mit | Python | |
d78c14cd8f6329f14628ac67345781c7eda6240c | add lists services script | vtcsec/wargame-scorer | list_services.py | list_services.py | import services
from services import *
print len(services.Service.plugins)
for p in services.Service.plugins:
print p.name
| bsd-3-clause | Python | |
5b8bf127ed7bbb3ea8e0bf05b9e4fc6d00962402 | add a script to use the data converter | agdsn/pycroft,lukasjuhrich/pycroft,lukasjuhrich/pycroft,lukasjuhrich/pycroft,agdsn/pycroft,agdsn/pycroft,lukasjuhrich/pycroft,agdsn/pycroft,agdsn/pycroft | data_convert.py | data_convert.py | # Copyright (c) 2012 The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details.
from legacy import convert
from pycroft import model
if __name__ == "__main__":
print "drop old db model"
... | apache-2.0 | Python | |
d0ff03be32a7325f310237b49d06f622a751e448 | add easy-rdf.py | Dans-labs/easy-lod | easy-rdf.py | easy-rdf.py | import itertools
import re
import os
import rdflib
from oaipmh.client import Client
from oaipmh.metadata import MetadataRegistry, oai_dc_reader
dc11 = rdflib.Namespace('http://purl.org/dc/elements/1.1/')
geo = rdflib.Namespace('http://www.w3.org/2003/01/geo/wgs84_pos#')
virtrdf = rdflib.Namespace('http://www.openlinks... | bsd-3-clause | Python | |
2234214adc252e37ff6e83776a32a2826a37f79f | add test for labelers | ntucllab/libact,ntucllab/libact,ntucllab/libact | libact/labelers/tests/test_labelers.py | libact/labelers/tests/test_labelers.py | import unittest
import numpy as np
from libact.base.dataset import Dataset
from libact.labelers import IdealLabeler
class TestDatasetMethods(unittest.TestCase):
initial_X = np.arange(15).reshape((5, 3))
initial_y = np.array([1, 2, 3, 1, 4])
def setup_dataset(self):
return Dataset(self.initial_... | bsd-2-clause | Python | |
dda0f1ba84feac1cf7cd54769efbb543defa173a | add epinions data reader | Evfro/polara | polara/datasets/epinions.py | polara/datasets/epinions.py | import numpy as np
import scipy as sp
import pandas as pd
def compute_graph_laplacian(edges, index):
all_edges = set()
for a, b in edges:
try:
a = index.get_loc(a)
b = index.get_loc(b)
except KeyError:
continue
if a == b: # exclude self links
... | mit | Python | |
22382726fa69f40c74611a79b99845df1bd3076f | Add rackHd inventory script | thaim/ansible,thaim/ansible | contrib/inventory/rackhd.py | contrib/inventory/rackhd.py | #!/usr/bin/python
import json
import requests
import os
import argparse
import types
MONORAIL_URL = 'http://localhost:8080'
class OnRackInventory(object):
def __init__(self, nodeids):
self._inventory = {}
for nodeid in nodeids:
self._load_inventory_data(nodeid)
output = '{\n'
... | mit | Python | |
4046c743323a4357864afcac482a5625ed71c184 | Add solution for problem 6 | cifvts/PyEuler | euler006.py | euler006.py | #!/usr/bin/python
limit = 100
sum_sq = ((limit + 1) * limit) / 2
sum_sq *= sum_sq
sq_sum = (limit * (limit + 1) * ((limit * 2) + 1)) / 6
print (int (sum_sq - sq_sum))
| mit | Python | |
e9a7d806030fc87ce63554a96c485ecf197e9efd | Create Accel_to_Pos.py | purduerov/X9-Core,purduerov/X9-Core,purduerov/X9-Core,purduerov/X9-Core,purduerov/X9-Core,purduerov/X9-Core | control/PID/Accel_to_Pos.py | control/PID/Accel_to_Pos.py | import time
class AccelConversion(object):
def __init__(self):
self.time_start = time.time()
def integration(self, accel):
delta_t = time.time() - self.time_start
pos = accel * (delta_t ** 2) # assumes the ROV has 0 velocity at the time of the switch to autopilot
... | mit | Python | |
66f5ec45798b21996bf5216cd9b8bce4d7d831fd | Add missing migration | patjouk/djangogirls,patjouk/djangogirls,patjouk/djangogirls,DjangoGirls/djangogirls,DjangoGirls/djangogirls,patjouk/djangogirls,DjangoGirls/djangogirls | core/migrations/0034_auto_20170124_1754.py | core/migrations/0034_auto_20170124_1754.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-24 17:54
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0033_auto_20170124_1300'),
]
operations = [
migrations.AlterField(
... | bsd-3-clause | Python | |
a051b41773c5ea25b3ff5791544fa3b38bdfec4a | add test | snahelou/awx,wwitzel3/awx,wwitzel3/awx,snahelou/awx,snahelou/awx,wwitzel3/awx,snahelou/awx,wwitzel3/awx | awx/main/tests/unit/models/test_inventory.py | awx/main/tests/unit/models/test_inventory.py | import pytest
import mock
from awx.main.models import (
UnifiedJob,
InventoryUpdate,
Job,
)
@pytest.fixture
def dependent_job(mocker):
j = Job(id=3, name='I_am_a_job')
j.cancel = mocker.MagicMock(return_value=True)
return [j]
def test_cancel(mocker, dependent_job):
with mock.patch.object... | apache-2.0 | Python | |
17725f25fa8ecd235d3c9a0b08320af680e3b8fc | Create Networking.py | Elviond/A4TL | Networking.py | Networking.py | import socket
import ast
class Server(object):
backlog = 5
client = None
def __init__(self, host, port):
self.socket = socket.socket()
self.socket.bind((host, port))
self.socket.listen(self.backlog)
def __del__(self):
self.close()
def accept(self):
# if a client is already connected, ... | mit | Python | |
1c745d9414b0a734ede929cd6c2698a68dd014e5 | Add timeout the runner | chilland/scraper,openeventdata/scraper | scraper_sched.py | scraper_sched.py | from functools import wraps
import errno
import os
import signal
from scraper import run_scraper
from apscheduler.schedulers.blocking import BlockingScheduler
from apscheduler.triggers.cron import CronTrigger
class TimeoutError(Exception):
pass
def timeout(seconds=10, error_message=os.strerror(errno.ETIME)):
... | from scraper import run_scraper
from apscheduler.schedulers.blocking import BlockingScheduler
from apscheduler.triggers.cron import CronTrigger
if __name__ == '__main__':
scheduler = BlockingScheduler()
scheduler.add_job(run_scraper, CronTrigger(minute=0))
scheduler.start()
| mit | Python |
29470e8e8d1709a3b40122cc79eca864e60d898e | Add benchmark script for recomennder bolt | cutoffthetop/recommender,cutoffthetop/recommender,cutoffthetop/recommender | scripts/bench.py | scripts/bench.py | #!/usr/bin/env python
"""
SYNOPSIS
bench [-b,--base] [-h,--help] [-k,--rank] [-r,--ratio] [-s,--size]
[-t,--threshold]
DESCRIPTION
Benchmark the RecommendationBolt class from ../storm/src/py/resources.
-b int, --base int
Configure the size of the user base to influence the underlying ... | bsd-2-clause | Python | |
b4332ef88f80fecdb80e33c72b8c8ad96b5fbda3 | delete non necessary files | ufabdyop/screenlock,ufabdyop/screenlock,ufabdyop/screenlock | screenlockApp.py | screenlockApp.py | import wx, ConfigParser, win32gui, win32process, win32con, subprocess, time, thread
from threading import *
from screenlockConfig import SLConfig
ID_SUBMIT = wx.NewId()
endFlag = False
class OverlayFrame( wx.Frame ) :
def __init__( self ) :
wx.Frame.__init__( self, None, title="Transparent Window",
... | mit | Python | |
b2d061113112634c34cb230090a97e25ef32c8b0 | Create scribe_level3.py | odorsey/pythonGame | scribe_level3.py | scribe_level3.py | print "Chapter 1: Breakin' Bad Habits"
print "You realize that you’re not cut out for a life on the run,
so you decide to head back to the palace and stand trial. As the judge concludes your charges, you stand
and defiantly plead "Not Guilty"\n"
action = raw_input("What is your argument? Do you claim you were takin... | bsd-3-clause | Python | |
337e60c3d63b56b1237e3d5b052a96f3824cc6c2 | Add command to migrate SMSLog to SQL | dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq | corehq/apps/sms/management/commands/migrate_sms_to_sql.py | corehq/apps/sms/management/commands/migrate_sms_to_sql.py | from corehq.apps.sms.models import SMSLog, SMS
from custom.fri.models import FRISMSLog
from dimagi.utils.couch.database import iter_docs
from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
class Command(BaseCommand):
args = ""
help = ("Migrates SMSLog to SMS")
... | bsd-3-clause | Python | |
8122cddcc8817829e103462fbf019d1a3f4be9a8 | add xiami.py with login | hailinzeng/zhuaxia,wangjun/zhuaxia,kuyagic/zhuaxia,zhaodelong/zhuaxia,windygu/zhuaxia,yosef-gao/zhuaxia | zhuaxia/xiami.py | zhuaxia/xiami.py | # -*- coding:utf-8 -*-
####################################################################
# taken from https://gist.github.com/lepture/1014329
####################################################################
#
# Copyright (c) 2011, lepture.com
#
# Redistribution and use in source and binary forms, with or withou... | mit | Python | |
75f81ff20dc3953b3b7c2e064105da34dde2edbf | Add experiment job manager | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | polyaxon_cli/managers/experiment_job.py | polyaxon_cli/managers/experiment_job.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import sys
from polyaxon_cli.managers.base import BaseConfigManager
from polyaxon_cli.utils.formatting import Printer
from polyaxon_schemas.experiment import ExperimentJobConfig
class ExperimentJobManager(BaseConfigManager):
... | apache-2.0 | Python | |
83bda2fbb116d46dc0f4e6eb2d63f3f90a6b9733 | fix bugs in travis ci | ideaworld/BioDesigner,igemsoftware/HFUT-China_2015,igemsoftware/HFUT-China_2015,ideaworld/BioDesigner,igemsoftware/HFUT-China_2015,ideaworld/BioDesigner | BioDesigner/settings.py | BioDesigner/settings.py | """
Django settings for BioDesigner project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...... | apache-2.0 | Python | |
d875d24d29b21d431f4ef5f0c95515afc0e78933 | Add Pidgin test | rolisz/Log,rolisz/Log | src/tests/pidgin_test.py | src/tests/pidgin_test.py | import unittest
import io
from src.data import parsers
conv = """<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Conversation with Person 1 at Tue 31 Jul 2013 02:19:13 PM EEST on person2@gmail.com/ (jabber)</title></head><body><h3>Conversation with Person 1 at Tue 31 Jul 2012 02:1... | mit | Python | |
74764e9949de82d4623167e3604d313bc6cf850e | add rejidge | Changron/NTHUOJ_web,nthuoj/NTHUOJ_web,geniusgordon/NTHUOJ_web,nthuoj/NTHUOJ_web,geniusgordon/NTHUOJ_web,Changron/NTHUOJ_web,bruce3557/NTHUOJ_web,geniusgordon/NTHUOJ_web,bbiiggppiigg/NTHUOJ_web,bbiiggppiigg/NTHUOJ_web,bruce3557/NTHUOJ_web,henryyang42/NTHUOJ_web,henryyang42/NTHUOJ_web,henryyang42/NTHUOJ_web,Changron/NTHU... | utils/rejudge.py | utils/rejudge.py | """
The MIT License (MIT)
Copyright (c) 2014 NTHUOJ team
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, merge, ... | mit | Python | |
d1588bdf0a672de8d7d4f4f9cddcc236f5b9026e | Add plot for color property combinations to examples. | CrazyGuo/bokeh,ericdill/bokeh,saifrahmed/bokeh,stuart-knock/bokeh,schoolie/bokeh,PythonCharmers/bokeh,alan-unravel/bokeh,percyfal/bokeh,mindriot101/bokeh,satishgoda/bokeh,roxyboy/bokeh,daodaoliang/bokeh,ChristosChristofidis/bokeh,rs2/bokeh,Karel-van-de-Plassche/bokeh,aavanian/bokeh,ChristosChristofidis/bokeh,Karel-van-... | examples/plotting/file/properties_alpha.py | examples/plotting/file/properties_alpha.py | import bokeh.plotting as plt
from itertools import product
plt.output_file('properties_alpha.html')
cats = ['RGB', 'RGBA', 'Alpha+RGB', 'Alpha+RGBA']
p = plt.figure(x_range=cats, y_range=cats,
title="Fill and Line Color Property Combinations")
alpha = 0.5
fill_color = (242, 44, 64)
fill_color_alpha = ... | bsd-3-clause | Python | |
bbc08cc30837ba1ce505d346b67f5808aed628af | Create OverlapGraphs.py | guylaor/rosalind | strings/OverlapGraphs.py | strings/OverlapGraphs.py | # solution for http://rosalind.info/problems/grph/
import re
Strings = {}
Prefixes = {}
Suffixes = {}
index = ""
f = open('fasta.txt', 'r')
for line in f:
match = re.match(r">", line)
#match = str(line).find(">")
if match:
index = line.strip()
index = index[1:len(index)]
Strings[index] = ""
Pr... | mpl-2.0 | Python | |
090c73c20e3a57f5b2710c270b0dfc139633d623 | Add tests for GameNode module | blairck/jaeger | test/test_gamenode.py | test/test_gamenode.py | """ Tests for the GameNode module """
from contextlib import contextmanager
from io import StringIO
import sys
import unittest
from src import gamenode
@contextmanager
def captured_output():
""" Redirects stdout to StringIO so we can inspect Print statements """
new_out = StringIO()
old_out = sys.stdout
... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.