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 |
|---|---|---|---|---|---|---|---|---|
cf7e9dfec0c0cdab913f98ff325210b552610219 | Add new runner, search! | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/runners/search.py | salt/runners/search.py | '''
Runner frontend to search system
'''
# Import salt libs
import salt.search
import salt.output
def query(term):
'''
Query the search system
'''
search = salt.search.Search(__opts__)
result = search.query(term)
salt.output.display_output(result, 'pprint', __opts__)
return result
| apache-2.0 | Python | |
da704e95b010330efd350e7ed85e51f252b8a453 | add missing migration | aldryn/aldryn-redirects,aldryn/aldryn-redirects | aldryn_redirects/migrations/0002_on_delete_and_verbose_names.py | aldryn_redirects/migrations/0002_on_delete_and_verbose_names.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-22 08:03
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('aldryn_redirects', '0001_initial'),
]
operations = ... | bsd-3-clause | Python | |
17ae9e25663d029af11236584b4c759c895ae830 | Improve and consolidate condition scripts of Lithium to support timeouts and regex via optparse. r=Jesse | nth10sd/funfuzz,nth10sd/funfuzz,MozillaSecurity/funfuzz,MozillaSecurity/funfuzz,nth10sd/funfuzz,MozillaSecurity/funfuzz | util/fileIngredients.py | util/fileIngredients.py | #!/usr/bin/env python
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import with_statement
import re
def fileContains(f, s, isRegex):
if isRege... | mpl-2.0 | Python | |
03baa59cea76ab85f661bfa3e8d910fd6a7ae82a | Remove leading slash in redirections | andredias/nikola,x1101/nikola,xuhdev/nikola,xuhdev/nikola,gwax/nikola,x1101/nikola,wcmckee/nikola,xuhdev/nikola,xuhdev/nikola,okin/nikola,getnikola/nikola,knowsuchagency/nikola,knowsuchagency/nikola,okin/nikola,andredias/nikola,okin/nikola,knowsuchagency/nikola,gwax/nikola,getnikola/nikola,getnikola/nikola,wcmckee/niko... | nikola/plugins/task/redirect.py | nikola/plugins/task/redirect.py | # -*- coding: utf-8 -*-
# Copyright © 2012-2016 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation
# the rights t... | # -*- coding: utf-8 -*-
# Copyright © 2012-2016 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation
# the rights t... | mit | Python |
21ef2114975a315815d960fd1f28c5e4036fb935 | Update browsermark to use results.AddValue(..) | crosswalk-project/chromium-crosswalk-efl,chuan9/chromium-crosswalk,bright-sparks/chromium-spacewalk,krieger-od/nwjs_chromium.src,M4sse/chromium.src,littlstar/chromium.src,markYoungH/chromium.src,Fireblend/chromium-crosswalk,axinging/chromium-crosswalk,hgl888/chromium-crosswalk,ondra-novak/chromium.src,M4sse/chromium.sr... | tools/perf/benchmarks/browsermark.py | tools/perf/benchmarks/browsermark.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Runs Browsermark CSS, DOM, WebGL, JS, resize and page load benchmarks.
Browsermark benchmark suite have five test groups:
a) CSS group: measures your bro... | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Runs Browsermark CSS, DOM, WebGL, JS, resize and page load benchmarks.
Browsermark benchmark suite have five test groups:
a) CSS group: measures your bro... | bsd-3-clause | Python |
b0a6192649dd47548e007410b9f1a60ec23466de | Add files via upload | sainzad/stackOverflowCodeIdentifier | XMLAnalyze2.py | XMLAnalyze2.py | # Author: Andrew Sainz
#
# Purpose: XMLParser is designed to iterate through a collection of Post data collected from Stack Overflow
# forums. Data collected to analize the code tagged information to find the language of the code
# being utilized.
#
# How to use: To run from command line input "python... | mit | Python | |
8204a8b84cdcd515ea1dcf7ab67574b6db5baca6 | Add WS caller | ncarro/openacademy-project | web_services/ws_test.py | web_services/ws_test.py | import functools
import xmlrpclib
HOST = 'localhost'
PORT = 8069
DB = 'odoo_curso'
USER = 'admin'
PASS = 'admin'
ROOT = 'http://%s:%d/xmlrpc/' % (HOST,PORT)
# 1. Login
uid = xmlrpclib.ServerProxy(ROOT + 'common').login(DB,USER,PASS)
print "Logged in as %s (uid:%d)" % (USER,uid)
call = functools.partial(
xmlrpclib... | apache-2.0 | Python | |
605fb4c6726d0c66bada870bffe526d493195b33 | Create USN.py | JadedCoder712/Final-Project | USN.py | USN.py | #Spooky scary skeeletons send shiveers down your spine
#You are a gunner in the Navy. Destroy the Commies.
| mit | Python | |
129e548ac0be8ee3a60dd85aca9d095456b7d3a6 | Add new py-testresources package (#14031) | LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/py-testresources/package.py | var/spack/repos/builtin/packages/py-testresources/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 PyTestresources(PythonPackage):
"""Testresources, a pyunit extension for managing expensiv... | lgpl-2.1 | Python | |
3e7b9b69e68c8594eac92d88f0579aab40d7d5ae | Test aborting queued live migration | mahak/nova,openstack/nova,mahak/nova,mahak/nova,openstack/nova,openstack/nova | nova/tests/functional/libvirt/test_live_migration.py | nova/tests/functional/libvirt/test_live_migration.py | # Copyright 2021 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | apache-2.0 | Python | |
226238bf4c672a58bb6c066f79301701d594a5c0 | Add notobuilder script | googlei18n/noto-source,googlei18n/noto-source,googlefonts/noto-source,googlefonts/noto-source,googlei18n/noto-source,googlefonts/noto-source | scripts/notobuilder.py | scripts/notobuilder.py | """Build a Noto font from one or more source files.
By default, places unhinted TTF, hinted TTF, OTF and (if possible) variable
fonts into the ``output/`` directory.
Currently does not support building from Monotype sources.
"""
import logging
import os
import re
import sys
from gftools.builder import GFBuilder
from... | apache-2.0 | Python | |
f8712c62ad069b815ff775bd758bdbf693bdbdb7 | Add some constants. | williamgibb/pyFuckery,williamgibb/pyFuckery | src/pyfuckery/constants.py | src/pyfuckery/constants.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# XXX Update Docstring
"""
pyFuckery - constants.py
Created on 2/12/17.
"""
# Stdlib
import logging
import re
# Third Party Code
# Custom Code
log = logging.getLogger(__name__)
# Brainfuck tokens
SYM_PTR_INC = '>'
SYM_PTR_DEC = '<'
SYM_DATA_INC = '+'
SYM_DATA_DEC = '-'
... | mit | Python | |
c97e44697444b15686bd0a6b5158c90630958238 | Add LRU example | voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts | lru.py | lru.py | from datetime import datetime
class LRUCacheItem(object):
"""Data structure of items stored in cache"""
def __init__(self, key, item):
self.key = key
self.item = item
self.timestamp = datetime.now()
class LRUCache(object):
"""A sample class that implements LRU algorithm"""
d... | mit | Python | |
dd7ffbf97f9ae8426d7f60e465941f3f70bccdd6 | add file | curtisxk38/cs3240-labdemo | new.py | new.py | print("test")
| mit | Python | |
494c8b88727dc958a7ba37f76d4c470837d26e1d | Define register files | nickdrozd/ecio-lisp,nickdrozd/ecio-lisp | reg.py | reg.py | EXP = 'EXP'
VAL = 'VAL'
ENV = 'ENV'
UNEV = 'UNEV'
FUNC = 'FUNC'
ARGL = 'ARGL'
CONT = 'CONT'
CURR = 'CURR'
STACK = 'STACK' | mit | Python | |
1c46aa8a03e577ddb3db55a11df3db70905110d2 | Add serial_logger.py | ethanhart/arduino-climate | serial_logger.py | serial_logger.py | #!/usr/bin/env python
# encoding: utf-8
# Log serial monitor data
# TO-DO: add options for serial device, baud rate
import serial
import datetime
ser = serial.Serial('/dev/cu.usbmodemfa131', 9600)
now = datetime.datetime.now()
def get_date_string():
day = now.day
month = now.month
year = now.year
cu... | mit | Python | |
0df0daf7f52015258c3607bb2822c1c77c5e8207 | add tensorflow sample | soy-curd/Snippets,soy-curd/Snippets,soy-curd/Snippets,soy-curd/Snippets,soy-curd/Snippets,soy-curd/Snippets,soy-curd/Snippets,soy-curd/Snippets | python/other/flow.py | python/other/flow.py | import tensorflow as tf
a = tf.constant(1, name="a")
b = tf.constant(1, name="b")
c = a + b
print(c)
graph = tf.get_default_graph()
print(graph.as_graph_def())
with tf.Session() as sess:
print(sess.run(c)) | mit | Python | |
fdc900d5da48ae9aea1c7537e026dc2d46c62bc8 | add some reuseable aggregation code | oss/shrunk,oss/shrunk,oss/shrunk,oss/shrunk,oss/shrunk | shrunk/aggregations.py | shrunk/aggregations.py |
def match_short_url(url):
return {"$match": {"short_url":url}}
def match_id(id):
return {"$match": {"short_url":url}}
#monthly visits aggregations phases
group_ips={"$group": {
"_id": "$source_ip",
"times": {
"$addToSet": "$time"
},
"count": {
"$sum": 1
}
}}
take_first_vi... | mit | Python | |
f9da8c4aa061223dac5147f6eaec6ad3419d1d6a | Add cli module to accept a language option | hackebrot/cookiedozer,hackebrot/cookiedozer | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/cli.py | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/cli.py | import os
os.environ["KIVY_NO_ARGS"] = "1"
import click
from {{cookiecutter.repo_name}}.{{cookiecutter.repo_name}} import {{cookiecutter.app_class_name}}
@click.command()
@click.option(
'-l', '--language', help='Default language of the App', default='en',
type=click.Choice(['en', 'de'])
)
def main(language)... | mit | Python | |
d7ea709e50510016bb448cb45e159528e416f08b | Create dianping_spider.py | EclipseXuLu/DataHouse,EclipseXuLu/DataHouse | DataHouse/crawler/dianping/dianping_spider.py | DataHouse/crawler/dianping/dianping_spider.py | """
a web spider for daz hong dian ping
"""
import time
import requests
from bs4 import BeautifulSoup
from lxml import etree
import pandas as pd
from pymongo import MongoClient
CITY_FILEPATH = 'city.xml'
CATEGORY_FILEPATH = 'type.xml'
SLEEP_TIME = 2
class City(object):
def __init__(self, pinyin, id, name):
... | mit | Python | |
195b74304fa1c5eab3bc2e16df1346c2f92916f8 | Test py | exonum/exonum,exonum/exonum,alekseysidorov/exonum,alekseysidorov/exonum,alekseysidorov/exonum,alekseysidorov/exonum,exonum/exonum,exonum/exonum | testnet/tests/configs_api_test.py | testnet/tests/configs_api_test.py | #!/usr/bin/env python3
import unittest
import datetime
from exonum import ExonumApi, random_hex
class ConfigsApi(ExonumApi):
def new_config_propose(self, config, height, actual_from_height):
tx, c = self.send_transaction("config/propose", {"config": config, "height": height, "actual_from_height": ac... | apache-2.0 | Python | |
1f24571c358941932860eab9b46b386adc7c7ecc | Add script to output the users with unassigned tickets | EuroPython/epcon,matrixise/epcon,malemburg/epcon,barrachri/epcon,barrachri/epcon,matrixise/epcon,matrixise/epcon,artcz/epcon,artcz/epcon,matrixise/epcon,malemburg/epcon,barrachri/epcon,artcz/epcon,matrixise/epcon,PythonSanSebastian/epcon,artcz/epcon,barrachri/epcon,EuroPython/epcon,malemburg/epcon,artcz/epcon,PythonSan... | p3/management/commands/users_with_unassigned_tickets.py | p3/management/commands/users_with_unassigned_tickets.py | # -*- coding: utf-8 -*-
""" Print information of the users who got unassigned tickets."""
from django.core.management.base import BaseCommand, CommandError
from django.core import urlresolvers
from conference import models
from conference import utils
from p3 import models as p3_models
from ... | bsd-2-clause | Python | |
aa720214722ca6ea445cf4ba38aa5f51ef7772b4 | add random user for notes | ThinkmanWang/NotesServer,ThinkmanWang/NotesServer,ThinkmanWang/NotesServer | add_random_user.py | add_random_user.py | #!/usr/bin/python
#coding=utf-8
import sys
import MySQLdb
from DBUtils.PooledDB import PooledDB
import hashlib
import time
import random
g_dbPool = PooledDB(MySQLdb, 5, host='function-hz.com', user='notes', passwd='welc0me', db='db_notes', port=3306, charset = "utf8", use_unicode = True);
def create_ra... | apache-2.0 | Python | |
05aa314ac9b5d38bb7a30e30aced9b27b2797888 | Add tests for non-async constructs | github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql | python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/test_syntax.py | python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/test_syntax.py | # Add taintlib to PATH so it can be imported during runtime without any hassle
import sys; import os; sys.path.append(os.path.dirname(os.path.dirname((__file__))))
from taintlib import *
# This has no runtime impact, but allows autocomplete to work
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ..taintlib... | mit | Python | |
388c51ea5f83f718b885d784b566bc1873998c3a | add management command used to find all duplicate districts | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | custom/icds_reports/management/commands/find_duplicate_district_topojsons.py | custom/icds_reports/management/commands/find_duplicate_district_topojsons.py | from django.core.management import BaseCommand
from custom.icds_reports.utils.topojson_util.topojson_util import get_topojson_file_for_level, \
get_district_topojson_data
class Command(BaseCommand):
help = "Prints out any districts whose names are duplicated across states."
def handle(self, *args, **kwa... | bsd-3-clause | Python | |
8634db8fe61f819cf24023514d94e4ebfc7e819f | Add Stats() class | auth0/auth0-python,auth0/auth0-python | auth0/v2/stats.py | auth0/v2/stats.py | from .rest import RestClient
class Stats(object):
"""Auth0 stats endpoints
Args:
domain (str): Your Auth0 domain, e.g: 'username.auth0.com'
jwt_token (str): An API token created with your account's global
keys. You can create one by using the token generator in the
AP... | mit | Python | |
c1fcf54b63de95c85a9505d83062d8b320b1cbdf | Add python cloudfront update_distribution example to replace ACM Certificate | awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,awsdocs/aws-doc-sdk-examples,a... | python/example_code/cloudfront/update_distribution_certificate.py | python/example_code/cloudfront/update_distribution_certificate.py | # Copyright 2010-2018 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file ac... | apache-2.0 | Python | |
b861b70e72b582a1bd3ae3ae6fa8ae2478b4ebe4 | add the tests | UDST/synthpop,synthicity/synthpop,sfcta/synthpop,SEMCOG/synthpop,bhargavasana/synthpop,hanase/synthpop | popgen/test/test_categorizer.py | popgen/test/test_categorizer.py | import pytest
import numpy as np
from ..census_helpers import Census
from .. import categorizer as cat
@pytest.fixture
def c():
return Census("827402c2958dcf515e4480b7b2bb93d1025f9389")
@pytest.fixture
def acs_data(c):
population = ['B01001_001E']
sex = ['B01001_002E', 'B01001_026E']
race = ['B02001... | bsd-3-clause | Python | |
151293037b941aba874fb2641c1bf982e2143beb | Create solution.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | hackerrank/algorithms/implementation/medium/the_time_in_words/py/solution.py | hackerrank/algorithms/implementation/medium/the_time_in_words/py/solution.py | #!/bin/python3
import sys
def solution(hrs, min):
lookup = {
0: 'zero',
1: 'one',
2: 'two',
3: 'three',
4: 'four',
5: 'five',
6: 'six',
7: 'seven',
8: 'eight',
9: 'nine',
10: 'ten',
11: 'eleven',
12: 'twelve',... | mit | Python | |
8ba0fcfa893e007f1c6cc794a36bd3604498c380 | add rapiro.py | oga00000001/RapiroTools | rapiroController.kivy/rapiro.py | rapiroController.kivy/rapiro.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import serial
import os
import time
import datetime
import threading
_str = ''
if os.name == 'posix':
com = serial.Serial('/dev/ttyAMA0', 57600, timeout = 0.05)
else:
com = sys.stdout
def a2dist(v):
d = 26.59*pow(v/1024.0*5.0,-1.209)
return(d)
... | mit | Python | |
a2848885e85ad6d9685bb8ae35747300ed4b6b8b | Add a BaseTokenizer | mozilla/spicedham,mozilla/spicedham | spicedham/tokenizer.py | spicedham/tokenizer.py | class BaseTokenizer(object):
def __init__(self, config):
pass
def tokenize(self, text):
return [text]
| mpl-2.0 | Python | |
75a882bf38c88d73e38d13fbb8b1499ff4ae4ea6 | Add migration for changing users added by OSF for meetings with emails for fullnames to their guid | felliott/osf.io,adlius/osf.io,felliott/osf.io,adlius/osf.io,saradbowman/osf.io,HalcyonChimera/osf.io,brianjgeiger/osf.io,Johnetordoff/osf.io,CenterForOpenScience/osf.io,mfraezz/osf.io,adlius/osf.io,felliott/osf.io,mattclark/osf.io,cslzchen/osf.io,CenterForOpenScience/osf.io,felliott/osf.io,pattisdr/osf.io,brianjgeiger/... | scripts/remove_after_use/set_meetings_users_fullnames_to_guids.py | scripts/remove_after_use/set_meetings_users_fullnames_to_guids.py | import sys
import logging
import django
from django.db import transaction
django.setup()
from osf.models import OSFUser
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
def main():
dry_run = '--dry' in sys.argv
with transaction.atomic():
users = OSFUser.objects.filter(ful... | apache-2.0 | Python | |
a6b35a9a94b2e4b32c2236258812b44e81184515 | Add management command for resyncing mobile worker location user data | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq | corehq/apps/users/management/commands/fix_location_user_data.py | corehq/apps/users/management/commands/fix_location_user_data.py | from corehq.apps.locations.models import Location
from corehq.apps.users.models import CommCareUser
from dimagi.utils.couch.database import iter_docs
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
args = "domain"
help = "Fix location user data for mobile workers.... | bsd-3-clause | Python | |
a31ef338ef4029be92b0c578bdd12706a0f1c17d | Move zpool grains into salt.grains.zpool | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/grains/zpool.py | salt/grains/zpool.py | # -*- coding: utf-8 -*-
'''
ZFS grain provider
:maintainer: Jorge Schrauwen <sjorge@blackdot.be>
:maturity: new
:depends: salt.utils, salt.module.cmdmod
:platform: illumos,freebsd,linux
.. versionadded:: Oxygen
'''
from __future__ import absolute_import
# Import python libs
import logging
# Impo... | apache-2.0 | Python | |
bb8a448e5e3f935f5ee4f8da9c78bcb651486c15 | Create ZigZagConversion_002.py | Chasego/cod,cc13ny/algo,cc13ny/Allin,Chasego/codi,Chasego/codirit,Chasego/codi,Chasego/cod,Chasego/cod,Chasego/codirit,Chasego/codirit,cc13ny/Allin,Chasego/codi,cc13ny/algo,cc13ny/algo,Chasego/cod,Chasego/codi,cc13ny/Allin,Chasego/codirit,Chasego/cod,Chasego/codi,cc13ny/Allin,Chasego/codirit,cc13ny/Allin,cc13ny/algo,cc... | leetcode/006-ZigZag-Conversion/ZigZagConversion_002.py | leetcode/006-ZigZag-Conversion/ZigZagConversion_002.py | class Solution:
# @param {string} s
# @param {integer} numRows
# @return {string}
def convert(self, s, numRows):
if numRows < 2:
return s
halfsize = numRows - 1
size = 2 * halfsize
res = ''
for i in range(numRows):
j, cnt = i, 1
... | mit | Python | |
95fcdd4f2f65a330adcb115b7ce6d6084efc6ae8 | Add examples. | tillahoffmann/util | examples/sampling/metropolis.py | examples/sampling/metropolis.py | #!/usr/bin/env python
import numpy as np
from util import MetropolisSampler, log_gaussian
from matplotlib import pyplot as plt
def __main__():
np.random.seed(4)
# Generate parameters
num_dims = 3
mu = np.random.normal(0, 3, num_dims)
cov = np.diag(np.random.gamma(.5, size=num_dims))
# Create ... | mit | Python | |
415717bddb00ca650bef61a5c6054a7b47575b56 | Implement unit test for break. | iksteen/jaspyx,ztane/jaspyx | jaspyx/tests/visitor/test_break.py | jaspyx/tests/visitor/test_break.py | import ast
from jaspyx.ast_util import ast_store, ast_load
from jaspyx.tests.visitor.v8_helper import V8Helper
class TestBreak(V8Helper):
def test_break(self):
assert self.run(
[
ast.Assign(
[ast_store('i')],
ast.Num(0),
)... | mit | Python | |
a1e451ab3525c5a0852782d1990f848b2329cb72 | add sinawb token | AsherYang/ThreeLine,AsherYang/ThreeLine,AsherYang/ThreeLine | server/crawler/sinawb/TokenConstant.py | server/crawler/sinawb/TokenConstant.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Author: AsherYang
Email: ouyangfan1991@gmail.com
Date: 2017/9/22.
Desc: sinaWeibo appkey
@see: http://open.weibo.com/apps/2489615368/info/basic?action=review
"""
domain="https://api.weibo.com/2/"
token=""
appkey = "2489615368"
secret = "dbb84df92e9a9c8f8e10d9985a8038a... | apache-2.0 | Python | |
1a9b6c7c58c5960df18335552780c3ca668dea5e | add evaluation script for ihm | YerevaNN/mimic3-benchmarks | evaluation/evalutate_ihm.py | evaluation/evalutate_ihm.py | import sklearn.utils as sk_utils
from mimic3models import metrics
import numpy as np
import pandas as pd
import argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument('prediction', type=str)
parser.add_argument('--test_listfile', type=str, default='../data/in-hospital-mortality/test/l... | mit | Python | |
e3c17a893ef4e0790af05cc238ac9038923b115a | Create docs directory for sphinx integration | NCRA-TIFR/gadpu,NCRA-TIFR/gadpu | docs/__init__.py | docs/__init__.py | #TODO:Create DOCS files for later integration using Sphinx
| mit | Python | |
c206cfd940dd8ba58edb86f16691bcf50b6e5e30 | Add modgraph.py demo from Michael Hohn <mhhohn@lbl.gov> | tkelman/graphviz,tkelman/graphviz,MjAbuz/graphviz,BMJHayward/graphviz,ellson/graphviz,jho1965us/graphviz,kbrock/graphviz,kbrock/graphviz,MjAbuz/graphviz,pixelglow/graphviz,BMJHayward/graphviz,jho1965us/graphviz,jho1965us/graphviz,tkelman/graphviz,ellson/graphviz,tkelman/graphviz,kbrock/graphviz,BMJHayward/graphviz,pixe... | tclpkg/gv/demo/modgraph.py | tclpkg/gv/demo/modgraph.py | #!/usr/bin/python
# display the kernel module dependencies
# author: Michael Hohn <mhholn@lbl.gov>
# based on: modgraph.tcl by John Ellson <ellson@research.att.com>
import sys
# sys.path.append('/usr/lib/graphviz/python')
sys.path.append('/usr/lib64/graphviz/python')
import gv
modules = open("/proc/modules", 'r').... | epl-1.0 | Python | |
5c7a4547558e6f6959ae1878f56efef8716456c4 | add script to convert distances into probabilities | hbredin/byzance | scripts/distance2probability.py | scripts/distance2probability.py | #!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2014 Hervé BREDIN
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without lim... | mit | Python | |
2197e16cf20bba5d373f4b7a250b8f1190be8ede | Add focus attribute example. | acrisci/i3ipc-python | examples/focused-windows.py | examples/focused-windows.py | #!/usr/bin/env python3
from argparse import ArgumentParser
import i3ipc
i3 = i3ipc.Connection()
def focused_windows():
tree = i3.get_tree()
workspaces = tree.workspaces()
for workspace in workspaces:
container = workspace
while container:
if not hasattr(container, 'focus') \
or not co... | bsd-3-clause | Python | |
e7146bbee86ea744d080f18a4f27def9cb26e33e | add corpus_test1.py to see how to parse music21 songs | fretboardfreak/potty_oh,fretboardfreak/potty_oh | experiments/corpus_test1.py | experiments/corpus_test1.py | #!/usr/bin/env python3
# Copyright 2016 Curtis Sand
#
# 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 la... | apache-2.0 | Python | |
6ccdf23c67af632a46017d63b5f51d2c207be0ab | Add file | SuLab/scheduled-bots,SuLab/scheduled-bots,SuLab/scheduled-bots | scheduled_bots/scripts/merge_duplicate_gene_proteins.py | scheduled_bots/scripts/merge_duplicate_gene_proteins.py | from tqdm import tqdm
from wikidataintegrator.wdi_core import WDItemEngine, MergeError
from wikidataintegrator.wdi_login import WDLogin
from scheduled_bots.local import WDUSER, WDPASS
login = WDLogin(WDUSER, WDPASS)
s_protein = """
SELECT DISTINCT ?item1 ?item2 ?value {{
?item1 wdt:P352 ?value .
?item2 wdt:P352 ?va... | mit | Python | |
495da73f305a2a0e79a28d251b5b93caea06656d | Add UglifyJS as a filter. | Carlangueitor/django-mediagenerator,adieu/django-mediagenerator,Carlangueitor/django-mediagenerator,adieu/django-mediagenerator | mediagenerator/filters/uglifier.py | mediagenerator/filters/uglifier.py | from django.conf import settings
from django.utils.encoding import smart_str
from mediagenerator.generators.bundles.base import Filter
class Uglifier(Filter):
def __init__(self, **kwargs):
super(Uglifier, self).__init__(**kwargs)
assert self.filetype == 'js', (
'Uglifier only supports c... | bsd-3-clause | Python | |
660a3c5f3f8a4c63c21c27ce58c5639d37409ae1 | add thing to filter tracts | kyleconroy/bitewise,kyleconroy/bitewise,kyleconroy/bitewise | filter_tracts.py | filter_tracts.py | import json
calif_tracts_data = open('tracts.json')
calif_tracts = json.load(calif_tracts_data)
sf_tracts = []
for r in calif_tracts["features"]:
if r["properties"]["COUNTY"] == "075":
sf_tracts.append(r)
calif_tracts_data.close()
print json.dumps({"type": "FeatureCollection", "features": sf_tracts}) | mit | Python | |
68a720ab539c6ba94fdf181328f27be453a9097f | Add examine_latent.py script | KelvinLu/krotos-convnet | examine_latent.py | examine_latent.py | # Examine the Million Song Dataset. Running this script will visualize each Echo
# Nest Taste Profile songs' latent features with t-SNE.
import os, subprocess
import matplotlib.pyplot as plt
from matplotlib.text import Annotation
import numpy as np
from sklearn.preprocessing import StandardScaler
from sklearn.manifold... | mit | Python | |
e687dce8c8441728f1af6336497f7a131730db4f | Add untracked campaigns.py | mattclark/osf.io,brandonPurvis/osf.io,DanielSBrown/osf.io,adlius/osf.io,samchrisinger/osf.io,jnayak1/osf.io,ticklemepierce/osf.io,GageGaskins/osf.io,felliott/osf.io,abought/osf.io,HalcyonChimera/osf.io,ticklemepierce/osf.io,monikagrabowska/osf.io,acshi/osf.io,cslzchen/osf.io,mfraezz/osf.io,aaxelb/osf.io,cwisecarver/osf... | framework/auth/campaigns.py | framework/auth/campaigns.py | import httplib as http
from framework.exceptions import HTTPError
from website import mails
VALID_CAMPAIGNS = (
'prereg',
)
EMAIL_TEMPLATE_MAP = {
'prereg': mails.CONFIRM_EMAIL_PREREG
}
def email_template_for_campaign(campaign, default=None):
if campaign in VALID_CAMPAIGNS:
try:
ret... | apache-2.0 | Python | |
96ed06f1f3dab3aa9d0f8150c41a5c1b943a86b0 | Add test for config module | StrellaGroup/frappe,frappe/frappe,StrellaGroup/frappe,frappe/frappe,StrellaGroup/frappe,frappe/frappe | frappe/tests/test_config.py | frappe/tests/test_config.py | # Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import unittest
import frappe
from frappe.config import get_modules_from_all_apps_for_user
class TestConfig(unittest.TestCase):
def test_get_modules(self):
frappe_modules = frappe.get_all("Module Def", filters={"app_n... | mit | Python | |
d7bfed84d773e7ccbd23e910a533f70b4dd02184 | Add module entrypoint | thismachinechills/grub2systemd | g2sd/__main__.py | g2sd/__main__.py | from .g2sd import cmd
if __name__ == "__main__":
cmd()
| agpl-3.0 | Python | |
7421cecfd6b304692eb19d76d3f90a61a950bc83 | add get_reviewers | RRSCDS/douban-mining | get_reviewers.py | get_reviewers.py |
import sys
import urllib2
import time
from lxml import html
def get_reviewers(bookid, star=1):
allstar10_list = []
for tag in ['collections', 'doings', 'wishes']:
reached_end = False
i = 0
while not reached_end:
print "start %d" % i
pa... | mit | Python | |
258a8d38d590f856e144b1e725fe38619c6758ea | Create notes_extractor.py | agancsos/python,agancsos/python | notes_extractor/notes_extractor.py | notes_extractor/notes_extractor.py | #!/usr/bin/env python3
###############################################################################
# Name : extract_notes.py #
# Version : v. 1.0.0.0 #
# Author : Abel Gancsos ... | mit | Python | |
c0d135fc40142561e4a2409e47b34c367a6a7ef4 | add script to read device logs from rms dump | dimagi/commcare,dimagi/commcare,dimagi/commcare-core,dimagi/commcare-core,dimagi/commcare,dimagi/commcare-core | util/scripts/devicelogs.py | util/scripts/devicelogs.py | from rmsdump import *
def read_log_entry (log_entry):
return tuple(log_entry.val[i].val for i in range(0, 3))
def print_log (log_atom):
print '%s> %s: %s' % (log_atom[0].strftime('%Y-%m-%d %H:%M:%S'), log_atom[1], log_atom[2])
if __name__ == "__main__":
data = sys.stdin.read()
stream = DataStream(d... | apache-2.0 | Python | |
f1ccab2168dea1b0827f4ca929f0036e84170a76 | Add tests for cross domain xhr view | praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go | go/base/tests/test_views.py | go/base/tests/test_views.py | """Test for go.base.utils."""
from mock import patch, Mock
from django.core.urlresolvers import reverse
from go.base.tests.utils import VumiGoDjangoTestCase
class BaseViewsTestCase(VumiGoDjangoTestCase):
def cross_domain_xhr(self, url):
return self.client.post(reverse('cross_domain_xhr'), {'url': url})
... | bsd-3-clause | Python | |
b67cc70a6cf04e605ad93933dd9d8a88db94f093 | add a simple flask app | gsathya/flow,gsathya/flow | backend/app.py | backend/app.py | from flask import Flask
import db
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
#db.process_db()
app = Flask(__name__)
app.run(debug=True)
| mit | Python | |
ce894232e3d8b00be3520f9f8d34ceb706b8dd75 | Create removelast2pagesofpdf.py | vicyangworld/AutoOfficer | RemoverLast2PagesOfPDF/removelast2pagesofpdf.py | RemoverLast2PagesOfPDF/removelast2pagesofpdf.py | import PyPDF2, os
import sys
import CmdFormat
import shutil
CDMF = CmdFormat.CmdFormat("PDF分离器")
class PDFMerger(object):
"""docstring for PDFMerger"""
def __init__(self,ROOTPATH):
self.__ROOTPATH = ROOTPATH+"\\"
self.__countriesCount = 0
self.__currentCoutry=""
self.bRegenerate = True
def __messages(sel... | mit | Python | |
2b25b9ba1c9417e3e25a91055a65551210eb5313 | Add meal migrations | teamtaverna/core | app/timetables/migrations/0002_meal.py | app/timetables/migrations/0002_meal.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-08-16 17:46
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('timetables', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | mit | Python | |
835d9628513a80215641bc4c63eae1fae7b8442b | rewrite portforwarding api | cboling/xos,cboling/xos,cboling/xos,cboling/xos,cboling/xos | xos/api/utility/portforwarding.py | xos/api/utility/portforwarding.py | from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework import serializers
from rest_framework import generics
from rest_framework.views import APIView
from core.models import *
from django.forms import widgets
from djang... | apache-2.0 | Python | |
f1826b2cf4c4103efe52713a57dc2fcabda1a45d | fix migration for real | anushbmx/kitsune,mythmon/kitsune,NewPresident1/kitsune,MikkCZ/kitsune,silentbob73/kitsune,anushbmx/kitsune,Osmose/kitsune,YOTOV-LIMITED/kitsune,MikkCZ/kitsune,H1ghT0p/kitsune,silentbob73/kitsune,brittanystoroz/kitsune,brittanystoroz/kitsune,YOTOV-LIMITED/kitsune,safwanrahman/kitsune,H1ghT0p/kitsune,feer56/Kitsune2,myth... | kitsune/questions/migrations/0006_ios_questionlocale.py | kitsune/questions/migrations/0006_ios_questionlocale.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def create_questionlocale(apps, schema_editor):
Product = apps.get_model('products', 'Product')
QuestionLocale = apps.get_model('questions', 'QuestionLocale')
p, created = Product.objects.get_or_crea... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def create_questionlocale(apps, schema_editor):
Product = apps.get_model('products', 'Product')
QuestionLocale = apps.get_model('questions', 'QuestionLocale')
p = Product.objects.get_or_create(slug='... | bsd-3-clause | Python |
4178691ed3826239721f2d9a6435ef90cfb5cf82 | Add color to input | wzyuliyang/initpy,janusnic/initpy,Parkayun/initpy | flask_init/run.py | flask_init/run.py | #!/usr/bin/python
# -*- coding:utf-8 -*-
import os
import six
import templates
from .creator import Creator
from .exceptions import InvalidFolderName
def color_input(color, text):
return six.moves.input(color+text+'\033[0m')
def color_print(color, text):
six.print_(color+text+'\033[0m')
def main():
... | #!/usr/bin/python
# -*- coding:utf-8 -*-
import os
import six
import templates
from .creator import Creator
from .exceptions import InvalidFolderName
def main():
name = six.moves.input('Input project name (default is "flask_proj"): ')
name = name or 'flask_proj'
module = six.moves.input('Input module na... | mit | Python |
48933f27c098b05276271a62ed3c970e4d5721b0 | add missing file | radical-cybertools/radical.repex | src/radical/repex/utils.py | src/radical/repex/utils.py |
import radical.utils as ru
# ------------------------------------------------------------------------------
#
def expand_ln(to_link, src_sbox, tgt_sbox, rid, cycle):
expand = {'rid' : rid,
'cycle': cycle}
if not src_sbox: src_sbox = '.'
if not tgt_sbox: tgt_sbox = '.'
ret = list()
... | mit | Python | |
88788c215c619ab894e21243d584541f311dbfb9 | Add eventlet test check to new tests __init__.py | varunarya10/oslo.concurrency,JioCloud/oslo.concurrency | oslo_concurrency/tests/__init__.py | oslo_concurrency/tests/__init__.py | # Copyright 2014 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 | Python | |
112c3a5a7728aea9be59b4bab1c26932e5faceaf | replace simple_api.py, set filename via commandline param, git add files that dont exist | niryariv/yuvalim,niryariv/yuvalim | import_fusion.py | import_fusion.py | #!/usr/bin/python
import json
import requests
import sys
import codecs
import subprocess
from datetime import datetime
from optparse import OptionParser
if __name__ == "__main__":
parser = OptionParser()
parser.add_option("-f", dest="output_file", help="output filename (will be stored under the data/ directo... | bsd-3-clause | Python | |
43d23f19933e898254d58c4874e6f0c0ac3b1cc6 | Add example config file | pyaiot/pyaiot,pyaiot/pyaiot,pyaiot/pyaiot,pyaiot/pyaiot | config-example.py | config-example.py | # Example configuration file for for Pyaiot
# Configuration options are shared between all pyaiot components.
# Debug
# Enable debug logging for all components.
#debug = False
# Broker host:
# Other component connect to this host for their broker connection. The
# dashboard passes this hostname to the clients for t... | bsd-3-clause | Python | |
783c3e740c154fb27b247b1cb8af5c853a8be973 | add basic_routing_test on experimental scenario | kadhikari/navitia,Tisseo/navitia,ballouche/navitia,ballouche/navitia,CanalTP/navitia,kadhikari/navitia,kadhikari/navitia,xlqian/navitia,TeXitoi/navitia,lrocheWB/navitia,kinnou02/navitia,Tisseo/navitia,pbougue/navitia,CanalTP/navitia,pbougue/navitia,antoine-de/navitia,ballouche/navitia,pbougue/navitia,Tisseo/navitia,kin... | source/jormungandr/tests/routing_tests_experimental.py | source/jormungandr/tests/routing_tests_experimental.py | # Copyright (c) 2001-2015, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... | agpl-3.0 | Python | |
b1caa89d75aecc564d504e5baffd0dc7619cd587 | Create foursq_friends.py | chenyang03/Foursquare_Crawler,chenyang03/Foursquare_Crawler | foursq_friends.py | foursq_friends.py | import json
from foursq_utils import *
def fetch_usr_friends(user_id):
super_token = 'QEJ4AQPTMMNB413HGNZ5YDMJSHTOHZHMLZCAQCCLXIX41OMP'
url = 'https://api.foursquare.com/v2/users/' + str(user_id) + '/friends?oauth_token=' + super_token + '&v=20210115'
try:
raw = get_raw_info(url)
data = jso... | mit | Python | |
139524072cc56d19ce887aaa95705dff8a952cc2 | Add lc035_search_insert_position.py | bowen0701/algorithms_data_structures | lc035_search_insert_position.py | lc035_search_insert_position.py | """Leetcode 35. Search Insert Position
Easy
URL: https://leetcode.com/problems/search-insert-position/
Given a sorted array and a target value, return the index if the target is found.
If not, return the index where it would be if it were inserted in order.
You may assume no duplicates in the array.
Example 1:
Inpu... | bsd-2-clause | Python | |
1669cd22d6c8ee5bcb37c6770c98ddcf8848d901 | Make lots of xyz with differing natoms visualizable | patrickmelix/Python4ChemistryTools | pad-trajectory.py | pad-trajectory.py | #!/usr/bin/env python3
#
# Script to generate an ext-xyz trajectory from individual ext-xyz files with varying atom numbers using ASE.
# Appens 'X' atoms at origin to obtain frames with equal lengths
# by Patrick Melix
# 2020/06/08
#
from ase import io, Atom
import os
def main(inList, outFile='traj.xyz', outFormat='e... | mit | Python | |
900b09803f5c49b8645ba7f3d47eb17515061377 | Create heads_and_legs.py | Kunalpod/codewars,Kunalpod/codewars | heads_and_legs.py | heads_and_legs.py | #Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Heads and Legs
#Problem level: 8 kyu
def animals(heads, legs):
if heads==0 and legs==0:
return (0,0)
y = legs//2 - heads
x = heads-y
if x<0 or y<0 or legs%2!=0:
return "No solutions"
return (x,y)
| mit | Python | |
fed98c8a9723c6fe18c123015b51714dc4ccdf68 | add migrations | bane138/nonhumanuser,bane138/nonhumanuser,bane138/nonhumanuser,bane138/nonhumanuser | actual_play/migrations/0006_game_thumbnail.py | actual_play/migrations/0006_game_thumbnail.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-10-20 22:45
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('actual_play', '0005_auto_20161010_1313'),
]
operations = [
migrations.AddFie... | mit | Python | |
5c9ffc4a0ab9f8aed3071a0bf4ad0fc69070b628 | Create inside_market.py | MKTSTK/Runover | inside_market.py | inside_market.py | import pandas as pd
import numpy as np
# update current state of our bid and ask
# iterate thru each trade and determine if a fill was generated
# id
# price
# qty
# side - bid/ask
# status - live, canceled, rejected
LIVE = 0
CANCELED = 1
REJECTED = 2
FILLED = 3
PARTIAL = 4
BID = 5
ASK = 6
MINUS_I... | bsd-3-clause | Python | |
0dd3894fb8816f6f904e5c7d204ab2672b304588 | Add earth mesh module | thomasgibson/firedrake-hybridization | gravity_waves/earth_mesh.py | gravity_waves/earth_mesh.py | from __future__ import absolute_import, print_function, division
from firedrake import *
__all__ = ["generate_earth_mesh"]
def generate_earth_mesh(r_level, num_layers, thickness, hexes=False):
"""Generates an Earth-like spherical mesh for the gravity wave
problem.
:arg r_level: An ``int`` denoting the... | mit | Python | |
5578d11f45e9c41ab9c4311f2bed48b9c24d9bf5 | Create file for Nonterminal have method | PatrikValkovic/grammpy | tests/grammar_term-nonterm_test/NonterminalHaveTest.py | tests/grammar_term-nonterm_test/NonterminalHaveTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
""" | mit | Python | |
b40c6ce73c439e7d74b867702fdd2c4cd7ad8b15 | add testrunner to automactically create/delete a test db during python and django tests. | sirex/couchdbkit,ghickman/couchdbkit,ghickman/couchdbkit,benoitc/couchdbkit,sirex/couchdbkit,benoitc/couchdbkit,benoitc/couchdbkit,ghickman/couchdbkit | couchdbkit/ext/django/testrunner.py | couchdbkit/ext/django/testrunner.py | from django.test.simple import DjangoTestSuiteRunner
from django.conf import settings
from couchdbkit.ext.django import loading as loading
from couchdbkit.resource import ResourceNotFound
class CouchDbKitTestSuiteRunner(DjangoTestSuiteRunner):
"""
A test suite runner for couchdbkit. This offers the exact same... | mit | Python | |
159156cb962ad0c8f4ea6f022471c75f33306f7e | Add unit tests for snapshots_client | Juniper/tempest,Tesora/tesora-tempest,masayukig/tempest,openstack/tempest,Tesora/tesora-tempest,bigswitch/tempest,masayukig/tempest,zsoltdudas/lis-tempest,Juniper/tempest,sebrandon1/tempest,cisco-openstack/tempest,openstack/tempest,LIS/lis-tempest,vedujoshi/tempest,izadorozhna/tempest,zsoltdudas/lis-tempest,vedujoshi/t... | tempest/tests/services/compute/test_snapshots_client.py | tempest/tests/services/compute/test_snapshots_client.py | # Copyright 2015 NEC Corporation. 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 ... | apache-2.0 | Python | |
913c9a10b2eb3b3d9de108a82a3251b2c0de0e10 | Add test for Hostname object | CybOXProject/python-cybox | cybox/test/objects/hostname_test.py | cybox/test/objects/hostname_test.py | # Copyright (c) 2014, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import unittest
from cybox.objects.hostname_object import Hostname
from cybox.test.objects import ObjectTestCase
class TestHostname(ObjectTestCase, unittest.TestCase):
object_type = "HostnameObjectType"
k... | bsd-3-clause | Python | |
514aca20c6f076a86819d7180f36c3b2e8bcc33b | Add integration test checking compatibility of Keras models with TF optimizers. | keras-team/keras,keras-team/keras | tests/integration_tests/test_tensorflow_integration.py | tests/integration_tests/test_tensorflow_integration.py | from __future__ import print_function
import os
import tempfile
import pytest
import keras
from keras import layers
from keras.utils.test_utils import get_test_data
from keras.utils.test_utils import keras_test
@pytest.mark.skipif(keras.backend.backend() != 'tensorflow', reason='Requires TF backend')
@keras_test
def... | apache-2.0 | Python | |
ebffda0ec0f2619ad1071bb1d00d87ce08d59498 | Add support for SymDIVINE tool | sosy-lab/benchexec,martin-neuhaeusser/benchexec,sosy-lab/benchexec,IljaZakharov/benchexec,dbeyer/benchexec,IljaZakharov/benchexec,ultimate-pa/benchexec,martin-neuhaeusser/benchexec,sosy-lab/benchexec,dbeyer/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,dbeyer/benchexec,ultimate-pa/benchexec,Ilja... | benchexec/tools/symdivine.py | benchexec/tools/symdivine.py | """
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2015 Dirk Beyer
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
... | apache-2.0 | Python | |
3840fbe6ca33e48b9bdbd78e85830a13606f612c | Create efi-smc.py | jacobsalmela/apple-efi-smc-scraper | efi-smc.py | efi-smc.py | #!/usr/bin/python
from lxml import html
import requests
# Get the EFI/SMC table from Apple's Website
page = requests.get('http://support.apple.com/en-us/HT1237')
tree = html.fromstring(page.text)
# Count the number of rows which will be used in looping
rows = tree.xpath('//*[@id="kbtable"]/tbody/tr')
# For each row:... | mit | Python | |
cdc6b62400f66d1b2747b5668a6618c961deb962 | create game class | vivekpabani/powerball-game | powerball/game.py | powerball/game.py | #!/usr/bin/env python
from collections import Counter
from .player import Player
class Game:
def __init__(self, players=None):
"""
Initialize the game instance.
players may be initialized by argument or by calling the begin method.
winning_numbers is initialized with an empty list... | mit | Python | |
b5d1be9069507feaeb41cfcf9cd774a244ffe49c | Add Activity model | piotr-dobrogost/sqlalchemy-continuum,kvesteri/sqlalchemy-continuum,rmoorman/sqlalchemy-continuum,avilaton/sqlalchemy-continuum | sqlalchemy_continuum/ext/activity_stream.py | sqlalchemy_continuum/ext/activity_stream.py | import sqlalchemy as sa
from sqlalchemy_utils import generic_relationship, JSONType
class Activity(object):
@declared_attr
def actor_id(self):
return sa.Column(
sa.Integer,
sa.ForeignKey('user.id'),
index=True
)
@declared_attr
def actor(self):
... | bsd-3-clause | Python | |
98b738e21918d1b6c4f2193cf229c518c9913974 | add standalone affordance server script | rdeits/director,mitdrc/director,mithrandir123/director,openhumanoids/director,empireryan/director,manuelli/director,RobotLocomotion/director,RobotLocomotion/director,rdeits/director,mithrandir123/director,edowson/director,patmarion/director,RobotLocomotion/director,patmarion/director,edowson/director,empireryan/directo... | src/python/scripts/affordanceServer.py | src/python/scripts/affordanceServer.py | from ddapp import consoleapp
from ddapp import lcmobjectcollection
from ddapp.timercallback import TimerCallback
import datetime
def main():
app = consoleapp.ConsoleApp()
meshCollection = lcmobjectcollection.LCMObjectCollection('MESH_COLLECTION_COMMAND')
affordanceCollection = lcmobjectcollection.LCMObje... | bsd-3-clause | Python | |
8e4d60645fb45e37c7a947b3a86219e5fd15c194 | Add py-geeup package (#12367) | iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/py-geeup/package.py | var/spack/repos/builtin/packages/py-geeup/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 PyGeeup(PythonPackage):
"""Simple Client for Earth Engine Uploads with Selenium Support.""... | lgpl-2.1 | Python | |
09aada1e7b734bde947a7031f97ecce34b8c65b2 | Create magical_marvelous_tour.py | mschruf/python | Google_Code_Jam/2014/Round_3/A/magical_marvelous_tour.py | Google_Code_Jam/2014/Round_3/A/magical_marvelous_tour.py | #!/usr/bin/python -tt
"""Solves Google Code Jam 2014 Round 3 Problem A
(https://code.google.com/codejam/contest/3024486/dashboard#s=p0)
"Magical, Marvelous Tour"
"""
import sys
def read_input():
"""Parses problem data from stdin.
Args:
None
Returns:
List of test cases, in order specifi... | cc0-1.0 | Python | |
c50628d1cf984be774cdf1bc6728b9c1cb3f94fa | Create Assignment2Solution.py | WUSTL-GIS-Programming-spring-2014/classinfo,WUSTL-GIS-Programming-spring-2014/classinfo | Assignments/Assignment2Solution.py | Assignments/Assignment2Solution.py | # Your name here
# Assignment 2: Process a folder of shapefiles
# Using the os library, find all shapefiles,and only shapefiles in a given folder and buffer them as before.
# Catch exceptions to handle invalid shapefiles.
import arcpy
import os
def main(inputfolder,prefix,outputfolder):
"""Buffer all shapefiles in... | unlicense | Python | |
4f32369efb0b2cd8540cc78132cadfbed6e68ae8 | Read and write xls files | alimanfoo/petlx,alimanfoo/petlx,alimanfoo/petlx | src/petlx/xls.py | src/petlx/xls.py | """
Read and write xls files, using xlrd.
"""
import os
import petl
from petlx.util import UnsatisfiedDependency
dep_message = """
The package xlrd is required. pip install xlrd.
"""
def fromxls(filename, sheetname):
"""
Extract a table from a sheet in an Excel (.xls) file.
N.B., the sheet name... | mit | Python | |
24d742e444c84df99629d8a6aff7ca7e6c90f995 | Add adhoc script to detect jobs with stuck ActiveInvocations list. | luci/luci-go,luci/luci-go,luci/luci-go,luci/luci-go,luci/luci-go,luci/luci-go | scheduler/misc/detect_stuck_active_invs.py | scheduler/misc/detect_stuck_active_invs.py | #!/usr/bin/env python
# Copyright 2018 The LUCI Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | apache-2.0 | Python | |
cf78037980a9345c12b1e2562bc4eda63cea95b3 | Add a simple regression test to go with r143260. CommandInterpreter::PreprocessCommand() should not infinite loop when a target has not been specified yet. | apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb,llvm-mirror/lldb | test/functionalities/backticks/TestBackticksWithoutATarget.py | test/functionalities/backticks/TestBackticksWithoutATarget.py | """
Test that backticks without a target should work (not infinite looping).
"""
import os, time
import unittest2
import lldb
from lldbtest import *
class BackticksWithNoTargetTestCase(TestBase):
mydir = "functionalities/backticks"
def test_backticks_no_target(self):
"""A simple test of backticks wi... | apache-2.0 | Python | |
28e226a47d16fb6a52c937031be19d8832e7e5c4 | Bump development version | nephila/django-ckeditor-filebrowser-filer,GasimGasimzada/django-ckeditor-filebrowser-filer,nephila/django-ckeditor-filebrowser-filer,GasimGasimzada/django-ckeditor-filebrowser-filer | ckeditor_filebrowser_filer/__init__.py | ckeditor_filebrowser_filer/__init__.py | # -*- coding: utf-8 -*-
__version__ = '0.2.0.b1'
| # -*- coding: utf-8 -*-
__version__ = '0.1.1'
| bsd-3-clause | Python |
ff2fb40e961fe7b0c3f6dd6e91d8fb79a865a631 | Hide the AuditorReader role in the system role assignment modal by placing it in an "implied" scope. | josthkko/ggrc-core,uskudnik/ggrc-core,selahssea/ggrc-core,prasannav7/ggrc-core,j0gurt/ggrc-core,j0gurt/ggrc-core,kr41/ggrc-core,kr41/ggrc-core,vladan-m/ggrc-core,NejcZupec/ggrc-core,edofic/ggrc-core,hasanalom/ggrc-core,hasanalom/ggrc-core,andrei-karalionak/ggrc-core,selahssea/ggrc-core,josthkko/ggrc-core,andrei-karalio... | src/ggrc_basic_permissions/migrations/versions/20131108224846_37b63b122038_hide_the_auditorread.py | src/ggrc_basic_permissions/migrations/versions/20131108224846_37b63b122038_hide_the_auditorread.py |
"""Hide the AuditorReader role by changing its scope.
Revision ID: 37b63b122038
Revises: 1ff082d26157
Create Date: 2013-11-08 22:48:46.956836
"""
# revision identifiers, used by Alembic.
revision = '37b63b122038'
down_revision = '1ff082d26157'
import sqlalchemy as sa
from alembic import op
from datetime import dat... | apache-2.0 | Python | |
dc200e50020637650c8a5dfe76895b0a033a8cea | Add tests for verifying that deactivating password works | akvo/akvo-rsr,akvo/akvo-rsr,akvo/akvo-rsr,akvo/akvo-rsr | akvo/rsr/tests/models/test_login_logging.py | akvo/rsr/tests/models/test_login_logging.py | # -*- coding: utf-8 -*-
# Akvo Reporting is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
from datetime import timedelta
... | agpl-3.0 | Python | |
e28a6423f63a169b46ebe46e9690d3858f953909 | Add tests | mathjazz/pontoon,mrinaljain/mozindia,elin-moco/ffclub,rtucker-mozilla/mozpackager,hfeeki/djiaoshoujia,akatsoulas/oneanddone,zofuthan/airmozilla,glogiotatidis/snippets-service,glogiotatidis/mozlex,linearregression/socorro,mozilla/bramble,kumar303/pto-planner,rtucker-mozilla/mozilla_inventory,jotes/pontoon,mozilla/dragne... | apps/commons/tests/test_accepted_locales.py | apps/commons/tests/test_accepted_locales.py | import os
import shutil
from django.conf import settings
import test_utils
import manage
class AcceptedLocalesTest(test_utils.TestCase):
"""Test lazy evaluation of locale related settings.
Verify that some localization-related settings are lazily evaluated based
on the current value of the DEV variabl... | bsd-3-clause | Python | |
bb9fd71dc06ac39b461b4109e341fe7cd4172c76 | use self.create_socket() | community-ssu/telepathy-gabble,mlundblad/telepathy-gabble,Ziemin/telepathy-gabble,community-ssu/telepathy-gabble,jku/telepathy-gabble,mlundblad/telepathy-gabble,community-ssu/telepathy-gabble,mlundblad/telepathy-gabble,community-ssu/telepathy-gabble,Ziemin/telepathy-gabble,jku/telepathy-gabble,Ziemin/telepathy-gabble,j... | tests/twisted/file-transfer/test-receive-file-and-disconnect.py | tests/twisted/file-transfer/test-receive-file-and-disconnect.py | import socket
from file_transfer_helper import exec_file_transfer_test, ReceiveFileTest
class ReceiveFileAndDisconnectTest(ReceiveFileTest):
def receive_file(self):
s = self.create_socket()
s.connect(self.address)
# disconnect
self.conn.Disconnect()
self.q.expect('dbus-sig... | import socket
from file_transfer_helper import exec_file_transfer_test, ReceiveFileTest
class ReceiveFileAndDisconnectTest(ReceiveFileTest):
def receive_file(self):
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
s.connect(self.address)
# disconnect
self.conn.Disconnect()
... | lgpl-2.1 | Python |
5dfd7b1534e19242ab778d535e2de13b424578f7 | Add examples | Jufik/python-fixer | example.py | example.py | #!/usr/bin/python3
#
# Copyright (c) 2016, Fabian Affolter <fabian@affolter-engineering.ch>
# Released under the MIT license. See LICENSE file for details.
#
import fixerio
# Our base currency is the Czech Koruna instead of the default (EUR).
BASE = 'CZK'
exchange = fixerio.Fixer(base=BASE)
print('Current exchange r... | mit | Python | |
5afdd7775dd1aa232d3ca8fa2852f4a36918f224 | add management command to fix forms whose non-ascii chars are corrupted | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/cleanup/management/commands/fix_corrupted_forms.py | corehq/apps/cleanup/management/commands/fix_corrupted_forms.py | # encoding: utf-8
from __future__ import absolute_import
from __future__ import unicode_literals
from django.core.management import BaseCommand
from six.moves import input
from corehq.apps.app_manager.dbaccessors import get_apps_by_id
SUSPICIOUS_STRINGS = [
international_character.encode('utf-8').decode('latin1... | bsd-3-clause | Python | |
3cf56093b9d132a5089a70a12feb73c4be987da8 | Add mtnpatch.py, a script to parse and import a full monotone diff | demsey/openenigma2,xifengchuo/openembedded,nx111/openembeded_openpli2.1_nx111,hulifox008/openembedded,nzjrs/overo-openembedded,sampov2/audio-openembedded,SIFTeam/openembedded,nvl1109/openembeded,openembedded/openembedded,JrCs/opendreambox,BlackPole/bp-openembedded,scottellis/overo-oe,popazerty/openembedded-cuberevo,bug... | contrib/mtnpatch.py | contrib/mtnpatch.py | #!/usr/bin/env python
import sys, os, string, getopt
mtncmd = "monotone"
def main(argv = None):
if argv is None:
argv = sys.argv
opts, list = getopt.getopt(sys.argv[1:], ':R')
if len(list) < 1:
print "You must specify a file"
return 2
reverse = False
for o, a in opts:
... | mit | Python | |
4430b1957b642e87cd263455e371bf1d634101b0 | Add buildone command | nirbheek/cerbero-old,nirbheek/cerbero-old,flexVDI/cerbero,sdroege/cerbero,brion/cerbero,nzjrs/cerbero,centricular/cerbero,OptoFidelity/cerbero,freedesktop-unofficial-mirror/gstreamer-sdk__cerbero,atsushieno/cerbero,atsushieno/cerbero,GStreamer/cerbero,shoreflyer/cerbero,fluendo/cerbero,ylatuya/cerbero,ikonst/cerbero,ni... | cerbero/commands/buildone.py | cerbero/commands/buildone.py | # cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; eit... | lgpl-2.1 | Python | |
6244e0b40d847687b7ff875a48fb08060efc97bf | Solve Within PyCharm | RaminGiahi/Pyomo | Newsolver.py | Newsolver.py | from __future__ import division
from pyomo.environ import *
from pyomo.opt import SolverFactory
model = AbstractModel()
model.M = Set()
model.N = Set()
model.n = Param()
model.c = Param(model.M, model.N)
model.x = Var(model.M, model.N, domain=Binary)
model.u = Var(model.M, domain=NonNegativeIntegers)... | unlicense | Python | |
00f766b24865e8010411105794f20bc0ef39a6dc | Add py-sphinxcontrib-devhelp package (#13278) | iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/py-sphinxcontrib-devhelp/package.py | var/spack/repos/builtin/packages/py-sphinxcontrib-devhelp/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 PySphinxcontribDevhelp(PythonPackage):
"""sphinxcontrib-devhelp is a sphinx extension whic... | lgpl-2.1 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.