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 |
|---|---|---|---|---|---|---|---|---|
52f4d72387810994a7106e4fa55c3bfcda798a1c | Create __init__.py | timo-stoettner/ENN | ENN/__init__.py | ENN/__init__.py | mit | Python | ||
f3f073379b71a13fea4255622c7df19bec02fdd7 | bump version | lbolla/EMpy,DavidRimel/EMpy,DanHickstein/EMpy,demisjohn/EMpy | EMpy/version.py | EMpy/version.py | __author__ = 'Lorenzo Bolla'
version = '0.1.4'
| __author__ = 'Lorenzo Bolla'
version = '0.1.3'
| mit | Python |
94610546a63a05f81942c43b12c109185a8a4aff | add benchmark.py for cifar_distributed_cnn | apache/incubator-singa,apache/incubator-singa,apache/incubator-singa,apache/incubator-singa,apache/incubator-singa | examples/cifar_distributed_cnn/benchmark.py | examples/cifar_distributed_cnn/benchmark.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | apache-2.0 | Python | |
05e37a58825a6b75ade5ffdd25e887f9c9a7409c | Add net/ip.py containing python function wrapping /sbin/ip | xenserver/python-libs,xenserver/python-libs | net/ip.py | net/ip.py | #!/usr/bin/env python
# Copyright (c) 2012 Citrix Systems, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation; version 2.1 only. with the special
# exception on linking described in fi... | bsd-2-clause | Python | |
2b57a443807de26c9e71c97fd029e3d8416db597 | Add feature usage shuffler | DynamoDS/Coulomb,DynamoDS/Coulomb,DynamoDS/Coulomb | SessionTools/feature_usage_shuffler.py | SessionTools/feature_usage_shuffler.py | # Condenses all the feature files into a single location,
# Split by the names of the features
import sys
from os.path import isfile
import os
import json
path = sys.argv[1]
out_path = sys.argv[2]
paths = []
i = 0
skipped = 0
pretty_print_json_output = True
feature_versions_map = {}
def flush():
# Create one... | mit | Python | |
66bb19a5937091812b80b9c0d98c6f52b9d47165 | add new package : kafka (#14315) | iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/kafka/package.py | var/spack/repos/builtin/packages/kafka/package.py | # Copyright 2013-2019 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 Kafka(Package):
"""
Kafka is used for building real-time data pipelines and streaming ... | lgpl-2.1 | Python | |
16e6f88e094d4eac8ba154eed5681187f14ab652 | Create __init__.py | overdev/SpaceGame | spacegame/__init__.py | spacegame/__init__.py | """SpaceGame
A simple 2d space shooter made with python and pygame.
"""
# Make sure you ha python34 and pygame 1.9.1+ installed before run this code.
import pygame
import pygame.locals as c
# this module itself does nothing important, but its good to have pygame
# initialized as soon as possible.
pygame.init()
| mit | Python | |
00cdcceb131814b24546c36810682ed78ba866c6 | Create database column class (DBCol) | rlinguri/pyfwk | pyfwk/struc/dbcol.py | pyfwk/struc/dbcol.py | #!/usr/bin/env python
"""
dbcol.py: DBCol is a struct describing an sqlite database table column
"""
# ----------------------------DATABASE-COLUMN-----------------------------#
class DBCol:
name = None
datatype = None
def __init__(self, name, datatype):
self.name = name
self.datatype =... | mit | Python | |
891eef2354e4cf0a552e5c8023c2778bf45a3582 | add py lib and the first py fiel | xylan2004/AciSnippets,xylan2004/AciSnippets,xylan2004/AciSnippets,xylan2004/AciSnippets,xylan2004/AciSnippets | pylib/EncodingLib.py | pylib/EncodingLib.py | # coding=utf-8
import sys
# sys.stdout = codecs.lookup('iso8859-1')[-1](sys.stdout)
print 'System Encoding is', sys.getdefaultencoding()
# python中的str对象其实就是"8-bit string" ,字节字符串,本质上类似java中的byte[]。
s_chinese = '中文'
# 而python中的unicode对象应该才是等同于java中的String对象,或本质上是java的char[]。
s_unicode_chinese = u'中文'
print 's_chines... | bsd-2-clause | Python | |
2644625e137963ef2982d7ff0a3241bfcbde1ac6 | Prepend the logs with '...' if they aren't complete | sysadmind/cron-sentry,mediacore/raven-cron,ciiol/cron-sentry,incuna/cron-sentry | raven_cron/runner.py | raven_cron/runner.py | from os import getenv, SEEK_END
from raven import Client
from subprocess import call
from tempfile import TemporaryFile
from argparse import ArgumentParser
from sys import argv, exit
from time import time
from .version import VERSION
MAX_MESSAGE_SIZE = 1000
parser = ArgumentParser(description='Wraps commands and repo... | from os import getenv, SEEK_END
from raven import Client
from subprocess import call
from tempfile import TemporaryFile
from argparse import ArgumentParser
from sys import argv, exit
from time import time
from .version import VERSION
MAX_MESSAGE_SIZE = 1000
parser = ArgumentParser(description='Wraps commands and repo... | mit | Python |
e66a690271f23fc2a4904e446bbdf0bf6b491a60 | Add manager migration | felliott/osf.io,Johnetordoff/osf.io,leb2dg/osf.io,binoculars/osf.io,chrisseto/osf.io,laurenrevere/osf.io,binoculars/osf.io,adlius/osf.io,HalcyonChimera/osf.io,TomBaxter/osf.io,chennan47/osf.io,CenterForOpenScience/osf.io,mattclark/osf.io,adlius/osf.io,leb2dg/osf.io,mattclark/osf.io,mattclark/osf.io,brianjgeiger/osf.io,... | osf/migrations/0028_auto_20170504_1548.py | osf/migrations/0028_auto_20170504_1548.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-04 20:48
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('osf', '0027_auto_20170428_1435'),
]
operations = [
migrations.AlterModelOptions(
... | apache-2.0 | Python | |
84e3475158797a60312068c284aa8d61d9466c6e | add model | ianzhengnan/blog-python3,ianzhengnan/blog-python3,ianzhengnan/blog-python3 | www/models.py | www/models.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Models for user, blog, comment
'''
__author__ = 'Ian Zheng'
import time, uuid
from www.orm import Model, StringField, BooleanField, IntegerField, FloatField
def next_id():
return '%015d%s000' % (int(time.time() * 1000), uuid.uuid4().hex)
class User(Model):
... | apache-2.0 | Python | |
3e9d5f9cf1c28619422cb012e532e776c4cc8b99 | fix bug 1369498: remove adi-related tables and stored procedures | lonnen/socorro,mozilla/socorro,mozilla/socorro,mozilla/socorro,mozilla/socorro,lonnen/socorro,lonnen/socorro,lonnen/socorro,mozilla/socorro,mozilla/socorro | alembic/versions/eb8269f6bb85_bug_1369498_remove_adi.py | alembic/versions/eb8269f6bb85_bug_1369498_remove_adi.py | """bug 1369498 remove adi
Remove ADI-related tables and stored procedures.
Revision ID: eb8269f6bb85
Revises: 0db05da17ae8
Create Date: 2018-07-19 20:00:52.933551
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = 'eb8269f6bb85'
down_revision = '0db05da17ae8'
def upgrade():
# Rem... | mpl-2.0 | Python | |
c413098151bc1cf7d9e37902afe4b110f97b9d57 | Add koth example (WIP) | BHSPitMonkey/vmflib | examples/koth_vmflib_example.py | examples/koth_vmflib_example.py | #!/usr/bin/python3
"""Example map generator: King of the Hill Example
This script demonstrates vmflib by generating a basic "king of the hill" style
map. "King of the hill" is a game mode in Team Fortress 2 where each team tries
to maintain control of a central "control point" for some total defined amount
of time (b... | bsd-2-clause | Python | |
4f5ce4af85971ea3c15c90b8a482b611b8bf6c4c | move logging code to evaluation directory | StackResys/Stack-Resys,StackResys/Stack-Resys,StackResys/Stack-Resys | src/evaluation/log.py | src/evaluation/log.py | """ This module provides a globally accessible
logger created from the config file """
import logging
import os
def _create_logger_from_config():
""" Create the logger from the config file """
conf = {
"name": "StackLogger",
"log_file": "logs/experiment.log",
"format": "%(asctime)s... | bsd-3-clause | Python | |
6d93ad1df3eb4a50038b7429fe9ed98a8d44af6f | add solution for Divide Two Integers | zhyu/leetcode,zhyu/leetcode | src/divideTwoIntegers.py | src/divideTwoIntegers.py | class Solution:
# @return an integer
def divide(self, dividend, divisor):
if divisor == 0:
return 2147483647
positive = (dividend < 0) is (divisor < 0)
dividend, divisor = abs(dividend), abs(divisor)
res = 0
while dividend >= divisor:
tmp, i = div... | mit | Python | |
51466e360320267afab41704caecebac0dff1dc2 | Add a handler for performing client load testing. | XiaonuoGantan/pywebsocket,XiaonuoGantan/pywebsocket | src/example/bench_wsh.py | src/example/bench_wsh.py | # Copyright 2011, Google Inc.
# 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 copyright
# notice, this list of conditions and the f... | bsd-3-clause | Python | |
bf7d56c748eb42350c4b37a858ee5d6bb4844efa | Add test coverage of existing simple tenant usage policies | mahak/nova,openstack/nova,klmitch/nova,klmitch/nova,openstack/nova,klmitch/nova,openstack/nova,mahak/nova,klmitch/nova,mahak/nova | nova/tests/unit/policies/test_simple_tenant_usage.py | nova/tests/unit/policies/test_simple_tenant_usage.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | apache-2.0 | Python | |
d45bdf62d54c0a5efc77be639f4259807a286d6e | Create pour-water.py | kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015 | Python/pour-water.py | Python/pour-water.py | # Time: O(v * n)
# Space: O(1)
# We are given an elevation map, heights[i] representing the height of the terrain at that index.
# The width at each index is 1. After V units of water fall at index K, how much water is at each index?
#
# Water first drops at index K and rests on top of the highest terrain or water at... | mit | Python | |
8dbc2dd48d1d0e25972ad359464694d352d58705 | add transpilation of the arangodb social graph | tariqdaouda/pyArango,tariqdaouda/pyArango | examples/createSocialGraph.py | examples/createSocialGraph.py | #!/usr/bin/python
import sys
from pyArango.connection import *
from pyArango.graph import *
from pyArango.collection import *
class Social(object):
class male(Collection) :
_fields = {
"name" : Field()
}
class female(Collection) :
_field... | apache-2.0 | Python | |
06d2d7dd155f5ac888a8c0d2d9c45c61b95de714 | update tests for thresholding for ecm | danlurie/C-PAC,danlurie/C-PAC,roijo/C-PAC_complexitytools,danlurie/C-PAC,sgiavasis/C-PAC,roijo/C-PAC_complexitytools,sgiavasis/C-PAC,roijo/C-PAC_complexitytools,sgiavasis/C-PAC,roijo/C-PAC_complexitytools,sgiavasis/C-PAC,danlurie/C-PAC | CPAC/network_centrality/tests/test_thresh_and_sum.py | CPAC/network_centrality/tests/test_thresh_and_sum.py | """
This tests the functions in network_centrality/thresh_and_sum.pyx
"""
import os, sys
import numpy as np
from numpy.testing import *
from nose.tools import ok_, eq_, raises, with_setup
from nose.plugins.attrib import attr # http://nose.readthedocs.org/en/latest/plugins/attrib.html
import sys
sys.path.insert(0,... | bsd-3-clause | Python | |
8f3767384b1173c2a9921fce055fdec0e2f1bacc | add backupscript | rprader/SimpleBackupScript | backupscript.py | backupscript.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import datetime, os, shutil
PATH_CONFIG = {
'local_backup_path': '/Users/raphaelprader/Desktop/fake_bu_path'
}
DB_CREDENTIALS = {
'username': 'root',
'password': '',
'host': 'localhost',
'db_names': [
'db_www_sprachtandem_ch',
]
}
GDRIVE_CREDENTIALS = {
'remote_name... | mit | Python | |
82fa373c46581e84f8e5ea0da733ef5c65928165 | Update MultipleParticleSystems.pyde | tildebyte/processing.py,mashrin/processing.py,jdf/processing.py,jdf/processing.py,mashrin/processing.py,tildebyte/processing.py,tildebyte/processing.py,jdf/processing.py,mashrin/processing.py | mode/examples/Topics/Simulate/MultipleParticleSystems/MultipleParticleSystems.pyde | mode/examples/Topics/Simulate/MultipleParticleSystems/MultipleParticleSystems.pyde | """
Multiple Particle Systems
by Daniel Shiffman.
Click the mouse to generate a burst of particles
at mouse location.
Each burst is one instance of a particle system
with Particles and CrazyParticles (a subclass of Particle).
Note use of Inheritance and Polymorphism here.
"""
from crazy_particle import CrazyParticle... | """
Multiple Particle Systems
by Daniel Shiffman.
Click the mouse to generate a burst of particles
at mouse location.
Each burst is one instance of a particle system
with Particles and CrazyParticles (a subclass of Particle).
Note use of Inheritance and Polymorphism here.
"""
from crazy_particle import CrazyParticle... | apache-2.0 | Python |
70bc8413dc3748f606e76f5e4e4abcde6b851cdd | Read and UDP | wadda/Bari | bari_spitter.py | bari_spitter.py | #!/usr/bin/python3
# coding=utf-8
"""reads barometric pressure sensor and writes it to UDP socket with timestamp
"""
import socket
from datetime import datetime
from time import sleep
from time import time
import ms5637
__author__ = 'Moe'
__copyright__ = 'Copyright 2017 Moe'
__license__ = 'MIT'
__version__ = '0.0.2'... | mit | Python | |
6811b4014fc0267edf4d397ccab86b0e986c2215 | Implement the INFO command | ElementalAlchemist/txircd,Heufneutje/txircd | txircd/modules/rfc/cmd_info.py | txircd/modules/rfc/cmd_info.py | from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd import version
from txircd.module_interface import Command, ICommand, IModuleData, ModuleData
from zope.interface import implements
class InfoCommand(ModuleData, Command):
implements(IPlugin, IModuleData, ICommand)
name... | bsd-3-clause | Python | |
0f199556df6bd498f01cccdce6316b733c876acc | Add migration file | inventree/InvenTree,inventree/InvenTree,SchrodingersGat/InvenTree,SchrodingersGat/InvenTree,SchrodingersGat/InvenTree,SchrodingersGat/InvenTree,inventree/InvenTree,inventree/InvenTree | InvenTree/part/migrations/0046_auto_20200804_0107.py | InvenTree/part/migrations/0046_auto_20200804_0107.py | # Generated by Django 3.0.7 on 2020-08-04 01:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('part', '0045_auto_20200605_0932'),
]
operations = [
migrations.AlterField(
model_name='partcategory',
name='default_... | mit | Python | |
f8fcae7dd7579b51c3c204337dfa70c702fdbf38 | add new namedtuple Chunk | alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl | AlphaTwirl/HeppyResult/Chunk.py | AlphaTwirl/HeppyResult/Chunk.py | # Tai Sakuma <tai.sakuma@cern.ch>
##__________________________________________________________________||
import collections
##__________________________________________________________________||
Chunk = collections.namedtuple('Chunk', 'inputPath treeName maxEvents start component name')
##___________________________... | bsd-3-clause | Python | |
16004f8138e16da51a5a1df22f3a23b1c9146256 | Create YelpReviewUsefulnessPrediction_v1.py | firiceguo/Recommendation-NLP,firiceguo/Recommendation-NLP | src/yyliu/YelpReviewUsefulnessPrediction_v1.py | src/yyliu/YelpReviewUsefulnessPrediction_v1.py | import os
import sys
import numpy as np
import nltk
# Set the path for spark installation
# this is the path where you have built spark using sbt/sbt assembly
os.environ['SPARK_HOME'] = "/Applications/spark-2.1.0"
# os.environ['SPARK_HOME'] = "/home/jie/d2/spark-0.9.1"
# Append to PYTHONPATH so that pyspark could be ... | mit | Python | |
f531eb7d1734d6d715893356a50d11eee6bc009a | Test mobile set password form | dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq | corehq/apps/users/tests/forms.py | corehq/apps/users/tests/forms.py | from collections import namedtuple
from django.contrib.auth import get_user_model
from django.test import TestCase
from corehq.apps.users.forms import SetUserPasswordForm
Project = namedtuple('Project', ['name', 'strong_mobile_passwords'])
class TestSetUserPasswordForm(TestCase):
def setUp(self):
super(T... | bsd-3-clause | Python | |
b3f436e14df37d4af602dcdc9882ce27c97fabd4 | Add a yaml sdb module (#37563) | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/sdb/yaml.py | salt/sdb/yaml.py | # -*- coding: utf-8 -*-
'''
Pull sdb values from a YAML file
:maintainer: SaltStack
:maturity: New
:platform: all
.. versionadded:: Nitrogen
Configuration:
.. code-block:: yaml
my-yaml-file:
driver: yaml
files:
- /path/to/foo.yaml
- /path/to/bar.yaml
The files are merg... | apache-2.0 | Python | |
a2151435057e3e42b8ecf6323b8276f4698fdd15 | Create getTermSize.py | sshortess/Handy-Utilities,sshortess/Handy-Utilities | ssh_utils/getTermSize.py | ssh_utils/getTermSize.py | #!/usr/bin/env python
""" getTerminalSize()
- get width and height of console
- works on linux,os x,windows,cygwin(windows)
"""
__all__=['getTerminalSize']
def getTerminalSize():
import platform
current_os = platform.system()
tuple_xy=None
if current_os == 'Windows':
tuple_xy = _getTerminalSize... | unlicense | Python | |
6c38414d899b00cf0ba386e59721354f3b2a799b | Update bechdel.py | beccasjames/learn_python,beccasjames/learn_python | bechdel.py | bechdel.py | # Difficulty level: Advanced
# Goal #1: Create a program that will print out a list of movie titles and a set of ratings defined below into a particular format.
# First, choose any five movies you want.
# Next, look each movie up manually to find out four pieces of information:
# Their parental guidance rating (G, ... | unlicense | Python | |
5b0f490cb527b0940dc322b060069f44fb29accd | Add git versioning | LABSN/expyfun,Eric89GXL/expyfun,rkmaddox/expyfun,drammock/expyfun,lkishline/expyfun | expyfun/_git.py | expyfun/_git.py | # -*- coding: utf-8 -*-
| bsd-3-clause | Python | |
bcfac4b7ea5b10b5b6e84a756d716ef6c47cdd62 | Create finalproject.py | jasper-meyer/Final-Project | finalproject.py | finalproject.py | code!
| mit | Python | |
2cdf030ee6d8a545c071f2c033d88c6c2091ef08 | Add freeze_graph tool | Zehaos/MobileNet,Zehaos/MobileNet | freeze_graph.py | freeze_graph.py | # code from https://blog.metaflow.fr/tensorflow-how-to-freeze-a-model-and-serve-it-with-a-python-api-d4f3596b3adc
# Thanks Morgan
import os, argparse
import tensorflow as tf
from tensorflow.python.framework import graph_util
dir = os.path.dirname(os.path.realpath(__file__))
def freeze_graph(model_folder):
# We r... | apache-2.0 | Python | |
f632bb5e63035e491ec74bdbcb0537cf03fa2769 | Add salt states for rbenv | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/states/rbenv.py | salt/states/rbenv.py | import re
def _check_rbenv(ret,runas=None):
if not __salt__['rbenv.is_installed'](runas):
ret['result'] = False
ret['comment'] = 'Rbenv is not installed.'
return ret
def _ruby_installed(ret, ruby, runas=None):
default = __salt__['rbenv.default'](runas=runas)
for version in __salt__['rb... | apache-2.0 | Python | |
3cffe6ce42702a1aaa4a01ae1f90962a00fcb911 | Add yum module | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/modules/yum.py | salt/modules/yum.py | '''
Support for YUM
'''
import subprocess
def _list_removed(old, new):
'''
List the pachages which have been removed between the two package objects
'''
pkgs = []
for pkg in old:
if not new.has_key():
pkgs.append(pkg)
return pkgs
def list_pkgs():
'''
List the packa... | apache-2.0 | Python | |
2207e8dfbf1ea0f11cac0a95f7c5317eaae27f9b | Add cron state support | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/states/cron.py | salt/states/cron.py | '''
Manage cron states
'''
def present(name,
user='root',
minute='*',
hour='*',
daymonth='*',
month='*',
dayweek='*',
):
'''
Verifies that the specified cron job is present for the specified user
'''
ret = {'name': name,
'result': True,... | apache-2.0 | Python | |
86c2441be14dbc3303b0bc65356372728a62fd4a | Add infrastructure for counting database queries | terceiro/squad,terceiro/squad,terceiro/squad,terceiro/squad | test/performance.py | test/performance.py | from contextlib import contextmanager
import json
import os
import re
import sys
from django.conf import settings
from django.db import connection, reset_queries
count = {}
@contextmanager
def count_queries(k):
q = 0
debug = settings.DEBUG
try:
settings.DEBUG = True
reset_queries()
... | agpl-3.0 | Python | |
059b7c5705d2134ca998e67caf65e3125d503dbc | add sitemap.py | toddsifleet/staticpy,toddsifleet/staticpy | staticpy/page/sitemap.py | staticpy/page/sitemap.py | from __future__ import absolute_import
import os
from jinja2 import Environment, PackageLoader
from ..utils import write_to_file
class Sitemap(object):
def __init__(self, site):
self.env = Environment(loader=PackageLoader('dynamic', 'templates'))
self.site = site
def write(self):
t... | mit | Python | |
b5568053325bd78c277d4bc0adff59cd12e10f48 | Add a script to build plugin. | qiuwch/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv,unrealcv/unrealcv,unrealcv/unrealcv,qiuwch/unrealcv,qiuwch/unrealcv | build-plugin.py | build-plugin.py | import os
UnrealEnginePath='/home/qiuwch/workspace/UnrealEngine'
UATScript = os.path.join(UnrealEnginePath, 'Engine/Build/BatchFiles/RunUAT.sh')
FullPluginFile = os.path.abspath('UnrealCV.uplugin')
os.system('%s BuildPlugin -plugin=%s' % (UATScript, FullPluginFile))
| mit | Python | |
01803c0b8f09d8a818f3ca4db4e4b9c5c14634da | Create retrieve_data.py | fridayideas/daytomatoserver,fridayideas/daytomatoserver | data_crawler/retrieve_data.py | data_crawler/retrieve_data.py | import rauth
import time
def main():
locations = [(48.44, -123.34), (48.40, -123.37), (48.42, -123.30), (48.44, -123.33), (48.47, -123.32)]
api_calls = []
for lat,longi in locations:
params = get_search_parameters(lat, longi)
api_calls.append(get_results(params))
time.sleep(1.0)
##Do other processing
wi... | apache-2.0 | Python | |
3be1c4f57e68b89d3c740a444e1f14ba67f3eada | Add a snippet. | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | python/pyqt/pyqt5/widget_QTableView_delegate_on_edit_using_timeedit_widget.py | python/pyqt/pyqt5/widget_QTableView_delegate_on_edit_using_timeedit_widget.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Ref:
# - http://doc.qt.io/qt-5/modelview.html#3-4-delegates
# - http://doc.qt.io/qt-5/model-view-programming.html#delegate-classes
# - http://doc.qt.io/qt-5/qabstractitemdelegate.html#details
# - http://doc.qt.io/qt-5/qitemdelegate.html#details
# - http://doc.qt.io/qt-5... | mit | Python | |
1f98fdc87ef62bb2b7a815f80c56f6957ab303b5 | Add tests for tensor_operators | odashi/primitiv,odashi/primitiv,odashi/primitiv | python-primitiv/tests/tensor_operators.py | python-primitiv/tests/tensor_operators.py | from primitiv import Device
from primitiv import tensor_operators as tF
from primitiv.devices import Naive
import numpy as np
import unittest
class TensorOperatorsTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
pass
@classmethod
def tearDownClass(cls):
pass
def setUp... | apache-2.0 | Python | |
bf42dd5246d935b0179faf1d563baa98bbcf0dbc | Create setup.py | olmallet81/URT,olmallet81/URT,olmallet81/URT | Python/setup.py | Python/setup.py | #==================================================================================================
# Copyright (C) 2016 Olivier Mallet - All Rights Reserved
#==================================================================================================
# run with:
# python... | mit | Python | |
5ae41fc3763f4fd4a25a7863ab139ef2709e9565 | Fix missing import | benhamner/Metrics,wendykan/Metrics,thitchen/Metrics,dksahuji/Metrics,thitchen/Metrics,eduardofv/Metrics,AaronRanAn/Metrics,benhamner/Metrics,abimannans/Metrics,dksahuji/Metrics,wendykan/Metrics,eduardofv/Metrics,AaronRanAn/Metrics,eduardofv/Metrics,AaronRanAn/Metrics,ujjwalkarn/Metrics,benhamner/Metrics,wendykan/Metric... | Python/setup.py | Python/setup.py | #!/usr/bin/env python
from setuptools import setup
import sys
requirements = [x.strip() for x in open("requirements.txt")]
# Automatically run 2to3 for Python 3 support
extra = {}
if sys.version_info >= (3,):
extra['use_2to3'] = True
setup(name='ml_metrics',
version='0.1.2',
description='Machine Lea... | #!/usr/bin/env python
from setuptools import setup
requirements = [x.strip() for x in open("requirements.txt")]
# Automatically run 2to3 for Python 3 support
extra = {}
if sys.version_info >= (3,):
extra['use_2to3'] = True
setup(name='ml_metrics',
version='0.1.2',
description='Machine Learning Evalu... | bsd-2-clause | Python |
2aa07b8ac9ba2ec8d2b1ac814b5a1fb3074a2616 | test loading dataset | rnoxy/cifar10-cnn | test_loadDataset.py | test_loadDataset.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: test_loadDataset.py
# Author: Rafał Nowak <rafal.nowak@cs.uni.wroc.pl>
import unittest
class TestLoadDataset(unittest.TestCase):
"""Test load_CIFAR_dataset function from utils"""
def test_certain_images(self):
from myutils import load_CIFAR_dataset... | mit | Python | |
21d931e35d9e0b32415a408f28e45894f0c3e800 | Add task files for celery async process | semorale/backend-test,semorale/backend-test,semorale/backend-test | django_backend_test/noras_menu/tasks.py | django_backend_test/noras_menu/tasks.py | # -*- encoding: utf-8 -*-
#app_mail/tasks.py
import requests
import simplejson as json
from django_backend_test.celery import app
from django.template.loader import render_to_string
from django.utils.html import strip_tags
from django.core.mail import EmailMultiAlternatives
from .models import Subscribers, MenuItems
... | mit | Python | |
849a29b22d656c8079b4ccaf922848fb057c80c5 | Add migration to assign appropriate sheets to Transnational CountryRegion | Code4SA/gmmp,Code4SA/gmmp,Code4SA/gmmp | forms/migrations/0023_assign_sheets_to_transnational.py | forms/migrations/0023_assign_sheets_to_transnational.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.exceptions import ObjectDoesNotExist
from django.db import migrations
def assign_transnational_region_to_sheets(apps, schema_editor):
from forms.models import sheet_models
CountryRegion = apps.get_model("forms", "CountryRegion"... | apache-2.0 | Python | |
22738b2cae0a6c77127bbf5385b7265247ffb306 | migrate also user profiles | adaptive-learning/geography,adaptive-learning/geography,adaptive-learning/geography,adaptive-learning/geography | geography/management/commands/migrate_geography_user.py | geography/management/commands/migrate_geography_user.py | from proso_user.models import UserProfile
from django.core.management.base import BaseCommand
from optparse import make_option
from contextlib import closing
from django.db import connection
from clint.textui import progress
from django.db import transaction
class Command(BaseCommand):
option_list = BaseCommand.... | mit | Python | |
e7640ad635a77eecbcc5291792b514e42958876e | add magic-gen.py | sdgdsffdsfff/criu,efiop/criu,AuthenticEshkinKot/criu,ldu4/criu,KKoukiou/criu-remote,gonkulator/criu,gonkulator/criu,fbocharov/criu,KKoukiou/criu-remote,biddyweb/criu,eabatalov/criu,rentzsch/criu,KKoukiou/criu-remote,efiop/criu,AuthenticEshkinKot/criu,svloyso/criu,tych0/criu,rentzsch/criu,wtf42/criu,gablg1/criu,ldu4/cri... | scripts/magic-gen.py | scripts/magic-gen.py | #!/bin/env python
import os, sys
import struct
# This program parses criu magic.h file and produces
# magic.py with all *_MAGIC constants except RAW and V1.
def main(argv):
if len(argv) != 3:
print("Usage: magic-gen.py path/to/image.h path/to/magic.py")
exit(1)
magic_c_header = argv[1]
magic_py = argv[2]
out... | lgpl-2.1 | Python | |
03c0aa498470037ef2aa6a8233198ff521f8d42f | add the links demo | MathieuDuponchelle/pygobject,davidmalcolm/pygobject,thiblahute/pygobject,davibe/pygobject,thiblahute/pygobject,jdahlin/pygobject,GNOME/pygobject,pexip/pygobject,choeger/pygobject-cmake,nzjrs/pygobject,davibe/pygobject,pexip/pygobject,MathieuDuponchelle/pygobject,GNOME/pygobject,MathieuDuponchelle/pygobject,davidmalcolm... | demos/gtk-demo/demos/links.py | demos/gtk-demo/demos/links.py | #!/usr/bin/env python
# -*- Mode: Python; py-indent-offset: 4 -*-
# vim: tabstop=4 shiftwidth=4 expandtab
#
# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri <johnp@redhat.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License a... | lgpl-2.1 | Python | |
dc82990f7a00e5e1e4d2a860630507f9cb3b81d4 | add script for just opening a package source | sassoftware/mirrorball,sassoftware/mirrorball | scripts/pkgsource.py | scripts/pkgsource.py | #!/usr/bin/python
import sys
from conary.lib import util
sys.excepthook = util.genExcepthook()
import logging
import updatebot.log
updatebot.log.addRootLogger()
log = logging.getLogger('test')
from aptmd import Client
from updatebot import config
from updatebot import pkgsource
cfg = config.UpdateBotConfig()
cfg.r... | apache-2.0 | Python | |
d6fa3fb8aa67d7581990c9278794516e499a3eb3 | Create RegRipbyDate.py | MalWerewolf/RegRipbyDate | RegRipbyDate.py | RegRipbyDate.py | '''
Created on May 19, 2014
@author: CaptainCrabnasty
----------------------------------------------------------------------------------
Copyright 2014
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... | apache-2.0 | Python | |
eeb9b9877f1aa5bc1f22ac4883fe58a57ee0474a | Add script to test HOTS | oliverlee/phobos,oliverlee/phobos,oliverlee/phobos,oliverlee/phobos | scripts/test_hots.py | scripts/test_hots.py | import numpy as np
events = [
(1162704874, -5547),
(1179727586, -5548),
(1209562198, -5547),
(1224960594, -5548),
]
t, x = zip(*events)
t = np.array(t)
x = np.array(x)
t = t - t[0] # redefine zero time
alpha = 1/t[-1]
t = alpha*t # scale time values
A = np.ones((4, 4))
A[:, -2] = np.array(t)
fo... | bsd-2-clause | Python | |
3862ea1b1cae1c3be80824495d1c6937a18378b9 | test added | mjirik/pyseg_base,mjirik/pysegbase,mjirik/pyseg_base,mjirik/pysegbase | tests/pycut_test.py | tests/pycut_test.py | #! /usr/bin/python
# -*- coding: utf-8 -*-
# import funkcí z jiného adresáře
import sys
import os.path
import copy
path_to_script = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(path_to_script, "../src/"))
import unittest
import numpy as np
import pycut
class PycutTest(unittest.TestCa... | bsd-3-clause | Python | |
ee169acf82eff08daa40c461263712f2af2a1131 | Add a standalone simulation script (really a duplicate of sensitivity.py) | chatelak/RMG-Py,pierrelb/RMG-Py,chatelak/RMG-Py,nyee/RMG-Py,pierrelb/RMG-Py,nickvandewiele/RMG-Py,nyee/RMG-Py,nickvandewiele/RMG-Py | scripts/simulate.py | scripts/simulate.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This script runs stand-alone simulation on an RMG job. This is effectively the
same script as sensitivity.py
"""
import os.path
import argparse
from rmgpy.tools.sensitivity import runSensitivity
#####################################################################... | mit | Python | |
0f31db66a38073e1549d977909c5f4c5d3eab280 | Create permutation-in-string.py | kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,jaredkoontz/leetcode,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,jaredkoontz/leetcode,yiwen-luo/LeetCode,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,yiwe... | Python/permutation-in-string.py | Python/permutation-in-string.py | # Time: O(n)
# Space: O(1)
# Given two strings s1 and s2, write a function to return true
# if s2 contains the permutation of s1. In other words,
# one of the first string's permutations is the substring of the second string.
#
# Example 1:
# Input:s1 = "ab" s2 = "eidbaooo"
# Output:True
# Explanation: s2 contains on... | mit | Python | |
ebb797bb7596adc71b1e906cb7d7f94b56e8f535 | Create subarray-sum-equals-k.py | jaredkoontz/leetcode,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,jaredkoontz/leetcode,kamyu104/LeetCode,jaredkoontz/leetcode,yiwen-luo/LeetCode,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,k... | Python/subarray-sum-equals-k.py | Python/subarray-sum-equals-k.py | # Time: O(n)
# Space: O(n)
# Given an array of integers and an integer k,
# you need to find the total number of continuous subarrays whose sum equals to k.
#
# Example 1:
# Input:nums = [1,1,1], k = 2
# Output: 2
#
# Note:
# The length of the array is in range [1, 20,000].
# The range of numbers in the array is [-10... | mit | Python | |
c9b75d5195666efaef8b52d9f2f2b70d9b11f25f | Create individual file used for initializing db | ganemone/ontheside,ganemone/ontheside,ganemone/ontheside | server/models/db.py | server/models/db.py | from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy() | mit | Python | |
c0ba4a18433a05f492cfb78716fc77e14c8b4f56 | test solvable:filelist attribute | openSUSE/sat-solver-bindings,openSUSE/sat-solver-bindings,openSUSE/sat-solver-bindings,openSUSE/sat-solver-bindings,openSUSE/sat-solver-bindings,openSUSE/sat-solver-bindings | bindings/python/tests/filelist.py | bindings/python/tests/filelist.py | #
# Check Filelists
#
import unittest
import sys
sys.path.insert(0, '../../../build/bindings/python')
import satsolver
class TestSequenceFunctions(unittest.TestCase):
def test_filelists(self):
pool = satsolver.Pool()
assert pool
pool.set_arch("x86_64")
repo = pool.add_solv( "os11-biarch.solv... | bsd-3-clause | Python | |
d1eceaf35b74166f3471dea86b194f67a152cb19 | add Python script to diff two source trees | apache/manifoldcf-integration-solr-4.x | dev-tools/scripts/diffSources.py | dev-tools/scripts/diffSources.py | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | apache-2.0 | Python | |
74f3f70337e9924e4fce030d6a5941ce506bfee9 | Add a runserver script to start the application for development purposes | whitel/fresque,fedora-infra/fresque,rahulrrixe/fresque,whitel/fresque,whitel/fresque,rahulrrixe/fresque,vivekanand1101/fresque,fedora-infra/fresque,rahulrrixe/fresque,whitel/fresque,rahulrrixe/fresque,fedora-infra/fresque,fedora-infra/fresque,vivekanand1101/fresque,vivekanand1101/fresque,vivekanand1101/fresque | runserver.py | runserver.py | #!/usr/bin/env python
## These two lines are needed to run on EL6
__requires__ = ['SQLAlchemy >= 0.8', 'jinja2 >= 2.4']
import pkg_resources
import sys
from werkzeug.contrib.profiler import ProfilerMiddleware
from fresque import APP
APP.debug = True
if '--profile' in sys.argv:
APP.config['PROFILE'] = True
A... | agpl-3.0 | Python | |
93039b9cbea2c8355b8d8651ec0d15cdd73169a6 | Create findmean.py | wdyer0726/CS101 | udacity/findmean.py | udacity/findmean.py | # The mean of a set of numbers is the sum of the numbers divided by the
# number of numbers. Write a procedure, list_mean, which takes a list of numbers
# as its input and return the mean of the numbers in the list.
# Hint: You will need to work out how to make your division into decimal
# division instead of integer ... | apache-2.0 | Python | |
7e2a1ac8f297223accdf2ec421d8c9c7a2fe4b3c | add the updated script | avinassh/avinassh.github.io,avinassh/avinassh.github.io | source/script.py | source/script.py | import os
import sys
import re
from datetime import datetime
import pytz
def replace_meta(content: str):
# all meta has to be between ---, so lets append that
content = '+++\n' + content
# match and replace the `Title: <something>` to `title = "<something>"`
content = re.sub(r'Title: *(.*)\n', r'title... | mit | Python | |
7ea9bbd3315fed4d6fd319a865517a4f72228342 | Create test.py | SchoolIdolTomodachi/SchoolIdolAPIOAuthExample,SchoolIdolTomodachi/SchoolIdolAPIOAuthExample,SchoolIdolTomodachi/SchoolIdolAPIOAuthExample | Python/test.py | Python/test.py | apache-2.0 | Python | ||
199b6bb0c62028d93e1204d96591500b0f76e834 | Add Robot_V002b.py Object Oriented Version | mirrorcoloured/slcypi | Robot_V002b.py | Robot_V002b.py | #!/usr/bin/python
import sys
sys.path.append("/home/pi/Documents/Robots/slcypi/MA") ### ADD PATH
sys.path.append("/home/pi/Documents/Robots/slcypi/HAT_Python3") ### ADD PATH
import time
from time import sleep
import atexit
import pygame
import pygame.camera
from PIL import Image
#from pylab import *
from Tank import T... | mit | Python | |
eeb0187b9d474b9b5d1710e8f45f8116894eb15c | Read Temperature from DS18B20. Post the data to data.sparkfun.com | fuzzyhandle/esp8266hangout,fuzzyhandle/esp8266hangout,fuzzyhandle/esp8266hangout | temp-sensor02/main.py | temp-sensor02/main.py | from machine import Pin
from ds18x20 import DS18X20
import onewire
import time
import machine
import ujson
import urequests
def posttocloud(temperature):
keystext = open("sparkfun_keys.json").read()
keys = ujson.loads(keystext)
url = keys['inputUrl'] + "?private_key=" + keys['privateKey'] + "&temp=" + str(temper... | mit | Python | |
d2e63dfc644e323bf23fbd6654f7493ed94d7991 | Use HTTPS for libchromiumcontent's URL | rajatsingla28/electron,rajatsingla28/electron,MaxWhere/electron,joaomoreno/atom-shell,electron/electron,twolfson/electron,shiftkey/electron,rreimann/electron,leftstick/electron,tonyganch/electron,brenca/electron,dongjoon-hyun/electron,tonyganch/electron,felixrieseberg/electron,voidbridge/electron,leftstick/electron,lee... | script/lib/config.py | script/lib/config.py | #!/usr/bin/env python
import errno
import os
import platform
import sys
BASE_URL = os.getenv('LIBCHROMIUMCONTENT_MIRROR') or \
'https://s3.amazonaws.com/github-janky-artifacts/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = 'cfbe8ec7e14af4cabd1474386f54e197db1f7ac1'
PLATFORM = {
'cygwin': 'win32',
'darwin':... | #!/usr/bin/env python
import errno
import os
import platform
import sys
BASE_URL = os.getenv('LIBCHROMIUMCONTENT_MIRROR') or \
'http://github-janky-artifacts.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = 'cfbe8ec7e14af4cabd1474386f54e197db1f7ac1'
PLATFORM = {
'cygwin': 'win32',
'darwin': ... | mit | Python |
632f71651864517cc977f79dcdac7f3b0f516b49 | Add example script to post experiment and task data | niekas/dakis,niekas/dakis,niekas/dakis | scripts/post_data.py | scripts/post_data.py | #!/usr/bin/env python3
import requests
domain = 'http://dakis.gimbutas.lt/api/'
exp_data = {
"description": "First successful post through API",
"algorithm": "TestTasks",
"neighbours": "Nearest",
"stopping_criteria": "x_dist",
"stopping_accuracy": "0.01",
"subregion": "simplex",
"inner_pr... | agpl-3.0 | Python | |
1c5ddc6803853e48eb77bd337fedbaabc56a0102 | Add empty MultiLayerPercetrsons file. | MoriKen254/DeepLearningWithPython | MultiLayerNeuralNetworks/MultiLayerPerceptrons/MultiLayerPerceptrons.py | MultiLayerNeuralNetworks/MultiLayerPerceptrons/MultiLayerPerceptrons.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
u"""
Copyright (c) 2016 Masaru Morita
This software is released under the MIT License.
See LICENSE file included in this repository.
"""
| mit | Python | |
5fc6b3c64b29dc5b17fec90f331cc7a2ca22704f | add main file | snowleung/pysms2email | sms2email.py | sms2email.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
Work at python2.5, iphone4(ios6) with cydia, using hotmail to send the message.
'''
import sqlite3 as sql
import email
import os
import sys
import codecs
import string
import datetime
from Queue import Queue
import time
import threading
import pymail
EMAIL_CONTENT =... | apache-2.0 | Python | |
4e8d4f21749a329dd114926d3654512e9842a1e1 | Change FULL_NAME_FUNCTION to GET_FULL_NAME_FUNCTION. | UWIT-IAM/iam-idbase,jeffFranklin/iam-idbase,UWIT-IAM/iam-idbase,jeffFranklin/iam-idbase,jeffFranklin/iam-idbase,UWIT-IAM/iam-idbase | idbase/views.py | idbase/views.py | from django.shortcuts import render, redirect
from django.conf import settings
from idbase.exceptions import InvalidSessionError
import logging
from importlib import import_module
logger = logging.getLogger(__name__)
def index(request, template=None):
"""Render the Identity home page."""
conf = {'urls': sett... | from django.shortcuts import render, redirect
from django.conf import settings
from idbase.exceptions import InvalidSessionError
import logging
from importlib import import_module
logger = logging.getLogger(__name__)
def index(request, template=None):
"""Render the Identity home page."""
conf = {'urls': sett... | apache-2.0 | Python |
e04bf5dd12a1f5e28258541dcf9d2eb8c5567ad0 | Add tests for lead price | Jamil/sabre_dev_studio | tests/lead_price_tests.py | tests/lead_price_tests.py | import unittest
import datetime
import json
import sys
sys.path.append('..')
import sabre_dev_studio
import sabre_dev_studio.sabre_exceptions as sabre_exceptions
'''
requires config.json in the same directory for api authentication
{
"sabre_client_id": -----,
"sabre_client_secret": -----
}
'''
class TestBasicLead... | mit | Python | |
b7c22cddecb743e9597c92160e3aa0100e149e19 | Introduce hades test fixtures and first tests. | agdsn/pycroft,agdsn/pycroft,lukasjuhrich/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,lukasjuhrich/pycroft,lukasjuhrich/pycroft,lukasjuhrich/pycroft | tests/model/test_hades.py | tests/model/test_hades.py | from datetime import datetime, timedelta
from pycroft.model import session
from pycroft.model.hades import radgroup_property_mappings, radcheck
from tests import FactoryDataTestBase
from tests.factories import PropertyGroupFactory, MembershipFactory, UserWithHostFactory, \
SwitchFactory, PatchPortFactory
class H... | apache-2.0 | Python | |
33bb7c4e026d46dda184d682c89fad7481ab1a77 | Add migration script. | shin-/docker.github.io,shin-/docker.github.io,denverdino/denverdino.github.io,johnstep/docker.github.io,JimGalasyn/docker.github.io,docker-zh/docker.github.io,rillig/docker.github.io,sdurrheimer/compose,shin-/docker.github.io,jzwlqx/denverdino.github.io,JimGalasyn/docker.github.io,gdevillele/docker.github.io,docker-zh/... | contrib/migration/migrate-compose-file-v1-to-v2.py | contrib/migration/migrate-compose-file-v1-to-v2.py | #!/usr/bin/env python
"""
Migrate a Compose file from the V1 format in Compose 1.5 to the V2 format
supported by Compose 1.6+
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import argparse
import logging
import sys
import ruamel.yaml
log = logging.getLogger('migrate')
def migra... | apache-2.0 | Python | |
5fc72b0a6efcd14196d33c8e0ba9b4b763ebf4d1 | Add a parse_time example | dpshelio/sunpy,dpshelio/sunpy,dpshelio/sunpy | examples/parse_time.py | examples/parse_time.py | """
================================================
Parsing times with sunpy.time.parse_time
================================================
Example to show some example usage of parse_time
"""
from datetime import datetime, date
import numpy as np
import pandas
from sunpy.time import parse_time
# dict used for c... | bsd-2-clause | Python | |
71e9a3a7e867b0670871ac46834988b87787c272 | Add import-hacks.py snippet file | cmey/surprising-snippets,cmey/surprising-snippets | import-hacks.py | import-hacks.py | # Can control the import mechanism in Python.
import importlib.abc
import logging
import sys
logging.getLogger().setLevel(logging.INFO)
class LoggingImporter(importlib.abc.Finder):
def find_module(self, name, path=None):
msg = "importing {} on {}".format(name, path)
logging.info(msg)
retur... | mit | Python | |
9d9e82487a6ad9494f65e484392334e89baf7b83 | Add AnalyzerResult class | IPMITMO/statan,IPMITMO/statan,IPMITMO/statan,IPMITMO/statan,IPMITMO/statan,IPMITMO/statan,IPMITMO/statan,IPMITMO/statan,IPMITMO/statan,IPMITMO/statan,IPMITMO/statan | coala/coalib/results/AnalyzerResult.py | coala/coalib/results/AnalyzerResult.py | import uuid
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
class AnalyzerResult:
def __init__(self,
origin,
language: str,
language_ver: str,
project_name: str,
project_version: str,
source_file_path: str,
... | mit | Python | |
c087b8c5da7b97554e7461509cda298282dcde21 | Add sfp_openstreetmaps | smicallef/spiderfoot,smicallef/spiderfoot,smicallef/spiderfoot | modules/sfp_openstreetmaps.py | modules/sfp_openstreetmaps.py | # -*- coding: utf-8 -*-
# -------------------------------------------------------------------------------
# Name: sfp_openstreetmaps
# Purpose: SpiderFoot plug-in to retrieve latitude/longitude coordinates
# for physical addresses from Open Street Maps API.
#
# Author: Brendan Coles <bco... | mit | Python | |
60e4269027adc05db7b585ab51334c8d28cd7a1c | Add assignment writer | jhamrick/original-nbgrader,jhamrick/original-nbgrader | nbgrader/assignment_writer.py | nbgrader/assignment_writer.py | """Based on the FilesWriter class included with IPython."""
import io
import os
import glob
import shutil
from IPython.utils.traitlets import Unicode
from IPython.utils.path import ensure_dir_exists
from IPython.utils.py3compat import unicode_type
from IPython.nbconvert.writers.base import WriterBase
class Assignm... | mit | Python | |
a998eaec11c9ec53e593e2a25542eabab0f75890 | Create __init__.py | SpaceHotDog/Flask_API | app/__init__.py | app/__init__.py | # app/__init__.py
from flask_api import FlaskAPI
from flask_sqlalchemy import SQLAlchemy
# local import
from instance.config import app_config
# initialize sql-alchemy
db = SQLAlchemy()
def create_app(config_name):
app = FlaskAPI(__name__, instance_relative_config=True)
app.config.from_object(app_config[con... | unlicense | Python | |
8abd31b54d4a767a3d04b82b3f6b8c9cae53222e | add build file | fdelbos/coolforms | build.py | build.py | #! /usr/bin/env python
#
# build.py
#
# Created by Frederic DELBOS <fred.delbos@gmail.com> on Nov 22 2013.
# This file is subject to the terms and conditions defined in
# file 'LICENSE.txt', which is part of this source code package.
#
import subprocess, argparse, sys, time, os
from watchdog.observers import Observ... | mit | Python | |
633b6f4c5cecda938f02ff6ccaa529de7b47ce67 | Initialize excelToCSV | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter14/PracticeProject/excelToCSV.py | books/AutomateTheBoringStuffWithPython/Chapter14/PracticeProject/excelToCSV.py | # Using the openpyxl module, write a program that reads all the Excel files in the
# current working directory and outputs them as CSV files.
# A single Excel file might contain multiple sheets; you’ll have to create one CSV
# file per sheet. The filenames of the CSV files should be
# <excel filename>_<sheet title>.csv... | mit | Python | |
09181bd4c11501fa9e8274651370e45ac8d83316 | add vars01.py | devlights/try-python | trypython/basic/vars01.py | trypython/basic/vars01.py | # coding: utf-8
"""
vars()についてのサンプルです。
"""
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import pr
class Sample(SampleBase):
def exec(self):
#
# vars() は、引数無しで呼ぶと locals() と同じ
# 引数を付与して呼ぶと、そのオブジェクトの __dict__ を返す
#
x = 10
y = 20
... | mit | Python | |
7577933c1e016ee6d4bca73bfa3434dc19c55315 | add basic initialization | sammdot/circa | circa.py | circa.py | import logging
import client
class Circa(client.Client):
def __init__(self, conf):
conf["autoconn"] = False
logging.basicConfig(filename=conf.get("log", "circa.log"), level=logging.INFO,
style="%", format="%(asctime)s %(levelname)s %(message)s")
if "log" in conf:
logging.basicConfig(filename=conf["log"])
... | bsd-3-clause | Python | |
ed479cf11540c6a67bb4b51eed42b91abd869090 | Add html_doc.py | Samuel-L/cli-ws,Samuel-L/cli-ws | tests/test_files/html_doc.py | tests/test_files/html_doc.py | doc = """<!DOCTYPE html>
<html>
<head>
<title>Html document</title>
</head>
<body>
<div>
<h1>H1 Tag</h1>
<h1 class='class-name'>H1 Tag with class</h1>
<h1 id='id-name'>H1 Tag with id</h1>
<p class='class-name'>P tag with class</p>
</div>
</body>
</html>""" | mit | Python | |
308744d8a022c7fc25af4f2ef8a6214cdcf014f9 | Add additional attributes to GPSLogger (#4755) | MungoRae/home-assistant,LinuxChristian/home-assistant,stefan-jonasson/home-assistant,jawilson/home-assistant,sdague/home-assistant,jamespcole/home-assistant,jawilson/home-assistant,molobrakos/home-assistant,auduny/home-assistant,nugget/home-assistant,nkgilley/home-assistant,morphis/home-assistant,auduny/home-assistant,... | homeassistant/components/device_tracker/gpslogger.py | homeassistant/components/device_tracker/gpslogger.py | """
Support for the GPSLogger platform.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.gpslogger/
"""
import asyncio
from functools import partial
import logging
from homeassistant.const import HTTP_UNPROCESSABLE_ENTITY
from homeassistant... | """
Support for the GPSLogger platform.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.gpslogger/
"""
import asyncio
from functools import partial
import logging
from homeassistant.const import HTTP_UNPROCESSABLE_ENTITY
from homeassistant... | apache-2.0 | Python |
e9ccfeb5b1bc5e30756075c1afd229f3691ac5ac | add python translation of centered smd_nfw | jesford/smd_nfw,jesford/smd-nfw | smd_nfw.py | smd_nfw.py | from __future__ import absolute_import, division, print_function
import numpy as np
from astropy import units
rbins = np.loadtxt('smd_in1.dat')
nbins = rbins.shape[0]
rbins = rbins * units.Mpc
data = np.loadtxt('smd_in2.dat')
nlens = data.shape[0]
rs = data[:,0] * units.Mpc
delta_c = data[:,1] #dimensionless
rho_cr... | mit | Python | |
8f32a5be4ffc427a1fbc6bf700edc81b191e876f | add tests for basic funcionality | terceiro/squad,terceiro/squad,terceiro/squad,terceiro/squad | test/api/test_rest.py | test/api/test_rest.py | import json
from test.api import APIClient
from django.test import TestCase
from squad.core import models
from squad.ci import models as ci_models
class RestApiTest(TestCase):
def setUp(self):
self.group = models.Group.objects.create(slug='mygroup')
self.project = self.group.projects.create(slug=... | agpl-3.0 | Python | |
86c6dcc8fe0ac739ed1ae1a7898ea609fe959c61 | add spectra extraction script | amirkdv/biseqt,amirkdv/biseqt,amirkdv/biseqt | spectra.py | spectra.py | import sqlite3
import igraph
import os
from matplotlib import pyplot as plt
db = 'genome.leishmania.hp_assembly.db'
wordlen = 10
base_dir = 'spectra-%d' % wordlen
pos_dir = os.path.join(base_dir, 'positive')
neg_dir = os.path.join(base_dir, 'negative')
num_bins = 1000
ylim = (0,100)
xlim = (-15000,15000)
G = igraph.re... | bsd-3-clause | Python | |
d42b2ee3eb60a0c11c1a973e030de909519ba662 | Add garage.argparse.add_bool_argument | clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage | garage/argparse.py | garage/argparse.py | __all__ = [
'add_bool_argument',
]
import argparse
def add_bool_argument(parser, *args, **kwargs):
kwargs = dict(kwargs) # Make a copy before modifying it...
kwargs['choices'] = (True, False)
kwargs['type'] = parse_bool
parser.add_argument(*args, **kwargs)
def parse_bool(string):
try:
... | mit | Python | |
10f9b0d1b02c2b5f4c4eeac0c1f803657c89764b | add example file for smooth OT | rflamary/POT,rflamary/POT | examples/plot_OT_1D_smooth.py | examples/plot_OT_1D_smooth.py | # -*- coding: utf-8 -*-
"""
====================
1D optimal transport
====================
This example illustrates the computation of EMD, Sinkhorn and smooth OT plans
and their visualization.
"""
# Author: Remi Flamary <remi.flamary@unice.fr>
#
# License: MIT License
import numpy as np
import matplotlib.pylab as ... | mit | Python | |
82dda8f12060ba0d3f83b6a9ff92bfcfbb212e25 | Add utils | aitoralmeida/intellidata,aitoralmeida/intellidata | utils/extract_zipcodes.py | utils/extract_zipcodes.py | import json
from bbvalib import create_mongoclient
db = create_mongoclient()
zipcodes = set()
zipcodes.update(db.top_clients_week.find().distinct("shop_zipcode"))
zipcodes.update(db.top_clients_month.find().distinct("shop_zipcode"))
zipcodes.update(db.top_clients_week.find().distinct("home_zipcode"))
zipcodes.update(... | apache-2.0 | Python | |
31110631d7fa43c695bc1f5504cd02c3d0cab745 | Add some tests | antismash/db-api,antismash/db-api | tests/test_error_handlers.py | tests/test_error_handlers.py | from testutils import app # noqa: F401
def test_not_found(client):
'''Test 404 error handler'''
results = client.get('/totally/made/up')
assert results.status_code == 404
assert results.json == {'error': 'Not found'}
def test_method_not_allowed(client):
'''Test 405 error handler'''
results ... | agpl-3.0 | Python | |
9d5be9d464168a3d9e9b3265a1581e0359f69f2a | test for #579 | RDFLib/rdflib,RDFLib/rdflib,RDFLib/rdflib,RDFLib/rdflib | test/test_issue579.py | test/test_issue579.py | # test for https://github.com/RDFLib/rdflib/issues/579
from rdflib import Graph, URIRef, Literal, Namespace
from rdflib.namespace import FOAF, RDF
g = Graph()
g.bind('foaf', FOAF)
n = Namespace("http://myname/")
g.add((n.bob, FOAF.name, Literal('bb')))
# query is successful.
assert len(g.query("select ?n where { ?n f... | bsd-3-clause | Python | |
d9b4b0d913304b19365854b0ffceab179237d8f8 | Add tests for float->int symbols (esp for 32-bit windows and linux) | numba/numba,stonebig/numba,stefanseefeld/numba,sklam/numba,seibert/numba,pitrou/numba,GaZ3ll3/numba,IntelLabs/numba,pombredanne/numba,stonebig/numba,gdementen/numba,pitrou/numba,pombredanne/numba,pitrou/numba,sklam/numba,ssarangi/numba,numba/numba,cpcloud/numba,stuartarchibald/numba,pombredanne/numba,seibert/numba,jrie... | numba/tests/test_floatsyms.py | numba/tests/test_floatsyms.py | from __future__ import print_function
import numba.unittest_support as unittest
from numba.compiler import compile_isolated
from numba import types
class TestFloatSymbols(unittest.TestCase):
"""
Test ftol symbols on windows
"""
def _test_template(self, realty, intty):
def cast(x):
... | bsd-2-clause | Python | |
45a6e108418944026f6d67fa018573a831dc5107 | add mul_recds.py | r2k0/flask-apps,r2k0/flask-apps | test/sql/mul_recds.py | test/sql/mul_recds.py | import sqlite3
with sqlite3.connect("new.db") as connection:
c = connection.cursor()
cities = [
('Boston','MA',600000)
]
| mit | Python | |
aa320afb447ab8486720a05f0613cad446c9bea9 | Add graph module. | sk89q/Plumeria,sk89q/Plumeria,sk89q/Plumeria | plumeria/plugins/graph.py | plumeria/plugins/graph.py | import asyncio
import io
import re
import matplotlib
import pkg_resources
from plumeria.command import commands, CommandError
from plumeria.message import Response, MemoryAttachment
from plumeria.util.ratelimit import rate_limit
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.font_manager as... | mit | Python | |
8ff6f08a497adba17bd02eae9ec6425a71927e08 | Update admin.py | imgmix/django-avatar,MachineandMagic/django-avatar,jezdez/django-avatar,brajeshvit/avatarmodule,therocode/django-avatar,ad-m/django-avatar,dannybrowne86/django-avatar,allenling/django-avatar,therocode/django-avatar,barbuza/django-avatar,ad-m/django-avatar,tbabej/django-avatar,brajeshvit/avatarmodule,jezdez/django-avata... | avatar/admin.py | avatar/admin.py | from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django.utils import six
from django.template.loader import render_to_string
from avatar.models import Avatar
from avatar.signals import avatar_updated
from avatar.util import get_user_model
class AvatarAdmin(admin.ModelAdmi... | from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from avatar.models import Avatar
from avatar.signals import avatar_updated
from avatar.templatetags.avatar_tags import avatar
from avatar.util import get_user_model
class AvatarAdmin(admin.ModelAdmin):
list_display = ('get_a... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.