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 |
|---|---|---|---|---|---|---|---|---|
3c2c6002cf25dab301044f2dc4c2c3bbd99e121e | add script file | m4b/get-polymer-imports | get-polymer-imports.py | get-polymer-imports.py | #!/usr/bin/env python
import os
import sys
#rootDir = "bower_components"
numArgs = len(sys.argv)
if numArgs <= 1:
print 'usage: get_all_imports.py <bower_components directory> [prefix (default "..")]'
exit(1)
rootDir = sys.argv[1]
if not (rootDir == "bower_components" or rootDir == "components"):
prin... | mit | Python | |
30dcfef191666951a4084a4b9d9c135c9edb5de8 | Create check.py | password123456/check_ssl_chain_certificate | check.py | check.py | # -*- coding: utf-8 -*-
__author__ = 'https://github.com/password123456/'
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import requests
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\03... | apache-2.0 | Python | |
0b9810227b91b7ee7bb58cee2dccec992c752768 | add xmpp plugin | melmothx/jsonbot,melmothx/jsonbot,melmothx/jsonbot | gozerlib/plugs/xmpp.py | gozerlib/plugs/xmpp.py | # gozerlib/plugs/xmpp.py
#
#
""" xmpp related commands. """
## gozerlib imports
from gozerlib.commands import cmnds
from gozerlib.examples import examples
from gozerlib.fleet import fleet
## commands
def handle_xmppinvite(bot, event):
""" invite (subscribe to) a different user. """
if not event.rest:
... | mit | Python | |
e1fad0e5759908b3c1f6d3bafa2110cb4c26b7e1 | Add get_jpp_env command... | tamasgal/km3pipe,tamasgal/km3pipe | km3pipe/shell.py | km3pipe/shell.py | # coding=utf-8
# cython: profile=True
# Filename: shell.py
# cython: embedsignature=True
# pylint: disable=C0103
"""
Some shell helpers
"""
from __future__ import division, absolute_import, print_function
import os
from .logger import logging
__author__ = "Tamas Gal"
__copyright__ = "Copyright 2016, Tamas Gal and t... | mit | Python | |
1360a7031d4389f2ecdef24ce3190a88e5f8f794 | add trivial pjit tests | google/jax,tensorflow/probability,google/jax,google/jax,tensorflow/probability,google/jax | tests/pjit_test.py | tests/pjit_test.py | # Copyright 2018 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 | Python | |
a8d359fd91cb6e92a034703d6203a2997b28c965 | Add utility to augment jsdoc with @method tag. | ohsu-qin/qiprofile,ohsu-qin/qiprofile,ohsu-qin/qiprofile,ohsu-qin/qiprofile | tools/yuimethod.py | tools/yuimethod.py | #!/usr/bin/env python
"""
Adds the @method tag to method comment blocks.
"""
import sys
import os
import re
import argparse
COMMENT_START_REGEX = re.compile('^(\s*)(/\*|###)\*\s*$')
COMMENT_END_REGEX = re.compile('^\s*(\*/|###)\s*$')
COMMENT_TAG_REGEX = re.compile('^\s*\* @(\w+).*$')
METHOD_REGEX = re.compile('^\s... | bsd-2-clause | Python | |
7c1b0d4efd000fee8f065f2f5815075833811331 | Change file location and rename | sibis-platform/ncanda-data-integration,sibis-platform/ncanda-data-integration | scripts/reporting/svn_report.py | scripts/reporting/svn_report.py | '''
This file creates a .csv file containing the name of each laptop and its last changed date
'''
import argparse
import csv
from datetime import datetime, timezone
import os
import svn.local
import pandas as pd
'''
Constants -- paths for reports, default save names, SLA, columns, and sites
TO-DO: Change SLA_DAYS to ... | bsd-3-clause | Python | |
f3f363e8911d3a635d68c7dbe767ee2585ed4f36 | Check for duplicates based on coordinates and select only one database (EU/NASA) | DanielAndreasen/SWEET-Cat | checkDuplicates.py | checkDuplicates.py | import pandas as pd
from astropy import coordinates as coord
from astropy import units as u
class Sweetcat:
"""Load SWEET-Cat database"""
def __init__(self):
self.fname_sc = 'WEBSITE_online_EU-NASA_full_database.rdb'
# Loading the SweetCat database
self.readSC()
def read... | mit | Python | |
485bbe732dfb8539ffaf017f3a005896a7f3e503 | create subhash module | coblo/isccbench | iscc_bench/imageid/subhash.py | iscc_bench/imageid/subhash.py | # -*- coding: utf-8 -*-
"""Test strategy with hashing mutiple shift invariant aligned patches
See: https://stackoverflow.com/a/20316789/51627
"""
def main():
pass
if __name__ == '__main__':
main()
| bsd-2-clause | Python | |
1742beec320d40e7859ea6f3b72e5fb3a7d1a51e | add flask hello world | jbothma/municipal-data,Code4SA/municipal-data,jbothma/municipal-data,jbothma/municipal-data,jbothma/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data | hello.py | hello.py | from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run()
| mit | Python | |
f2b329d5ab98cfd1c1e9a9c28e373e1411a78967 | Convert text/plain to multipart/alternative | dahlbaek/Ubuntu-dotfiles | home/bin/parse_mail.py | home/bin/parse_mail.py | #!/usr/bin/python3
import email
from email import policy
import pypandoc
import fileinput
import subprocess
from email import charset
# use 8bit encoded utf-8 when applicable
charset.add_charset('utf-8', charset.SHORTEST, '8bit')
# read email
stdin_lines = []
with fileinput.input(["-"]) as stdin:
msg = email.mes... | mit | Python | |
3fabca45d6071c7fe333050264e8b92f23336c12 | fix type | scienceopen/airtools,scienceopen/pyAIRtools,scienceopen/airtools | kaczmarz.py | kaczmarz.py | import numpy as np
#import matplotlib.pyplot as plt
def kaczmarz_ART(A,b,maxIter=8,x0=None,lambdaRelax=1,stopmode=None,taudelta=0,nonneg=True,dbglvl=0):
# TODO: add randomized ART, and other variants
# Michael Hirsch May 2014
# GPL v3+ license
#
# inputs:
# A: M x N 2-D projection matrix
#... | bsd-3-clause | Python | |
ef192ebd7679b96317cc6d878fb82c925787710d | Add Pattern based filterer. | 4degrees/sawmill,4degrees/mill | source/bark/filterer/pattern.py | source/bark/filterer/pattern.py | # :coding: utf-8
# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
# :license: See LICENSE.txt.
import re
from .base import Filterer
class Pattern(Filterer):
'''Filter logs using pattern matching.'''
INCLUDE, EXCLUDE = ('include', 'exclude')
def __init__(self, pattern, key='name', mode=INCLUDE... | apache-2.0 | Python | |
bcd485f240a7eb6373f847d6cc9dd07ebd2c3ef2 | add test case for redeem of default coupon (user limit=1, not bound to user) | rsalmaso/django-fluo-coupons,rsalmaso/django-fluo-coupons | coupons/tests/test_use_cases.py | coupons/tests/test_use_cases.py | from datetime import datetime
from django.contrib.auth.models import User
from django.utils import timezone
from django.test import TestCase
from coupons.forms import CouponForm
from coupons.models import Coupon
class DefaultCouponTestCase(TestCase):
def setUp(self):
self.user = User.objects.create(user... | bsd-3-clause | Python | |
424d7107944f3ecb8ebf78a62dc35428952b380b | add reindex script | fritz0705/lglass | contrib/reindex.py | contrib/reindex.py | #!/bin/python
# coding: utf-8
import signal
import argparse
from datetime import datetime
argparser = argparse.ArgumentParser()
argparser.add_argument("--database-type", "-T", choices=["nic", "ipam"],
default="nic")
argparser.add_argument("database")
args = argparser.parse_args()
if args.database_type == "ni... | mit | Python | |
65a1c06b6e5d7ec37ac232ab048b3cc541b75a45 | refactor Coupon | Go-In/go-coup,Go-In/go-coup,Go-In/go-coup,Go-In/go-coup,Go-In/go-coup | customermanage/models/Coupon.py | customermanage/models/Coupon.py | from django.db import models
from storemanage.models.Currency import Currency
from storemanage.models.Ticket import Ticket
from django.contrib.auth.models import User
from django.contrib.postgres.fields import JSONField
# Create your models here.
class Coupon(models.Model):
ticket = models.ForeignKey(Ticket, on_de... | mit | Python | |
837dc69a430161f6b942b629793ec1d37db780d4 | Create virtool.db.settings | igboyes/virtool,igboyes/virtool,virtool/virtool,virtool/virtool | virtool/db/settings.py | virtool/db/settings.py | import logging
import pymongo.errors
logger = logging.getLogger(__name__)
async def initialize(db):
try:
await db.settings.insert_one({
"_id": "settings",
"enable_sentry": {"type": "boolean", "default": True},
"sample_group": "none",
"sample_group_read": Tr... | mit | Python | |
094020855126721827342da98992a8c057d1a135 | fix memory benchmark for reference builds. | pozdnyakov/chromium-crosswalk,timopulkkinen/BubbleFish,bright-sparks/chromium-spacewalk,ltilve/chromium,krieger-od/nwjs_chromium.src,hujiajie/pa-chromium,Just-D/chromium-1,Chilledheart/chromium,fujunwei/chromium-crosswalk,chuan9/chromium-crosswalk,Chilledheart/chromium,axinging/chromium-crosswalk,dushu1203/chromium.src... | tools/perf/perf_tools/memory_benchmark.py | tools/perf/perf_tools/memory_benchmark.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.
from telemetry import multi_page_benchmark
MEMORY_HISTOGRAMS = [
{'name': 'V8.MemoryExternalFragmentationTotal', 'units': 'percent'},
{'name': 'V... | # 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.
from telemetry import multi_page_benchmark
MEMORY_HISTOGRAMS = [
{'name': 'V8.MemoryExternalFragmentationTotal', 'units': 'percent'},
{'name': 'V... | bsd-3-clause | Python |
4e797dd9c8b43ab62f70b0515dee9e6b5c17d043 | Create secret.py | toms3t/Propalyzer,toms3t/Propalyzer,toms3t/Propalyzer | propalyzer_site/propalyzer_site/secret.py | propalyzer_site/propalyzer_site/secret.py | class Secret():
SECRET_KEY = ''
| mit | Python | |
3d8fe5cfc64c3667f938fa221353489846a9aeb0 | Add test of F.diagonal | tkerola/chainer,pfnet/chainer,keisuke-umezawa/chainer,chainer/chainer,ktnyt/chainer,okuta/chainer,hvy/chainer,ktnyt/chainer,niboshi/chainer,wkentaro/chainer,jnishi/chainer,hvy/chainer,niboshi/chainer,rezoo/chainer,ronekko/chainer,okuta/chainer,jnishi/chainer,okuta/chainer,jnishi/chainer,niboshi/chainer,hvy/chainer,chai... | tests/chainer_tests/functions_tests/array_tests/test_diagonal.py | tests/chainer_tests/functions_tests/array_tests/test_diagonal.py | import unittest
import numpy
import chainer
from chainer.backends import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
@testing.parameterize(*testing.product_dict(
[
{'shape': (2, 4, 6), 'args': (1, 2, 0)},
{'sha... | mit | Python | |
254564ceb905dc512693febed44e908c27f249ce | Add tests for cupyx.scipy.ndimage.label | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | tests/cupyx_tests/scipy_tests/ndimage_tests/test_measurements.py | tests/cupyx_tests/scipy_tests/ndimage_tests/test_measurements.py | import unittest
import numpy
from cupy import testing
import cupyx.scipy.ndimage # NOQA
try:
import scipy.ndimage # NOQA
except ImportError:
pass
def _generate_binary_structure(rank, connectivity):
if connectivity < 1:
connectivity = 1
if rank < 1:
return numpy.array(True, dtype=b... | mit | Python | |
2a6907ddf9c7b5df2e1b59c8feeb0fa4bd4b5752 | add rudimentary validation tests for azure | sonchang/validation-tests,rancherio/validation-tests,wlan0/validation-tests,aruneli/validation-tests,cjellick/validation-tests,rancher/validation-tests,hibooboo2/validation-tests,wlan0/validation-tests,sangeethah/validation-tests,aruneli/validation-tests,sonchang/validation-tests,rancher/validation-tests,hibooboo2/vali... | tests/validation/cattlevalidationtest/core/test_machine_azure.py | tests/validation/cattlevalidationtest/core/test_machine_azure.py | import logging
from common_fixtures import * # NOQA
DEFAULT_TIMEOUT = 900
subscription_id = os.environ.get('AZURE_SUBSCRIPTION_ID')
subscription_cert = os.environ.get('AZURE_SUBSCRIPTION_CERT')
# Use azure settings from environment variables , if set
i = 'b39f27a8b8c64d52b05eac6a62ebad85__'
i = i + 'Ubuntu-14_04_1... | apache-2.0 | Python | |
e9091be4ae9ddf0cb83bd7535c4ced5bb2d691d2 | add config_edit.py | wijjo/scripts,wijjo/scripts | castiron/lib/castiron/actions/config_edit.py | castiron/lib/castiron/actions/config_edit.py | from castiron.tools import Action, register_actions
import os
import re
class G:
all_edits = []
def _file_contains_re(runner, path, contains_re):
real_path = os.path.realpath(os.path.expanduser(path))
if os.path.exists(real_path):
with open(real_path) as f:
for line in f:
... | apache-2.0 | Python | |
99430e9f51eccb79f32af49bedfb28ba5f39cd09 | update : minor changes | black-perl/ptop | ptop/plugins/system_sensor.py | ptop/plugins/system_sensor.py | '''
System sensor plugin
Generates the basic system info
'''
from ptop.core import Plugin
import psutil, socket, getpass
import datetime, time
class SystemSensor(Plugin):
def __init__(self,**kwargs):
super(SystemSensor,self).__init__(**kwargs)
# overriding the update method
def update(sel... | mit | Python | |
ded21520c1fde89336480b48387d383a2e449c2a | Write test for array | cupy/cupy,wkentaro/chainer,laysakura/chainer,cemoody/chainer,kikusu/chainer,t-abe/chainer,ktnyt/chainer,cupy/cupy,niboshi/chainer,hvy/chainer,benob/chainer,okuta/chainer,kashif/chainer,rezoo/chainer,jnishi/chainer,chainer/chainer,ytoyama/yans_chainer_hackathon,niboshi/chainer,tscohen/chainer,chainer/chainer,jnishi/chai... | tests/chainer_tests/utils_tests/test_array.py | tests/chainer_tests/utils_tests/test_array.py | import unittest
import numpy
from chainer import cuda
from chainer.utils import array
from chainer.testing import attr
class TestFullLike(unittest.TestCase):
def test_full_like_cpu(self):
x = numpy.array([1, 2], numpy.float32)
y = array.full_like(x, 3)
self.assertIsInstance(y, numpy.nda... | mit | Python | |
f4260ad3e652a09922395e64d29bcf8f96ee12bc | Add test_colormap.py | talespaiva/folium,shankari/folium,QuLogic/folium,python-visualization/folium,BibMartin/folium,ocefpaf/folium,QuLogic/folium,talespaiva/folium,BibMartin/folium,shankari/folium,talespaiva/folium,talespaiva/folium,BibMartin/folium,QuLogic/folium,shankari/folium,python-visualization/folium,ocefpaf/folium | tests/test_colormap.py | tests/test_colormap.py | # -*- coding: utf-8 -*-
""""
Folium Colormap Module
----------------------
"""
import folium.colormap as cm
def test_simple_step():
step = cm.StepColormap(['green','yellow','red'], vmin=3., vmax=10., index=[3,4,8,10], caption='step')
step = cm.StepColormap(['r','y','g','c','b','m'])
step._repr_html_()
def... | mit | Python | |
dd65fb84e41b11f8d97e3862d00137969589ab4b | integrate greenify | alex8224/gTornado,zhu327/greentor | tests/test_greenify.py | tests/test_greenify.py | from __future__ import absolute_import
import sys
import time
import greenify
greenify.greenify()
import pylibmc
import random
from tornado.ioloop import IOLoop
from tornado.gen import coroutine
from gtornado import green
greenify.patch_lib("/usr/lib/x86_64-linux-gnu/libmemcached.so")
def call_mc(i):
mc = pylibmc... | mit | Python | |
7401d1ecd6b3323b266cf02eabd42a2c4e40d988 | Add initial tests for test module | timothycrosley/hug,timothycrosley/hug,timothycrosley/hug | tests/test_test.py | tests/test_test.py | """tests/test_test.py.
Test to ensure basic test functionality works as expected.
Copyright (C) 2019 Timothy Edmund Crosley
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, i... | mit | Python | |
925da64adf0b74ba18eb78acd9127e3a6dc6f903 | Add test cases for reported issues | pjwerneck/pyrql | tests/test_reported.py | tests/test_reported.py | # -*- coding: utf-8 -*-
from pyrql import parse
CMP_OPS = ['eq', 'lt', 'le', 'gt', 'ge', 'ne']
class TestReportedErrors:
def test_like_with_string_parameter(self):
expr = 'like(name,*new jack city*)'
rep = {'name': 'like', 'args': ['name', '*new jack city*']}
pd = parse(expr)
... | mit | Python | |
e61c6eb5b5a9f6f70df036dcfedf552325a6e9bd | move unit test syn import to pytest fixture | thomasyu888/synapsePythonClient | tests/unit/conftest.py | tests/unit/conftest.py | import logging
import pytest
from synapseclient import Synapse
from synapseclient.core.logging_setup import SILENT_LOGGER_NAME
"""
pytest unit test session level fixtures
"""
@pytest.fixture(scope="session")
def syn():
"""
Create a Synapse instance that can be shared by all tests in the session.
"""
... | apache-2.0 | Python | |
182762812cb1945dd2b50c21b34609be00b7bf45 | Create wordlist_add_digits.py | Matir/analysis-tools | wordlist_add_digits.py | wordlist_add_digits.py | #!/usr/bin/env python
#Adds 4digits to the end of the common word lists
import os, sys
class Wordlist_Add_Digits():
def add_digits(self, wordlist, outfile):
#File to start with
file=wordlist
#Output file
out=open(outfile, 'w')
#Start loop of 0000-9999 added to each word
with open(file) as f:
content ... | mit | Python | |
da3e9d5f7ffeae68ef7ae3b07247a9f6cb16d40d | Create get_user_statuses.py | RRSCDS/douban-mining | src/Python/get_user_statuses.py | src/Python/get_user_statuses.py | import sys
import urllib2
import time
import re
from lxml import html
def get_user_statuses(userid):
reached_end = False
i = 1
saying_list = []
while not reached_end:
page_url = "http://www.douban.com/people/%s/statuses?p=%d" % (userid, i)
# TODO: User login. Results limited to the first 10 pag... | mit | Python | |
c0637f482a95dd7ec02bb7b85bc8d164c0a80585 | add missing check_headers tool | pybee/Python-Android-support,dongguangming/python-for-android,ravsa/python-for-android,eHealthAfrica/python-for-android,kivy/python-for-android,Cheaterman/python-for-android,Cheaterman/python-for-android,kivy/python-for-android,codingang/python-for-android,manashmndl/python-for-android,dongguangming/python-for-android,... | tools/check_headers.py | tools/check_headers.py | #!/usr/bin/env python2
import sys
from os import unlink
from os.path import exists
HEADERS = ('Content-Disposition', 'Content-Length', 'Content-Type',
'ETag', 'Last-Modified')
def is_sig_header(header):
header = header.lower()
for s in HEADERS:
if header.startswith(s.lower()):
... | mit | Python | |
3e5105218976549a0a782f179bb358edfd4e89c9 | Add load_tests / __init__.py to the azure/cli/tests module to allow for simpler unit test discovery | samedder/azure-cli,samedder/azure-cli,QingChenmsft/azure-cli,yugangw-msft/azure-cli,samedder/azure-cli,samedder/azure-cli,yugangw-msft/azure-cli,yugangw-msft/azure-cli,yugangw-msft/azure-cli,yugangw-msft/azure-cli,QingChenmsft/azure-cli,QingChenmsft/azure-cli,QingChenmsft/azure-cli,yugangw-msft/azure-cli,BurtBiel/azure... | src/azure/cli/tests/__init__.py | src/azure/cli/tests/__init__.py | from .test_argparse import Test_argparse
from unittest import TestSuite
test_cases = [Test_argparse]
def load_tests(loader, tests, pattern):
suite = TestSuite()
for testclass in test_cases:
tests = loader.loadTestsFromTestCase(testclass)
suite.addTests(tests)
return suite
| mit | Python | |
f91d666cc06f5db48bea43de29ca4153e58c473d | add test for os platform check | marshki/pyWipe,marshki/pyWipe | check.py | check.py | #!/bin/py
import os
import sys
def osCheck():
""" Check if OS is 'UNIX-like' """
if not sys.platform.startswith('linux') or sys.platform.startswith('darwin'):
# if not sys.platform.startswith('darwin'):
print("This program was designed for UNIX-like systems. Exiting.")
sys.exit()
osChe... | mit | Python | |
ba82331fa694ec26c7f0108451abf3912b5a37ff | Reimplement deprecated (1.6) _is_ignorable_404 | beniwohli/apm-agent-python,tarkatronic/opbeat_python,dirtycoder/opbeat_python,beniwohli/apm-agent-python,tarkatronic/opbeat_python,daikeren/opbeat_python,patrys/opbeat_python,daikeren/opbeat_python,ticosax/opbeat_python,beniwohli/apm-agent-python,dirtycoder/opbeat_python,patrys/opbeat_python,ticosax/opbeat_python,ticos... | opbeat/contrib/django/middleware/__init__.py | opbeat/contrib/django/middleware/__init__.py | """
opbeat.contrib.django.middleware
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2011-2012 Opbeat
Large portions are
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from django.conf import setti... | """
opbeat.contrib.django.middleware
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2011-2012 Opbeat
Large portions are
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from django.middleware.commo... | bsd-3-clause | Python |
92b572004264c69baed5cce721e20e1a830514f8 | add 'is_changed' filter | serge-name/myansible,serge-name/myansible,serge-name/myansible | filter_plugins/is_changed.py | filter_plugins/is_changed.py | class FilterModule(object):
''' A comment '''
def filters(self):
return {
'is_changed': self.is_changed,
}
def is_changed(self, input_value, key, value):
if type(input_value) is not dict:
raise TypeError, u"{} must be dict (got {})".format(input_value, str(t... | mit | Python | |
82cab3f91df9b4bb9f60e553d6b9e4ef431cb6ae | Add __init__.py | ra1fh/eppconvert | eppconvert/__init__.py | eppconvert/__init__.py | #
# Copyright (c) 2017 Ralf Horstmann <ralf@ackstorm.de>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUT... | isc | Python | |
2f9699d5088266aaa76dad1742f2432d78da9d3b | add validator class | biothings/biothings_explorer,biothings/biothings_explorer | biothings_explorer/resolve_ids/validator.py | biothings_explorer/resolve_ids/validator.py | from collections import defaultdict
from ..config_new import ID_RESOLVING_APIS
from ..exceptions.id_resolver import InvalidIDResolverInputError
from ..utils.common import getPrefixFromCurie
class Validator:
def __init__(self, user_input):
self.__user_input = user_input
self.__valid = defaultdict(... | apache-2.0 | Python | |
c69fdba07aa4228f3e708b49e7fef4d0143e7a13 | Add missing stats.py | voer-platform/vp.repo,voer-platform/vp.repo,voer-platform/vp.repo,voer-platform/vp.repo | vpr/tests/api_stats.py | vpr/tests/api_stats.py | from django.db import connection
SQL_COUNT = 'select count(id) from vpr_api_apirecord where %s=%s;'
def countValue(field, value, time_start=None, time_end=None):
cur = connection.cursor()
cur.execute(SQL_COUNT % (field, value))
return cur.fetchone()
| agpl-3.0 | Python | |
13addaf6e5a0423b632efcc4d16e3e5d864fdac3 | Create validate_csv_wd.py | rupendrab/py_unstr_parse | validate_csv_wd.py | validate_csv_wd.py | #!/usr/bin/env python3.5
import sys
import re
import os
import csv
def read_file(fname):
f = open(fname, 'r')
csv_reader = csv.reader(f, delimiter='~')
no_rows = 0
for row in csv_reader:
no_rows += 1
no_cols = len(row)
print("Row %d: columns = %d" % (no_rows, no_cols))
f.close()
print(".......... | mit | Python | |
6c4ef8298bbdf48f82d13fb25a0f3958237392f2 | Add nova client for retrieving instance information | rcritten/novajoin | novajoin/nova.py | novajoin/nova.py | # Copyright 2016 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... | apache-2.0 | Python | |
d53358a6a0a564a5b4982f7f3dfdfd1163d6a295 | Add test covering no RunStop for v2. | ericdill/databroker,ericdill/databroker | databroker/tests/test_v2/test_no_run_stop.py | databroker/tests/test_v2/test_no_run_stop.py | # This is a special test because we corrupt the generated data.
# That is why it does not reuse the standard fixures.
import tempfile
from suitcase.jsonl import Serializer
from bluesky import RunEngine
from bluesky.plans import count
from ophyd.sim import det
from databroker._drivers.jsonl import BlueskyJSONLCatalog
... | bsd-3-clause | Python | |
ace782a3f4c616f9e22e1a1ce29f053b71391845 | Add missing migration for column description. | pbs/django-cms,pbs/django-cms,pbs/django-cms,pbs/django-cms | cms/migrations/0002_update_template_field.py | cms/migrations/0002_update_template_field.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('cms', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='page',
name='template',
... | bsd-3-clause | Python | |
c1e76dbdf07e67d98814d6f357a70c692af3a31d | Add first pass at db router | sloria/osf.io,cslzchen/osf.io,laurenrevere/osf.io,erinspace/osf.io,CenterForOpenScience/osf.io,leb2dg/osf.io,cwisecarver/osf.io,adlius/osf.io,Johnetordoff/osf.io,acshi/osf.io,monikagrabowska/osf.io,mfraezz/osf.io,Johnetordoff/osf.io,monikagrabowska/osf.io,binoculars/osf.io,Nesiehr/osf.io,HalcyonChimera/osf.io,mfraezz/o... | osf/db/router.py | osf/db/router.py | from django.conf import settings
import psycopg2
CACHED_MASTER = None
class PostgreSQLFailoverRouter(object):
"""
1. CHECK MASTER_SERVER_DSN @ THREAD LOCAL
2. THERE?, GOTO 9
3. GET RANDOM_SERVER FROM `settings.DATABASES`
4. CONNECT TO RANDOM_SERVER
5. IS MASTER SERVER?
6. YES? GOTO 8
... | apache-2.0 | Python | |
aca6b8b4cd221efca6d3a5f59f96b73d70e65714 | test integration against scipy | adrn/gala,adrn/gary,adrn/gary,adrn/gala,adrn/gary,adrn/gala | gary/integrate/tests/test_1d.py | gary/integrate/tests/test_1d.py | # coding: utf-8
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os
import time
import logging
# Third-party
import numpy as np
from astropy import log as logger
from scipy.integrate import simps
# Project
from ..simpsgauss import simpson
logg... | mit | Python | |
ca002a18b7e392bbdca9d7e0ed8c39739dc5b4a3 | Add code to get 99th percentile absolute pointing for POG | sot/aimpoint_mon,sot/aimpoint_mon | pog_absolute_pointing.py | pog_absolute_pointing.py | import numpy as np
from Chandra.Time import DateTime
import plot_aimpoint
# Get 99th percential absolute pointing radius
plot_aimpoint.opt = plot_aimpoint.get_opt()
asols = plot_aimpoint.get_asol()
# Last six months of data
asols = asols[asols['time'] > DateTime(-183).secs]
# center of box of range of data
mid_dy = (... | bsd-2-clause | Python | |
874da8664a6ee62937fb859665e17c035a66324b | add utils | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | custom/enikshay/management/commands/utils.py | custom/enikshay/management/commands/utils.py | from __future__ import print_function
import csv
import datetime
from django.core.management import BaseCommand
from casexml.apps.case.mock import CaseFactory
from casexml.apps.case.xform import get_case_updates
from corehq.form_processor.interfaces.dbaccessors import CaseAccessors
from custom.enikshay.case_utils ... | bsd-3-clause | Python | |
fa28e80dc7aeed1eb4fb0a18126a2f8105d5a5d2 | Create Cleverbot.py | alexsiri7/jasper-module-cleverbot | Cleverbot.py | Cleverbot.py | mport re
import cleverbot
import traceback
WORDS = ["CLEVERBOT", "BOT"]
PATTERN = r"\b(cleverbot|bot)\b"
def handle(text, mic, profile):
"""
Responds to user-input, typically speech text, starting a conversation with cleverbot
Arguments:
text -- user-input, typically transcribed speech
... | mit | Python | |
405dfc9a0a814001961e4090be83a3da4a4d4369 | Copy in constants file from master | architecture-building-systems/CityEnergyAnalyst,architecture-building-systems/CityEnergyAnalyst,architecture-building-systems/CityEnergyAnalyst | cea/technologies/constants.py | cea/technologies/constants.py | """
Constants used throughout the cea.technologies package.
History lesson: This is a first step at removing the `cea.globalvars.GlobalVariables` object.
"""
# Heat Exchangers
U_cool = 2500.0 # W/m2K
U_heat = 2500.0 # W/m2K
dT_heat = 5.0 # K - pinch delta at design conditions
dT_cool = 2.0 # K - pinch delta a... | mit | Python | |
656cf2955510151675dfb4acae4e92e21021a6b5 | Add the Course of LiaoXueFeng | MiracleWong/PythonBasic,MiracleWong/PythonBasic | LiaoXueFeng/function.py | LiaoXueFeng/function.py | def fact(n):
if n==1:
return 1
return n * fact(n - 1)
print fact(10)
| mit | Python | |
7a8250e6640c8ebf36cd159607da24b095cf708e | Create Fibonacci.py | MichaelAubry/Fusion360 | Fibonacci.py | Fibonacci.py | #Author-Michael Aubry
#Description-This script outputs a spiraling fibinacci sequence onto a Fusion 360 sketch
import adsk.core, adsk.fusion
app= adsk.core.Application.get()
design = app.activeProduct
ui = app.userInterface;
#**User Inputs**
Steps = 15 #How many steps of Fibonacci would you like to plot?
Length = 2... | mit | Python | |
85c02da33f5e9ed4ef1e72bef3cec094ca8cf4d5 | add DBMetric class that holds data that has to be recorded | djangothon/django-db-meter,djangothon/django-db-meter,djangothon/django-db-meter | django_db_meter/message.py | django_db_meter/message.py | import datetime
import cPickle as pickle
import pylzma
import json
from collections import namedtuple
from django.core.serializers import serialize, deserialize
from django.conf import settings
from core.log import sclient
from core.utils import run_async
from newsfeed.activity import Actor, Target
from newsfeed.cons... | apache-2.0 | Python | |
b777872d1b06714f538dc8fb21b790de822b5a66 | Update Example folder | DiCarloLab-Delft/PycQED_py3,QudevETH/PycQED_py3,DiCarloLab-Delft/PycQED_py3,DiCarloLab-Delft/PycQED_py3 | examples/listing_instruments.py | examples/listing_instruments.py | import visa
rm = visa.ResourceManager()
rm.list_resources() | mit | Python | |
735c55d68d4831137255808042684733f93d5c18 | add iconv clone | The-Orizon/nlputils,The-Orizon/nlputils,The-Orizon/nlputils | iconv.py | iconv.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import locale
import argparse
import fileinput
preferredenc = locale.getpreferredencoding()
parser = argparse.ArgumentParser(
description="Convert encoding of given files from one encoding to another.")
parser.add_argument(
"-f", "--from-code", metava... | mit | Python | |
aa7f888605dee0a845a20e1c0869cc5061719151 | Add rtree spatial index class | evil-mad/plotink | plotink/rtree.py | plotink/rtree.py | # -*- coding: utf-8 -*-
# rtree.py
# part of plotink: https://github.com/evil-mad/plotink
#
# See below for version information
#
# Written by Michal Migurski https://github.com/migurski @michalmigurski
# as a contribution to the AxiDraw project https://github.com/evil-mad/axidraw/
#
# Copyright (c) 2022 Windell H. Osk... | mit | Python | |
56ca21d312f34b6a229fe6cdb720ccc96ef712a5 | add polysites2vcf | mathii/gdc | polysites2vcf.py | polysites2vcf.py | #This is for converting Shop Mallick's polysite format to vcf
#Probably only useful to you if you are working on the SGDP
#Very specific to this particular format.
from __future__ import division, print_function
import argparse, sys, pdb
#Remember, in eigenstrat, 2 means "2 ref copies"
CODES={
"A":"AA",
... | apache-2.0 | Python | |
72dcd6857f5f895f0fb9325681302f5875bc50ec | Add a new user-defined file | NSLS-II-CHX/ipython_ophyd,NSLS-II-CHX/ipython_ophyd | profile_collection/startup/31-capillaries.py | profile_collection/startup/31-capillaries.py | #6.342 mm apart
#6.074
def capillary6_in():
mov(diff.xh,12.41)
mov(diff.yh,-12.58)
def capillary7_in():
mov(diff.xh,6.075)
mov(diff.yh,-12.58)
def capillary8_in():
mov(diff.xh,-.26695)
mov(diff.yh,-12.58)
def capillary9_in():
mov(diff.xh,-6.609)
mov(diff.yh,-12.58)
def ... | bsd-2-clause | Python | |
f1ee6ce108626342b42a2d2a7b5aa4779af87e6c | Add python code to plot the histogram | chengluyu/SDU-Computer-Networks | plot-histogram.py | plot-histogram.py | import matplotlib.pyplot as plt
import sys
if __name__ == "__main__":
with open(sys.argv[1]) as f:
data = map(float, f.readlines())
plt.hist(list(data), 100)
plt.show()
| mit | Python | |
0852aa9328cf3fe2b975581f4e67357fc2c68f06 | add reprozip installation and trace cmd | kaczmarj/neurodocker,kaczmarj/neurodocker | neurodocker/interfaces/reprozip.py | neurodocker/interfaces/reprozip.py | """Add Dockerfile instructions to minimize container with ReproZip.
Project repository: https://github.com/ViDA-NYU/reprozip/
See https://github.com/freesurfer/freesurfer/issues/70 for an example of using
ReproZip to minimize Freesurfer's recon-all command.
"""
# Author: Jakub Kaczmarzyk <jakubk@mit.edu>
from __futu... | apache-2.0 | Python | |
c9f64c0e61fb08c43b1c8cb93ec6f9c389b9c31c | delete finished pods from cluster | Iwan-Zotow/runEGS | XcScripts/deletePods.py | XcScripts/deletePods.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import json
import shutil
import subprocess
import time
def ReadPodsToBeDeleted(fname):
"""
self explanatory
"""
listPods = []
with open(fname,'r') as f:
for line in f:
listPods.append(line.rstrip('\n'))
... | apache-2.0 | Python | |
375134eba8a7fa1cbf2ab5c94ae0976eebc65de9 | Solve Code Fights crazyball problem | HKuz/Test_Code | CodeFights/crazyball.py | CodeFights/crazyball.py | #!/usr/local/bin/python
# Code Fights Crazyball Problem
from itertools import combinations
def crazyball(players, k):
return sorted([sorted(list(l)) for l in combinations(players, k)])
def main():
tests = [
[["Ninja", "Warrior", "Trainee", "Newbie"], 3,
[["Newbie", "Ninja", "Trainee"], ... | mit | Python | |
e7bac459119e32cb79708ae7764a149dc22a1ed8 | add visitor.py from python svn (python 2.5 doesnt have it) | pyjs/pyjs,lancezlin/pyjs,pyjs/pyjs,minghuascode/pyj,pombredanne/pyjs,gpitel/pyjs,pyjs/pyjs,minghuascode/pyj,lancezlin/pyjs,pyjs/pyjs,anandology/pyjamas,Hasimir/pyjs,spaceone/pyjs,minghuascode/pyj,lancezlin/pyjs,Hasimir/pyjs,gpitel/pyjs,anandology/pyjamas,lancezlin/pyjs,anandology/pyjamas,anandology/pyjamas,gpitel/pyjs,... | pyjs/src/pyjs/visitor.py | pyjs/src/pyjs/visitor.py | # XXX should probably rename ASTVisitor to ASTWalker
# XXX can it be made even more generic?
class ASTVisitor:
"""Performs a depth-first walk of the AST
The ASTVisitor will walk the AST, performing either a preorder or
postorder traversal depending on which method is called.
methods:
preorder(tre... | apache-2.0 | Python | |
7da94fd5576f4c052e79a8068164c101054d5ae7 | Add Python / `requests` example | masterleague-net/api-examples | python/simple.py | python/simple.py | import requests # http://python-requests.org/
# Premium user authentication process and API access example
r = requests.post('https://api.masterleague.net/auth/token/', data={'username': 'user', 'password': '12345'})
if 'token' not in r.json():
print(r.text)
raise ValueError("Unable to extract authentication... | mit | Python | |
b4f2c7b8bde0d28f7d1b61718eb7cd0b9159f507 | add __version__ | harmslab/epistasis,Zsailer/epistasis | epistasis/__version__.py | epistasis/__version__.py | __version__ = "0.6.4"
| unlicense | Python | |
9498ac9ec27bbef1725b92e84a3b0d4c9e967aa6 | add ex14 | Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python | lpthw/ex14.py | lpthw/ex14.py | #!/usr/bin/env python
# Exercise 14: Prompting and Passing
from sys import argv
script, user_name = argv
prompt = '> '
print "Hi %s, I'm the %s script." % (user_name, script)
print "I'd like to ask you a few questions."
print "Do you like me %s?" % user_name
likes = raw_input(prompt)
print "Where do you live %s?" ... | mit | Python | |
1c8fd79c783ba6f21140b4c08bbf648bf5989dd4 | Add main module | HIIT/hybra-core,HIIT/hybra-core,HIIT/hybra-core,HIIT/hybra-core,HIIT/hybra-core | core/hybra.py | core/hybra.py | import data_loader
import descriptives
import network
import timeline
import wordclouds
def load_data( terms = [], data_folder = '' ):
if data_folder == '':
return load_all_data( terms )
else:
if '/' not in data_folder:
data_folder += '/'
loader = data_folder.split( '/' )[0... | mit | Python | |
0ec0398f8e50ed0adca426f9c468fd5154603941 | add mmd matrix example | deepmind/open_spiel,deepmind/open_spiel,deepmind/open_spiel,deepmind/open_spiel,deepmind/open_spiel,deepmind/open_spiel | open_spiel/python/examples/mmd_matrix_example.py | open_spiel/python/examples/mmd_matrix_example.py | """ Example of using MMD with dilated entropy
to solve for QRE in a Matrix Game """
from absl import app
from absl import flags
from open_spiel.python.algorithms import mmd_dilated
import pyspiel
FLAGS = flags.FLAGS
flags.DEFINE_integer("iterations", 1000, "Number of iterations")
flags.DEFINE_float("alpha", 0.1... | apache-2.0 | Python | |
eb2cbb45fd78c2e8accdaa6f8ba37ef1403159dd | Add brainfuck live shell | agwilt/python | bf/bf_cmd.py | bf/bf_cmd.py | #!/usr/bin/env python3
class BracketError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class Machine():
def __init__(self):
self.tape = [0]
self.p = 0
def run(self, code):
pc = 0
loop_stack = []
brackets = 0
printed = False
for instr in ... | mit | Python | |
3425d265c32d33c189710bcffd1d0df62ce27b3a | update model | freedomboxtwh/Plinth,jvalleroy/plinth-debian,harry-7/Plinth,vignanl/Plinth,vignanl/Plinth,kkampardi/Plinth,kkampardi/Plinth,kkampardi/Plinth,jvalleroy/plinth-debian,freedomboxtwh/Plinth,freedomboxtwh/Plinth,freedomboxtwh/Plinth,harry-7/Plinth,vignanl/Plinth,jvalleroy/plinth-debian,kkampardi/Plinth,jvalleroy/plinth-debi... | model.py | model.py | class User(dict):
""" Every user must have keys for a username, name, passphrase (this
is a bcrypt hash of the password), salt, groups, and an email address.
They can be blank or None, but the keys must exist. """
def __init__(self, dict=None):
for key in ['username', 'name', 'passphrase', 'salt... | class User(dict):
""" Every user must have keys for a username, name, passphrase (this
is a md5 hash of the password), groups, and an email address. They can be
blank or None, but the keys must exist. """
def __init__(self, dict=None):
for key in ['username', 'name', 'passphrase', 'email']:
... | agpl-3.0 | Python |
f95d7011ff89badfadbd07da0226f67f6dbd27a5 | Remove unused `organizations:new-tracebacks` flag. (#4083) | zenefits/sentry,gencer/sentry,JamesMura/sentry,JamesMura/sentry,fotinakis/sentry,looker/sentry,BuildingLink/sentry,JamesMura/sentry,JamesMura/sentry,BuildingLink/sentry,alexm92/sentry,mvaled/sentry,mvaled/sentry,ifduyue/sentry,beeftornado/sentry,beeftornado/sentry,jean/sentry,beeftornado/sentry,looker/sentry,looker/sen... | src/sentry/features/__init__.py | src/sentry/features/__init__.py | from __future__ import absolute_import
from .base import * # NOQA
from .handler import * # NOQA
from .manager import * # NOQA
default_manager = FeatureManager() # NOQA
default_manager.add('auth:register')
default_manager.add('organizations:api-keys', OrganizationFeature) # NOQA
default_manager.add('organization... | from __future__ import absolute_import
from .base import * # NOQA
from .handler import * # NOQA
from .manager import * # NOQA
default_manager = FeatureManager() # NOQA
default_manager.add('auth:register')
default_manager.add('organizations:api-keys', OrganizationFeature) # NOQA
default_manager.add('organization... | bsd-3-clause | Python |
bbfcddbb21a6b6f40fafe8c88ca76ab4a0b4667b | add script to analysis the flow map | chihyaoma/Activity-Recognition-with-CNN-and-RNN,chihyaoma/Activity-Recognition-with-CNN-and-RNN | FlowNet/flowAnalysis.py | FlowNet/flowAnalysis.py | # When the movement of the objects in the video is not distinct to be
# captured by optical flow algorithm, training this "noisy" flow map
# against the ground truth labeling is risky. In this code, we would
# like to iterate through all the generated flow videos, and filter
# out the noisy flow map.
#
#
# Contact: Chi... | mit | Python | |
629ccdc27d2eb3522def903cc42606e43c3f816b | Add script to write network related files | AdaptivePELE/AdaptivePELE,AdaptivePELE/AdaptivePELE,AdaptivePELE/AdaptivePELE,AdaptivePELE/AdaptivePELE | AdaptivePELE/analysis/writeNetworkFiles.py | AdaptivePELE/analysis/writeNetworkFiles.py | import os
import sys
import argparse
from AdaptivePELE.utilities import utilities
import matplotlib.pyplot as plt
def parseArguments():
desc = "Write the information related to the conformation network to file\n"
parser = argparse.ArgumentParser(description=desc)
parser.add_argument("clusteringObject", ty... | mit | Python | |
daa4565abe4059e8588ddf374fde0f51d9ec784e | Create a skeleton for node propagation integration tests | thiderman/network-kitten | test/integration/test_node_propagation.py | test/integration/test_node_propagation.py | class TestPropagation(object):
def test_node_propagation(self):
"""
Tests that check node propagation
1) Spin up four servers.
2) Make the first one send a sync request to all three others.
3) Count the numbers of requests made.
4) Check databases to see that they al... | mit | Python | |
5b9b27d98cad06f0bbd67026b6533dee7c218df7 | update series server code shifted from custom script to py file | saurabh6790/omnit-app,hatwar/Das_erpnext,suyashphadtare/vestasi-update-erp,indictranstech/tele-erpnext,saurabh6790/test-erp,gangadhar-kadam/smrterp,saurabh6790/test-med-app,saurabh6790/medsynaptic1-app,meisterkleister/erpnext,geekroot/erpnext,sagar30051991/ozsmart-erp,hatwar/Das_erpnext,gangadhar-kadam/sapphire_app,Tej... | setup/doctype/update_series/update_series.py | setup/doctype/update_series/update_series.py | # Please edit this list and import only required elements
import webnotes
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate,... | agpl-3.0 | Python | |
4eab434002c99daf9c302cb1007e7ec384453aae | Fix cherrypy example | ajdiaz/pyload,ajdiaz/pyload | examples/cherrypysample.py | examples/cherrypysample.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
import bottle
@bottle.get('/')
def index():
return {'key': 'value'}
bottle.run(port=8080, host="0.0.0.0", server="cherrypy")
| mit | Python | |
93e07841d961fb7956612339f13dfd4e8ddd8bac | Create RPi_Final.py | alexreed6899/RPI-Final-Proj. | RPi_Final.py | RPi_Final.py | from random import *
| mit | Python | |
2eba3f5072b547829964eac9d2d5b03076a49faf | add firmwareupdate sample | sakuraio/python-sakuraio | examples/firmwareupdate.py | examples/firmwareupdate.py | from sakuraio.hardware.rpi import SakuraIOGPIO
#from sakuraio.hardware.rpi import SakuraIOSMBus
import time
sakuraio = SakuraIOGPIO()
#sakuraio = SakuraIOSMBus()
sakuraio.unlock()
time.sleep(1)
sakuraio.update_firmware()
#print(sakuraio.get_firmware_version())
| mit | Python | |
16c57e5f3bd63667c7ca0b828e1f0fcd85d64b76 | Create SecureMSG.py | dwiktor/SecureMSG | SecureMSG.py | SecureMSG.py | #!/usr/python
#
# I dedicate this application for my best friend, Robert Niemiec :)
#
# Copyright (c) 2015 Dawid Wiktor
# This app is writed for all whistleblowers, journalists and
# cryptoanarchists. Use it when you need. Be carefull! NSA watchin'
#
# This is the Open Source Software. You can freely use it, edit cod... | mpl-2.0 | Python | |
522fb2e4b9fdf46abed3b5ca8ba43758b22253a1 | add missing file | mlaitinen/odoo,abdellatifkarroum/odoo,jesramirez/odoo,0k/odoo,eino-makitalo/odoo,vnsofthe/odoo,naousse/odoo,Maspear/odoo,VielSoft/odoo,Drooids/odoo,goliveirab/odoo,bkirui/odoo,grap/OpenUpgrade,minhtuancn/odoo,lsinfo/odoo,apanju/GMIO_Odoo,Antiun/odoo,OpenUpgrade/OpenUpgrade,sinbazhou/odoo,abstract-open-solutions/OCB,Ich... | addons/web/ir_module.py | addons/web/ir_module.py | from openerp.osv import osv
import openerp.wsgi.core as oewsgi
from common.http import Root
class ir_module(osv.Model):
_inherit = 'ir.module.module'
def update_list(self, cr, uid, context=None):
result = super(ir_module, self).update_list(cr, uid, context=context)
if tuple(result) != (0, 0)... | agpl-3.0 | Python | |
9c7d04b4eecb392b368e4b84a48197682ea63b8d | Add blackroom/python/auto-push.py | zhihaofans/Bilibili | blackroom/python/auto-push.py | blackroom/python/auto-push.py | #!/usr/bin/python3
# -*-coding:utf-8 -*-
# ProjectName:Bilibili小黑屋爬虫v2
# Author:zhihaofans
# Github:https://github.com/zhihaofans/Bilibili/tree/master/blackroom
# PythonVersion:3.x
import requests
import os
import json
import time
from bilibili import blackRoom
from zhihaofans import file as f
savePath = f.getUpPath(f... | apache-2.0 | Python | |
380a87e71c347eab5d9c5d22a255753e62e1d739 | Add the original game code to the files to show progress made during the week using classes and other skills | Baseyoyoyo/Higher-or-Lower,Baseyoyoyo/Higher-or-Lower | Original_python_game.py | Original_python_game.py | import random
GuessesTaken = 0
print ("Hello and welcome to my higher or lower number guessing game.")
print ("Whats your name?")
myName = input()
number = random.randint(1, 20)
number1 = random.randint(1, 20)
number2 = random.randint(1, 20)
number3 = random.randint(1, 20)
number4 = random.randint(1, 20)
number5 = r... | mit | Python | |
958e6ca0ba5be68802e61a450aeb2bf39ea5d5ba | Create psf2pdb.py | tmorrell/psf2pdb | psf2pdb.py | psf2pdb.py | import sys
pdbfile = open(sys.argv[1],'r')
psfile = open(sys.argv[2],'r')
inline = pdbfile.readline()
output = ''
while inline != 'END\n':
output = output + inline
inline = pdbfile.readline()
if inline == '': #sanity check
print "Error"
exit()
inline = psfile.readline().split()
while inli... | mit | Python | |
e73d16d4051c6bc66daf415d2da4e8d204a97004 | Add rainbow function | tryptochan/pymol-scripts | rainbow.py | rainbow.py | import re
import colorsys
from pymol import cmd
def rainbow(range_string):
"""
DESCRIPTION
Colors rainbow spectrum for a selection given in range string.
The difference between coloring in rainbow with built-in 'spectrum' is that
this relies on the segment order in range string (not alphabetically
... | mit | Python | |
cbaed7d194f4a91198fc097d4657ad327819af4b | Add new migration. | unt-libraries/django-invite,unt-libraries/django-invite | invite/migrations/0004_auto_20191126_1740.py | invite/migrations/0004_auto_20191126_1740.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.22 on 2019-11-26 17:40
from __future__ import unicode_literals
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('invite', '0003_abstract_invitation_auto_now_add'),
]
operations = [
... | bsd-3-clause | Python | |
47044317e4067fb38bf9e0fdb2e9c5f9ccb78053 | add migration | PokeAPI/pokeapi,PokeAPI/pokeapi,PokeAPI/pokeapi,PokeAPI/pokeapi | pokemon_v2/migrations/0006_auto_20200725_2205.py | pokemon_v2/migrations/0006_auto_20200725_2205.py | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("pokemon_v2", "0005_auto_20200709_1930"),
]
operations = [
migrations.AlterField(
model_name="pokemon",
name="height",
field=models.IntegerField(blank=Tru... | bsd-3-clause | Python | |
bad97abfe7fd93cefac10d46b5434b63cc7e3d2b | add line to end of file | keras-team/keras-contrib,keras-team/keras-contrib,farizrahman4u/keras-contrib,stygstra/keras-contrib,keras-team/keras-contrib | keras_contrib/constraints.py | keras_contrib/constraints.py | from __future__ import absolute_import
from . import backend as K
from keras.utils.generic_utils import get_from_module
from keras.constraints import *
class Clip(Constraint):
"""Clips weights to [-c, c].
# Arguments
c: Clipping parameter.
"""
def __init__(self, c=0.01):
self.c = c
... | from __future__ import absolute_import
from . import backend as K
from keras.utils.generic_utils import get_from_module
from keras.constraints import *
class Clip(Constraint):
"""Clips weights to [-c, c].
# Arguments
c: Clipping parameter.
"""
def __init__(self, c=0.01):
self.c = c
... | mit | Python |
d558ed9875cf99ebdf6915e7acd877fc7fae69f3 | Add missing migration | mysociety/yournextmp-popit,mysociety/yournextrepresentative,mysociety/yournextmp-popit,mysociety/yournextrepresentative,mysociety/yournextrepresentative,mysociety/yournextmp-popit,mysociety/yournextmp-popit,mysociety/yournextrepresentative,mysociety/yournextrepresentative,mysociety/yournextmp-popit | candidates/migrations/0028_auto_20160411_1055.py | candidates/migrations/0028_auto_20160411_1055.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('candidates', '0027_create_standard_complex_fields'),
]
operations = [
migrations.AlterField(
model_name='complex... | agpl-3.0 | Python | |
90a5242a93beda053ad91adca0728995232e23d2 | Create toggle_editor_text_console.py | satishgoda/learning,satishgoda/learning,satishgoda/learning,satishgoda/learning | cg/blender/scripts/toggle_editor_text_console.py | cg/blender/scripts/toggle_editor_text_console.py | import bpy
keyconfig = bpy.context.window_manager.keyconfigs.user
args = ('wm.context_set_enum', 'ESC', 'PRESS')
kwargs = {'shift':True}
for source, destination in (('Console', 'TEXT_EDITOR'), ('Text', 'CONSOLE')):
kmi = keyconfig.keymaps[source].keymap_items.new(*args, **kwargs)
properties = kmi.properties... | mit | Python | |
cb505bd4c86c39bd7ce575a7d72e4a3d33875b93 | Create polyDataMake.py | probml/pyprobml,probml/pyprobml,probml/pyprobml,probml/pyprobml | figureCode/polyDataMake.py | figureCode/polyDataMake.py | import numpy as np
from random import seed, getstate, setstate
def polyDataMake(n=21,deg=3,sampling='sparse'):
old_state = getstate()
seed(0)
if sampling == 'irregular':
xtrain = np.array([np.linspace(-1,-.5,6),np.linspace(3,3.5,6)]).reshape(-1,1)
elif sampling == 'sparse':
xtrain = np... | mit | Python | |
53dc0a5a1e8cc94dd23f6b6cfa1997f7b8b6f926 | call FSL NIDM export from command line | cmaumet/nidm-results_fsl,incf-nidash/nidmresults-fsl,jbpoline/nidm-results_fsl,incf-nidash/nidm-results_afni,cmaumet/nidmresults-fsl,incf-nidash/nidm-results_fsl,cmaumet/nidm-results_afni | nidm-results_fsl.py | nidm-results_fsl.py | #!/usr/bin/python
"""
Export neuroimaging results created with FSL feat following NIDM-Results
specification. The path to feat directory must be passed as first argument.
@author: Camille Maumet <c.m.j.maumet@warwick.ac.uk>
@copyright: University of Warwick 2013-2014
"""
import sys
import os
from fsl_exporter.fsl_ex... | mit | Python | |
775a86179c321ac3cab73c9556edaa798f4273fd | add PassiveTotal OneShotAnalytics | yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti | plugins/analytics/passive_total.py | plugins/analytics/passive_total.py | import requests
import json
from datetime import datetime
from core.analytics import OneShotAnalytics
from core.observables import Observable, Hostname
class PassiveTotal(OneShotAnalytics):
default_values = {
"name": "PassiveTotal Passive DNS",
"description": "Perform passive DNS (reverse) lookup... | apache-2.0 | Python | |
2bd913c6cad94f3bc244d92a1ae1caffda82dcf8 | Add humble plugin | thomasleese/smartbot-old,Cyanogenoid/smartbot,Muzer/smartbot,tomleese/smartbot | plugins/humble.py | plugins/humble.py | import lxml.html
import requests
from smartbot import utils
class Plugin:
def __call__(self, bot):
bot.on_respond(r"humble( weekly)?( sale)?", self.on_respond)
bot.on_help("humble", self.on_help)
def on_respond(self, bot, msg, reply):
page = requests.get("https://www.humblebundle.com/... | mit | Python | |
23ffdaf1ed0e1739975de058b9f8c1adeef15531 | Add "nice guy bot" strategy | HiccupinGminor/bidding-game | nicebotbot.py | nicebotbot.py | #!/bin/python
def calculate_bid(player,pos,first_moves,second_moves):
remaining = remaining_amount(player, first_moves, second_moves)
amortized_bid = remaining / steps_remaining(player, pos)
if(amortized_bid < 1):
amortized_bid = 1
default_bid = 14
last_first_bid = 0
... | mit | Python | |
48951aa7c2c82ca03e801e1bfce09be5492ce27b | Add python_analytics package | enthought/python-analytics | python_analytics/__init__.py | python_analytics/__init__.py | import logging
try: # pragma: no cover
from ._version import full_version as __version__
except ImportError: # pragma: no cover
__version__ = "not-built"
logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
| bsd-3-clause | Python | |
9fa9b339cb0da0ae6a4318288afd8c75e6890e4e | prepare for provider | RealGeeks/flask-oauthlib,Ryan-K/flask-oauthlib,PyBossa/flask-oauthlib,landler/flask-oauthlib,kevin1024/flask-oauthlib,lepture/flask-oauthlib,tonyseek/flask-oauthlib,Fleurer/flask-oauthlib,huxuan/flask-oauthlib,huxuan/flask-oauthlib,CoreyHyllested/flask-oauthlib,Ryan-K/flask-oauthlib,Fleurer/flask-oauthlib,cogniteev/fla... | flask_oauthlib/provider.py | flask_oauthlib/provider.py | # coding: utf-8
"""
Flask-OAuthlib
--------------
Implemnts OAuth2 provider support for Flask.
:copyright: (c) 2013 by Hsiaoming Yang.
"""
| bsd-3-clause | Python | |
f8e64d26c86e84ce9efe36db1155fdf5a4c6d5f8 | Add example to show of icons. | zoofIO/flexx,zoofIO/flexx,jrversteegh/flexx,jrversteegh/flexx | flexx/ui/examples/icons.py | flexx/ui/examples/icons.py | # doc-export: Icons
"""
This example demonstrates the use of icons in Flexx.
"""
import os
import flexx
from flexx import app, ui
# todo: support icons in widgets like Button, TabWidget, etc.
# todo: support fontawesome icons
class Icons(ui.Widget):
def init(self):
ui.Button(text='Not mu... | bsd-2-clause | Python | |
5e574a24d95e686bc2592af439e148e68036c61d | Add unit test for nova connector | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/unit/cloud/clouds/nova_test.py | tests/unit/cloud/clouds/nova_test.py | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Bo Maryniuk <bo@suse.de>`
'''
# Import Python libs
from __future__ import absolute_import
# Import Salt Testing Libs
from salttesting import TestCase
from salt.cloud.clouds import nova
from salttesting.mock import MagicMock, patch
from tests.unit.cloud.clouds impor... | apache-2.0 | Python | |
2b8ff3b38e4f8bdc9da30c7978062174b0259f76 | Add lc0068_text_justification.py | bowen0701/algorithms_data_structures | lc0068_text_justification.py | lc0068_text_justification.py | """Leetcode 68. Text Justification
Hard
URL: https://leetcode.com/problems/text-justification/
Given an array of words and a width maxWidth, format the text such that each line has
exactly maxWidth characters and is fully (left and right) justified.
You should pack your words in a greedy approach; that is, pack as m... | bsd-2-clause | Python | |
63a8f4af91048d0847cb7628f2ea15bb2b5f0e0a | Add abstract base classes to fs.archive | althonos/fs.archive | fs/archive/base.py | fs/archive/base.py | # coding: utf-8
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import io
import abc
import six
import shutil
import tempfile
from .. import errors
from ..base import FS
from ..proxy.writer import ProxyWriter
@six.add_metaclass(abc.ABCMeta)
class ArchiveSaver(object):
... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.