commit stringlengths 40 40 | subject stringlengths 1 1.49k | old_file stringlengths 4 311 | new_file stringlengths 4 311 | new_contents stringlengths 1 29.8k | old_contents stringlengths 0 9.9k | lang stringclasses 3
values | proba float64 0 1 |
|---|---|---|---|---|---|---|---|
daba5cef48e2194a902c82e263fc6df3a279f826 | Add basic Linux LVM support | salt/modules/linux_lvm.py | salt/modules/linux_lvm.py | '''
Support for Linux LVM2
'''
# Import python libs
import re
# Import salt libs
import salt.utils
def __virtual__():
'''
Only load the module if lvm is installed
'''
if salt.utils.which('lvm'):
return 'lvm'
return False
def version():
'''
Return LVM version from lvm version
... | Python | 0 | |
be089aba90a13730e7185d2381088193d44790a5 | Create plumber.py | plumber.py | plumber.py | import select
import re
from collections import defaultdict
import os
from termcolor import colored, cprint
import datetime
import sys
print "Welcome to Plumber, a grep friendly execve/fork monitor for Linux!"
print "Written by Amit Serper, Cybereason | Contact: @0xAmit"
#TODO: divide this into different classes and ... | Python | 0 | |
1077d1df94b207606a15a233182a6f6aa07c9625 | create module to support vendoring | vendor.py | vendor.py | import subprocess
import os
from os import path
import traceback
import sys
import shutil
error_msg = """
This library depends on sources fetched when packaging that failed to be
retrieved.
This means that it will *not* work as expected. Errors encountered:
"""
def run(cmd):
print '[vendoring] Running command:... | Python | 0 | |
5f2c2e4736cfe141b1f717b688b290657e3ddef7 | Add script to install gsl-lite package | script/install-gsl-pkg.py | script/install-gsl-pkg.py | #!/usr/bin/env python
#
# Copyright 2015-2018 by Martin Moene
#
# gsl-lite is based on GSL: Guideline Support Library,
# https://github.com/microsoft/gsl
#
# This code is licensed under the MIT License (MIT).
#
# script/install-gsl-pkg.py
#
from __future__ import print_function
import argparse
import os
import re
i... | Python | 0 | |
62ed9524bc1c7ec5aafb44e3e1aea0c313083d64 | add script to retrieve catalog statistics | add-ons/tools/get_info.py | add-ons/tools/get_info.py | #!/usr/bin/env python
import sys
import cvmfs
def usage():
print sys.argv[0] + " <local repo name | remote repo url> [root catalog]"
print "This script looks in the given root_catalog (or the repository HEAD) and"
print "retrieves the contained statistics counters in CVMFS 2.1 catalogs."
print
pri... | Python | 0 | |
34e7a8d904b332a91a615043a629725100367d6f | Add ast.GlyphDefinition | Lib/fontTools/voltLib/ast.py | Lib/fontTools/voltLib/ast.py | from __future__ import print_function, division, absolute_import
from __future__ import unicode_literals
import fontTools.feaLib.ast as ast
class VoltFile(ast.Block):
def __init__(self):
ast.Block.__init__(self, location=None)
class GlyphDefinition(ast.Statement):
def __init__(self, location, name, g... | Python | 0.000001 | |
d51699474a9221a71daff29d7f834bedf618acad | week1-Exercise:varA varB | varAvarB.py | varAvarB.py | '''
Assume that two variables, varA and varB, are assigned values, either numbers or strings.
Write a piece of Python code that evaluates varA and varB, and then prints out one of the following messages:
"string involved" if either varA or varB are strings
"bigger" if varA is larger than varB
"equal" if varA is equ... | Python | 0.972752 | |
52c0006c7d26e821eeba6e4ad07949f8f59b9e86 | add wrapper | letmecreate/click/alcohol.py | letmecreate/click/alcohol.py | #!/usr/bin/env python3
"""Python binding of Alcohol Click wrapper of LetMeCreate library."""
import ctypes
_LIB = ctypes.CDLL('libletmecreate_click.so')
def get_measure(mikrobus_index):
"""Returns a 16-bit integer from the Accel Click.
mikrobus_index: must be 0 (MIKROBUS_1) or 1 (MIKROBUS_2)
Note: An e... | Python | 0 | |
a0d5c9aaf0f573ff11beacb6a30a91f90312dd08 | Create BitonicSort.py (#386) | sorts/BitonicSort.py | sorts/BitonicSort.py | # Python program for Bitonic Sort. Note that this program
# works only when size of input is a power of 2.
# The parameter dir indicates the sorting direction, ASCENDING
# or DESCENDING; if (a[i] > a[j]) agrees with the direction,
# then a[i] and a[j] are interchanged.*/
def compAndSwap(a, i, j, dire):
if (di... | Python | 0 | |
7457275762214bef85ad53282eb0bb8bc9d6ddba | Create DetachReAttach.py | DetachReAttach.py | DetachReAttach.py | import csv
import arcpy
import os
import sys
input = r"Database Connections\your.sde\pictures featureclass"
inputField = "NAME"
matchTable = r"C:\Users\<user>\Desktop\matchtable.csv"
matchField = "NAME"
pathField = r"picture Location"
rootdir = r"C:\Root Directory\A-Z pictures\picture"
#get subdirectories
subdirector... | Python | 0 | |
76d2d97183d4e57f9f59f654fc1302bf99740c0b | add failing test | molo/core/tests/test_models.py | molo/core/tests/test_models.py | import pytest
from datetime import datetime, timedelta
from django.test import TestCase
from molo.core.models import ArticlePage
@pytest.mark.django_db
class TestModels(TestCase):
fixtures = ['molo/core/tests/fixtures/test.json']
def test_article_order(self):
now = datetime.now()
article1 = ... | Python | 0.00005 | |
1dbfcfd6558a3148ea2726898d65e1e8ef9115fc | Add a management command that imports bug data from YAML files | mysite/customs/management/commands/import_bugimporter_data.py | mysite/customs/management/commands/import_bugimporter_data.py | # This file is part of OpenHatch.
# Copyright (C) 2012 OpenHatch, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later v... | Python | 0.000002 | |
1314da3ffbaa42aca4a917aef8a230478a22be68 | Add a script that uses the JSON metadata to create ordered symlinks. | scripts/order-symlinks.py | scripts/order-symlinks.py | #!/usr/bin/env python
# Copyright (C) 2013 Tobias Gruetzmacher
"""
This script takes the JSON file created by 'dosage -o json' and uses the
metadata to build a symlink farm in the deduced order of the comic. It created
those in a subdirectory called 'inorder'.
"""
from __future__ import print_function
import sys
import... | Python | 0 | |
a756edd9da035b027e2538228da349592031412e | Create ASCII_Art.py | Easy/ASCII_Art.py | Easy/ASCII_Art.py | l = int(input())
h = int(input())
t = input()
row=[]
for i in range(h):
row.append(input())
alpha=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
letter=[]
for obj in t:
found=False
for i in range(len(alpha)):
if obj.lower()==alpha[i]:
... | Python | 0.002622 | |
3cf77344df5993428cab38f646303e6735ecefd3 | Implement shorthand type constructors for users | numba/typesystem/shorthands.py | numba/typesystem/shorthands.py | """
Shorthands for type constructing, promotions, etc.
"""
from numba.typesystem import *
from numba.minivect import minitypes
#------------------------------------------------------------------------
# Utilities
#------------------------------------------------------------------------
def is_obj(type):
return t... | Python | 0.000001 | |
66591bd481a8c78f9563ef001f0d799a38130869 | add version file | autofocus/version.py | autofocus/version.py | __version__ = "1.2.0"
| Python | 0.000001 | |
8d1d0719b2d43e49f9e3403d147201b34b526a81 | Add SubscriptionInfo class | cartoframes/data/observatory/subscription_info.py | cartoframes/data/observatory/subscription_info.py |
class SubscriptionInfo(object):
def __init__(self, raw_data):
self._raw_data = raw_data
@property
def id(self):
return self._raw_data.get('id')
@property
def estimated_delivery_days(self):
return self._raw_data.get('estimated_delivery_days')
@property
def subscri... | Python | 0 | |
c8f868e24378eebd31a84b5da29d27361eb987de | Create inmoov3.minimalHead.py | home/hairygael/inmoov3.minimalHead.py | home/hairygael/inmoov3.minimalHead.py | #file : InMoov3.minimalHead.py
# this will run with versions of MRL above 1695
# a very minimal script for InMoov
# although this script is very short you can still
# do voice control of a right hand or finger box
# It uses WebkitSpeechRecognition, so you need to use Chrome as your default browser for this script to w... | Python | 0.000001 | |
15b6bbac7bce15f6f7d72618f51877455f3e0ee5 | improve tag resolution handling | git/refs/tag.py | git/refs/tag.py | from .reference import Reference
__all__ = ["TagReference", "Tag"]
class TagReference(Reference):
"""Class representing a lightweight tag reference which either points to a commit
,a tag object or any other object. In the latter case additional information,
like the signature or the tag-creator, is avai... | from .reference import Reference
__all__ = ["TagReference", "Tag"]
class TagReference(Reference):
"""Class representing a lightweight tag reference which either points to a commit
,a tag object or any other object. In the latter case additional information,
like the signature or the tag-creator, is avai... | Python | 0.000009 |
84edade82d83129afe88a6df7748aab551619c38 | Create examples.py | spacy/lang/hi/examples.py | spacy/lang/hi/examples.py | # coding: utf8
from __future__ import unicode_literals
"""
Example sentences to test spaCy and its language models.
>>> from spacy.lang.en.examples import sentences
>>> docs = nlp.pipe(sentences)
"""
sentences = [
"एप्पल 1 अरब डॉलर के लिए यू.के. स्टार्टअप खरीदने पर विचार कर रहा है",
"स्वायत्त कार निर्म... | Python | 0.000362 | |
8180c84a98bec11308afca884a4d7fed4738403b | Add tests for new Levenshtein alignment | spacy/tests/test_align.py | spacy/tests/test_align.py | import pytest
from .._align import align
@pytest.mark.parametrize('string1,string2,cost', [
(b'hello', b'hell', 1),
(b'rat', b'cat', 1),
(b'rat', b'rat', 0),
(b'rat', b'catsie', 4),
(b't', b'catsie', 5),
])
def test_align_costs(string1, string2, cost):
output_cost, i2j, j2i, matrix = align(str... | Python | 0 | |
dc9c9cfd45726e4f3458fcc0f02c29c61482c0bc | Create gzip_identifier.py | identifiers/gzip_identifier.py | identifiers/gzip_identifier.py | from identifier import Result
GZ_PATTERNS = [
'1F 8B 08 08'
]
class GzResolver:
def identify(self, stream):
return Result('GZ')
def load(hound):
hound.add_matches(GZ_PATTERNS, GzResolver())
| Python | 0.000015 | |
ffe76ac5d3cd5485dd288415a5845c2d5a247633 | add shipping | components/shipping_reckoner/shipping_reckoner.py | components/shipping_reckoner/shipping_reckoner.py | #! /usr/bin/env python
from json import loads, dumps
from pika import BlockingConnection, ConnectionParameters
RABBIT_MQ_HOST = '54.76.183.35'
RABBIT_MQ_PORT = 5672
def shipping(ch, method, properties, body):
product = loads(body)
sku, price = product['sku'], product['price']
if price < 50:
shipp... | Python | 0 | |
112fadcee2bcb0f0122916ed248df7c965189c36 | Add pagination tests for permission groups | tests/api/pagination/test_account.py | tests/api/pagination/test_account.py | import pytest
from django.contrib.auth import models as auth_models
from ..utils import get_graphql_content
@pytest.fixture
def permission_groups_for_pagination(db):
return auth_models.Group.objects.bulk_create(
[
auth_models.Group(name="Group1"),
auth_models.Group(name="GroupGrou... | Python | 0 | |
8c85761d37625393cdb70664af33853cbe105a9d | Create binarytree_intree.py | binarytree_intree.py | binarytree_intree.py | """"
find if a is a subset of b,
where both a and b are binary trees
"""
| Python | 0.000905 | |
cbef1510b8bf0e7d0d9a3bb5a678d2d118822979 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/d33e1ade02f55fd63e04ccf6e6188d009c9d3b69. | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "d33e1ade02f55fd63e04ccf6e6188d009c9d3b69"
TFRT_SHA256 = "ac62839411fe0f0cde68daa8f50a... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "272fc1c72b798def2a9e2a384c478a6ee4b357c9"
TFRT_SHA256 = "a6173ac76fc7d2361729f6c268b3... | Python | 0 |
aeafc18cee3e8d833160d3bc2df6a971878022fe | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/90ada7c89c5d812ae3fe09d7c2cbd9a77e7273b8. | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "90ada7c89c5d812ae3fe09d7c2cbd9a77e7273b8"
TFRT_SHA256 = "8f2aab5b834112dd815bac9b0416... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "e66a3653ca77861cb3d9c34eb6bbe05d4f67dfae"
TFRT_SHA256 = "edabb53b75f8fef59d308310d2bf... | Python | 0.000001 |
941f89dfb8f4c8bf0a8445d3c57ff9e652ad85d1 | Create server.py | lab1/server.py | lab1/server.py | ok
| Python | 0.000001 | |
bc46efa788a0e3d0aacab724e16b8da01a671331 | Add p1. | p1.py | p1.py | def p1_for(input_list):
"""Compute some of numbers in list with for loop."""
out = 0
for i in input_list:
out += i
return out
def p1_while(input_list):
"""Compute some of numbers in list with while loop."""
out = 0
count = 0
while count < len(input_list):
out += input_l... | Python | 0.000006 | |
798a7e553bd67c5a75c7639b73f3a22c03bf32a2 | Create simple_RSA_implementation.py | Prabhanjan/simple_RSA_implementation.py | Prabhanjan/simple_RSA_implementation.py | Implementation of RSA
#This can primarily be divided into 3 steps-
#1. Key Generation
#2. Encryption
#3. Decryption
import math
import random
def create_list_primes(sieve_size):
#Returns a list of primes less than or equal to sieveSize
sieve=[True]*sieve_size
sieve[0]=False
sieve[1]=False
#zero and one are not... | Python | 0.00011 | |
1a6818d4829c3da42750f6d0f042df203434595c | Add a little to models | Carkinos/probes/migrations/0002_auto_20160106_2307.py | Carkinos/probes/migrations/0002_auto_20160106_2307.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-06 15:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('probes', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | Python | 0 | |
96d89e4398a68aab8df033847a1cf8fa47cef5dc | Create find-duplicate-file-in-system.py | Python/find-duplicate-file-in-system.py | Python/find-duplicate-file-in-system.py | # Time: O(n * l), l is the average length of file content
# Space: O(n * l)
# Given a list of directory info including directory path,
# and all the files with contents in this directory,
# you need to find out all the groups of duplicate files
# in the file system in terms of their paths.
#
# A group of duplicate fi... | Python | 0.000154 | |
2a6d8bc208463a0f903a2b62021abb913ab510c5 | Add TestSuiteHandler. | app/handlers/test_suite.py | app/handlers/test_suite.py | # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be usefu... | Python | 0 | |
d1ce76f33bdf93ee631f3ee38b565e79a1f38343 | add a demo of building a custom python wrapper using libgvc | dot.demo/gv_test.py | dot.demo/gv_test.py | #!/usr/bin/python
import gv
g = gv.digraph("G")
n = gv.node(g,"hello")
m = gv.node(g,"world")
e = gv.edge(n,m)
gv.layout(g, "dot")
gv.render(g, "png", "gv_test.png")
gv.rm(g)
| Python | 0 | |
d9b4607819d985dee086ff4f435972d304e3a45e | update Site admin | plstackapi/core/models/site.py | plstackapi/core/models/site.py | import os
from django.db import models
from plstackapi.core.models import PlCoreBase
from plstackapi.core.models import DeploymentNetwork
from plstackapi.openstack.driver import OpenStackDriver
# Create your models here.
class Site(PlCoreBase):
tenant_id = models.CharField(max_length=200, help_text="Keystone te... | import os
from django.db import models
from plstackapi.core.models import PlCoreBase
from plstackapi.core.models import DeploymentNetwork
from plstackapi.openstack.driver import OpenStackDriver
# Create your models here.
class Site(PlCoreBase):
tenant_id = models.CharField(max_length=200, help_text="Keystone t... | Python | 0 |
42192dad06079a654945a9a53dcdc548aa7085c4 | Create __init__.py | modules/datasave/__init__.py | modules/datasave/__init__.py | Python | 0.000429 | ||
ad72e7cdc02d746ec56dfd85ed5a46de59e57684 | add the pocket pla machine laerning algorithm | machine_learning/python/pocket_pla.py | machine_learning/python/pocket_pla.py | import random
import numpy as np
FEATURE = 5
def sign(num):
if np.sign(num) <= 0:
return -1.0
return 1.0
def pla(X,y,m):
''' improved (pocket) perceptron learning algorithm
Arguments:
X {list or numpy array}
y {list or numpy array} -- target
m {integer} -- the size of tr... | Python | 0.000001 | |
4fe62ac1211e68f1d9c656453bdf71d6849c3daf | Add organisation values for the Enterprise Europe Network. | migrations/versions/0101_een_logo.py | migrations/versions/0101_een_logo.py | """empty message
Revision ID: 0101_een_logo
Revises: 0100_notification_created_by
Create Date: 2017-06-26 11:43:30.374723
"""
from alembic import op
revision = '0101_een_logo'
down_revision = '0100_notification_created_by'
ENTERPRISE_EUROPE_NETWORK_ID = '89ce468b-fb29-4d5d-bd3f-d468fb6f7c36'
def upgrade():
... | Python | 0 | |
eff52ac7e0177cdf79b4fe4f076bf411a4b2b54b | Add migration file | migrations/versions/bf1347acdee2_.py | migrations/versions/bf1347acdee2_.py | """empty message
Revision ID: bf1347acdee2
Revises: b4dd0add5f79
Create Date: 2018-03-23 17:08:11.289953
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'bf1347acdee2'
down_revision = 'b4dd0add5f79'
branch_labels = None
depends_on = None
def upgrade():
# ... | Python | 0.000001 | |
845615f2a34c5680ed22a2f4eafa5febe7cd7246 | Add date updated to Owner | alembic/versions/20087beff9ea_added_date_updated_t.py | alembic/versions/20087beff9ea_added_date_updated_t.py | """Added date updated to Owner
Revision ID: 20087beff9ea
Revises: 2dc72d16c188
Create Date: 2014-03-09 01:43:00.648013
"""
# revision identifiers, used by Alembic.
revision = '20087beff9ea'
down_revision = '2dc72d16c188'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated ... | Python | 0 | |
b0480b55ea19bc661091924fb21b1b9b95b54200 | Create NoDuplicateLetters-Hard.py | Edabit/NoDuplicateLetters-Hard.py | Edabit/NoDuplicateLetters-Hard.py | #!/usr/bin/env python3
'''
Given a common phrase, return False if any individual word in the phrase contains duplicate letters.
Return True otherwise.
'''
def no_duplicate_letters(phrase):
val = [phrase]
nlst = ' '.join(val).split()
st = [len(i) for i in nlst]
ev = [len(set(i)) for i in nlst]
return st == ev
#A... | Python | 0 | |
d62b0e231177edbd60730470c5213dbff3bfa11c | Implement the PRIVMSG and NOTICE commands | txircd/modules/cmd_privmsg_notice.py | txircd/modules/cmd_privmsg_notice.py | from twisted.words.protocols import irc
from txircd.modbase import Command
class MessageCommand(object):
def __init__(self, ircd):
self.ircd = ircd
def onUse(self, cmd, user, data):
if ("targetchan" not in data or not data["targetchan"]) and ("targetuser" not in data or not data["targetuser"]):
return
if ... | Python | 0.000058 | |
679fbe2825a1c2a6312cd1d13974cbe9feb30be9 | user prompts: python3 | user_prompts/python3/user_prompts.py | user_prompts/python3/user_prompts.py | #!/usr/bin/python3
name = input("Name: ")
age = input("Age: ")
username = input("Username: ")
if username.find("u/") == 0:
username = "/"+username
if username.find("/u/") == -1:
username = "/u/"+username
print("Your name is "+name+", you are "+age+" years old, and your username is "+username+"\n")
| Python | 0.999993 | |
4745a6e80b978d6310ab59c8ac3f0ce562dd7aa8 | Add module to compile with nuitka | n_utils/nitor-dt-load-project-env.py | n_utils/nitor-dt-load-project-env.py | from n_utils.project_util import load_project_env
load_project_env() | Python | 0 | |
36af34a1537bbfc30a8e124bfc82c4650a31c8d3 | Fix wrong unit test about config option enabled_apis | nova/tests/unit/cmd/test_nova_api.py | nova/tests/unit/cmd/test_nova_api.py | # Copyright 2015 HPE, 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 writing, sof... | # Copyright 2015 HPE, 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 writing, sof... | Python | 0.000241 |
68b865c120e49c8a64cdeb010893ca6e6c0de32f | Create webapp.py | webapp.py | webapp.py | from flask import Flask
app = Flask(__name__) #__name__ = "__main__" if this is the file that was run. Otherwise, it is the name of the file (ex. webapp)
@app.route("/")
def render_main():
return url_for('static', filename='home.html')
if __name__=="__main__":
app.run(debug=False, port=54321)
| Python | 0.000044 | |
a2386d80fbbff2cd3ab3814cd850a8471280dde8 | Check if user.token attribute exists | openstack_dashboard/views.py | openstack_dashboard/views.py | # Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | # Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | Python | 0.000006 |
256bd96aabbb4b12972e070e11bfbd95248c3f29 | add new recipe | recipes/sdl2_mixer/__init__.py | recipes/sdl2_mixer/__init__.py | from toolchain import Recipe, shprint
import sh
class LibSDL2MixerRecipe(Recipe):
version = "2.0.0"
url = "http://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-{version}.tar.gz"
library = "Xcode-iOS/build/Release-{arch.sdk}/libSDL2_mixer.a"
include_dir = "SDL_mixer.h"
depends = ["sdl2"]
... | Python | 0.000001 | |
0c9dcb8c23be8685bfe32a465f8e1b3023c95934 | Create manager_D3S.py | manager_D3S.py | manager_D3S.py | #!/usr/bin/env python
import argparse
import kromek
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--transport', '-t', dest='transport', default='any')
parser.add_argument('--interval', '-i', dest='interval', default=1)
parser.add_argument('--count', '-c', dest='count', default=0... | Python | 0.000003 | |
dc9449768dd93ec29a031b31c3a975c2db797252 | Create test_Deter_as_Server_and_Play_Audio.py | test_Deter_as_Server_and_Play_Audio.py | test_Deter_as_Server_and_Play_Audio.py | # DETER DEVICE
# this is test code for putting the deter device into server mode, and getting a message via bluetooth from the detection device, and
# then going ahead and playing scare sounds. You need to determine your MAC address. It is for the server in this case, so the MAC address
# of the deter device. You also ... | Python | 0.000001 | |
7735ea4909d30a6592b3bcbcf2752fb3fba8ebb7 | Add Depth-First Search | dfs.py | dfs.py | # -*- coding: utf-8 -*-
import draw
import grid
import util
def dfs(g, start, goal):
return dfs_rec(g, start, goal, [start])
def dfs_rec(g, pos, goal, path):
if pos == goal:
return path
if len(path) > 50:
return None
for n in g.neighbours(*pos):
if n in path:
conti... | Python | 0.000001 | |
309e9557dd8c66ad2fccaa61c8badb9bf0110dcd | Add the testbench for the I$. | Simulation/modules/test_icache.py | Simulation/modules/test_icache.py | #!/usr/bin/env python
# Copyright (c) 2015 Angel Terrones (<angelterrones@gmail.com>)
#
# 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 r... | Python | 0 | |
58d1011b2758f537a3539321bea64cf1c77f39fe | Add spider for Au Bon Pain; closes #783 | locations/spiders/aubonpain.py | locations/spiders/aubonpain.py | import scrapy
import re
import json
from locations.items import GeojsonPointItem
from locations.hours import OpeningHours
class AuBonPainSpider(scrapy.Spider):
name = "aubonpain"
download_delay = 0.5
allowed_domains = [
"www.aubonpain.com",
]
start_urls = (
'https://www.aubonpain.c... | Python | 0 | |
ab7006cd6a174273c026fda15e3471b9571ed0a6 | Add some simple tests | pages/tests.py | pages/tests.py | from django.test import TestCase
from pages.models import *
class PagesTestCase(TestCase):
fixtures = ['tests']
def test_01_managers(self):
"""Check the managers"""
pages = Page.published.all()
for p in pages:
self.assertEqual(p.status, 1)
pages = Page.drafts.all()
... | Python | 0.000029 | |
414c0a799f7fa1441150d6caae8447a135b9443a | Create sentiment-analysis.py | data-analysis/sentiment-Google-API/sentiment-analysis.py | data-analysis/sentiment-Google-API/sentiment-analysis.py | import couchdb
from google.cloud import language
language_client = language.Client()
try:
couch = couchdb.Server('http://localhost:15984/')
print("Connect to local db")
except:
print ("Cannot find CouchDB Server ... Exiting\n")
print ("----_Stack Trace_-----\n")
raise
db = couch['ten']
print ("Con... | Python | 0.000454 | |
2859ca788a07338d5bf22a697669358e1f027382 | Add dataset_generation. | dataset_generation.py | dataset_generation.py | import itertools
person = [
"Obama",
"Barack Obama",
"Barack Hussein Obama",
"Lennon",
"John Lennon",
"Saint-Exupéry",
"Antoine de Saint-Exupéry",
"Antoine Marie Jean-Baptiste Roger de Saint-Exupéry"
]
country = [
"United States",
"United States of America",
"USA",
"US"... | Python | 0.000001 | |
0781d105e4182bdd8abf1a8c7185311a48273c28 | Add imgadm beacons for SmartOS | salt/beacons/smartos_imgadm.py | salt/beacons/smartos_imgadm.py | # -*- coding: utf-8 -*-
'''
Beacon that fires events on image import/delete.
.. code-block:: yaml
## minimal
# - check for new images every 1 second (salt default)
# - does not send events at startup
beacons:
imgadm: []
## standard
# - check for new images every 60 seconds
# - send ... | Python | 0 | |
8b63dc73b4e3303d1b86faf42f635f3ce01e9da4 | Create helper script providing multiprocessing support. | run.py | run.py | #!/usr/bin/env python
# encoding: utf-8
import argparse
import subprocess as sub
### Parse command line arguments
parser = argparse.ArgumentParser(description="M/M/1 queue simulation -- Helper script")
parser.add_argument('reps', metavar='repetitions',
type=int, help='number of repetitions')
pars... | Python | 0 | |
401b98d0f3834eebc71342746beb8ce28a73d75f | Add check for AddToHueAndSaturation | checks/check_add_to_hue_and_saturation.py | checks/check_add_to_hue_and_saturation.py | from __future__ import print_function, division
import imgaug as ia
from imgaug import augmenters as iaa
import numpy as np
from skimage import data
import cv2
from itertools import cycle
VAL_PER_STEP = 1
TIME_PER_STEP = 10
def main():
image = data.astronaut()
cv2.namedWindow("aug", cv2.WINDOW_NORMAL)
c... | Python | 0 | |
e0c82bec30568eb845c71fb0335d6ac5edef18e9 | Add migration that had conflict from merge with master | corehq/apps/translations/migrations/0002_transifexblacklist.py | corehq/apps/translations/migrations/0002_transifexblacklist.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-01-09 19:35
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('translations', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | Python | 0.000001 | |
09a2a2aac94c4ab2a47161d32d77218d18eb6c75 | add queue for data pre_processing using multi-thread | dnn_model/pk_queue.py | dnn_model/pk_queue.py | import time
import Queue
import threading
import pk_input as pki
target_list = ["cdk2", "egfr_erbB1", "gsk3b", "hgfr", "map_k_p38a", "tpk_lck", "tpk_src", "vegfr2"]
target = target_list[0]
d = pki.Datasets(target_list)
# using queue
# producer thread
class Producer(threading.Thread):
def __init__(self, t_name... | Python | 0 | |
6aeab650a43235a463cf9ff8c55b4cd22e6866c7 | Add mapping code | qanta/ingestion/annotated_mapping.py | qanta/ingestion/annotated_mapping.py | from unidecode import unidecode
from collections import defaultdict, Counter
import string
import re
PUNCTUATION = string.punctuation
PAREN = re.compile(r'\([^)]*\)')
BRACKET = re.compile(r'\[[^)]*\]')
MULT_SPACE = re.compile(r'\s+')
ANGLE = re.compile(r'<[^>]*>')
def split_and_remove_punc(text):
for i in text.s... | Python | 0.000145 | |
28ccfa6f1a2cd58907105afd4844c865191d423d | Add a `more_tearDown` method to MpiTestCase. | distarray/testing.py | distarray/testing.py | import unittest
import importlib
import tempfile
import os
from uuid import uuid4
from functools import wraps
from distarray.error import InvalidCommSizeError
from distarray.mpiutils import MPI, create_comm_of_size
def temp_filepath(extension=''):
"""Return a random 8-character filename."""
tempdir = tempfil... | import unittest
import importlib
import tempfile
import os
from uuid import uuid4
from functools import wraps
from distarray.error import InvalidCommSizeError
from distarray.mpiutils import MPI, create_comm_of_size
def temp_filepath(extension=''):
"""Return a random 8-character filename."""
tempdir = tempfil... | Python | 0 |
b3df89c93a5d924b83d0dba6d83dd92fe2331f7c | Implementa a classe Agendamento conforme diagrama de classes | domain/Agendamento.py | domain/Agendamento.py | from domain import IntervaloDeTempo
class Agendamento():
def __init__(self, intervalo, IDUsuario = None):
self.intervalo = intervalo
self.responsavel = IDUsuario
| Python | 0.000001 | |
7ca606892f119f3eee33974f02ea3ecbf1e4bc56 | Apply Mark's fix to dv.clear. | distarray/testing.py | distarray/testing.py | import unittest
import importlib
import tempfile
import os
import six
import types
from uuid import uuid4
from functools import wraps
from distarray.error import InvalidCommSizeError
from distarray.mpiutils import MPI, create_comm_of_size
from IPython.parallel import Client
def temp_filepath(extension=''):
"""R... | import unittest
import importlib
import tempfile
import os
import six
import types
from uuid import uuid4
from functools import wraps
from distarray.error import InvalidCommSizeError
from distarray.mpiutils import MPI, create_comm_of_size
from IPython.parallel import Client
def temp_filepath(extension=''):
"""R... | Python | 0 |
b41b6998dc14920193f22399804552209f7adcab | add migration script | osf/migrations/0078_ensure_schemas.py | osf/migrations/0078_ensure_schemas.py | from __future__ import unicode_literals
import logging
from django.db import migrations
from osf.utils.migrations import ensure_schemas, remove_schemas
logger = logging.getLogger(__file__)
class Migration(migrations.Migration):
dependencies = [
('osf', '0077_add_maintenance_permissions'),
]
... | Python | 0.000001 | |
3037d356552634bc5d67568e97a9d7aedceb0fdf | Add description to email for non pyvideo events. | dj/scripts/email_title.py | dj/scripts/email_title.py | #!/usr/bin/python
# email_url.py
# emails the video URL to the presenters
from django.core.mail import get_connection, EmailMessage
from django.template import Context, Template
from process import process
from email_ab import email_ab
# from django.conf import settings
class email_title(email_ab):
ready_stat... | #!/usr/bin/python
# email_url.py
# emails the video URL to the presenters
from django.core.mail import get_connection, EmailMessage
from django.template import Context, Template
from process import process
from email_ab import email_ab
# from django.conf import settings
class email_title(email_ab):
ready_stat... | Python | 0 |
f852fcc24a3e7a758d0fa9fd912b1edd42ae362d | Add vneo module. | py2neo/vneo.py | py2neo/vneo.py |
from __future__ import print_function
import os
from subprocess import check_output
from shutil import rmtree
import sys
from py2neo.dist import download
from py2neo.server import GraphServer
from py2neo.util import ustr
USAGE = """\
Usage:
vneo list
vneo make <name> <edition> <version>
vneo remove <n... | Python | 0 | |
c98ff54d2888a0fdaa6634d065876d4cf5514b65 | Add compat file | pynetdicom3/compatibility.py | pynetdicom3/compatibility.py | """Compatibility module for python2.7/python3."""
import sys
IN_PYTHON2 = sys.version_info[0] == 2
if IN_PYTHON2:
import Queue as queue
else:
import queue
| Python | 0 | |
5be91f4e7b3607090e94fbf221628a359063823d | Use indexed text with sqlite | data/bag-brk/create_db.py | data/bag-brk/create_db.py | import csv
import sqlite3
conn = sqlite3.connect('processed-lines.db')
c = conn.cursor()
# c.execute('CREATE TABLE processed (cadastral_designation text, bag_pand_id text, match_type text, parcel_uri text, '
# 'dummy text, mother_parcel_match text, parcel_error text, timestamp timestamp default CURRENT_TIMES... | Python | 0.000001 | |
8279485c7c29453bea744ad137bb38552ac83bdb | Create master_script.py | scripts/hello_again/master_script.py | scripts/hello_again/master_script.py | import subprocess
import os
FNULL = open(os.devnull, 'w')
subprocess.Popen('python live_stream.py', shell=True, stdout=FNULL, stderr=subprocess.STDOUT)
subprocess.Popen('python processed_stream.py', shell=True, stdout=FNULL, stderr=subprocess.STDOUT)
subprocess.Popen('python database_lookup.py', shell=True, stdout=FNU... | Python | 0.000001 | |
149631d1ad2733792feedf24d67575159289025c | set MOCK_FORENSIC_AUTH default to False | forensic/session.py | forensic/session.py | """
Copyright 2014 Sotera Defense Solutions, 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 writ... | """
Copyright 2014 Sotera Defense Solutions, 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 writ... | Python | 0.998874 |
7e5800d46d8dd49b421b3cdcd12701f64da994c3 | Add script for testing performance. | performance.py | performance.py | import argparse
import os.path
import re
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Runs combinations of performance tests.')
parser.add_argument(
'--config',
dest = 'config',
default = '',
help = 'Override configuration to <Platform>_<Configuration>, i.e. x64_Debug.'
... | Python | 0 | |
1440023d9a46b5abc0fe9e3a713d437185478102 | Create chucknorris.py | Codingame.com/chucknorris.py | Codingame.com/chucknorris.py | import sys
import math
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
message = input()
binaries = []
for ch in message:
binaries.append(bin(ord(ch))[2:].zfill(7))
stringer = ""
zero = False
one = False
for binary in binaries:
for char in bina... | Python | 0.000001 | |
2edb50db002e773b66eb1f824894ee362846f86e | add example using 2 env vars | scripts/environment/dual_env_vars.py | scripts/environment/dual_env_vars.py | #!/usr/bin/env python
from argparse import ArgumentParser
from datetime import datetime
import os
inventory = {
'all': {'vars': {'ansible_connection': 'local'}},
'ungrouped': {'hosts': ['localhost']},
'_meta': {'hostvars': {'localhost': {
'test_env': os.environ.get('TEST_ENV', False),
'test... | Python | 0 | |
20cc61dd008fa4c1ced0d4726baaeba78d0d1f05 | Update get_posts example script for Python 3. | examples/get_posts.py | examples/get_posts.py | """
A simple example script to get all posts on a user's timeline.
Originally created by Mitchell Stewart.
<https://gist.github.com/mylsb/10294040>
"""
import facebook
import requests
def some_action(post):
""" Here you might want to do something with each post. E.g. grab the
post's message (post['message']) ... | """
A simple example script to get all posts on a user's timeline.
Originally created by Mitchell Stewart.
<https://gist.github.com/mylsb/10294040>
"""
import facebook
import requests
def some_action(post):
""" Here you might want to do something with each post. E.g. grab the
post's message (post['message']) ... | Python | 0 |
6a968d47a3605a4ce0af486b7777497749b4fac6 | Add tests for deleted notification objects | src/tests/ggrc_workflows/notifications/test_deleted_objects.py | src/tests/ggrc_workflows/notifications/test_deleted_objects.py | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
import random
from tests.ggrc import TestCase
from freezegun import freeze_time
... | Python | 0 | |
134dbd68cc4630442f1dddb9426207de93c1498b | Add a missing migration for Course.solution_visibility description | web/courses/migrations/0005_update_solution_visibility_text.py | web/courses/migrations/0005_update_solution_visibility_text.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('courses', '0004_course_institution'),
]
operations = [
migrations.AlterField(
model_name='problemset',
... | Python | 0.000785 | |
fe5fa8bcde6c98e8dd66cf6190544d4ccf86175e | Add settings file for demo deployments | src/ggrc/settings/app_engine_demo.py | src/ggrc/settings/app_engine_demo.py | from app_engine import *
COMPANY = "Reciprocity, Inc."
COMPANY_LOGO_TEXT = "Demo gGRC Implementation"
| Python | 0 | |
8e54894906f8a67607deb1d81d42eb2a92fafe2e | add rabbit test code | rabbit-test.py | rabbit-test.py | import time
import sys
import stomp
class MyListener(object):
def on_error(self, headers, message):
print 'received an error %s' % message
def on_connecting(self, host_and_port):
print host_and_port
def on_message(self, headers, message):
print 'received a message %s' % m... | Python | 0.000001 | |
880d797a6e1f4e3a9182c647c0530976c1a65fc2 | Add FIWARE Doc Style | doc/conf.py | doc/conf.py | # -*- coding: utf-8 -*-
import os
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
extensions = []
templates_path = ['/home/docs/checkouts/readthedocs.org/readthedocs/templates/sphinx', 'templates', '_templates', '.templates']
source_suffix = ['.rst', '.md']
master_doc = 'index'
project = u'WMarket'
copyrigh... | Python | 0 | |
1b5a6458c526a9789fab5d08fbbc5cece60f3b62 | add bootstrap file | bootstrap.py | bootstrap.py |
def main():
parser = argparse.ArgumentParser(description='Initialize an Elm page')
parser.add_argument('module_name')
parser.add_argument('destination')
args = parser.parse_args()
bootstrap(args.module_name, args.destination)
if __name__ == '__main__':
main()
| Python | 0.000001 | |
8054aa12d4d38b6600750527ed8552058ac216cd | Add 'choose/' from commit '7515ded12265f841375b584cb5da6601cf822a4f' | choose/choose.py | choose/choose.py | #!/usr/bin/env python
# Copyright (C) 2016 Eddie Antonio Santos <easantos@ualberta.ca>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your op... | Python | 0.000082 | |
287fe6a2945c97ca380bd19ff3720e42942495a6 | trim down email_title a bit. | dj/scripts/email_title.py | dj/scripts/email_title.py | #!/usr/bin/python
# email_title.py
# emails the preseter: title slide URL and some other details
from django.core.mail import get_connection, EmailMessage
from django.template import Context, Template
from process import process
from email_ab import email_ab
# from django.conf import settings
class email_title(ema... | #!/usr/bin/python
# email_title.py
# emails the preseter: title slide URL and some other details
from django.core.mail import get_connection, EmailMessage
from django.template import Context, Template
from process import process
from email_ab import email_ab
# from django.conf import settings
class email_title(ema... | Python | 0.000055 |
bf6e9fd75b4d7d7d7f4c225ba6684e895b79160e | add sign up script | cgi-bin/signup.py | cgi-bin/signup.py | #!/usr/bin/env python
from __future__ import print_function
from common import populate_html
import os
import hashlib
import cgi
import MySQLdb
import smtplib
def process_input():
# Load email and password
form = cgi.FieldStorage()
email = form.getfirst("email")
password = form.getfirst("password"... | Python | 0.000001 | |
ef6b50284236df6fa14b440c50f8243427512c81 | Add prototype of wrapped force balance objective | desc/objectives/_wrappers.py | desc/objectives/_wrappers.py | import numpy as np
from desc.backend import jnp
from .utils import get_force_balance_objective, factorize_linear_constraints
class WrappedForceObjective:
"""Evaluate an objective subject to equilibrium constraint
Parameters
----------
objetive : ObjectiveFunction
objective to evaluate
eq ... | Python | 0 | |
64fce7c67849f44492d55ccf8a745b252bf1368b | Add some tests for polynomial printing. | numpy/polynomial/tests/test_printing.py | numpy/polynomial/tests/test_printing.py | import numpy.polynomial as poly
from numpy.testing import TestCase, run_module_suite, assert_
class test_str(TestCase):
def test_polynomial_str(self):
res = str(poly.Polynomial([0,1]))
tgt = 'poly([0., 1.])'
assert_(res, tgt)
def test_chebyshev_str(self):
res = str(poly.Chebys... | Python | 0 | |
96fa9dd03ec6a97f6b99c1556f84b0b50824ee53 | Create keyexpansion.py | research/aes/keyexpansion.py | research/aes/keyexpansion.py | import sys
sys.path.append("../..")
import pyrtl
from pyrtl import *
import func_g
from func_g import *
def KeyExpansion(in_vector):
""" KeyExpansion round of AES.
Input: 16-byte key.
Output: 176-byte expanded key.
"""
w0 = in_vector[96:128]
w1 = in_vector[64:96]
w2 = in_vector[32:64]
w3 = in_vector[0:32]... | Python | 0.000001 | |
d251a2b2cd449ed5078b41b09f50003786f3bbde | Create script to pad and trim fastq reads to one length | seq_pad.py | seq_pad.py | #!/usr/bin/python
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__author__= 'Allison MacLeay'
import sys
import os
import argparse
import glob
import gzip
#-----------------------------------------
# MAIN
# run umitag.py for all files in a directo... | Python | 0 | |
19e3cd7256d5eb25eee8597f82bb2dd3fc019f03 | add a low-level random kick agent | example/low_level_random_kick_agent.py | example/low_level_random_kick_agent.py | #!/usr/bin/env python3
# encoding: utf-8
from hfo import *
import argparse
import numpy as np
import math as m
import sys, os
import itertools
def rad_to_deg(rad):
return rad/m.pi*180
def sign(x):
return (int(x>=0)-0.5)*2
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--po... | Python | 0.000004 | |
5eae0b790fb84ec77bc1f7a28706eecb9f25ef1f | Add another specific script | sauce/bin/add_dummy_users.py | sauce/bin/add_dummy_users.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Add new users by CSV file
@author: moschlar
"""
#
## SAUCE - System for AUtomated Code Evaluation
## Copyright (C) 2013 Moritz Schlarb
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU Affero General Public Licen... | Python | 0.000002 | |
0095e75ce94b3181d56f7783110cadd3d9730577 | add version 0.0.1 for initialize | __init__.py | __init__.py | from __future__ import absolute_import
__version__ = '0.0.1' | Python | 0.000002 | |
4926dc06a94b83ec0cf446074b4c2277d4ebba20 | Reorder imports | bears/js/JSONFormatBear.py | bears/js/JSONFormatBear.py | import json
from collections import OrderedDict
from coala_utils.param_convertion import negate
from coalib.bearlib import deprecate_settings
from coalib.bearlib.spacing.SpacingHelper import SpacingHelper
from coalib.bears.LocalBear import LocalBear
from coalib.misc.Compatibility import JSONDecodeError
from coalib.res... | import json
from collections import OrderedDict
from coalib.bearlib import deprecate_settings
from coalib.bearlib.spacing.SpacingHelper import SpacingHelper
from coalib.bears.LocalBear import LocalBear
from coalib.misc.Compatibility import JSONDecodeError
from coalib.results.Diff import Diff
from coalib.results.Result... | Python | 0 |
d25af87006ac21f55706c3a5579aec3c961b88e8 | Add script to download data from MDCS | download_mdcs_data.py | download_mdcs_data.py | """Fetch images from MDCS.
"""
import json
import requests
import xmltodict
def download_mdcs_data():
user = "dwheeler"
password = "12345"
mdcs_url = "http://129.6.153.123:8000"
schema_title = 'SemImage'
url = mdcs_url + "/rest/templates/select/all"
allSchemas = json.loads(requests.get(url, ... | Python | 0 | |
3e73bbb51c7b5b214dc2c79e5a1cb8b00f243855 | Fix tests | corehq/apps/locations/tests/test_location_fixtures.py | corehq/apps/locations/tests/test_location_fixtures.py | from django.test import SimpleTestCase
from corehq.apps.locations.models import SQLLocation, LocationType
from ..fixtures import _location_to_fixture, _location_footprint
class LocationFixturesTest(SimpleTestCase):
def test_metadata(self):
state = LocationType(
domain="test-domain",
... | from django.test import SimpleTestCase
from corehq.apps.locations.models import Location
from ..fixtures import _location_to_fixture, _location_footprint
class LocationFixturesTest(SimpleTestCase):
def test_metadata(self):
location = Location(
_id="unique-id",
domain="test-domain"... | Python | 0.000003 |
ae0ef3a709e22774cf98f4c3010b66fb1be172bc | add class Datapoint | Datapoint.py | Datapoint.py | import re
from datetime import date
class Datapoint:
def __init__(self, recipient, s_date="01.01.1970", value=0.0, comment=""):
self.__Recipient = recipient
self.__Date = s_date
self.__Value = value
self.__Comment = comment
def get_recipient(self):
return self.__Recipie... | Python | 0.000001 | |
f6637b7fe03e9d72b8053972c444840921b84d6e | Add a registry that keeps track of tag->renderer/input mappings | common/lib/capa/capa/registry.py | common/lib/capa/capa/registry.py | class TagRegistry(object):
"""
A registry mapping tags to handlers.
(A dictionary with some extra error checking.)
"""
def __init__(self):
self._mapping = {}
def register(self, cls):
"""
Register cls as a supported tag type. It is expected to define cls.tags as a list ... | Python | 0 | |
6b6adc4dd4441f47f8d4e45a5f8473dbdfec275d | Move get_packs_base_path and get_pack_base_path to utils in st2common. | st2common/st2common/content/utils.py | st2common/st2common/content/utils.py | import os
import pipes
from oslo.config import cfg
__all__ = [
'get_packs_base_path',
'get_pack_base_path'
]
def get_packs_base_path():
return cfg.CONF.content.packs_base_path
def get_pack_base_path(pack_name):
"""
Return full absolute base path to the content pack directory.
:param pack_... | Python | 0 | |
effc03fbc0646b875e7cd586b04024dbdd12f806 | Create b.py | agc015/b.py | agc015/b.py | def main():
floors = input()
count = 0
for i in range(len(floors)):
if floors[i] == 'U':
count += (len(floors) - (i + 1)) + 2 * i
else:
count += 2 * (len(floors) - (i + 1)) + i
print(count)
if __name__ == '__main__':
main()
| Python | 0.000018 | |
b35e780364ca2d06902302b165ce2261ec6795a1 | Add tests for getting all toilets | ona_migration_script/test_migrate_toilet_codes.py | ona_migration_script/test_migrate_toilet_codes.py | import json
import requests
from requests_testadapter import TestAdapter
import unittest
import migrate_toilet_codes
class TestCreateSession(unittest.TestCase):
def test_create_session(self):
username = 'testuser'
password = 'testpass'
s = migrate_toilet_codes.create_session(username, pas... | Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.