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 |
|---|---|---|---|---|---|---|---|---|
bac4d20f4ab9cf38ec4ec8d318e9fb57edb9e6e7 | Implement the quilt add command | bjoernricks/python-quilt,vadmium/python-quilt | quilt/add.py | quilt/add.py | # vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:
# python-quilt - A Python implementation of the quilt patch system
#
# Copyright (C) 2012 Björn Ricks <bjoern.ricks@googlemail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as ... | mit | Python | |
16654e7c02831e1d8daede1a3d83cbcfa0d5f92b | Add tests for the stacks.yml file | alphagov/digitalmarketplace-aws,alphagov/digitalmarketplace-aws,alphagov/digitalmarketplace-aws | tests/test_stacks_file.py | tests/test_stacks_file.py | import json
from dmaws.stacks import Stack
from dmaws.context import Context
def is_true(x):
assert x
def is_in(a, b):
assert a in b
def valid_stack_json(stack):
text = stack.build('stage', 'env', {}).template_body
template = json.loads(text)
assert 'Parameters' in template
assert set(te... | mit | Python | |
dbca58879b5c0c8c6c35e5d52391ba5e90198695 | Add sensor_net handling for the Adafruit Raspberry PI DHT22 hummidity sensor driver. | geekylou/sensor_net,geekylou/sensor_net,geekylou/sensor_net,geekylou/sensor_net,geekylou/sensor_net | publisher_DHT22.py | publisher_DHT22.py | #!/usr/bin/python
# Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
# Adapted to use sensor_net by Louise Newberry
# 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 restri... | bsd-3-clause | Python | |
02b277f2edb9b24f5ceca9af16be7a762d6d0464 | Add numeric helper. | why2pac/dp-tornado,why2pac/dp-tornado,why2pac/dp-tornado,why2pac/dp-tornado | helper/numeric.py | helper/numeric.py | #
# dp for Tornado
# YoungYong Park (youngyongpark@gmail.com)
# 2014.11.04
#
from __future__ import absolute_import
from engine.helper import Helper as dpHelper
import re
class NumericHelper(dpHelper):
def extract_numbers(self, string):
return re.sub(r'\D+', '', str(string))
def number_format(se... | mit | Python | |
aec2f0f919bc81f701cfbd02c07f7e974db35b3c | add ip_util.py | semonalbertyeah/pyutils | pyutils/ip_util.py | pyutils/ip_util.py | # -*- coding:utf-8 -*-
from .data import ip_2_int
def same_net(ip1, ip2, netmask):
'''
check if these two IP in the same subnet.
input:
ip1, ip2 : display string. e.g.: '192.168.2.33' or int
netmask : display string. e.g.: '255.255.255.0' or int
'''
ip1 = ip_2_int(i... | mit | Python | |
3f7e3532a5477290a2e46099cf4520fa05f3438b | add testrunner | Christophe31/django-tickets,byteweaver/django-tickets,Christophe31/django-tickets,byteweaver/django-tickets | tickets/tests/runtests.py | tickets/tests/runtests.py | #!/usr/bin/env python
"""
Inspired by https://github.com/mbrochh/tdd-with-django-reusable-app
Thanks a lot!
"""
import os
import sys
from django.conf import settings
EXTERNAL_APPS = [
'django.contrib.admin',
'django.contrib.admindocs',
'django.contrib.auth',
'django.contrib.contenttypes',
'django... | bsd-3-clause | Python | |
43b8687ceb38716aa94dc4eec07404895e34e715 | fix django ex | MrKiven/gunicorn,ccl0326/gunicorn,prezi/gunicorn,tempbottle/gunicorn,malept/gunicorn,harrisonfeng/gunicorn,ephes/gunicorn,gtrdotmcs/gunicorn,zhoucen/gunicorn,z-fork/gunicorn,tejasmanohar/gunicorn,prezi/gunicorn,zhoucen/gunicorn,malept/gunicorn,mvaled/gunicorn,keakon/gunicorn,WSDC-NITWarangal/gunicorn,zhoucen/gunicorn,p... | examples/frameworks/django/testing/testing/apps/someapp/urls.py | examples/frameworks/django/testing/testing/apps/someapp/urls.py | from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^acsv$', 'testing.apps.someapp.views.acsv'),
url(r'^$', 'testing.apps.someapp.views.home'),
)
| from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('',
url(r'^acsv$', 'testing.apps.someapp.views.acsv'),
url(r'^$', 'testing.apps.someapp.views.home'),
)
| mit | Python |
c932fef4bd44ac0a62f8ac301fb18de65b021c8e | convert trainResized testResized Bmp data to hdf5 | zhmz90/first_step_with_julia_kaggle.jl | torch/preprocess.py | torch/preprocess.py | #!/usr/local/env python
import h5py
from skimage.io import imread
import numpy as np
import pandas as pd
def read_data(typeData, labelsInfo, imageSize, path):
x = np.zeros((labelsInfo.shape[0], imageSize))
for (index, idImage) in enumerate(labelsInfo["ID"]):
nameFile = "{0}/{1}Resized/{2}.Bmp".format(path, ty... | mit | Python | |
ab2f7f680af49bb534dc9c96467fe84de4c196d1 | Add plug-in summary for osc doc | openstack/python-heatclient | heatclient/osc/plugin.py | heatclient/osc/plugin.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
# distrib... | # 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
# distrib... | apache-2.0 | Python |
f3f94fc218220e91197e639b0b3e5514741623f0 | Add joblaunch command to source control | jangsutsr/tower-cli,tomfotherby/tower-cli,ansible/tower-cli,AlanCoding/tower-cli,docschick/tower-cli,ansible/tower-cli,cedub/tower-cli,nitzmahone/tower-cli,AlanCoding/tower-cli,chrismeyersfsu/tower-cli | lib/awx_cli/commands/JobLaunchCommand.py | lib/awx_cli/commands/JobLaunchCommand.py | # Copyright 2013, AnsibleWorks Inc.
# Michael DeHaan <michael@ansibleworks.com>
# Chris Church <cchurch@ansibleworks.com>
#
# 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.ap... | apache-2.0 | Python | |
84f59fea7da5ecf18cc0472b807c6880fb956d95 | Create ValidateBST_001_rec.py | Chasego/cod,cc13ny/algo,Chasego/codi,Chasego/cod,Chasego/codirit,Chasego/codirit,Chasego/codirit,Chasego/codi,Chasego/codi,cc13ny/algo,cc13ny/algo,Chasego/cod,cc13ny/Allin,Chasego/codi,cc13ny/algo,cc13ny/Allin,cc13ny/Allin,cc13ny/Allin,cc13ny/algo,Chasego/codirit,cc13ny/Allin,Chasego/cod,Chasego/codi,Chasego/cod,Chaseg... | leetcode/098-Validate-Binary-Search-Tree/ValidateBST_001_rec.py | leetcode/098-Validate-Binary-Search-Tree/ValidateBST_001_rec.py | # Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def isValidBST(self, root):
"""
:type root: TreeNode
:rtype: bool
"""
isVal, mi, ... | mit | Python | |
dcecd21f8237f9e455fa2aaf4862530470e7ffa8 | Drop unused month and year columns from monthlybilling | alphagov/notifications-api,alphagov/notifications-api | migrations/versions/0114_drop_monthly_billing_cols.py | migrations/versions/0114_drop_monthly_billing_cols.py | """
Revision ID: 0014_drop_monthly_billing_cols
Revises: 0113_job_created_by_nullable
Create Date: 2017-07-27 13:36:37.304344
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0014_drop_monthly_billing_cols'
down_revision = '0113_job_created_by_nullable'
def ... | mit | Python | |
fdfa3298cb5165f8beb638c137eef5d6d43267e8 | Add MySQL HA | jiasir/playback,nofdev/playback | playback/mysql.py | playback/mysql.py | import argparse
from fabric.api import *
parser = argparse.ArgumentParser()
group = parser.add_mutually_exclusive_group()
parser.add_argument('--user', help='the target user',
action='store', default='ubuntu', dest='user')
parser.add_argument('--hosts', help='the target address',
... | mit | Python | |
e2d0dd8cc4ca8d35434fefeeeacf1acda0207690 | add remind plugin | Rj48/ircbot,Rouji/Yui | plugins/remind.py | plugins/remind.py | import re
import dateutil.parser
import datetime
yui.db.execute("""\
CREATE TABLE IF NOT EXISTS remind(
id INTEGER PRIMARY KEY AUTOINCREMENT,
nick TEXT,
channel TEXT,
msg TEXT,
date_remind DATETIME,
date_added DATETIME DEFAULT current_timestamp);""")
yui.db.execute("""\
CREATE TABLE IF NOT EX... | mit | Python | |
d2f5d35df256d1ab9e85ff4bd032a7288d8f3f5b | Define a new randomize script | vandaele/light-automation,vandaele/light-automation | randomize.py | randomize.py | from automaton_client import AutomatonClient
SERVER_HOST = "localhost"
SERVER_PORT = 1502
try:
c = AutomatonClient(host=SERVER_HOST, port=SERVER_PORT)
# open or reconnect TCP to server
if not c.is_open():
if not c.open():
print("unable to connect to %s:%s" % (SERVER_HOST, SERVER_PORT)... | mit | Python | |
35a58ee5b5af15f01fa8f45a815f673f4b3e90b5 | Add tools/pdfstats.py which counts all LT* types in a PDF (#68) | pdfminer/pdfminer.six,goulu/pdfminer,rotula/pdfminer | tools/pdfstats.py | tools/pdfstats.py | #!/usr/bin/env python3
# Exercise pdfminer, looking deeply into a PDF document, print some stats to stdout
# Usage: pdfstats.py <PDF-filename>
import sys, os
import collections
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfdocument import PDFDocument
from pdfminer.pdfpage import PDFPage, PDFTextExtractio... | mit | Python | |
651ac60c333c4181dc8496812329383e9151644f | implement Liang-Barsky line clipping | ufoym/wavelet-rasterization,ufoym/wavelet-rasterization | util/LiangBarsky.py | util/LiangBarsky.py | from collections import namedtuple
Point = namedtuple('Point', 'x y')
def LiangBarsky(left, right, bottom, top, start, end):
t0, t1 = 0, 1
xdelta = end.x-start.x
ydelta = end.y-start.y
for edge in xrange(4): # traverse through left, right, bottom, top edges.
if edge == 0: p, q = -xdelta, -... | mit | Python | |
a61185fb3351aa273d9826ef50d3a9c9c2f04f57 | Create RhinoRenderAnimation.py | ebberly/arch-scripts | RhinoRenderAnimation.py | RhinoRenderAnimation.py | import scriptcontext
import Rhino
import System
from Rhino.Geometry import *
from scriptcontext import doc
import rhinoscriptsyntax as rs
import Rhino.RhinoApp as app
from array import *
import os
import sys
frames = 300
#rs.CurrentView("perspective")
#rs.Command ("!_-Render")
#saveRenderview("C:\Users\ebberly")
... | mit | Python | |
91056970b5359b8410348010ce7a96547272e1c8 | Add regression test for bug 1825034 | rahulunair/nova,klmitch/nova,openstack/nova,mahak/nova,mahak/nova,mahak/nova,openstack/nova,klmitch/nova,klmitch/nova,rahulunair/nova,klmitch/nova,openstack/nova,rahulunair/nova | nova/tests/functional/regressions/test_bug_1825034.py | nova/tests/functional/regressions/test_bug_1825034.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 t... | apache-2.0 | Python | |
24287654c5710560e2c905b2500886f146014c8a | add the encoding functions | koll00/Gui_SM,koll00/Gui_SM | SMlib/utils/encoding.py | SMlib/utils/encoding.py | """
"""
from __future__ import with_statement
import re
import os
import locale
import sys
from codecs import BOM_UTF8, BOM_UTF16, BOM_UTF32
PREFERRED_ENCODING = locale.getpreferredencoding()
def transcode(text, input=PREFERRED_ENCODING, output=PREFERRED_ENCODING):
"""Transcode a text string""... | mit | Python | |
eaa8b9035b3a8b4261c829045aefbc27f2e7afe3 | Add (GNU) sed package | BreakawayConsulting/xyz | rules/sed.py | rules/sed.py | import xyz
import os
import shutil
class Sed(xyz.BuildProtocol):
pkg_name = 'sed'
def configure(self, builder, config):
# FIXME: doen't understand --disable-shared (it isn't a lib, so not surprise ther!)
builder.host_lib_configure(config=config)
rules = Sed()
| mit | Python | |
d0b6571e81bdff73527dac9ed032f76473b88d90 | Implement the next cli command | bjoernricks/python-quilt,vadmium/python-quilt | quilt/cli/next.py | quilt/cli/next.py | # vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:
# python-quilt - A Python implementation of the quilt patch system
#
# Copyright (C) 2012 Björn Ricks <bjoern.ricks@googlemail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as ... | mit | Python | |
cd97ef5951f2fac229c3d1bd7320907ac754607e | Create test runner script. | drowse314-dev-ymat/ipyenv | run_tests.py | run_tests.py | # encoding: utf-8
import subprocess
import os
import sys
import re
TARGET_DIR = os.path.realpath('./tests')
RE_TEST_SCRIPT_NAME = re.compile('^[Tt]est.*\.py$')
def execute_test(filepath):
subprocess.call([sys.executable, filepath])
def run():
for root, dirs, files in os.walk(TARGET_DIR):
if root !... | bsd-3-clause | Python | |
cb8db33cbc81998f490aa021df1e318a2d346656 | print matrix diagonally | Harnek/Data-Structure-and-Algorithms,Harnek/algorithms | matrix_printing_diagonally.py | matrix_printing_diagonally.py | '''@author : https://github.com/Harnek'''
a = [[1, 2, 3, 4],
[5, 6, 7, 8],
[9,10,11,12],
[13,14,15,16],]
r = 4
c = 4
#Diagonally Up
'''
1
5 2
9 6 3
13 10 7 4
14 11 8
15 12
16
'''
for i in range(r + c - 1):
k1 = 0 if i < c else i - c + 1
k2 = 0 if i < r else i - r + 1
for j in range(... | mit | Python | |
1b4f973c1d8d51eaad0ed20036c93fa560c124e9 | add run_tests.py | googleinterns/amt-xpub,googleinterns/amt-xpub | run_tests.py | run_tests.py | # Copyright 2020 The Private Cardinality Estimation Framework 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 b... | apache-2.0 | Python | |
11341dd7c9bb5d953111543206c8d81d2dfc753c | add module to generate deterministic k | fametrano/BitcoinBlockchainTechnology | scripts/rfc6979.py | scripts/rfc6979.py | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 9 11:00:55 2017
@author: Leonardo
"""
# deterministic generation of k
# addapted from:
# https://github.com/AntonKueltz/fastecdsa/blob/master/fastecdsa/util.py
from hashlib import sha256
from secp256k1 import order as ec_order
from struct import pack
from binascii imp... | mit | Python | |
d8199b2f8cbb71918d624bdccd21c907950b1233 | add file | Geew/safe_html | safe_html.py | safe_html.py | #!/usr/bin/env python
# encoding: utf-8
from bs4 import BeautifulSoup, Comment
import urllib
import re
# html 标签白名单
VALID_TAGS = {
'strong': [],
'em': [],
'span': {'style', },
'p': [],
'h1': [],
'pre': [],
'h2': [],
'h3': [],
'br': [],
'a': {'href', 'title'},
'img': {'src'... | mit | Python | |
924de7e93a8d73932253b10699ab0f481761586e | Add functions to build and parse variable-length (VLE) strings | TeskaLabs/SeaCat-Client-Python3 | seacat/spdy/vle.py | seacat/spdy/vle.py | import struct
def spdy_add_vle_string(frame, string):
buf = bytes(string, 'utf-8')
buf_len = len(buf)
if buf_len >= 0xFA:
struct.pack_into('!BH', frame.data, frame.position, 0xFF, buf_len)
frame.position += struct.calcsize('!BH')
else:
struct.pack_into('!B', frame.data, frame.position, buf_len)
frame.pos... | bsd-3-clause | Python | |
74907d298f491f89a7fc6fb880464631cebf639b | Add examples/c4_ql_tab_simple_selfplay.py | davidrobles/mlnd-capstone-code | examples/c4_ql_tab_simple_selfplay.py | examples/c4_ql_tab_simple_selfplay.py | '''
The Q-learning algorithm is used to estimate the state-action values for a
simple Connect 4 position by playing games against itself (self-play).
'''
from capstone.game.games import Connect4
from capstone.game.players import RandPlayer
from capstone.game.utils import c42pdf
from capstone.rl import Environment, Game... | mit | Python | |
7e6baa184955bc2ac43533df7962afd85e923a03 | Update osf base logic | CenterForOpenScience/scrapi,mehanig/scrapi,fabianvf/scrapi,fabianvf/scrapi,felliott/scrapi,felliott/scrapi,mehanig/scrapi,alexgarciac/scrapi,erinspace/scrapi,icereval/scrapi,jeffreyliu3230/scrapi,ostwald/scrapi,CenterForOpenScience/scrapi,erinspace/scrapi | scrapi/processing/osf/__init__.py | scrapi/processing/osf/__init__.py | from scrapi.processing.osf import crud
from scrapi.processing.osf import collision
from scrapi.processing.base import BaseProcessor
class OSFProcessor(BaseProcessor):
NAME = 'osf'
def process_normalized(self, raw_doc, normalized):
if crud.is_event(normalized):
crud.dump_metdata(normalized... | from scrapi.processing.osf import crud
from scrapi.processing.osf import collision
from scrapi.processing.base import BaseProcessor
class OSFProcessor(BaseProcessor):
NAME = 'osf'
def process_normalized(self, raw_doc, normalized):
if crud.is_event(normalized):
crud.create_event(normalized... | apache-2.0 | Python |
13e1f8b4218ce885d91486cddbc9c2e9b970826f | add websocket example | Kriechi/mitmproxy,mitmproxy/mitmproxy,mhils/mitmproxy,Kriechi/mitmproxy,mhils/mitmproxy,vhaupert/mitmproxy,mitmproxy/mitmproxy,vhaupert/mitmproxy,Kriechi/mitmproxy,mhils/mitmproxy,mitmproxy/mitmproxy,vhaupert/mitmproxy,vhaupert/mitmproxy,mitmproxy/mitmproxy,mhils/mitmproxy,mhils/mitmproxy,Kriechi/mitmproxy,mitmproxy/mi... | examples/simple/websocket_messages.py | examples/simple/websocket_messages.py | import re
from mitmproxy import ctx
def websocket_message(flow):
# get the latest message
message = flow.messages[-1]
# simply print the content of the message
ctx.log.info(message.content)
# manipulate the message content
message.content = re.sub(r'^Hello', 'HAPPY', message.content)
| mit | Python | |
1a3494c9f5657ec03a82312cab3760a1ae3820e5 | Add diagnostics support to Whois (#64855) | nkgilley/home-assistant,w1ll1am23/home-assistant,w1ll1am23/home-assistant,rohitranjan1991/home-assistant,GenericStudent/home-assistant,rohitranjan1991/home-assistant,mezz64/home-assistant,nkgilley/home-assistant,toddeye/home-assistant,rohitranjan1991/home-assistant,mezz64/home-assistant,GenericStudent/home-assistant,to... | homeassistant/components/whois/diagnostics.py | homeassistant/components/whois/diagnostics.py | """Diagnostics support for Whois."""
from __future__ import annotations
from typing import Any
from whois import Domain
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
from .const import DOMA... | apache-2.0 | Python | |
13cb9144047b0aa24260ff4b2bdbc5d2fcd8b82b | Add tool for generating ublox config packets | mtharp/laureline-firmware,mtharp/laureline-firmware,mtharp/laureline-firmware,mtharp/laureline-firmware | util/ublox_pkt.py | util/ublox_pkt.py | #
# Copyright (c) Michael Tharp <gxti@partiallystapled.com>
#
# This file is distributed under the terms of the MIT License.
# See the LICENSE file at the top of this tree, or if it is missing a copy can
# be found at http://opensource.org/licenses/MIT
#
import struct
import sys
msg_cls = int(sys.argv[1], 16)
msg_id... | mit | Python | |
cb815258413d8ff22a677663be57238b8f8f3654 | Fix the Ghostscript normalization output format | artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin | fpr/migrations/0019_fix_gs_command.py | fpr/migrations/0019_fix_gs_command.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def data_migration(apps, schema_editor):
"""Fix the Ghostscript normalization command "Command Transcoding to pdfa
with Ghostscript" so that it documents its true output format as PDF/A 1b
(fmt/354) and not P... | agpl-3.0 | Python | |
8a53fc791f15c4038be671d0c707ab74d18eaf37 | Create something.py | uidp6824/hello-there | something.py | something.py | print "Comparte"
| mit | Python | |
2317b92f4e80d82263e1b5f8f081e28361cc42c9 | Add regression test for bug #1899835 | mahak/nova,openstack/nova,openstack/nova,openstack/nova,mahak/nova,mahak/nova | nova/tests/functional/regressions/test_bug_1899835.py | nova/tests/functional/regressions/test_bug_1899835.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 t... | apache-2.0 | Python | |
db2b8a48ce0910559130df2bc0a3a1af7c072e24 | Create lager_generator | andresodio/lager,andresodio/lager,andresodio/lager,andresodio/lager | lager_generator/lager_generator.py | lager_generator/lager_generator.py | #!/usr/bin/python
# This program generates new gesture strings based on an input gesture string.
#
# It creates new variants by using the Monte Carlo method. The input gesture
# string is used as the model, and a normal distribution around each literal
# in the model string is used to replace the literal by either its... | mit | Python | |
bb3573ce7b0eb93e202a7dba13f2c1eedcca1275 | Add a forgotten migration for QueuedImage | neavouli/yournextrepresentative,YoQuieroSaber/yournextrepresentative,neavouli/yournextrepresentative,datamade/yournextmp-popit,DemocracyClub/yournextrepresentative,YoQuieroSaber/yournextrepresentative,mysociety/yournextrepresentative,neavouli/yournextrepresentative,YoQuieroSaber/yournextrepresentative,datamade/yournext... | moderation_queue/migrations/0003_auto_20150301_2035.py | moderation_queue/migrations/0003_auto_20150301_2035.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('moderation_queue', '0002_auto_20150213_0838'),
]
operations = [
migrations.AlterField(
model_name='queuedimage',... | agpl-3.0 | Python | |
eefb0b5cd6b0d500f46fd351e1ba3e1a543cb1af | Create vlookup_report.py | rahulinux/scripts,rahulinux/scripts,rahulinux/scripts,rahulinux/scripts | vlookup_report.py | vlookup_report.py | #!/usr/bin/evn python
import sys
import csv
import subprocess
if len(sys.argv) != 3:
print "\nUsage:\n\t %s <file1> <file2>\n" % sys.argv[0]
raise SystemExit(1)
else:
file1,file2 = sys.argv[1:3]
of = open("output.csv","wb")
reader = csv.reader(open(file1))
output = csv.writer(of,quoting=csv.QU... | mit | Python | |
6a3e35ef30f83058c73f5872bdbf937ffa49aeef | add solution for Number of Islands | zhyu/leetcode,zhyu/leetcode | src/numberOfIslands.py | src/numberOfIslands.py | class Solution:
# @param grid, a list of list of characters
# @return an integer
def _get_f(self, x):
if x != self.f[x]:
self.f[x] = self._get_f(self.f[x])
return self.f[x]
def numIslands(self, grid):
if not grid or not grid[0]:
return 0
n, m = l... | mit | Python | |
03278bd4ccbc5277ec506190674e3103a07b7014 | Add 'run_mnist.py' for demonstration | IshitaTakeshi/PCANet | run_mnist.py | run_mnist.py | import os
from os.path import isdir, join
import timeit
import argparse
from sklearn.svm import SVC
from sklearn.metrics import accuracy_score
from pcanet import PCANet
from utils import load_model, save_model, load_mnist
parser = argparse.ArgumentParser(description="PCANet example")
parser.add_argument("--gpu", "-... | mit | Python | |
1522c5258476df29b6d704bca8281e00f0ded990 | Add conftest.py with in_tmp_path fixture | JonathonReinhart/scuba,JonathonReinhart/scuba,JonathonReinhart/scuba | tests/conftest.py | tests/conftest.py | import pytest
@pytest.fixture
def in_tmp_path(tmp_path, monkeypatch):
"""Runs a test in a temporary directory provided by the tmp_path fixture"""
monkeypatch.chdir(tmp_path)
return tmp_path
| mit | Python | |
64e629a0e9109a817655f7f966e79bd174858b0b | Add MyModule.py | Naftoreiclag/Python-Tests | source/MyModule.py | source/MyModule.py | x = raw_input("Enter name: ")
print "Hey " + x
| mit | Python | |
668ce50a16c4b6e25c17b8496d093deffca06eb4 | Add schedulers.py with random_scheduler | valpo-sats/scheduling-bazaar,valpo-sats/scheduling-bazaar | broker/schedulers.py | broker/schedulers.py | # This file contains the different scheduling method definitions to be used
# when simulating.
def random_scheduler(passes, clients, debug=False):
"""Randomly schedules passes on the given clients (which are already
instantiated with the desired client type).
passes - candidate passes for scheduling.
... | agpl-3.0 | Python | |
762f9e4fac6e775a3530fd56237de951aea05622 | Add the exceptions module | willrogers/pml,willrogers/pml,razvanvasile/RML | rml/exceptions.py | rml/exceptions.py | class ConfigException(RuntimeError):
pass
| apache-2.0 | Python | |
4599b2d3d953e844210a88ce7f2ce2a1dc0f4e02 | Add self-replicating python program | uluyol/misc,uluyol/misc,uluyol/misc,uluyol/misc,uluyol/misc,uluyol/misc | self-repl.py | self-repl.py | s='p'+'r'+'i'+'n'+'t'+'('+'"'+'s'+'='+'"'+','+' '+'e'+'n'+'d'+'='+'"'+'"'+')'+'\n'+'f'+'o'+'r'+' '+'c'+' '+'i'+'n'+' '+'s'+':'+'\n'+'\t'+'p'+'r'+'i'+'n'+'t'+'('+'"'+'"'+'"'+'\\'+'\n'+'{'+'!'+'r'+'}'+'+'+'"'+'"'+'"'+'.'+'f'+'o'+'r'+'m'+'a'+'t'+'('+'c'+')'+','+' '+'e'+'n'+'d'+'='+'"'+'"'+')'+'\n'+'p'+'r'+'i'+'n'+'t'+'('+... | mit | Python | |
99a44bd29d9e640830399f79eb90d9a5c370f7c0 | add nim-game | EdisonAlgorithms/LeetCode,zeyuanxy/leet-code,EdisonAlgorithms/LeetCode,zeyuanxy/leet-code,EdisonAlgorithms/LeetCode,zeyuanxy/leet-code | vol4/nim-game/nim-game.py | vol4/nim-game/nim-game.py | class Solution(object):
def canWinNim(self, n):
"""
:type n: int
:rtype: bool
"""
if n % 4 == 0:
return False
else:
return True | mit | Python | |
b12f612ad93093359e6d751656fb0ba848ce6b2c | Create lmao.py | grampajoe/lmao | lmao.py | lmao.py | from flask import Flask
app = Flask(__name__)
@app.route('/')
def lmao():
return 'lmao'
| mit | Python | |
7d17aa3a48f6538ee0be836344767b6e90a25f01 | allow loaddata to work with InnoDB | mozilla/FlightDeck,mozilla/FlightDeck,mozilla/FlightDeck | apps/jetpack/management/commands/loaddata.py | apps/jetpack/management/commands/loaddata.py | from django.core.management.commands.loaddata import Command as BaseCommand
from test_utils import runner
class Command(BaseCommand):
pass
| bsd-3-clause | Python | |
63a2960c87a4f39cfbe4b809da3affb1500f4b03 | Add one more testcase | mathstuf/vdirsyncer,untitaker/vdirsyncer,hobarrera/vdirsyncer,untitaker/vdirsyncer,credativUK/vdirsyncer,tribut/vdirsyncer,untitaker/vdirsyncer,hobarrera/vdirsyncer,mathstuf/vdirsyncer,tribut/vdirsyncer,credativUK/vdirsyncer | tests/test_cli.py | tests/test_cli.py | # -*- coding: utf-8 -*-
'''
tests.test_cli
~~~~~~~~~~~~~~
:copyright: (c) 2014 Markus Unterwaditzer
:license: MIT, see LICENSE for more details.
'''
from textwrap import dedent
import vdirsyncer.cli as cli
def test_load_config(tmpdir, monkeypatch):
f = tmpdir.join('test.cfg')
f.write(dedent(... | # -*- coding: utf-8 -*-
'''
tests.test_cli
~~~~~~~~~~~~~~
:copyright: (c) 2014 Markus Unterwaditzer
:license: MIT, see LICENSE for more details.
'''
from textwrap import dedent
import vdirsyncer.cli as cli
def test_load_config(tmpdir, monkeypatch):
f = tmpdir.join('test.cfg')
f.write(dedent(... | mit | Python |
f4cd648cb2266a8f122e81a2807ba4ca0b6c9a74 | Refactor and lint fixes | postlund/pyatv,postlund/pyatv | tests/test_log.py | tests/test_log.py | """Unit tests for pyatv.log."""
import unittest
import logging
from unittest.mock import MagicMock
from pyatv import log
class LogTest(unittest.TestCase):
def setUp(self):
self.mock_logger = MagicMock()
self.mock_logger.return_value = True
def test_no_log_if_not_debug(self):
self.m... | mit | Python | |
ba34105e9c3e3c3a20500999de3f4b06bed87400 | add a test that checks _mssql whilst being run in threads | jasongs/pymssql,jasongs/pymssql | tests/threaded.py | tests/threaded.py | import _mssql
import unittest
import threading
from mssqltests import server, username, password, database
class TestingThread(threading.Thread):
def run(self):
self.running = True
mssql = _mssql.connect(server, username, password)
mssql.select_db(database)
for i in xrange(0, 100):... | lgpl-2.1 | Python | |
ab47c9c11fc7144ae9bd8d662136d8946e02bda2 | Add MSE module | awest1339/multiscanner,mitre/multiscanner,awest1339/multiscanner,awest1339/multiscanner,jmlong1027/multiscanner,mitre/multiscanner,mitre/multiscanner,jmlong1027/multiscanner,MITRECND/multiscanner,awest1339/multiscanner,jmlong1027/multiscanner,MITRECND/multiscanner,jmlong1027/multiscanner | modules/Antivirus/MSEScan.py | modules/Antivirus/MSEScan.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import division, absolute_import, with_statement, print_function, unicode_literals
import os
import ... | mpl-2.0 | Python | |
c5df66f9d8b6783de4dcbbb70b2e66d3351d4e85 | Put together a simple Python script to call on FFMPEG to do hard work | Rosuav/shed,Rosuav/shed,Rosuav/shed,Rosuav/shed,Rosuav/shed | channel_split.py | channel_split.py | # Split the audio channel from a file into its channels
# Keeps video and subtitles tracks untouched
import json
import subprocess
import sys
if len(sys.argv) < 3:
sys.exit(1, "USAGE: python3 %s inputfile outputfile")
_, infile, outfile, *_ = sys.argv
# Determine the channel layout of the input file
p = subprocess.r... | mit | Python | |
d8b396db59199f9221a3bf7ac9d75f1edfd07d4c | Add unit tests for upcoming pygametemplate.Image class | AndyDeany/pygame-template | spec/image_spec.py | spec/image_spec.py | from spec.helper import *
from pygame import Surface
from pygametemplate import Image
with description("pygametemplate.Image"):
with it("should initialise correctly, without loading a Surface object"):
self.image = Image("test")
expect(self.image.name).to(equal("test"))
expect(self.image... | mit | Python | |
47a4fc43b6bb4e55897c52828df119df8a5e4aa6 | Create similar-rgb-color.py | kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode | Python/similar-rgb-color.py | Python/similar-rgb-color.py | # Time: O(1)
# Space: O(1)
class Solution(object):
def similarRGB(self, color):
"""
:type color: str
:rtype: str
"""
def rounding(color):
q, r = divmod(int(color, 16), 17)
if r > 8: q += 1
return '{:02x}'.format(17*q)
return '#' ... | mit | Python | |
0c8e61bc23d44fcac00cc1b1142f5c90ba1927cb | Add binary search | jeremykid/FunAlgorithm,jeremykid/FunAlgorithm,jeremykid/FunAlgorithm,jeremykid/FunAlgorithm | python_practice/data_structure/binary_search.py | python_practice/data_structure/binary_search.py |
def binarySearchList(space_list, target):
space_list.sort()
space_list_length = len(space_list)
lo = 0
hi = space_list_length
while lo < hi:
mid = (lo+hi)//2
if space_list[mid] == target:
return mid
else if space_list[mid] > target:
hi = mid-1
else:
lo = mid+1
if space_lis... | mit | Python | |
b704d6118b0cfd2ab6a9a25e9515abcd5665b867 | Create advantage-shuffle.py | tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode | Python/advantage-shuffle.py | Python/advantage-shuffle.py | # Time: O(nlogn)
# Space: O(n)
# Given two arrays A and B of equal size, the advantage of A with respect to B
# is the number of indices i for which A[i] > B[i].
#
# Return any permutation of A that maximizes its advantage with respect to B.
#
# Example 1:
#
# Input: A = [2,7,11,15], B = [1,10,4,11]
# Output: [2,11,7... | mit | Python | |
6fca9da8cbf5318a2f7cdee16d4136b7b54088a5 | Add migration for reminder update | BirkbeckCTP/janeway,BirkbeckCTP/janeway,BirkbeckCTP/janeway,BirkbeckCTP/janeway | src/cron/migrations/0004_auto_20210831_1159.py | src/cron/migrations/0004_auto_20210831_1159.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-08-31 11:59
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cron', '0003_auto_20171121_1115'),
]
operations = [
migrations.AlterField(... | agpl-3.0 | Python | |
2d234bb0197a79f2d7ca5a2a6f0f4ed64b5e1d85 | Add class for ban mask matching | Zarthus/Reconcile,Zarthus/Reconcile | tools/bantools.py | tools/bantools.py | """
The MIT License (MIT)
Copyright (c) 2014 - 2015 Jos "Zarthus" Ahrens and contributors
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 rig... | mit | Python | |
0061f8228461a6298ada92069c4e15ffcec3530f | add template tag for displaying licence info in the search results | MiltosD/CEF-ELRC,MiltosD/CEFELRC,MiltosD/CEFELRC,MiltosD/CEFELRC,MiltosD/CEF-ELRC,MiltosD/CEFELRC,MiltosD/CEFELRC,MiltosD/CEF-ELRC,MiltosD/CEF-ELRC,MiltosD/CEF-ELRC,MiltosD/CEFELRC,MiltosD/CEF-ELRC,MiltosD/CEF-ELRC,MiltosD/CEFELRC | metashare/repository/templatetags/resource_distribution.py | metashare/repository/templatetags/resource_distribution.py | from django import template
from metashare.settings import MEDIA_URL
from metashare.repository.model_utils import get_resource_license_types
from replace import pretty_camel
register = template.Library()
@register.filter("licence_icon")
def licence_icon(licence):
if licence == "non-standard/Other_Licence/Terms":
... | bsd-3-clause | Python | |
71e1916bb44f16fd897327bdfa28d1cbdda0314c | Create cybergis-script-ittc-register-snapshot-layergroup.py | state-hiu/cybergis-scripts,state-hiu/cybergis-scripts | bin/cybergis-script-ittc-register-snapshot-layergroup.py | bin/cybergis-script-ittc-register-snapshot-layergroup.py | #!/usr/bin/python
from base64 import b64encode
from optparse import make_option
import json
import urllib
import urllib2
import argparse
import time
import sys
import os
import subprocess
#==#
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'lib', 'cybergis')))
import gs._geoserver_animate... | mit | Python | |
de8dfe0db0a6f1f0708761864c62563af14ef5e7 | add missing file | 255BITS/HyperGAN,255BITS/HyperGAN | lib/regularizers/l2_regularizer.py | lib/regularizers/l2_regularizer.py | import tensorflow as tf
def get(config):
ws = None
with tf.variable_scope("generator"):
with tf.variable_scope("g_lin_proj"):
tf.get_variable_scope().reuse_variables()
ws = tf.get_variable('Matrix',dtype=config['dtype'])
tf.get_variable_scope().reuse_variables()
... | mit | Python | |
5e2893450db160318f7359505a2081effd9d0266 | add wrapper.py | yasfmy/chainer_attention_model | yasfmy/wrapper.py | yasfmy/wrapper.py | from functools import wraps
from chainer import cuda
import numpy as np
class xpmeta(type):
def __new__(cls, clsname, bases, clsdict):
try:
cuda.check_cuda_available()
xp = cuda.cupy
except RuntimeError:
xp = np
return xp
class xp(metaclass=xpmeta):
... | mit | Python | |
6e1c7c2ed81bc3739952f0b1fd1ff4e67ac759e2 | Add color masking demo. | scikit-image/skimage-demos | color_masking.py | color_masking.py | from skimage import data, io, color, img_as_float
import numpy as np
import matplotlib.pyplot as plt
alpha = 0.6
img = img_as_float(data.camera())
rows, cols = img.shape
# Construct a colour image to superimpose
color_mask = np.zeros((rows, cols, 3))
color_mask[30:140, 30:140] = [1, 0, 0] # Red block
color_mask[170... | bsd-3-clause | Python | |
e7f745e18e0125bea49f3892fd5bacf16e9cd1a7 | Add agent module | wairton/zephyrus-mas | zephyrus/agent.py | zephyrus/agent.py | import abc
import logging
from multiprocessing import Process
import zmq
from zephyrus.address import Participants
from zephyrus.components import ComponentManager
class Agent(abc.ABC, Process):
def __init__(self, ag_id, address_config, component_config=None):
super().__init__()
self.id = ag_id
... | mit | Python | |
a6f2a9e5aa28ef8927c6fb2b9a3c4ce287e548c4 | Add read skill permission | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | bluebottle/tasks/migrations/0032_add_skill_permission.py | bluebottle/tasks/migrations/0032_add_skill_permission.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-08-29 07:33
from __future__ import unicode_literals
from django.db import migrations
from bluebottle.utils.utils import update_group_permissions
def add_group_permissions(apps, schema_editor):
group_perms = {
'Anonymous': {
'perms'... | bsd-3-clause | Python | |
26859b307c3c7a0aa9bef8250a31d451c320a685 | Create DBGUpdates.py | plasticantifork/PS2Updates | DBGUpdates.py | DBGUpdates.py | #!/usr/bin/python
import sys, os
import traceback
import requests
import hashlib
import credentials
import tweepy
import praw
from datetime import datetime,timedelta
r = praw.Reddit('Planetside 2 Update Poster')
r.login(credentials.u, credentials.p)
twitterAuthFile = open(os.path.join(sys.path[0], 'twitterAuth'), 'r'... | mit | Python | |
a6c3622ffbe6f02bab8a9be2c8949771d8729d95 | Add basic proof of concept: encode and decode | Telkkar/fibonacci_message_encoding | fibonacci_message_encoding/main.py | fibonacci_message_encoding/main.py | import string
# Pseudocode
## Encode
def encode(secret_string, wordlist=[]):
# TODO: wordlist is not intended for production
message = []
# Generate fibo values V_m_n using m_0
# TODO: add possibility of calculating closed-form fibo numbers using starting position
fibonacci_values = [1, 1, 2, 3, ... | mit | Python | |
2de23b183f9da1338b9773614f3c236fd61bb5e2 | add forms | samitnuk/urlsaver_django,samitnuk/urlsaver_django | urlsaver/forms.py | urlsaver/forms.py | from django import forms
from django.contrib.auth.models import User
#----------------------------------------------------------------------------
class LoginForm(forms.Form):
email = forms.EmailField()
password = forms.CharField(widget=forms.PasswordInput)
#--------------------------------------------------... | mit | Python | |
bc293b675b067574f8c9da0e18d5d958e4ca568b | Migrate SDE to remove redundant fields | kriberg/stationspinner,kriberg/stationspinner | stationspinner/sde/migrations/0008_auto_20150715_1544.py | stationspinner/sde/migrations/0008_auto_20150715_1544.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('sde', '0007_remove_invtype_chanceofduplicating'),
]
operations = [
migrations.RemoveField(
model_name='invcatego... | agpl-3.0 | Python | |
ae7026296b2a5b5b0d622abda4841919bc783248 | Add files via upload | ketiil/1050-Quiz | main.py | main.py | from quiz import Quiz
def main():
#Oppretter objekt av Quiz
quiz = Quiz()
#Rydder skjermen
quiz.clear_screen()
#Mah loop
loop = True
#inpt = input("Input: ")
while loop:
#Hovedmeny
print("1: Start All Random \n")
print("2: Start Kategorier \n")
print... | mit | Python | |
0abbe91108551651ffee712c93499bc89a3adc27 | add shout and echo | AnotherKamila/distributed-algorithms-emulator | examples/shout-and-echo.py | examples/shout-and-echo.py | """Implements a shout-and-echo algorithm on any topology."""
from da import Node, Network
import topo
class ShoutAndEcho(Node):
def run(self):
marked_edges = [ False for e in range(self.deg) ]
first_from = None
if 'shout' in self.data:
self.data['msg'] = self.data['shout']
... | mit | Python | |
6017ec0dad8cbd34920bb629aa5059f3a12ac512 | Create Python_PE.py | MCPEBukkit/Python_PE,MCPEBukkit/Python_PE | Python_PE.py | Python_PE.py | #soon
| mit | Python | |
b05d285c9381ad0629380962d1db86e4809c2c16 | Create SlurmTemp.py | timknut/SlurmTemp | SlurmTemp.py | SlurmTemp.py | ### **Slurmtemp.py**
Command line tool for sending simple yet CPU itensive jobs to the CIGENE cluster.
You can modify job name, log name and number and CPUs for the job with command line options.
Usage: `Slurmtemp.py "commands" [n threads as integer]`
type `Slurmtemp.py -h` for command line help.
####Installation
... | mit | Python | |
2a3afede2d15660f40486cf7cdcdbb2079c69461 | Add partial function demo. | precompiler/python-101 | mastering-python/ch04/FuncTools.py | mastering-python/ch04/FuncTools.py | import functools
def power(m, n):
return m ** n
print(power(3, 2))
square = functools.partial(power, n=2)
print(square(2))
print(square(10))
| apache-2.0 | Python | |
b006123331d919de0997b307a5e174832bc4d610 | Add new package: AutoDock-GPU. (#17808) | iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/autodock-gpu/package.py | var/spack/repos/builtin/packages/autodock-gpu/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class AutodockGpu(MakefilePackage):
"""AutoDock-GPU: AutoDock for GPUs and other accelerators.
... | lgpl-2.1 | Python | |
2bcb703d959e628a5add2a034e0a3d8dbb5f6e13 | Add hello world | CS113/fatty-big-star,CS113/fatty-big-star,CS113/fatty-big-star | hello_world.py | hello_world.py | print 'hello world'
| mit | Python | |
0363bb7854ffec61c8e001b6560bd99ff5aff383 | Add warning to mezzanine_project script to prevent the user from creating a project name that conflicts with an existing package or module. | viaregio/mezzanine,mush42/mezzanine,biomassives/mezzanine,guibernardino/mezzanine,gbosh/mezzanine,biomassives/mezzanine,tuxinhang1989/mezzanine,douglaskastle/mezzanine,dustinrb/mezzanine,fusionbox/mezzanine,jerivas/mezzanine,industrydive/mezzanine,AlexHill/mezzanine,readevalprint/mezzanine,Kniyl/mezzanine,SoLoHiC/mezza... | mezzanine/bin/mezzanine_project.py | mezzanine/bin/mezzanine_project.py | #!/usr/bin/env python
import os
import shutil
import sys
import mezzanine
class ProjectException(Exception):
pass
def create_project():
"""
Copies the contents of the project_template directory to a new directory
specified as an argument to the command line.
"""
# Ensure a directory n... | #!/usr/bin/env python
import os
import sys
import shutil
import mezzanine
def create_project():
script_name = os.path.basename(sys.argv[0])
if len(sys.argv) == 1:
print
print "Usage: %s project_name" % script_name
print
sys.exit()
mezzanine_path = os.path.dirname(... | bsd-2-clause | Python |
9a1bdce4e23441507310777abba217dd136ee353 | Create __init__.py | CyberTriber/python | commands/__init__.py | commands/__init__.py | mit | Python | ||
0c1a0a70154ddf107a6174d49793e369d28f1beb | Fix default get_user_home with dynamic dashboards | bigswitch/horizon,tsufiev/horizon,froyobin/horizon,NeCTAR-RC/horizon,kfox1111/horizon,NeCTAR-RC/horizon,yjxtogo/horizon,RudoCris/horizon,watonyweng/horizon,philoniare/horizon,philoniare/horizon,noironetworks/horizon,eayunstack/horizon,CiscoSystems/avos,Dark-Hacker/horizon,zouyapeng/horizon,nvoron23/avos,mrunge/horizon,... | openstack_dashboard/views.py | openstack_dashboard/views.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | apache-2.0 | Python |
b4afa00760f7f410ecff80d2aae008b98595af34 | Create Python file | michaelhogg/sublime-character-info | character_info.py | character_info.py | import sublime, sublime_plugin, unicodedata
# Needed because unicodedata.name() doesn't return names of control characters
# See stackoverflow.com/questions/24552786/why-doesnt-unicodedata-recognise-certain-characters
UNNAMED_CONTROL_CHARS = {
0x00: 'NULL',
0x01: 'START OF HEADING',
0x02: 'START OF TEXT',
... | mit | Python | |
207314d4d0f4ceb19c818d0aad692b37cfd17085 | Add first version of instagram-scraper | ransomwarezz/instagram-scraper | instagram-scraper.py | instagram-scraper.py | import time
from selenium import webdriver
from selenium.common.exceptions import StaleElementReferenceException
def isUserLink(link):
address = link.get_attribute('href')
parent = link.find_element_by_xpath('..')
return "/accounts/" not in address and \
"/p/" not in address and \
"... | mit | Python | |
d764e51b7d2503d645912a25df93fc1287c111de | Create smsmasking.py | agusmakmun/Some-Examples-of-Simple-Python-Script,agusmakmun/Some-Examples-of-Simple-Python-Script | sms/smsmasking.py | sms/smsmasking.py | import sys
import json
import requests
URL_API = 'http://smsmasking.ca/api.html'
def sendSMS(sender, number, message):
message_data = {
'sender' : sender,
'number' : number,
'message': message
}
response = requests.post(url=URL_API, data=message_data)
status_code = resp... | agpl-3.0 | Python | |
9808240497055d3d2068bfeaf01ba9b43030b099 | add test case for password policy test | hglkrijger/azure-linux-automation,Nidylei/azure-linux-automation,hglkrijger/azure-linux-automation,iamshital/azure-linux-automation,iamshital/azure-linux-automation,Nidylei/azure-linux-automation,konkasoftci/azure-linux-automation,konkasoftci/azure-linux-automation,v-sirebb/azure-linux-automation,v-sirebb/azure-linux-a... | remote-scripts/ICA-PASSWD-POLICY-TEST.py | remote-scripts/ICA-PASSWD-POLICY-TEST.py | #! /usr/bin/env python
from azuremodules import *
from subprocess import Popen, PIPE
from collections import OrderedDict
import sys
import platform
import string
import random
if(len(sys.argv) == 1):
RunLog.error('please specify the origin vm password.')
exit()
else:
origin_password = sys.argv[1]
allowed_min_len_p... | apache-2.0 | Python | |
de11769c861532c8655e90e1b8c0e9d04606adbc | Create __init__.py | stuycs-softdev-fall-2013/proj2-pd6-04-omnithinker,stuycs-softdev-fall-2013/proj2-pd6-04-omnithinker,stuycs-softdev-fall-2013/proj2-pd6-04-omnithinker | omnithinker/api/__init__.py | omnithinker/api/__init__.py | mit | Python | ||
a82f213bd4ec1d135d39381235df4657ea8de531 | add otimizier | cigroup-ol/metaopt,cigroup-ol/metaopt,cigroup-ol/metaopt | orges/optimizer/optimizer.py | orges/optimizer/optimizer.py | """
Abstract optimizer defining the API of optimizer implementations.
"""
import abc # Abstract Base Class
class Optimizer(object):
"""Abstract invoker managing calls to ."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self):
pass
@abc.abstractmethod
def optimize(... | bsd-3-clause | Python | |
4bbaee0015beeb55e0ec3538fe89c14a0e25dcdd | Add script to fill mongodb | fact-project/aux2mongodb | aux2mongodb/__main__.py | aux2mongodb/__main__.py | '''
Usage:
aux2mongodb [options]
Options:
--services=<s> Comma Separated list of services to store in the mongodb
If not given, all supported services are stored
--begin=<date> First date to fill into the database [default: 2016-01-01]
--end=<date> Last date to fill... | mit | Python | |
47760ee426f55eae2968db4fad7a8e79c5f168cb | solve 13 Roman to Integer | brettchien/LeetCode | 13_RomanToInteger.py | 13_RomanToInteger.py | class Solution:
# @param {string} s
# @return {integer}
def romanToInt(self, s):
ROMAN_NUM = {
"I": 1,
"V": 5,
"X": 10,
"L": 50,
"C": 100,
"D": 500,
"M": 1000}
result = 0
f... | mit | Python | |
085d280f450b6516d377bd7f7dbdbbd5004cd963 | Add backkwards-compatible Bankcard class factory | QLGu/django-oscar,kapt/django-oscar,Idematica/django-oscar,anentropic/django-oscar,Bogh/django-oscar,nickpack/django-oscar,saadatqadri/django-oscar,jmt4/django-oscar,michaelkuty/django-oscar,bnprk/django-oscar,sonofatailor/django-oscar,thechampanurag/django-oscar,kapari/django-oscar,nfletton/django-oscar,nickpack/djang... | oscar/apps/payment/utils.py | oscar/apps/payment/utils.py | import warnings
from . import models
def Bankcard(card_number, expiry_date, name=None,
cvv=None, start_date=None, issue_number=None):
# This odd looking thing is to handle backwards compatibility with Oscar
# 0.5 where the Bankcard class wasn't a model and lived in this utils
# module. As o... | bsd-3-clause | Python | |
6866f3679704acac8430a77afb44fad618d18102 | Add startups.spiders | clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage | garage/startups/spiders.py | garage/startups/spiders.py | """Initialize garage.spiders."""
__all__ = [
'SPIDER',
'SPIDER_PARSER',
'init'
]
from startup import startup
import garage.spiders
from garage.functools import run_once
from garage.spiders import Spider
from garage.startups import ARGS, PARSE, PARSER
from garage.startups import components
from garage.st... | mit | Python | |
a1e5ebded1a44480dd71bdb267087683cf330a67 | Add class to store caption data | glut23/webvtt-py,sampattuzzi/webvtt-py | webvtt/generic.py | webvtt/generic.py |
class Caption(object):
def __init__(self, start, end, lines=None):
self.start = start
self.end = end
self.lines = lines or []
def add_line(self, line):
self.lines.append(line) | mit | Python | |
a9e2b9ec16e15267d812b0148a014dde6e3db64c | Add msisdn util file | matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse,matrix-org/synapse | synapse/util/msisdn.py | synapse/util/msisdn.py | # -*- coding: utf-8 -*-
# Copyright 2015, 2016 OpenMarket Ltd
# Copyright 2017 Vector Creations Ltd
#
# 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/LICE... | apache-2.0 | Python | |
72a82455ba75d49b2deed5e3b9481fb90f15902d | Add mysql_query script | innogames/igcollect | src/mysql_query.py | src/mysql_query.py | #!/usr/bin/env python
#
# igcollect - Mysql query results
#
# This script executes a single query and prints the results. The columns
# returned by the query are going to be appended to the given prefix.
# The query must return numeric values.
#
# Copyright (c) 2017, InnoGames GmbH
#
from __future__ import print_funct... | mit | Python | |
ae56997ed0c26b787c637a805aee3f4bbb3389a0 | Add the package_manager_provider file | GoogleContainerTools/base-images-docker,dlorenc/debian-docker,GoogleContainerTools/base-images-docker,dlorenc/debian-docker | package_managers/package_manager_provider.bzl | package_managers/package_manager_provider.bzl | #Copyright 2017 Google Inc. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agree... | apache-2.0 | Python | |
b35c5b01316d580cc2f90ccc01fc286057c5e333 | Create folders and __init__.py | abeoliver/ReverseLearning | Data/__init__.py | Data/__init__.py | mit | Python | ||
37e3b8dce76c17a85db30e94b61f8f181de2b983 | Add tests for PysbAssembler | sorgerlab/belpy,johnbachman/indra,sorgerlab/belpy,sorgerlab/indra,pvtodorov/indra,jmuhlich/indra,pvtodorov/indra,johnbachman/belpy,pvtodorov/indra,sorgerlab/indra,johnbachman/belpy,bgyori/indra,johnbachman/indra,sorgerlab/indra,johnbachman/indra,jmuhlich/indra,jmuhlich/indra,sorgerlab/belpy,johnbachman/belpy,pvtodorov/... | indra/tests/test_pysb_assembler.py | indra/tests/test_pysb_assembler.py | from indra.pysb_assembler import PysbAssembler
from indra.statements import *
def test_pysb_assembler_phos1():
enz = Agent('BRAF')
sub = Agent('MEK1')
stmt = Phosphorylation(enz, sub, 'PhosphorylationSerine', '222', '', '', '', '')
pa = PysbAssembler()
pa.add_statements([stmt])
model = pa.make_... | bsd-2-clause | Python | |
12941a5d1e0bd48576065e182e2325aa7c09794d | 更新 models Group, 將 logo 欄位改用 groups_get_random_filename() 來處理儲存位置 | yrchen/CommonRepo,yrchen/CommonRepo,yrchen/CommonRepo,yrchen/CommonRepo | commonrepo/groups/migrations/0007_auto_20160122_0706.py | commonrepo/groups/migrations/0007_auto_20160122_0706.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import commonrepo.groups.models
class Migration(migrations.Migration):
dependencies = [
('groups', '0006_group_logo'),
]
operations = [
migrations.AlterField(
model_name=... | apache-2.0 | Python | |
aea4f35e51f244ad191de37ca0f634b4917ae78d | Test part 1 of day 7. | machinelearningdeveloper/aoc_2016 | 07/test_address.py | 07/test_address.py | import unittest
from address import has_reflection, is_compatible
class TestAddress(unittest.TestCase):
def test_has_reflection(self):
assert has_reflection(['mnop']) == False
assert has_reflection(['abba', 'qrst']) == True
def test_is_compatible(self):
assert is_compatible('abba[mno... | mit | Python | |
367192aa0b1f928597c66dddbafcc82f13667219 | Create GameOfThrones_II.py | tejasnikumbh/Algorithms,tejasnikumbh/Algorithms,tejasnikumbh/Algorithms | Strings/GameOfThrones_II.py | Strings/GameOfThrones_II.py | import math;
def getNumAnag(strDict):
num = 0;
denom = [];
for i in strDict:
num += strDict[i];
if(strDict[i]!=0):
denom.append(strDict[i]);
numFact = math.factorial(num);
denomFact = 1;
for i in range(len(denom)):
denomFact *= math.factorial(denom[i]);
resu... | bsd-2-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.