commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
3fb15a0e2fd4b1c9d6fb90ea5db92e99fda578c7 | Create topKFrequent.py | jose-raul-barreras/letscode | topKFrequent.py | topKFrequent.py | #
# Given a non-empty array of integers, return the k most frequent elements.
#
# For example,
# Given [1,1,1,2,2,3] and k = 2, return [1,2].
#
# Note:
# You may assume k is always valid, 1 ≤ k ≤ number of unique elements.
# Your algorithm's time complexity must be better than O(n log n), whe... | mit | Python | |
3190b1e90c4f5de71e766fc97acb6c03b5c6888b | Create tweet-ip.py | hackerspace-ntnu/tweet_ip,hackerspace-ntnu/tweet_ip | tweet-ip.py | tweet-ip.py | from twitter import *
import subprocess
from random import randint
import time
import urllib2
def internet_on():
try:
response=urllib2.urlopen('http://twitter.com',timeout=1)
return True
except urllib2.URLError as err: pass
return False
def getserial():
# Extract serial from cpuinfo fil... | mit | Python | |
d7a5743bf92627280c2067be7dc496cd81b8353c | add unit tests file | nricklin/leafpy | unit_tests.py | unit_tests.py | import pytest
r = pytest.main(["-s", "tests/unit"])
if r:
raise Exception("There were test failures or errors.") | mit | Python | |
8dc6afa76f2dcfdba4d80c28e9fdfbc278bd8374 | add XFCC-related config tests for invalid values | datawire/ambassador,datawire/ambassador,datawire/ambassador,datawire/ambassador,datawire/ambassador | python/tests/test_ambassador_module_validation.py | python/tests/test_ambassador_module_validation.py | from typing import List, Tuple
import logging
import pytest
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s test %(levelname)s: %(message)s",
datefmt='%Y-%m-%d %H:%M:%S'
)
logger = logging.getLogger("ambassador")
from ambassador import Cache, IR
from ambassador.compile import Compile
def ... | apache-2.0 | Python | |
5a2042ebd62cefdda82b6e288b4b6d5b0f527fcd | Add script to add uplaoders to a repo | sorenh/python-django-repomgmt,sorenh/python-django-repomgmt | repomgmt/management/commands/repo-add-uploader.py | repomgmt/management/commands/repo-add-uploader.py | #
# Copyright 2012 Cisco Systems, Inc.
#
# Author: Soren Hansen <sorhanse@cisco.com>
#
# 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... | apache-2.0 | Python | |
09c8399092c3c97be068051306fda057170cf290 | Add LPC residual computation. | cournape/talkbox,cournape/talkbox | scikits/talkbox/linpred/common.py | scikits/talkbox/linpred/common.py | from scipy.signal import lfilter
from scikits.talkbox.linpred import lpc
def lpcres(signal, order, axis = -1):
"""Compute the LPC residual of a signal.
The LPC residual is the 'error' signal from LPC analysis, and is defined
as:
res[n] = x[n] - xe[n] = 1 + a[1] x[n-1] + ... + a[p] x[n-p]
Whe... | mit | Python | |
1afe54b237724ce8f06379ef461e5d849ddeec74 | Add Persian Badwords | aetilley/revscoring,eranroz/revscoring,ToAruShiroiNeko/revscoring,he7d3r/revscoring,wiki-ai/revscoring | revscoring/languages/persian.py | revscoring/languages/persian.py | import warnings
import enchant
from .language import Language, LanguageUtility
DICTIONARY = enchant.Dict("fa")
BADWORDS = set([
"کیرم", "ایتالیک", "کونی", "کیر", "فرمود", "آله", "فرموده", "فرمودند",
"جنده", "برووتو", "لعنت", "کون", "السلام", "جمهورمحترم", "کونی",
"کاکاسیاه", "آشغال", "گائیدم", "گوزیده", ... | import warnings
import enchant
from .language import Language, LanguageUtility
DICTIONARY = enchant.Dict("fa")
def is_misspelled_process():
def is_misspelled(word):
return not DICTIONARY.check(word)
return is_misspelled
is_misspelled = LanguageUtility("is_misspelled", is_misspelled_process,
... | mit | Python |
4fe8df5d09c554b45d5097ca0574b47703c9b581 | Add another simpler test for %f | buchuki/pyjaco,mattpap/py2js,chrivers/pyjaco,mattpap/py2js,qsnake/py2js,chrivers/pyjaco,chrivers/pyjaco,buchuki/pyjaco,buchuki/pyjaco,qsnake/py2js | tests/strings/string_format_f_simple.py | tests/strings/string_format_f_simple.py | a = 1.123456
b = 10
c = -30
d = 34
e = 123.456789
f = 892122.129899
# form 0
s = "b=%f" % a
print s
# form 1
s = "b,c,d=%f+%f+%f" % (a, e, f)
print s
| mit | Python | |
215822f6edb48f156a15548ff40d21d76e14d692 | Add markdown as submodule | plotly/dash-core-components | dash_core_components/markdown/__init__.py | dash_core_components/markdown/__init__.py | from .Markdown import Markdown
from .. import _js_dist
from .. import _css_dist
_js_dist.append(
{
'relative_package_path': 'highlight.pack.js',
'namespace': 'dash_core_components'
}
)
_css_dist.append(
{
'relative_package_path': 'highlight.css',
'namespace': 'dash_core_co... | mit | Python | |
e6ff67fc67e3c3f1a1513534088743a243e1257a | Add tests to the role logic | rhyolight/nupic.son,rhyolight/nupic.son,rhyolight/nupic.son | tests/app/soc/logic/models/test_role.py | tests/app/soc/logic/models/test_role.py | #!/usr/bin/env python2.5
#
# Copyright 2010 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | apache-2.0 | Python | |
3657eed1c0f0cf29be85bce03983e5b2c2581b9b | test showing bug in cyl mesh face inner product | simpeg/discretize,simpeg/simpeg,simpeg/discretize,simpeg/discretize | tests/mesh/test_cylMeshInnerProducts.py | tests/mesh/test_cylMeshInnerProducts.py | from SimPEG import Mesh
import numpy as np
import sympy
from sympy.abc import r, t, z
import unittest
TOL = 1e-1
class CylInnerProducts_Test(unittest.TestCase):
def test_FaceInnerProduct(self):
# Here we will make up some j vectors that vary in space
# j = [j_r, j_z] - to test face inner products... | mit | Python | |
8ad86651a9d07984c0b1afb0ec7e400288ac6d2e | add pyRpc2 | ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study | python/proto/pyRpc2/__init__.py | python/proto/pyRpc2/__init__.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2016 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyrig... | bsd-2-clause | Python | |
47c2a98d28c8e592035761b4ecfcd1026038fd14 | Add an option to not automatically record interaction for gesture actions. | chuan9/chromium-crosswalk,Just-D/chromium-1,bright-sparks/chromium-spacewalk,jaruba/chromium.src,fujunwei/chromium-crosswalk,hgl888/chromium-crosswalk-efl,axinging/chromium-crosswalk,hgl888/chromium-crosswalk,Chilledheart/chromium,Pluto-tv/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,Pluto-tv/chromium-cr... | tools/telemetry/telemetry/page/actions/gesture_action.py | tools/telemetry/telemetry/page/actions/gesture_action.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page.actions import page_action
from telemetry.page.actions import wait
from telemetry import decorators
from telemetry.page.actions import ac... | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page.actions import page_action
from telemetry.page.actions import wait
from telemetry import decorators
from telemetry.page.actions import ac... | bsd-3-clause | Python |
20a191ad9325909434a6ca806ef69c515cbce6a8 | add new package (#24749) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-neurokit2/package.py | var/spack/repos/builtin/packages/py-neurokit2/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyNeurokit2(PythonPackage):
"""The Python Toolbox for Neurophysiological Signal Processing... | lgpl-2.1 | Python | |
2322b349aac06395382d26a95b5d965ab0f0b326 | Test save, load functionality in Statespace | josef-pkt/statsmodels,josef-pkt/statsmodels,statsmodels/statsmodels,bashtage/statsmodels,jseabold/statsmodels,statsmodels/statsmodels,statsmodels/statsmodels,ChadFulton/statsmodels,bert9bert/statsmodels,bashtage/statsmodels,jseabold/statsmodels,jseabold/statsmodels,bashtage/statsmodels,yl565/statsmodels,jseabold/statsm... | statsmodels/tsa/statespace/tests/test_save.py | statsmodels/tsa/statespace/tests/test_save.py | """
Tests of save / load / remove_data state space functionality.
"""
from __future__ import division, absolute_import, print_function
import numpy as np
import pandas as pd
import os
from statsmodels import datasets
from statsmodels.tsa.statespace import (sarimax, structural, varmax,
... | bsd-3-clause | Python | |
58624ba3b267fdc0e1ae6d8509c0a1315f22c22f | Initialize P4_autoDownloadTorrent | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter16/PracticeProjects/P4_autoDownloadTorrent.py | books/AutomateTheBoringStuffWithPython/Chapter16/PracticeProjects/P4_autoDownloadTorrent.py | # Write a program that checks an email account every 15 minutes for any instructions
# you email it and executes those instructions automatically.
#
# For example, BitTorrent is a peer-to-peer downloading system. Using free BitTorrent
# software such as qBittorrent, you can download large media files on your home compu... | mit | Python | |
f41585c0bccf63ad1d5d451c0eeb4bb091264416 | test factories stub | sndrtj/pyrefflat | test/test_factories.py | test/test_factories.py | from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
__author__ = 'ahbbollen'
import pytest
from pyrefflat import Reader
from pyrefflat.factories import *
@pytest.fixture(scope="module")
def factory():
factory = RecordFactory()
r... | mit | Python | |
a2f20be78ad54a6fe118b197cc416dcfdfb6dddf | add tf test file | iViolinSolo/DeepLearning-GetStarted,iViolinSolo/DeepLearning-GetStarted | TF-Demo/AlexNetDemo/test_tf.py | TF-Demo/AlexNetDemo/test_tf.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: violinsolo
# Created on 28/12/2017
import tensorflow as tf
import numpy as np
x = []
for i in range(0, 20):
x += [i]
print x
# trans to float32
x1 = np.asarray(x, dtype=np.float32)
print 'new x:'
print x1
with tf.Session() as sess:
m = np.reshape(x, [-1, ... | apache-2.0 | Python | |
8026b091b1bae1a3b241b6b23b515ce8b5ec084e | Add openshift inventory plugin | thaim/ansible,thaim/ansible | plugins/inventory/openshift.py | plugins/inventory/openshift.py | #!/bin/python
# (c) 2013, Michael Scherer <misc@zarb.org>
#
# This file is part of Ansible,
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) a... | mit | Python | |
5856ceb23cf639ee1cc3ea45d81a1917c0ef031d | Make a pnacl-finalize tool, that runs the final steps for pnacl ABI stability. | Lind-Project/native_client,Lind-Project/native_client,Lind-Project/native_client,Lind-Project/native_client,Lind-Project/native_client,Lind-Project/native_client | pnacl/driver/pnacl-finalize.py | pnacl/driver/pnacl-finalize.py | #!/usr/bin/python
# Copyright (c) 2013 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# IMPORTANT NOTE: If you make local mods to this file, you must run:
# % pnacl/build.sh driver
# in order for them to take eff... | bsd-3-clause | Python | |
73027d04a416f24dbaaf685da6eb1893c6c433ab | Add hanabank adapter | ssut/PushBank,ssut/PushBank | adapters/hana.py | adapters/hana.py | #-*- coding: utf-8 -*-
from datetime import datetime, timedelta
import json
from bs4 import BeautifulSoup
import urllib, urllib2
en_name = 'hana'
name = u'하나은행'
def query(account, password, resident):
"""
하나은행 계좌 잔액 빠른조회. 빠른조회 서비스에 등록이 되어있어야 사용 가능.
빠른조회 서비스: https://open.hanabank.com/flex/quick/quickServi... | mit | Python | |
7f65c70b786024e8213c56448f8d715bda8c0197 | add jsonrpc | hansroh/skitai,hansroh/skitai,hansroh/skitai | skitai/saddle/jsonrpc_executor.py | skitai/saddle/jsonrpc_executor.py | from . import wsgi_executor
try:
import jsonrpclib
except ImportError:
pass
from aquests.protocols.http import respcodes
class Executor (wsgi_executor.Executor):
def __call__ (self):
request = self.env ["skitai.was"].request
data = self.env ["wsgi.input"].read ()
... | mit | Python | |
26ff3cbfcd9aee35da3645573c01717518467e8d | Create main.py | rmotr-curriculum-testing/learn-testing-repo | unit-3-mixed-reading-and-assignment-lessons/lesson-4-assignment-multiple-code-blocks/main.py | unit-3-mixed-reading-and-assignment-lessons/lesson-4-assignment-multiple-code-blocks/main.py | class Operation(object):
def __init__(self, *args):
# Do something here
pass
def operate(self):
raise NotImplementedError()
class AddOperation(Operation):
# The only method present in this class
def operate(self):
pass
class SubtractOperation(Operation):
def oper... | mit | Python | |
b589ab584cc1fdade736d0c166aae73978018dc5 | add channel out example | jagill/treeano,diogo149/treeano,nsauder/treeano,nsauder/treeano,jagill/treeano,diogo149/treeano,jagill/treeano,nsauder/treeano,diogo149/treeano | examples/channel_out/mnist_cnn.py | examples/channel_out/mnist_cnn.py | from __future__ import division, absolute_import
from __future__ import print_function, unicode_literals
import itertools
import numpy as np
import sklearn.datasets
import sklearn.cross_validation
import sklearn.metrics
import theano
import theano.tensor as T
import treeano
import treeano.nodes as tn
import treeano.la... | apache-2.0 | Python | |
c95772e8b3119f464dba4b8fd864812a525a4379 | add tests | glasslion/salt-mill | tests/test_core.py | tests/test_core.py | # -*- coding: utf-8 -*-
from saltmill import Mill
from pepper import PepperException
import pytest
def test_login():
mill = Mill()
mill.login()
def test_auto_login():
mill = Mill()
MSG = 'This is a test.'
ret = mill.local('*', 'test.echo',MSG)
assert len(ret['return'][0]) > 0
for salt_id,... | bsd-3-clause | Python | |
83cfb4d135b5eb3eaa4efb3f74ce13d44afb4c5a | Add a test for __main__ | marcelm/cutadapt | tests/test_main.py | tests/test_main.py | import pytest
from cutadapt.__main__ import main
def test_help():
with pytest.raises(SystemExit) as e:
main(["--help"])
assert e.value.args[0] == 0
| mit | Python | |
0275556bcb29f4468c4a7e5b0771686c031e3c94 | Add context test. | MostAwesomeDude/pyfluidsynth | demos/context.py | demos/context.py | #!/usr/bin/env python
import fluidsynth
settings = fluidsynth.FluidSettings()
settings["synth.chorus.active"] = "off"
settings["synth.reverb.active"] = "off"
settings["synth.sample-rate"] = 22050
synth = fluidsynth.FluidSynth(settings)
driver = fluidsynth.FluidAudioDriver(settings, synth)
player = fluidsynth.Flui... | mit | Python | |
eb15e17e99212f2d779ef33a1a9dfa7293ad96ad | Add `ProtectedFieldsMixin` for use with `ChangeProtected`s | shawnadelic/shuup,suutari-ai/shoop,akx/shoop,shawnadelic/shuup,jorge-marques/shoop,akx/shoop,shoopio/shoop,shoopio/shoop,jorge-marques/shoop,taedori81/shoop,hrayr-artunyan/shuup,suutari/shoop,suutari-ai/shoop,suutari/shoop,suutari-ai/shoop,shoopio/shoop,taedori81/shoop,taedori81/shoop,jorge-marques/shoop,akx/shoop,hray... | shoop/core/utils/form_mixins.py | shoop/core/utils/form_mixins.py | # -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django.utils.translation import ugettext_lazy as _
class ProtectedFi... | agpl-3.0 | Python | |
9a82eb7fe4f587b00cca155b84a36c6d590e0e16 | Add tests to patterns | rougeth/bottery | tests/test_patterns.py | tests/test_patterns.py | from bottery import patterns
def test_message_handler_check_positive_match():
message = type('Message', (), {'text': 'ping'})
handler = patterns.MessageHandler(pattern='ping')
assert handler.check(message)
def test_message_handler_check_negative_match():
message = type('Message', (), {'text': 'Ping'... | mit | Python | |
2087394a69b3d4ca47e441b2561a0645c9a99e68 | Add test_recharge | gwtsa/gwtsa,pastas/pastas,pastas/pasta | tests/test_recharge.py | tests/test_recharge.py | import pastas as ps
import pandas as pd
def test_linear():
index = pd.date_range("2000-01-01", "2000-01-10")
prec = pd.Series([1, 2] * 5, index=index)
evap = prec / 2
rm = ps.RechargeModel(prec=prec, evap=evap, rfunc=ps.Exponential,
recharge="Linear", name="recharge")
retu... | mit | Python | |
170373e6f0a1a416a50e16a3fbfb6a2da2b2e700 | Add Site traversal object | usingnamespace/usingnamespace | usingnamespace/api/traversal/v1/site.py | usingnamespace/api/traversal/v1/site.py | import logging
log = logging.getLogger(__name__)
from pyramid.compat import string_types
from .... import models as m
class Site(object):
"""Site
Traversal object for a site ID
"""
__name__ = None
__parent__ = None
def __init__(self, site_id):
"""Create the default root object
... | isc | Python | |
97fe3384b0e614e17010623af5bccf515ce21845 | Migrate jupyter_{notebook => server}_config.py | verdimrc/linuxcfg,verdimrc/linuxcfg,verdimrc/linuxcfg | .jupyter/jupyter_server_config.py | .jupyter/jupyter_server_config.py | # https://jupyter-server.readthedocs.io/en/stable/operators/migrate-from-nbserver.html
#c.ServerApp.browser = 'chromium-browser'
#c.ServerApp.terminado_settings = { "shell_command": ["/usr/bin/env", "bash"] }
c.ServerApp.open_browser = False
c.ServerApp.port_retries = 0
c.KernelSpecManager.ensure_native_kernel = False... | apache-2.0 | Python | |
d4541113581433b63f19f23a9bde249acf8324a8 | Add a vizualization tool | keithw/SSIM,vasilvv/SSIM,keithw/SSIM,vasilvv/SSIM | tools/visualize.py | tools/visualize.py | #!/usr/bin/python
import matplotlib.pyplot as plt
import sys
if len(sys.argv) < 2:
print "Usage: vizualize.py file1[:label1] file2[:label2] ..."
colors = ['g', 'b', 'r', '#F800F0', '#00E8CC', '#E8E800']
markers = { 'I' : '*', 'P' : 's', 'B' : 'o' }
if len(sys.argv) - 1 > len(colors):
print "Too many files s... | mit | Python | |
5fc7fa839616213d07ad85e164f6639ff1225065 | Add override for createsuperuser | fotinakis/sentry,daevaorn/sentry,BuildingLink/sentry,mvaled/sentry,JamesMura/sentry,BuildingLink/sentry,ifduyue/sentry,jean/sentry,BuildingLink/sentry,JackDanger/sentry,JamesMura/sentry,beeftornado/sentry,alexm92/sentry,JackDanger/sentry,gencer/sentry,zenefits/sentry,JamesMura/sentry,mvaled/sentry,alexm92/sentry,ifduyu... | src/sentry/management/commands/createsuperuser.py | src/sentry/management/commands/createsuperuser.py | from __future__ import absolute_import, print_function
from django.core.management import call_command
from django.contrib.auth.management.commands.createsuperuser import Command
class Command(Command):
help = 'Performs any pending database migrations and upgrades'
def handle(self, **options):
call_... | bsd-3-clause | Python | |
7f860b23975150642bd6f8d244bce96d401603b0 | Improve the help text for the rdp options | gooddata/openstack-nova,hanlind/nova,jianghuaw/nova,cloudbase/nova,rajalokan/nova,vmturbo/nova,klmitch/nova,klmitch/nova,openstack/nova,cloudbase/nova,sebrandon1/nova,Juniper/nova,mikalstill/nova,sebrandon1/nova,mikalstill/nova,openstack/nova,jianghuaw/nova,alaski/nova,gooddata/openstack-nova,mahak/nova,Juniper/nova,Ju... | nova/conf/rdp.py | nova/conf/rdp.py | # Copyright 2015 OpenStack Foundation
# 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 requ... | # Copyright 2015 OpenStack Foundation
# 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 requ... | apache-2.0 | Python |
e7d86c77471d3b0890287e0ca32ecfb94b80abda | add util method for Leave One Out crossvalidation | kaichogami/scikit-learn,simon-pepin/scikit-learn,iismd17/scikit-learn,RomainBrault/scikit-learn,liangz0707/scikit-learn,siutanwong/scikit-learn,rsivapr/scikit-learn,mikebenfield/scikit-learn,massmutual/scikit-learn,arjoly/scikit-learn,lenovor/scikit-learn,lesteve/scikit-learn,mattgiguere/scikit-learn,mattgiguere/scikit... | scikits/learn/utils/crossval.py | scikits/learn/utils/crossval.py | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD Style.
# $Id: cd.py 473 2010-03-03 16:27:38Z twigster $
import numpy as np
import exceptions
class LOO:
"""
Leave-One-Out cross validation:
Provides train/test indexes to split data in train test sets
Examples:
import scik... | bsd-3-clause | Python | |
e42fcd8a7dfd213c3de8ccc925410ab3dfe68a3c | Test Lemniscate of Bernoulli trajectory | bit0001/trajectory_tracking,bit0001/trajectory_tracking | src/test/trajectory/test_lemniscate_trajectory.py | src/test/trajectory/test_lemniscate_trajectory.py | #!/usr/bin/env python
import unittest
from geometry_msgs.msg import Point
from trajectory.lemniscate_trajectory import LemniscateTrajectory
class LemniscateTrajectoryTest(unittest.TestCase):
def setUp(self):
self.trajectory = LemniscateTrajectory(5, 4)
self.expected_position = Point()
def ... | mit | Python | |
4322e8f487af673191cb042bd8f34d6c1526bb42 | Add a command for _accessibilityTraitsInspectorHumanReadable. | mrhappyasthma/happydebugging | scripts/accessibility_traits.py | scripts/accessibility_traits.py | import lldb
import shlex
from helpers.environment_checks import EnvironmentChecks
from subprocess import call
def accessibility_traits(debugger, command, result, internal_dict):
"""Prints human readable strings of the a11y traits for a given object..
Note: This command can only be run while VoiceOver is runnin... | mit | Python | |
7b4107cfb465faf70110b72da9b655758d62d9b3 | add extraction tool as per request from Renee | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | scripts/mec/extract_rshowers.py | scripts/mec/extract_rshowers.py | import pytz
import datetime
import psycopg2
pgconn = psycopg2.connect(host='127.0.0.1', port=5555, user='mesonet', database='mec')
cursor = pgconn.cursor()
dates = """06-02-2008 00z - 06-07-2008 06z
06-09-2008 00z - 06-14-2008 06z
06-23-2008 00z - 06-25-2008 06z
07-04-2008 00z - 07-06-2008 06z
08-15-2008 00z - 08-23-2... | mit | Python | |
74bfc85ef4533e93a4edf4c16e5a7a6bb175f36b | Simplify the view as the validation logic has already moved to the model | ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,fajran/django-loginurl,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,ISIFoundation/influenzanet-website,vanschelven/cmsplugin-journal,ISIFoundation/influenzanet-website,uploadcare/django-loginurl,ISIFoundation/influenzanet-web... | onetime/views.py | onetime/views.py | from datetime import datetime
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseGone
from django.contrib import auth
from django.conf import settings
from onetime import utils
from onetime.models import Key
def cleanup(request):
utils.cleanup()
return HttpResponse('ok', content_type='te... | from datetime import datetime
from django.http import HttpResponseRedirect, HttpResponseGone
from django.contrib.auth import login
from django.conf import settings
from onetime import utils
from onetime.models import Key
def cleanup(request):
utils.cleanup()
def login(request, key, redirect_invalid_to=None, red... | agpl-3.0 | Python |
159b971ae95501f9093dedb881ed030eed74241e | Create __init__.py | claus022015/Nutrition-Database-Modernization,claus022015/Nutrition-Database-Modernization,claus022015/Nutrition-Database-Modernization,claus022015/Nutrition-Database-Modernization,claus022015/Nutrition-Database-Modernization,claus022015/Nutrition-Database-Modernization | docs/__init__.py | docs/__init__.py | # -*- coding: utf-8 -*-
"""
sphinxcontrib
~~~~~~~~~~~~~
This package is a namespace package that contains all extensions
distributed in the ``sphinx-contrib`` distribution.
:copyright: Copyright 2007-2009 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
__import__(... | mit | Python | |
b9be58f46fe40f471696dd153253781b7a873eda | Create secret_lottery_winning_no3.py | james-jz-zheng/OtherStuff | secret_lottery_winning_no3.py | secret_lottery_winning_no3.py | ### QUESTION:
'''
Mr. X is approached in the subway by a guy who claims to be an alien stranded on Earth and to possess time machine
that allows him to know the future. He needs funds to fix his flying saucer but filling in wiMAX_NOing numbers for next week's lottery
would create a time paradox. Therefore, he's wil... | apache-2.0 | Python | |
88d4139fdfdcb11be7cbe42fe1223cfde5752950 | debug path | ethermarket/pyethereum,ethereum/pyethereum,vaporry/pyethereum,pipermerriam/pyethereum,harlantwood/pyethereum,inzem77/pyethereum,shahankhatch/pyethereum,shahankhatch/pyethereum,pipermerriam/pyethereum,karlfloersch/pyethereum,holiman/pyethereum,ddworken/pyethereum,karlfloersch/pyethereum,ethereum/pyethereum,ckeenan/pyeth... | pyethereum/config.py | pyethereum/config.py |
import os
import uuid
import StringIO
import ConfigParser
from pyethereum.utils import default_data_dir
from pyethereum.packeter import Packeter
from pyethereum.utils import sha3
def default_config_path():
return os.path.join(default_data_dir, 'config.txt')
def default_client_version():
return Packeter.CLI... |
import os
import uuid
import StringIO
import ConfigParser
from pyethereum.utils import default_data_dir
from pyethereum.packeter import Packeter
from pyethereum.utils import sha3
def default_config_path():
return os.path.join(default_data_dir, 'config.txt')
def default_client_version():
return Packeter.CLI... | mit | Python |
7f0658ee700174bae100a12b8c8c22377e829d6f | Create BlepiInit.py | HammerDuJour/blepisensor,HammerDuJour/blepisensor | BlepiInit.py | BlepiInit.py | import sqlite3
connection = sqlite3.connect('/home/pi/blepimesh/data/client.db')
cursor = connection.cursor()
print "Adding Data To DB"
cursor.execute("INSERT INTO log(tagDate) values(date('now'))")
cursor.execute("INSERT INTO log values('5',date('now'),time('now'),'34','43','TagAddr','')")
connection.commit()
... | mit | Python | |
b5fda5ff78f97c7bdd23f3ca4ed2b2d2ab33d101 | Create _init_.py | FinancialSentimentAnalysis-team/Finanical-annual-reports-analysis-code,FinancialSentimentAnalysis-team/Finanical-annual-reports-analysis-code,FinancialSentimentAnalysis-team/Finanical-annual-reports-analysis-code | luowang/tools/tree-tagger-windows-3.2/TreeTagger/bin/_init_.py | luowang/tools/tree-tagger-windows-3.2/TreeTagger/bin/_init_.py | apache-2.0 | Python | ||
f3fbb6ca517314ab7ac1330e766da1de89970e13 | Add debug plugin | Cyanogenoid/smartbot,tomleese/smartbot,Muzer/smartbot,thomasleese/smartbot-old | plugins/debug.py | plugins/debug.py | import time
class Plugin:
def __call__(self, bot):
bot.on_respond(r"ping$", lambda bot, msg, reply: reply("PONG"))
bot.on_respond(r"echo (.*)$", lambda bot, msg, reply: reply(msg["match"].group(1)))
bot.on_respond(r"time$", lambda bot, msg, reply: reply(time.time()))
bot.on_help("de... | mit | Python | |
1a7acfd59f48522f0dda984b2f33d20d843ee8ba | set up role.py | ucfopen/canvasapi,ucfopen/canvasapi,ucfopen/canvasapi | pycanvas/role.py | pycanvas/role.py | from canvas_object import CanvasObject
from util import combine_kwargs
class Role(CanvasObject):
def __str__(self):
return ""
| mit | Python | |
0d85832a82c0973c89f3f321e1f2e2486a197882 | Add script to perform partial upload | fedora-infra/fedimg,fedora-infra/fedimg | bin/partial_upload.py | bin/partial_upload.py | #!/bin/env python
# -*- coding: utf8 -*-
""" Triggers a partial upload process with the specified raw.xz URL. """
import argparse
from fedimg.config import AWS_ACCESS_ID
from fedimg.config import AWS_SECRET_KEY
from fedimg.config import AWS_BASE_REGION, AWS_REGIONS
from fedimg.services.ec2.ec2copy import main as ec2c... | agpl-3.0 | Python | |
1a49426497819c13ccf858d51e5fa333d95f1f7d | Add basic unit test for parseCommand | atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot | src/autobot/src/udpRemote_test.py | src/autobot/src/udpRemote_test.py | #!/usr/bin/env python
import unittest
from udpRemote import parseCommand
class MockDriveParam:
velocity = 0.0
angle = 0.0
class UdpRemoteTest(unittest.TestCase):
def testValidParse(self):
p = MockDriveParam()
p = parseCommand("V44.4", p)
self.assertEqual(p.velocity, 44.4)
... | mit | Python | |
5b899181f14c65778f23312ddd31078fac46cd9c | Fix template filter. | jaddison/django-assets,logston/django-assets,ridfrustum/django-assets,logston/django-assets,Eksmo/django-assets,adamchainz/django-assets,mcfletch/django-assets | django_assets/filter.py | django_assets/filter.py | """Django specific filters.
For those to be registered automatically, make sure the main
django_assets namespace imports this file.
"""
from django.template import Template, Context
from webassets import six
from webassets.filter import Filter, register_filter
class TemplateFilter(Filter):
"""
Will compile ... | """Django specific filters.
For those to be registered automatically, make sure the main
django_assets namespace imports this file.
"""
from django.template import Template, Context
from webassets import six
from webassets.filter import Filter, register_filter
class TemplateFilter(Filter):
"""
Will compile ... | bsd-2-clause | Python |
d843a2198b87a41d73ab19e09ac8d0c78a6e0ef9 | Create IC74139.py | rajathkumarmp/BinPy,BinPy/BinPy,daj0ker/BinPy,BinPy/BinPy,daj0ker/BinPy,rajathkumarmp/BinPy,yashu-seth/BinPy,yashu-seth/BinPy | BinPy/examples/ic/Series_7400/IC74139.py | BinPy/examples/ic/Series_7400/IC74139.py | from __future__ import print_function
from BinPy import *
print ('Usage of IC 74139:\n')
ic = IC_74139()
print ("""This is a dial 1:4 demultiplexer(2:4 decoder) with output being inverted input"""")
print ('\nThe Pin configuration is:\n')
p = {1:0,2:0,3:0,14:0,13:1,15:0}
print (p)
print ('\nPin initialization -using -... | bsd-3-clause | Python | |
dcd19e7982024f4f196f24b71fc2d73bef6723eb | add new package (#25505) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/cupla/package.py | var/spack/repos/builtin/packages/cupla/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Cupla(Package):
"""C++ User interface for the Platform independent Library Alpaka"""
... | lgpl-2.1 | Python | |
7e5b4e178a5d36ca89034287168560a73bd9e63d | Create drivers.py | ariegg/webiopi-drivers,ariegg/webiopi-drivers | chips/sensor/lis3dh/drivers.py | chips/sensor/lis3dh/drivers.py | # This code has to be added to the corresponding __init__.py
DRIVERS["lis3dh"] = ["LIS3DH"]
| apache-2.0 | Python | |
f342dbf8d9455db91286823ec5d6ef64e2ace68c | Create MCP3202.py | userdw/RaspberryPi_3_Starter_Kit | Other_Applications/Ultrasonic/MCP3202.py | Other_Applications/Ultrasonic/MCP3202.py | #!/usr/bin/python
import RPi.GPIO as GPIO
import time
import datetime
import os
from time import strftime
CS = 4
CS2 = 7
CLK = 11
MOSI = 10
MISO = 9
LDAC = 8
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(CS, GPIO.OUT)
GPIO.setup(CLK, GPIO.OUT)
GPIO.setup(MOSI, GPIO.OUT)
GPIO.setup(CS2, GPIO.OUT)
GPIO.setu... | mit | Python | |
bfc8d1052ba6f1011fcdb882a825694acf98dd39 | Add regression test for bug 1797580 | mikalstill/nova,gooddata/openstack-nova,klmitch/nova,klmitch/nova,openstack/nova,gooddata/openstack-nova,rahulunair/nova,klmitch/nova,mahak/nova,mikalstill/nova,rahulunair/nova,mahak/nova,openstack/nova,gooddata/openstack-nova,rahulunair/nova,mahak/nova,mikalstill/nova,gooddata/openstack-nova,klmitch/nova,openstack/nov... | nova/tests/functional/regressions/test_bug_1797580.py | nova/tests/functional/regressions/test_bug_1797580.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
# distributed under t... | apache-2.0 | Python | |
64b842d0af6c4e07971a733d8ed6e70109e26979 | Add sample logging | yxiong/xy_python_utils | samples/sample_logging.py | samples/sample_logging.py | #!/usr/bin/env python
#
# Author: Ying Xiong.
# Created: Dec 04, 2015.
import logging
import sys
class DebugOrInfoFilter(logging.Filter):
"""Keep the record only if the level is debug or info."""
def filter(self, record):
return record.levelno in (logging.DEBUG, logging.INFO)
def config_logger(logger... | mit | Python | |
cc02339717f392b0750be3b9a74a6406d8c2122f | Expand Event's attributes and add a __doc__ field to each class in events/models.py | matus-stehlik/glowing-batman,rtrembecky/roots,tbabej/roots,matus-stehlik/roots,tbabej/roots,tbabej/roots,rtrembecky/roots,matus-stehlik/roots,matus-stehlik/roots,matus-stehlik/glowing-batman,rtrembecky/roots | events/models.py | events/models.py | from django.db import models
from django.contrib import admin
# Event-related models
class Event(models.Model):
"""
Event represents a simple event, that is opened to public. This can be
either a public presentation, or a public game.
Users are not invited, but can notify the organizer that they want... | from django.db import models
from django.contrib import admin
# Event-related models
class Event(models.Model):
name = models.CharField(max_length=100)
galerry = models.ForeignKey('posts.Gallery')
registered_user = models.ManyToManyField('users.User',
through='... | mit | Python |
4f0b6a6eefd6848a702fe4b808f137ef0b2ee2f8 | rename as "config.py" after adding keys | mwweinberg/NYC-MTA-Next-Train,mwweinberg/NYC-MTA-Next-Train | exampleconfig.py | exampleconfig.py | URL_F = 'http://datamine.mta.info/mta_esi.php?key='KEY'&feed_id=21'
URL_AC = 'http://datamine.mta.info/mta_esi.php?key='KEY'&feed_id=26'
| mit | Python | |
85daad5401267b613e546896bb2abd1658f730b1 | Create 1_triple_step.py | zmarvel/cracking,zmarvel/cracking | ch09/1_triple_step.py | ch09/1_triple_step.py | # 0 - (1) [0]
# 1 - (1) [1]
# 2 - (2) [1, 1], [2]
# 3 - (4) [1, 1, 1], [1, 2], [2, 1], [3]
# 4 -
#subtract 1
#subtract 2
#subtract 3
ways = {0: 0, 1:1, 2: 2, 3: 4}
def calculate_ways(steps):
if steps < 4:
return ways[steps]
for i in range(4, steps + 1):
ways[i] = ways[i-1] + ways[i-2] + way... | mit | Python | |
3e51c57a8611a8ebfb4f2eb045510c50587bd781 | Test password tokens not in response | renalreg/radar,renalreg/radar,renalreg/radar,renalreg/radar | api/radar_api/tests/test_users.py | api/radar_api/tests/test_users.py | import json
from radar_api.tests.fixtures import get_user
def test_serialization(app):
admin = get_user('admin')
client = app.test_client()
client.login(admin)
response = client.get('/users')
assert response.status_code == 200
data = json.loads(response.data)
for user in data['data']... | agpl-3.0 | Python | |
3660767a92750eae3c3ede69ef6778a23d3074a7 | Add the Action enum | chrisseto/Still | wdim/client/actions.py | wdim/client/actions.py | import enum
class Action(enum.Enum):
create = 0
delete = 1
update = 2
| mit | Python | |
71bab0603cbf52d6b443cfff85ef19a04f882a36 | Add the SQL statements because I forgot | codeforsanjose/inventory-control,worldcomputerxchange/inventory-control | inventory_control/database/sql.py | inventory_control/database/sql.py | """
So this is where all the SQL commands live
"""
CREATE_SQL = """
CREATE TABLE component_type (
id INT PRIMARY KEY AUTO_INCREMENT,
type VARCHAR(255) UNIQUE
);
CREATE TABLE components (
id INT PRIMARY KEY AUTO_INCREMENT,
sku TEXT,
type INT,
status INT,
FOREIGN KEY (type) REFERENCES compo... | mit | Python | |
52076834e04fd735d4bba88472163c31347bc201 | Create scarp_diffusion_no_component.py | landlab/drivers | scripts/diffusion/scarp_diffusion_no_component.py | scripts/diffusion/scarp_diffusion_no_component.py | #Import statements so that you will have access to the necessary methods
import numpy
from landlab import RasterModelGrid
from landlab.plot.imshow import imshow_node_grid, imshow_core_node_grid
from pylab import show, figure
#Create a raster grid with 25 rows, 40 columns, and cell spacing of 10 m
mg = RasterModelGrid(... | mit | Python | |
9d8278e98e505ffb68c2dcf870e61c0239721e5b | Add the gpio proxy for the Intel Edison | fjacob21/pycon2015 | elpiwear/Edison/gpio.py | elpiwear/Edison/gpio.py | # The MIT License (MIT)
#
# Copyright (c) 2015 Frederic Jacob
#
# 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, mo... | mit | Python | |
a49d28c552600ee2a0fe24ee83ed5cc7bbe36417 | Add wrist tracker class | Isaac-W/cpr-vision-measurement,Isaac-W/cpr-vision-measurement,Isaac-W/cpr-vision-measurement | wristtracker.py | wristtracker.py | import math
from markerutils import *
class TrackedMarker(object):
def __init__(self, marker, size, distance, position):
self.marker = marker
self.size = size
self.distance = distance
self.position = position
class WristTracker(object):
def __init__(self, marker_finder, marke... | mit | Python | |
49716ea37b36785faeb4a8b1cb43e6225e6b1d82 | add revised jobfile script for excalibur | stu314159/pyNFC,stu314159/pyNFC,stu314159/pyNFC,stu314159/pyNFC | genJobfile_ex.py | genJobfile_ex.py | #genJobfile.py
"""
more-or-less automated generation of PBS jobfile
"""
import argparse
parser = argparse.ArgumentParser(prog="genJobfile.py",
description="PBS Jobfile generation script.")
parser.add_argument('jobfileName',type=str)
parser.add_argument('jobName',type=str)
parser.add_a... | mit | Python | |
cbc1609758762c7db4d3477248e87ecf29fdd288 | add dep | kiaderouiche/hilbmetrics | hilbert/common/__accessdata__.py | hilbert/common/__accessdata__.py | from sys import platform
from platform import architecture
def install_data_files():
""" """
if sys.platform.startswith('netbsd'):
""" """
pass
elif sys.platform.startswith('freebsd'):
""" """
pass
elif sys.platform.startswith('linux'):
if PY3:
data_... | apache-2.0 | Python | |
dfe3f7fd7775ce13a670e1d27beddba5c1254a4a | Define the HPACK reference structure. | irvind/hyper,fredthomsen/hyper,lawnmowerlatte/hyper,masaori335/hyper,fredthomsen/hyper,masaori335/hyper,plucury/hyper,Lukasa/hyper,irvind/hyper,jdecuyper/hyper,Lukasa/hyper,jdecuyper/hyper,lawnmowerlatte/hyper,plucury/hyper | hyper/http20/hpack_structures.py | hyper/http20/hpack_structures.py | # -*- coding: utf-8 -*-
"""
hyper/http20/hpack_structures
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Contains data structures used in hyper's HPACK implementation.
"""
class Reference(object):
"""
The reference object is essentially an object that 'points to' another
object, not unlike a pointer in C or similar languag... | mit | Python | |
5326519e69b1280ae53c02fa6e62ed6a9aa2db03 | Create Ethiopia.py | dr-prodigy/python-holidays | holidays/countries/Ethiopia.py | holidays/countries/Ethiopia.py | # -*- coding: utf-8 -*-
# python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Author: ryanss <ryanssdev@icl... | mit | Python | |
4df070d5b39898ca67127ef17aa8d80f47e2c992 | Add files via upload | zaqari/WordEmbeddingsIntoDNN | Embeddings_2_DNNClass_General.py | Embeddings_2_DNNClass_General.py | #All the imports.
import gensim
import codecs
from gensim import corpora, models, similarities
import nltk
import csv
import pandas as pd
import tempfile
import codecs
import csv
model = models.Word2Vec.load(input('Where are your word embeddings coming from, shitbags? '))
word = model.wv.vocab
#Just some notes when ... | mit | Python | |
37b1250e213b78262075664e4291707ff369e981 | Create clase-3.py | AnhellO/DAS_Sistemas,AnhellO/DAS_Sistemas,AnhellO/DAS_Sistemas | Ene-Jun-2019/Ejemplos/clase-3.py | Ene-Jun-2019/Ejemplos/clase-3.py | diccionario = {
'a': ['accion', 'arte', 'arquitectura', 'agrego', 'actual'],
'b': ['bueno', 'bien', 'bonito'],
'c': ['casa', 'clase', 'coctel']
}
diccionario['d'] = ['dado', 'diccionario', 'duda']
# print(diccionario)
# print(diccionario['a'])
for llave, valor in diccionario.items():
pass #print("sho... | mit | Python | |
48f2be780f6aa569bb1d8b8c0623e54cac49f613 | add instance action model | CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend,CCI-MOC/GUI-Backend | core/models/instance_action.py | core/models/instance_action.py | from django.db import models
class InstanceAction(models.Model):
name = models.CharField(max_length=50)
description = models.TextField()
class Meta:
db_table = 'instance_action'
app_label = 'core' | apache-2.0 | Python | |
78aaccb71fc64e52497abf0d0c768f3767a3d932 | Update expenses status on database | softwaresaved/fat,softwaresaved/fat,softwaresaved/fat,softwaresaved/fat | fellowms/migrations/0020_auto_20160602_1607.py | fellowms/migrations/0020_auto_20160602_1607.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-02 16:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fellowms', '0019_auto_20160601_1512'),
]
operations = [
migrations.AlterFiel... | bsd-3-clause | Python | |
1c6b74129d6e6a815d73e2a935fc86755ffb4f8a | Improve sourcecode (issue #11 and #17). | gersolar/solar_radiation_model,ahMarrone/solar_radiation_model,scottlittle/solar_radiation_model | imagedownloader/requester/api.py | imagedownloader/requester/api.py | from requester.models import AutomaticDownload
from tastypie.authentication import SessionAuthentication
from tastypie.resources import ModelResource
class AutomaticDownloadResource(ModelResource):
class Meta(object):
queryset = AutomaticDownload.objects.all()
resource_name = 'automatic_download'
filtering =... | from requester.models import AutomaticDownload
from tastypie import fields
from tastypie.authentication import SessionAuthentication
from tastypie.resources import ModelResource
from libs.tastypie_polymorphic import ModelResource
class AutomaticDownloadResource(ModelResource):
class Meta(object):
queryset = Auto... | mit | Python |
65830295d30507e632a1a71c15083c0e58977c9c | add badchans.py, for honeypot purposes... | PyLink/pylink-contrib-modules | 2.0/plugins/badchans.py | 2.0/plugins/badchans.py | """
badchans.py - Kills unopered users when they join specified channels.
"""
from pylinkirc import utils, conf, world
from pylinkirc.log import log
REASON = "You have si" + "nned..." # XXX: config option
def handle_join(irc, source, command, args):
"""
killonjoin JOIN listener.
"""
# Ignore our own ... | mpl-2.0 | Python | |
e3ad95017bced8dac5474d6de5958decf4f58279 | add migration file | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/auditcare/migrations/0005_auditcaremigrationmeta.py | corehq/apps/auditcare/migrations/0005_auditcaremigrationmeta.py | # Generated by Django 2.2.24 on 2021-06-20 14:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('auditcare', '0004_add_couch_id'),
]
operations = [
migrations.CreateModel(
name='AuditcareMigrationMeta',
fields=[
... | bsd-3-clause | Python | |
77a6100cbb45342d471d3d258b73c346bebacbbb | Add weather warnings | ElizabethSEden/cycling-weather-bot | weather_warning.py | weather_warning.py | from bs4 import BeautifulSoup
from urllib.request import Request, urlopen
from settings import REGION_CODE, REGION_NAME
from datetime import date
class NoWarningsException(Exception):
pass
def get_weather_warning():
try:
return WarningDetails(REGION_CODE, REGION_NAME) #get warning for London and South... | unlicense | Python | |
9c70a5d65b1c06f62751dfb4fcdd4d6a60a5eb71 | Add unit tests for testing the widget tree iterators. | eHealthAfrica/kivy,xpndlabs/kivy,vipulroxx/kivy,rafalo1333/kivy,CuriousLearner/kivy,Farkal/kivy,rafalo1333/kivy,Cheaterman/kivy,bionoid/kivy,bliz937/kivy,vipulroxx/kivy,habibmasuro/kivy,xiaoyanit/kivy,dirkjot/kivy,Farkal/kivy,rafalo1333/kivy,manashmndl/kivy,KeyWeeUsr/kivy,darkopevec/kivy,viralpandey/kivy,matham/kivy,cb... | kivy/tests/test_widget_walk.py | kivy/tests/test_widget_walk.py | import unittest
class FileWidgetWalk(unittest.TestCase):
def test_walk_large_tree(self):
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
from kivy.uix.widget import walk, walk_reverse
''' the tree
BoxLayout
BoxLayout
Label
... | mit | Python | |
989320c3f2bdf65eb8c22822f34052047e0d1a2b | Reorder array | prathamtandon/g4gproblems | Arrays/reorder_array.py | Arrays/reorder_array.py | """
Given two integer arrays of same size, arr[] and index[], reorder elements in arr[] according to given index array.
Input:
arr: 50 40 70 60 90
index: 3 0 4 1 2
Output:
arr: 60 50 90 40 70
index: 0 1 2 3 4
"""
"""
Approach:
1. Do the following for every element arr[i]
2. While index[i] != i, store array and index v... | mit | Python | |
3a4de870ebefd0e3e32b8c1b9facee6c98ce8b7f | Convert python 2 version to python 3 | Lingotek/filesystem-connector,Lingotek/translation-utility,Lingotek/client,Lingotek/client,Lingotek/translation-utility,Lingotek/filesystem-connector | ltk2to3.py | ltk2to3.py | import os
import shutil
import fnmatch
def get_files(patterns):
""" gets all files matching pattern from root
pattern supports any unix shell-style wildcards (not same as RE) """
cwd = os.getcwd()
if isinstance(patterns,str):
patterns = [patterns]
matched_files = []
for pattern in... | mit | Python | |
0babd53317322cea1a56cc8cacd6ffc417145c80 | Add migration file. | AIFDR/inasafe-django,AIFDR/inasafe-django,AIFDR/inasafe-django,AIFDR/inasafe-django | django_project/realtime/migrations/0033_auto_20180202_0723.py | django_project/realtime/migrations/0033_auto_20180202_0723.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('realtime', '0032_auto_20180201_0947'),
]
operations = [
migrations.AlterField(
model_name='ash',
nam... | bsd-2-clause | Python | |
844049b0d4aecb25fc480fae37111e8aebac6438 | Add mimeformats.py to support drag and drop | vorburger/mcedit2,vorburger/mcedit2 | src/mcedit2/util/mimeformats.py | src/mcedit2/util/mimeformats.py | """
mimeformats
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
log = logging.getLogger(__name__)
class MimeFormats(object):
MapItem = "application/x-mcedit-mapitem" | bsd-3-clause | Python | |
d2c99675bce99da0c0b77829081a805c0aa817be | add init evtxinfo.py | williballenthin/python-evtx,ohio813/python-evtx | Evtx/evtxinfo.py | Evtx/evtxinfo.py | #!/bin/python
# This file is part of python-evtx.
#
# Copyright 2012, 2013 Willi Ballenthin <william.ballenthin@mandiant.com>
# while at Mandiant <http://www.mandiant.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance wit... | apache-2.0 | Python | |
fa1223c661d60033b7d7aba2a27151d6ee18a299 | Add tests for circle ci checks | relekang/python-semantic-release,wlonk/python-semantic-release,relekang/python-semantic-release,riddlesio/python-semantic-release | tests/ci_checks/test_circle.py | tests/ci_checks/test_circle.py | import pytest
from semantic_release import ci_checks
from semantic_release.errors import CiVerificationError
def test_circle_should_pass_if_branch_is_master_and_no_pr(monkeypatch):
monkeypatch.setenv('CIRCLE_BRANCH', 'master')
monkeypatch.setenv('CI_PULL_REQUEST', '')
assert ci_checks.circle('master')
... | mit | Python | |
6a50f602ebc2334d45352cd2ff13c1f91db7e0bd | Integrate LLVM at llvm/llvm-project@8e22539067d9 | karllessard/tensorflow,Intel-Corporation/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,paolodedios/tensorflow,frreiss/tensorflow-fred,Intel-tensorflow/tensorflow,tensorflow/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_saved_model,tens... | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "8e22539067d9376c4f808b25f543feba728d40c9"
LLVM_SHA256 = "db0a7099e6e1eacbb51338f0b18c237be7354c25e8126c523390bef965a9b6f6"
tf_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "223261cbaa6b4c74cf9eebca3452ec0d15ea018e"
LLVM_SHA256 = "8425d6458484c6e7502b4e393cd8d98b533826a3b040261d67261f1364936518"
tf_http_archive(
... | apache-2.0 | Python |
bd729068b1683954ab190f187e59d8a5fc0741f1 | Integrate LLVM at llvm/llvm-project@7ed7d4ccb899 | gautam1858/tensorflow,Intel-tensorflow/tensorflow,paolodedios/tensorflow,Intel-tensorflow/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,Intel-tensorflow/tensorflow,yongtang/tensorflow,Intel-Corporation/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/t... | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "7ed7d4ccb8991e2b5b95334b508f8cec2faee737"
LLVM_SHA256 = "6584ccaffd5debc9fc1bb275a36af9bad319a7865abecf36f97cbe3c2da028d0"
tf_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "b109172d993edacd9853a8bbb8128a94da014399"
LLVM_SHA256 = "36ee6bf7d89b43034c1c58c57aa63d0703d1688807480969dfd1f4d7ccaa3787"
tf_http_archive(
... | apache-2.0 | Python |
e1fc8b6774c6283a8c4f81235f1a1d9dc10c5fc6 | Add tSNE-script | tokee/juxta,tokee/juxta,tokee/juxta | tSNE-images.py | tSNE-images.py | # Copied with permission from https://github.com/ml4a/ml4a-ofx.git
import argparse
import sys
import numpy as np
import json
import os
from os.path import isfile, join
import keras
from keras.preprocessing import image
from keras.applications.imagenet_utils import decode_predictions, preprocess_input
from keras.models ... | apache-2.0 | Python | |
f29dab9a82b44fac483d71c432a40a0bb2ca51b1 | Add the beginnings of an example client. | rvykydal/blivet,AdamWill/blivet,jkonecny12/blivet,vpodzime/blivet,vojtechtrefny/blivet,vpodzime/blivet,vojtechtrefny/blivet,jkonecny12/blivet,AdamWill/blivet,rvykydal/blivet | examples/dbus_client.py | examples/dbus_client.py |
import dbus
bus = dbus.SystemBus()
# This adds a signal match so that the client gets signals sent by Blivet1's
# ObjectManager. These signals are used to notify clients of changes to the
# managed objects (for blivet, this will be devices, formats, and actions).
bus.add_match_string("type='signal',sender='com.redha... | lgpl-2.1 | Python | |
ebf4d87390307dcf735c53f18a18f3466a4ee5e4 | Add standalone wave trigger tool. | lordjabez/light-maestro,lordjabez/light-maestro,lordjabez/light-maestro,lordjabez/light-maestro | tools/standalonewavetrigger.py | tools/standalonewavetrigger.py | #!/usr/bin/env python
# Standard library imports
import argparse
import collections
import logging
import os
import time
# Additional library imports
import requests
# Named logger for this module
_logger = logging.getLogger(__name__)
# Parse the command line arguments
_parser = argparse.ArgumentParser('')
_parser... | apache-2.0 | Python | |
d76c7f73701edeb263ebffc94ccc3f4893f7ef0d | add leetcode Reorder List | Fity/2code,Fity/2code,Fity/2code,Fity/2code,Fity/2code,Fity/2code | leetcode/ReorderList/solution.py | leetcode/ReorderList/solution.py | # Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def printList(self):
head = self
while head:
print head,
head = head.next
print ''
def __str__(self):
return str(self.val)
cl... | mit | Python | |
27a177a9c03ca5e98f1997eae18d046875a17c3b | Create alias.py | TingPing/plugins,TingPing/plugins | HexChat/alias.py | HexChat/alias.py | import hexchat
__module_name__ = "Alias"
__module_author__ = "TingPing"
__module_version__ = "0"
__module_description__ = "Create aliases for commands"
alias_hooks = {}
help_cmds = ['alias', 'unalias', 'aliases']
help_msg = 'Alias: Valid commands are:\n \
ALIAS name command\n \
UNALIAS name\n \
ALIASE... | mit | Python | |
a86852fe908bb0a44ef267a75b9446ddcaf03f6e | Add basic support for LimitlessLED | Duoxilian/home-assistant,betrisey/home-assistant,CCOSTAN/home-assistant,open-homeautomation/home-assistant,Smart-Torvy/torvy-home-assistant,pschmitt/home-assistant,hexxter/home-assistant,srcLurker/home-assistant,postlund/home-assistant,alexmogavero/home-assistant,MungoRae/home-assistant,srcLurker/home-assistant,turboko... | homeassistant/components/light/limitlessled.py | homeassistant/components/light/limitlessled.py | """
homeassistant.components.light.limitlessled
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for LimitlessLED bulbs, also known as...
EasyBulb
AppLight
AppLamp
MiLight
LEDme
dekolight
iLight
"""
import random
import logging
from homeassistant.helpers.entity import ToggleEntity
from homeassistant.const import STATE_O... | mit | Python | |
8d1917785f4cf8cc17ec1b3898dcb90f7402cfe9 | Revert of Attempt to add tracing dir into path, so that tracing_project can be imported. (patchset #1 id:1 of https://codereview.chromium.org/1300373002/ ) | sahiljain/catapult,0x90sled/catapult,zeptonaut/catapult,SummerLW/Perf-Insight-Report,SummerLW/Perf-Insight-Report,catapult-project/catapult,sahiljain/catapult,catapult-project/catapult,catapult-project/catapult-csm,benschmaus/catapult,SummerLW/Perf-Insight-Report,modulexcite/catapult,scottmcmaster/catapult,0x90sled/cat... | tracing/tracing_build/__init__.py | tracing/tracing_build/__init__.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
import os
import sys
import tracing_project
tracing_project.UpdateSysPathIfNeeded()
| # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
import os
import sys
def _AddTracingProjectPath():
tracing_path = os.path.normpath(
os.path.abspath(os.path.join(os.path.dirname(__file__), '.... | bsd-3-clause | Python |
b09a6fdd14e2e65bddd03bd11d14a20133f36f57 | Create nad2wgs.py | Kevo89/UTM2LatLong | nad2wgs.py | nad2wgs.py | #----------------------------
# NAD83 to WGS84 Converter #
# Python Version #
#----------------------------
# Adapted from Node-coordinator Project (https://github.com/beatgammit/node-coordinator)
#
# Original and this version released under MIT License (Provided below as per licensing)
#
# Copyright (c) 2... | mit | Python | |
37f286812bea7429bea67172a40d26ad435d6f67 | Add test for 'holes' argument in add_polygon | nschloe/python4gmsh | test/examples/hole_in_square.py | test/examples/hole_in_square.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import pygmsh as pg
import numpy as np
def generate():
# Characteristic length
lcar = 1e-1
# Coordinates of lower-left and upper-right vertices of a square domain
xmin = 0.0
xmax = 5.0
ymin = 0.0
ymax = 5.0
# Vertices of a square hole
squ... | bsd-3-clause | Python | |
db4bc200f9a48edf9e160c2134293df0313183a7 | Add conditional command prefix plugin | Aaron1011/CloudBotPlugins | conditional_prefix.py | conditional_prefix.py | from cloudbot import hook
import re
@hook.sieve
def conditional_prefix(bot, event, plugin):
if plugin.type == 'command':
if event.chan in event.conn.config['prefix_blocked_channels']:
command_prefix = event.conn.config['command_prefix']
if not event.chan.lower() == event.nick.lowe... | mit | Python | |
46977f4d36e09cccd5485352b27d1bac4d5b702a | Add unit tests for cmus module | tobi-wan-kenobi/bumblebee-status,tobi-wan-kenobi/bumblebee-status | tests/modules/test_cmus.py | tests/modules/test_cmus.py | # pylint: disable=C0103,C0111
import mock
import unittest
import tests.mocks as mocks
from bumblebee.config import Config
from bumblebee.input import I3BarInput, LEFT_MOUSE
from bumblebee.modules.cmus import Module
class TestCmusModule(unittest.TestCase):
def setUp(self):
self._stdin, self._select, self... | mit | Python | |
450eb8aee6d3638d6a5211e6c5ae1fa8ff8d1b9b | Add unittests for SelectTask, ProcessStreamHandler | fmoo/sparts,pshuff/sparts,fmoo/sparts,pshuff/sparts,bboozzoo/sparts,djipko/sparts,djipko/sparts,facebook/sparts,bboozzoo/sparts,facebook/sparts | tests/tasks/test_select.py | tests/tasks/test_select.py | # Copyright (c) 2014, Facebook, Inc. All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
#
from sparts.fileutils import set... | bsd-3-clause | Python | |
a2ea7c7d4d6b680f180b9916eb2a814713887154 | Test empty record. | Byhiras/pyavroc,Byhiras/pyavroc,Byhiras/pyavroc,Byhiras/pyavroc | tests/test_empty_record.py | tests/test_empty_record.py | #!/usr/bin/env python
# Copyright 2016 Ben Walsh
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 | Python | |
cba5a8058e96bd6c5ee639df223c77f56d8296fa | Add ladot package (#10905) | LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/ladot/package.py | var/spack/repos/builtin/packages/ladot/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Ladot(Package):
"""Ladot is a script that makes using LaTeX in graphs generated by dot
... | lgpl-2.1 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.