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 |
|---|---|---|---|---|---|---|---|---|
4761b92bc058c49b696757580212a599e4a22bed | update 26 ott 2016 | ernitron/uPython-esp8266-httpserver | realmain.py | realmain.py | # Micropython Http Server
# Erni Tron ernitron@gmail.com
# Copyright (c) 2016
import time
import network
import gc
import machine
from config import read_config, get_config, set_config, save_config
development = True
def do_connect(ssid, pwd):
sta_if = network.WLAN(network.STA_IF)
if not sta_if.isconnected(... | mit | Python | |
69df0819456c45bcac8ace28cfd3f294795ae726 | Create ATM.py | RicoAntonioFelix/ATM-SIMULATOR | src/ATM.py | src/ATM.py | # Copyright 2014 Rico Antonio Felix
#
# Licensed under the Apache License, Version 2.0 (the "License");
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | apache-2.0 | Python | |
6616d17a534ff2cf0dbdeb9f138d4ef09bf8d03d | update app.config | sahlinet/httptest,sahlinet/httptest,sahlinet/httptest,sahlinet/httptest | run_all.py | run_all.py | def func(self):
import sys, os
import py_compile
if os.environ['EXECUTOR'] != "docker":
sys.path.append("/home/philipsahli/workspace/httptest/app")
py_compile.compile("/home/philipsahli/workspace/httptest/app/run_all.py", doraise=True)
import run_all
import utils
reload(run_all)
reload(utils)
else:
f... | mit | Python | |
de4359d228b47a4da87c0f79603373b916ff9464 | Add migration from other branch | tsotetsi/textily-web,tsotetsi/textily-web,tsotetsi/textily-web,pulilab/rapidpro,pulilab/rapidpro,tsotetsi/textily-web,pulilab/rapidpro,pulilab/rapidpro,pulilab/rapidpro,tsotetsi/textily-web | temba/flows/migrations/0083_populate_recent_msgs.py | temba/flows/migrations/0083_populate_recent_msgs.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-11 09:46
from __future__ import unicode_literals
from django.db import migrations
def old_recent_messages_lookup(FlowStep, step_uuid, rule_uuid, next_uuid):
"""
The old way of looking up recent messages from flow step table
"""
recent_me... | agpl-3.0 | Python | |
a32b4216b98fb2bb23d8a0a700d05bd417df1906 | Implement main function | Hethurin/UApp | useless_passport_validator/umain.py | useless_passport_validator/umain.py | #!/usr/bin/python3.4
import ulibrary
import sys
from uwindow import UWindow
from gi.repository import Gtk
class Usage(Exception):
def __init__(self, msg):
self.msg = msg
def main():
ulibrary.init()
uwindow = UWindow()
uwindow.connect("delete-event", Gtk.main.quit)
uwindow.show_all()
... | mit | Python | |
845a74ca5475aa8121733ab92d4e1141e62d39a1 | rename error to result error. | tobyqin/testcube,tobyqin/testcube,tobyqin/testcube,tobyqin/testcube | testcube/core/migrations/0006_auto_20170610_0526.py | testcube/core/migrations/0006_auto_20170610_0526.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-10 05:26
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0005_auto_20170610_0506'),
]
operations = [
migrations.RenameModel(
... | mit | Python | |
a9388f7d4c4747e6710d20d618b57f19360cb69c | Add remove vlan compliance test | lindycoder/netman,internaphosting/netman,internap/netman | tests/adapters/compliance_tests/remove_vlan_test.py | tests/adapters/compliance_tests/remove_vlan_test.py | # Copyright 2019 Internap.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | apache-2.0 | Python | |
b9ba0f23b4e9efdc2c6158ce2047f5e4cc73f9b5 | Add conftest.py to ignore top-level stuff | wmayner/pyemd,wmayner/pyemd | conftest.py | conftest.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
collect_ignore = ["setup.py", ".pythonrc.py"]
| mit | Python | |
63326149ba56677f2fbcfc6e875819d0b2ddf5de | Create sqlsync.py | GaryBrittain/DB2S3,GaryBrittain/DB2S3 | sqlsync.py | sqlsync.py | import MySQLdb as db
HOST = ""
PORT =
USER = ""
PASSWORD = ""
DB = ""
def post_file (path, filename):
try:
conn = db.Connection(host=HOST, port=PORT, user=USER, passwd=PASSWORD, db=DB)
dbhandler = conn.cursor(db.cursors.DictCursor)
sql = ("INSERT INTO db2s3 (PATH, FILENAME, DROPBOX_DOWNLOADED) VALUES(... | mit | Python | |
03e1a4d988650196f698623da8d84070f9ace47d | Create ModisLADSFTP.py | Tartomas/PyModisAtm | ModisLADSFTP.py | ModisLADSFTP.py | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 4 13:02:35 2017
@author: Tomás Acuña y Italo Moletto
mail: tomasacuna@ug.uchile.cl
Modified from : http://www.science-emergence.com/Codes/Download-a-file-of-MODIS-MYD08-M3-from-ladsftp-using-python/
"""
from ftplib import FTP
import numpy as np
import os
import calendar
... | mit | Python | |
d0c3e0901cbb1c89477ec081a5dce0d3a12f8df8 | add test runner script for local development | adnelson/nixfromnpm,adnelson/nixfromnpm | runtests.py | runtests.py | #!/usr/bin/env nix-shell
#! nix-shell -i python3 -p python3Packages.pyyaml
"""Run the tests in the circleci config, for local dev."""
from os.path import dirname, join
from subprocess import call
import yaml
with open(join(dirname(__file__), ".circleci", "config.yml")) as f:
circle_cfg = yaml.load(f)
results = {}... | mit | Python | |
3361cf94d06bdc3a207caa490c7ce2e43cc5795f | Add 136-single-number.py | mvj3/leetcode | 136-single-number.py | 136-single-number.py | """
Question:
Single Number
Given an array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
Performance:
1. Total Accepted: 92009 Total Submissions: 19999... | mit | Python | |
c8c026cb1f0d19a928671dd80e7a9664d13507c6 | add leetcode Binary Tree Preorder Traversal | Fity/2code,Fity/2code,Fity/2code,Fity/2code,Fity/2code,Fity/2code | leetcode/BinaryTreePreorderTraversal/solution.py | leetcode/BinaryTreePreorderTraversal/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 a list of integers
def preorderTraversal(self, root):
ret = ... | mit | Python | |
3c4cc20a2b9708f01569abd7985573e26f0a19ad | add tic_tac_toe.py part 1 | Nethermaker/school-projects | intro/tic_tac_toe.py | intro/tic_tac_toe.py | import random
import copy
#We will represent the board as a string with
# TEN THINGS in it. The first thing will be blank (always),
# and the next nine will be 'X', 'O', or ' '.
board = ' XO XO XOO'
def draw_board(board):
print ' | | '
print ' {} | {} | {} '.format(board[7], board[8], boar... | mit | Python | |
19f58aca5dbfbdd6e47cca5927df51dc8904371c | Add mocked up settings | SEL-Columbia/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,p... | settings.py | settings.py | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
SECRET_KEY = 'this is not a secret key'
INSTALLED_APPS = (
'couchdbkit.ext.django',
'couchforms',
'coverage'
)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'couchforms',
}
}
####### ... | bsd-3-clause | Python | |
158e4df1738ab1b1e104ee50a93cb829ed868374 | Create tutorial2.py | eddennison/empty-app | tutorial2.py | tutorial2.py | from ggame import App, Color, LineStyle, Sprite
from ggame import CircleAsset
red = Color(0xff0000, 1.0)
green = Color(0x00ff00, 1.0)
blue = Color(0x0000ff, 1.0)
black = Color(0x000000, 1.0)
thinline = LineStyle(1, black)
mycircle = CircleAsset(5, thinline, blue)
xcoordinates = range(100, 600, 10)
# Generate a list ... | mit | Python | |
d0789d6b47a7186077927d8b8b0f812c597e26bc | Add check_keys.py | Celeo/GETIN-Auth,Celeo/GETIN-Auth,Celeo/GETIN-Auth,Celeo/GETIN-Auth | check_keys.py | check_keys.py | from hr.app import *
with open('results.txt', 'w') as f:
for key in APIKey.query.all():
try:
auth = xmlapi.auth(keyID=key.key, vCode=key.code)
result = auth.account.APIKeyInfo()
if not result.key.accessMask == app.config['API_KEY_MASK']:
f.write('Invalid... | mit | Python | |
301e6b9b997c53aec8f63184153c949e8d6a1983 | Create __init__.py | Quantmatic/iq2mongo | iq2mongo/__init__.py | iq2mongo/__init__.py | from iq2mongo import Iqfeedhistoricdata
| apache-2.0 | Python | |
22be0d463a7e4f8795c9b14e761bb2f84ef3ce50 | add UDPCollector | Nihn/Diamond-1,Netuitive/Diamond,bmhatfield/Diamond,signalfx/Diamond,Slach/Diamond,datafiniti/Diamond,CYBERBUGJR/Diamond,rtoma/Diamond,jriguera/Diamond,Ssawa/Diamond,skbkontur/Diamond,actmd/Diamond,EzyInsights/Diamond,disqus/Diamond,timchenxiaoyu/Diamond,hvnsweeting/Diamond,saucelabs/Diamond,Clever/Diamond,Slach/Diamon... | src/collectors/udp/udp.py | src/collectors/udp/udp.py | # coding=utf-8
"""
The UDPCollector class collects metrics on UDP stats (surprise!)
It's a copy of the TCPCollector with minor adjustments
#### Dependencies
* /proc/net/snmp
"""
import diamond.collector
import os
class UDPCollector(diamond.collector.Collector):
PROC = '/proc/net/snmp'
def get_default_... | mit | Python | |
f54a014fa420699f3c161f90b6392075a0134807 | move .ready() to the right place | cdsteinkuehler/MachineKit,araisrobo/machinekit,unseenlaser/machinekit,ArcEye/machinekit-testing,strahlex/machinekit,ArcEye/machinekit-testing,strahlex/machinekit,EqAfrica/machinekit,ArcEye/machinekit-testing,yishinli/emc2,araisrobo/machinekit,unseenlaser/machinekit,strahlex/machinekit,RunningLight/machinekit,ianmcmahon... | src/hal/user_comps/pyvcp.py | src/hal/user_comps/pyvcp.py | #!/usr/bin/env python
# This is a component of emc
# Copyright 2007 Anders Wallin <anders.wallin@helsinki.fi>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of... | #!/usr/bin/env python
# This is a component of emc
# Copyright 2007 Anders Wallin <anders.wallin@helsinki.fi>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of... | lgpl-2.1 | Python |
365be4a69571f5eadc8e3446e200594e8497b9b5 | add python password generator | bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile,bmaupin/junkpile | python/python/misc/pwgen.py | python/python/misc/pwgen.py | #!/usr/bin/env python
'''
Copyright (C) 2011 Bryan Maupin <bmaupincode@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later... | mit | Python | |
525f8afcb132c2bb0eb853207685f291b292c41f | Add strip_openflow utility component | pthien92/sdn,MurphyMc/pox,PrincetonUniversity/pox,adusia/pox,pthien92/sdn,noxrepo/pox,MurphyMc/pox,adusia/pox,chenyuntc/pox,denovogroup/pox,carlye566/IoT-POX,MurphyMc/pox,xAKLx/pox,carlye566/IoT-POX,VamsikrishnaNallabothu/pox,VamsikrishnaNallabothu/pox,chenyuntc/pox,diogommartins/pox,noxrepo/pox,waltznetworks/pox,kpeng... | pox/lib/pxpcap/strip_openflow.py | pox/lib/pxpcap/strip_openflow.py | # Copyright 2012,2013 James McCauley
#
# This file is part of POX.
#
# POX is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# POX is d... | apache-2.0 | Python | |
148068d99477b5f61a91362a22d56dc3e7ca2dcd | Change where uploads go | comandrei/meh,comandrei/meh | meh/vermin/migrations/0002_auto_20150505_0439.py | meh/vermin/migrations/0002_auto_20150505_0439.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('vermin', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='post',
name='image',
... | mit | Python | |
2ddaadff2033517def793af5bfc0bae122789e6a | add users.py, which plugs a hole in the dev authentication process | fcrepo4-archive/RDFDatabank,fcrepo4-archive/RDFDatabank,fcrepo4-archive/RDFDatabank,fcrepo4-archive/RDFDatabank | rdfdatabank/config/users.py | rdfdatabank/config/users.py | _USERS = {'admin': {'owner': '*', 'first_name': 'Databank', 'last_name': 'Admin', 'role': 'admin'}, 'sandbox_user': {'owner': ['sandbox'], 'role': 'user', 'name': 'Sandbox user', 'description': 'User for silo Sandbox'}}
| mit | Python | |
a1be18c495802ab07147b30c2455445817a42fa6 | Test for __unicode__ behavior | amir-qayyum-khan/lore,amir-qayyum-khan/lore,amir-qayyum-khan/lore,amir-qayyum-khan/lore,mitodl/lore,mitodl/lore,amir-qayyum-khan/lore,mitodl/lore,mitodl/lore,mitodl/lore | learningresources/tests/test_models.py | learningresources/tests/test_models.py | """
Tests for learningresources models
"""
from __future__ import unicode_literals
from django.test.testcases import TestCase
from learningresources.models import LearningResourceType
class TestModels(TestCase):
"""Tests for learningresources models"""
def test_unicode(self):
"""Test for __unicode_... | agpl-3.0 | Python | |
24357efc8b44d916d9d43e262bb7b323cc650e81 | Create get_ip_send_email.py | oska874/raspberry | get_ip_send_email.py | get_ip_send_email.py | #!/usr/bin/python
#-*-coding:utf8-*-
__author__ = 'laixintao'
import socket
import fcntl
import time
import struct
import smtplib
import urllib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
import re
import urllib2
# the e-mail config
# thi... | mit | Python | |
5a38a989591202fae42da75fde73f486634376e3 | Create 7kyu_simple_fun_new_numeral_system.py | Orange9000/Codewars,Orange9000/Codewars | Solutions/7kyu/7kyu_simple_fun_new_numeral_system.py | Solutions/7kyu/7kyu_simple_fun_new_numeral_system.py | from string import ascii_uppercase as AU
def new_numeral_system(number):
idx = AU.index(number)
return ["{} + {}".format(AU[i], AU[idx-i]) for i in range((idx//2)+1)]
| mit | Python | |
6174804ab17b621ad010c6ddd3b07f7728d24120 | add script | adamewing/bamsurgeon,MischaLundberg/bamsurgeon,adamewing/bamsurgeon,MischaLundberg/bamsurgeon | etc/bsrg.py | etc/bsrg.py | #!/usr/bin/env python
''' Adds a bogus read group to a readgroup-less BAM file '''
import os
import sys
import pysam
from uuid import uuid4
def modhead(header, rgid, fn):
if 'RG' in header:
sys.stderr.write("RG found in header, this script is not what you want!\n")
sys.exit(usage())
header[... | mit | Python | |
936042aad2e599c864cf31164d2399f6170e38c1 | add updated data, new 05 homework | bluegrapes/DAT8Coursework | homework/05_pandas_homework_imdb.py | homework/05_pandas_homework_imdb.py | '''
Pandas Homework with IMDb data
'''
'''
BASIC LEVEL
'''
import pandas as pd
import matplotlib.pyplot as plt
# read in 'imdb_1000.csv' and store it in a DataFrame named movies
movies = pd.read_csv("data/imdb_1000.csv")
# check the number of rows and columns
movies.shape
# check the data type of each column
movie... | apache-2.0 | Python | |
9ffe40aaf5ece521020258c4b31fbdb514e02b69 | Add utility function for get latest Build | colajam93/aurpackager,colajam93/aurpackager,colajam93/aurpackager,colajam93/aurpackager | manager/utilities.py | manager/utilities.py | from typing import Optional
from manager.models import Package, Build
def get_latest_build(package: Package) -> Optional[Build]:
try:
return Build.objects.filter(package=package, status=Build.SUCCESS).order_by('-id')[0]
except IndexError:
return None
| mit | Python | |
0b55d97573fcd196a318b3c901f6dcac1b0a4eef | Create a placeholder for pyauto test scripts. | ropik/chromium,adobe/chromium,ropik/chromium,gavinp/chromium,yitian134/chromium,adobe/chromium,adobe/chromium,ropik/chromium,ropik/chromium,adobe/chromium,gavinp/chromium,Crystalnix/house-of-life-chromium,gavinp/chromium,Crystalnix/house-of-life-chromium,Crystalnix/house-of-life-chromium,Crystalnix/house-of-life-chromi... | chrome/test/functional/test_basic.py | chrome/test/functional/test_basic.py | #!/usr/bin/python
# Copyright (c) 2010 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 unittest
from pyauto import PyUITest
class SimpleTest(PyUITest):
def testCanOpenGoogle(self):
self.NavigateToURL("http... | bsd-3-clause | Python | |
ffdfc05affc88226fda08c4d1924a9c509f4b53e | add GBM detector and datatype attrs | dpshelio/sunpy,dpshelio/sunpy,dpshelio/sunpy | sunpy/net/dataretriever/attrs/gbm.py | sunpy/net/dataretriever/attrs/gbm.py | from sunpy.net.attr import SimpleAttr
__all__ = ['Detector']
class Detector(SimpleAttr):
"""
Detector number for FERMI GBM
"""
class Datatype(SimpleAttr):
"""
Data type of GBM - either CSPEC or CTIME
""" | bsd-2-clause | Python | |
6906f574fad033f0b68fe7a5a35f4fcef1207ee0 | Load the source from a highlighted URL into a new window | RichardHyde/SublimeText.Packages | Get_Webpage_Source.py | Get_Webpage_Source.py | import sublime
import sublime_plugin
import urllib
class GetWebpageSourceCommand(sublime_plugin.TextCommand):
def run(self, edit):
url = self.view.substr(self.view.sel()[0])
if len(url) == 0:
return
output = ""
r = urllib.request.urlopen(url)
output = str(r.read(), encoding='utf8')
... | mit | Python | |
430ad720ef43de501f3fb06901fbf5971cf920c6 | Create nowplaying.py | TingPing/plugins,TingPing/plugins | HexChat/nowplaying.py | HexChat/nowplaying.py | import dbus
import hexchat
__module_name__ = "NowPlaying"
__module_author__ = "TingPing"
__module_version__ = "0"
__module_description__ = "Announce Pithos or Audacious Songs"
# This is just me duct-taping two of my scripts together
# Don't expect adding players to this list.
np_help_msg = 'NP: Valid commands are (s... | mit | Python | |
a6edfaeb6fc8036c60d9c20bf871795cba198337 | Add unittests for new bridgedb.translations module. | mmaker/bridgedb,pagea/bridgedb,pagea/bridgedb,mmaker/bridgedb | lib/bridgedb/test/test_translations.py | lib/bridgedb/test/test_translations.py | # -*- coding: utf-8 -*-
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org>
# :copyright: (c) 2014, Isis Lovecruft
# (c) 2014, The Tor Project, Inc.
# :license: 3-Clause BSD, see LICENSE for licensing information
from t... | bsd-3-clause | Python | |
93d80604003e1b3b21498df01f7647e7cea69a5f | Add basic WinEvent object tests. | CybOXProject/python-cybox | cybox/test/objects/win_event_test.py | cybox/test/objects/win_event_test.py | # Copyright (c) 2015, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import unittest
from cybox.objects.win_event_object import WinEvent
from cybox.test.objects import ObjectTestCase
class TestWinThread(ObjectTestCase, unittest.TestCase):
object_type = "WindowsEventObjectType"... | bsd-3-clause | Python | |
6c36729ec7d9f3345f0adb0c5deba13bd62262c6 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/6e84074d5cbda4900ea3f6cf29333e9f0140a661. | paolodedios/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,Intel-tensorflow/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow,tensorflow/tens... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "6e84074d5cbda4900ea3f6cf29333e9f0140a661"
TFRT_SHA256 = "6764720c5901c26c6b92b5b16a12... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "d5b707f0e4997a401fd14b4a94e4f670e03e502e"
TFRT_SHA256 = "24a0e9963489cb9f5443e9e4a670... | apache-2.0 | Python |
05afa4481112f4cc890cfe3d6372044397b774c7 | Create set-timeZone-AsiaJakarta.py | agusmakmun/Some-Examples-of-Simple-Python-Script,agusmakmun/Some-Examples-of-Simple-Python-Script | timezone/set-timeZone-AsiaJakarta.py | timezone/set-timeZone-AsiaJakarta.py | >>> import os, time
>>> os.environ['TZ'] = 'Asia/Jakarta'
>>> time.tzset()
>>> time.strftime('%X %x %Z')
'12:26:07 10/15/15 WIB'
>>> print str(datetime.datetime.now()).split()[0]
2015-10-15
>>>
| agpl-3.0 | Python | |
4c71d31fc4adaec4a21f766530f459c911e03492 | add 0001 | Show-Me-the-Code/python,Show-Me-the-Code/python,Show-Me-the-Code/python,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python | Jaccorot/0001/0001.py | Jaccorot/0001/0001.py | #!/usr/local/bin/python
#coding=utf-8
#第 0001 题:做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),
#使用 Python 如何生成 200 个激活码(或者优惠券)?
import uuid
def create_code(num, length):
#生成”num“个激活码,每个激活码含有”length“位
result = []
while True:
uuid_id = uuid.uuid1()
temp = str(uuid_id).replace('-', '')[:le... | mit | Python | |
ea64c4f44d5c386f9d9b43a8f122987b374b10d3 | Update the bot to use our new Yo emote | mileswwatkins/moxie,mileswwatkins/moxie,loandy/moxie,loandy/moxie,paultag/moxie,rshorey/moxie,rshorey/moxie,paultag/moxie,mileswwatkins/moxie,rshorey/moxie,loandy/moxie,paultag/moxie | moxie/butterfield.py | moxie/butterfield.py | import os
import json
import asyncio
from butterfield.utils import at_bot
from aiodocker import Docker
from aiocore import EventService
WEB_ROOT = os.environ.get("MOXIE_WEB_URL", "http://localhost:8888")
class LogService(EventService):
"""
Provide basic text logging using print()
"""
identifier = "mo... | import os
import json
import asyncio
from butterfield.utils import at_bot
from aiodocker import Docker
from aiocore import EventService
WEB_ROOT = os.environ.get("MOXIE_WEB_URL", "http://localhost:8888")
class LogService(EventService):
"""
Provide basic text logging using print()
"""
identifier = "mo... | mit | Python |
89d4c1420805a6f2e491f1ab250722cdcf950bd8 | Work towards integration NDTable <-> Minivect | seibert/blaze-core,seibert/blaze-core,seibert/blaze-core,seibert/blaze-core,seibert/blaze-core | ndtable/engine/mv.py | ndtable/engine/mv.py | import sys
import time
import numpy as np
from minivect import miniast
from minivect import specializers
from minivect import minitypes
from minivect.ctypes_conversion import get_data_pointer, \
get_pointer, convert_to_ctypes
from ndtable.datashape.coretypes import var_generator
from ndtable.expr.visitor import ... | bsd-2-clause | Python | |
1146ab654c8b0d6f982f19bafed91f18edb877f3 | Add tests for the `dirty_unzip` rule | gogobebe2/thefuck,bigplus/thefuck,Aeron/thefuck,manashmndl/thefuck,subajat1/thefuck,PLNech/thefuck,princeofdarkness76/thefuck,mcarton/thefuck,lawrencebenson/thefuck,thinkerchan/thefuck,Clpsplug/thefuck,vanita5/thefuck,levythu/thefuck,BertieJim/thefuck,hxddh/thefuck,Clpsplug/thefuck,zhangzhishan/thefuck,barneyElDinosaur... | tests/rules/test_dirty_unzip.py | tests/rules/test_dirty_unzip.py | import os
import pytest
import zipfile
from thefuck.rules.dirty_unzip import match, get_new_command, side_effect
from tests.utils import Command
@pytest.fixture
def zip_error(tmpdir):
path = os.path.join(str(tmpdir), 'foo.zip')
def reset(path):
with zipfile.ZipFile(path, 'w') as archive:
... | mit | Python | |
fce66429cb361e9f113b3ec69031502128d192fb | Create OGR_PointIteration.py | leandromet/Geoprocessamento---Geoprocessing,leandromet/Geoprocessamento---Geoprocessing,leandromet/Geoprocessamento---Geoprocessing,leandromet/Geoprocessamento---Geoprocessing,leandromet/Geoprocessamento---Geoprocessing | OGR_PointIteration.py | OGR_PointIteration.py | from osgeo import ogr
import os
shapefile = "//mnt//hgfs//Biondo//GINF//Florestas_Parana//pr_300_f22.shp"
driver = ogr.GetDriverByName("ESRI Shapefile")
dataSource = driver.Open(shapefile, 0)
layer = dataSource.GetLayer()
for feature in layer:
geom = feature.GetGeometryRef()
pt = geom.Centroid()
pto = (pt... | mit | Python | |
d3922992a4048dfff356ed91196c9c4d4d62bb08 | Create testcase.py | SAYONG/hairy-octo-nemesis,SAYONG/hairy-octo-nemesis | testcase.py | testcase.py | import unittest
from cal import Calculator
class TddInPythonExample(unittest.TestCase):
def test_calculator_add_method_returns_correct_result(self):
calc = Calculator()
result = calc.add(2,2)
self.assertEqual(4, result)
def test_calculator_returns_error_message_if_both_args_not... | apache-2.0 | Python | |
f83250d04fc4f98e97abcdc705046e5b412fc62e | add solution for Set Matrix Zeroes | zhyu/leetcode,zhyu/leetcode | src/setMatrixZeroes.py | src/setMatrixZeroes.py | class Solution:
# @param matrix, a list of lists of integers
# RETURN NOTHING, MODIFY matrix IN PLACE.
def setZeroes(self, matrix):
if not matrix:
return
n = len(matrix)
if n == 0:
return
m = len(matrix[0])
pos = None
for i in xrange(n... | mit | Python | |
3926420273dce58076a8ba148e87f5ef268a2846 | add ie6 specific Focus.focus function | jaredly/pyjamas,jaredly/pyjamas,jaredly/pyjamas,jaredly/pyjamas | library/__ie6__/pyjamas/ui/Focus.py | library/__ie6__/pyjamas/ui/Focus.py | # emulate behaviour of other browsers
def focus(elem):
JS("""
try {
elem.focus();
} catch (e) {
// Only trap the exception if the attempt was mostly legit
if (!elem || !elem.focus) {
// Rethrow the probable NPE or invalid type
throw... | apache-2.0 | Python | |
b219f44c754aafb959217ecf4199c8dc23a41ab1 | Create __init__.py | andrewchenshx/vnpy,bigdig/vnpy,bigdig/vnpy,andrewchenshx/vnpy,msincenselee/vnpy,bigdig/vnpy,vnpy/vnpy,vnpy/vnpy,msincenselee/vnpy,bigdig/vnpy,andrewchenshx/vnpy,andrewchenshx/vnpy,msincenselee/vnpy,andrewchenshx/vnpy,msincenselee/vnpy | vnpy/app/risk_manager/ui/__init__.py | vnpy/app/risk_manager/ui/__init__.py | from .widget import RiskManager
| mit | Python | |
b92f204174e8d14fe4912631f5bc1305d7cd9550 | add choose.py; hardly anything in it | ieuan1630-cmis/ieuan1630-cmis-cs2 | choose.py | choose.py | def main(): #get input and if input is bingo return true
x = raw_input("Type a word: ")
return bool(x == "bingo" or x == "Bingo")
print main()
| cc0-1.0 | Python | |
8188a8327b6269cdb2ae84fd97b19eac50914731 | add time module | anlutro/allib.py | allib/time.py | allib/time.py | import math
def format_timedelta(timedelta, short=True):
"""
Format a timedelta into a human-readable string.
"""
seconds = abs(timedelta.total_seconds())
days = max(0, math.floor(seconds / (3600 * 24)))
seconds -= 3600 * 24 * days
hours = max(0, math.floor(seconds / 3600))
seconds -= ... | mit | Python | |
178d4f3c13fa4baba4a0cb3bcadfa983ee1246ae | Add zenodo harvester | CenterForOpenScience/scrapi,alexgarciac/scrapi,fabianvf/scrapi,jeffreyliu3230/scrapi,fabianvf/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,felliott/scrapi,erinspace/scrapi,icereval/scrapi,mehanig/scrapi,felliott/scrapi,ostwald/scrapi,mehanig/scrapi | scrapi/harvesters/zenodo.py | scrapi/harvesters/zenodo.py | '''
Harvester for the ASU Digital Repository for the SHARE project
Example API call: https://zenodo.org/oai2d?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals
from scrapi.base import OAIHarvester
class ZenodoHarvester(OAIHarvester):
short_name = 'zenodo'
long_name = 'Zenodo... | apache-2.0 | Python | |
0749111442c638569b6e42a11adee70e71e50813 | Add an helper class to write pexpect-based test cases Over time, we should improve this class and port all pexpect based testing over to using this | llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb | test/lldbpexpect.py | test/lldbpexpect.py | import lldb
from lldbtest import *
import lldbutil
import os
import unittest2
import sys
import pexpect
class PExpectTest(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
def doTest(self):
# put your commands he... | apache-2.0 | Python | |
305c3e0ce2705dd23e00ec801f5588ec1dbcc3a8 | Add py solution for 167. Two Sum II - Input array is sorted | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | py/two-sum-ii-input-array-is-sorted.py | py/two-sum-ii-input-array-is-sorted.py | class Solution(object):
def twoSum(self, numbers, target):
"""
:type numbers: List[int]
:type target: int
:rtype: List[int]
"""
head, tail = 0, len(numbers) - 1
while head < tail:
s = numbers[head] + numbers[tail]
if s == target:
... | apache-2.0 | Python | |
b41fc9f56fbeef66612647605b8cbc144e93e66a | add example on how to run parallel func | chiahaoliu/pdf_lib | pdf_lib/lib_build.py | pdf_lib/lib_build.py | # script to execute database building
from pdf_lib.parallel_func import (save_data, learninglib_build,
map_learninglib)
from ipyparallel import Client
rc = Client()
dview = rc[:]
def run_build(cif_dir):
fn_list = sorted([f for f in os.listdir(cif_dir) if f.endswith('.cif')])
... | mit | Python | |
a7342cf25b850d310b0607f46a86037b26a8ecc4 | Create to_html.py | pactekviz/awesome-datascience-colleges,ryanswanstrom/awesome-datascience-colleges,Deerluluolivia/awesome-datascience-colleges,nitishmadhukar/awesome-datascience-colleges,JeffJetton/awesome-datascience-colleges,strasser/awesome-datascience-colleges | to_html.py | to_html.py | import pandas as pd
in_file = 'https://raw.githubusercontent.com/ryanswanstrom/awesome-datascience-colleges/master/data_science_colleges.csv'
## Read in the file
df = pd.read_csv(in_file)
# get a full degree name
df['DEGREE_FULL'] = df[['DEGREE']].apply(lambda x:
('Bachelors' if x[0]=='B' else 'Masters' if x[0]=='... | mit | Python | |
a26303847f8133ea037c7629c4949d061457f7d2 | Add a new module to import configuration data (hosts/services) from a MySQL database | lets-software/shinken,kaji-project/shinken,xorpaul/shinken,xorpaul/shinken,rednach/krill,Simage/shinken,peeyush-tm/shinken,baloo/shinken,staute/shinken_deb,savoirfairelinux/shinken,dfranco/shinken,staute/shinken_package,rednach/krill,mohierf/shinken,titilambert/alignak,fpeyre/shinken,tal-nino/shinken,naparuba/shinken,s... | shinken/modules/mysql_import_arbiter.py | shinken/modules/mysql_import_arbiter.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#Copyright (C) 2009 Gabes Jean, naparuba@gmail.com
#
#This file is part of Shinken.
#
#Shinken 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... | agpl-3.0 | Python | |
3bf0a1c0752be428d3259a6639be205f019751d5 | Add lc0056_merge_intervals.py | bowen0701/algorithms_data_structures | lc0056_merge_intervals.py | lc0056_merge_intervals.py | """Leetcode 56. Merge Intervals
Medium
URL: https://leetcode.com/problems/merge-intervals/
Given a collection of intervals, merge all overlapping intervals.
Example 1:
Input: [[1,3],[2,6],[8,10],[15,18]]
Output: [[1,6],[8,10],[15,18]]
Explanation: Since intervals [1,3] and [2,6] overlaps, merge them into [1,6].
Exa... | bsd-2-clause | Python | |
f8e24bf955eb70535b989aad6ab8666ddd013da1 | Add in first py.test tests. | clalancette/pycdlib,clalancette/pyiso | tests/test_basic.py | tests/test_basic.py | import pytest
import subprocess
import os
import sys
prefix = '.'
for i in range(0,3):
if os.path.exists(os.path.join(prefix, 'pyiso.py')):
sys.path.insert(0, prefix)
break
else:
prefix = '../' + prefix
import pyiso
def test_nofiles(tmpdir):
# First set things up, and generate the... | lgpl-2.1 | Python | |
8a2891aa7b4aaf68655654f19998fe3dbc25db38 | Create tree_de.py | praveendareddy21/my-repo,praveendareddy21/my-repo | tree_de.py | tree_de.py | class nod(object):
def __init__(self ,elem):
self.elem=elem
self.le=None
self.ri=None
def setle(self ,le):
self.le=le
def getle(self):
return self.le
def setri(self ,ri):
self.ri=ri
def getri(self):
return self.ri
class dll(object):
def __i... | mit | Python | |
9c6f0cf829f4f0c7ff71ad65bed36269425dae13 | Add test for zoom backend | python-social-auth/social-core,python-social-auth/social-core | social_core/tests/backends/test_zoom.py | social_core/tests/backends/test_zoom.py | import json
from .oauth import OAuth2Test
class ZoomOAuth2Test(OAuth2Test):
backend_path = 'social_core.backends.zoom.ZoomOAuth2'
user_data_url = 'https://api.zoom.us/v2/users/me'
expected_username = 'foobar'
access_token_body = json.dumps({
'access_token': 'foobar-token',
'token_type... | bsd-3-clause | Python | |
6824c741c455339eaaff5481f6e84c42fe1e26cf | Copy of main.py from fergal, reworked | barentsen/dave,barentsen/dave,barentsen/dave,barentsen/dave | susanplay/mainSusan.py | susanplay/mainSusan.py |
"""
This is a template top level script.
Please don't edit this file. Instead, copy it to
youname_main.py, then run and edit that file.
"""
import dave.pipeline.pipeline as dpp
import dave.pipeline.clipboard as clipboard
def main():
"""A bare bones main program"""
cfg = loadMyConfiguration()
epicList ... | mit | Python | |
a4a956899008102b993d2268fbf6ae92d191ee6a | Test suite for Wikipedia triggers | ch3nkula/ifttt,ch3nkula/ifttt,ch3nkula/ifttt | ifttt/ifttt-tests.py | ifttt/ifttt-tests.py | # -*- coding: utf-8 -*-
"""
Wikipedia channel for IFTTT
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Copyright 2015 Ori Livneh <ori@wikimedia.org>
Stephen LaPorte <stephen.laporte@gmail.com>
Alangi Derick <alangiderick@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");... | apache-2.0 | Python | |
4a8c3043962efa7e2a443a10a0ad13d025699730 | Add script to extract useful lsf job information | Rfam/rfam-production,Rfam/rfam-production,Rfam/rfam-production | support/get_lsf_job_info.py | support/get_lsf_job_info.py | import os
import sys
from subprocess import Popen, PIPE
# --------------------------------------------------------------------------------------------------
def get_job_run_time(lsf_output_file, time='s'):
"""
"""
fp = open(lsf_output_file, 'r')
process = Popen(['grep', 'Run time', lsf_output_file], stdin=PIPE, ... | apache-2.0 | Python | |
52d947daa8ea6642472660d0c16c2b05e34bea41 | Add migration file for the model of CoC record | pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016,pycontw/pycontw2016 | src/users/migrations/0010_cocrecord.py | src/users/migrations/0010_cocrecord.py | # Generated by Django 3.0.2 on 2020-02-23 11:12
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('users', '0009_auto_20160227_1656'),
]
operations = [... | mit | Python | |
bf55611be1b4c3799ab3e14bdcc1b46e96cffe24 | Add try_f test | codeforamerica/Change-By-Us,localprojects/Change-By-Us,localprojects/Change-By-Us,codeforeurope/Change-By-Us,watchcat/cbu-rotterdam,localprojects/Change-By-Us,codeforamerica/Change-By-Us,watchcat/cbu-rotterdam,watchcat/cbu-rotterdam,codeforeurope/Change-By-Us,watchcat/cbu-rotterdam,codeforamerica/Change-By-Us,codeforam... | tests/util-tests.py | tests/util-tests.py | import unittest, sys, os
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
import framework.util as util
class UtilTests (unittest.TestCase):
def test_try_f(self):
self.assertEqual(util.try_f(int, "10", -1), 10, "Did not convert string to int.")
self.assertEqual(util.t... | agpl-3.0 | Python | |
b7bc68872a45396358ce20a215e3a3a2c3734b8a | Add pretend ram module to try out the progress bar | guiniol/py3status,guiniol/py3status | py3status/modules/pretend_ram.py | py3status/modules/pretend_ram.py | # -*- coding: utf-8 -*-
from __future__ import division
import random
class Py3status:
"""
"""
format = "{bar}"
thresholds = [(0, "good"), (40, "degraded"), (75, "bad")]
cache_timeout = 1
middle_char = '|'
middle_color = None
left_char = '|'
left_color = None
right_char = '|'
... | bsd-3-clause | Python | |
a90eb2777c7a6e80c8a57fec7f5d5b2665339d50 | Add fixed_rank.py module for fixed rank matrices | tingelst/pymanopt,nkoep/pymanopt,pymanopt/pymanopt,pymanopt/pymanopt,j-towns/pymanopt,nkoep/pymanopt,nkoep/pymanopt | pymanopt/manifolds/fixed_rank.py | pymanopt/manifolds/fixed_rank.py | """
Module containing manifolds of fixed rank matrices.
"""
from pymanopt.manifolds.manifold import Manifold
class FixedRankEmbedded(Manifold):
"""
Manifold struct to optimize fixed-rank matrices w/ an embedded geometry.
FixedRankEmbedded(m, n, k)
Manifold of m-by-n real matrices of fixed rank k. T... | bsd-3-clause | Python | |
10b0b790ca503bcabf203e6cdf8cd3ebc0bcfa5a | Create plot_log.py | prlz77/ResNeXt.pytorch | plot_log.py | plot_log.py | import re
import matplotlib.pyplot as plt
if __name__=='__main__':
file = open('./logs/log.txt','r')
accuracy = []
epochs = []
loss = []
for line in file:
test_accuracy = re.search('"test_accuracy": ([0]\.[0-9]+)*', line)
if test_accuracy:
accuracy.append(test_accuracy.g... | mit | Python | |
abc155280052ab2f216342acd7933db3e090d94e | Add some basic tests for flow_exports | mitmproxy/mitmproxy,StevenVanAcker/mitmproxy,mitmproxy/mitmproxy,xaxa89/mitmproxy,zlorb/mitmproxy,dwfreed/mitmproxy,dwfreed/mitmproxy,ddworken/mitmproxy,jvillacorta/mitmproxy,ddworken/mitmproxy,mhils/mitmproxy,mhils/mitmproxy,mitmproxy/mitmproxy,gzzhanghao/mitmproxy,laurmurclar/mitmproxy,ddworken/mitmproxy,mosajjal/mit... | test/test_export_flow.py | test/test_export_flow.py | import netlib.tutils
from libmproxy import flow_export
from . import tutils
req_get = netlib.tutils.treq(
method='GET',
headers=None,
content=None,
)
req_post = netlib.tutils.treq(
method='POST',
headers=None,
)
def test_request_simple():
flow = tutils.tflow(req=req_get)
assert flow_expo... | mit | Python | |
027b1e35a1808b010b30c596b9e98ede72b8c4e4 | add yamladd | benformosa/Toolbox,benformosa/Toolbox | yamladd.py | yamladd.py | #!/usr/bin/env python2
import argparse
import yaml
import sys
parser = argparse.ArgumentParser(
description='Insert a key-value pair into each mapping '
'in a YAML sequence of mappings')
parser.add_argument('key', help='Add this key')
parser.add_argument('value', help='with this value')
args = parser.... | unlicense | Python | |
5c0ef34788202abefbc36f80899f9b9b54ba17be | Add a fabric file to test the generated output | spyder-ide/docrepr,spyder-ide/docrepr,techtonik/docrepr,spyder-ide/docrepr,techtonik/docrepr,techtonik/docrepr | fabfile.py | fabfile.py | # -*- coding: utf-8 -*
"""
Simple fabric file to test oinspect output
"""
from __future__ import print_function
import webbrowser
import oinspect.sphinxify as oi
def test_basic():
"""Test with an empty context"""
docstring = 'A test'
content = oi.sphinxify(docstring, oi.generate_context())
page_nam... | bsd-3-clause | Python | |
6cfd5b46b9208d4e47482739732266c598e514df | add test script | luoyetx/mxnet,larroy/mxnet,jiajiechen/mxnet,CodingCat/mxnet,luoyetx/mxnet,TuSimple/mxnet,dmlc/mxnet,zhreshold/mxnet,reminisce/mxnet,precedenceguo/mxnet,jamesliu/mxnet,LinkHS/incubator-mxnet,navrasio/mxnet,vikingMei/mxnet,vikingMei/mxnet,LinkHS/incubator-mxnet,jiajiechen/mxnet,Northrend/mxnet,luoyetx/mxnet,TuSimple/mxne... | test_new_image_loader.py | test_new_image_loader.py | import os
os.environ['MXNET_CPU_WORKER_NTHREADS'] = '1'
os.environ['OMP_NUM_THREADS'] = '1'
import time
import numpy as np
import multiprocessing as mp
import mxnet as mx
from mxnet import gluon as gl
from mxnet.gluon.data.vision import transforms
if __name__ == '__main__':
M = 24
BS = 100
dataset = gl.data.vision... | apache-2.0 | Python | |
8d017a1f54bfff98f8f571c69d1e19ddbe8abdde | Add processify decorator | dseuss/pythonlibs | tools/processify.py | tools/processify.py | #!/usr/bin/env python
# encoding: utf-8
"""Taken from https://gist.github.com/schlamar/2311116"""
from __future__ import division, print_function
import sys
import traceback
from functools import wraps
from multiprocessing import Process, Queue
def processify(func):
"""Decorator to run a function as a process. ... | unlicense | Python | |
c5da3ee962a05c05d55fd98149c1095a57f03e36 | Add tests for task types for shot route | cgwire/zou | test/shots/test_task_types_for_shot.py | test/shots/test_task_types_for_shot.py | from test.base import ApiDBTestCase
class ShotTaskTypesTestCase(ApiDBTestCase):
def setUp(self):
super(ShotTaskTypesTestCase, self).setUp()
self.generate_fixture_project_status()
self.generate_fixture_project()
self.generate_fixture_entity_type()
self.generate_fixture_sequ... | agpl-3.0 | Python | |
554243dd90d6a96e5782f2b3e7ed5a72254fdf5b | Add tests. | Scifabric/pybossa,PyBossa/pybossa,PyBossa/pybossa,Scifabric/pybossa | test/test_jobs/test_export_userdata.py | test/test_jobs/test_export_userdata.py | # -*- coding: utf8 -*-
# This file is part of PYBOSSA.
#
# Copyright (C) 2018 Scifabric LTD.
#
# PYBOSSA is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your op... | agpl-3.0 | Python | |
566b2e9450c0602ea622d5c9b0ea90512336aef5 | Add exceptions from ceilometerclient | rdo-management/python-tuskarclient,tuskar/python-tuskarclient | tuskarclient/exc.py | tuskarclient/exc.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | apache-2.0 | Python | |
ff68543ba0ebe15b5847dfbc0f2d45221b1f3634 | add inflexible fast tests | dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy | tests/fast_test_suite.py | tests/fast_test_suite.py | import unittest
from test_evaluation_metrics import EvaluationMetricsTestCase
from test_appliance_trace import ApplianceTraceTestCase
from test_appliance_instance import ApplianceInstanceTestCase
from test_appliance_set import ApplianceSetTestCase
from test_appliance_type import ApplianceTypeTestCase
from test_utils im... | mit | Python | |
fc74bf1ee86b667221d25c296c305d2d2e478e23 | add inflexible fast tests | dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy | tests/fast_test_suite.py | tests/fast_test_suite.py | import unittest
from test_evaluation_metrics import EvaluationMetricsTestCase
from test_appliance_trace import ApplianceTraceTestCase
from test_appliance_instance import ApplianceInstanceTestCase
from test_appliance_set import ApplianceSetTestCase
from test_appliance_type import ApplianceTypeTestCase
from test_utils im... | mit | Python | |
de15489a27c28c6cb5bf35c325ebdd6e4dad5d2c | Create log.py | ArtiomL/tls-scan,ArtiomL/tls-scan | lib/log.py | lib/log.py | test
| mit | Python | |
21077f751e6cacae2e2383942f9b572a5ede86c9 | Add some example function tests that use gaeftest | MatthewWilkes/mw4068-packaging,MatthewWilkes/mw4068-packaging,MatthewWilkes/mw4068-packaging,MatthewWilkes/mw4068-packaging | tests/test_functional.py | tests/test_functional.py | #!/usr/bin/python2.5
#
# Copyright 2009 the Melange authors.
#
# 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... | apache-2.0 | Python | |
21b8c5317af4ff129f72fa949e32a57eae0df7d4 | Create categoryManager.py | MichaelCurrin/twitterverse,MichaelCurrin/twitterverse | app/utils/categoryManager.py | app/utils/categoryManager.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Category manager utility.
Manage values in the Category table and manage links between Category
and Profiles.
"""
import argparse
import os
import sys
# Allow imports to be done when executing this file directly.
sys.path.insert(0, os.path.abspath(os.path.join(os.path... | mit | Python | |
a9976160ad297953ecb91ff38fe904a993eba784 | Remove _clean | jorgebastida/django-dajax,jayfk/django-dajax,jorgebastida/django-dajax,jorgebastida/django-dajax,jayfk/django-dajax,Leonime/django-dajax,Leonime/django-dajax | dajax/core.py | dajax/core.py | from django.utils import simplejson as json
class Dajax(object):
def __init__(self):
self.calls = []
def json(self):
return json.dumps(self.calls)
def alert(self, message):
self.calls.append({'cmd': 'alert', 'val': message})
def assign(self, id, attribute, value):
s... | from django.utils import simplejson as json
class Dajax(object):
def __init__(self):
self.calls = []
def json(self):
return json.dumps(self.calls)
def alert(self, message):
self.calls.append({'cmd': 'alert', 'val': self._clean(message)})
def assign(self, id, attribute, valu... | bsd-3-clause | Python |
5db1ac3c73ebba56f478c8ee75d725032c5ab34e | Create gui.py | gappleto97/Senior-Project | client/gui.py | client/gui.py | mit | Python | ||
9c6da7e968f6659016fd34fb32a71476bd63c96b | Create emoji.py | PrestigeDox/Watashi-SelfBot | cogs/emoji.py | cogs/emoji.py | import discord
from discord.ext import commands
class Emoji:
def __init__(self, bot):
self.bot = bot
@commands.group(invoke_without_command=True)
async def emoji(self, ctx):
await ctx.message.delete()
emb = discord.Embed(colour=self.bot.gold)
emb.add_field(name='Usage', value='{***REMOVED***emoji <emojinam... | mit | Python | |
26b0c71b43c19984121c3f474b0836981950c468 | Add 0014 file | Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Show-Me-the-Code/python,Show-Me-the-Code/python,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Show-Me-the-Code/python | Drake-Z/0014/0014.py | Drake-Z/0014/0014.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''第 0014 题: 纯文本文件 student.txt为学生信息, 里面的内容(包括花括号)如下所示:
{
"1":["张三",150,120,100],
"2":["李四",90,99,95],
"3":["王五",60,66,68]
}
请将上述内容写到 student.xls 文件中。'''
__author__ = 'Drake-Z'
import os
import re
from collections import OrderedDict
import xlwt
def read_data... | mit | Python | |
3f6b36d96e7e718ff7fb9d98a8211448f6b0d7e9 | Add upgrade script | TribeMedia/synapse,howethomas/synapse,rzr/synapse,illicitonion/synapse,howethomas/synapse,TribeMedia/synapse,matrix-org/synapse,iot-factory/synapse,matrix-org/synapse,iot-factory/synapse,rzr/synapse,iot-factory/synapse,matrix-org/synapse,rzr/synapse,rzr/synapse,matrix-org/synapse,illicitonion/synapse,iot-factory/synaps... | scripts/upgrade_appservice_db.py | scripts/upgrade_appservice_db.py | import argparse
import json
import sqlite3
def main(dbname):
con = sqlite3.connect(dbname)
cur = con.cursor()
cur.execute("SELECT id, regex FROM application_services_regex")
for row in cur.fetchall():
try:
print "checking %s..." % row[0]
json.loads(row[1])
p... | apache-2.0 | Python | |
fe757d0f17c57f6748ca28e678bb22a9f36271de | Add cd magic test | Calysto/metakernel | metakernel/magics/tests/test_cd_magic.py | metakernel/magics/tests/test_cd_magic.py |
import os
from metakernel.tests.utils import get_kernel
def test_cd_magic():
kernel = get_kernel()
kernel.do_execute("%cd ~")
assert os.getcwd() == os.path.expanduser('~'), os.getcwd()
| bsd-3-clause | Python | |
45e6903bdb6d75f68dd09e156e85960acd885638 | Add main program. | Uberi/The-Mippits | mippits.py | mippits.py | #!/usr/bin/env python3
code = "00001020afc2fffcafc5fff8afdffff4000028140000000c03c5f02200001814ffffffff104300260000a014000000300282a0200000a814ffff000caeb400000042102000421020002220208c8200040000a014000000410282a0200000a814ffff000caeb400000000f8140000000403e00009006028208c8200080000a014000000410282a0200000a814ffff000c... | mit | Python | |
daef27939bed715d8a7d1f27fbfb4a193fb2de73 | add multiprocessing for cpu-load | Justontheway/HelloWorld,Justontheway/HelloWorld | src/python/multiprocessing/predict.py | src/python/multiprocessing/predict.py | # -*- coding:utf-8 -*-
import os
import sys
from math import ceil
import time
import signal
os.environ['OMP_NUM_THREADS'] = '1'
import numpy as np
import multiprocessing as mp
MATRIX_SIZE = (20000, 20000)
#MATRIX_SIZE = (2000, 2000)
pool = None
EXIT_FLAG = False
def worker(*args, **kwargs):
mat1 = np.random.rand... | apache-2.0 | Python | |
067668ee5879ba80cd29c9ae0ddee2a9be15fc31 | Create weather.py | krishnaaswani29/DenverCrimeVsPopulation | weather.py | weather.py |
from bs4 import BeautifulSoup
# In[27]:
import urllib2
# In[28]:
f = open('weather_1.txt', 'w')
f.write("Date" + '\t' + "Temp" +'\t' + "precp" +'\n')
# In[29]:
for y in range(2013, 2014):
for m in range(1, 13):
for d in range(1, 32):
# Check if leap year
if y%400 == 0:
leap = True
... | mit | Python | |
b7975ad7b733eda545e3647d40bc46abbe4df250 | add elseclause01.py | devlights/try-python | trypython/basic/elseclause01.py | trypython/basic/elseclause01.py | # coding: utf-8
"""
各処理の後に付与できる オプション else節 についてのサンプルです。
"""
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import pr
class Sample(SampleBase):
def exec(self):
#
# Pythonの for, while, try には else をつけることが出来る
# どれも、正常に処理が通った場合に else に入るようになっている。
#... | mit | Python | |
5a0afa8eead558adf8e24aa1a6a32055c0296b08 | Add docker settings | dkarchmer/django-aws-template,dkarchmer/django-aws-template,dkarchmer/django-aws-template,dkarchmer/django-aws-template | server/config/settings/docker.py | server/config/settings/docker.py | from .base import * # NOQA
import sys
import logging.config
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATES[0]['OPTIONS'].update({'debug': True})
STATIC_URL = '/static/'
STATIC_ROOT = '/www/static/'
STATICFILES_DIRS = (
('dist', os.path.join(STATIC_ROOT, 'dist'... | mit | Python | |
bdc9a6525e75014c727eeaf0aeb8b21a5b2290ca | Create wildchr.py | praveendareddy21/my-repo,praveendareddy21/my-repo | wildchr.py | wildchr.py | def match(str1,str2):
print '_'
if str1=='*' and str2=='' :
return True
if str1=='' and str2=='' :
return True
if str1=='' or str2=='' :
return False
if str1[0] ==str2[0] :
return match(str1[1:],str2[1:])
if str1[0]=='*' and str2[0] != '':
return matc... | mit | Python | |
14199e0590cf07f791c7422ee0b670d93ff0c5b0 | Create Transformations2D.py (#2310) | TheAlgorithms/Python | linear_algebra/src/transformations_2d.py | linear_algebra/src/transformations_2d.py | """
2D Transformations are regularly used in Linear Algebra.
I have added the codes for reflection, projection, scaling and rotation 2D matrices.
scaling(5) = [[5.0, 0.0], [0.0, 5.0]]
rotation(45) = [[0.5253219888177297, -0.8509035245341184],
[0.8509035245341184, 0.5253219888177297]]
projectio... | mit | Python | |
0942d2ccf68b88db2616f9839c1ca1ebfacb8ad9 | Migrate in domain model changes | johnjohndoe/spendb,CivicVision/datahub,USStateDept/FPA_Core,USStateDept/FPA_Core,spendb/spendb,openspending/spendb,pudo/spendb,johnjohndoe/spendb,nathanhilbert/FPA_Core,spendb/spendb,nathanhilbert/FPA_Core,CivicVision/datahub,spendb/spendb,nathanhilbert/FPA_Core,CivicVision/datahub,openspending/spendb,openspending/spen... | migration/versions/013_dataset_serp.py | migration/versions/013_dataset_serp.py | from sqlalchemy import *
from migrate import *
meta = MetaData()
def upgrade(migrate_engine):
meta.bind = migrate_engine
dataset = Table('dataset', meta, autoload=True)
serp_title = Column('serp_title', Unicode())
serp_title.create(dataset)
serp_teaser = Column('serp_teaser', Unicode())
serp... | agpl-3.0 | Python | |
c3743e6ba9f38388c6705f59b7991d4ed75d849e | Add helper module | minhvvu/writing_ass | helper.py | helper.py | from itertools import tee
def pairwise(itr):
a, b = tee(itr) # two version of itr
next(b, None) # b goes ahead one step
return zip(a, b) # return iterator
| mit | Python | |
53f4477776e922455c4a9180ac587ccfe5a3f589 | add Matplotlib1DWidget | michaellaier/pymor,michaellaier/pymor,michaellaier/pymor,michaellaier/pymor | src/pymor/gui/matplotlib.py | src/pymor/gui/matplotlib.py | # This file is part of the pyMor project (http://www.pymor.org).
# Copyright Holders: Felix Albrecht, Rene Milk, Stephan Rave
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function
import math as m
import numpy as np
from PySide.... | bsd-2-clause | Python | |
bbb9c4df3b4bdafb1e3b4c5bc05b19dd56aff407 | Add interactive console to add test cases. | google/budou | add_testcase.py | add_testcase.py | # coding: utf-8
from six.moves import input
import budou
import json
TESTCASES_PATH = 'test/cases.ndjson'
def colorize(text, color='green'):
ENDC = '\033[0m'
colors = {
'red': '\033[91m',
'green': '\033[92m',
'yellow': '\033[93m',
'blue': '\033[94m',
}
return colors[color] + text + ENDC
def m... | apache-2.0 | Python | |
9961234594b2581707978c20a51b838ba4b70627 | Add lan_ping.py | catroll/clipboard,catroll/clipboard,catroll/clipboard,catroll/clipboard | lan_ping.py | lan_ping.py | #!/usr/bin/env python
# -*- coding:utf8 -*-
import Queue
import threading
import subprocess
import re
import sys
lock = threading.Lock()
DEFAULT_THREAD_NUM = 100
def get_ips(ip):
a = re.match(r'(.*\d+)\.(\d+)-(\d+)', ip)
if not a:
raise Exception('IP range error')
start = int(a.group(2))
end... | mit | Python | |
b768281bf3b0e069312b64e738c12064cf4bd185 | add missing model migration | stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten | features/tags/migrations/0002_auto_20170116_2047.py | features/tags/migrations/0002_auto_20170116_2047.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-16 19:47
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('tags', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
... | agpl-3.0 | Python | |
b38ddb6c279da63d98e64476b4edc6b4c02f02d6 | add numeric sample | yusabana-sandbox/python-practice | numeric.py | numeric.py | # -*- coding: utf-8 -*-
print(0b11)
print(0o17)
print(0xb)
# int('2.1') # Error
print(type(0xb))
| mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.