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 |
|---|---|---|---|---|---|---|---|---|
d764a483497afc5d029a82db14cc5cc88f45f4c0 | Add an extension to allow for an addFixedIp action on instances | saleemjaveds/https-github.com-openstack-nova,bigswitch/nova,virtualopensystems/nova,leilihh/nova,cyx1231st/nova,rajalokan/nova,whitepages/nova,eneabio/nova,devendermishrajio/nova,virtualopensystems/nova,luogangyi/bcec-nova,tanglei528/nova,cloudbau/nova,sileht/deb-openstack-nova,tianweizhang/nova,mandeepdhami/nova,salv-... | nova/api/openstack/contrib/multinic.py | nova/api/openstack/contrib/multinic.py | # Copyright 2011 OpenStack LLC.
# 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 b... | apache-2.0 | Python | |
c13d1347889cf574d3e6b9b835dadbca5fdc2d6c | Add wheel module for the salt key system | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/wheel/key.py | salt/wheel/key.py | '''
Wheel system wrapper for key system
'''
import salt.key
def list_all():
'''
List the keys under a named status
'''
skey = salt.key.Key(__opts__)
return skey.list_all()
def accept(match):
'''
Accept keys based on a glob match
'''
skey = salt.key.Key(__opts__)
return skey.ac... | apache-2.0 | Python | |
c0ebb74ad0ee2eb210266e3610e0b44474628872 | add ismount function from python Lib/posixpath.py | thaim/ansible,thaim/ansible | lib/ansible/module_utils/ismount.py | lib/ansible/module_utils/ismount.py | # This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is based on
# Lib/posixpath.py of cpython
# It is licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
#
# 1. This LICENSE AGREEMENT is between the Python Software Foundation
# ("PSF")... | mit | Python | |
95a8ed6dcb19f322c9a14957da207efb8be10f5d | Customize makemessages to support ignoring fuzzy | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | hqscripts/management/commands/makemessages.py | hqscripts/management/commands/makemessages.py | from django.core.management.commands import makemessages
class Command(makemessages.Command):
def add_arguments(self, parser):
super().add_arguments(parser)
parser.add_argument('--no-fuzzy', action='store_true', help='Remove fuzzy strings.')
def handle(self, *args, **options):
no_fuzz... | bsd-3-clause | Python | |
1bd6d53c7ab8d7b2c2fdfbb8eb2fab2e1cfa1537 | Implement statistics & logger class | reinikai/mugloar | mugloar/logger.py | mugloar/logger.py | from datetime import datetime
from tabulate import tabulate
import sys
RED = "\033[1;31m"
BLUE = "\033[1;34m"
CYAN = "\033[1;36m"
GREEN = "\033[0;32m"
RESET = "\033[0;0m"
BOLD = "\033[;1m"
class Logger:
stats = {'NMR': {'win': 0, 'lose': 0},
'FUNDEFINEDG': {'win': 0, 'lose': 0},
'H... | mit | Python | |
597a1c12223fec5deefcd31b3a00b06d1095b32d | Add check replication step | globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service,globocom/database-as-a-service | dbaas/workflow/steps/util/region_migration/check_replication.py | dbaas/workflow/steps/util/region_migration/check_replication.py | # -*- coding: utf-8 -*-
import logging
from util import full_stack
from workflow.steps.util.base import BaseStep
from workflow.exceptions.error_codes import DBAAS_0020
from time import sleep
LOG = logging.getLogger(__name__)
class CheckReplication(BaseStep):
def __unicode__(self):
return "Checking replic... | bsd-3-clause | Python | |
fb6c84e7703092f495324fe57041717403803e7f | Add scrape_symbols.py placeholder. | scraperwiki/stock-tool,scraperwiki/stock-tool | scrape_symbols.py | scrape_symbols.py | #!/usr/bin/env python
# encoding: utf-8
def main():
pass
if __name__ == '__main__':
main()
| agpl-3.0 | Python | |
fe479bf2a8ec547922c6643bbdf0ba768eb79c9d | Add script to simulate multiple games | risteon/ludo_python | ludo/simulator.py | ludo/simulator.py | #!/usr/bin/env python3
from game import Game
print("Welcome to a game of ludo!")
average_throw_counter = 0
min_throws_per_game = 10000000
max_throws_per_game = 0
NUM_GAMES = 100
for i in range(0, NUM_GAMES):
game = Game()
throw_counter = 0
while game.next_move():
throw_counter += 1
average... | mit | Python | |
a8f172752a72d93537820322b9ce62b601be6c5f | Fix cpplint warning. | Gerhut/electron,bitemyapp/electron,thompsonemerson/electron,nekuz0r/electron,felixrieseberg/electron,jcblw/electron,brenca/electron,rhencke/electron,adamjgray/electron,lrlna/electron,soulteary/electron,vaginessa/electron,joaomoreno/atom-shell,ianscrivener/electron,soulteary/electron,setzer777/electron,baiwyc119/electro... | script/cpplint.py | script/cpplint.py | #!/usr/bin/env python
import fnmatch
import os
import subprocess
import sys
IGNORE_FILES = [
'browser/atom_application_mac.h',
'browser/atom_application_delegate_mac.h',
'browser/native_window_mac.h',
'browser/resources/win/resource.h',
'browser/ui/cocoa/event_processing_window.h',
'browser/ui/cocoa/atom_... | #!/usr/bin/env python
import fnmatch
import os
import subprocess
import sys
IGNORE_FILES = [
'app/win/resource.h',
'browser/atom_application_mac.h',
'browser/atom_application_delegate_mac.h',
'browser/native_window_mac.h',
'browser/ui/cocoa/event_processing_window.h',
'browser/ui/cocoa/atom_menu_controlle... | mit | Python |
334aa288fc38636f10e25b0d8ab4ecb91d198c9b | Add example SNP analysis script. | MikkelSchubert/paleomix,MikkelSchubert/paleomix,MikkelSchubert/paleomix | examples/nature_protocols/phylogeny/summarize_heterozygosity.py | examples/nature_protocols/phylogeny/summarize_heterozygosity.py | #!/usr/bin/python
#
# Copyright (c) 2012 Mikkel Schubert <MSchubert@snm.ku.dk>
#
# 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
#... | mit | Python | |
4c5e4cb960a266482dac21eaeb0b568359c58b39 | Add py-backcall (#8701) | krafczyk/spack,iulian787/spack,mfherbst/spack,LLNL/spack,iulian787/spack,krafczyk/spack,krafczyk/spack,LLNL/spack,mfherbst/spack,iulian787/spack,mfherbst/spack,LLNL/spack,krafczyk/spack,mfherbst/spack,LLNL/spack,krafczyk/spack,mfherbst/spack,iulian787/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/py-backcall/package.py | var/spack/repos/builtin/packages/py-backcall/package.py | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
7975ef9f34cc578de968e1a1c8e6f731c164641a | Create 1.5_countstrings.py | HeyIamJames/CodingInterviewPractice,HeyIamJames/CodingInterviewPractice | CrackingCodingInterview/1.5_countstrings.py | CrackingCodingInterview/1.5_countstrings.py | """
given a string, return a string counting all the occurences
of each character if the count > 1
"""
def compress(string_to_compress):
if len(string_to_compress) < 2
return string_to_compress
groups = []
previous_character = string_to_compress[0]
counter = 1
for c in string_to_compres... | mit | Python | |
c89cce1a47c1e379958d7cced624ec0317cd3407 | Add demo for non-blocking with poll(). | easies/xmpp2 | examples/demo3.py | examples/demo3.py | import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
import logging
import threading
import xmpp2
import time
import select
from xmpp2 import XML
# non-blocking, poll example.
USERNAME = 'yourusername'
PASSWORD = 'yourpassword'
SERVER = 'example.com'
logging.basicConfig(level=logging... | mit | Python | |
bb1ce480184d4e78f121f9e473e58f47b80de53a | Create FirstLinuxFile.py | diejia/python-study | FirstLinuxFile.py | FirstLinuxFile.py | #!/usr/bin
| unlicense | Python | |
be5db45702c01aadb5ac323cbb6b0ef53c5d1d4c | add mobility/debug.py | melon-li/netem,melon-li/netem | mobility/debug.py | mobility/debug.py | #!/usr/bin/python
#coding:utf-8
import numpy as np
import math
import sys
import os
import time
import matplotlib.pyplot as plt
from pprint import pprint
import matplotlib.animation as animation
import cPickle as pickle
from copy import deepcopy
def load_coordiantes(file_path):
with open(file_path, 'rb') as... | apache-2.0 | Python | |
f724f5b488f23a6ceb2314aa18933b5fac3f5aab | Add courseware migration. | edx-solutions/edx-platform,cpennington/edx-platform,edx/edx-platform,eduNEXT/edx-platform,eduNEXT/edx-platform,angelapper/edx-platform,msegado/edx-platform,cpennington/edx-platform,mitocw/edx-platform,edx/edx-platform,stvstnfrd/edx-platform,msegado/edx-platform,angelapper/edx-platform,eduNEXT/edx-platform,EDUlib/edx-pl... | lms/djangoapps/courseware/migrations/0013_auto_20191001_1858.py | lms/djangoapps/courseware/migrations/0013_auto_20191001_1858.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.25 on 2019-10-01 18:58
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('courseware', '0012_adjust_fields'),
]
operations = [
migrations.AlterModelOptions(... | agpl-3.0 | Python | |
1e65555a08ff3ee1a06e92d9dd054abf3cfaf711 | Add a migration to update to final tree fields | samluescher/django-media-tree,samluescher/django-media-tree,samluescher/django-media-tree | media_tree/migrations/0003_alter_tree_fields.py | media_tree/migrations/0003_alter_tree_fields.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('media_tree', '0002_mptt_to_treebeard'),
]
operations = [
migrations.AlterField(
model_name='filenode',
... | bsd-3-clause | Python | |
fb5f6bf999b2cd8b674bc2c89f74f1413fc8ee1e | Add command line interface to play | rickerbh/tictactoe_py | command_line_tic_tac_toe.py | command_line_tic_tac_toe.py | #!/usr/bin/env python3
import cmd
from tictactoe.ai_player import AIPlayer
from tictactoe.human_player import HumanPlayer
from tictactoe.game_controller import GameController
from tictactoe.board_stringification import BoardStringification
class CommandLineTicTacToe(cmd.Cmd):
def __init__(self,
i... | mit | Python | |
f91db461b5745689ed356dd740ed7ff3b27524e4 | Add page base classes | matthiask/feincms3,matthiask/feincms3,matthiask/feincms3 | feincms3/pages.py | feincms3/pages.py | from __future__ import unicode_literals
from django.core.urlresolvers import reverse
from django.core.validators import RegexValidator
from django.db import models
from django.db.models import signals
from django.dispatch import receiver
from django.utils.encoding import python_2_unicode_compatible
from django.utils.t... | bsd-3-clause | Python | |
6d59e6d37d6f33f3513a1c6b1cb7d0d9062f391e | Create ClassesandInstances.py | madhurilalitha/Python-Projects | EmployeeManagementSystem/Findings/ClassesandInstances.py | EmployeeManagementSystem/Findings/ClassesandInstances.py | #Creating and instantiating python classes
#classes - they allow us to logically group data(attributes) and functions (methods)
'''class Employee:
pass
print ("Class (Blueprint) vs Instance")
emp1 = Employee()
emp2 = Employee()
print (emp1)
print (emp2)
print ("instance variables contains data unique to each insta... | mit | Python | |
86618e2e30aa4a129041bd2b6b8c312b00de9ce5 | use separate modules for netlink | tijko/shadow,tijko/shadow | shadow/netlink.py | shadow/netlink.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import struct
import os
# Flag values
NLM_F_REQUEST = 1
NLM_F_MULTI = 2
NLM_F_ACK = 4
NLM_F_ECHO = 8
NLM_F_DUMP_INTR = 16
# Modifiers to GET request
NLM_F_ROOT = 0x100
NLM_F_MATCH = 0x200
NLM_F_ATOMIC = 0x400
NLM_F_DUMP = (NLM_F_ROOT | ... | mit | Python | |
ec22c2d82ff4f045b992014d17ada850359c2ab6 | change folder layout | abhishek-sehgal954/SVG_Digital_Halftoning | patterning_algorithm/color_halftone.py | patterning_algorithm/color_halftone.py | # This program takes a raster color image and produces its raster color halftone using patterning algorithm .
# Split the image into C, M, Y, K.
# Rotate each separated image by 0, 15, 30, and 45 degrees respectively.
# Take the half-tone of each image (dot size will be proportional to the intensity).
# Rotate back eac... | mit | Python | |
eced1499c4b82ce83f954a0364b02f2116a11326 | Add quick verification checker. | danluu/BitFunnel,BitFunnel/BitFunnel,BitFunnel/BitFunnel,danluu/BitFunnel,danluu/BitFunnel,danluu/BitFunnel,BitFunnel/BitFunnel,BitFunnel/BitFunnel,danluu/BitFunnel,danluu/BitFunnel,BitFunnel/BitFunnel,BitFunnel/BitFunnel | src/Scripts/verify.py | src/Scripts/verify.py | # Take a ground truth file produced by the verifier and a match file and compare them.
# Output is in fully normalized format, the same as VerifyCommand.cpp produces.
#
# TODO: remove hardcoded paths.
# file format:
# term,docId,[0-3]
# 0: true positive
# 1: false postive
# 2: false negative
# 3: unverified
from col... | mit | Python | |
d16d66e520c5f80870957c63694708118d6f9f69 | Add module for MOC (music on console) | ncoop/i3pystatus,yang-ling/i3pystatus,m45t3r/i3pystatus,fmarchenko/i3pystatus,drwahl/i3pystatus,richese/i3pystatus,schroeji/i3pystatus,Arvedui/i3pystatus,richese/i3pystatus,schroeji/i3pystatus,facetoe/i3pystatus,teto/i3pystatus,drwahl/i3pystatus,enkore/i3pystatus,m45t3r/i3pystatus,teto/i3pystatus,ncoop/i3pystatus,facet... | i3pystatus/moc.py | i3pystatus/moc.py | import re
from i3pystatus import IntervalModule
from i3pystatus import formatp
from i3pystatus.core.command import run_through_shell
from i3pystatus.core.util import TimeWrapper
class Moc(IntervalModule):
"""
Display various information from MOC (musci on console)
.. rubric:: Available formatters
*... | mit | Python | |
b1ef133904540b7f49e22ac52a0f844963be829e | Add basic test for discovery loader | ojengwa/nose2,ezigman/nose2,little-dude/nose2,ojengwa/nose2,leth/nose2,ptthiem/nose2,ptthiem/nose2,little-dude/nose2,leth/nose2,ezigman/nose2 | nose2/tests/functional/test_discovery_loader.py | nose2/tests/functional/test_discovery_loader.py | from nose2.tests._common import FunctionalTestCase, support_file
from nose2 import events, loader, session
from nose2.plugins.loader.discovery import DiscoveryLoader
class Watcher(events.Plugin):
def __init__(self):
self.called = []
def loadTestsFromModule(self, event):
self.called.append(eve... | bsd-2-clause | Python | |
2de3ab69c0725312663ecd94378c5b267a6c5ab1 | Add graph_data.py with a graph_ratings function | jvanbrug/netflix,jvanbrug/netflix | graph_data.py | graph_data.py | """Graph properties and patterns of the raw data
.. moduleauthor:: Jan Van Bruggen <jancvanbruggen@gmail.com>
"""
import matplotlib.pyplot as plt
def graph_ratings():
num_points = 1e5
ratings = rating_counts('data/mu/all.dta', num_points)
rating_numbers = sorted(ratings.keys())
x = [i - 0.4 for i in ... | mit | Python | |
7a861623987225bd786301dfe6dea78173ddaf1a | Create generator.py | wolfdale/Hadoop-BDA,wolfdale/Hadoop-BDA | Testing_Hadoop/generator.py | Testing_Hadoop/generator.py | import time
start_time = time.time()
fo = open("hadoop_test_data.txt", "wb")
for i in range(0,9):
for i in range(0,10000000):
fo.write("Hadoop ");
fo.close()
print("--- %s seconds ---" % (time.time() - start_time))
| mit | Python | |
963aa3fd9830d1a4817a26a2e8a5676174e30d19 | Add new migration | jwarren116/RoadTrip,jwarren116/RoadTrip,jwarren116/RoadTrip | planner/migrations/0005_auto_20150711_1117.py | planner/migrations/0005_auto_20150711_1117.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('planner', '0004_auto_20150616_1926'),
]
operations = [
migrations.RenameField(
model_name='route',
o... | apache-2.0 | Python | |
ea9b6920c88ac40a72aadd70199a52f27a1c097e | Create RespostaListar.py | AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb,AEDA-Solutions/matweb | backend/Models/Predio/RespostaListar.py | backend/Models/Predio/RespostaListar.py | from Framework.Resposta import Resposta
from Models.Predio.Predio import Predio as ModelPredio
class RespostaListar(Resposta):
def __init__(self,predios):
self.corpo = []
for predio in predios:
self.corpo.append(ModelPredio(predio))
| mit | Python | |
87804aef17874339e7b58df0c3bcb29338fa412a | add country regions include Minsk | opendataby/osm-geodata | belarus_region_borders_include_minsk.py | belarus_region_borders_include_minsk.py | from _helpers import cursor_wrap, dump
@cursor_wrap
def main(cursor):
sql = """
SELECT r.osm_id, c.name AS country, r.name AS region, ST_AsGeoJSON(r.way)
FROM osm_polygon c
LEFT JOIN osm_polygon r ON ST_Contains(c.way, r.way)
WHERE c.osm_id = -59065 AND r.admin_level = '4'
... | mit | Python | |
b5bc7827fb2452e82789129b918861157010c58e | Create pokebot.py | LukeBob/teamspeak-tools | pokebot.py | pokebot.py | #!/usr/bin/python3
#
# Author: Luke
import time, ts3, sys, traceback
USER = 'serveradmin' # Query user
PASS = '' # Query Password
HOST = 'localhost' # Query Server-host
PORT = '10011' # Query Server-Port
SID = 1 # Serveradmin sid (dont touch)
def usage():
print ('\n./Poke-bot.py <... | mit | Python | |
4f87a0e144bf738e523cd1f8d914f39090275fee | add review status to individuals | ssadedin/seqr,macarthur-lab/seqr,macarthur-lab/xbrowse,macarthur-lab/seqr,macarthur-lab/seqr,ssadedin/seqr,macarthur-lab/seqr,macarthur-lab/xbrowse,ssadedin/seqr,macarthur-lab/xbrowse,macarthur-lab/xbrowse,macarthur-lab/xbrowse,macarthur-lab/xbrowse,ssadedin/seqr,ssadedin/seqr,macarthur-lab/seqr | xbrowse_server/base/migrations/0008_individual_review_status.py | xbrowse_server/base/migrations/0008_individual_review_status.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-10-05 09:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('base', '0007_auto_20160826_1327'),
]
operations = [
migrations.AddField(
... | agpl-3.0 | Python | |
34bc4b9e5731c94ae4655deb338d67aa3f9a1f63 | Create project.py | eddie-jeon/empty-app | project.py | project.py | from ggame import App, RectangleAsset, ImageAsset, SoundAsset, Sprite, Sound
from ggame import LineStyle, Color
SCREEN_WIDTH = 640
SCREEN_HEIGHT = 480
green = Color(0x00ff00, 1)
black = Color(0, 1)
noline = LineStyle(0, black)
bg_asset = RectangleAsset(SCREEN_WIDTH, SCREEN_HEIGHT, noline, green)
bg = Sprite(bg_asset,... | mit | Python | |
080df88609ac25eff0b4379e31acb63654d3314c | Create randfor.py | FelBalazard/Prediction-with-Haplotypes,FelBalazard/Prediction-with-Haplotypes,FelBalazard/Prediction-with-Haplotypes | randfor.py | randfor.py | #!/usr/bin/env python
#This script performs randomforests on the blocks for the three variation of the method.
import sys
blocn=sys.argv[1]
min_samples_leaf=int(sys.argv[2])
import math
#The function evi for evidence is meant to make the result homogeneous to
#logistic regression. The if loop avoids having any infini... | mit | Python | |
681cc0a4160373fe82de59946b52e0e21611af84 | Print out all links on a page | NilanjanaLodh/PyScripts,NilanjanaLodh/PyScripts | linkLister.py | linkLister.py | import requests
import re
url = raw_input("Enter URL with http or https prefix : " )
print url
website= requests.get(url)
html = website.text
print html
linklist = re.findall('"((http|ftp)s?://.*?)"',html)
print linklist
for link in linklist:
print link[0]
| mit | Python | |
51f8b228ff1096769a06b47d026e81a166503a82 | add missing unit tests for previous commit | Bismarrck/pymatgen,ctoher/pymatgen,rousseab/pymatgen,ctoher/pymatgen,ctoher/pymatgen,yanikou19/pymatgen,sonium0/pymatgen,Bismarrck/pymatgen,rousseab/pymatgen,rousseab/pymatgen,migueldiascosta/pymatgen,Dioptas/pymatgen,migueldiascosta/pymatgen,sonium0/pymatgen,Bismarrck/pymatgen,yanikou19/pymatgen,Bismarrck/pymatgen,Bis... | pymatgen/util/tests/test_decorators.py | pymatgen/util/tests/test_decorators.py | import unittest
from pymatgen.util.decorators import lru_cache
class TestLRUCache(unittest.TestCase):
def test_function(self):
@lru_cache(2)
def cached_func(a, b):
return a + b
#call a few times to get some stats
self.assertEqual(cached_func(1, 2), 3)
self.asse... | mit | Python | |
3554160654a1cb8e7000ebeea06aecdabc91af8e | Create JustPremium.py | vuolter/pyload,vuolter/pyload,vuolter/pyload | module/plugins/hooks/JustPremium.py | module/plugins/hooks/JustPremium.py | # -*- coding: utf-8 -*-
"""
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 version.
This program is distributed in ... | agpl-3.0 | Python | |
61a6f6468462ed5db6c8e6c55bf29f0c503ff899 | add solution for H-Index | zhyu/leetcode,zhyu/leetcode | algorithms/hIndex/hIndex.py | algorithms/hIndex/hIndex.py | class Solution(object):
def hIndex(self, citations):
"""
:type citations: List[int]
:rtype: int
"""
n = len(citations)
c = collections.Counter([min(x, n) for x in citations])
s = reduce(lambda a, x: a + [a[-1] + c[x]], reversed(range(n)), [c[n]])
retur... | mit | Python | |
c2f0f5184665250949c32d16db0b521c357e3aa7 | Add solution to linkedListCycle problem. | TheGhostHuCodes/leetCode | python/src/linkedListCycle/linkedListCycle.py | python/src/linkedListCycle/linkedListCycle.py | # Given a linked list, determine if it has a cycle in it.
# Follow up:
# Can you solve it without using extra space?
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
# @param head, a ListNode
# @return a boolean
... | mit | Python | |
2ab5d0bfdfe90279f3fffeeb51882cdbcb4e9135 | test genesis tests | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/unit/modules/genesis_test.py | tests/unit/modules/genesis_test.py | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Rupesh Tare <rupesht@saltstack.com>`
'''
# Import Salt Testing Libs
from salttesting import TestCase, skipIf
from salttesting.mock import (
MagicMock,
patch,
NO_MOCK,
NO_MOCK_REASON
)
# Import Salt Libs
from salt.modules import genesis
# Globals
g... | apache-2.0 | Python | |
4ec7abe5df2bdd4a68528fc9af14288b57fd72cc | add integration utest on Session | anybox/anybox.recipe.odoo | tests_with_openerp/test_session.py | tests_with_openerp/test_session.py | from unittest import TestCase
from anybox.recipe.odoo.runtime.session import Session
from openerp.tests.common import get_db_name
class SessionTestCase(TestCase):
def setUp(self):
super(SessionTestCase, self).setUp()
self.session = Session(None, None, parse_config=False)
def open_session(sel... | agpl-3.0 | Python | |
da1bda146b4762bc572cb28da30cfb09b1d083aa | add hikvision (#243) | balloob/netdisco | netdisco/discoverables/hikvision.py | netdisco/discoverables/hikvision.py | """Discover Hikvision cameras."""
from . import MDNSDiscoverable
class Discoverable(MDNSDiscoverable):
"""Add support for discovering Hikvision cameras."""
def __init__(self, nd):
"""Initialize Hikvision camera discovery."""
super(Discoverable, self).__init__(nd, '_http._tcp.local.')
def... | mit | Python | |
f7b2b511bd6cca122782b39c9eb75ed4a4736717 | add benchmark | daxlab/Play-Store-API,daxlab/Play-Store-API | test/benchmark.py | test/benchmark.py | import urllib2
import json
url = "http://localhost:3000/api?package=com.whatsapp"
for i in range(5):
print 'Downloading '+ str(i)
res = urllib2.urlopen(url).read()
file = "data-"+str(i)+".json"
with open(file, 'w') as outfile:
json.dump(res, outfile)
| mit | Python | |
27622185e04bb652284597783287262e23bafa7d | Add minimal test case (failing) | evernym/zeno,evernym/plenum | plenum/test/node_request/test_apply_stashed_partially_ordered.py | plenum/test/node_request/test_apply_stashed_partially_ordered.py | import pytest
from plenum.common.constants import DOMAIN_LEDGER_ID
from plenum.common.startable import Mode
from plenum.common.txn_util import reqToTxn
from plenum.test.delayers import cDelay
from plenum.test.helper import sdk_get_and_check_replies, sdk_send_random_requests, logger
from plenum.test.node_catchup.helper... | apache-2.0 | Python | |
95da7f3b6c03d3d8e711aea4195017a17cb63d5f | Add another version of write libsvm data format. | Wayne82/libsvm-practice,Wayne82/libsvm-practice,Wayne82/libsvm-practice | scripts/python/write_libsvm_data_format_v2.py | scripts/python/write_libsvm_data_format_v2.py | """
A script to write out lib svm expected data format from my collecting data
"""
import os
import sys
import csv
import json
import getopt
import subprocess
CMD_USAGE = """
usage: write_libsvm_data_format.py --inputs="/inputs/folder/" --output="/output/lib_svm_data" <options>
<options>:
-f, --fe... | bsd-3-clause | Python | |
cc7eb329a7d132947861ca1f2d4713cba1e4274a | Add tests! | mplewis/iverilog-netlist-processing | test_processor.py | test_processor.py | from ivl_enums import IvlElabType, IvlPortType, IvlDataDirection
from parsers import parse_modules_and_elabs
from utils import IvlNetManager
import pytest
import sure # noqa
@pytest.yield_fixture
def read_netlist():
# Read a netlist and parse it into modules and elabs.
# Create a new net manager.
with o... | mit | Python | |
823d10795b22b751647e79e77eecd381cf7a809d | create test file | mkolodny/3taps | test_threetaps.py | test_threetaps.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for threetaps."""
import unittest
if __name__ == '__main__':
unittest.main()
| mit | Python | |
f9fd2e3dcc4c25fd7561f8898e3845992553a8a8 | add wrapper script to launch tests | paradoxon82/qdjango,ericLemanissier/qdjango,ericLemanissier/qdjango,paradoxon82/qdjango,ericLemanissier/qdjango,jlaine/qdjango,jlaine/qdjango,paradoxon82/qdjango,paradoxon82/qdjango,jlaine/qdjango,jlaine/qdjango,ericLemanissier/qdjango,ericLemanissier/qdjango,jlaine/qdjango,paradoxon82/qdjango | tests/run.py | tests/run.py | #!/usr/bin/python
import os
root = os.path.join(os.path.dirname(__file__), '..')
prog = os.path.join(os.path.dirname(__file__), 'qdjango-tests')
path = []
for component in ['db', 'http', 'script']:
path.append(os.path.join(root, 'src', component))
os.system("LD_LIBRARY_PATH=%s %s" % (':'.join(path), prog))
| lgpl-2.1 | Python | |
e8a6c0adc3aa77f8e0b1399fe076b43720acb823 | Test the API can run | antoinearnoud/openfisca-france,antoinearnoud/openfisca-france,sgmap/openfisca-france,sgmap/openfisca-france | tests/test_api.py | tests/test_api.py | # -*- coding: utf-8 -*-
import subprocess
import requests
from unittest import TestCase
from nose.tools import assert_equal
class Test(TestCase):
def setUp(self):
self.process = subprocess.Popen("openfisca-serve")
def tearDown(self):
self.process.terminate()
def test_response(self):
... | agpl-3.0 | Python | |
690c08b2b35df2d81dc0977d8bd593c45806e1c2 | Add dumb log view test cases | bosondata/badwolf,bosondata/badwolf,bosondata/badwolf | tests/test_log.py | tests/test_log.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from flask import url_for
def test_view_build_log(test_client):
test_client.get(url_for('log.build_log', sha='123456'))
def test_view_lint_log(test_client):
test_client.get(url_for('log.lint_log', sha='123456'))
| mit | Python | |
4d500d9abe2da28cdd9bd95019048de445aac265 | Add a history demo in documentation. | tantale/deprecated | docs/source/tutorial/v5/history_demo.py | docs/source/tutorial/v5/history_demo.py | # coding: utf-8
from deprecated.history import deprecated
from deprecated.history import versionadded
from deprecated.history import versionchanged
@deprecated(
reason="""
This is deprecated, really. So you need to use another function.
But I don\'t know which one.
- The first,
- The se... | mit | Python | |
361333f8b214097469389d0219f339fc59ea469b | Add permissions.py | migonzalvar/teamroulette,mfernandezmsistemas/phyton1 | teams/permisssions.py | teams/permisssions.py | from rest_framework.permissions import BasePermission
class IsOwnerPermission(BasePermission):
def has_permission(self, request, view):
return request.user.is_authenticated()
def has_object_permission(self, request, view, obj):
return request.user == obj.owner
| mit | Python | |
20ac8a830ef59abc51afe13ac102521767d47c22 | test uffd bad socket path scenarios | firecracker-microvm/firecracker,firecracker-microvm/firecracker,firecracker-microvm/firecracker,firecracker-microvm/firecracker,firecracker-microvm/firecracker | tests/integration_tests/functional/test_uffd.py | tests/integration_tests/functional/test_uffd.py | # Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Test UFFD related functionality when resuming from snapshot."""
import logging
import os
from framework.artifacts import SnapshotMemBackendType
from framework.builder import MicrovmBuilder, SnapshotBuilde... | apache-2.0 | Python | |
7cb839279bc62b95eb7367814ef71c046d4b2184 | Add 'examples' module which contains some examplary function examples. | mansenfranzen/tssim | tssim/examples.py | tssim/examples.py | """This module contains example time functions"""
import numpy as np
def rand_lin_noise():
beta = np.random.normal()
return lambda x: beta * x + np.random.random(size=len(x))
def const_lin_noise(x):
beta = np.random.normal()
return beta * x + np.random.random(size=len(x))
def random_walk(x):
... | mit | Python | |
c156ad1379d842924b928c6c80f668f9875e840a | Remove page-filter flag. (which is now user-filter) | TheTypoMaster/chromium-crosswalk,Just-D/chromium-1,Chilledheart/chromium,axinging/chromium-crosswalk,Just-D/chromium-1,hgl888/chromium-crosswalk,hgl888/chromium-crosswalk,chuan9/chromium-crosswalk,Chilledheart/chromium,Chilledheart/chromium,chuan9/chromium-crosswalk,Pluto-tv/chromium-crosswalk,Pluto-tv/chromium-crosswa... | tools/telemetry/telemetry/story/story_filter.py | tools/telemetry/telemetry/story/story_filter.py | # Copyright 2013 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 optparse
import re
from telemetry.internal.util import command_line
class _StoryMatcher(object):
def __init__(self, pattern):
self._regex = N... | # Copyright 2013 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 optparse
import re
from telemetry.internal.util import command_line
class _StoryMatcher(object):
def __init__(self, pattern):
self._regex = N... | bsd-3-clause | Python |
c39c086f51963678769c1066637ca573c721e827 | Create a simple static gallery script. | strickyak/aphid,strickyak/aphid,strickyak/aphid,strickyak/aphid,strickyak/aphid,strickyak/aphid,strickyak/aphid | static_gallery.py | static_gallery.py | from . import flag
#from go import html
from go import os
from go import path/filepath
def ReadAlbumDirs(input_dir):
f = os.Open(input_dir)
with defer f.Close():
names = f.Readdirnames(-1)
for name in names:
stat = os.Stat(filepath.Join(input_dir, name))
if stat.IsDir():
yield name
def... | mit | Python | |
f083789e5615d15715f49a7dbdb25505aa5efae2 | Initialize P1_assignChores | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter16/PracticeProjects/P1_assignChores.py | books/AutomateTheBoringStuffWithPython/Chapter16/PracticeProjects/P1_assignChores.py | # Write a program that takes a list of people’s email addresses and a list of chores
# that need to be done and randomly assigns chores to people. Email each person their
# assigned chores.
#
# If you’re feeling ambitious, keep a record of each person’s previously assigned
# chores so that you can make sure the program... | mit | Python | |
54a9b637aad85a20f3e865185ffed0abfd4192cd | Create tutorial4.py | danielwilson2017/ggame-tutorials | tutorial4.py | tutorial4.py | from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame
SCREEN_WIDTH = 640
SCREEN_HEIGHT = 480
class SpaceShip(Sprite):
"""
Animated space ship
"""
asset = ImageAsset("images/four_spaceship_by_albertov_with_thrust.png",
Frame(227,0,292-227,125), 4, 'vertical')
... | mit | Python | |
8d1ef1f33cc6f10a58cdeacc0fd840dea245e7a6 | Create typecheck.py with all the code | jacopofar/runtime_typecheck | typecheck.py | typecheck.py | #!/usr/bin/env python3
from typing import (Union,
Tuple,
Any,
TypeVar,
Type,
List)
def check_type(obj, candidate_type, reltype='invariant') -> bool:
if reltype not in ['invariant', 'covariant', 'contravariant']:
... | mit | Python | |
1a9302d984e8fd0e467a04c87428b64d874e5f04 | refactor customerWallet | Go-In/go-coup,Go-In/go-coup,Go-In/go-coup,Go-In/go-coup,Go-In/go-coup | usermanage/views/customerWallet.py | usermanage/views/customerWallet.py | from django.shortcuts import render, redirect
from django.http import HttpResponseRedirect
from django.contrib.auth import login, authenticate, logout
from django.contrib.auth.models import User, Group
from django.contrib.auth.decorators import login_required, user_passes_test, permission_required
from django.contrib.a... | mit | Python | |
b9f28570ba619db5adacb05a7eadab77f140e876 | Create __init__.py | Kalimaha/fake_data_crud_service | fake_data_crud_service/rest/__init__.py | fake_data_crud_service/rest/__init__.py | __package__ = 'rest'
__author__ = 'Barbaglia, Guido'
__email__ = 'guido.barbaglia@gmail.com;'
__license__ = 'MIT'
| mit | Python | |
192e60955051f8ffb34f6cc1f1e3f226acb1b5fb | add missing primary key constraints (#7129) | pypa/warehouse,pypa/warehouse,pypa/warehouse,pypa/warehouse | warehouse/migrations/versions/b5bb5d08543d_create_missing_primary_key_constraints.py | warehouse/migrations/versions/b5bb5d08543d_create_missing_primary_key_constraints.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
# distributed under the Li... | apache-2.0 | Python | |
a3d3040f16a604b534406d2f59a841d7ef6cebfa | Test HTTPMediaWikiAPI.get_content() | Lodifice/mfnf-pdf-export,Lodifice/mfnf-pdf-export,Lodifice/mfnf-pdf-export | tests/test_api.py | tests/test_api.py | import requests
from unittest import TestCase
from mfnf.api import HTTPMediaWikiAPI
class TestHTTPMediaWikiAPI(TestCase):
def setUp(self):
self.api = HTTPMediaWikiAPI(requests.Session())
def test_get_content(self):
content = self.api.get_content("Mathe für Nicht-Freaks: Epsilon-Delta-Kriteri... | apache-2.0 | Python | |
8139dc9e04025da001323122521951f5ed2c391b | Fix mysql encoding for users.profile.reason | sbuss/voteswap,sbuss/voteswap,sbuss/voteswap,sbuss/voteswap | users/migrations/0010_users-profile-encoding.py | users/migrations/0010_users-profile-encoding.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-09-25 01:43
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0009_remove_profile_active'),
]
operations = [
migrations.RunSQL("ALTER DAT... | mit | Python | |
328901c74d1ee103a1ee5b2f26aa391ddeda465b | Add unit test for webpage creation and description | appeltel/AutoCMS,appeltel/AutoCMS,appeltel/AutoCMS | tests/test_web.py | tests/test_web.py | """Test the AutoCMS web reporting functionality."""
import os
import shutil
import unittest
import re
from autocms.core import load_configuration
from autocms.web import (
produce_default_webpage
)
class TestWebPageCreation(unittest.TestCase):
"""Test the accurate creation of test webpages."""
def setU... | mit | Python | |
e6b086f3baef34cf1e5278e930a034a92f4eee76 | Add test for DirectionalGridCRF | wattlebird/pystruct,amueller/pystruct,massmutual/pystruct,d-mittal/pystruct,massmutual/pystruct,pystruct/pystruct,wattlebird/pystruct,d-mittal/pystruct,amueller/pystruct,pystruct/pystruct | tests/test_directional_crf.py | tests/test_directional_crf.py | import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
#from nose.tools import assert_almost_equal
import pystruct.toy_datasets as toy
from pystruct.lp_new import lp_general_graph
from pystruct.inference_methods import _make_grid_edges
from pystruct.crf import DirectionalGridCRF
... | bsd-2-clause | Python | |
439e4b740f6903341e81e158e6591c9cbd242a4c | Check in a tool that dumps graphviz output. | csulmone/gyp,csulmone/gyp,csulmone/gyp,csulmone/gyp | tools/graphviz.py | tools/graphviz.py | #!/usr/bin/python
# Copyright (c) 2011 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Using the JSON dumped by the dump-dependency-json generator,
generate input suitable for graphviz to render a dependency graph of
targets."""... | bsd-3-clause | Python | |
80d9a407d76f11573af5ccb6783f837b939b5466 | Add Python benchmark | stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib | lib/node_modules/@stdlib/math/base/special/erfinv/benchmark/python/benchmark.scipy.py | lib/node_modules/@stdlib/math/base/special/erfinv/benchmark/python/benchmark.scipy.py | #!/usr/bin/env python
"""Benchmark scipy.special.erfinv."""
import timeit
name = "erfinv"
repeats = 3
iterations = 1000000
def print_version():
"""Print the TAP version."""
print("TAP version 13")
def print_summary(total, passing):
"""Print the benchmark summary.
# Arguments
* `total`: tota... | apache-2.0 | Python | |
3133bbfcb5ee56c88ea20be21778519bffe77299 | Add another different type of book | palfrey/book-blog | literotica.py | literotica.py | from common import *
from sys import argv
from urlgrab import Cache
from re import compile, DOTALL, MULTILINE
cache = Cache()
url = argv[1]
titlePattern = compile("<h1>([^<]+)</h1>")
contentPattern = compile("<div class=\"b-story-body-x x-r15\">(.+?)</div><div class=\"b-story-stats-block\">" , DOTALL|MULTILINE)
nextP... | agpl-3.0 | Python | |
f31d6730a0cfbc50c55e9260391f399e77c3d631 | access the repository from console | vipints/genomeutils,vipints/genomeutils,vipints/genomeutils | utils/__init__.py | utils/__init__.py | __version__="0.1"
| bsd-3-clause | Python | |
893679baff0367538bdf3b52b04f8bae72732be8 | Add migration to remove system avatar source. | sharmaeklavya2/zulip,isht3/zulip,joyhchen/zulip,susansls/zulip,zulip/zulip,punchagan/zulip,blaze225/zulip,PhilSk/zulip,samatdav/zulip,hackerkid/zulip,christi3k/zulip,brainwane/zulip,mahim97/zulip,kou/zulip,jackrzhang/zulip,amyliu345/zulip,paxapy/zulip,niftynei/zulip,samatdav/zulip,vikas-parashar/zulip,shubhamdhama/zuli... | zerver/migrations/0031_remove_system_avatar_source.py | zerver/migrations/0031_remove_system_avatar_source.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('zerver', '0030_realm_org_type'),
]
operations = [
migrations.AlterField(
model_name='userprofile',
n... | apache-2.0 | Python | |
ff89cda5f77bec569c7451c9ee72ef7c028f7552 | Add sample extraction script | lisongze/SForecast,lisongze/SForecast,lisongze/SForecast,lisongze/SForecast | extract_samples.py | extract_samples.py | import sys, os
import numpy as np
import pandas as pd
import datetime
if __name__ == '__main__':
infile = sys.argv[1]
csv_content = pd.read_csv(infile, [0])
| mit | Python | |
73f47cc6a8a98b2026ee27985f8c3042352c941b | Add lc066_plus_one.py | bowen0701/algorithms_data_structures | lc066_plus_one.py | lc066_plus_one.py | """Leetcode 66. Plus One
Easy
URL: https://leetcode.com/problems/plus-one/
Given a non-empty array of digits representing a non-negative integer,
plus one to the integer.
The digits are stored such that the most significant digit is at the
head of the list, and each element in the array contain a single digit.
Yo... | bsd-2-clause | Python | |
a620cc46d97f80ef658c46130f0448c36844d847 | Add alembic revision | HERA-Team/hera_mc,HERA-Team/Monitor_and_Control,HERA-Team/hera_mc | alembic/versions/63b625cf7b06_add_white_rabbit_status.py | alembic/versions/63b625cf7b06_add_white_rabbit_status.py | """add white rabbit status
Revision ID: 63b625cf7b06
Revises: e83aa47e530b
Create Date: 2019-12-06 02:45:01.418693+00:00
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '63b625cf7b06'
down_revision = 'e83aa47e530b'
branch_labels = None
depends_on = None
def u... | bsd-2-clause | Python | |
b51398d602a157ce55fd7e08eedd953051f716a1 | Add script to update uploaded files. | materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org | backend/scripts/updatedf.py | backend/scripts/updatedf.py | #!/usr/bin/env python
#import hashlib
import os
def main():
for root, dirs, files in os.walk("/mcfs/data/materialscommons"):
for f in files:
print f
if __name__ == "__main__":
main()
| mit | Python | |
ba3582d1e4521c040ef9f43c3a4760eb4fd694da | add lib/config_loader.py | izakp/hokusai | hokusai/lib/config_loader.py | hokusai/lib/config_loader.py | import os
import tempfile
import shutil
from urlparse import urlparse
import boto3
import yaml
from hokusai.lib.common import get_region_name
from hokusai.lib.exceptions import HokusaiError
class ConfigLoader
def __init__(self, uri):
self.uri = uri
def load(self):
uri = urlparse(self.uri)
if not ur... | mit | Python | |
21e766688e3cc4d08339f81c35dba43d26010a6d | edit vehicle form | jclgoodwin/bustimes.org.uk,jclgoodwin/bustimes.org.uk,jclgoodwin/bustimes.org.uk,jclgoodwin/bustimes.org.uk | vehicles/forms.py | vehicles/forms.py | from django import forms
class EditVehicleForm(forms.Form):
fleet_number = forms.CharField(label='Fleet number', required=False)
reg = forms.CharField(label='Registration', required=False)
vehicle_type = forms.CharField(label='Type', required=False)
colours = forms.CharField(label='Colours', required=... | mpl-2.0 | Python | |
fbf36a2fb52b5ed1aceaec4c1d1075448584a97d | Test that modules can be imported in any order | lektor/lektor,lektor/lektor,lektor/lektor,lektor/lektor | tests/test_imports.py | tests/test_imports.py | """Test that all modules/packages in the lektor tree are importable in any order
Here we import each module by itself, one at a time, each in a new
python interpreter.
"""
import pkgutil
import sys
from subprocess import run
import pytest
import lektor
def iter_lektor_modules():
for module in pkgutil.walk_pac... | bsd-3-clause | Python | |
e3bdccc8c7ef23b449a53043f4a048fe71cd642c | Use an explicit list due to the filter-object type of python3 | dulaccc/django-accounting,kenjhim/django-accounting,dulaccc/django-accounting,dulaccc/django-accounting,dulaccc/django-accounting,kenjhim/django-accounting,kenjhim/django-accounting,kenjhim/django-accounting | accounting/apps/connect/views.py | accounting/apps/connect/views.py | from django.views import generic
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from accounting.apps.books.models import Organization
from .steps import (
CreateOrganizationStep,
ConfigureTaxRatesStep,
ConfigureBusinessSettingsStep,
ConfigureFinancialSettingsS... | from django.views import generic
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from accounting.apps.books.models import Organization
from .steps import (
CreateOrganizationStep,
ConfigureTaxRatesStep,
ConfigureBusinessSettingsStep,
ConfigureFinancialSettingsS... | mit | Python |
b7fff47b228fbe8774c9f465c383ae1015c598fe | use cvmfs.py for openRootCatalog.py | DrDaveD/cvmfs,alhowaidi/cvmfsNDN,trshaffer/cvmfs,DrDaveD/cvmfs,trshaffer/cvmfs,alhowaidi/cvmfsNDN,Moliholy/cvmfs,alhowaidi/cvmfsNDN,MicBrain/cvmfs,djw8605/cvmfs,MicBrain/cvmfs,reneme/cvmfs,Gangbiao/cvmfs,cvmfs-testing/cvmfs,djw8605/cvmfs,alhowaidi/cvmfsNDN,MicBrain/cvmfs,Gangbiao/cvmfs,cvmfs-testing/cvmfs,cvmfs/cvmfs,a... | add-ons/tools/openRootCatalog.py | add-ons/tools/openRootCatalog.py | #!/usr/bin/python
import cvmfs
import sys
def usage():
print sys.argv[0] + " <repository path | repository url>"
print "This script decompresses the root catalog file to a temporary storage"
print "and opens this directly with sqlite3."
print "WARNING: changes to this database will not persist, as it is only a t... | #!/usr/bin/python
import sys
import zlib
import tempfile
import subprocess
def getRootCatalogName(cvmfspublished):
try:
cvmfspubdata = open(cvmfspublished, 'rb').read()
except:
print "cannot open .cvmfspublished"
sys.exit(1)
lines = cvmfspubdata.split('\n')
if len(lines) < 1:
print ".cvmfspublished is m... | bsd-3-clause | Python |
a8ca46a8d964907038f6c096a316175543bc2518 | add mask_iou test | chainer/chainercv,pfnet/chainercv,yuyu2172/chainercv,chainer/chainercv,yuyu2172/chainercv | tests/utils_tests/mask_tests/test_mask_iou.py | tests/utils_tests/mask_tests/test_mask_iou.py | from __future__ import division
import unittest
import numpy as np
from chainer import cuda
from chainer import testing
from chainer.testing import attr
from chainercv.utils import mask_iou
@testing.parameterize(
{'mask_a': np.array(
[[[False, False], [True, True]],
[[True, True], [False, Fal... | mit | Python | |
a377195fa95b819924ddfbd3fb564cffbe08f9ae | Add an example for solvent model to customize solvent cavity | sunqm/pyscf,sunqm/pyscf,sunqm/pyscf,sunqm/pyscf | examples/solvent/30-custom_solvent_cavity.py | examples/solvent/30-custom_solvent_cavity.py | #!/usr/bin/env python
'''
Custom solvent cavity
'''
import numpy
from pyscf import gto, qmmm, solvent
#
# Case 1. Cavity for dummy atoms with basis on the dummy atoms
#
mol = gto.M(atom='''
C 0.000000 0.000000 -0.542500
O 0.000000 0.000000 0.677500
H 0.000000 0.... | apache-2.0 | Python | |
97ecb8f7dbcb36cfa9e2d180f29d29002eea127e | add elasticsearch import | snowch/biginsight-examples,snowch/biginsight-examples | examples/ElasticsearchIntegrationWithSpark/import_from_elasticsearch.py | examples/ElasticsearchIntegrationWithSpark/import_from_elasticsearch.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | apache-2.0 | Python | |
8b419fefc93f9084b8d504b7382fd51087e4645f | add migration script that removes table 'regressions' | PolyJIT/benchbuild,PolyJIT/benchbuild,PolyJIT/benchbuild,PolyJIT/benchbuild | benchbuild/db/versions/001_Remove_RegressionTest_table.py | benchbuild/db/versions/001_Remove_RegressionTest_table.py | """
Remove unneeded Regressions table.
This table can and should be reintroduced by an experiment that requires it.
"""
from sqlalchemy import Table, Column, ForeignKey, Integer, String
from benchbuild.utils.schema import metadata
META = metadata()
REGRESSION = Table('regressions', META,
Column(
... | mit | Python | |
847232f2890a4700e4983cd971ef2cd1a76a4b1d | rebuild cases | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/cleanup/management/commands/rebuild_cases.py | corehq/apps/cleanup/management/commands/rebuild_cases.py | from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import logging
from django.core.management.base import BaseCommand
from corehq.form_processor.backends.sql.processor import FormProcessorSQL
from corehq.form_processor.models import RebuildWithReason
... | bsd-3-clause | Python | |
0919661333c8099a85e7c12c6ce9393ced8c985b | create the lib directory to hold vendored libraries | imzhulei/ceph-deploy,ddiss/ceph-deploy,jumpstarter-io/ceph-deploy,ceph/ceph-deploy,shenhequnying/ceph-deploy,Vicente-Cheng/ceph-deploy,rtulke/ceph-deploy,ghxandsky/ceph-deploy,alfredodeza/ceph-deploy,branto1/ceph-deploy,ddiss/ceph-deploy,shenhequnying/ceph-deploy,isyippee/ceph-deploy,zhouyuan/ceph-deploy,rtulke/ceph-de... | ceph_deploy/lib/__init__.py | ceph_deploy/lib/__init__.py | """
This module is meant for vendorizing Python libraries. Most libraries will need
to have some ``sys.path`` alterations done unless they are doing relative
imports.
Do **not** add anything to this module that does not represent a vendorized
library.
"""
import remoto
| mit | Python | |
6303ffeee0118a2fef1cb0a9abfe931a04ee6974 | Fix web app. #79 | joebowen/ChannelWorm,openworm/ChannelWorm,joebowen/ChannelWorm,cheelee/ChannelWorm,VahidGh/ChannelWorm,joebowen/ChannelWorm,cheelee/ChannelWorm,cheelee/ChannelWorm,openworm/ChannelWorm,gsarma/ChannelWorm,VahidGh/ChannelWorm,gsarma/ChannelWorm,openworm/ChannelWorm,gsarma/ChannelWorm,joebowen/ChannelWorm,VahidGh/ChannelW... | channelworm/web_app/wsgi.py | channelworm/web_app/wsgi.py | """
WSGI config for myproject project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "web_app.settings")
from django.core.w... | mit | Python | |
e5ed4497fd8aee709dd441cfcddc9a1a91c538d4 | add theilsen | rlowrance/re-local-linear,rlowrance/re-local-linear,rlowrance/re-local-linear | chart-02-theilsen-median-of-root-median-squared-errors.py | chart-02-theilsen-median-of-root-median-squared-errors.py | # create files for chart-02-theilsen-median-of-root-mdian-squared-errors
# with these choices
# metric in median-root-median-squared-errors
# model in theilsen
# ndays in 30 60 ... 360
# predictors in act actlog ct ctlog
# responses in price logprice
# usetax in yes no
# year in 2008
# i... | mit | Python | |
2df737f2690925e2752ae7633f1db05f952209bc | Create led_record.py | H-SG/rpi-camrecord,H-SG/rpi-camrecord | led_record.py | led_record.py | #!/usr/bin/env python
import RPi.GPIO as GPIO
from time import sleep
import os
import subprocess
# Setup getting an image
def get_video(state):
folderName = "/home/pi/HumphreyData/"
if os.path.isdir(folderName)== False:
os.makedirs(folderName)
fileNumber = 1
filePath = folderName + str(fileNumber) + ".h2... | mit | Python | |
f68689e3b6caaad2d143d92af5395f7c12316525 | add simple test file | mattjj/pylds | test.py | test.py | from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
from pybasicbayes.distributions import Gaussian, Regression
from autoregressive.distributions import AutoRegression
from pyhsmm.util.text import progprint_xrange
from models import LDS
np.random.seed(0)
#########################
# s... | mit | Python | |
2e4bb9ca00c992dab0967b3238d8aebd8710d79d | Create controller.py | bit0001/trajectory_tracking,bit0001/trajectory_tracking | src/controller.py | src/controller.py | #!/usr/bin/env python
import rospy
if __name__ == '__main__':
pass
| mit | Python | |
c3748579854ae06c995cb12ea45a1be4de8f827d | Add gallery migration | stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten,stadtgestalten/stadtgestalten | features/galleries/migrations/0003_auto_20170421_1109.py | features/galleries/migrations/0003_auto_20170421_1109.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-21 09:09
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('galleries', '0002_auto_20170421_0934'),
]
operations... | agpl-3.0 | Python | |
a6381765ad8e15624a5dabb848283e92b0e90d8c | Create rpkm_bin.py | ShaopengLiu1/Atac-seq_Quality_Control_pipe,ShaopengLiu1/Atac-seq_Quality_Control_pipe,ShaopengLiu1/Atac-seq_Quality_Control_pipe | code_collection/rpkm_bin.py | code_collection/rpkm_bin.py | import sys
peak=[]
with open(sys.argv[1],'r') as f:
for line in f:
line=line.strip('\n').split('\t')
peak.append(line)
bed=[]
with open(sys.argv[2],'r') as f:
for line in f:
line=line.strip('\n').split('\t')
bed.append(line)
SIZE=int(sys.argv[3])
index=0
n=len(peak)
num=[0]*n
for read in bed:
mid=(int(re... | mit | Python | |
85202173cf120caad603315cd57fa66857a88b0b | Add missing migrations for institutions | watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder,watchdogpolska/feder | feder/institutions/migrations/0013_auto_20170810_2118.py | feder/institutions/migrations/0013_auto_20170810_2118.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-08-10 21:18
from __future__ import unicode_literals
from django.db import migrations
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
('institutions', '0012_auto_20170808_0309'),
]
operations = [
... | mit | Python | |
4bb5653f5f7f95bf28b2ee596c441cbc4c7fbf3a | Create whitefilterstr.py | Ton-Lankveld/whitelist-filter-string,Ton-Lankveld/whitelist-filter-string,Ton-Lankveld/whitelist-filter-string | whitefilterstr.py | whitefilterstr.py | def whiteListCharFilter(inStr, whiteListStr):
""" Sanatize a string with a list of allowed (white) characters
Input: inStr {string} String to be sanatized.
Input: whiteListStr {string} String with allowed characters.
Output: outStr {string} Sanatized string
"""
outStr = ""
if (isinstance(in... | mit | Python | |
4bfb560dc9f28d850a89c98590df032849cfc035 | Create zoql.py | bolaurent/zuora_restful_python | zoql.py | zoql.py | #!/usr/local/bin/python3
import sys
import cmd
import csv
import pdb
import config
from zuora import Zuora
zuora = Zuora(config.zuoraConfig)
def zuoraObjectKeys(zouraObject):
if zouraObject:
return zouraObject.keys()
def dumpRecords(records):
if records:
firstRecord = records[0]
... | mit | Python | |
eb250318cf6933b4a037bd9ea238ce0fc7be58c2 | add first script | leethargo/gitthemall | gitthemall.py | gitthemall.py | #! /usr/bin/env python2
import argparse
import os.path
import logging
import sys
logging.basicConfig(format='%(levelname)s: %(message)s')
def fail(msg):
'Fail program with printed message'
logging.error(msg)
sys.exit(1)
def update(repo, actions):
'Update repo according to allowed actions.'
repo =... | mit | Python | |
f9ea992353f2caa835ca2007eb07b470d1b782a3 | Fix migration colorfield | makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin | geotrek/trekking/migrations/0006_practice_mobile_color.py | geotrek/trekking/migrations/0006_practice_mobile_color.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2019-03-04 12:43
from __future__ import unicode_literals
import colorfield.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('trekking', '0005_auto_20181219_1524'),
]
operations = [
m... | bsd-2-clause | Python | |
3959ad4a4ddc4655c1acd8362de4284ba1e8d3e7 | Apply the hack that renames local_settings.py only when running setup.py | LinuxTeam-teilar/cronos.teilar.gr,LinuxTeam-teilar/cronos.teilar.gr,LinuxTeam-teilar/cronos.teilar.gr | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
from setuptest import test
import os, sys
if sys.argv[1] == 'install':
'''
Rename local_settings.py in order to
be excluded from setup.py install command
'''
ORIG_NAME = 'cronos/local_settings.py'
TEMP_NAME = 'cronos/local_setti... | #!/usr/bin/env python
from setuptools import setup, find_packages
from setuptest import test
import os
'''
Rename local_settings.py in order to
be excluded from setup.py install command
'''
ORIG_NAME = 'cronos/local_settings.py'
TEMP_NAME = 'cronos/local_settings.py1'
try:
os.rename(ORIG_NAME, TEMP_NAME)
except:
... | agpl-3.0 | Python |
b187e844d667b14dcc7874b351ee3f82383be348 | Fix dependency reference error | aaront/puckdb | setup.py | setup.py | import ast
import re
from setuptools import setup, find_packages
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('puckdb/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
setup(
name='puckdb',
author='Aaron Toth',
v... | import ast
import re
from setuptools import setup, find_packages
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('puckdb/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
setup(
name='puckdb',
author='Aaron Toth',
v... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.