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 |
|---|---|---|---|---|---|---|---|---|
cc89c5222ec7f6d6f95b5efdce3958b3ca33814e | Add basic functionality and regression tests for ACA dark cal module | sot/mica,sot/mica | mica/archive/tests/test_aca_dark_cal.py | mica/archive/tests/test_aca_dark_cal.py | """
Basic functionality and regression tests for ACA dark cal module.
"""
import numpy as np
from ..aca_dark import dark_cal
def test_date_to_dark_id():
assert dark_cal.date_to_dark_id('2011-01-15T12:00:00') == '2011015'
def test_dark_id_to_date():
assert dark_cal.dark_id_to_date('2011015') == '2011:015'
... | bsd-3-clause | Python | |
dd3ed1c8fdf9024a7978a1443baf8ca101f21642 | add demo object for channel | ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study | server/Mars/MarsRpc/ChannelObjs.py | server/Mars/MarsRpc/ChannelObjs.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2016 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyrig... | bsd-2-clause | Python | |
160a3012db5513b4d3a45098a9b0b72e1f117b20 | add a constant coefficient test for sanity | zingale/pyro2,zingale/pyro2,harpolea/pyro2,harpolea/pyro2 | lowmach/mg_constant_test.py | lowmach/mg_constant_test.py | #!/usr/bin/env python
"""
Test the variable coefficient MG solver with a CONSTANT coefficient
problem -- the same on from the multigrid class test. This ensures
we didn't screw up the base functionality here.
We solve:
u_xx + u_yy = -2[(1-6x**2)y**2(1-y**2) + (1-6y**2)x**2(1-x**2)]
u = 0 on the boundary
this is t... | bsd-3-clause | Python | |
81b9d141295ee2a8b31974aa86d89b80dfefe3ca | Create question5.py | pythonzhichan/DailyQuestion,pythonzhichan/DailyQuestion | chengjun/question5.py | chengjun/question5.py | #!usr/bin/python
import re
class extrac_url():
def __init__(self,url):
self.url = url
def pater(self):
url = self.url
[scheme1,url_rest] = url.split('//')
scheme = re.search(r'(.+)//',url).group(1)
#print "scheme is %s " % scheme
netloc = re.search(r'//(.+)/',url).group(1)
#print "netloc is %s " % netl... | mit | Python | |
5eefc407b8f51c017a3f4193c88f6dc188a88601 | Include OpenCV based Python CLAHE script | seung-lab/Julimaps,seung-lab/Julimaps | src/CLAHE_dir.py | src/CLAHE_dir.py | from PIL import Image
import numpy as np
import h5py
import os
import sys
import cv2
# Maybe consider implemeting more involved auto-balancing
# http://wiki.cmci.info/documents/120206pyip_cooking/python_imagej_cookbook#automatic_brightnesscontrast_button
def apply_clahe_to_H5(fn, clahe):
f = h5py.File(fn, "r+")
img... | mit | Python | |
f0af14b8fcd420b63a47e18938664e14cf9ea968 | Add generic asynchronous/synchronous run command | CanonicalLtd/subiquity,CanonicalLtd/subiquity | subiquity/utils.py | subiquity/utils.py | # Copyright 2015 Canonical, Ltd.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... | agpl-3.0 | Python | |
2aab90ab9e4a32bef1496149a2780b7385318043 | Add tests | bjodah/symengine.py,symengine/symengine.py,bjodah/symengine.py,symengine/symengine.py,symengine/symengine.py,bjodah/symengine.py | symengine/tests/test_cse.py | symengine/tests/test_cse.py | from symengine import cse, sqrt, symbols
def test_cse_single():
x, y, x0 = symbols("x, y, x0")
e = pow(x + y, 2) + sqrt(x + y)
substs, reduced = cse([e])
assert substs == [(x0, x + y)]
assert reduced == [sqrt(x0) + x0**2]
def test_multiple_expressions():
w, x, y, z, x0 = symbols("w, x, y, z, ... | mit | Python | |
5a21b66f7ab77f419245d8c07d7473a6e1600fc4 | Add crawler for 'Hark, A Vagrant' | jodal/comics,jodal/comics,klette/comics,datagutten/comics,datagutten/comics,datagutten/comics,klette/comics,klette/comics,jodal/comics,jodal/comics,datagutten/comics | comics/crawler/crawlers/harkavagrant.py | comics/crawler/crawlers/harkavagrant.py | from comics.crawler.base import BaseComicCrawler
from comics.crawler.meta import BaseComicMeta
class ComicMeta(BaseComicMeta):
name = 'Hark, A Vagrant!'
language = 'en'
url = 'http://www.harkavagrant.com/'
start_date = '2008-05-01'
history_capable_days = 120
schedule = 'Mo,Tu,We,Th,Fr,Sa,Su'
... | agpl-3.0 | Python | |
2f188d3d43741821126e381af9753e0e3d7be231 | test hello python file | rryqszq4/ngx_python,rryqszq4/ngx_python,rryqszq4/ngx_python | t/library/hello.py | t/library/hello.py | import ngx
ngx.echo("Hello, Ngx_python\n") | bsd-2-clause | Python | |
c2a0b66ec1ad7f32e1291fc6a2312d2a4a06a6e3 | Add class-file to right location | python-technopark/MoneyMoney | src/mmhandler.py | src/mmhandler.py | class MmHandler:
pass
| mit | Python | |
aa096865f425a57ccbde51d0586be8a07403a6bd | Add migration for BoundarySet start/end see #25 | datamade/represent-boundaries,datamade/represent-boundaries,opencorato/represent-boundaries,datamade/represent-boundaries,opencorato/represent-boundaries,opencorato/represent-boundaries | boundaries/south_migrations/0005_add_set_start_end_date.py | boundaries/south_migrations/0005_add_set_start_end_date.py | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'BoundarySet.start_date'
db.add_column(u'boundaries_bounda... | mit | Python | |
4f155252bf9d9508b955d7eecf589da347bff817 | Add a setup.cfg. | adam-incuna/imperial-painter,adam-thomas/imperial-painter,adam-incuna/imperial-painter,adam-thomas/imperial-painter | setup.py | setup.py | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="imperial-painter-adam-thomas",
version="1.0.0",
author="Adam Thomas",
author_email="sortoflikechess@gmail.com",
description="A tool for generating prototype cards from Excel file... | mit | Python | |
f874c337e0d0bb8cce8cfe6523c0d06c37b93198 | add basic setup.py definition | juannyG/django-rest-framework-saasy,pombredanne/django-rest-framework-saasy | setup.py | setup.py | from distutils.core import setup
setup(
name='SaasyDjangoRestFramework',
version='0.1dev',
packages=[],
license='Creative Commons Attribution-Noncommercial-Share Alike license',
description="SaaS plugin for the django rest framework",
)
| mit | Python | |
63143c94cef353d7bae13f7b13650801bb901c94 | Test for explicit start/end args to str methods for unicode. | hiway/micropython,martinribelotta/micropython,tdautc19841202/micropython,supergis/micropython,torwag/micropython,pfalcon/micropython,galenhz/micropython,TDAbboud/micropython,kerneltask/micropython,heisewangluo/micropython,kerneltask/micropython,pozetroninc/micropython,ericsnowcurrently/micropython,ernesto-g/micropython... | tests/unicode/unicode_pos.py | tests/unicode/unicode_pos.py | # str methods with explicit start/end pos
print("Привет".startswith("П"))
print("Привет".startswith("р", 1))
print("абвба".find("а", 1))
print("абвба".find("а", 1, -1))
| mit | Python | |
601fd8a7b4fea5db2f23741735e6e7f1332b4417 | Fix issue #949 - Add mock as dependency | spulec/moto,Affirm/moto,Affirm/moto,botify-labs/moto,Affirm/moto,botify-labs/moto,kefo/moto,whummer/moto,dbfr3qs/moto,william-richard/moto,Brett55/moto,william-richard/moto,botify-labs/moto,botify-labs/moto,spulec/moto,ZuluPro/moto,Brett55/moto,william-richard/moto,ZuluPro/moto,kefo/moto,spulec/moto,Brett55/moto,whumme... | setup.py | setup.py | #!/usr/bin/env python
from __future__ import unicode_literals
from setuptools import setup, find_packages
install_requires = [
"Jinja2>=2.8",
"boto>=2.36.0",
"boto3>=1.2.1",
"cookies",
"requests>=2.0",
"xmltodict",
"dicttoxml",
"six",
"werkzeug",
"pyaml",
"pytz",
"python... | #!/usr/bin/env python
from __future__ import unicode_literals
from setuptools import setup, find_packages
install_requires = [
"Jinja2>=2.8",
"boto>=2.36.0",
"boto3>=1.2.1",
"cookies",
"requests>=2.0",
"xmltodict",
"dicttoxml",
"six",
"werkzeug",
"pyaml",
"pytz",
"python... | apache-2.0 | Python |
84c1ee14e1717ec63782dd5a159fe5848fce1cc4 | Add Python 3.6 and 3.7 to PyPI page | fkazimierczak/bottle,oz123/bottle,oz123/bottle,bottlepy/bottle,bottlepy/bottle,defnull/bottle,fkazimierczak/bottle,ifduyue/bottle,ifduyue/bottle,defnull/bottle | setup.py | setup.py | #!/usr/bin/env python
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.version_info < (2, 7):
raise NotImplementedError("Sorry, you need at least Python 2.7 or Python 3.2+ to use bottle.")
import bottle
setup(name='bottle',
version=bottle.__v... | #!/usr/bin/env python
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.version_info < (2, 7):
raise NotImplementedError("Sorry, you need at least Python 2.7 or Python 3.2+ to use bottle.")
import bottle
setup(name='bottle',
version=bottle.__v... | mit | Python |
f539736b563fb6859a6bffb03aed42b57880744f | create module | danzipie/aau-community-detection | test_vbn_parser.py | test_vbn_parser.py | import networkx as nx
import matplotlib.pyplot as plt
import vbn_parser as p
# initialize
G = nx.Graph()
link = 'http://vbn.aau.dk/da/organisations/antennas-propagation-and-radio-networking(c2c38bb3-3d28-4b2c-8bc4-949211d2d486)/publications.rss?altordering=publicationOrderByPublicationYearThenCreated&pageSize=500'
# ... | mit | Python | |
30fc52d77170844c5b3820d997286df744eb56db | Add setup.py for packaging and PyPI submission. | kozz/hsalf | setup.py | setup.py | from setuptools import setup
name = 'hsalf'
setup(
name=name,
version='0.0.1',
author='Nam T. Nguyen',
author_email='namn@bluemoon.com.vn',
url='https://bitbucket.org/namn/hsalf/overview',
description='Hsalf is a pure Python library to read and write Flash files (SWF).',
long_descri... | mit | Python | |
d433d16a0375669c1664bbe8f20a8db5924fa92e | Add basic benchmark for length | alvinlindstam/grapheme | tests/benchmark.py | tests/benchmark.py | from random import choice
from string import ascii_lowercase
import timeit
import grapheme
def random_ascii_string(n):
return "".join(choice(ascii_lowercase) for i in range(n))
long_ascii_string = random_ascii_string(1000)
statements = [
"len(long_ascii_string)",
"grapheme.length(long_ascii_string)",
]
... | mit | Python | |
dd015a7bf9c69e2f96488c9239be694303b30176 | Create setup.py | shenweichen/DeepCTR | setup.py | setup.py | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="deepctr",
version="0.1.3",
author="Weichen Shen",
author_email="wcshen1994@163.com",
description="DeepCTR is a Easy-to-use,Modular and Extendible package of deep-learning based CTR models ... | apache-2.0 | Python | |
5a2a2aa33a2e206042b3d28a830d00bdae2f5ad8 | Add setup.py for distribution | Pringley/rw | setup.py | setup.py | from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
setup(
name = "rw",
version = "0.0.1",
packages = find_packages(),
scripts = ['scripts/rw'],
install_requires = ['docopt'],
author = "Ben Pringle",
author_email = "ben.pringle@gmail.com",
... | mit | Python | |
91affa8b785e0b5261f69448c1c08de429460bb9 | Add setup.py | lamby/django-yadt | setup.py | setup.py | from setuptools import setup
setup(
name='django-yadt',
packages=(
'django_yadt',
'django_yadt.management',
'django_yadt.management.commands',
),
)
| bsd-3-clause | Python | |
631afff160077cc629054613d59cb47747f6c20d | Fix setup to exclude tests | superdesk/superdesk-core,nistormihai/superdesk-core,superdesk/superdesk-core,sivakuna-aap/superdesk-core,ancafarcas/superdesk-core,akintolga/superdesk-core,petrjasek/superdesk-core,petrjasek/superdesk-core,mdhaman/superdesk-core,ioanpocol/superdesk-core,ioanpocol/superdesk-core,mdhaman/superdesk-core,superdesk/superdes... | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014, 2015 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/sup... | #!/usr/bin/env python
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014, 2015 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/sup... | agpl-3.0 | Python |
5b251911d112abea610477a3f552a78be6b5b1e1 | add utils module | ojengwa/gfe | utils.py | utils.py | from flask import Response, request
def add_basic_auth(blueprint, username, password, realm='RQ Dashboard'):
'''Add HTTP Basic Auth to a blueprint.
Note this is only for casual use!
'''
@blueprint.before_request
def basic_http_auth(*args, **kwargs):
auth = request.authorization
if ... | mit | Python | |
70ad81a24e218fd2b5fed03224611eae63e0d58f | add main argument processing file | Zumium/boxes | boxes/argsParse.py | boxes/argsParse.py | import argparse
| apache-2.0 | Python | |
a633cc0b4ee376ff02af101154e60b8b33dfda08 | add migration for old logs | mfraezz/osf.io,alexschiller/osf.io,laurenrevere/osf.io,felliott/osf.io,CenterForOpenScience/osf.io,laurenrevere/osf.io,pattisdr/osf.io,crcresearch/osf.io,Nesiehr/osf.io,saradbowman/osf.io,cwisecarver/osf.io,monikagrabowska/osf.io,cslzchen/osf.io,Johnetordoff/osf.io,mluo613/osf.io,felliott/osf.io,baylee-d/osf.io,leb2dg/... | scripts/migrate_preprint_logs.py | scripts/migrate_preprint_logs.py | import sys
import logging
from datetime import datetime
from modularodm import Q
from modularodm.exceptions import NoResultsFound
from website.app import init_app
from website.models import NodeLog, PreprintService
logger = logging.getLogger(__name__)
def main(dry):
if dry:
logging.warn('DRY mode runni... | apache-2.0 | Python | |
caf2d7108d7329da562a012775bac0a87d4c62b6 | Create db_create.py | rockwolf/python,rockwolf/python,rockwolf/python,rockwolf/python,rockwolf/python,rockwolf/python | fade/db_create.py | fade/db_create.py | #!flask/bin/python
"""
See LICENSE.txt file for copyright and license details.
"""
from migrate.versioning import api
from config import SQLALCHEMY_DATABASE_URI
from config import SQLALCHEMY_MIGRATE_REPO
from app import db
import os.path
db.create_all()
if not os.path.exists(SQLALCHEMY_MIGRATE_REPO):
api.crea... | bsd-3-clause | Python | |
f6f75172b1b8a41fc5ae025416ea665258d4ff4c | Add script for updating favicon from gh avatar | Sorashi/sorashi.github.io | favicon-update.py | favicon-update.py | from PIL import Image
import requests
from io import BytesIO
# This whole script was done using Google and StackOverflow
# How to generate ico files
# https://stackoverflow.com/a/36168447/1697953
# How to get GitHub avatar location from username
# https://stackoverflow.com/a/36380674/1697953
# How to read image data f... | mit | Python | |
75031595de8726dcd21535b13385c4e6c89aa190 | Add run meter task | impactlab/oeem-energy-datastore,impactlab/oeem-energy-datastore,impactlab/oeem-energy-datastore | datastore/tasks.py | datastore/tasks.py | from __future__ import absolute_import
from celery import shared_task
from datastore.models import Project
@shared_task
def run_meter(project_pk):
project = Project.objects.get(pk=project_pk):
project.run_meter()
| mit | Python | |
3ed6a0e337c99d12fb4abd96b2230e13388289e7 | Add tests for Process functionality. | Jarn/jarn.mkrelease | jarn/mkrelease/tests/test_process.py | jarn/mkrelease/tests/test_process.py | import unittest
import os
from jarn.mkrelease.process import Process
from jarn.mkrelease.testing import JailSetup
from jarn.mkrelease.testing import quiet
class PopenTests(unittest.TestCase):
@quiet
def test_simple(self):
process = Process()
rc, lines = process.popen('echo "Hello world"')
... | bsd-2-clause | Python | |
27c5a09ddbe2ddf14b2f4c84ebb668adbdfd7070 | ADD example.basicserver for test | thislight/wood,thislight/wood | example/basicserver.py | example/basicserver.py |
from wood import Wood
w = Wood(__name__,debug=True)
IndexHandler = w.empty(uri='/',name='IndexHandler')
@IndexHandler.get
def index_page(self):
self.write('滑稽,这里什么都没有\n(HuajiEnv)')
if __name__ == '__main__':
w.start(port=6000)
| apache-2.0 | Python | |
537bb46c6806ef69ab3022641a76f50f97630e11 | Add first migration: Create the database tables. | klmitch/boson | boson/db/sqlalchemy/alembic/versions/1f22e3c5ff66_initial_revision.py | boson/db/sqlalchemy/alembic/versions/1f22e3c5ff66_initial_revision.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 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/... | apache-2.0 | Python | |
8049e2f0bb0a12bb301ab4390c3e4da3d90f0369 | Move stagingsettings to new 'cosmos' project tree | telefonicaid/fiware-cosmos-platform,telefonicaid/fiware-cosmos-platform,telefonicaid/fiware-cosmos-platform,telefonicaid/fiware-cosmos-platform,telefonicaid/fiware-cosmos-platform | cosmos/platform/frontend/src/bdp_fe/conf/stagingsettings.py | cosmos/platform/frontend/src/bdp_fe/conf/stagingsettings.py | """
Module testsettings
These settings allow Django unittests to setup a temporary databse and run the
tests of the installed applications.
"""
DEBUG = True
TEMPLATE_DEBUG = DEBUG
from bdp_fe.conf.base_settings import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ... | apache-2.0 | Python | |
1b8edd0d6ce3f66c8bacad8bad62de0d40284799 | Add dodge game example | JoeGlancy/micropython,JoeGlancy/micropython,JoeGlancy/micropython | examples/dodge_game.py | examples/dodge_game.py | """
Dodge game
Get the player back and forth across the screen while dodging the enemy
"""
from microbit import *
import music
class Enemy:
"""
Enemy which moves vertically down the screen
"""
def __init__(self):
self.x, self.y = 2, -1
def get_positions(self):
return ((self.x, s... | mit | Python | |
70d912bfb1ccec03edfe92b9b2c87610346c8f42 | Add blocking migration for new domain db | dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq | corehq/doctypemigrations/migrations/0006_domain_migration_20151118.py | corehq/doctypemigrations/migrations/0006_domain_migration_20151118.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from corehq.doctypemigrations.djangomigrations import assert_initial_complete
from corehq.doctypemigrations.migrator_instances import domains_migration
class Migration(migrations.Migration):
dependencies = [
... | bsd-3-clause | Python | |
0378f8cde69a18d954341b861a724592ef7a5949 | Extend RANSAC example with comparison to BaggingRegressor | murali-munna/scikit-learn,gotomypc/scikit-learn,mattilyra/scikit-learn,fzalkow/scikit-learn,Srisai85/scikit-learn,ChanderG/scikit-learn,3manuek/scikit-learn,loli/sklearn-ensembletrees,jorge2703/scikit-learn,trungnt13/scikit-learn,mugizico/scikit-learn,schets/scikit-learn,terkkila/scikit-learn,sanketloke/scikit-learn,ne... | examples/linear_model/plot_ransac.py | examples/linear_model/plot_ransac.py | """
===========================================
Robust linear model estimation using RANSAC
===========================================
In this example we see how to robustly fit a linear model to faulty data using
the RANSAC algorithm.
"""
import numpy as np
from matplotlib import pyplot as plt
from sklearn import ... | """
===========================================
Robust linear model estimation using RANSAC
===========================================
In this example we see how to robustly fit a linear model to faulty data using
the RANSAC algorithm.
"""
import numpy as np
from matplotlib import pyplot as plt
from sklearn import ... | bsd-3-clause | Python |
d0e5ea752912b10e473b2a05da9196800eb6ca86 | Add an example for the RedisLock | dieseldev/diesel | examples/redis_lock.py | examples/redis_lock.py | import random
from diesel import fork, quickstop, quickstart, sleep
from diesel.protocols.redis import RedisClient, RedisTransactionError, RedisLock, LockNotAcquired
"""Implement the Redis INCR command using a lock. Obviously this is inefficient, but it's a good
example of how to use the RedisLock class"""
key = 't... | bsd-3-clause | Python | |
d0b8c68ae3c8acbc3d5dfe13842e3c41a198b978 | Add script to fix all notions | l-vincent-l/alignements_backend | fix_notions_db.py | fix_notions_db.py | from alignements_backend.db import DB
from alignements_backend.notion import Notion
for notion in DB.scan_iter(match='notion:*'):
n = Notion(list(DB.sscan_iter(notion)))
| mit | Python | |
ad6e0bad22b0c5b0e6f97ceb13694ab804041443 | Add model resources. | GeneralMaximus/secondhand | tracker/api.py | tracker/api.py | from tastypie.resources import ModelResource
from tracker.models import Task, WorkSession
from django.contrib.auth.models import User
from tastypie import fields
class UserResource(ModelResource):
class Meta:
queryset = User.objects.all()
resource_name = 'user'
class TaskResource(ModelResource):... | mit | Python | |
8f05695a153eef415f752c42c2f737de3f120b55 | Create dgen_red_a.py | kyanyoga/iot_kafka_datagen | bin/dgen_red_a.py | bin/dgen_red_a.py | #!/usr/bin/env python
"""
Created on March 4, 2016
@author: Gus Segura
"""
# imports
import time
import random
import base64
import os
import sys
import math
import json
import redis
from collections import OrderedDict
# redis server connection
# Connection to Database: this is how we work with Redis
database = redis... | mit | Python | |
c97680113fb25ed43e96c26d02bfd57e15e427b8 | Add missing migrations | opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor | nodeconductor/billing/migrations/0004_invoice_usage_pdf.py | nodeconductor/billing/migrations/0004_invoice_usage_pdf.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('billing', '0003_invoice_status'),
]
operations = [
migrations.AddField(
model_name='invoice',
name='... | mit | Python | |
e456e4799f5cee13ce1b5f93a9cc91b28059db16 | Remove tests that use real data from the individual inferred test | e-mission/e-mission-server,e-mission/e-mission-server,shankari/e-mission-server,shankari/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server,shankari/e-mission-server,e-mission/e-mission-server | emission/individual_tests/TestMetricsInferredSections.py | emission/individual_tests/TestMetricsInferredSections.py | from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import *
import unittest
import logging
import arrow
import os
import emission.core.g... | bsd-3-clause | Python | |
321463a5d7f102431ed286d57d1a8fa8c576cca7 | add plotting fns | dharhas/terrapin | terrapin/plot.py | terrapin/plot.py | import matplotlib.pyplot as plt
def flow_grid(dem, angles):
pass | bsd-2-clause | Python | |
ed23fb301503d331af243a37d1b0a934d5d2f21c | add laser plugin object | b-mueller/mythril,b-mueller/mythril,b-mueller/mythril,b-mueller/mythril | mythril/laser/ethereum/plugins/plugin.py | mythril/laser/ethereum/plugins/plugin.py | from mythril.laser.ethereum.svm import LaserEVM
class LaserPlugin:
""" Base class for laser plugins
Functionality in laser that the symbolic execution process does not need to depend on
can be implemented in the form of a laser plugin.
Laser plugins implement the function initialize(symbolic_vm) whi... | mit | Python | |
550469032843eb2af3b4a9faaed34d9754f00700 | Add command to test managers emails | mabhub/Geotrek,camillemonchicourt/Geotrek,mabhub/Geotrek,Anaethelion/Geotrek,makinacorpus/Geotrek,mabhub/Geotrek,Anaethelion/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,Anaethelion/Geotrek,Anaethelion/Geotrek,camillemonchicourt/Geotrek,johan--/Geotrek,GeotrekCE/Geot... | geotrek/common/management/commands/test_managers_emails.py | geotrek/common/management/commands/test_managers_emails.py | from django.core.mail import mail_managers
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = "Test if email settings are OK by sending mail to site managers"
def execute(self, *args, **options):
subject = u'Test email for managers'
message = u'If you rece... | bsd-2-clause | Python | |
edb9500824faffd9f1d0d1b59ca29966e3b18282 | Customize behave formatter to output json | avidas/reliability-demo | modules/formatter_record.py | modules/formatter_record.py | from behave.formatter.json import PrettyJSONFormatter
from pprint import pprint
class RecordFormatter(PrettyJSONFormatter):
name = "super"
description = "Formatter for adding REST calls to JSON output."
jsteps = {} # Contains an array of features, that contains array of steps in each feature
# Overrid... | mit | Python | |
def7e3aeaf3b0cd1a6486c72c68a3baad77ef3e5 | Create leetcode-50.py | jeremykid/FunAlgorithm,jeremykid/FunAlgorithm,jeremykid/FunAlgorithm,jeremykid/FunAlgorithm | python_practice/leetCode/leetcode-50.py | python_practice/leetCode/leetcode-50.py | class Solution:
def myPow(self, x: 'float', n: 'int') -> 'float':
return x**n
def myPow2(self, x: 'float', n: 'int') -> 'float':
if n == 0:
return 1
if n < 0:
n = 0-n
x = 1/x
return x**(n%2)*myPow2(x*x, n//2)
| mit | Python | |
71e431a5eccc6483847888fb0f8f5f30f182913a | add a script to convert xml documentation into json | GodotExplorer/godot-tools,GodotExplorer/godot-tools | doc/xmldoc2json.py | doc/xmldoc2json.py | #!/usr/bin/python
import sys
import xml.etree.ElementTree as ET
import json
def parseClass(data):
dictCls = dict(data.attrib)
dictCls['brief_description'] = data.find("brief_description").text.strip()
dictCls['description'] = data.find("description").text.strip()
dictCls['methods'] = []
for m in da... | mit | Python | |
4ca8d43d8e6ec243d9812bb313a8e7a21ad781ea | Add DB exercise. | bluedai180/PythonExercise,bluedai180/PythonExercise | Exercise/DB.py | Exercise/DB.py | import mysql.connector
conn = mysql.connector.connect(user='root', password='blue', database='test')
cursor = conn.cursor()
cursor.execute('create table user (id varchar(20) primary key, name varchar(20))')
cursor.execute('insert into user (id, name) values (%s, %s)', ['1', 'Dai'])
print(cursor.rowcount)
conn.commit(... | apache-2.0 | Python | |
c4e1e034a3f0be3590dc78c5683d9deaf44d696f | add example of escape character | AlanCoding/Ansible-inventory-file-examples,AlanCoding/Ansible-inventory-file-examples | scripts/escape/backslash.py | scripts/escape/backslash.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
'''
This tests the acceptance of backslashes
\\f should be okay
\f is not necessarily okay, because json.dumps will not dump this
'''
print json.dumps({
"foogroup": {
"hosts": [
"foobar"
]
},
"_meta": {
"hostvars... | mit | Python | |
c5c0d3f447b1295bdbbda60c38c4123f2e8d871c | add gnucash2ledger converter | MatzeB/pygnucash,MatzeB/pygnucash | gnucash2ledger.py | gnucash2ledger.py | #!/usr/bin/env python
import sys
import codecs
import gnucash
out = codecs.getwriter('UTF-8')(sys.stdout)
if len(sys.argv) == 1:
sys.stderr.write("Invocation: %s gnucash_filename\n" % sys.argv[0])
sys.exit(1)
data = gnucash.read_file(sys.argv[1])
def format_commodity(commodity):
mnemonic = commodity.mnemonic
try:... | bsd-2-clause | Python | |
bfbd2c792aacd307f8d7ed68ea0f2a7db681431d | add functions that generate mask image of the target bin | pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc | jsk_apc2016_common/python/jsk_apc2016_common/mask_bin.py | jsk_apc2016_common/python/jsk_apc2016_common/mask_bin.py | #!/usr/bin/env python
import numpy as np
from matplotlib.path import Path
import jsk_apc2016_common.segmentation_helper as helper
from tf2_geometry_msgs import do_transform_point
def get_mask_img(transform, target_bin, camera_model):
"""
:param point: point that is going to be transformed
:type point: Po... | bsd-3-clause | Python | |
852c6639bb0a71b9ef2dd81b2830193d0c9fe23d | Create FractalPoke.py | christopherkopic/FractalPoke-Blender3d | FractalPoke.py | FractalPoke.py | bl_info = {
"name": "FractalPoke",
"author": "Christopher Kopic",
"version": (1, 0),
"blender": (2, 7, 8),
"location": "",
"description": "Iterative Poking inspired by Simon Holmedal's Always Forever",
"warning": "",
"wiki_url": "",
"tracker_url": "",
"category": "Mesh"}
import bpy
from bpy.types import Ope... | mit | Python | |
2dff378e7f446e83aa7c105bded3f3330fe9fa20 | Add a script to generate a Javascript file encoding_<enc>.js containing encoding and decoding tables for the specified <enc> encoding. Uses Unicode table at location http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/<enc>.TXT. Related to issue #1541. | brython-dev/brython,brython-dev/brython,brython-dev/brython | scripts/make_encoding_js.py | scripts/make_encoding_js.py | """Create a Javascript script to encode / decode for a specific encoding
described in a file available at
http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/<ENCODING>.TXT
"""
import os
import re
import json
import urllib.request
line_re = re.compile("^(0x[A-Z0-9]+)\s+(0x[A-Z0-9]+)*", re.M)
tmpl = "http://uni... | bsd-3-clause | Python | |
f1c65cf208b4a6275214d82a765ad75c47c75715 | add example of how to use KT without defines | benvanwerkhoven/kernel_tuner | examples/cuda-c++/vector_add_defines.py | examples/cuda-c++/vector_add_defines.py | #!/usr/bin/env python
""" This is the example demonstrates how to use Kernel Tuner
to insert tunable parameters into template arguments
without using any C preprocessor defines
"""
import numpy as np
import kernel_tuner as kt
def tune():
kernel_string = """
template<typename T, int blockSize>
__global__ ... | apache-2.0 | Python | |
00cc1f17796897ca2f4351bbea74ee22aad98f14 | Create quadrants_HH_HL_LH_LL.py | jamaps/open_geo_scripts,jamaps/fun_with_gdal,jamaps/gdal_and_ogr_scripts,jamaps/shell_scripts,jamaps/open_geo_scripts,jamaps/open_geo_scripts,jamaps/gdal_and_ogr_scripts,jamaps/fun_with_gdal,jamaps/shell_scripts | quadrants_HH_HL_LH_LL.py | quadrants_HH_HL_LH_LL.py | # python3 for categorizing data into 4 quadrants from 2 numerical fields
# this case is for vis minoirty + avg income in Toronto census tracts
import csv
import statistics as st
# just the toronto cts
tor_cts = []
with open('ct_tor.csv', 'r') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
... | mit | Python | |
9dae55d2ef2e786799554ec2121cf9ecfe59eb62 | Rename file | gawkermedia/dnsdiff | dnsdiff/dnsdiff.py | dnsdiff/dnsdiff.py | '''Module to quickly look up and compare NS records for differences'''
import dns.resolver
import pprint
import sys
pp = pprint.PrettyPrinter(indent=4)
def compare_dns(nameservers, domain):
'''Compares records between nameservers using dnspython'''
responses = {}
resolver = dns.resolver.Resolver(configure=False)... | mit | Python | |
d3b4d53e84bdb1f50b244b282d6cb1b3b0d10ee3 | Add scraper | kqdtran/bearRec,kqdtran/bearRec | project/scrape.py | project/scrape.py | import requests
import re
from bs4 import BeautifulSoup
def main():
department_list = scrape()
department_scrape(department_list)
def scrape():
# Set up pull requests and soup object
front_html = requests.get("http://general-catalog.berkeley.edu/catalog/gcc_search_menu")
soup = BeautifulSoup(front_html.conte... | mit | Python | |
be189d9d01f916af87b45f36ac36f7c5d302dbbf | add an experimental command for setting the login background image | lyw07/kolibri,mrpau/kolibri,benjaoming/kolibri,learningequality/kolibri,indirectlylit/kolibri,benjaoming/kolibri,lyw07/kolibri,jonboiser/kolibri,DXCanas/kolibri,mrpau/kolibri,lyw07/kolibri,DXCanas/kolibri,jonboiser/kolibri,indirectlylit/kolibri,jonboiser/kolibri,indirectlylit/kolibri,indirectlylit/kolibri,mrpau/kolibri... | kolibri/content/management/commands/background.py | kolibri/content/management/commands/background.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import logging
import os
import shutil
from django.conf import settings
from django.core.management.base import BaseCommand
logger = logging.getLogger(__name__)
class Command(BaseCommand):
def a... | mit | Python | |
1f48fee7ffcef3eefa6aaedb5ca963c10bb7c58c | Add test case for user creation form | wldcordeiro/cookiecutter-django-essentials,wldcordeiro/cookiecutter-django-essentials,wldcordeiro/cookiecutter-django-essentials | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/users/test_forms.py | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/users/test_forms.py | from django.test import TestCase
from users.forms import ZionsUserCreationForm
from users.models import User
class {{cookiecutter.project_camel_name}}UserCreationTestCase(TestCase):
def setUp(self):
self.test_user = User.objects.create(
username='testuser',
email='test@test.com',
... | bsd-3-clause | Python | |
616bb27db3daef8939fe706d1c41cf79f35b40fa | set of default rules in common module | deztructor/parsed | common.py | common.py | #/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Denis Zalevskiy
# Licensed under MIT License
import string
from parser import *
def vspace(): return '\n\r', ignore
def hspace(): return ' \t', ignore
def eol(): return choice(eof, vspace), ignore
def space(): return ' \n\r\t', ignore
def spaces(): retur... | mit | Python | |
b8c4fdc1ebba18ab832160bece4ce8b391a15b7a | add sampled stochastic games serialization tests | deepmind/open_spiel,deepmind/open_spiel,deepmind/open_spiel,deepmind/open_spiel,deepmind/open_spiel,deepmind/open_spiel | open_spiel/python/tests/sampled_stochastic_games_test.py | open_spiel/python/tests/sampled_stochastic_games_test.py | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... | apache-2.0 | Python | |
ed9d640a11c02ca4b42e62d975e4ae9a2bd33093 | add tests for simtk! | dwhswenson/openpathsampling,openpathsampling/openpathsampling,choderalab/openpathsampling,choderalab/openpathsampling,openpathsampling/openpathsampling,openpathsampling/openpathsampling,dwhswenson/openpathsampling,dwhswenson/openpathsampling,dwhswenson/openpathsampling,openpathsampling/openpathsampling,choderalab/openp... | openpathsampling/experimental/storage/test_simtk_unit.py | openpathsampling/experimental/storage/test_simtk_unit.py | import pytest
import numpy as np
from ..simstore.custom_json import JSONSerializerDeserializer, DEFAULT_CODECS
from .simtk_unit import *
try:
from simtk import unit
except ImportError:
HAS_SIMTK = False
else:
HAS_SIMTK = True
class TestSimtkUnitCodec(object):
def setup(self):
pytest.importor... | mit | Python | |
4d85702561c000824083544de98693e244c8aab7 | Add test for decoder stack | Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide,Parisson/TimeSide | tests/test_decoding_stack.py | tests/test_decoding_stack.py | #! /usr/bin/env python
from __future__ import division
from timeside.decoder import FileDecoder
from timeside.analyzer import AubioPitch
from timeside.core import ProcessPipe
import numpy as np
from unit_timeside import *
import os.path
#from glib import GError as GST_IOError
# HINT : to use later with Gnonlin only... | agpl-3.0 | Python | |
40bf8d4773eb659ac2ac22aef50c2f63084924be | add profiler test case | tensorflow/community,tensorflow/community,tensorflow/community,tensorflow/community,tensorflow/community | rfcs/20200624-pluggable-device-for-tensorflow/sample/test_profiler.py | rfcs/20200624-pluggable-device-for-tensorflow/sample/test_profiler.py | #!/usr/bin/env python
# coding=utf-8
import tensorflow as tf
import numpy as np
import os
tf.compat.v1.disable_eager_execution()
profile_options = tf.profiler.experimental.ProfilerOptions(
host_tracer_level = 3,
devic... | apache-2.0 | Python | |
1670438ac9becf93e9ba428065e4b19b219e8ffc | Add WebSockets and SSL supports with Twisted :) | Relrin/Helenae,Relrin/Helenae,Relrin/Helenae | helenae/server.py | helenae/server.py | import sys
from json import dumps, loads
import sqlalchemy
from sqlalchemy.orm import sessionmaker
from db.create_db import Users
from twisted.internet import reactor, ssl
from twisted.python import log
from twisted.web.server import Site
from twisted.web.static import File
from autobahn.twisted.websocket import We... | mit | Python | |
3d0827fa805a08eaaaa07e037f6ce3da6d8e1c4e | add guess module | mrterry/yoink | yoink/guess.py | yoink/guess.py | import numpy as np
from scipy import ndimage
try:
from skimage.feature import corner_harris
from skimage.measure import approximate_polygon
except ImportError:
from yoink.mini_skimage import corner_harris, approximate_polygon
def guess_corners(bw):
"""
Infer the corners of an image using a Sobel ... | bsd-3-clause | Python | |
4ef2344b3abf3d8c0542ffd97425557ae092f21d | handle ZeroDivisionError | paolodedios/tensorflow,yongtang/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow,karllessard/tensorflow,tensorflow/tensorflow,paolodedios/tensorflow,yongtang/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow,gautam1858/tensorflow... | tensorflow/python/data/experimental/benchmarks/map_defun_benchmark.py | tensorflow/python/data/experimental/benchmarks/map_defun_benchmark.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 | Python |
ef96c4e1a27289f5cdad5de78ee2a2dfc1b91bd0 | Create network-delay-time.py | tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode | Python/network-delay-time.py | Python/network-delay-time.py | # Time: O((|E| + |V|) * log|V|)
# Space: O(|E| + |V|)
# Dijkstra's algorithm
class Solution(object):
def networkDelayTime(self, times, N, K):
"""
:type times: List[List[int]]
:type N: int
:type K: int
:rtype: int
"""
min_heap = []
adj = [[] for _ in ... | mit | Python | |
842d7337f236d94d1b7ed70aaa98eff73b4000cd | Create pyside_houdini.py | amitkhanna15/aov-manager | pyside_houdini.py | pyside_houdini.py | """
This module helps you use PyQt in Houdini's GUI by integrating PyQt's event
loop into Houdini's. Replace calls to QApplication.exec_() in your
code with calls to pyqt_houdini.exec_(app).
"""
from email.mime import image
import hou
from PySide import QtCore
from PySide import QtGui
class IntegratedEventLoop(object... | mit | Python | |
90ef0ed82a4d22f277ccc0c3275f0a07189fadc0 | Make title pictures. | pyoceans/seapy,pyoceans/seapy,pyoceans/seapy | title_pics.py | title_pics.py | # -*- coding: utf-8 -*-
#
# title_pics.py
#
# purpose: Create map and time-series for title
# author: Filipe P. A. Fernandes
# e-mail: ocefpaf@gmail
# web: http://ocefpaf.github.io/
# created: 20-Jan-2015
# modified: Tue 20 Jan 2015 11:18:15 AM BRT
#
# obs:
#
import matplotlib
import numpy as np
import car... | cc0-1.0 | Python | |
cf95ab6ee1bf53ff1a998824dc3718c1ae19336e | Create train_dots.py | davharris/leafpuppy,davharris/leafpuppy,davharris/leafpuppy | train_dots.py | train_dots.py | #!/bin/python
import pylab as pl
import cPickle
import matplotlib.pyplot as plt
from sklearn import svm, metrics
import numpy as np
import sys
square = 13
imgloc = '../images/v012-penn.10-1hA5D1-cropb.png'
resd={'dot':0,'noise':1,'vein':2}
currimg=plt.imread(imgloc)
pkl_file=open('dots.pkl', 'r')
dots = cPickle.load... | bsd-3-clause | Python | |
84153b0be78998ab8ec6914df8623c99255457b5 | Improve code for creating temporary locustfiles that can be used in tests | mbeacom/locust,locustio/locust,locustio/locust,mbeacom/locust,mbeacom/locust,locustio/locust,mbeacom/locust,locustio/locust | locust/test/mock_locustfile.py | locust/test/mock_locustfile.py | import os
import random
import time
from contextlib import contextmanager
MOCK_LOUCSTFILE_CONTENT = '''
"""This is a mock locust file for unit testing"""
from locust import HttpLocust, TaskSet, task, between
def index(l):
l.client.get("/")
def stats(l):
l.client.get("/stats/requests")
class UserTasks(T... | mit | Python | |
fea7f350ce711d183fd9011c43ca68fff88400eb | Add cython compile util | awest1339/multiscanner,mitre/multiscanner,MITRECND/multiscanner,mitre/multiscanner,jmlong1027/multiscanner,jmlong1027/multiscanner,awest1339/multiscanner,MITRECND/multiscanner,mitre/multiscanner,jmlong1027/multiscanner,awest1339/multiscanner,awest1339/multiscanner,jmlong1027/multiscanner | utils/cython_compile_libs.py | utils/cython_compile_libs.py | #!/bin/env python
from __future__ import division, absolute_import, with_statement, print_function, unicode_literals
import os
import sys
import shutil
from pyximport.pyxbuild import pyx_to_dll
WD = os.path.dirname(os.path.dirname((os.path.abspath(__file__))))
LIBS = os.path.join(WD, 'libs')
# Adds the libs directory t... | mpl-2.0 | Python | |
d31f63a914877fe12d66497bdbc7dd6d871672fc | add solution for Best Time to Buy and Sell Stock | zhyu/leetcode,zhyu/leetcode | src/bestTimeToBuyAndSellStock.py | src/bestTimeToBuyAndSellStock.py | class Solution:
# @param prices, a list of integer
# @return an integer
def maxProfit(self, prices):
n = len(prices)
if n < 2:
return 0
min_price = prices[0]
res = 0
for i in xrange(1, n):
res = max(res, prices[i]-min_price)
min_pr... | mit | Python | |
595c8fad76696240f96e61d9a2299de3d6cda16a | Add utility for walking etree and yielding nodes if options class type match. | TamiaLab/PySkCode | skcode/utility/walketree.py | skcode/utility/walketree.py | """
SkCode utility for walking across a document tree.
"""
def walk_tree_for_cls(tree_node, opts_cls):
"""
Walk the tree and yield any tree node matching the given options class.
:param tree_node: The current tree node instance.
:param opts_cls: The options class to search for.
"""
# Check th... | agpl-3.0 | Python | |
4e50597100b5e84b1ed3c304a3a7323e7bab7918 | Create removeSequence.py | edenmark/removeSequence | removeSequence.py | removeSequence.py | #!/usr/bin/python
###############################################################################
#
# removeSequence.py version 1.0
#
# Removes a specified nucleotide sequence from the beginning of a larger sequence
#
# Useful for preparing FASTA files for certain processing pipelines that do not
# all... | mit | Python | |
b7d15547bd88c6304c5d8ceb1f74481cb4d162e7 | Add parser hacking example | Saluev/habrahabr-jinja-demo | repeat_n_times.py | repeat_n_times.py | # -*- encoding: utf-8 -*-
from jinja2 import Environment
from jinja2.ext import Extension
from jinja2 import nodes
class RepeatNTimesExtension(Extension):
tags = {"repeat"}
def parse(self, parser):
lineno = next(parser.stream).lineno
index = nodes.Name("_", "store", lineno=lineno)
h... | mit | Python | |
e3365aa8d9f5e49d3aff732d169c22a46ef22904 | Create viriback_tracker.py (#452) | yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti | plugins/feeds/public/viriback_tracker.py | plugins/feeds/public/viriback_tracker.py | import logging
from dateutil import parser
from datetime import timedelta, datetime
from core import Feed
from core.errors import ObservableValidationError
from core.observables import Url, Ip
class ViriBackTracker(Feed):
default_values = {
"frequency": timedelta(hours=24),
"name": "ViriBackTrack... | apache-2.0 | Python | |
5a5c30e701220cc874d08a442af0e81d2020aacf | bump dev version | NelleV/pyconfr-test,pyconca/2013-web,pydata/symposion,miurahr/symposion,faulteh/symposion,euroscipy/symposion,TheOpenBastion/symposion,pyconau2017/symposion,euroscipy/symposion,miurahr/symposion,pyconca/2013-web,pydata/symposion,pyohio/symposion,pyohio/symposion,mbrochh/symposion,toulibre/symposion,NelleV/pyconfr-test,... | symposion/__init__.py | symposion/__init__.py | __version__ = "1.0b1.dev43"
| __version__ = "1.0b1.dev42"
| bsd-3-clause | Python |
85336dfed46145c36307f218612db7c4d8dbf637 | bump version | mbrochh/symposion,pydata/symposion,euroscipy/symposion,pydata/symposion,euroscipy/symposion,python-spain/symposion,pinax/symposion,pyconau2017/symposion,pyohio/symposion,pyconca/2013-web,pyohio/symposion,toulibre/symposion,miurahr/symposion,mbrochh/symposion,TheOpenBastion/symposion,pyconca/2013-web,pyconau2017/symposi... | symposion/__init__.py | symposion/__init__.py | __version__ = "1.0b1.dev18"
| __version__ = "1.0b1.dev17"
| bsd-3-clause | Python |
c642a32b1aff0c9adc8e62aad8ceb7e0396512ed | bump version | TheOpenBastion/symposion,pinax/symposion,TheOpenBastion/symposion,mbrochh/symposion,pyconca/2013-web,faulteh/symposion,pinax/symposion,miurahr/symposion,euroscipy/symposion,mbrochh/symposion,pyconau2017/symposion,pyohio/symposion,euroscipy/symposion,toulibre/symposion,pydata/symposion,pyconau2017/symposion,pyohio/sympo... | symposion/__init__.py | symposion/__init__.py | __version__ = "1.0b1.dev14"
| __version__ = "1.0b1.dev13"
| bsd-3-clause | Python |
c36a954dbdfcca6e520dca6b96c1c97f496880ca | Add test for forcefield_labeler | open-forcefield-group/smarty,open-forcefield-group/smarty,open-forcefield-group/smarty | smarty/tests/test_forcefield_labeler.py | smarty/tests/test_forcefield_labeler.py | from functools import partial
import smarty
import openeye
from openeye.oechem import *
import os
from smarty.utils import get_data_filename
import numpy as np
from smarty.forcefield_labeler import *
def test_read_ffxml():
"""Test reading of ffxml files.
"""
labeler = ForceField_labeler(get_data_filename(... | mit | Python | |
7d1fde66e0fd6b3b8cc9876e0d3271d6776b347f | convert tiffs to video added | emmettk/pvrsex | image_to_video.py | image_to_video.py | # -*- coding: utf-8 -*-
"""
Created on Tue May 15 16:11:55 2018
@author: LaVision
"""
#!/usr/local/bin/python3
import cv2
import argparse
import os
# Construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-ext", "--extension", required=False, default='png', help="exten... | mit | Python | |
f67514bf9ed193c0a8ac68c2258913bb54df8a88 | Create save_py_source.py | cclauss/Pythonista_ui | save_py_source.py | save_py_source.py | import datetime, os, zipfile
exts = '.py pyui'.split()
zip_file_name = 'aa_source_code_%Y_%m_%d_%H_%M_%S.zip'
zip_file_name = datetime.datetime.strftime(datetime.datetime.now(), zip_file_name)
def get_filenames(in_dir=None):
def visit(_, dirname, names):
for name in names:
filename = os.path.j... | apache-2.0 | Python | |
c7c02febb43eb2466484f5c99d6dcc2d60e67e09 | add docker.py | zhengze/zblog,zhengze/zblog,zhengze/zblog,zhengze/zblog | zblogsite/settings/docker.py | zblogsite/settings/docker.py | from .base import *
DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'zblog', # Or path to database file if using sqlite3.
# The following settings are not used wi... | mit | Python | |
f60f31c73deef7768af5eb45046a8848f2dc40c4 | Create draw_neural_net.py | XinDongol/warehouse | draw/draw_neural_net.py | draw/draw_neural_net.py | import matplotlib.pyplot as plt
def draw_neural_net(ax, left, right, bottom, top, layer_sizes):
'''
Draw a neural network cartoon using matplotilb.
:usage:
>>> fig = plt.figure(figsize=(12, 12))
>>> draw_neural_net(fig.gca(), .1, .9, .1, .9, [4, 7, 2])
:parameters:
- a... | mit | Python | |
041b55f3a9ded360146f6e2dda74a6b20b3e6f7e | Add scrape_results | Aditya8795/Python-Scripts | scrape_results.py | scrape_results.py | from selenium import webdriver
from time import sleep
from bs4 import BeautifulSoup
driver = webdriver.Firefox()
driver.get("http://www.nitt.edu/prm/ShowResult.htm")
driver.get("javascript:(function(){document.getElementsByName('main')[0].contentWindow.document.getElementById('TextBox1').value=110113006;}());")
dri... | mit | Python | |
5745bf81a32915cb85a60093dc2a7123e5814767 | Add personal problem 001 | aiden0z/snippets,aiden0z/snippets,aiden0z/snippets,aiden0z/snippets,aiden0z/snippets,aiden0z/snippets | problems/001_parse_navs_from_markdown.py | problems/001_parse_navs_from_markdown.py | """从 Markdown 文本中解析出目录信息
现在有格式如下的文档:
```markdown
* [目录 1](chapter1/1.md)
* [目录 1.1](chapter1/1-1.md)
* [目录 1.1.1](chapter1/1-1-1.md)
* [目录 2](chapter2/1.md)
```
要求写一个解析器,解析返回所有目录信息,并包含层级关系。返回的示例数据如下。
```python
[
{
'name': '目录 1',
'path': 'chaper1/1.md',
'chapters': [
{... | mit | Python | |
dc52b5914c4d0024458eefeb3b3576aa58692345 | Remove print | Chilledheart/seahub,miurahr/seahub,madflow/seahub,miurahr/seahub,cloudcopy/seahub,madflow/seahub,cloudcopy/seahub,cloudcopy/seahub,miurahr/seahub,madflow/seahub,madflow/seahub,cloudcopy/seahub,Chilledheart/seahub,Chilledheart/seahub,madflow/seahub,miurahr/seahub,Chilledheart/seahub,Chilledheart/seahub | organizations/decorators.py | organizations/decorators.py | # encoding: utf-8
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
from seaserv import get_user_current_org
def org_staff_required(func):
"""
Decorator for views that checks the user is org staff.
"""
def _decorated(request, *args, **kwargs):
... | # encoding: utf-8
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
from seaserv import get_user_current_org
def org_staff_required(func):
"""
Decorator for views that checks the user is org staff.
"""
def _decorated(request, *args, **kwargs):
... | apache-2.0 | Python |
55bf42057bcd9e14d964b2064f9322c164ba91ff | Test request construction (#91) | tableau/server-client-python,tableau/server-client-python,Talvalin/server-client-python,Talvalin/server-client-python | test/test_requests.py | test/test_requests.py | import unittest
import requests
import requests_mock
import tableauserverclient as TSC
class RequestTests(unittest.TestCase):
def setUp(self):
self.server = TSC.Server('http://test')
# Fake sign in
self.server._site_id = 'dad65087-b08b-4603-af4e-2887b8aafc67'
self.server._auth_t... | mit | Python | |
69c3e33df15dca13cf310062216525dfbe98639e | add spectandus for index analysis | ebenolson/desiderata | spectandus.py | spectandus.py | #!/usr/bin/env python
# Author: Eben Olson <eben.olson@gmail.com>
# Licensed under the MIT license <http://opensource.org/licenses/MIT>
import logging
from colorlog import ColoredFormatter
import plac
import sys
import json
from fs import zipfs
from collections import defaultdict
formatter = ColoredFormatter(
"%(... | mit | Python | |
35f98c14a74e207c616fcb57538bb176842c0d1e | Add procfile and wsgi entrypoint | openhealthcare/open-prescribing,openhealthcare/open-prescribing,openhealthcare/open-prescribing | nhs/wsgi.py | nhs/wsgi.py | """
WSGI config for Nhs Prescriptions project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPL... | agpl-3.0 | Python | |
ebd41d7f264de92be19347042749ef48d5820b7d | add inner product demo | YcheLanguageStudio/PythonStudy | study/language_core_and_lib/function/functional_example.py | study/language_core_and_lib/function/functional_example.py | def demo_inner_product():
vec0 = range(10)
vec1 = [i ** 2 for i in range(10)]
print 'inner product:', reduce(lambda l, r: l + r, map(lambda ele: ele[0] * ele[1], zip(vec0, vec1)), 0)
print 'verify:', sum([i ** 3 for i in range(10)])
if __name__ == '__main__':
demo_inner_product()
| mit | Python | |
7bd3d26427c08cf38f2f7dedbf075e1335447f70 | add config for database | lecly/pymongo-driver | config/database.py | config/database.py | mongorc = {
'host': '127.0.0.1',
'port': 27017,
'db': 'demo'
}
| mit | Python | |
f3325695a78f528af6f3c2adb6024dc71405af8f | Create kaynaksız_sil.py | Mavrikant/WikiBots | kaynaksız_sil.py | kaynaksız_sil.py | # -*- coding: utf-8 -*-
# !/usr/bin/python
from bs4 import BeautifulSoup
import requests
import mavri
import re
import random
xx= mavri.login('tr.wikipedia','Mavrikant Bot')
wiki='tr.wikipedia'
template='Şablon:Kaynaksız'
ticontinue = ''
while ticontinue != 'DONE':
allpages= requests.get('https://' + wiki + '.... | mit | Python | |
118e47c2bc307d8de447e9d37973feca44763ab5 | Create __init__.py | StackStorm/st2contrib,StackStorm/st2contrib,StackStorm/st2contrib | packs/astral/actions/lib/__init__.py | packs/astral/actions/lib/__init__.py | from .BaseAction import BaseAction
| apache-2.0 | Python | |
f5c56152771fbafc5ac9161ccd453a240bfca5cc | Add get_history example. | supasate/PythonZabbixApi | examples/get_history.py | examples/get_history.py | import sys
sys.path.append('../')
import zabbix
from datetime import datetime
from datetime import timedelta
from calendar import timegm
# read config file
config = {}
execfile("config.py", config)
# new api instance
server = config["server"]
api = zabbix.Api(server)
# log in
username = config["user"]
password = co... | apache-2.0 | Python | |
26afdc032087693d274966a803a6bb3c77d17549 | add request example | squeaky-pl/japronto,squeaky-pl/japronto,squeaky-pl/japronto,squeaky-pl/japronto,squeaky-pl/japronto | examples/request/req.py | examples/request/req.py | from app import Application
def dump(request):
text = """
Method: {0.method}
Path: {0.path}
Version: {0.version}
Headers: {0.headers}
Match: {0.match_dict}
Body: {0.body}
QS: {0.query_string}
query: {0.query}
mime_type: {0.mime_type}
encoding: {0.encoding}
form: {0.form}
keep_alive: {0.keep_alive}
route: {0.route}... | mit | Python | |
b84a2667b5071ede3eb983364195c3a2d3c97543 | Create MQTTstage.py | Anton04/MQTT-Stage,Anton04/MQTT-Stage | MQTTstage.py | MQTTstage.py | #!/usr/bin/python
#Check if the
def CheckDirectories():
| mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.