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 |
|---|---|---|---|---|---|---|---|---|
fe14781a46a60a4fdd0101468ae487a691a2154a | Add ontap_command.py Module (#44190) | thaim/ansible,thaim/ansible | lib/ansible/modules/storage/netapp/na_ontap_command.py | lib/ansible/modules/storage/netapp/na_ontap_command.py | #!/usr/bin/python
# (c) 2018, NetApp, 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
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | mit | Python | |
295afe540c24ded86353402d87c42e072f7a64fa | Initialize makePublicPrivateKeys | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/CrackingCodesWithPython/Chapter23/makePublicPrivateKeys.py | books/CrackingCodesWithPython/Chapter23/makePublicPrivateKeys.py | # Public Key Generator
# https://www.nostarch.com/crackingcodes/ (BSD Licensed)
import random, sys, os, primeNum, cryptomath
def main():
# Create a public/private keypair with 1024-bit keys:
print('Making key files...')
makeKeyFiles('al_sweigart', 1024)
print('Key files made.')
def generateKey(keySi... | mit | Python | |
3e97731449027e5ac0d3a047e1b872956feac528 | Create cracking-the-safe.py | tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015 | Python/cracking-the-safe.py | Python/cracking-the-safe.py | # Time: O(k^n)
# Space: O(k^n)
# There is a box protected by a password.
# The password is n digits, where each letter can be one of the first k digits 0, 1, ..., k-1.
#
# You can keep inputting the password,
# the password will automatically be matched against the last n digits entered.
#
# For example, assuming the... | mit | Python | |
9c2487ab2c3b8d12e5a5f0f179b2a1fd79496b17 | add tests | DOAJ/doaj,DOAJ/doaj,DOAJ/doaj,DOAJ/doaj | doajtest/unit/event_consumers/test_application_publisher_in_progress_notify.py | doajtest/unit/event_consumers/test_application_publisher_in_progress_notify.py | from portality import models
from portality import constants
from portality.bll import exceptions
from doajtest.helpers import DoajTestCase
from doajtest.fixtures import ApplicationFixtureFactory
import time
from portality.events.consumers.application_publisher_inprogress_notify import ApplicationPublisherInprogresNot... | apache-2.0 | Python | |
73ae4839941b802870eaba29b67c8b8a89e43c71 | add backend_service_migration script to call the migration handler | googleinterns/vm-network-migration | backend_service_migration.py | backend_service_migration.py | # Copyright 2020 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 | |
a1b88f50edf9f30f3840c50067545f2d315596aa | create compare.py | kumalee/python-101 | part-1/compare.py | part-1/compare.py | # coding: utf8
print '''
CPython implementation detail: Objects of different types except numbers are ordered by their type names; objects of the same types that don’t support proper comparison are ordered by their address.
>>> 5 < 'foo' # <type 'int'> < <type 'str'>
True
>>> 5 < (1, 2)
True
>>> 5 < {}
True
... | mit | Python | |
c7c4a3c68e4950049db4b113576cfa3b2f6748f5 | add test data | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/reports/tests/data/case_list_report_data.py | corehq/apps/reports/tests/data/case_list_report_data.py | dummy_user_list = [
{
'domain': 'case-list-test',
'username': 'active-worker-1',
'password': 'Some secret Pass',
'created_by': None,
'created_via': None,
'email': 'activeworker@commcarehq.com',
'uuid': 'active1',
'is_active': True,
'doc_type': ... | bsd-3-clause | Python | |
3f24e7b51281031fa9713b737a9647b305105a89 | Write unittest for parse_file() in ConfigReader.py | johnmarcampbell/twircBot | src/unittests.py | src/unittests.py | from ConfigReader import ConfigReader as cr
import unittest
import os
class testConfigReader(unittest.TestCase):
"""Test cases for configReader"""
def setUp(self):
"""Set up some important variables"""
self.example_config_filename = 'testConfig.config'
# Set some values
... | mit | Python | |
bbd6e538ec45c3650b7b3b7d520613fb4967236a | Print 4x4 grid | bandarji/lekhan | python/reddit/think_python_grid.py | python/reddit/think_python_grid.py | def grid():
delimiter_row = ('{}{}'.format('+ ', '- ' * 4) * 4) + '+'
openspace_row = ('{}{}'.format('|', ' ' * 9) * 4) + '|'
for box_row in range(4 * 4):
if box_row % 4 == 0:
print(delimiter_row)
print(openspace_row)
else:
print(openspace_row)
print(d... | apache-2.0 | Python | |
6e535a2d597f172d9342fb8a547335890c474b49 | Add a sample config file | byanofsky/playa-vista-neighborhood,byanofsky/playa-vista-neighborhood,byanofsky/playa-vista-neighborhood | src/config-sample.py | src/config-sample.py | FLASK_SECRET_KEY = 'Enter a Flask Secret Key'
# OAuth Credentials. You can find them on
# https://www.yelp.com/developers/v3/manage_app
YELP_CLIENT_ID = 'Enter Yelp Client ID'
YELP_CLIENT_SECRET = 'Enter Yelp Client Secret'
| mit | Python | |
7b545e210aa534b5d76e30769a125285cb40bfa8 | Create PrintFunctionBancorFormula.py | enjin/contracts | solidity/python/constants/PrintFunctionBancorFormula.py | solidity/python/constants/PrintFunctionBancorFormula.py | from math import factorial
MIN_PRECISION = 32
MAX_PRECISION = 127
NUM_OF_PRECISIONS = 128
NUM_OF_COEFS = 34
maxFactorial = factorial(NUM_OF_COEFS)
coefficients = [maxFactorial/factorial(i) for i in range(NUM_OF_COEFS)]
def fixedExpUnsafe(x,precision):
xi = x
res = safeMul(coefficients[0],1 << precision)
... | apache-2.0 | Python | |
8b0130ccb318f7f04daf8e8fa7532c88afb9f7c2 | convert eexec doctests into eexec_test.py | fonttools/fonttools,googlefonts/fonttools | Tests/misc/eexec_test.py | Tests/misc/eexec_test.py | from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
from fontTools.misc.eexec import decrypt, encrypt
def test_decrypt():
testStr = b"\0\0asdadads asds\265"
decryptedStr, R = decrypt(testStr, 12321)
assert decryptedStr == b'0d\nh\x15\xe8\xc4\xb2\x15\x1d\x108\... | mit | Python | |
9ea8b1ea9eaf7906abaf9cfe73bbe19b581fa562 | Add TVA. | divergentdave/inspectors-general,lukerosiak/inspectors-general | inspectors/tva.py | inspectors/tva.py | #!/usr/bin/env python
import datetime
import logging
import os
from urllib.parse import urljoin
from bs4 import BeautifulSoup
from utils import utils, inspector
# http://oig.tva.gov
# Oldest report: 1998
# options:
# standard since/year options for a year range to fetch from.
#
# Notes for IG's web team:
#
AUDIT... | cc0-1.0 | Python | |
6515e45e6d717ed2c84789a5d0941533465496b7 | update test | h2oai/h2o-3,mathemage/h2o-3,YzPaul3/h2o-3,michalkurka/h2o-3,YzPaul3/h2o-3,spennihana/h2o-3,mathemage/h2o-3,YzPaul3/h2o-3,h2oai/h2o-dev,spennihana/h2o-3,michalkurka/h2o-3,h2oai/h2o-dev,h2oai/h2o-3,spennihana/h2o-3,michalkurka/h2o-3,jangorecki/h2o-3,jangorecki/h2o-3,spennihana/h2o-3,mathemage/h2o-3,jangorecki/h2o-3,jango... | h2o-py/tests/testdir_munging/pyunit_insert_missing.py | h2o-py/tests/testdir_munging/pyunit_insert_missing.py | from builtins import zip
from builtins import range
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
def insert_missing():
# Connect to a pre-existing cluster
data = [[1, 2, 3, 1, 'a', 1, 9],
[1, 6, 4, 2, 'a', 1, 9],
[2, 3, 8, 6, 'b', 1, 9],
... | from builtins import zip
from builtins import range
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
def insert_missing():
# Connect to a pre-existing cluster
data = [[1, 2, 3, 1, 'a', 1, 9],
[1, 6, 4, 2, 'a', 1, 9],
[2, 3, 8, 6, 'b', 1, 9],
... | apache-2.0 | Python |
1de77375a12e26693c89f5fe824df82719bc8632 | Add dummy directory | prophile/jacquard,prophile/jacquard | jacquard/directory/dummy.py | jacquard/directory/dummy.py | from .base import Directory
class DummyDirectory(Directory):
def __init__(self, users=()):
self.users = {x.id: x for x in users}
def lookup(self, user_id):
return self.users[user_id]
def all_users(self):
return self.users.values()
| mit | Python | |
90eda86a7bbd1dc28023a6c5df1f964add3ddf55 | add client test for oaipmh endpoint. | DOAJ/doaj,DOAJ/doaj,DOAJ/doaj,DOAJ/doaj | test/oaipmh_client_test.py | test/oaipmh_client_test.py | import requests
from lxml import etree
NS = "{http://www.openarchives.org/OAI/2.0/}"
JOURNAL_BASE_URL = "http://localhost:5004/oai"
ARTICLE_BASE_URL = "http://localhost:5004/oai.article"
def harvest(base_url, resToken=None):
url = base_url + "?verb=ListRecords"
if resToken is not None:
url += "&resum... | apache-2.0 | Python | |
294f8721799f6562b7d7f3f31a68f25cb24c964f | Add Spanish Código Cuenta Corriente (CCC) | holvi/python-stdnum,holvi/python-stdnum,holvi/python-stdnum,arthurdejong/python-stdnum,arthurdejong/python-stdnum,arthurdejong/python-stdnum | stdnum/es/ccc.py | stdnum/es/ccc.py | # ccc.py - functions for handling Spanish CCC bank account code
# coding: utf-8
#
# Copyright (C) 2016 David García Garzón
# Copyright (C) 2016 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free... | lgpl-2.1 | Python | |
0ba3dff1e150d534e4eda086ebbd53ec3789d82c | Add alg_balance_symbols.py | bowen0701/algorithms_data_structures | alg_max_connected_colors.py | alg_max_connected_colors.py | def max_connected_colors():
pass
def main():
# A grid of connected colors: 5 (of 2's).
grid = [[1, 1, 2, 3],
[1, 2, 3, 2],
[3, 2, 2, 2]]
if __init__ == '__main__':
main()
| bsd-2-clause | Python | |
ce6052ee9df9ca83ac2da691eb51a8eaea0ab603 | Comment model migration | v1k45/blogghar,v1k45/blogghar,v1k45/blogghar | comments/migrations/0001_initial.py | comments/migrations/0001_initial.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-10 22:41
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('blog', ... | mit | Python | |
74260fbf266628d4f8afbbab61bbd6de0ddfe7fe | Remove unused constant | openstack/dragonflow,openstack/dragonflow,openstack/dragonflow | dragonflow/neutron/common/constants.py | dragonflow/neutron/common/constants.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | apache-2.0 | Python |
22298d91fff788c37395cdad9245b3e7ed20cfdf | Add a snippet (Python OpenCV). | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | python/opencv/opencv_2/images/display_image_with_matplotlib.py | python/opencv/opencv_2/images/display_image_with_matplotlib.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015 Jérémie DECOCK (http://www.jdhp.org)
"""
OpenCV - Display image: display an image given in arguments
Required: opencv library (Debian: aptitude install python-opencv)
See: https://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_gui/... | mit | Python | |
ba9e4c6b003cc002e5bc7216da960e47f9fe5424 | Print information about all nitrogens. | berquist/orcaparse | copper_imidazole_csv_allnitrogen.py | copper_imidazole_csv_allnitrogen.py | #!/usr/bin/env python2
import orca_parser
from copper_imidazole_analysis import CopperImidazoleAnalysis
import argparse
import csv
cia = CopperImidazoleAnalysis()
parser = argparse.ArgumentParser(description="Given pathnames of ORCA output files, make a dump of all nitrogen parameters to a CSV file.")
parser.add_ar... | mpl-2.0 | Python | |
eb0772fc6c30d98b83bf1c8e7d83af21066ae45b | Add peek method and implementation | Deepak345/al-go-rithms,Cnidarias/al-go-rithms,EUNIX-TRIX/al-go-rithms,ZoranPandovski/al-go-rithms,manikTharaka/al-go-rithms,Deepak345/al-go-rithms,manikTharaka/al-go-rithms,ZoranPandovski/al-go-rithms,Cnidarias/al-go-rithms,EUNIX-TRIX/al-go-rithms,manikTharaka/al-go-rithms,ZoranPandovski/al-go-rithms,EUNIX-TRIX/al-go-r... | data_structures/Stack/Python/Stack.py | data_structures/Stack/Python/Stack.py | # Author: AlexBanks97
# Purpose: LIFO Stack implementation using python array.
# Date: October 15th 2017
class Stack(object):
def __init__(self):
# Initialize stack as empty array
self.stack = []
# Return and remove the last element of the stack array.
def pop(self):
# If the stack... | # Author: AlexBanks97
# Purpose: LIFO Stack implementation using python array.
# Date: October 15th 2017
class Stack(object):
def __init__(self):
# Initialize stack as empty array
self.stack = []
# Return and remove the last element of the stack array.
def pop(self):
# If the stack... | cc0-1.0 | Python |
825c4d613915d43aea2e6ee0bc5d5b49ed0a4500 | Create a simple method to segment a trip into sections | shankari/e-mission-server,joshzarrabi/e-mission-server,joshzarrabi/e-mission-server,sunil07t/e-mission-server,yw374cornell/e-mission-server,e-mission/e-mission-server,e-mission/e-mission-server,yw374cornell/e-mission-server,yw374cornell/e-mission-server,sunil07t/e-mission-server,sunil07t/e-mission-server,shankari/e-mis... | emission/analysis/classification/segmentation/section_segmentation.py | emission/analysis/classification/segmentation/section_segmentation.py | # Standard imports
import attrdict as ad
import numpy as np
import datetime as pydt
# Our imports
import emission.analysis.classification.cleaning.location_smoothing as ls
import emission.analysis.point_features as pf
import emission.storage.decorations.location_queries as lq
def segment_into_sections(trip):
poin... | bsd-3-clause | Python | |
5f2cd26054adff5a1fbf9ba5d56766b972f46670 | Add a multithreaded stress tester for key generation. Hopefully provides additional confidence that that code is correct with respect to threading. | mhils/pyopenssl,kediacorporation/pyopenssl,reaperhulk/pyopenssl,r0ro/pyopenssl,mhils/pyopenssl,daodaoliang/pyopenssl,elitest/pyopenssl,kjav/pyopenssl,kediacorporation/pyopenssl,alex/pyopenssl,lvh/pyopenssl,samv/pyopenssl,Lukasa/pyopenssl,mitghi/pyopenssl,msabramo/pyOpenSSL,reaperhulk/pyopenssl,hynek/pyopenssl,pyca/pyop... | leakcheck/thread-key-gen.py | leakcheck/thread-key-gen.py | # Copyright (C) Jean-Paul Calderone
# See LICENSE for details.
#
# Stress tester for thread-related bugs in RSA and DSA key generation. 0.12 and
# older held the GIL during these operations. Subsequent versions release it
# during them.
from threading import Thread
from OpenSSL.crypto import TYPE_RSA, TYPE_DSA, PKe... | apache-2.0 | Python | |
c87be0f98295d64addc01529999996b566c80f2c | add sent notification status | alphagov/notifications-api,alphagov/notifications-api | migrations/versions/00xx_add_sent_notification_status.py | migrations/versions/00xx_add_sent_notification_status.py | """empty message
Revision ID: 00xx_add_sent_notification_status
Revises: 0075_create_rates_table
Create Date: 2017-04-24 16:55:20.731069
"""
# revision identifiers, used by Alembic.
revision = '00xx_sent_notification_status'
down_revision = '0075_create_rates_table'
from alembic import op
import sqlalchemy as sa
e... | mit | Python | |
7597e834288c21065703bcdc86530a0ad5414a95 | backup strategy tasks | opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor | nodeconductor/backup/tasks.py | nodeconductor/backup/tasks.py | from celery import shared_task
@shared_task
def backup_task(backupable_instance):
backupable_instance.get_backup_strategy.backup()
@shared_task
def restore_task(backupable_instance):
backupable_instance.get_backup_strategy.restore()
@shared_task
def delete_task(backupable_instance):
backupable_instanc... | mit | Python | |
4820013e207947fe7ff94777cd8dcf1ed474eab1 | Add migration for account lockout fields on User | richgieg/flask-now,richgieg/flask-now | migrations/versions/fb6a6554b21_add_account_lockout_fields_to_user.py | migrations/versions/fb6a6554b21_add_account_lockout_fields_to_user.py | """Add account lockout fields to User
Revision ID: fb6a6554b21
Revises: 1f9b411bf6df
Create Date: 2015-10-29 01:07:27.930095
"""
# revision identifiers, used by Alembic.
revision = 'fb6a6554b21'
down_revision = '1f9b411bf6df'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto gene... | mit | Python | |
cee7f23df93f4a09550348e30709aa1e6e6969fc | use net ip availability api def from neutron-lib | noironetworks/neutron,noironetworks/neutron,eayunstack/neutron,eayunstack/neutron,openstack/neutron,mahak/neutron,huntxu/neutron,huntxu/neutron,openstack/neutron,mahak/neutron,openstack/neutron,mahak/neutron | neutron/extensions/network_ip_availability.py | neutron/extensions/network_ip_availability.py | # Copyright 2016 GoDaddy.
#
# 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,... | # Copyright 2016 GoDaddy.
#
# 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 |
6fabbe85bb74788641897daf8b162eac3d47b0aa | Add script for downloading Indonesia price data | FAB4D/humanitas,FAB4D/humanitas,FAB4D/humanitas | data_crunching/indonesia_timeseries/download_indonesia_prices.py | data_crunching/indonesia_timeseries/download_indonesia_prices.py | #!/usr/bin/env python2
import urllib2
import shutil
import re
import sys
import datetime
from lxml import etree
usage_str = """
This scripts downloads daily food prices from http://m.pip.kementan.org/index.php (Indonesia).
Provide date in DD/MM/YYYY format.
Example:
./download_indonesia_prices.py 15/03/2013
""... | bsd-3-clause | Python | |
4fdf2c32bcd937ba2fc21dbaad8a81620c02fb17 | Fix part of #5134: Add test for core.storage.config.gae_models (#5565) | kevinlee12/oppia,prasanna08/oppia,prasanna08/oppia,oppia/oppia,kevinlee12/oppia,souravbadami/oppia,souravbadami/oppia,souravbadami/oppia,prasanna08/oppia,brianrodri/oppia,oppia/oppia,oppia/oppia,oppia/oppia,brianrodri/oppia,souravbadami/oppia,kevinlee12/oppia,prasanna08/oppia,prasanna08/oppia,oppia/oppia,brianrodri/opp... | core/storage/config/gae_models_test.py | core/storage/config/gae_models_test.py | # coding: utf-8
#
# Copyright 2018 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | apache-2.0 | Python | |
65969d0251dc5031328132cf2043f1f76ee90d72 | Include the demo as a separate file | CylonicRaider/cwidgets | demo.py | demo.py |
import sys, curses
from cwidgets import *
from cwidgets import _LOG
def demo(window):
# Create the root of the widget hierarchy.
root = WidgetRoot(window)
# Wrap the UI in a Viewport to avoid crashes at small resolutions.
vp = root.add(Viewport())
# Push the UI together to avoid spreading everyti... | mit | Python | |
3968c53c4577b2efe9ef3cd2de76b688a26517d9 | Add gpio example | designiot/code,designiot/code,designiot/code,designiot/code,phodal/iot-code,phodal/iot-code,phodal/iot-code,phodal/iot-code | chapter2/gpio.py | chapter2/gpio.py | import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(5, GPIO.OUT)
GPIO.output(5, GPIO.HIGH)
GPIO.output(5, GPIO.LOW)
| mit | Python | |
dc0bb07da52fd11a7980b9f36c38fcdb7f9c6ba5 | Add `edit.py` to be able to edit a view asynchronously | tbfisher/sublimetext-Pandoc | edit.py | edit.py | # edit.py
# buffer editing for both ST2 and ST3 that "just works"
import sublime
import sublime_plugin
from collections import defaultdict
try:
sublime.edit_storage
except AttributeError:
sublime.edit_storage = {}
class EditStep:
def __init__(self, cmd, *args):
self.cmd = cmd
self.args = ... | mit | Python | |
a795d94a9c885b97ab5bffc313524ae46626d556 | Add simple function-size analysis tool. | pypyjs/pypyjs,perkinslr/pypyjs,perkinslr/pypyjs,perkinslr/pypyjs,albertjan/pypyjs,pombredanne/pypyjs,albertjan/pypyjs,perkinslr/pypyjs,pombredanne/pypyjs,pypyjs/pypyjs,trinketapp/pypyjs,pypyjs/pypyjs,pypyjs/pypyjs,perkinslr/pypyjs,trinketapp/pypyjs,albertjan/pypyjs | tools/analyze_code_size.py | tools/analyze_code_size.py |
import os
import re
import sys
import optparse
MARKER_START_FUNCS = "// EMSCRIPTEN_START_FUNCS"
MARKER_END_FUNCS = "// EMSCRIPTEN_END_FUNCS"
FUNCTION_CODE_RE = re.compile(
r"function (?P<name>[a-zA-Z0-9_]+)(?P<defn>.*?)((?=function)|(?=$))"
)
def analyze_code_size(fileobj, opts):
funcs = {}
name_re = Non... | mit | Python | |
2ce7bcdd6606cb1590febf6430a7635462b09d74 | fix #61: prefer configuration files under script dir | wangjun/xunlei-lixian,sndnvaps/xunlei-lixian,xieyanhao/xunlei-lixian,davies/xunlei-lixian,ccagg/xunlei,windygu/xunlei-lixian,wogong/xunlei-lixian,liujianpc/xunlei-lixian,sdgdsffdsfff/xunlei-lixian,iambus/xunlei-lixian,myself659/xunlei-lixian,GeassDB/xunlei-lixian | lixian_config.py | lixian_config.py |
import os
import os.path
def get_config_path(filename):
if os.path.exists(filename):
return filename
import sys
local_path = os.path.join(sys.path[0], filename)
if os.path.exists(local_path):
return local_path
user_home = os.getenv('USERPROFILE') or os.getenv('HOME')
lixian_home = os.getenv('LIXIAN_HOME') o... |
import os
import os.path
def get_config_path(filename):
if os.path.exists(filename):
return filename
user_home = os.getenv('USERPROFILE') or os.getenv('HOME')
lixian_home = os.getenv('LIXIAN_HOME') or user_home
return os.path.join(lixian_home, filename)
LIXIAN_DEFAULT_CONFIG = get_config_path('.xunlei.lixian.c... | mit | Python |
2ba9fb77ddcf1a5cc8b923ab46e50c4b17c36447 | add readme update tool | buptlxb/hihoCoder,buptlxb/hihoCoder | hiho.py | hiho.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import codecs
import sys
import argparse
class Entry:
URL = r'http://hihocoder.com/problemset/problem/'
def __init__(self, name=None, number=0):
self.name = name
self.number = number
def parse(self, line):
m = re.match(r'\|.*... | apache-2.0 | Python | |
dfe2bd52fd2e561a79c91d4ff34fbead8a26c1c3 | Create init.py | andrermartins/xgh | init.py | init.py | #!/usr/bin/env python
import sys
import os
import psycopg2
def dump_table(table_name, conn):
query = "SELECT * FROM "+table_name+" LIMIT 1"
cur = conn.cursor()
cur.execute(query)
rows = cur.fetchall()
description = cur.description
columns = "'INSERT INTO "+table_name+" VALUES ('"
for desc i... | mit | Python | |
bfaeeec3f5f5582822e2918491090815a606ba44 | Add test to make sure imports and __all__ matches | smarter-travel-media/warthog | test/test_api.py | test/test_api.py | # -*- coding: utf-8 -*-
import warthog.api
def test_public_exports():
exports = set([item for item in dir(warthog.api) if not item.startswith('_')])
declared = set(warthog.api.__all__)
assert exports == declared, 'Exports and __all__ members should match'
| mit | Python | |
48857638694ceca08c64d7b9c6825e2178c53279 | Add function decorator to improve functools.wraps | goodfeli/pylearn2,JesseLivezey/pylearn2,TNick/pylearn2,fulmicoton/pylearn2,pkainz/pylearn2,Refefer/pylearn2,woozzu/pylearn2,kastnerkyle/pylearn2,CIFASIS/pylearn2,mclaughlin6464/pylearn2,hyqneuron/pylearn2-maxsom,aalmah/pylearn2,bartvm/pylearn2,JesseLivezey/pylearn2,nouiz/pylearn2,lamblin/pylearn2,CIFASIS/pylearn2,junbo... | pylearn2/utils/doc.py | pylearn2/utils/doc.py | """
Documentation-related helper classes/functions
"""
class soft_wraps:
"""
A Python decorator which concatenates two functions' docstrings: one
function is defined at initialization and the other one is defined when
soft_wraps is called.
This helps reduce the ammount of documentation to write: ... | bsd-3-clause | Python | |
dfca9c3d7dbbe97516a24bea89b917f7282c7dc7 | Add problem rotate image | guozengxin/myleetcode,guozengxin/myleetcode | python/rotateImage.py | python/rotateImage.py | # https://leetcode.com/problems/rotate-image/
class Solution(object):
def rotate(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: void Do not return anything, modify matrix in-place instead.
"""
size = len(matrix)
for i in xrange(0, size/2):
for j... | mit | Python | |
cce6a4c2efe62c267b04f6ce75019d577428e2c9 | add sensu_check_dict module | twaldrop/ursula,panxia6679/ursula,narengan/ursula,blueboxgroup/ursula,channus/ursula,wupeiran/ursula,ryshah/ursula,fancyhe/ursula,rongzhus/ursula,persistent-ursula/ursula,panxia6679/ursula,panxia6679/ursula,blueboxgroup/ursula,channus/ursula,knandya/ursula,edtubillara/ursula,blueboxgroup/ursula,persistent-ursula/ursula... | library/sensu_check_dict.py | library/sensu_check_dict.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2014, Blue Box Group, Inc.
# Copyright 2014, Craig Tracey <craigtracey@gmail.com>
# Copyright 2016, Paul Czarkowski <pczarkow@us.ibm.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the L... | mit | Python | |
577b84cf124a35b49311e39ab4d40ef0f8af59ed | introduce proso.analysis module | adaptive-learning/proso-apps,adaptive-learning/proso-apps,adaptive-learning/proso-apps | proso/analysis.py | proso/analysis.py | import json
import hashlib
import os
def get_experiment_data(name, compute_fun, cache_dir, cached=True, **kwargs):
kwargs_hash = hashlib.sha1(json.dumps(kwargs, sort_keys=True)).hexdigest()
filename = '{}/{}.json'.format(cache_dir, name);
if cached and os.path.exists(filename):
with open(filename,... | mit | Python | |
45cb940db74d99b0dac31a2aace3d8505e4a9046 | Add empty file to contain main part of module | jrsmith3/datac,jrsmith3/datac | datac/main.py | datac/main.py | # -*- coding: utf-8 -*-
import copy
| mit | Python | |
323fb80744e63a322fe5ed70d86130aa61aa3c19 | Remove unused imports | yonglehou/scikit-learn,russel1237/scikit-learn,thientu/scikit-learn,rrohan/scikit-learn,procoder317/scikit-learn,yunfeilu/scikit-learn,Obus/scikit-learn,MatthieuBizien/scikit-learn,jakirkham/scikit-learn,q1ang/scikit-learn,shyamalschandra/scikit-learn,jpautom/scikit-learn,mattgiguere/scikit-learn,Adai0808/scikit-learn,... | examples/manifold/plot_swissroll.py | examples/manifold/plot_swissroll.py | """
===================================
Swiss Roll reduction with LLE
===================================
An illustration of Swiss Roll reduction
with locally linear embedding
"""
# Author: Fabian Pedregosa -- <fabian.pedregosa@inria.fr>
# License: BSD, (C) INRIA 2011
print __doc__
import pylab as pl
#-----------... | """
===================================
Swiss Roll reduction with LLE
===================================
An illustration of Swiss Roll reduction
with locally linear embedding
"""
# Author: Fabian Pedregosa -- <fabian.pedregosa@inria.fr>
# License: BSD, (C) INRIA 2011
print __doc__
import numpy as np
import pylab a... | bsd-3-clause | Python |
e8c75e84a158876e71a926bec244af43ad93cbc4 | add imu class | codingfoo/overo_python_examples,codingfoo/overo_python_examples | imu.py | imu.py | import serial
import math
import struct
class IMU:
"""Class for working with a Microstrain IMU"""
def __init__(self):
self.IMU_PORT = '/dev/ttyS0'
self.IMU_BAUD = 115200
self.CMD_ACCEL_ANG_ORIENT = '\xC8'
self.CMD_ACCEL_ANG_ORIENT_SIZE = 67
self.IMU_COMMAND = self.CMD_ACCEL_ANG_ORIENT
self... | mit | Python | |
fb37af691d63ab8a43d50701d6b1f8ae027e2e1b | Create dfirwizard.py | dlcowen/dfirwizard | dfirwizard.py | dfirwizard.py | #!/usr/bin/python
# Sample program or step 1 in becoming a DFIR Wizard!
# No license as this code is simple and free!
import sys
import pytsk3
imagefile = "Stage2.vhd"
imagehandle = pytsk3.Img_Info(imagefile)
partitionTable = pytsk3.Volume_Info(imagehandle)
for partition in partitionTable:
print partition.addr, parti... | apache-2.0 | Python | |
ac83a8bbef2c61021c39c77ef3c14675383edc62 | Fix a typo. | pidah/st2contrib,pearsontechnology/st2contrib,meirwah/st2contrib,digideskio/st2contrib,StackStorm/st2contrib,meirwah/st2contrib,psychopenguin/st2contrib,psychopenguin/st2contrib,tonybaloney/st2contrib,StackStorm/st2contrib,armab/st2contrib,armab/st2contrib,digideskio/st2contrib,tonybaloney/st2contrib,lmEshoo/st2contrib... | packs/st2/actions/lib/action.py | packs/st2/actions/lib/action.py | from st2actions.runners.pythonrunner import Action
from st2client.client import Client
from st2client.models.keyvalue import KeyValuePair # pylint: disable=no-name-in-module
from lib.utils import filter_none_values
__all__ = [
'St2BaseAction'
]
class St2BaseAction(Action):
def __init__(self, config):
... | from st2actions.runners.pythonrunner import Action
from st2client.client import Client
from st2client.models.datastore import KeyValuePair # pylint: disable=no-name-in-module
from lib.utils import filter_none_values
__all__ = [
'St2BaseAction'
]
class St2BaseAction(Action):
def __init__(self, config):
... | apache-2.0 | Python |
7ff614950163b1fb6a8fe0fef5b8de9bfa3a9d85 | Add a test for the hard-coded re() partial frac form | ergs/transmutagen,ergs/transmutagen | transmutagen/tests/test_partialfrac.py | transmutagen/tests/test_partialfrac.py | from sympy import together, expand_complex, re, im, symbols
from ..partialfrac import t
def test_re_form():
theta, alpha = symbols('theta, alpha')
# Check that this doesn't change
re_form = together(expand_complex(re(alpha/(t - theta))))
assert re_form == (t*re(alpha) - re(alpha)*re(theta) -
... | bsd-3-clause | Python | |
352e2d053b8880e1e1a951be4338c188fee925d1 | order book testing first iteration | PierreRochard/coinbase-exchange-order-book | orderbooktest.py | orderbooktest.py | import time
try:
import ujson as json
except ImportError:
import json
from orderbook.book import Book
def dict_compare(new_dictionary, old_dictionary, price_map=False, order_map=False):
d1_keys = set(new_dictionary.keys())
d2_keys = set(old_dictionary.keys())
intersect_keys = d1_keys.intersection... | bsd-2-clause | Python | |
7522ffb9f6934de02d5d326d5f798d42a2da800d | add script to find old experimental apis | vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam,vmiklos/vmexam | pdfium/find_old_experimental.py | pdfium/find_old_experimental.py | #!/usr/bin/env python3
#
# Copyright 2019 Miklos Vajna. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
"""Finds my old + experimental APIs."""
import subprocess
import time
def main() -> None:
"""Commandline interface to this module."""... | mit | Python | |
05dd8bdfeab63b3096e8f7d98032088133d1f0e5 | Add function provider to get osm data | meomancer/field-campaigner,meomancer/field-campaigner,meomancer/field-campaigner | campaign_manager/provider.py | campaign_manager/provider.py | import json
import hashlib
import os
from reporter import config
from reporter.utilities import (
split_bbox,
)
from reporter.osm import (
load_osm_document
)
from urllib.parse import quote
from reporter.queries import TAG_MAPPING, OVERPASS_QUERY_MAP
def get_osm_data(bbox, feature):
"""Get osm data.
... | bsd-3-clause | Python | |
9305f158b71f65923ee37de2805324db362e0db6 | Add DRF LocalDateTimeField | PSU-OIT-ARC/django-arcutils,wylee/django-arcutils,wylee/django-arcutils,PSU-OIT-ARC/django-arcutils | arcutils/drf/serializers.py | arcutils/drf/serializers.py | from django.utils import timezone
from rest_framework import serializers
class LocalDateTimeField(serializers.DateTimeField):
"""Converts datetime to local time before serialization."""
def to_representation(self, value):
value = timezone.localtime(value)
return super().to_representation(va... | mit | Python | |
3f9aae149dba5c9b68ff6f7fd83cadf3fd6b1d7d | Add automorphic number implementation (#7978) | TheAlgorithms/Python | maths/automorphic_number.py | maths/automorphic_number.py | """
== Automorphic Numbers ==
A number n is said to be a Automorphic number if
the square of n "ends" in the same digits as n itself.
Examples of Automorphic Numbers: 0, 1, 5, 6, 25, 76, 376, 625, 9376, 90625, ...
https://en.wikipedia.org/wiki/Automorphic_number
"""
# Author : Akshay Dubey (https://github.com/itsAksh... | mit | Python | |
34391723f44c81ceab77fd3200ee34c9f1b2d4b2 | add plugin factory | PalNilsson/pilot2,mlassnig/pilot2,mlassnig/pilot2,PalNilsson/pilot2 | pilot/common/pluginfactory.py | pilot/common/pluginfactory.py | #!/usr/bin/env python
# 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
#
# Authors:
# - Wen Guan, wen.guan@cern.ch, 2018
import logging
logger = lo... | apache-2.0 | Python | |
9346ca997d723cbfedf383eb78db2f62552f8a7c | Fix empty image list test. | Freestila/dosage,mbrandis/dosage,Freestila/dosage,blade2005/dosage,peterjanes/dosage,wummel/dosage,webcomics/dosage,wummel/dosage,mbrandis/dosage,peterjanes/dosage,webcomics/dosage,blade2005/dosage | tests/test_comics.py | tests/test_comics.py | # -*- coding: iso-8859-1 -*-
# Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012 Bastian Kleineidam
import tempfile
import shutil
from itertools import islice
from unittest import TestCase
from dosagelib import scraper
class _ComicTester(TestCase):
"""Basic comic test class."""
... | # -*- coding: iso-8859-1 -*-
# Copyright (C) 2004-2005 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012 Bastian Kleineidam
import tempfile
import shutil
from itertools import islice
from unittest import TestCase
from dosagelib import scraper
class _ComicTester(TestCase):
"""Basic comic test class."""
... | mit | Python |
acd33bdffb3302d2130505873a062fae39dcd976 | Add WikiText103 and WikiText2 Mocked Unit Tests (#1592) | pytorch/text,pytorch/text,pytorch/text,pytorch/text | test/datasets/test_wikitexts.py | test/datasets/test_wikitexts.py | import os
import random
import string
import zipfile
from collections import defaultdict
from unittest.mock import patch
from ..common.parameterized_utils import nested_params
from torchtext.datasets.wikitext103 import WikiText103
from torchtext.datasets.wikitext2 import WikiText2
from ..common.case_utils import Temp... | bsd-3-clause | Python | |
61cd24aef4c9c8ef72527e75991c23873892ec3b | Change listener module file | gelnior/newebe,gelnior/newebe,gelnior/newebe,gelnior/newebe | platform/listener/__init__.py | platform/listener/__init__.py | '''
Module to handle data synchronization with contacts.
'''
| agpl-3.0 | Python | |
18378b201cae7e23889031044fa6ddbaf50946c5 | check langauge detecting for lett files where we know the expetected language from the URL | ModernMT/DataCollection,ModernMT/DataCollection,ModernMT/DataCollection,ModernMT/DataCollection,ModernMT/DataCollection | baseline/check_lett_lang.py | baseline/check_lett_lang.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
doc2lang = {}
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('referencepairs', type=argparse.FileType('r'))
parser.add_argument('-slang', help='Source language', default='en')
par... | apache-2.0 | Python | |
1bbfb6fe5080de9326bd7a35afe893bf59744bdf | add ASGI plugin/middleware tests. | honeybadger-io/honeybadger-python,honeybadger-io/honeybadger-python | honeybadger/tests/contrib/test_asgi.py | honeybadger/tests/contrib/test_asgi.py | import pprint
import unittest
from async_asgi_testclient import TestClient
import aiounittest
import mock
from honeybadger import contrib
class SomeError(Exception):
pass
def asgi_app():
"""Example ASGI App."""
async def app(scope, receive, send):
if "error" in scope["path"]:
raise Som... | mit | Python | |
10dd7a4a70fe639b806e004bc0a0d6fb791279a3 | Add a utility script: | llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,llvm-mirror/lldb,apple/swift-lldb,apple/swift-lldb,llvm-mirror/lldb,apple/swift-lldb | utils/misc/grep-svn-log.py | utils/misc/grep-svn-log.py | #!/usr/bin/env python
"""
Greps and returns the first svn log entry containing a line matching the regular
expression pattern passed as the only arg.
Example:
svn log -v | grep-svn-log.py '^ D.+why_are_you_missing.h$'
"""
import fileinput, re, sys, StringIO
# Separator string for "svn log -v" output.
separator =... | apache-2.0 | Python | |
8dc7a1e239dc22dd4eb69cfe1754586e3a1690dc | Test javascript using the "js" | qsnake/py2js,mattpap/py2js,chrivers/pyjaco,buchuki/pyjaco,mattpap/py2js,chrivers/pyjaco,chrivers/pyjaco,buchuki/pyjaco,buchuki/pyjaco,qsnake/py2js | tests/test_run_js.py | tests/test_run_js.py | import os
from py2js import JavaScript
def f(x):
return x
def test(func, run):
func_source = str(JavaScript(func))
run_file = "/tmp/run.js"
with open(run_file, "w") as f:
f.write(func_source)
f.write("\n")
f.write(run)
r = os.system('js -f defs.js -f %s' % run_file)
as... | mit | Python | |
bbed1fc6d144571f5cb69d1c1a54904857646d74 | Create redis-graphite.py | DerMitch/redis-graphite | redis-graphite.py | redis-graphite.py | """
Redis Graphite Publisher
~~~~~~~~~~~~~~~~~~~~~~~~
Publishes stats from a redis server to a carbon server.
These stats include:
- Generic server stats (INFO command)
- Length of lists (useful for monitoring queues)
Requires redis and statsd:
https://pypi.python.org/pypi/redis
E... | mit | Python | |
dee49a5e023907d77e2598560d25480bc7f56e34 | Add k40 batch script | tamasgal/km3pipe,tamasgal/km3pipe | examples/offline_analysis/qk40calib.py | examples/offline_analysis/qk40calib.py | """
================================
K40 Calibration Batch Processing
================================
Standalone job submitter for K40 offline calibrations with KM3Pipe.
"""
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Filename: qk40calib.py
# Author: Tamas Gal <tgal@km3net.de>
"""
Standalone job submitter for K4... | mit | Python | |
e44bd0b5a5db15b99a06b7561b8146554b1419d2 | Add genesisbalance class #217 | xeroc/python-bitshares | bitshares/genesisbalance.py | bitshares/genesisbalance.py | # -*- coding: utf-8 -*-
from .account import Account
from .instance import BlockchainInstance
from graphenecommon.genesisbalance import (
GenesisBalance as GrapheneGenesisBalance,
GenesisBalances as GrapheneGenesisBalances,
)
from bitsharesbase.account import Address, PublicKey
from bitsharesbase import operat... | mit | Python | |
3dd71c02ea1fa9e39054bd82bf9e8657ec77d6b9 | Add a script to recover the chat_id | a2ohm/ProgressBot | tools/get_chat_id.py | tools/get_chat_id.py | #! /usr/bin/python3
# -*- coding:utf-8 -*-
# by antoine@2ohm.fr
import sys
import time
import telepot
def handle(msg):
content_type, chat_type, chat_id = telepot.glance(msg)
print("\tchat_id: {}".format(chat_id))
if content_type == 'text' and msg['text'] == '/start':
ans = """
Hello <b>{first_na... | apache-2.0 | Python | |
e950a53b2a392014fbfd7b9827a9f3f0b12a377b | add connector test class | brucelau-github/raspberry-pi-proj | connectortest.py | connectortest.py | import unittest
import threading
import re
import message
import StringIO
from connector import Connector, AppConnector
import SocketServer
from threadserver import DetailServer
from datetime import datetime
from PIL import Image
class App:
def update_msg(self, txtmsg):
print txtmsg.get_body()
ret... | mit | Python | |
f97868b89da50532413465250d84308b84276296 | add script | adamewing/tebreak,ValentinaPeona/tebreak,adamewing/tebreak,ValentinaPeona/tebreak | scripts/getliblist.py | scripts/getliblist.py | #!/usr/bin/env python
import sys
import os
def getlibs(invcf):
rgs = {}
with open(invcf, 'r') as vcf:
for line in vcf:
if not line.startswith('#'):
chrom, pos, id, ref, alt, qual, filter, info, format, sample = line.strip().split('\t')
for rg in sample.split... | mit | Python | |
fda7d76e4b10a1b43e3612742585d9abcc7b27da | Rename tags.py to search.py | cdent/tank,cdent/tank,cdent/tank | tiddlywebplugins/tank/search.py | tiddlywebplugins/tank/search.py | """
Routines associated with finding and listing tags.
An experiment for now.
"""
from tiddlyweb.model.bag import Bag
from tiddlyweb.model.policy import PermissionsError
from tiddlywebplugins.whoosher import get_searcher, query_parse
def list_tags(environ, start_response):
"""
Plain text list of tags in a c... | bsd-3-clause | Python | |
eac6545d0700d2a6c3de43db5ea8d46cfea12464 | Update link.py | Halibot/haltoys | link.py | link.py | from module import XMPPModule
import halutils
import re, requests
class Link(XMPPModule):
def handleMessage(self, msg):
obj = re.match('.*(http[s]?://.*)+', msg['body'])
if obj:
addr = obj.group(1)
webpage = requests.get(addr).content
title = re.match('.*... | bsd-3-clause | Python | |
c29e430301dc854dc7bd83ebc2a588cea70589a6 | Fix has_perm issue in get_project_list | mvaled/sentry,korealerts1/sentry,mvaled/sentry,JamesMura/sentry,BuildingLink/sentry,ngonzalvez/sentry,mvaled/sentry,alexm92/sentry,kevinlondon/sentry,SilentCircle/sentry,ewdurbin/sentry,kevinastone/sentry,argonemyth/sentry,boneyao/sentry,mvaled/sentry,llonchj/sentry,chayapan/django-sentry,JTCunning/sentry,rdio/sentry,m... | sentry/web/helpers.py | sentry/web/helpers.py | """
sentry.web.views
~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from django.conf import settings as dj_settings
from django.core.urlresolvers import reverse, resolve
from django.http import HttpResponse
from django.template ... | """
sentry.web.views
~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from django.conf import settings as dj_settings
from django.core.urlresolvers import reverse, resolve
from django.http import HttpResponse
from django.template ... | bsd-3-clause | Python |
1510a0faeff91f6f6ed7a1c5929628d430cb0506 | Update file identification tools | artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin,artefactual/archivematica-fpr-admin | fpr/migrations/0010_update_fido_136.py | fpr/migrations/0010_update_fido_136.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
def data_migration(apps, schema_editor):
IDTool = apps.get_model('fpr', 'IDTool')
IDTool.objects.filter(description='Fido', version='1.3.5').update(version='1.3.6')
IDTool.objects.filter(description='... | agpl-3.0 | Python | |
93548efe9eb04dd9659e3cc76c711d967e8770df | Create filereader.py | timjinx/Sample-Repo,timjinx/Sample-Repo,timjinx/Sample-Repo,timjinx/Sample-Repo,timjinx/Sample-Repo,timjinx/Sample-Repo,timjinx/Sample-Repo,timjinx/Sample-Repo,timjinx/Sample-Repo,timjinx/Sample-Repo,timjinx/Sample-Repo | filereader.py | filereader.py | #!/usr/bin/python
import os
import re
from optparse import OptionParser
SUFFIX=".out"
def main () :
global filename
parser = OptionParser()
parser.add_option("-f", "--file", dest="filename",
help="the file to update", metavar="FILE")
parser.add_option("-n", "--name", dest="name",
... | apache-2.0 | Python | |
23ab301f4773892f6db7321105f79ba0c48404a3 | add urls | avlach/univbris-ocf,avlach/univbris-ocf,avlach/univbris-ocf,avlach/univbris-ocf | src/doc/expedient/source/developer/sshaggregate/urls.py | src/doc/expedient/source/developer/sshaggregate/urls.py | from django.conf.urls.defaults import *
urlpatterns = patterns('sshaggregate.views',
url(r'^aggregate/create/$', 'aggregate_crud', name='sshaggregate_aggregate_create'),
url(r'^aggregate/(?P<agg_id>\d+)/edit/$', 'aggregate_crud', name='sshaggregate_aggregate_edit'),
url(r'^aggregate/(?P<agg_id>\d+)/servers... | bsd-3-clause | Python | |
fed2e3f9bdb3a00b077b5e7df1aed4d927b77b6c | Add test for Clifford drudge by quaternions | tschijnmo/drudge,tschijnmo/drudge,tschijnmo/drudge | tests/clifford_test.py | tests/clifford_test.py | """Test for the Clifford algebra drudge."""
from drudge import CliffordDrudge, Vec, inner_by_delta
def test_clifford_drudge_by_quaternions(spark_ctx):
"""Test basic functionality of Clifford drudge by quaternions.
"""
dr = CliffordDrudge(
spark_ctx, inner=lambda v1, v2: -inner_by_delta(v1, v2)
... | mit | Python | |
09a0689b8e521c1d5c0ea68ac448dc9ae7abcff5 | Read the header of a fits file and/or look up a single key (case insensitive). | DanielAndreasen/astro_scripts | fitsHeader.py | fitsHeader.py | #!/usr/bin/env python
# -*- coding: utf8 -*-
# My imports
from __future__ import division
from astropy.io import fits
from pydoc import pager
import argparse
def _parser():
parser = argparse.ArgumentParser(description='View the header of a fits file')
parser.add_argument('input', help='File name of fits file... | mit | Python | |
b674f921a8e5cffb2d3e320f564c61ca01455a9f | Add command to generate a csv of talk titles and video reviewers | CTPUG/wafer,CTPUG/wafer,CTPUG/wafer,CTPUG/wafer | wafer/management/commands/wafer_talk_video_reviewers.py | wafer/management/commands/wafer_talk_video_reviewers.py | import sys
import csv
from django.core.management.base import BaseCommand
from django.contrib.auth import get_user_model
from wafer.talks.models import Talk, ACCEPTED, PROVISIONAL
class Command(BaseCommand):
help = ("List talks and the associated video_reviewer emails."
" Only reviewers for accepted... | isc | Python | |
3db3c22d83071550d8bbd70062f957cf43c5e54a | Add a compatibility module, because of Python 2/3 compatibility issues. | davidhalter-archive/shopping_cart_example | cart/_compatibility.py | cart/_compatibility.py | import sys
is_py3 = sys.version_info[0] >= 3
def utf8(string):
"""Cast to unicode DAMMIT!
Written because Python2 repr always implicitly casts to a string, so we
have to cast back to a unicode (and we now that we always deal with valid
unicode, because we check that in the beginning).
"""
if ... | mit | Python | |
156b7dfc11f24a7d77d2280e8ddade3cb7a474b7 | Add a script for listing all Elasticsearch indexes | wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api | misc/list_all_es_indexes.py | misc/list_all_es_indexes.py | #!/usr/bin/env python
# -*- encoding: utf-8
import boto3
import hcl
import requests
def get_terraform_vars():
s3_client = boto3.client("s3")
tfvars_body = s3_client.get_object(
Bucket="wellcomecollection-platform-infra",
Key="terraform.tfvars"
)["Body"]
return hcl.load(tfvars_body)
... | mit | Python | |
006a921f19f6c4f64d694c86346ad85ada2c8bb8 | Add tests for subclass support | pycurl/pycurl,pycurl/pycurl,pycurl/pycurl | tests/subclass_test.py | tests/subclass_test.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vi:ts=4:et
try:
import unittest2 as unittest
except ImportError:
import unittest
import pycurl
CLASSES = (pycurl.Curl, pycurl.CurlMulti, pycurl.CurlShare)
class SubclassTest(unittest.TestCase):
def test_baseclass_init(self):
# base classes do not a... | lgpl-2.1 | Python | |
c8816f509a661ed53c166d843ebfb7dcb6b8d75a | use only single threaded svrlight | lisitsyn/shogun,Saurabh7/shogun,besser82/shogun,shogun-toolbox/shogun,Saurabh7/shogun,besser82/shogun,besser82/shogun,sorig/shogun,sorig/shogun,shogun-toolbox/shogun,karlnapf/shogun,karlnapf/shogun,sorig/shogun,shogun-toolbox/shogun,karlnapf/shogun,Saurabh7/shogun,karlnapf/shogun,besser82/shogun,Saurabh7/shogun,shogun-... | examples/undocumented/python_modular/regression_svrlight_modular.py | examples/undocumented/python_modular/regression_svrlight_modular.py | ###########################################################################
# svm light based support vector regression
###########################################################################
from numpy import array
from numpy.random import seed, rand
from tools.load import LoadMatrix
lm=LoadMatrix()
traindat = lm... | ###########################################################################
# svm light based support vector regression
###########################################################################
from numpy import array
from numpy.random import seed, rand
from tools.load import LoadMatrix
lm=LoadMatrix()
traindat = lm... | bsd-3-clause | Python |
7327250621dc34a1e7c2f1998333d65024583168 | add simple test | zerovm/zpm,zerovm/zpm,zerovm/zpm,zerovm/zerovm-cli,zerovm/zerovm-cli,zerovm/zpm,zerovm/zerovm-cli,zerovm/zerovm-cli,zerovm/zpm,zerovm/zerovm-cli,zerovm/zpm,zerovm/zerovm-cli | tests/test_commands.py | tests/test_commands.py | # Copyright 2014 Rackspace, 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... | apache-2.0 | Python | |
2b2f11cc7650fc5c40cd21a6e8ad671656fc9b21 | add quicksort | gnhuy91/python-utils | quicksort.py | quicksort.py | '''
QuickSort implementation
'''
def quick_sort(arr, l, r):
i = l
j = r
x = arr[(l + r) / 2]
if len(arr) == 0:
return arr
else:
while True:
while arr[i] < x:
i += 1
while arr[j] > x:
j -= 1
if i <= j:
... | mit | Python | |
ef76498542aec046c2307562db01e4764ae68b50 | Add gce_resize | tfuentes/cloudtool | gce_resize.py | gce_resize.py | #!/usr/bin/env python
# import section
import argparse, os, time
from googleapiclient import discovery
from oauth2client.service_account import ServiceAccountCredentials
from pprint import pprint
# functions
def get_instanceGroup(service, project,zone, instanceGroup):
"""
Returns instance group object.
... | agpl-3.0 | Python | |
b102a2769dc70deb2055a2d4ae0bf11f48c13f9d | add game window | MadaooQuake/Pinko | core/core.py | core/core.py | # -*- coding: utf-8 -*-
import pygame
from pygame.locals import *
class App:
def __init__(self):
self._running = True
self._display_surf = None
self.size = self.weight, self.height = 1024, 576
def on_init(self):
pygame.init()
self._display_surf = pygame.display.set_mode... | bsd-3-clause | Python | |
fb6dd1a92471697b8665364dfaa7fedc519d00ed | Create properties.py | Zain117/Rogue | data/properties.py | data/properties.py | import libtcodpy as libtcod
class Object():
def __init__(self, x, y, char, color, screen):
self.x = x
self.y = y
self.char = char
self.color = color
self.screen = screen
def draw_object(self):
#Set the color of the character and draw it
libtcod.console_s... | mit | Python | |
a2ba0c1658850064f55de1a99c3c2a49ef847b8d | Add join_by draft | Suor/funcy | drafts/join_by.py | drafts/join_by.py | def join_by(op, dicts, start=EMPTY):
dicts = list(dicts)
if not dicts:
return {}
elif len(dicts) == 1:
return dicts[0]
result = {}
for d in dicts:
for k, v in iteritems(d):
if k in result:
result[k] = op(result[k], v)
else:
... | bsd-3-clause | Python | |
235cc3a7529b36e11a7935e15c90f496210d7c31 | implement method for generating request signature | gdmachado/scup-python | scup/auth.py | scup/auth.py | import hashlib
import time
def get_request_signature(private_key):
current_time = int(time.time())
message = '{}{}'.format(current_time, private_key)
digest = hashlib.md5(message).hexdigest()
return current_time, digest
| mit | Python | |
5834f2e259834b325cf076b36af634dc6b64f442 | Add info if not parsed | Phantasus/intelmq,s4n7h0/intelmq | intelmq/bots/parsers/generic/parser.py | intelmq/bots/parsers/generic/parser.py | from intelmq.lib.bot import Bot, sys
from intelmq.lib.message import Event
from intelmq.bots import utils
import re
class GenericBot(Bot):
# Generic parser, will simply parse and add named group to event
# for example if you have the regex :
# '^\s*(?P<ip>(?:(?:\d){1,3}\.){3}\d{1,3})'
# You will have an item 'ip' in ... | from intelmq.lib.bot import Bot, sys
from intelmq.lib.message import Event
from intelmq.bots import utils
import re
class GenericBot(Bot):
# Generic parser, will simply parse and add named group to event
# for example if you have the regex :
# '^\s*(?P<ip>(?:(?:\d){1,3}\.){3}\d{1,3})'
# You will have an item 'ip' in ... | agpl-3.0 | Python |
7490c39f958291cc99913d0f36581439d8efdf77 | Add a command to fix candidate image metadata | DemocracyClub/yournextrepresentative,neavouli/yournextrepresentative,mysociety/yournextrepresentative,neavouli/yournextrepresentative,mysociety/yournextmp-popit,neavouli/yournextrepresentative,mysociety/yournextmp-popit,mysociety/yournextrepresentative,mysociety/yournextrepresentative,datamade/yournextmp-popit,openstat... | candidates/management/commands/candidates_fix_image_metadata.py | candidates/management/commands/candidates_fix_image_metadata.py | from PIL import Image
from hashlib import md5
import re
import requests
import sys
from StringIO import StringIO
from candidates.popit import PopItApiMixin, popit_unwrap_pagination
from candidates.update import fix_dates
from moderation_queue.views import PILLOW_FORMAT_MIME_TYPES
from django.core.management.base impo... | agpl-3.0 | Python | |
d046968c5b16239b4ce3fbe17b6359339f3e7b9b | Add vcf convertor | ihciah/AndroidSMSRelay,ihciah/AndroidSMSRelay | utils/vcf_convertor.py | utils/vcf_convertor.py | #! -*- coding: utf-8 -*-
import re
import json
person_patten = re.compile(r'BEGIN:VCARD(.*?)END:VCARD', re.DOTALL)
fullname_patten = re.compile(r'FN:(.*?)\n')
mobile_patten = re.compile(r':\+*?(\d{9}\d*?)\n')
f = open(r'iCloud vCard.vcf')
fc = f.read()
people = person_patten.findall(fc)
names = {}
for p in people:
... | mit | Python | |
3a1b4ceb2ae989495d2453c612ac6645fdf59726 | Create cisco_vlan_extract.py | JamesKBowler/networking_scripts | cisco/cisco_vlan_extract.py | cisco/cisco_vlan_extract.py | from ciscoconfparse import CiscoConfParse as ccp
def extract_vlan(vlans):
"""
Will convert ACTIVE vlans in the 'show vlan' command .....
switch#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1... | mit | Python | |
08d66a82ea47832654aa17f0323df6ce57691fcb | add setup.py | expertanalytics/fagkveld | verdenskart/setup.py | verdenskart/setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name="bokeh-worldmap",
version="0.1.0",
packages=find_packages("src"),
package_data={},
package_dir={"": "src"},
entry_points={"console_scripts": []},
)
| bsd-2-clause | Python | |
d33bd223ec35712d0aa9e4ab3da83a19cf1a1120 | Create httpclient.py | hoogles/CMPUT404-assignment-web-client | httpclient.py | httpclient.py | #!/usr/bin/env python
# coding: utf-8
# Copyright 2013 Abram Hindle
#
# 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 b... | apache-2.0 | Python | |
5bb7d25765655f83c42b5e7abc1093f7f85f7950 | bump version to 0.8.16 | MycroftAI/mycroft-core,aatchison/mycroft-core,MycroftAI/mycroft-core,Dark5ide/mycroft-core,linuxipho/mycroft-core,Dark5ide/mycroft-core,linuxipho/mycroft-core,forslund/mycroft-core,aatchison/mycroft-core,forslund/mycroft-core | mycroft/version/__init__.py | mycroft/version/__init__.py | # Copyright 2016 Mycroft AI, Inc.
#
# This file is part of Mycroft Core.
#
# Mycroft Core is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later versio... | # Copyright 2016 Mycroft AI, Inc.
#
# This file is part of Mycroft Core.
#
# Mycroft Core is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later versio... | apache-2.0 | Python |
32a1781bb5ba4f143e5910fbd841ca6aeeebc8fe | Add test script for color histogram matcher | pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc,pazeshun/jsk_apc | jsk_2015_05_baxter_apc/node_scripts/test_color_histogram_matcher.py | jsk_2015_05_baxter_apc/node_scripts/test_color_histogram_matcher.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""This script is to test color histogram & its matcher
Usage
-----
$ # to extract color histogram
$ roslaunch jsk_2014_picking_challenge extract_color_histogram.launch
input_image:=/test_color_histogram/train_image
$ rosrun jsk_2014_picking_challeng... | bsd-3-clause | Python | |
3088fcd2d42b4e59601c103cc01cec1d949f6f57 | Improve OldPersian | lingdb/CoBL-public,lingdb/CoBL-public,lingdb/CoBL-public,lingdb/CoBL-public | ielex/lexicon/migrations/0093_fix_oldPersian.py | ielex/lexicon/migrations/0093_fix_oldPersian.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def forwards_func(apps, schema_editor):
'''
OldPersian doesn't have lexemes for some meanings.
This migration generates them.
'''
# Models to work with:
Language = apps.get_model('lexicon', 'Langua... | bsd-2-clause | Python | |
6516b73210a575376bc78005ae28c0e843303b24 | add theano how-to-perform | rianrajagede/iris-python,rianrajagede/simplesamplecode | Theano/how-to-perform-stencil-computations-element-wise-on-a-matrix-in-theano.py | Theano/how-to-perform-stencil-computations-element-wise-on-a-matrix-in-theano.py | import numpy as np
import theano
import theano.tensor as T
from theano.tensor.nnet import conv2d
# original image 3D (3x3x4) (RGB Channel, height, width)
img = [[[1, 2, 3, 4],
[1, 1, 3, 1],
[1, 3, 1, 1]],
[[2, 2, 3, 4],
[2, 2, 3, 2],
[2, 3, 2, 2]],
[[3, 2, 3, 4],
[3, 3,... | mit | Python | |
a99f0678815c2e998c25a0aaf9f2c79ad0d18610 | Add package 'ui' | AntumDeluge/desktop_recorder,AntumDeluge/desktop_recorder | source/ui/__init__.py | source/ui/__init__.py | # -*- coding: utf-8 -*-
## \package ui
# MIT licensing
# See: LICENSE.txt
| mit | Python | |
00b995719aaf11c2d7c3126e29b94b74f0edf8d2 | add test | brianjgeiger/osf.io,adlius/osf.io,Johnetordoff/osf.io,aaxelb/osf.io,pattisdr/osf.io,saradbowman/osf.io,felliott/osf.io,baylee-d/osf.io,Johnetordoff/osf.io,baylee-d/osf.io,mfraezz/osf.io,CenterForOpenScience/osf.io,adlius/osf.io,caseyrollins/osf.io,cslzchen/osf.io,Johnetordoff/osf.io,HalcyonChimera/osf.io,mfraezz/osf.io... | osf_tests/test_downloads_summary.py | osf_tests/test_downloads_summary.py | # encoding: utf-8
import mock
import pytest
import pytz
import datetime
from django.utils import timezone
from addons.osfstorage import utils
from addons.osfstorage.tests.utils import StorageTestCase
from osf_tests.factories import ProjectFactory
from scripts.analytics.download_count_summary import DownloadCountSum... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.