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 |
|---|---|---|---|---|---|---|---|---|
2b3f06175328fafaa8a8c7599a266a40044f8414 | Add Facebook OAuth | Encrylize/MyDictionary,Encrylize/MyDictionary,Encrylize/MyDictionary | app/oauth.py | app/oauth.py | import os
from flask import session
from app import oauth
facebook = oauth.remote_app(
"facebook",
base_url="https://graph.facebook.com/",
request_token_url=None,
access_token_url="/oauth/access_token",
authorize_url="https://facebook.com/dialog/oauth",
consumer_key=os.getenv("MYDICTIONARY_FAC... | mit | Python | |
6cb60c665b0f5db15c47f45fc6bba6a14ec804cb | Add sstats management command | akgrant43/storagemgr,akgrant43/storagemgr | storagemgr/storage/management/commands/sstats.py | storagemgr/storage/management/commands/sstats.py | from os.path import isdir, abspath
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from storage.models import File, Keyword, RootPath
from logger import init_logging
logger = init_logging(__name__)
class Command(BaseCommand):
args = ''
help = 'Print basic... | apache-2.0 | Python | |
a35b7a54b1ad54a490ea0f01063c368ecca43faa | Add benchmark for Softmax | sony/nnabla,sony/nnabla,sony/nnabla | python/benchmark/function/test_softmax.py | python/benchmark/function/test_softmax.py | # Copyright 2022 Sony Group Corporation.
#
# 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 ... | apache-2.0 | Python | |
abc4f62ced1f5f4530bd184628f916f51ace06a7 | add demo of using threading.Thread with object | ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study | reading-notes/CorePython/src/mt_sleep2.py | reading-notes/CorePython/src/mt_sleep2.py | # Copyright (c) 2014 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 copyright
# notice, this list ofconditions and the fol... | bsd-2-clause | Python | |
ccafc7454bea54e564f671945605e2572e179ed1 | add edit dist algo | gsathya/dsalgo,gsathya/dsalgo | algo/edit_dist.py | algo/edit_dist.py | def edit_distance(word1, word2):
len1 = len(word1)
len2 = len(word2)
table = [[0]*(len2+1) for i in range(len1+1)]
for i in range(len1+1):
table[i][0] = i
for j in range(len2+1):
table[0][j] = j
for i in range(1, len1+1):
for j in range(1, len2+1):
... | mit | Python | |
c62351f36e9865619032c6ee498a32958ae33d70 | add app.wsgi | Kai-Zhang/galaxy,leoYY/galaxy,szxw/galaxy,sdgdsffdsfff/galaxy,Kai-Zhang/galaxy,bluebore/galaxy,WangCrystal/galaxy,imotai/galaxy,ontologyzsy/galaxy,baidu/galaxy,fxsjy/galaxy,bluebore/galaxy,ontologyzsy/galaxy,leoYY/galaxy,fxsjy/galaxy,ontologyzsy/galaxy,baidu/galaxy,taotaowill/galaxy,szxw/galaxy,sdgdsffdsfff/galaxy,sdgd... | console/backend/src/app.wsgi | console/backend/src/app.wsgi | import os,sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'bootstrap.settings'
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
| bsd-3-clause | Python | |
8b985bfd5c01f337c7d2c0803c49fe8123293501 | Create loading.py | hantsik/dissertation | loading.py | loading.py | def loading(L, cuts, w, P, x):
"Return the geometrical and loading properties in form of L, cuts, w, P, x where x is distance from left to pointload"
P=P*1000 #Conversion to N
points= cuts+1
r = np.ones((3, points), dtype=np.float )
#Therefore the points considered will be from beginning to end... | mit | Python | |
e6bfcede8cb01fa38a5401315422a13d28983182 | Add tests to agent module. Just sunny day case for now | wairton/zephyrus-mas | tests/test_agent.py | tests/test_agent.py | import json
import pytest
import zmq
from zephyrus.addresses import Participants
from zephyrus.agent import Agent
from zephyrus.message import Message
from zephyrus.tester import TesterMessenger as ZTesterMessenger
@pytest.fixture
def DummyAgent():
class Dummy(Agent):
def act(self, perceived):
... | mit | Python | |
0c8b880552c6088e4ec8f7d77d04127c324e06ea | add management command to hard delete forms and cases in SQL | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/domain/management/commands/hard_delete_forms_and_cases_in_domain.py | corehq/apps/domain/management/commands/hard_delete_forms_and_cases_in_domain.py | from __future__ import absolute_import
from __future__ import unicode_literals
from django.core.management import BaseCommand
from corehq.form_processor.backends.sql.dbaccessors import CaseAccessorSQL, FormAccessorSQL
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('dom... | bsd-3-clause | Python | |
797599802c4702d4a4452aafa276ceedd829e27f | Add test module for tools module | wind-python/windpowerlib | tests/test_tools.py | tests/test_tools.py | from windpowerlib.tools import smallest_difference
import collections
class TestTools:
@classmethod
def setup_class(self):
self.return_tuple = collections.namedtuple('selected_values',
['closest_value',
... | mit | Python | |
ffb324d64c57b1f040c5b4201fbea0da0d28dee3 | test coverage | SalesforceFoundation/CumulusCI,SalesforceFoundation/CumulusCI | cumulusci/tests/test_main.py | cumulusci/tests/test_main.py | from unittest import mock
def test_main():
with mock.patch("cumulusci.cli.cci.main") as main:
from cumulusci import __main__
__main__
assert main.called_once
| bsd-3-clause | Python | |
01ba614a44a30994641d6858b9ea78eb522460a5 | Add managers tests | joshsamara/game-website,joshsamara/game-website,joshsamara/game-website | core/tests/test_managers.py | core/tests/test_managers.py | from .utils import BaseTestCase as TestCase
from core.models import User
class UserManagerTestCase(TestCase):
def setUp(self):
self.manager = User.objects
def test_create_user(self):
self.assertFalse(self.manager.all().exists())
email = 'test@email.com'
password = 'testpass'
... | mit | Python | |
f1615469adfdd6c49787e427525f7f8f440856f4 | Create 2_flickrlikes_csvlistoutput_directory.py | sharathchandra92/flickrapi_downloadfavorites,sharathchandra92/flickrapi_downloadfavorites | 2_flickrlikes_csvlistoutput_directory.py | 2_flickrlikes_csvlistoutput_directory.py | """
Run this first on unix
for i in $(ls); do # runs through the 'items' in this dir
if [ -d $i ]; then # if this is a dir
fname=${i##*/} # pick up the dir name which will be used as prefix
echo $fname ... | mit | Python | |
2d557b68fd9b7e0e900215afeb5185e466907a49 | Add test for reading and writing avro bytes to hdfs | danielfrg/libhdfs3.py,danielfrg/libhdfs3.py,danielfrg/cyhdfs3,danielfrg/cyhdfs3 | cyhdfs3/tests/test_avro.py | cyhdfs3/tests/test_avro.py | import posixpath
import subprocess
import numpy as np
import pandas as pd
import pandas.util.testing as pdt
import cyavro
from utils import *
avroschema = """ {"type": "record",
"name": "from_bytes_test",
"fields":[
{"name": "id", "type": "int"},
{"name": "name", "type": "string"}
]
}
"""
def test_avro_mov... | apache-2.0 | Python | |
e88e6466e2dd3af71bb74074b761d32cb676167d | Add new package: soci (#18816) | LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/soci/package.py | var/spack/repos/builtin/packages/soci/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)
from spack import *
class Soci(CMakePackage):
"""Official repository of the SOCI - The C++ Database Access Library""... | lgpl-2.1 | Python | |
28240c77c98859a47b5cd7c83b5ff22c06f689f1 | add test src | if1live/pelican-jsfiddle | pelican_jsfiddle/test_jsfiddle.py | pelican_jsfiddle/test_jsfiddle.py | #!/usr/bin/env python
#-*- coding: utf-8 -*-
import docutils.core
from pelican_jsfiddle import register as register_jsfiddle
rest_text = '''
.. jsfiddle:: if1live/V2P28
.. jsfiddle:: if1live/V2P28
:width: 100%
:height: 150
:tabs: js,result
:skin: presentation
'''
register_jsfiddle()
html = docutils.co... | mit | Python | |
8e991e06802a378ffa9bd1669d6454fb0e08e49f | Add basic array.array test. | vriera/micropython,hosaka/micropython,jmarcelino/pycom-micropython,noahchense/micropython,aethaniel/micropython,orionrobots/micropython,hosaka/micropython,henriknelson/micropython,aethaniel/micropython,xhat/micropython,ganshun666/micropython,torwag/micropython,cwyark/micropython,methoxid/micropystat,misterdanb/micropyt... | tests/basics/array.py | tests/basics/array.py | import array
a = array.array('B', [1, 2, 3])
print(a, len(a))
i = array.array('I', [1, 2, 3])
print(i, len(i))
print(a[0])
print(i[-1])
# Empty arrays
print(len(array.array('h')))
print(array.array('i'))
| mit | Python | |
9ba3a14c9a960ee1a8527acc21b5eaa0624b4693 | Add slicing tests for case #106 | theoriginalgri/django-mssql,theoriginalgri/django-mssql | tests/test_main/slicing/tests.py | tests/test_main/slicing/tests.py | from django.core.paginator import Paginator
from django.test import TestCase
from slicing.models import *
class PagingTestCase(TestCase):
"""The Paginator uses slicing internally."""
fixtures = ['paging.json']
def get_q(self, a1_pk):
return SecondTable.objects.filter(a=a1_pk).order_... | mit | Python | |
df22c5d6323ca67ed7b062790273cd327a64e440 | Update dependency bazelbuild/buildtools to latest version | google/copybara,google/copybara,google/copybara | third_party/bazel_buildtools.bzl | third_party/bazel_buildtools.bzl | # Copyright 2019 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,... | apache-2.0 | Python | |
636071a22ace2da9598cc7892e024dae4bb490f8 | add arduino sensor platform | kyvinh/home-assistant,robjohnson189/home-assistant,LinuxChristian/home-assistant,maddox/home-assistant,miniconfig/home-assistant,LinuxChristian/home-assistant,JshWright/home-assistant,LinuxChristian/home-assistant,instantchow/home-assistant,tboyce1/home-assistant,sfam/home-assistant,tomduijf/home-assistant,alexmogavero... | homeassistant/components/sensor/arduino.py | homeassistant/components/sensor/arduino.py | """
homeassistant.components.sensor.arduino
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for getting information from Arduino pins. Only analog pins are
supported.
Configuration:
sensor:
platform: arduino
pins:
7:
name: Door switch
type: analog
0:
name: Brightness
type: analog
... | apache-2.0 | Python | |
6d66f3d2a734e49ba61c59d544fd2048e653aea2 | Test lissajous trajectory | bit0001/trajectory_tracking,bit0001/trajectory_tracking | src/test/trajectory/test_lissajous_trajectory.py | src/test/trajectory/test_lissajous_trajectory.py | #!/usr/bin/env python
import unittest
from geometry_msgs.msg import Point
from trajectory.lissajous_trajectory import LissajousTrajectory
class LissajousTrajectoryTest(unittest.TestCase):
def setUp(self):
self.trajectory = LissajousTrajectory(1, 1, 3, 2, 4)
self.expected_position = Point()
... | mit | Python | |
9649fe7654237d5f2fa137eb8ee17c946e2c684e | Add the module file | LabPy/lantz,LabPy/lantz,varses/awsch,varses/awsch,LabPy/lantz_qt,LabPy/lantz_qt,LabPy/lantz,LabPy/lantz,LabPy/lantz_qt | lantz/drivers/ni/__init__.py | lantz/drivers/ni/__init__.py | # -*- coding: utf-8 -*-
"""
lantz.drivers.ni
~~~~~~~~~~~~~~~~
:company: National Instruments
:description:
:website: http://www.ni.com/
----
:copyright: 2012 by Lantz Authors, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from .daqe import NI6052E
... | bsd-3-clause | Python | |
b878a6ea720304fe11550ec9d94fc55a5093a5dd | Sort Array By Parity | MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode,MingfeiPan/leetcode | array/905.py | array/905.py | class Solution:
def sortArrayByParity(self, A):
"""
:type A: List[int]
:rtype: List[int]
"""
if not A:
return A
length = len(A)
pre = 0
nxt = length - 1
while pre < nxt:
while pre < length and A[pre] % 2 == 0:
... | apache-2.0 | Python | |
b7ca406adcbfe722cfa9fb6cc700304b79eaa28f | add tls for kaa.notifier support based on tlslite | freevo/kaa-base,freevo/kaa-base | src/net/tls.py | src/net/tls.py | # -* -coding: iso-8859-1 -*-
# -----------------------------------------------------------------------------
# tls.py - TLS support for kaa.notifier based on tlslite
# -----------------------------------------------------------------------------
# $Id$
#
# ---------------------------------------------------------------... | lgpl-2.1 | Python | |
6459d289f2db842bc6b852adc6fb91018a977be1 | Add benchmark | maximkulkin/lollipop | benchmark.py | benchmark.py | #!/usr/bin/env python
import lollipop.types as lt
import lollipop.validators as lv
from collections import namedtuple
import timeit
import os
import hotshot, hotshot.stats
def profile(func, *args, **kwargs):
prof = hotshot.Profile("object.prof")
prof.runcall(func, *args, **kwargs)
prof.close()
stats... | mit | Python | |
3ac2e885d4f701fca3bcc2228cae6286fd45de2d | Create download_ax_text_files.py | KarrLab/kinetic_datanator,KarrLab/kinetic_datanator | kinetic_datanator/data_source/download_ax_text_files.py | kinetic_datanator/data_source/download_ax_text_files.py | import requests
import os
import sys
import datetime
import json
reload(sys)
sys.setdefaultencoding('utf8')
class DownloadExperiments():
def download_single_year(self, year):
"""
Gets a JSON of all queries for a single year. Saves it into a directory called
"AllSamples". Creates this directory if it doesn't... | mit | Python | |
7cda4e6eeefe6c612d5bbee21159375a71aa707d | add logic to fetch keys | alexisrolland/data-quality,alexisrolland/data-quality,alexisrolland/data-quality,alexisrolland/data-quality | api/init/security/keys.py | api/init/security/keys.py | from jwt import (
jwk_from_dict,
jwk_from_pem
)
def get_public_key():
with open('/run/secrets/public_key', 'rb') as fh:
return jwk_from_dict(fh.read())
def get_private_key():
with open('/run/secrets/private_key', 'rb') as fh:
return jwk_from_pem(fh.read())
| apache-2.0 | Python | |
81a0f7222cf8fd464327865702c86618f8598b41 | create py-sphinx-multiversion spackage (#27314) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-sphinx-multiversion/package.py | var/spack/repos/builtin/packages/py-sphinx-multiversion/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 PySphinxMultiversion(PythonPackage):
"""A Sphinx extension for building self-hosted versio... | lgpl-2.1 | Python | |
c830550f2f457115a0595054c80cba5832823e06 | Create FTP downloader function | pratikmshah/practice,pratikmshah/practice,pratikmshah/practice,pratikmshah/practice | py-data-analysis/FtpDownloader.py | py-data-analysis/FtpDownloader.py | # -*- coding: utf-8 -*-
"""
Created on Sat May 21 16:43:47 2016
@author: Pratik
"""
from ftplib import FTP
def ftpDownloader(host, user, passwd):
ftp = FTP(host)
ftp.login(user, passwd)
print(ftp.nlst())
| mit | Python | |
f46fc38092d2720d4eb8eb197e5993be84e25a87 | add cudatext_nodejs.py | Alexey-T/CudaText,Alexey-T/CudaText,Alexey-T/CudaText,Alexey-T/CudaText,vhanla/CudaText,vhanla/CudaText,Alexey-T/CudaText,vhanla/CudaText,vhanla/CudaText,vhanla/CudaText,vhanla/CudaText,Alexey-T/CudaText,Alexey-T/CudaText,Alexey-T/CudaText,vhanla/CudaText,vhanla/CudaText,vhanla/CudaText,vhanla/CudaText | app/py/cudatext_nodejs.py | app/py/cudatext_nodejs.py | import os
import platform
import subprocess
MSG_CANNOT_RUN_NODE = "Cannot run Node.js. Make sure it's in your PATH."
#
# Linux: package "nodejs" installs binary "nodejs"
# Mac: need to specify path
#
NODE_FILE = 'node'
s = platform.system()
if s == 'Linux':
NODE_FILE = 'nodejs'
elif s == 'Darwin':
NODE_FILE ... | mpl-2.0 | Python | |
e1734d2b41d27815441262ed816e56d0021c119b | add time_step utility for order test | olivierverdier/homogint | homogint/utils.py | homogint/utils.py | #!/usr/bin/env python
# coding: UTF-8
from __future__ import division
def time_step(dt):
def scale(vf):
def scaled_vf(x):
return dt*vf(x)
return scaled_vf
return scale
| mit | Python | |
a24426619ae24952a441c51d2fb7639f39574ce2 | Create hoshank_ailani.py | ACM-SNU/git_talk | hoshank_ailani.py | hoshank_ailani.py | Hoshank
| mit | Python | |
5b619029441261659bf0f326f784e5322a952096 | Add timing test of password scrambling with pbkdf2, sha-256 and hmac(sha-256) | reider-roque/crypto-challenges | coursera-crypto-i/w4/pbdkf2_hmac_sha256.py | coursera-crypto-i/w4/pbdkf2_hmac_sha256.py | import binascii, hashlib, hmac, os, time
def scramble_with_kdf(passw, salt, iters):
return hashlib.pbkdf2_hmac('sha256', passw, salt, iters, 32)
def scramble_with_sha256(passw, salt, iters):
passw = salt + passw
for i in range(iters):
passw = hashlib.sha256(passw).digest()
return passw
def sc... | mit | Python | |
c1bf752aa2da676b84e5934e13baa2b4d115130a | add the submit module | appeltel/AutoCMS,appeltel/AutoCMS,appeltel/AutoCMS | autocms/submit.py | autocms/submit.py | """Functions to submit and register new jobs."""
import sys
import os
import re
import time
import socket
from .core import JobRecord
from .scheduler import Scheduler
def submit_and_stamp(counter, testname, scheduler, config):
"""Submit a job to the scheduler and produce a newstamp file.
This function shoul... | mit | Python | |
d9345c927774fafcc43e3d401e1c1e6fa3dd46eb | add solution to level 10 | maxrake/pc | PythonChallenge/level_10.py | PythonChallenge/level_10.py | """level 10
Find len(sequence[30])
Given the sequence = [1, 11, 21, 1211, 111221, ...]
This is the 'Look and Say' sequence:
https://en.wikipedia.org/wiki/Look-and-say_sequence
"""
def level_10(num):
"""Return the next number in the 'see-and-say' sequence, given a number.
The next number in t... | mit | Python | |
3e79e5df776a09f7c5ca555410f37a369fae53df | set ordering for extensions | numbas/editor,numbas/editor,numbas/editor | editor/migrations/0023_auto_20171018_0843.py | editor/migrations/0023_auto_20171018_0843.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('editor', '0022_taxonomies'),
]
operations = [
migrations.AlterModelOptions(
name='extension',
option... | apache-2.0 | Python | |
8ace231b97935ae0e99bd6dbd8da54b14118f73f | add proposed solution. | yevheniyc/Projects,yevheniyc/Projects,yevheniyc/Python,yevheniyc/Projects,yevheniyc/Python,yevheniyc/Python,yevheniyc/Projects,yevheniyc/Projects,yevheniyc/Projects | SocketIO/process_changes.py | SocketIO/process_changes.py | # This script was provided as a desired solution to the challenge.
# Although, I like mine better, this is a more elegant solution which utilizes ProcessPoolExecutor's
# map function to keep track of the order in which processing tasks come in. I used a simple list to keep track
# of the threads.
# The multi-threa... | mit | Python | |
f286cd167001b307d171702184bc60447c50638a | Create foxpro_run.py | Hexenon/FoxCode,Hexenon/FoxCode | foxpro_run.py | foxpro_run.py | import sublime, sublime_plugin
import os
import re
class foxpro_run(sublime_plugin.WindowCommand):
def run(self):
self.window.show_input_panel("Do ", "", self.on_done, None, None)
pass
def on_done(self,user_input):
if user_input == "":
user_input = self.window.active_view().fil... | mit | Python | |
a8f152e9a6a2db98305ee84dfb5b3be3cee91a84 | Implement importer as a management command. | us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite,us-ignite/us_ignite | us_ignite/apps/management/commands/app_import.py | us_ignite/apps/management/commands/app_import.py | import requests
from django.core.management.base import BaseCommand, CommandError
from us_ignite.apps import importer
class Command(BaseCommand):
help = 'Import the given JSON file.'
def handle(self, url, *args, **options):
response = requests.get(url)
if not response.status_code == 200:
... | bsd-3-clause | Python | |
90b34c96d6a255489ccc03c62f64c191130a32ac | Create new package. (#7069) | iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/mark/package.py | var/spack/repos/builtin/packages/mark/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... | lgpl-2.1 | Python | |
3ed70bcc0c699744fd4dc3259ca2f0b6ee7e5d6a | Add auth step to baseprovider for Redis connection pools | denizs/swampdragon,jonashagstedt/swampdragon,jonashagstedt/swampdragon,denizs/swampdragon,denizs/swampdragon,jonashagstedt/swampdragon | swampdragon/pubsub_providers/redis_sub_provider.py | swampdragon/pubsub_providers/redis_sub_provider.py | import json
import tornadoredis.pubsub
import tornadoredis
from .base_provider import BaseProvider
from .redis_settings import get_redis_host, get_redis_port, get_redis_db, get_redis_password
class RedisSubProvider(BaseProvider):
def __init__(self):
self._subscriber = tornadoredis.pubsub.SockJSSubscriber(... | import json
import tornadoredis.pubsub
import tornadoredis
from .base_provider import BaseProvider
from .redis_settings import get_redis_host, get_redis_port, get_redis_db
class RedisSubProvider(BaseProvider):
def __init__(self):
self._subscriber = tornadoredis.pubsub.SockJSSubscriber(tornadoredis.Client(... | bsd-3-clause | Python |
37dede316306d7c42045f5d3815f5e347a7bccad | Add package for maven (#2132) | mfherbst/spack,mfherbst/spack,tmerrick1/spack,iulian787/spack,krafczyk/spack,iulian787/spack,LLNL/spack,lgarren/spack,skosukhin/spack,krafczyk/spack,LLNL/spack,mfherbst/spack,iulian787/spack,lgarren/spack,mfherbst/spack,TheTimmy/spack,skosukhin/spack,lgarren/spack,tmerrick1/spack,TheTimmy/spack,TheTimmy/spack,EmreAtes/... | var/spack/repos/builtin/packages/maven/package.py | var/spack/repos/builtin/packages/maven/package.py | ##############################################################################
# Copyright (c) 2013-2016, 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... | lgpl-2.1 | Python | |
1223e43827eb229ca32d83e1b3950a71fe08d29d | add 2.0 (#2890) | TheTimmy/spack,iulian787/spack,LLNL/spack,mfherbst/spack,matthiasdiener/spack,krafczyk/spack,tmerrick1/spack,matthiasdiener/spack,TheTimmy/spack,skosukhin/spack,krafczyk/spack,TheTimmy/spack,iulian787/spack,LLNL/spack,matthiasdiener/spack,LLNL/spack,skosukhin/spack,iulian787/spack,EmreAtes/spack,tmerrick1/spack,lgarren... | var/spack/repos/builtin/packages/p4est/package.py | var/spack/repos/builtin/packages/p4est/package.py | ##############################################################################
# Copyright (c) 2013-2016, 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... | ##############################################################################
# Copyright (c) 2013-2016, 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... | lgpl-2.1 | Python |
b1e2ecc561b69aee76ad42fdbb01d89ff582a9de | Create SparkSQLPopularMostMovie.py | kratikaswami/Spark-Projects | SparkSQLPopularMostMovie.py | SparkSQLPopularMostMovie.py | from pyspark.sql import SparkSession
from pyspark.sql import Row
from pyspark.sql import functions
def loadMovieNames():
movieNames = {}
with open("/home/kratika/Desktop/spark/ml-100k/u.item", encoding = "ISO-8859-1") as f:
for line in f:
fields = line.split('|')
movieNames[int(... | apache-2.0 | Python | |
0d0bacdee7eb7d6c4ffc74f2110f523fd341aa3c | add export anag | nomed/ebetl,nomed/ebetl,nomed/ebetl | ebetl/commands/exportanag.py | ebetl/commands/exportanag.py | #!/usr/bin/env python
""" Print all the usernames to the console. """
import os
import sys
from argparse import ArgumentParser
from paste.deploy import appconfig
from ebetl.config.environment import load_environment
from ebetl.model import *
from paste.script.command import Command
from genshi.template import Template... | artistic-2.0 | Python | |
46de620d4829ba498c7022cf1ffc8af10f6b7a9a | Add text batch | realitix/vulk-demo,realitix/vulk-demo | vulkdemo/textbatch.py | vulkdemo/textbatch.py | #!/usr/bin/env python3.6
from vulk.baseapp import BaseApp
from vulk.graphic.d2.batch import TextBatch
from vulk.graphic.d2.fontdata import FontData
class App(BaseApp):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def start(self):
super().start()
self.data = F... | apache-2.0 | Python | |
c9bd8dad9fcb90d5545becd0d366b345cdb2f84a | rename file | ktbyers/pynet_ons,ktbyers/pynet_ons | day1/ex3_strings.py | day1/ex3_strings.py | name1 = "Kirk Byers"
name2 = "George Washington"
name3 = "Thomas Jefferson"
name4 = raw_input("Enter fourth name: ")
print
print "{:>30}".format(name1)
print "{:>30}".format(name2)
print "{:>30}".format(name3)
print "{:>30}".format(name4)
print
| apache-2.0 | Python | |
8e1906e54ab42dd1d69b5d158932583dcacb3530 | Create colortext.py (Will need improvements.) | Jake0720/XChat-Scripts | colortext.py | colortext.py | __module_name__ = 'Color Text'
__module_version__ = '0.1'
__module_description__ = 'Another way to type in colors, if you find it more difficult with Ctrl + K. (Only works for one color)'
__module_author__ = 'Jake0720'
import xchat
p = '\x0313'
br = '\x0305'
v = '\x0306'
nb = '\x0302'
a = '\x0311'
y = '\x0308'
dg = '... | mit | Python | |
3d2d3ba501dbc3d15489cf26b422c0444359f4a5 | add unit test stub for cookie persistence | F5Networks/f5-ansible-modules | test/unit/test_bigip_profile_persistence_cookie.py | test/unit/test_bigip_profile_persistence_cookie.py | # -*- coding: utf-8 -*-
#
# Copyright: (c) 2018, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
from nose.plugins.skip i... | mit | Python | |
0a74878997b2df53b1e482a61a36c6e9f35b248a | Add an example of event monitoring. | rvykydal/blivet,AdamWill/blivet,jkonecny12/blivet,rhinstaller/blivet,jkonecny12/blivet,rhinstaller/blivet,rvykydal/blivet,AdamWill/blivet,vpodzime/blivet,vojtechtrefny/blivet,vpodzime/blivet,vojtechtrefny/blivet | examples/uevents.py | examples/uevents.py | import time
from examples.common import print_devices
import blivet
from blivet.events.manager import event_manager
from blivet.util import set_up_logging
def print_changes(event, changes):
print("***", event)
for change in changes:
print("***", change)
print("***")
print()
set_up_logging(c... | lgpl-2.1 | Python | |
1af6faccbf16095cb8d21dd6a2059e0bc69cfd27 | check missing sha1 | svebk/DeepSentiBank_memex,svebk/DeepSentiBank_memex,svebk/DeepSentiBank_memex,svebk/DeepSentiBank_memex | hbase_ht/check_escorts_missing_sha1.py | hbase_ht/check_escorts_missing_sha1.py | import happybase
import time
import sys
import os
import json
sys.path.insert(0, os.path.abspath('../memex_tools'))
import sha1_tools
hbase_conn_timeout = None
nb_threads = 2
pool = happybase.ConnectionPool(size=nb_threads,host='10.1.94.57',timeout=hbase_conn_timeout)
sha1_tools.pool = pool
tab_escorts_images_name = '... | bsd-2-clause | Python | |
9bb213f1d227d953a0237bff6b0e96c7be49bee2 | add pokedex.py | longears/pokedex,longears/pokedex | pokedex.py | pokedex.py | #!/usr/bin/env python
import hashlib
import os
from boto.s3.connection import S3Connection
"""
poke-catch file [file file ...]
poke-release file [file file ...]
foo.txt --> foo.txt__pokeball
pokeball contents:
POKEBALL
sha1-oifjqofijq3ofiq3f34
sha1-942f298dh298qhd9q8h
sha1-afiq34fjq3o4fiq3j4f
a po... | mit | Python | |
faa3739356e66dfb348fdd6f92bec2aff991e402 | add datamigrations to create job pages dashblocktype | Ilhasoft/ureport,rapidpro/ureport,auduaboki/ureport,xkmato/ureport,auduaboki/ureport,Ilhasoft/ureport,auduaboki/ureport,rapidpro/ureport,rapidpro/ureport,eHealthAfrica/ureport,Ilhasoft/ureport,eHealthAfrica/ureport,xkmato/ureport,xkmato/ureport,rapidpro/ureport,eHealthAfrica/ureport,Ilhasoft/ureport | ureport/jobs/migrations/0002_auto_20150320_1404.py | ureport/jobs/migrations/0002_auto_20150320_1404.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def generate_job_block_types(apps, schema_editor):
User = apps.get_model("auth", "User")
root = User.objects.filter(username="root").first()
if not root:
root = User.objects.filter(username="r... | agpl-3.0 | Python | |
99f121e0f3cd8108a5ffe229308005f79d32d962 | Add configuration generation script to scripts | henningjp/CoolProp,JonWel/CoolProp,DANA-Laboratory/CoolProp,dcprojects/CoolProp,dcprojects/CoolProp,CoolProp/CoolProp,henningjp/CoolProp,dcprojects/CoolProp,CoolProp/CoolProp,CoolProp/CoolProp,DANA-Laboratory/CoolProp,JonWel/CoolProp,dcprojects/CoolProp,JonWel/CoolProp,henningjp/CoolProp,CoolProp/CoolProp,dcprojects/Co... | Web/scripts/coolprop.configuration.py | Web/scripts/coolprop.configuration.py | from __future__ import print_function
import CoolProp.CoolProp as CP, json
jj = json.loads(CP.get_config_as_json_string())
with open('../coolprop/configuration_keys.rst.in', 'w') as fp:
for key in sorted(jj.keys()):
fp.write('``' + key + '``: ' + CP.config_key_description(key) + '\n\n') | mit | Python | |
e0e28d06a172cbb961746c8b2901f50a67ac52c6 | Create xtp_constant.py | vnpy/vnpy,bigdig/vnpy,bigdig/vnpy,bigdig/vnpy,bigdig/vnpy,vnpy/vnpy | vnpy/api/xtp/generator/xtp_constant.py | vnpy/api/xtp/generator/xtp_constant.py | XTP_VERSION_LEN = 16
XTP_TRADING_DAY_LEN = 9
XTP_TICKER_LEN = 16
XTP_TICKER_NAME_LEN = 64
XTP_LOCAL_ORDER_LEN = 11
XTP_ORDER_EXCH_LEN = 17
XTP_EXEC_ID_LEN = 18
XTP_BRANCH_PBU_LEN = 7
XTP_ACCOUNT_NAME_LEN = 16
XTP_CREDIT_DEBT_ID_LEN = 33
XTP_SIDE_BUY = 1
XTP_SIDE_SELL = 2
XTP_SIDE_PURCHASE = 7
XTP_SIDE_REDEMPTION = 8
XT... | mit | Python | |
fcaa0bec7a719b025da4694099c621a6b74bd06e | add publish file | ambitioninc/gclient-service-account-auth | publish.py | publish.py | import subprocess
subprocess.call(['pip', 'install', 'wheel'])
subprocess.call(['python', 'setup.py', 'clean', '--all'])
subprocess.call(['python', 'setup.py', 'register', 'sdist', 'bdist_wheel', 'upload'])
| mit | Python | |
49b916ce00d919a73ddc8923f62e0b4c6115b608 | Add test to source folder. | samueljackson92/coranking | src/coranking_test.py | src/coranking_test.py | import unittest
import nose.tools
from sklearn import manifold, datasets
from mia.coranking import trustworthiness, continuity, LCMC, coranking_matrix
from mia.utils import *
class CorankingTest(unittest.TestCase):
def setUp(self):
self._high_data, color \
= datasets.samples_generator.make_s... | mit | Python | |
9c4cb69b60b7d91a5ed07f2871174e276db80071 | Load content from a given directory. | luispedro/django-gitcms,luispedro/django-gitcms | loadcontent.py | loadcontent.py | from os import listdir, path
basedir = '../../website.content/'
for app in listdir(basedir):
module = __import__(app,{},{},fromlist=['load'])
if 'loaddir' in dir(module.load):
module.load.loaddir(path.join(basedir, app), clear=True)
elif 'loadfile' in dir(module.load):
module.load.clear()
... | agpl-3.0 | Python | |
63a430345b641bd32c60cfccd96339b4c6bf5d19 | fix db merge conflict | ssadedin/seqr,macarthur-lab/seqr,ssadedin/seqr,macarthur-lab/seqr,macarthur-lab/seqr,macarthur-lab/seqr,ssadedin/seqr,ssadedin/seqr,macarthur-lab/seqr,ssadedin/seqr | seqr/migrations/0068_merge_20190830_1616.py | seqr/migrations/0068_merge_20190830_1616.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-08-30 16:16
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('seqr', '0065_merge_20190827_2031'),
('seqr', '0067_auto_20190827_1957'),
]
operati... | agpl-3.0 | Python | |
c1c4abe338142931c17cda2527362b6daaed60f2 | add some server page tests | jasonmunro/cypht,jasonmunro/cypht,jasonmunro/cypht,jasonmunro/cypht | tests/selenium/servers.py | tests/selenium/servers.py | from base import WebTest, USER, PASS
from runner import test_runner
from selenium.common.exceptions import ElementNotVisibleException
class ServersTest(WebTest):
def __init__(self):
WebTest.__init__(self)
self.login(USER, PASS)
self.wait_with_folder_list()
def toggle_server_section(se... | lgpl-2.1 | Python | |
66df7c819d51059f30f9002c479f33324e9c72a5 | Correct Python Docs about tensorboard path (#7250) | weleen/mxnet,antoan2/incubator-mxnet,sergeykolychev/mxnet,CodingCat/mxnet,jiajiechen/mxnet,sergeykolychev/mxnet,nicklhy/mxnet,hesseltuinhof/mxnet,wangyum/mxnet,tlby/mxnet,crazy-cat/incubator-mxnet,luoyetx/mxnet,larroy/mxnet,navrasio/mxnet,eric-haibin-lin/mxnet,wangyum/mxnet,nicklhy/mxnet,TuSimple/mxnet,sxjscience/mxnet... | python/mxnet/contrib/tensorboard.py | python/mxnet/contrib/tensorboard.py | # coding: utf-8
"""TensorBoard functions that can be used to log various status during epoch."""
from __future__ import absolute_import
import logging
class LogMetricsCallback(object):
"""Log metrics periodically in TensorBoard.
This callback works almost same as `callback.Speedometer`, but write TensorBoard... | # coding: utf-8
"""TensorBoard functions that can be used to log various status during epoch."""
from __future__ import absolute_import
import logging
class LogMetricsCallback(object):
"""Log metrics periodically in TensorBoard.
This callback works almost same as `callback.Speedometer`, but write TensorBoard... | apache-2.0 | Python |
cd0e3ec8359eeec31ad383310c2bab4588dc095a | Add IcedID downloader ida string decoding | sysopfb/Malware_Scripts | IcedID_Downloader/ztrak_downloader_strings_ida.py | IcedID_Downloader/ztrak_downloader_strings_ida.py | def gen_key(k):
return(((k << 0x1d) | (k >> 3)) & 0xffffffff)
#Unpacked of 32a683ac11d966d73fedf4e249573022891ac902086167e4d20b18be28bd2c1d
for addr in XrefsTo(0x40233e, flags=0):
addr = addr.frm
#print(hex(addr))
addr = idc.PrevHead(addr)
while GetMnem(addr) != "push":
addr = idc.PrevHead(addr)
prin... | mit | Python | |
2d672d17c6554d656ba536d09934302603bfa178 | Add example client script | CloudCredo/graphite-statsd-boshrelease,CloudCredo/graphite-statsd-boshrelease,CloudCredo/graphite-statsd-boshrelease | examples/example-client.py | examples/example-client.py | #!/usr/bin/python
"""Copyright 2008 Orbitz WorldWide
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... | apache-2.0 | Python | |
2c9474ad90987ca18d408a848c33ed1107d8975a | Create mars_mobile.py | Zprogrammer/pymove3D_comments | mars_mobile.py | mars_mobile.py | #!bpy
"""
Name: 'mars_mobile.py'
Blender: 2.69
Group: 'Composition'
Tooltip: 'Rotate, locate and scale objects assembled to a futuristic prototype'
"""
import bpy
def create_objects():
"""Create objects from a list of attributes
List values:
object name -- string
object type -- string
locati... | cc0-1.0 | Python | |
62dd78bf463e94a92f22ccddbd59c2365b7058bf | test prototype | beckdac/minecraft_tiered_structure_generator | mob_spawner.py | mob_spawner.py | #!/usr/bin/env python3
"""
Minecraft mob spawner generator
with setblock commands in vanilla minecraft
E.g. usage:
./mob_spawner.py -x 82 -z 358 -y 63 -b minecraft:cobblestone
Capture the output and paste it into the console
"""
import argparse
import math
def set_block(x, y, z, block_id):
"""
Set a block ... | bsd-3-clause | Python | |
fe05fc7fd5ae674d7ef0ff22652202e01394ebc3 | Add new package: jline3 (#18548) | iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/jline3/package.py | var/spack/repos/builtin/packages/jline3/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)
from spack import *
class Jline3(MavenPackage):
"""JLine is a Java library for handling console input."""
homep... | lgpl-2.1 | Python | |
d3cf3273d0350e4015156c08a1295f43eefdd0a8 | add opsis_video target (wip) | cr1901/HDMI2USB-litex-firmware,mithro/HDMI2USB-litex-firmware,cr1901/HDMI2USB-litex-firmware,mithro/HDMI2USB-litex-firmware,cr1901/HDMI2USB-litex-firmware,mithro/HDMI2USB-litex-firmware,cr1901/HDMI2USB-litex-firmware,mithro/HDMI2USB-litex-firmware | opsis_video.py | opsis_video.py | #!/usr/bin/env python3
from opsis_base import *
from gateware.hdmi_in import HDMIIn
from gateware.hdmi_out import HDMIOut
base_cls = MiniSoC
class VideoMixerSoC(base_cls):
csr_peripherals = (
"hdmi_out0",
"hdmi_out1",
"hdmi_in0",
"hdmi_in0_edid_mem",
... | bsd-2-clause | Python | |
f6057bff2cca9859e6baa9c0fd3a6ea4bd2220d3 | Add config tests | INCF/pybids | bids/tests/test_config.py | bids/tests/test_config.py | import bids
import tempfile
import os
import json
import pytest
from bids.config import reset_options
def test_load_from_standard_paths():
# Verify defaults
reset_options(False)
assert bids.config._settings == bids.config._default_settings
# Verify that PLIERS_CONFIG and local dir take precedence
... | mit | Python | |
4664efaf1e768b35ef9d7dcfd31f9dab37aef321 | Create make_plotly.py | boisvert42/baseball-for-fun,boisvert42/baseball-for-fun,boisvert42/baseball-for-fun | expected_woba/make_plotly.py | expected_woba/make_plotly.py | #!/usr/bin/python
import numpy as np
import plotly.graph_objs as go
from plotly.offline import plot as plotly_plot
import pandas as pd
#%%
df = pd.read_csv(r'eWOBA.csv')
plot_data = []
teams = np.sort(df.Team.unique())
for team in teams:
xdata = df.loc[df.Team==team]['wOBA']
ydata = df.loc[df.Team==team]['pr... | mit | Python | |
0beca881b386071b6a1c2dd641ef50dbd9afff54 | add code to check mongodb auth | lizbew/code-practice,lizbew/code-practice,lizbew/code-practice,lizbew/code-practice | 10-mongo/check_port.py | 10-mongo/check_port.py | #!/usr/bin/env python
# -*- encoding:utf-8 -*-
import sys
import socket
CLIENT_PORT = 27017
WEB_PORT = 28017
socket.setdefaulttimeout(1)
def check_port_opened(host, port):
try:
socket.create_connection((host, port), 0.5)
return True
except socket.timeout:
pass
exce... | apache-2.0 | Python | |
b6416376db5f8b09b64a25d2818e15127963ac1d | add new package (#23576) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/alpaka/package.py | var/spack/repos/builtin/packages/alpaka/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 Alpaka(CMakePackage, CudaPackage):
"""Abstraction Library for Parallel Kernel Acceleratio... | lgpl-2.1 | Python | |
2b68a9cb2f7044d7e5ce9e7c971070eba7a36c07 | add min_con impl | YcheLanguageStudio/PythonStudy | bioinformatics/dynamic_programming/min_num_coin.py | bioinformatics/dynamic_programming/min_num_coin.py | def min_num_coin(coin_list, val):
coin_list = sorted(set(coin_list), key=lambda x: -x)
choice_list = []
# key: end_idx, val: (min_coin_num, path)
min_coin_num_dict = {}
def min_num_coin_detail(end_idx, left_val, coin_count, path):
if end_idx in min_coin_num_dict:
return min_coi... | mit | Python | |
70062488848b890419adc516caf85e3fbe823db6 | Add parser for csv sleeptime data | f-jiang/sleep-pattern-grapher | csvparser.py | csvparser.py | import csv
from datetime import datetime, timedelta
from collections import OrderedDict
# ----sample csv:
# 01/30/2016
# 23:49,7:20,0 # 11:49 PM, Jan 30 - 7:20 AM, Jan 31
# # no data; blank line still needed so subsequent dates aren't misaligned
# 1:30,7:25,0
_dfmtstr = '%m/%d/%y'
_tfmtstr = '%H:%M'
... | mit | Python | |
15191610a9ec5a915610a4804be36782571e79cd | Add example | hkwi/twink,yeardancing/twink | test/example_switch.py | test/example_switch.py | import binascii
import twink
import twink.gevent
from twink.ofp4 import *
import twink.ofp4.parse as p
import twink.ofp4.build as b
import twink.ofp4.oxm as oxm
import logging
logging.basicConfig(level=logging.DEBUG)
def switch_proc(message, channel):
msg = p.parse(message)
if msg.header.type == OFPT_F... | apache-2.0 | Python | |
7664068ad03b133a0976fdf8ccfab21f339d8480 | Add script elveg_all.py to unzip and convert all municipalities. | gomyhr/elveg2osm | elveg_all.py | elveg_all.py | #! /usr/bin/env python2
'''elveg_all Elveg_archive.zip [XXXX [YYYY [...]]]'''
import sys
import os
filename = sys.argv[1]
# Unzip archive if necessary
if filename[-4:] == '.zip':
# Assume that it is a zip file
dirname = filename[:-4]
if not os.path.isdir(dirname):
os.mkdir(dirname)
os.sy... | mit | Python | |
d40fb793e032c5e356ba7683fbb03eb3565fd463 | Add 338-counting-bits.py | daicang/Leetcode-solutions,daicang/Leetcode-solutions | 338-counting-bits.py | 338-counting-bits.py |
# O(n * sizeof(n)) solution
class Solution(object):
def countBits(self, num):
ret = [0]*(num+1)
for i in range(0, num+1):
curr = i
while (i != 0):
ret[curr] += i & 1
i >>= 1
return ret
class Solution(object):
def countBits(self, ... | mit | Python | |
b91bd6806fe2df3243f7d28376372731ae74fd5d | solve in python | japaric/eulermark,japaric/eulermark,japaric/eulermark,japaric/eulermark,japaric/eulermark,japaric/eulermark,japaric/eulermark,japaric/eulermark | 0/0/4/004.py | 0/0/4/004.py | # Copyright (C) 2013 Jorge Aparicio
def is_palindrome(n):
s = str(n)
return s == s[::-1]
print(max([a * b
for a in range(100, 1000)
for b in range(a, 1000)
if is_palindrome(a * b)]))
| mit | Python | |
84328d79b0aa8f7a4cdf88981d961c7d7b0fbc4f | add flowstats_logger.py | hibitomo/lago-mon | flowstats_logger.py | flowstats_logger.py | #!/usr/bin/env python
# Copyright (C) 2014-2016 Nippon Telegraph and Telephone Corporation.
#
# 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
... | apache-2.0 | Python | |
c4b83a909eb7149ac3da33b90e912d1275a8dc16 | Add tests for indexed access compilation | ytanay/thinglang,ytanay/thinglang,ytanay/thinglang,ytanay/thinglang | tests/compiler/test_access_compilation.py | tests/compiler/test_access_compilation.py | from tests.compiler import compile_local, A_ID, LST_ID, SELF_ID, VAL1_ID
from thinglang.compiler.opcodes import OpcodePushLocal, OpcodePushIndexImmediate, OpcodePushIndex, OpcodePushMember
def test_local_list_immediate_index():
assert compile_local('lst[123]') == [OpcodePushLocal(LST_ID), OpcodePushIndexImmediate... | mit | Python | |
d8b3f064d2886e1361c2b0884392c6545a1c97e9 | Create paretocurve_convergence.py | architecture-building-systems/CityEnergyAnalyst,architecture-building-systems/CityEnergyAnalyst,architecture-building-systems/CityEnergyAnalyst | cea/plots/optimization/paretocurve_convergence.py | cea/plots/optimization/paretocurve_convergence.py | """
cehck perfromacne of pareto curve
https://arxiv.org/pdf/1901.00577.pdf
"""
from __future__ import division
from __future__ import print_function
import json
import plotly.graph_objs as go
import cea.plots.optimization
__author__ = "Jimeno Fonseca"
__copyright__ = "Copyright 2018, Architecture and Building Syste... | mit | Python | |
e3bbc950d5ce2819113e5966a20297e6e74a84a7 | Create __init__.py | somchaisomph/RPI.GPIO.TH | gadgets/motors/__init__.py | gadgets/motors/__init__.py | #Empty file
| mit | Python | |
d91834dc3eeeedad5285f7abf02049972fd54d08 | Add plot | IshitaTakeshi/Matrix4j,IshitaTakeshi/Matrix4j | demo/plot.py | demo/plot.py | from os.path import join, expanduser
from matplotlib.font_manager import FontProperties
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import image
from skimage.color import rgb2gray
import numpy as np
home = expanduser("~")
font = FontProperties(fname=join(home, ".fonts", "... | mit | Python | |
b913018da05fd2e1eb19add396c100105812652b | add predict dir file | adiyoss/DeepWDM | predict_dir.py | predict_dir.py | import argparse
import os
from lib.textgrid import TextGrid
from predict import predict
def run_dir(in_path, out_path):
for item in os.listdir(in_path):
if item.endswith('.wav'):
out_file_path = out_path + item.replace('.wav', '.TextGrid')
predict(in_path + item, out_file_path, 'r... | mit | Python | |
f56f4ee22cc9ac3cfb4bf33eefe375b4c150d250 | Move tkgui to gui folder. | nicorellius/password-generator | gui/tkgui.py | gui/tkgui.py | #!/usr/bin/env python
import tkinter as tk
from scripts.generate import generate_password
class Application(tk.Tk):
MODES = [
("Words", "Words"),
("Numbers", "Numbers"),
("Mixed", "Mixed"),
]
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
... | mit | Python | |
74dc022315b94cde4a330ae60e75c65808ce9bf7 | Add 0008 file | Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Yrthgze/prueba-sourcetree2,Show-Me-the-Code/python,Show-Me-the-Code/python,Show-Me-the-Code/python | Drake-Z/0008/0008.py | Drake-Z/0008/0008.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'第 0008 题:一个HTML文件,找出里面的正文。'
__author__ = 'Drake-Z'
from html.parser import HTMLParser
from html.entities import name2codepoint
class MyHTMLParser(HTMLParser):
in_zhengwen = False
in_huanhang = False
def handle_starttag(self, tag, attrs):
if ('class... | mit | Python | |
548aac27cb218db989d45e801b8ecdfa993caa53 | Create soil_moisture.py | Python-IoT/Smart-IoT-Planting-System,Python-IoT/Smart-IoT-Planting-System | device/src/soil_moisture.py | device/src/soil_moisture.py | #soil moisture sensor.
#VCC, GND, AO, DO
#DO <--> GPIO
#AO <--> ADC Port
#if value is low than defined data, DO value is 0,
#if value is high than defined data, DO value is 1.
#AO is the specific value.
from pyb import Pin
p_in = Pin('Y12', Pin.IN, Pin.PULL_UP)
p_in.value
adc = pyb.ADC(Pin('Y11')) # create an ... | mit | Python | |
ca109b6cd0f7ce5818abdf413abcac51fc5f8b0d | Add initial test for the optimal_parameters function. | odlgroup/odl,kohr-h/odl,odlgroup/odl,kohr-h/odl | odl/contrib/param_opt/test/test_param_opt.py | odl/contrib/param_opt/test/test_param_opt.py | import pytest
import odl
import odl.contrib.fom
import odl.contrib.param_opt
from odl.util.testutils import simple_fixture
space = simple_fixture('space',
[odl.rn(3),
odl.uniform_discr([0, 0], [1, 1], [9, 11]),
odl.uniform_discr(0, 1, 10)])
def te... | mpl-2.0 | Python | |
d141dd94c24f0d8e2d9cb5254b09bc7e66627562 | Add a basic debugging script | ec-geolink/glharvest,ec-geolink/glharvest,ec-geolink/glharvest | glharvest/scripts/debug.py | glharvest/scripts/debug.py | """debug.py
General debug script.
"""
import sys
import os
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir))
# sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'd1lod'))
sys.path.append("/Users/mecum/src/glharvest/d1lod/")
import logging
logging.basicConfig(... | apache-2.0 | Python | |
9ade5a79e74281f8503c798b06f6b568122b0594 | Add data migration for existing zotero user and node settings models - "personal" library is the only library that was previously available, but now group libraries are accessible. | chennan47/osf.io,saradbowman/osf.io,Johnetordoff/osf.io,icereval/osf.io,erinspace/osf.io,chennan47/osf.io,CenterForOpenScience/osf.io,CenterForOpenScience/osf.io,brianjgeiger/osf.io,icereval/osf.io,felliott/osf.io,erinspace/osf.io,sloria/osf.io,mfraezz/osf.io,CenterForOpenScience/osf.io,pattisdr/osf.io,mfraezz/osf.io,m... | addons/zotero/migrations/0005_auto_20180216_0849.py | addons/zotero/migrations/0005_auto_20180216_0849.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-02-16 14:49
from __future__ import unicode_literals
from bulk_update.helper import bulk_update
from django.db import migrations
def reverse_func(state, schema):
print 'Starting reverse zotero library migration'
modify_node_settings(state, None)
... | apache-2.0 | Python | |
48e9ea38ff32cb7848543db76e20d051ffbb7563 | Create customMsg.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | home/calamity/customMsg.py | home/calamity/customMsg.py | arduino = Runtime.createAndStart("arduino", "Arduino")
arduino.connect("COM11")
def test(data):
print data
arduino.addListener("publishCustomMsg","python","test")
arduino.customMsg(55,44)
| apache-2.0 | Python | |
8851146342d32b73ab129d4281380f94d6fc0f5c | remove MIRAX OriginalFile objects from OMERO and, optionally, files from the file system | crs4/ome_seadragon,crs4/ome_seadragon,crs4/ome_seadragon,lucalianas/ome_seadragon,lucalianas/ome_seadragon,lucalianas/ome_seadragon,lucalianas/ome_seadragon,crs4/ome_seadragon | tools/delete_slides.py | tools/delete_slides.py | import requests
from argparse import ArgumentParser
import os
from shutil import rmtree
import sys
from urlparse import urljoin
import logging
class SlidesDeleter(object):
def __init__(self, ome_base_url, slides_file_list, log_level='INFO', log_file=None):
self.ome_delete_url = urljoin(ome_base_url, 'mir... | mit | Python | |
998fdf69ce3fdb31b49a1446a68ad0004e02c9e5 | Fix conflicting migrations | masschallenge/django-accelerator,masschallenge/django-accelerator | accelerator/migrations/0100_update_program_model.py | accelerator/migrations/0100_update_program_model.py | # Generated by Django 2.2.28 on 2022-04-20 13:05
import sorl.thumbnail.fields
from django.db import (
migrations,
models,
)
class Migration(migrations.Migration):
dependencies = [
<<<<<<< HEAD:accelerator/migrations/0101_update_program_model.py
('accelerator', '0100_add_innovation_stage_model'),... | mit | Python | |
b5f495b6e1ee5f73af80ee659a6db49b80ce9564 | fix new revision | joehand/DataNews,joehand/DataNews | alembic/versions/346b3484b0c9_item_textcol_limit.py | alembic/versions/346b3484b0c9_item_textcol_limit.py | """item_textcol_limit
Revision ID: 346b3484b0c9
Revises: None
Create Date: 2013-09-01 19:42:02.730648
"""
# revision identifiers, used by Alembic.
revision = '346b3484b0c9'
down_revision = '55de89cf5a1'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - plea... | bsd-3-clause | Python | |
00d9baa484451a8ce59a928973a10ca14f163b71 | add a management command to unbounce an email | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/util/management/commands/unbounce_email.py | corehq/util/management/commands/unbounce_email.py | from django.core.management.base import BaseCommand
from corehq.util.models import (
BouncedEmail,
PermanentBounceMeta,
ComplaintBounceMeta,
)
class Command(BaseCommand):
help = "Check on the bounced status of an email"
def add_arguments(self, parser):
parser.add_argument('bounced_email'... | bsd-3-clause | Python | |
7578cef2d5006af632b45ce6b279d54253db3b5b | Add abstracted server and client library | the-raspberry-pi-guy/lidar | pi_approach/Libraries/serverxclient.py | pi_approach/Libraries/serverxclient.py | # Server and Client Abstraction Library
import socket
HOST = "userinterface.local"
PORT = 12345
class Server(object):
"""A server-serving class"""
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
def setup_server(self):
try:
Server.s.bind((HOST,PORT))
print "Bind success"
except socket.error:
... | mit | Python | |
cfa8c3561214ab60a6d275f79b543bc7718d423b | Create LongestCommonPrefix.py | lingcheng99/LeetCode | LongestCommonPrefix.py | LongestCommonPrefix.py | """
Write a function to find the longest common prefix string amongst an array of strings.
"""
class Solution(object):
def longestCommonPrefix(self, strs):
"""
:type strs: List[str]
:rtype: str
"""
if strs==[]:
return ''
if len(strs)==1:
retu... | mit | Python | |
96f260bc18cb4018e9e69bdd9fadb5e2df1876a7 | Create PathFinder-Client.py | networkingdvi/HPN-Scripting,rbatist/HPN-Scripting | PathFinder-Client.py | PathFinder-Client.py | #******************************************************************************
# MAC path finder - Client part
# equivalent to traceroute but based on MAC address
# Version: 1.0
# Revision history:
# 1.0 - 30/06/2014 : Initial coding (Yannick Castano, Hewlett-Packard)
#
# Pre-requisite: LLDP enables on all switch ... | mit | Python | |
a9efd01f22a4fe311b97bb6ef4f14e3abe1a5dc1 | Add script to sort results. This is useful for sorting by the "total_time" key. | symbooglix/boogie-runner,symbooglix/boogie-runner | analysis/sort-by.py | analysis/sort-by.py | #!/usr/bin/env python
"""
Sort a result list by a particular top level key.
The key must have a total order (e.g. strings, ints, floats)
"""
import argparse
import os
import logging
import pprint
import sys
import yaml
from br_util import FinalResultType, classifyResult
# HACK
_brPath = os.path.dirname(os.path.dirname... | bsd-3-clause | Python | |
18f8fe11495d2d99e6a5101826116937792d4c79 | Update vagrant external inventory file to handle multiple boxes, and --list and --host params. | thaim/ansible,thaim/ansible | plugins/inventory/vagrant.py | plugins/inventory/vagrant.py | #!/usr/bin/env python
"""
Vagrant external inventory script. Automatically finds the IP of the booted vagrant vm(s), and
returns it under the host group 'vagrant'
Example Vagrant configuration using this script:
config.vm.provision :ansible do |ansible|
ansible.playbook = "./provision/your_playbook.yml"
... | mit | Python | |
31512a9fbc08f8ef5a3f2294af02fb13b51845d4 | Create echobuild.py | geoffroygivry/CyclopsVFX-Polyphemus,geoffroygivry/CyclopsVFX-Polyphemus,geoffroygivry/CyclopsVFX-Polyphemus,geoffroygivry/CyclopsVFX-Polyphemus,geoffroygivry/CyclopsVFX-Polyphemus | echobuild.py | echobuild.py | print("Build passed. Please do run python cyclops.py to get CyclopsVFX Polyphemus started.")
| mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.