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 |
|---|---|---|---|---|---|---|---|
1de5b9746c33add889837e5e0feaf1796fb00eb8 | add script to generate breakseq index | scripts/breakseq2_gen_bplib.py | scripts/breakseq2_gen_bplib.py | #!/usr/bin/env python
import argparse
from breakseq2 import breakseq_index, _version
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Generate breakpoint library FASTA from breakpoint GFF",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
bre... | Python | 0.000001 | |
4dde2e3718ecd2e3e8b0ffc7e38433e3a9cda546 | add beta_vae script | scripts/vae/models/beta_vae.py | scripts/vae/models/beta_vae.py | # -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Optional
def kl_divergence(mean, logvar):
return -0.5 * torch.mean(1 + logvar - torch.square(mean) - torch.exp(logvar))
def loss(config, x, x_hat, z, mu, logvar):
recons_loss = F.mse_loss(x_hat, x, reduc... | Python | 0 | |
33f455cba56c7ae557cfe9f5494b6a045c68f1d2 | add simple hello world | examples/hello.py | examples/hello.py | from flower import run, schedule, tasklet
def say(s):
for i in range(5):
schedule()
print(s)
def main():
tasklet(say)("world")
say("hello")
run()
if __name__ == '__main__':
main()
| Python | 0.999998 | |
152dafeeb35647dbcfb25549f7f1e73a397428a0 | Add urls for the demo | demo_zinnia_bitly/urls.py | demo_zinnia_bitly/urls.py | """Urls for the zinnia-bitly demo"""
from django.conf import settings
from django.contrib import admin
from django.conf.urls import url
from django.conf.urls import include
from django.conf.urls import patterns
from django.views.generic.base import RedirectView
from zinnia.sitemaps import TagSitemap
from zinnia.sitema... | Python | 0 | |
64b14b64c00bc6885acc1ff4d9b76898f66a8a86 | add new package (#15737) | var/spack/repos/builtin/packages/opendx/package.py | var/spack/repos/builtin/packages/opendx/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class Opendx(AutotoolsPackage):
"""Open Visualization Data Explorer."""
homepage = "https://github.com/Mwoolsey/... | Python | 0 | |
7c56318cb545011e64e3a491058054ad3d7cd9c0 | Create new package. (#5987) | var/spack/repos/builtin/packages/r-aims/package.py | var/spack/repos/builtin/packages/r-aims/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | Python | 0 | |
eb429be1fdc7335bec5ba036fcece309778b23f0 | Add an example that uses filterReactions AND pdep at the same time | examples/rmg/heptane-filterReactions/input.py | examples/rmg/heptane-filterReactions/input.py | # Data sources
database(
thermoLibraries = ['primaryThermoLibrary'],
reactionLibraries = [],
seedMechanisms = [],
kineticsDepositories = ['training'],
kineticsFamilies = 'default',
kineticsEstimator = 'rate rules',
)
# Constraints on generated species
generatedSpeciesConstraints(
maximumCa... | Python | 0 | |
e5a14054e1e9e95b04baf5ec7c92a2fdde51703b | Update __openerp__.py | scanterra_modifcations/__openerp__.py | scanterra_modifcations/__openerp__.py | # -*- coding: utf-8 -*-
{
'name': 'Scanterra Modifications',
'version': '8.0.1.1.0',
'category': 'Sales Management',
'sequence': 14,
'summary': 'Sales, Product, Category, Clasification',
'description': """
Scanterra Modifications
=======================
* Restringir que las tareas creadas por un... | # -*- coding: utf-8 -*-
{
'name': 'Scanterra Modifications',
'version': '8.0.1.0.0',
'category': 'Sales Management',
'sequence': 14,
'summary': 'Sales, Product, Category, Clasification',
'description': """
Scanterra Modifications
=======================
* Restringir que las tareas creadas por un... | Python | 0.000024 |
559ba309a72d277c3b5a78614889d19b8866b7ea | add parallel by Alexandre Gramford (mne-python) | scikits/statsmodels/tools/parallel.py | scikits/statsmodels/tools/parallel.py | """Parralle util function
"""
# Author: Alexandre Gramfort <gramfort@nmr.mgh.harvard.edu>
#
# License: Simplified BSD
def parallel_func(func, n_jobs, verbose=5):
"""Return parallel instance with delayed function
Util function to use joblib only if available
Parameters
----------
func: callable
... | Python | 0 | |
2c6be657e0024a1a2e162a6a508d2d5716736121 | add wrapper class for adiabatic approximation | galpy/actionAngle_src/actionAngleAdiabatic.py | galpy/actionAngle_src/actionAngleAdiabatic.py | ###############################################################################
# actionAngle: a Python module to calculate actions, angles, and frequencies
#
# class: actionAngleAdiabatic
#
# wrapper around actionAngleAxi (adiabatic approximation) to do
# this for any (x,v)
#
# met... | Python | 0 | |
3a240005142da25aa49938a15d39ddf68dd7cead | Add functional test to verify presence of policy | nova/tests/functional/api/openstack/placement/test_verify_policy.py | nova/tests/functional/api/openstack/placement/test_verify_policy.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | Python | 0.003609 | |
b416de22866f6ebc05fcb256d5ab97f391481ddc | Create CSVStreamReader.py | CSVStreamReader.py | CSVStreamReader.py |
# The MIT License (MIT)
# Copyright (c) 2016 Chris Webb
# 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
# to use, copy, modify, m... | Python | 0.000004 | |
04aec30723e976742697ead88a1cd4437f3842de | add test | tests/chainer_tests/dataset_tests/tabular_tests/test_attr_based_dataset.py | tests/chainer_tests/dataset_tests/tabular_tests/test_attr_based_dataset.py | import unittest
import numpy as np
import chainer
from chainer import testing
from chainer.dataset import tabular
class DatasetDataOnly(tabular.AttrBasedDataset):
def __init__(self):
super().__init__()
with self.init_scope():
self.a = np.arange(10)
self.b = [3, 1, 4, 5, ... | Python | 0.000002 | |
da09de30b376f1ab9e687e8064423499b4cf8d50 | Add missing file | vispy/util/context.py | vispy/util/context.py | # -*- coding: utf-8 -*-
# Copyright (c) 2014, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
Functionality to deal with GL Contexts in vispy. This module is not in
app, because we want to make it possible to use parts of vispy without
relying on app.
The GLContex... | Python | 0.000006 | |
7c623e1368f92155edafdbf822b8c1512aebbfaa | Create conf.py | docs/conf.py | docs/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Use sphinx-quickstart to create your own conf.py file!
# After that, you have to edit a few things. See below.
# Select nbsphinx and, if needed, add a math extension (mathjax or pngmath):
extensions = [
'nbsphinx',
'sphinx.ext.mathjax',
'jupyter_alabaster_... | Python | 0.000001 | |
783e7f644e2fc659d432d447bbbe6a01f2ac74c1 | Fix #390 #450 | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django import forms
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as AuthUserAdmin
from django.contrib.auth.forms import UserChangeForm, UserCreationForm
from .models import User
class MyUserChang... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django import forms
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as AuthUserAdmin
from django.contrib.auth.forms import UserChangeForm, UserCreationForm
from .models import User
class MyUserChan... | Python | 0.000004 |
207f8ffaffa1eb6c7ed8a5f4c884f91ec3e971f3 | Format : Add compatibility conversion for old serialised Formats with (0,0) min values. | startup/GafferImage/formatCompatibility.py | startup/GafferImage/formatCompatibility.py | ##########################################################################
#
# Copyright (c) 2015, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | Python | 0 | |
471c36f309360396fa173ec3b75d3783d791f5f5 | string is powerful | src/strings.py | src/strings.py | person = "Harold Finch"
print person[0],person[1]; # H a
print person[0:6] # Harold
greeting = "Hello " + person; # Hello Harold Finch
print greeting[:6] + "John Reese"; # Hello John Reese
contains = 'H' in person;
notcontains = 'R' in person;
print contains, notcontains; # True, False | Python | 0.999999 | |
9d51e2ef626ce61dd3ae563681477b12a2352881 | Add test_sprint | test_sprint.py | test_sprint.py | def inc(val):
return val - 1
def test_inc():
assert inc(5) == 6
| Python | 0.000002 | |
8f6db5945348879a7340f8a4c7da6111a06cd062 | Add new module to statically host an arbitrary directory | python/smqtk/web/search_app/modules/static_host.py | python/smqtk/web/search_app/modules/static_host.py | import flask
__author__ = 'paul.tunison@kitware.com'
class StaticDirectoryHost (flask.Blueprint):
"""
Module that will host a given directory to the given URL prefix (relative to
the parent module's prefix).
Instances of this class will have nothing set to their static URL path, as a
blank stri... | Python | 0 | |
fdb8f36fd4eed11d5d757d8477b3c2b8619aae8a | Add management command to populate last_modified fields | corehq/apps/commtrack/management/commands/product_program_last_modified.py | corehq/apps/commtrack/management/commands/product_program_last_modified.py | from django.core.management.base import BaseCommand
from corehq.apps.commtrack.models import Product, Program
from dimagi.utils.couch.database import iter_docs
from datetime import datetime
import json
class Command(BaseCommand):
help = 'Populate last_modified field for products and programs'
def handle(self,... | Python | 0.000001 | |
cf6d2e732ab4b7131312323632761561f2aa3a86 | add field user_email to DynamicSaveInputs | webapp/apps/dynamic/migrations/0002_dynamicsaveinputs_user_email.py | webapp/apps/dynamic/migrations/0002_dynamicsaveinputs_user_email.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('dynamic', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='dynamicsaveinputs',
nam... | Python | 0.000001 | |
6118b05f0efd1c2839eb8bc4de36723af1fcc364 | Convert snake_case to camelCase or PascalCase (#7028) (#7034) | strings/snake_case_to_camel_pascal_case.py | strings/snake_case_to_camel_pascal_case.py | def snake_to_camel_case(input: str, use_pascal: bool = False) -> str:
"""
Transforms a snake_case given string to camelCase (or PascalCase if indicated)
(defaults to not use Pascal)
>>> snake_to_camel_case("some_random_string")
'someRandomString'
>>> snake_to_camel_case("some_random_string", u... | Python | 0.997846 | |
e581d41ded30aac220875c4e5f8fd41e56889742 | Fix googlehome alarm sensor platform (#20742) | homeassistant/components/googlehome/sensor.py | homeassistant/components/googlehome/sensor.py | """
Support for Google Home alarm sensor.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.googlehome/
"""
import logging
from datetime import timedelta
from homeassistant.components.googlehome import (
CLIENT, DOMAIN as GOOGLEHOME_DOMAIN, NAME... | """
Support for Google Home alarm sensor.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.googlehome/
"""
import logging
from datetime import timedelta
from homeassistant.components.sensor import ENTITY_ID_FORMAT
from homeassistant.components.goog... | Python | 0 |
4a71e883a469f22995775cbc1eeb6489a2dd71d1 | add integration test | tests/integration_tests/test_contrib_wandb.py | tests/integration_tests/test_contrib_wandb.py | import logging
import os
import shutil
import sys
import ludwig.contrib
from tests.integration_tests.test_experiment import run_experiment
from tests.integration_tests.utils import image_feature
from tests.integration_tests.utils import category_feature
from tests.integration_tests.utils import generate_data
import w... | Python | 0.000001 | |
da5afa7e96bfa72d6fd0906ed1a42c5f230112f5 | Add tests for update_taxon_assignments method | test/core/update_taxon_assignments_test.py | test/core/update_taxon_assignments_test.py | import os
import time
import unittest
from configparser import ConfigParser
from uuid import uuid4
from GenomeFileUtil.GenomeFileUtilImpl import GenomeFileUtil
from GenomeFileUtil.GenomeFileUtilServer import MethodContext
from installed_clients.WorkspaceClient import Workspace as workspaceService
# NOTE: These tests ... | Python | 0 | |
bbc4351a5611a035bbee1f18cb55b74d9583cdcd | Create a state for add an object | sara_flexbe_states/src/sara_flexbe_states/Wonderland_Add_Object.py | sara_flexbe_states/src/sara_flexbe_states/Wonderland_Add_Object.py | #!/usr/bin/env python
# encoding=utf8
import json
import requests
from flexbe_core import EventState, Logger
class Wonderland_Add_Object(EventState):
'''
Add an object to Wonderland.
For the room, enter only ID or Name, not both.
Return the ID of the added human.
># name string name of the human
... | Python | 0.000006 | |
3ce9dcb1ae21ac35ddd97d648ae3ff4b5877adc5 | add script for downloading and conversion of bhuman dataset after conversion the dataset is in the same format as the berlin-united one | Utils/py/BallDetection/RegressionNetwork/generate_image_db_bhuman.py | Utils/py/BallDetection/RegressionNetwork/generate_image_db_bhuman.py | """
Converts the b-human 2019 dataset to the naoth format so we can run performance comparisons
"""
import pickle
import numpy as np
import h5py
from pathlib import Path
from urllib.request import urlretrieve
from urllib.error import HTTPError, URLError
from utility_functions.loader import calculate_mean, subtract_mean... | Python | 0 | |
78bc96307fb52d95e36eab1da6fa57a66af736e8 | Add script to delete couch phone numbers | corehq/apps/sms/management/commands/delete_messaging_couch_phone_numbers.py | corehq/apps/sms/management/commands/delete_messaging_couch_phone_numbers.py | from corehq.apps.sms.mixin import VerifiedNumber
from corehq.apps.sms.models import PhoneNumber
from dimagi.utils.couch.database import iter_docs_with_retry, iter_bulk_delete_with_doc_type_verification
from django.core.management.base import BaseCommand
from optparse import make_option
class Command(BaseCommand):
... | Python | 0 | |
678ef4a2ccd9bbfc12ed9a6077d666c4daebf243 | remove like indexes from phonelog | corehq/ex-submodules/phonelog/migrations/0008_remove_like_indexes.py | corehq/ex-submodules/phonelog/migrations/0008_remove_like_indexes.py | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
db.execute("DROP INDEX IF EXISTS phonelog_devicereportentry_device_id_like")
db.execute("DROP INDEX IF EXISTS phone... | Python | 0.000054 | |
20c6f14d4cc76771290f7ce6fc4f3dd5abed07b4 | write symbol calculus with sympy. | cpp/src/DO/Sara/MultiViewGeometry/Estimators/five_point_algorithm.py | cpp/src/DO/Sara/MultiViewGeometry/Estimators/five_point_algorithm.py | from sympy import *
X = Matrix(symbols(' '.join(['X{}'.format(i) for i in range(9)]))).reshape(3, 3)
Y = Matrix(symbols(' '.join(['Y{}'.format(i) for i in range(9)]))).reshape(3, 3)
Z = Matrix(symbols(' '.join(['Z{}'.format(i) for i in range(9)]))).reshape(3, 3)
W = Matrix(symbols(' '.join(['W{}'.format(i) for i in ra... | Python | 0 | |
25b0544c2f2c78dbc3bf971d955fda651d7ed5e9 | fix is_open_for_signup missing param | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/users/adapter.py | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/users/adapter.py | # -*- coding: utf-8 -*-
from django.conf import settings
from allauth.account.adapter import DefaultAccountAdapter
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
class AccountAdapter(DefaultAccountAdapter):
def is_open_for_signup(self, request):
return getattr(settings, 'ACCOUNT_ALL... | # -*- coding: utf-8 -*-
from django.conf import settings
from allauth.account.adapter import DefaultAccountAdapter
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
class AccountAdapter(DefaultAccountAdapter):
def is_open_for_signup(self, request):
return getattr(settings, 'ACCOUNT_ALL... | Python | 0.000021 |
c8143c9f3eca422e48625700aeef11e528131caf | add zeroOutDisk.py | zeroOutDisk.py | zeroOutDisk.py | #!/usr/bin/env python
def zeroOutDisk():
"""Fill selected device (/dev/) with zeros."""
pass=1
for int in range(wipe):
print 'Wiping drives pass %s of $s")%(pass, count))
os.system(("dd if=/dev/zero of=%s")%(device))
pass+=1
| Python | 0.000001 | |
8b26888dea4e825d06b6ebfed628a1762f6a5455 | Solve 48. | 048/solution.py | 048/solution.py | # coding: utf-8
""" Project Euler problem #48. """
def problem():
u""" Solve the problem.
The series, 11 + 22 + 33 + ... + 1010 = 10405071317.
Find the last ten digits of the series, 11 + 22 + 33 + ... + 10001000.
Answer: 9110846700
"""
result = long(0)
for num in range(1, 1001):
... | Python | 0.999984 | |
e0770c4a671c650f4569036350b4047fcf925506 | Add a demo app to illustrate the result | AnalysisDemo.py | AnalysisDemo.py | import wx
#import matplotlib
class AnalysisDemo(wx.Frame):
def __init__(self, *args, **kw):
super(AnalysisDemo, self).__init__(*args, **kw)
self.initMain()
def initMain(self):
pn = wx.Panel(self)
self.showPackage = wx.RadioButton(pn, label='Organize in package')
self.s... | Python | 0 | |
0d92a54f244b1d2ba3a0e6be5a2ff9ab0766171c | lab3 lab3 | Lab3/palindrome.py | Lab3/palindrome.py | check=input("input word for testing")
def del_space(word):
word = word.replace(" ","")
word = word.lower()
print(word)
return word
| Python | 0.999727 | |
b19d6a63d80919b3e7a2f3c40cd026085a526614 | Create Rehash.py | LintCode/Rehash.py | LintCode/Rehash.py | '''
Medium Rehashing Show result
25% Accepted
The size of the hash table is not determinate at the very beginning. If the total size of keys is too large (e.g. size >= capacity / 10), we should double the size of the hash table and rehash every keys. Say you have a hash table looks like below:
size=3, capacity=4
[n... | Python | 0 | |
af4a5e92dc7ef8bffa96c6e556671e1c49116a70 | Test commit | radproc.py | radproc.py | #-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: heistermann
#
# Created: 26.10.2011
# Copyright: (c) heistermann 2011
# Licence: <your licence>
#------------------------------------------------------------------------... | Python | 0 | |
217b95f7ecb42dd4a9a671703c86a2b83838bb28 | rename to .py | python_solutions/PENULTIMATE_WORD/PENULTIMATE_WORD.py | python_solutions/PENULTIMATE_WORD/PENULTIMATE_WORD.py | """
Write a program which finds the next-to-last word in a string.
INPUT SAMPLE:
Your program should accept as its first argument a path to a filename. Input
example is the following:
some line with text
another line
Each line has more than one word.
OUTPUT SAMPLE:
Print the next-to-last word in the following way... | Python | 0.999999 | |
bc10094ef6250558d713f3636dbd01f295503f15 | Create NovelAPI.py | NovelAPI.py | NovelAPI.py | import aiohttp
from bs4 import BeautifulSoup
onlysession = aiohttp.ClientSession()
class NovelUpdatesAPI:
def __init__(self):
self.baseurl = 'http://www.novelupdates.com/'
async def search_novel_updates(self, term: str):
term = term.replace(' ', '+')
params = {'s': term, 'post_type': '... | Python | 0 | |
ea3f995775b42784d99ebc19effce949a700eb28 | Update blocks.py | Urutu/cl/blocks.py | Urutu/cl/blocks.py | ## OpenCL blocks are initialized here!
## Created by: Aditya Atluri
## Date: Mar 03 2014
def bx(blocks_dec, kernel):
if blocks_dec == False:
string = "int bx = (get_global_id(0) - get_local_id(0)) / get_local_size(0);\n"
kernel = kernel + string
blocks_dec = True
return kernel, blocks_dec
def by(blocks_dec, k... | ## OpenCL blocks are initialized here!
## Created by: Aditya Atluri
## Date: Mar 03 2014
def bx(blocks_dec, kernel):
if blocks_dec == False:
string = "int bx = get_group_id(0);\n"
kernel = kernel + string
blocks_dec = True
return kernel, blocks_dec
def by(blocks_dec, kernel):
if blocks_dec == False:
string... | Python | 0.000001 |
f9bad030fffbf6b50ec5833c4024656c725c7679 | Rename and add item3. | Python/item3.py | Python/item3.py | #!/usr/local/bin/python
# -*- coding:utf-8 -*-
import sys
def to_unicode(unicode_or_str):
if isinstance(unicode_or_str,str):
v=unicode_or_str.decode('utf-8')
else:
v=unicode_or_str
return v
def to_str(unicode_or_str):
if isinstance(unicode_or_str,unicode):
v=unicode_or_str.encode('utf-8')
else:
... | Python | 0 | |
09f8a25a80924a5f0b29969ffe3f89ad798ec1b4 | Create default.py | default.py | default.py | # -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations
# -------------------------------------------------------------------------
# This is a sample controller
# - index is the default action of any application
# - user is required for authentication and authorization
... | Python | 0.000001 | |
2caf6ab1e43ad29864e4dc652a60e445adfa31bb | Add session merger tool | SessionTools/session_merger.py | SessionTools/session_merger.py | import gzip
import os
import random
import time
import sys
VERBOSE = True
def log(s):
if VERBOSE:
print (time.strftime("%Y-%m-%d %H:%M:%S") + " " + str(s))
if len(sys.argv) != 3:
print ("Usage: python session_merger.py PathToInSessions PathToTargetSessions")
exit(1)
inSessionsPath = sys.argv[1]
print(inSe... | Python | 0 | |
b6531b3712a5c6e42f4cd1241e740f46fd448696 | add send_setpoint | laserpack/bin/send_setpoint.py | laserpack/bin/send_setpoint.py | #!/usr/bin/env python
# vim:set ts=4 sw=4 et:
import rospy
import mavros
import time
import tf
import numpy as np
from laserpack.getch import *
from threading import Thread
from geometry_msgs.msg import PoseStamped
from sensor_msgs.msg import Imu
from mavros_msgs.srv import SetMode
from mavros_msgs.msg import State
... | Python | 0.000001 | |
e9861532a3aa420b68bc797ee54f7429ea73c0e7 | fix #1 | rest.py | rest.py | from flask import Flask
app = Flask(__name__)
@app.route("/")
def ping():
return "python server received 'ping' request!"
if __name__ == "__main__":
app.run(debug=True)
| Python | 0.000002 | |
e40091a2105fc4e04bcce9b2c6ebcc7cf28f22ca | add module uwsgi | modules/uwsgi.py | modules/uwsgi.py | """uwsgi-for-Django module.
Website: https://uwsgi-docs.readthedocs.io/en/latest/
"""
import os
def uwsgi(loader, *args):
loader.setup_virtualenv()
venv_dir = loader.get_virtualenv_dir()
binargs = [os.path.join(venv_dir, 'bin', 'uwsgi')] + list(args)
os.execvp(binargs[0], binargs)
def uwsgi_run(load... | Python | 0.000001 | |
a1d523c2daf563444761cb7315e18e1e0ee1b506 | Add ARM program (forgot to add) | ppci/arch/arm/program.py | ppci/arch/arm/program.py | from ppci.programs import MachineProgram
class ArmProgram(MachineProgram):
""" Machine code for most mobile devices and e.g. the Raspberry Pi.
"""
def _check_items(self, items):
return items
def _copy(self):
raise NotImplementedError()
def _get_report(self, html):
... | Python | 0 | |
10af3d7ee13afda37e8ecf76927bc2fedfe22b6f | add expand module | biothings_explorer/expand/__init__.py | biothings_explorer/expand/__init__.py | from collections import defaultdict
from ..smartapi_kg import MetaKG
from ..call_apis import APIQueryDispatcher
from ..query.utils import annotateEdgesWithInput
class Expander:
def __init__(self):
self.kg = MetaKG()
self.kg.constructMetaKG(source="local")
def __getEdges(self, semanticType):
... | Python | 0.000001 | |
034b4a634511299886520431022cd3b1c2bd8994 | Create dropper.py | dropper.py | dropper.py | #!/usr/bin/python
# Stego Dropper For Pentesters v0.1
# Heavily uses parts from https://github.com/RobinDavid/LSB-Steganography
import urllib
import urllib2
import httplib
import subprocess
import sys
import base64
import os
import string
import cv2.cv as cv
# Set your payload server address
HOST = "localhost" # sys.... | Python | 0 | |
b55e27e7420443b4d9a48da7c4e5501e1de66f44 | Add some code | modules/descriptive_statistics/app.py | modules/descriptive_statistics/app.py | class DescriptiveStatistics():
def __init__(self,data):
return self.main()
def main(self):
return True | Python | 0.000013 | |
c505b95c3affe3805bd9274c3aedd1c6640c5ff5 | Create solution.py | leetcode/medium/linked_list_cycle_ii/py/solution.py | leetcode/medium/linked_list_cycle_ii/py/solution.py | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def detectCycle(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
if head == None:
retur... | Python | 0.000018 | |
2b7fffd3f6f358df5613b9aa304f9a70f9b04bc2 | add bloom filter script | cloud-computing-concepts-part1/scripts/bloom-filter.py | cloud-computing-concepts-part1/scripts/bloom-filter.py | __author__ = 'grokrz'
m = 32
def hash_function(x, i, m):
return ((pow(x, 2) * pow(x, 3)) * i) % m
def show_bits_set_to_1(val):
for i in range(1, 4):
print "Bit set to 1: " + str(hash_function(val, i, m))
show_bits_set_to_1(2013) | Python | 0 | |
c3a83ed6158fcd9335f9253417ca4b24e9ab7934 | Add test for fqdn thread leak | tests/pytests/unit/modules/test_network.py | tests/pytests/unit/modules/test_network.py | import threading
import pytest
import salt.modules.network as networkmod
from tests.support.mock import patch
@pytest.fixture
def configure_loader_modules():
return {networkmod: {}}
@pytest.fixture
def socket_errors():
# Not sure what kind of errors could be returned by getfqdn or
# gethostbyaddr, but ... | Python | 0.000002 | |
f58589f4bcb2aa233ebbd71831e31b1b9505e2c4 | Create wiki_img_extractor.py | wiki_img_extractor.py | wiki_img_extractor.py | ##/**
## * xa2.js
## * @author Akshay Dahiya - @xadahiya
## * @description Typingeek's tutor script
## */
import wikipedia, requests, lxml.html
###images and caption from wikipedia
##
##main image from table@class="infobox"
## img/@src,img/@alt
##
##wikipedia images from div@class="thumb tright"
## img@clas... | Python | 0.000001 | |
a0aae3600da7658d9ab8389ec136977c064a0276 | remove like indexes from sms | corehq/apps/sms/migrations/0003_remove_like_indexes.py | corehq/apps/sms/migrations/0003_remove_like_indexes.py | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
db.execute("DROP INDEX IF EXISTS sms_sms_couch_id_like")
db.execute("DROP INDEX IF EXISTS sms_sms_couch_recipient_d... | Python | 0.000304 | |
f7328b96275bad6c3d8d9a4f844d47a65fe2bf4b | Create test_wrap.py | wordwrap/test_wrap.py | wordwrap/test_wrap.py | import unittest
from wrap import wrap
class TestWW(unittest.TestCase):
def test_empty_string(self):
self.assertEqual('', wrap('', 1))
def test_string_smaller_than_col(self):
self.assertEqual('ab', wrap('ab', 3))
def test_string_without_spaces(self):
self.assertEqual('ab\ncd', wra... | Python | 0.000007 | |
7922f168c1f844d7f1b69dfb383918d051cc312f | test when no server is present on the connection | tests/twisted/search/no-server-property.py | tests/twisted/search/no-server-property.py | """
Tests Contact Search channels to a simulated XEP-0055 service, without
passing the Server property
"""
import dbus
from twisted.words.xish import xpath
from gabbletest import exec_test, sync_stream, make_result_iq, acknowledge_iq, elem_iq, elem
from servicetest import EventPattern
from search_helper import call_... | """
Tests Contact Search channels to a simulated XEP-0055 service, without
passing the Server property
"""
import dbus
from twisted.words.xish import xpath
from gabbletest import exec_test, sync_stream, make_result_iq, acknowledge_iq, elem_iq, elem
from servicetest import EventPattern
from search_helper import call_... | Python | 0 |
0a02faf18fd3f05156df1b59dce83cee49a149f5 | set version in finstance | onadata/apps/fsforms/management/commands/save_version_in_finstance.py | onadata/apps/fsforms/management/commands/save_version_in_finstance.py | from django.core.management.base import BaseCommand
from onadata.apps.fsforms.models import FInstance
class Command(BaseCommand):
help = 'Set version in FInstance for given user'
def add_arguments(self, parser):
parser.add_argument('username', type=str)
def handle(self, *args, **options):
... | Python | 0 | |
0e51e1b32fd51ea2f55ee64c762dcbc87159caa0 | Add test_visibility_uvfits | tests/processing_components/test_visibility_uvfits.py | tests/processing_components/test_visibility_uvfits.py | """ Unit tests for visibility operations
"""
import sys
import unittest
import logging
import numpy
from data_models.parameters import arl_path
from data_models.polarisation import PolarisationFrame
from processing_components.visibility.base import create_blockvisibility_from_uvfits, create_visibility_f... | Python | 0.00141 | |
b7f9bbd7afd64c702a2ea296b9e47cb5f563a4a2 | Create valid-square.py | Python/valid-square.py | Python/valid-square.py | # Time: O(1)
# Space: O(1)
# Given the coordinates of four points in 2D space,
# return whether the four points could construct a square.
#
# The coordinate (x,y) of a point is represented by an integer array with two integers.
#
# Example:
# Input: p1 = [0,0], p2 = [1,1], p3 = [1,0], p4 = [0,1]
# Output: True
# Note... | Python | 0.99833 | |
9925f3a677b7a855a2242176139bde4ab9d62ba0 | Add script which will compute the number of 'bonnes boites' per rome | labonneboite/scripts/nb_hirings/rome_nb_bonne_boite.py | labonneboite/scripts/nb_hirings/rome_nb_bonne_boite.py | import pandas as pd
if __name__ == '__main__':
df = pd.read_csv('prediction_per_company_per_rome2019-11-08.csv')
df_rome_nb_bonne_boite = df.groupby(['rome'])['is a bonne boite ?'].sum()
df_rome_nb_bonne_boite.to_csv('nb_bonne_boite_per_rome2019-11-089.csv')
| Python | 0.834097 | |
8f488365c9a4f14bf96eab089d6ac869b675c1b4 | Add system.version functional test | tests/functional/test_system.py | tests/functional/test_system.py | import logging
import unittest
import trovebox
from tests.functional import test_base
class TestSystem(test_base.TestBase):
testcase_name = "system"
def setUp(self):
"""
Override the default setUp, since we don't need a populated database
"""
logging.info("\nRunning %s...", se... | Python | 0.000002 | |
234d53ed185976a65042c136426d7f05022a698d | add memnn test | tests/test_memnn.py | tests/test_memnn.py | from __future__ import print_function
import unittest
from seya.layers.memnn2 import MemN2N
from keras.models import Sequential
from keras.layers.core import Lambda
from keras import backend as K
import numpy as np
class TestMemNN(unittest.TestCase):
"""Test seya.layers.memnn layer"""
def test_memnn(self):... | Python | 0.000001 | |
b15bf5758539c0682ba607e74e34ef8869431a49 | add tests for TETRA calculations | tests/test_tetra.py | tests/test_tetra.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""test_tetra.py
Test tetra.py module.
These tests are intended to be run from the repository root using:
nosetests -v
print() statements will be caught by nosetests unless there is an
error. They can also be recovered with the -s option.
(c) The James Hutton Institut... | Python | 0 | |
737ac4ddbc3d047fbf41e3d9f7cde20a53d8974a | add management command to decrypt eval data | evaluation/management/commands/decrypt_eval_data.py | evaluation/management/commands/decrypt_eval_data.py | from django.core.management.base import BaseCommand
import gnupg
import json
from django.conf import settings
import environ
env = environ.Env()
from evaluation.models import EvalRow
class Command(BaseCommand):
help='decrypts eval data. can only be run in local environments (import data from prod)'
def handl... | Python | 0.000002 | |
81785da3db0b4f20b0fb8f1bbfaf86a5c0bb7eab | Send updates for 99DOTS successful records wrongly marked as failed | custom/enikshay/management/commands/mark_successfull_99dots_records.py | custom/enikshay/management/commands/mark_successfull_99dots_records.py | from __future__ import absolute_import, print_function
import csv
from datetime import datetime
from django.core.management.base import BaseCommand
from corehq.apps.hqcase.utils import update_case
from corehq.form_processor.interfaces.dbaccessors import CaseAccessors
from corehq.motech.repeaters.dbaccessors import (... | Python | 0 | |
b977b1e6732255732843aaaad3e5c1f8e2b4d0e0 | add unit tests for openquake/utils/general.py | tests/utils_general_unittest.py | tests/utils_general_unittest.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010-2011, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# only, as published by the Free Software Foundation.
#
# OpenQuak... | Python | 0.000004 | |
e4e4a52318b857ce315a6f673e72b018e6501a83 | Add a plotting example. | Lib/sandbox/pyem/examples/plotexamples.py | Lib/sandbox/pyem/examples/plotexamples.py | #! /usr/bin/env python
# Last Change: Mon Jun 11 03:00 PM 2007 J
# This is a simple test to check whether plotting ellipsoides of confidence and
# isodensity contours match
import numpy as N
from numpy.testing import set_package_path, restore_path
import pylab as P
set_package_path()
import pyem
restore_path()
# Ge... | Python | 0.999999 | |
dccfeac4af2d16e332af9618b8a0c63b1289fdbb | Create alpha_reader.py | alpha_reader.py | alpha_reader.py | from itertools import groupby
import csv
import numpy as np
import pandas
import skll
def average(values):
return sum(values) / len(list(values))
def squared_difference(value, average):
return ( value - average )**2
def variance(values):
try:
return average(
[
squared... | Python | 0.000053 | |
0caef8ed3bcf369ffd61f83b06f971b31ae0fb70 | test unittest | bnw_core/test_delayed_global.py | bnw_core/test_delayed_global.py | # coding: utf-8
from delayed_global import DelayedGlobal
def test_delayed_global():
a = DelayedGlobal()
b = dict({100:200})
try:
c = a.get(100)
except AttributeError:
pass
else:
assert 0, "Got result from empty DelayedGlobal"
a.register(b)
assert a.get(100) == ... | Python | 0.000001 | |
ae6f5556cc37d72fff49c76932b94ac8a65bcfbf | make an example python' | example.py | example.py | import time
import uuid
from datetime import datetime
from decimal import Decimal
from json_util import dumps, loads
json_ = {"MyString": "a",
"num": 4,
"MyBool": False,
"my_dict": {"my_date": datetime.utcnow()},
"MyNone": None,
"MyZero": 0,
"myDecimal": Decimal("... | Python | 0.001311 | |
405d33789a70a04ebdcca491ca2a749e9e48ddfd | Add example | example.py | example.py | import pygame
import bluePoV
# Varia el color regularmente
x,y = (480,64)
pendiente = 4
# Pygame inits & variables
pygame.init()
pygame.display.set_mode((x,y))
disp = pygame.display.get_surface()
clock = pygame.time.Clock()
# BluePoV init & variables
print ("Port? (default /dev/ttyUSB0)")
port = input()
if not port... | Python | 0.000003 | |
3a200bbc447ee05c650bbd592a331b2817c9a498 | Update create_address_doc_from_address_field_in_company.py | erpnext/patches/v8_0/create_address_doc_from_address_field_in_company.py | erpnext/patches/v8_0/create_address_doc_from_address_field_in_company.py | # Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
# new field address_html is created in place of address field for the company's address in PR #8754 (without patch)
# so here is the patch for ... | # Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
# new field address_html is created in place of address field for the company's address in PR #8754 (without patch)
# so here is the patch for ... | Python | 0.000004 |
a6c8176e3f4602e846888293093fc64b7b20233b | Add cmd to force send of cancelled repeat records | corehq/motech/repeaters/management/commands/send_cancelled_records.py | corehq/motech/repeaters/management/commands/send_cancelled_records.py | import csv
import datetime
import re
import time
from django.core.management.base import BaseCommand
from corehq.motech.repeaters.const import RECORD_CANCELLED_STATE
from corehq.motech.repeaters.dbaccessors import iter_repeat_records_by_domain
class Command(BaseCommand):
help = """
Send cancelled repeat rec... | Python | 0 | |
bf66372b2b5b49ba4a93d8ac4f573ceb7857f5b8 | Fix attach in case of multiple threads. | python/helpers/pydev/pydevd_attach_to_process/linux/lldb_threads_settrace.py | python/helpers/pydev/pydevd_attach_to_process/linux/lldb_threads_settrace.py | # This file is meant to be run inside lldb as a command after
# the attach_linux.dylib dll has already been loaded to settrace for all threads.
def __lldb_init_module(debugger, internal_dict):
# Command Initialization code goes here
print('Startup LLDB in Python!')
import lldb
try:
show_debug_i... | # This file is meant to be run inside lldb as a command after
# the attach_linux.dylib dll has already been loaded to settrace for all threads.
def __lldb_init_module(debugger, internal_dict):
# Command Initialization code goes here
print('Startup LLDB in Python!')
try:
show_debug_info = 0
... | Python | 0 |
1f6595acc01c6dfda899886388b4309f3d8c855b | add index to fixed_ips | nova/db/sqlalchemy/migrate_repo/versions/139_add_indexes_to_fixed_ips.py | nova/db/sqlalchemy/migrate_repo/versions/139_add_indexes_to_fixed_ips.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/... | Python | 0.000001 | |
66e87095caa9df483ad5727110e29e0071305987 | add first parser for Monarch-internally curated data #10 | dipper/sources/Monarch.py | dipper/sources/Monarch.py | import csv
import re
import logging
from os import listdir
from os.path import isfile, join
from dipper.sources.Source import Source
from dipper.models.assoc.D2PAssoc import D2PAssoc
from dipper.models.Genotype import Genotype
from dipper.models.Dataset import Dataset
from dipper.utils.GraphUtils import GraphUtils
fro... | Python | 0 | |
5e8ce7c9fb31d76ec5f372bb0b62e7b846304966 | Create exerc-4.py | exerc-4.py | exerc-4.py | arquivo = open("arquivo.txt","w")
for i in range(1):
arquivo.write("Atividade 4 ")
arquivo.close()
arquivo = open("arquivo.txt","r")
for linha in arquivo:
print("Texto: ",linha)
arquivo.close()
arquivo = open("arquivo.txt", "r")
copia = open("copia.txt", "w")
while 1:
texto = arquivo.read(50)
if t... | Python | 0.000001 | |
98a6a1dfe9b692cfde47e25a504d2a9ee80bcf29 | remove unnecessary import | planetstack/observer/event_manager.py | planetstack/observer/event_manager.py | import threading
import requests, json
from planetstack.config import Config
from observer.deleters import deleters
import os
import base64
from fofum import Fofum
import json
# decorator that marks dispatachable event methods
def event(func):
setattr(func, 'event', func.__name__)
return func
c... | import threading
import requests, json
from core.models import *
from planetstack.config import Config
from observer.deleters import deleters
import os
import base64
from fofum import Fofum
import json
# decorator that marks dispatachable event methods
def event(func):
setattr(func, 'event', func.__name__)
... | Python | 0.000037 |
a18ef3eb9128ee27d4f14e7952ba8545b510c4ac | add e2e test file | e2e_test.py | e2e_test.py | # Copyright 2015, Google, 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, software d... | Python | 0.000001 | |
5695a468f8619ea6bb7c9a01857a375f827de6a1 | Add parser for 0.4.6 XML report. | libptp/tools/arachni/parser.py | libptp/tools/arachni/parser.py | from libptp.exceptions import NotSupportedVersionError
from libptp.info import Info
from libptp.parser import AbstractParser
class ArachniXMLParser(AbstractParser):
__tool__ = 'arachni'
__format__ = 'xml'
__version__ = ['0.4.6']
def __init__(self, *args, **kwargs):
AbstractParser.__init__(se... | Python | 0 | |
ddad199df01cf41dda188d501ddb74e17c38d94f | add symbiotic3 tool | benchexec/tools/symbiotic3.py | benchexec/tools/symbiotic3.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
... | Python | 0 | |
8e9c2a3c31184e789bf2788f5fa0ab06e0db988f | Add utilities module | sufam/utils.py | sufam/utils.py | import errno
import os
import shutil
import sys
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc:
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else:
raise
def rm_rf(path):
if os.path.isdir(path):
shutil.rmtree(path)
... | Python | 0.000001 | |
c1fb94f457b09fe6602075331ea14c3cfa0d60e4 | Add services and API status management command | src/nodeconductor_assembly_waldur/support/management/commands/status.py | src/nodeconductor_assembly_waldur/support/management/commands/status.py | import logging
import requests
from django.contrib.auth import get_user_model, authenticate
from django.core.management.base import BaseCommand
from django.db import connection
from django.db.utils import OperationalError
from elasticsearch.exceptions import ElasticsearchException
from redis import exceptions as redis... | Python | 0 | |
efb6072e097a816bb46fdd83541c763e222816c9 | Add initial tests for the concordance view | clic/dickens/test_concordance.py | clic/dickens/test_concordance.py | import unittest
from concordance_new import Concordancer_New
class TestConcordancerNewChapterIndex(unittest.TestCase):
def test_create_concordance(self):
"""
This is a very naive test to run whilst reviewing the create
concordance code. It's goal is simply to evaluate whether that
... | Python | 0 | |
915f94433171c9ee73fa5cf5941c695590e6ee16 | add fabric config file | fabfile.py | fabfile.py | import os, re
from datetime import datetime
from fabric.api import *
#server user name
env.user = 'zhengnan'
# sudo user
env.sudo_user = 'root'
# server address
env.hosts = ['192.168.56.103']
db_user = 'www-data'
db_password = 'www-data'
_TAR_FILE = 'dist-awesome.tar.gz'
def build():
includes = ['static', '... | Python | 0.000001 | |
7e8d1220ef0032c505d7d66838fc9fc9999da810 | add some python test code | project_02/tests.py | project_02/tests.py | from unittest import TestCase, main
import subprocess
import re
NUM_PATTERN = re.compile(r'\w+\s*=\s*(?P<num>[10]+)')
def run(num1, num2, operation):
p = subprocess.Popen(
'./proj2.out',
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
stdin=subprocess.PIPE,
bufsize=0
)
p.stdin.write('{}\n{}\n{}\n'.fo... | Python | 0.000062 | |
9f5bc55f7cfc5b6d0ee3ee9d6ad8a5317e1fa62b | Move all constants here | consts.py | consts.py | ## Constants
# Lat / long bounding box of City of Portland
# (-123.0, 44.0, -122.0, 45.0) ??
PDX_BOUNDING_BOX = (-122.9, 45.35, -122.4, 45.7)
| Python | 0.000003 | |
7185136cf4322397803eabe805ab4e818197edf8 | Add wsgi startup script | core.wsgi | core.wsgi | import os
import sys
root = os.path.dirname(__file__)
sys.path.insert(0, root)
from core import app as application
from core import index
from core.handlers.search import *
from core.handlers.regulation import *
index.init_schema()
| Python | 0.000001 | |
a76f2bfea735f6b452785185ebc257d1da179ec4 | Add tests (#5451) | core/platform/taskqueue/gae_taskqueue_services_test.py | core/platform/taskqueue/gae_taskqueue_services_test.py | # coding: utf-8
#
# Copyright 2018 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | Python | 0 | |
caa29a940673d42d23d70b31eddd2ec61fc3fb73 | Add a simple script which monitors the paused domains on a host, checks them against the xapi database, logs anomalies, and optionally destroys the domain if it has been in an error state for longer than a threshold (currently 60s) | scripts/examples/python/monitor-unwanted-domains.py | scripts/examples/python/monitor-unwanted-domains.py | #!/usr/bin/env python
import subprocess, XenAPI, inventory, time, sys
# Script which monitors the domains running on a host, looks for
# paused domains which don't correspond to VMs which are running here
# or are about to run here, logs them and optionally destroys them.
# Return a list of (domid, uuid) tuples, one... | Python | 0 | |
ab0868b777101a8442cec80009b84b40e79a3a08 | add a sample script | decode.py | decode.py | """Command-line tool to decode audio files to raw PCM."""
import audioread
import sys
import os
def decode(filename):
filename = os.path.abspath(os.path.expanduser(filename))
with audioread.audio_open(filename) as f:
print 'Input file: %i channels at %i Hz; %.1f seconds.' % \
(f.channels,... | Python | 0.000001 | |
b5b22086efe745f5d14207c1103483189e0387ef | Add game_state.py | pyzertz/game_state.py | pyzertz/game_state.py | import table
import os
class Player:
def __init__(self, name):
self.marbles = [0,0,0] #white, gray, black
self.name = name
def __str__(self):
return self.name
pl1 = Player("Odon")
pl2 = Player("Bela")
winner = None
act = pl1
t=table.Table(3)
t.get(0,0).type=1
t.get(-3,0).... | Python | 0.000005 | |
51055b6fbd81ffc88215b88f9a63d702535bdd93 | Add missing file | jobslave/job_data.py | jobslave/job_data.py | #
# Copyright (c) 2011 rPath, Inc.
#
BUILD_DEFAULTS = {
'autoResolve': False,
'maxIsoSize': '681574400',
'bugsUrl': 'http://issues.rpath.com/',
'natNetworking': False,
'vhdDiskType': 'dynamic',
'anacondaCustomTrove': '',
'stringArg': '',
'mediaTemplateTr... | Python | 0.000006 | |
41cc4d54d5eddcf30e2c9a98179ff1e745a12f90 | Add missing migration | core/migrations/0009_wagtail112upgrade.py | core/migrations/0009_wagtail112upgrade.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-21 23:14
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0008_wagtailcompanypage_sites_ordering'),
]
operations = [
migratio... | Python | 0.000001 | |
896132d9068ed736587047e7a4501f49d7a1bffd | Update test helpers | test/selenium/src/lib/test_helpers.py | test/selenium/src/lib/test_helpers.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: jernej@reciprocitylabs.com
# Maintained By: jernej@reciprocitylabs.com
"""
Utility classes for page objects used in tests.
Details:
Most of the te... | # 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: jernej@reciprocitylabs.com
# Maintained By: jernej@reciprocitylabs.com
"""
Utility classes for page objects used in tests.
Details:
Most of the te... | Python | 0.000001 |
9bc05db6bc3b6b2570c8e37d528639c310a6f162 | Add login required decorator | pybossa_analyst/login.py | pybossa_analyst/login.py | # -*- coding: utf8 -*-
from functools import wraps
from flask import session, request, redirect, url_for
def login_required(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if session.get('api_key') is None:
return redirect(url_for('home.login', next=request.url))
return f(*... | Python | 0.000001 | |
24bdb8217a921f3f1833a8e9c1bcd7cc1615ea9b | add mgmt command to migrate testruns between projects | squad/core/management/commands/migrate_test_runs.py | squad/core/management/commands/migrate_test_runs.py | import sys
from django.core.exceptions import ObjectDoesNotExist
from django.core.management.base import BaseCommand
from squad.core.models import Project, Build, Environment
from squad.core.tasks import UpdateProjectStatus
class Command(BaseCommand):
help = """Move test runs identified by environment slug
... | Python | 0.005135 | |
0b09eeede5f8a1533c166fe97844834ceb2ee178 | remove some hard-coded paths | autoload/nimrod_vim.py | autoload/nimrod_vim.py | import threading, Queue, subprocess, signal, os
try:
import vim
except ImportError:
class Vim:
def command(self, x):
print("Executing vim command: " + x)
vim = Vim()
def disable_sigint():
# Ignore the SIGINT signal by setting the handler to the standard
# signal handler SIG_IGN.
signal.signal... | import threading, Queue, subprocess, signal, os
try:
import vim
except ImportError:
class Vim:
def command(self, x):
print("Executing vim command: " + x)
vim = Vim()
def disable_sigint():
# Ignore the SIGINT signal by setting the handler to the standard
# signal handler SIG_IGN.
signal.signal... | Python | 0.999058 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.