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 |
|---|---|---|---|---|---|---|---|---|
6aaa08a48dade981de18b117363357fdffaeb641 | add python_capstone_setup.py | techvoltage/capstone,bughoho/capstone,bughoho/capstone,techvoltage/capstone,bigendiansmalls/capstone,angelabier1/capstone,bughoho/capstone,dynm/capstone,pombredanne/capstone,AmesianX/capstone,zuloloxi/capstone,bughoho/capstone,nplanel/capstone,bigendiansmalls/capstone,bSr43/capstone,sephiroth99/capstone,capturePointer/... | suite/python_capstone_setup.py | suite/python_capstone_setup.py | #!/bin/sh
# this prints out Capstone setup & core+Python-binding versions
python -c "import capstone; print capstone.debug()"
| bsd-3-clause | Python | |
077cf46ab42c76bf3a854142a4f530625a377837 | Create tutorial2.py | dina-hertog/empty-app | tutorial2.py | tutorial2.py | mit | Python | ||
1bb1ececfcd548d52a28b713f4ee7eb4e710da85 | Add an example of using fchollet multi_gpu_model on InceptionV3. | rossumai/keras-multi-gpu,rossumai/keras-multi-gpu | keras_tf_multigpu/examples/fchollet_inception3_multigpu.py | keras_tf_multigpu/examples/fchollet_inception3_multigpu.py | import tensorflow as tf
from keras.applications import InceptionV3
from keras.utils import multi_gpu_model
import numpy as np
num_samples = 1000
height = 224
width = 224
num_classes = 1000
gpu_count = 2
# Instantiate the base model
# (here, we do it on CPU, which is optional).
with tf.device('/cpu:0' if gpu_count > ... | mit | Python | |
9ffafa9c11e71c176adb4056fbc780e450cc0d82 | Add experimental queries module. | ericdill/databroker,ericdill/databroker | databroker/queries.py | databroker/queries.py | """
This module is experimental.
"""
import collections.abc
import abc
class Query(collections.abc.Mapping):
"""
This represents a MongoDB query.
MongoDB queries are typically encoded as simple dicts. This object supports
the dict interface in a read-only fashion. Subclassses add a nice __repr__
... | bsd-3-clause | Python | |
177f198a1efb99da592d96a2d5d259722b8a47ee | Add a test of switching back and forth between Decider() values (specifically 'MD5' and 'timestamp-match'), copied from back when this functionality was configured with the SourceSignatures() function. | timj/scons,timj/scons,timj/scons,timj/scons,timj/scons,timj/scons,timj/scons,timj/scons,timj/scons | test/Decider/switch-rebuild.py | test/Decider/switch-rebuild.py | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | mit | Python | |
666cd734270f7d7487815c7805940cb8a2d99c2c | Add script for downloading and patching the TIGER corpus | ooz/Confopy,ooz/Confopy | confopy/localization/de/corpus_de/tiger_dl_patch.py | confopy/localization/de/corpus_de/tiger_dl_patch.py | #!/usr/bin/python
# coding: utf-8
'''
File: tiger_release_aug07.corrected.16012013_patch.py
Author: Oliver Zscheyge
Description:
Fixes wrong morph values in the TIGER corpus:
tiger_release_aug07.corrected.16012013.xml
Also converts XML file to utf-8 encoding.
'''
import urllib
import tarfile
import co... | mit | Python | |
8c7fc2382db0ec9c901f6c2c2b00971f3ee7c3cc | Add tests for custom authentication backend | randomic/aniauth-tdd,randomic/aniauth-tdd | logintokens/tests/test_backends.py | logintokens/tests/test_backends.py | """logintokens app unittests for backends
"""
from time import sleep
from django.test import TestCase, Client
from django.contrib.auth import get_user_model, authenticate
from logintokens.tokens import default_token_generator
USER = get_user_model()
class EmailOnlyAuthenticationBackendTest(TestCase):
"""Test... | mit | Python | |
f746c2a8a59342060d404944a586b11e1f46df5a | Merge with lp:openobject-addons | hifly/OpenUpgrade,fuselock/odoo,kybriainfotech/iSocioCRM,nexiles/odoo,kirca/OpenUpgrade,oliverhr/odoo,Danisan/odoo-1,rgeleta/odoo,dezynetechnologies/odoo,OpenUpgrade-dev/OpenUpgrade,christophlsa/odoo,luistorresm/odoo,slevenhagen/odoo-npg,savoirfairelinux/odoo,cysnake4713/odoo,synconics/odoo,OSSESAC/odoopubarquiluz,rowe... | addons/product_visible_discount/__openerp__.py | addons/product_visible_discount/__openerp__.py | ##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... | ##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... | agpl-3.0 | Python |
54ca48a2b8cbd53cd6506fdbce47d16f03a28a7d | Add unit tests for bubble sort | ueg1990/aids | tests/test_sorting_and_searching/test_bubble_sort.py | tests/test_sorting_and_searching/test_bubble_sort.py | import unittest
from aids.sorting_and_searching.bubble_sort import bubble_sort
class BubbleSortTestCase(unittest.TestCase):
'''
Unit tests for bubble sort
'''
def setUp(self):
self.example_1 = [2, 5, 4, 3, 1]
def test_bubble_sort(self):
bubble_sort(self.example_1)
self.a... | mit | Python | |
f24bdbbd0a7abc32d49f844a4b97b128a3adc299 | add tests for KnownIssues | terceiro/squad,terceiro/squad,terceiro/squad,terceiro/squad | test/core/test_known_issues.py | test/core/test_known_issues.py | from django.test import TestCase
from django.utils import timezone
from unittest.mock import patch
from squad.core.models import Group, KnownIssue
class KnownIssueTest(TestCase):
def setUp(self):
self.group = Group.objects.create(slug='mygroup')
self.project = self.group.projects.create(slug='my... | agpl-3.0 | Python | |
0b047f5b6123d851916ed12114512ddebec58225 | Add 20150509 question. | fantuanmianshi/Daily,fantuanmianshi/Daily | LeetCode/add_two_numbers.py | LeetCode/add_two_numbers.py | """
You are given two linked lists representing two non-negative numbers.
The digits are stored in reverse order and each of their nodes contain a single
digit. Add the two numbers and return it as a linked list.
Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
Output: 7 -> 0 -> 8
Notice: extra digit.
"""
class ListNode:
"... | mit | Python | |
e5502056a36507bd6d77bc814014b45cd9afc8bf | make a version bumping and version sorting system | hepix-virtualisation/vmcaster | dishpub/versioning.py | dishpub/versioning.py | import re
regdelexp = re.compile('[-,.\/]')
regnumeric = re.compile('[0-9]+')
def split_line_by_delimiter(line,regex):
splitline = []
splititr = regex.finditer(line)
lstart = 0
for i in splititr:
(mstart,mend) = i.span()
if lstart != mstart:
splitline.append(line[lstart:msta... | apache-2.0 | Python | |
e46da8f316485c7c9e11ffe751108539f9254a68 | Create ClientUDP.py | shutebt01/legendary-engine | ClientUDP.py | ClientUDP.py | '''
Created on 12 Feb 2015
@author: shutebt01
'''
#!/bin/env/python3
'''
Packet formating:
[type, src-name, src-group, data]
'''
import socket, threading, json
name = input("Enter User Name: ")
port = 16500
#host = input("Enter host: ")
room = "Global"
showall = False
s = socket.socket(socket.AF_INET, socket.S... | unlicense | Python | |
bf4b4ae886d8b631c443d1d992159f1922232dca | Create code.py | amitkumarj441/DiveInDjango | Code/code.py | Code/code.py | from django.db import models
class Address(models.Model):
address=models.CharField(max_length=255,blank=True)
city=models.CharField(max_length=150,blank=True)
state=models.CharField(max_length=2,blank=True) // Such as US for Unitet States of America, IN for India
pin=models.CharField(max_length=15,blank=Tr... | mpl-2.0 | Python | |
67596d081059a004e5f7ab15f7972773fdf2f15e | ADD PyGrid SetupService message tests | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | tests/syft/grid/messages/setup_msg_test.py | tests/syft/grid/messages/setup_msg_test.py | # syft absolute
import syft as sy
from syft.core.io.address import Address
from syft.grid.messages.setup_messages import CreateInitialSetUpMessage
from syft.grid.messages.setup_messages import CreateInitialSetUpResponse
from syft.grid.messages.setup_messages import GetSetUpMessage
from syft.grid.messages.setup_messages... | apache-2.0 | Python | |
3608c4d3b559ba7fa1bd9629231e98196681caa4 | add package py-gdbgui (#7715) | tmerrick1/spack,krafczyk/spack,krafczyk/spack,LLNL/spack,EmreAtes/spack,iulian787/spack,LLNL/spack,LLNL/spack,mfherbst/spack,mfherbst/spack,matthiasdiener/spack,matthiasdiener/spack,EmreAtes/spack,krafczyk/spack,tmerrick1/spack,tmerrick1/spack,EmreAtes/spack,LLNL/spack,EmreAtes/spack,matthiasdiener/spack,iulian787/spac... | var/spack/repos/builtin/packages/py-gdbgui/package.py | var/spack/repos/builtin/packages/py-gdbgui/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
478072e8350d03655364ea9147bbe21bafabbcce | Add tests for template tags | makinacorpus/Geotrek,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek | geotrek/feedback/tests/test_template_tags.py | geotrek/feedback/tests/test_template_tags.py | from datetime import datetime
from django.test import TestCase
from geotrek.authent.tests.factories import UserFactory, UserProfileFactory
from geotrek.feedback.templatetags.feedback_tags import (
predefined_emails, resolved_intervention_info, status_ids_and_colors)
from geotrek.feedback.tests.factories import (P... | bsd-2-clause | Python | |
8355cb358d14589a194926d37beeb5af7af2a591 | Increase event image url limit from 200 | sussexstudent/falmer,sussexstudent/falmer,sussexstudent/falmer,sussexstudent/falmer | falmer/events/migrations/0012_auto_20170905_1208.py | falmer/events/migrations/0012_auto_20170905_1208.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-09-05 11:08
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0011_auto_20170905_1028'),
]
operations = [
migrations.AlterField... | mit | Python | |
a16b4401f37f08d8cb5e1f9ec1b7d4a3221360ab | Add test case for regular extrusion | nschloe/python4gmsh | test/test_regular_extrusion.py | test/test_regular_extrusion.py | # -*- coding: utf-8 -*-
"""Creates regular cube mesh by extrusion.
"""
import pygmsh
from helpers import compute_volume
def test():
x = 5
y = 4
z = 3
x_layers = 10
y_layers = 5
z_layers = 3
geom = pygmsh.built_in.Geometry()
p = geom.add_point([0, 0, 0], 1)
_, l, _ = geom.extrude(p... | bsd-3-clause | Python | |
5c7b70061d6e96619c6e3a40c87aaec39b408fdf | Enable subscription admin area | praekelt/ndoh-control,praekelt/ndoh-control,praekelt/ndoh-control,praekelt/ndoh-control | subscription/admin.py | subscription/admin.py | from django.contrib import admin
from subscription.models import MessageSet, Message, Subscription
admin.site.register(MessageSet)
admin.site.register(Message)
admin.site.register(Subscription)
| bsd-3-clause | Python | |
7bd6f3e7751deecfc3cd555fc071d722c856802c | Implement division using built in library function | dawsonjon/Chips-2.0,dawsonjon/Chips-2.0,dawsonjon/Chips-2.0,dawsonjon/Chips-2.0,dawsonjon/Chips-2.0 | chips/compiler/builtins.py | chips/compiler/builtins.py | #!/usr/bin/env python
"""Support Library for builtin Functionality"""
__author__ = "Jon Dawson"
__copyright__ = "Copyright (C) 2013, Jonathan P Dawson"
__version__ = "0.1"
builtins="""
unsigned unsigned_divide_xxxx(unsigned dividend, unsigned divisor){
unsigned denom = divisor;
unsigned bit = 1;
unsigned... | mit | Python | |
6eb49ae8dcf33a7d7be9ed3c8208bc83a9a46757 | Create python_wiki_one.py | stephaneAG/Python_tests,stephaneAG/Python_tests,stephaneAG/Python_tests,stephaneAG/Python_tests | ckOLDab/python_wiki_one.py | ckOLDab/python_wiki_one.py | import time
import BaseHTTPServer
HOST_NAME = '127.0.0.1' # !!!REMEMBER TO CHANGE THIS!!!
PORT_NUMBER = 80 # Maybe set this to 9000.
class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_HEAD(s):
s.send_response(200)
s.send_header("Content-type", "text/html")
s.end_headers()
... | mit | Python | |
4fd9984e4187a64906ca9e0b3a7ccf01486c156d | Create Fred14_LeftArmServos.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | home/Ray.Edgley/fred/fred01/Fred14_LeftArmServos.py | home/Ray.Edgley/fred/fred01/Fred14_LeftArmServos.py | #########################################################
# Fred14 Setup the Left Arm Servos
#########################################################
# We will be using the following services:
# Servo Service
#########################################################
# I Fred's Left Arm, we have the Bicep Rotator, t... | apache-2.0 | Python | |
53cdd6e7bcb37567382f3b3688b6a55f1b2968be | Add test_binaryclassifier | Neurita/darwin | tests/test_binaryclassifier.py | tests/test_binaryclassifier.py |
import numpy as np
from sklearn import svm, datasets
from darwin.pipeline import ClassificationPipeline
def test_binary_classification_with_classification_pipeline():
# generate the dataset
n_samples=100
n_features=20
x, y = datasets.make_gaussian_quantiles(mean=None, cov=1.0, n_samples=n_samples,
... | bsd-3-clause | Python | |
bb80025f3ed8169a2558e9c5c6bc4db5a862d7ae | Integrate LLVM at llvm/llvm-project@529a3d87a799 | yongtang/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,karllessard/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow,karllessard/tensorflow,yongtang/tensorflow,tensorflow/tensorflow-pywrap_saved_model,paolodedios/tensorflow,karllessard/tensorflow,t... | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "529a3d87a799a2cba29bc1d0f426a00d5bb4c88f"
LLVM_SHA256 = "3d2ca52bd36ad3904f2f5d0e43935b0e82f3d1ac137e0a89025141e36735944f"
tf_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "6139626d738fd03b968e07698f5cd26924e3cd65"
LLVM_SHA256 = "b9581ac44a7d9dd3a8470497cddb63c387ab6520d82d077fb609bc29b4e7b887"
tf_http_archive(
... | apache-2.0 | Python |
fee6e923b27947721ba1ea4ce5005f54eabba421 | Integrate LLVM at llvm/llvm-project@4504e1134c91 | yongtang/tensorflow,gautam1858/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-experimental_link_static_libraries_once,gautam1858/tensorflow,yongtang/tensorflow,Intel-Corporation/tensorflow,gautam1858/tensorflow,frreiss/tensorflow-fred,Intel-Corporation/tensorflow,Intel-... | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "4504e1134c9118f3c322685f8a90129e09bab92c"
LLVM_SHA256 = "2b1d7a96ff37600cae12d2ed51b9f0554b1bbc6511ffe51ac7525928b29bab44"
tf_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "0ad1d9fdf22dad41312e02b8bc990bf58ce1744c"
LLVM_SHA256 = "517db6d771cf24d9f0aea6d4fdd59591347c7eb9d86ef58521fe8cb929fbe82b"
tf_http_archive(
... | apache-2.0 | Python |
a868b0d057b34dbd487a1e3d2b08d5489651b3ff | Integrate LLVM at llvm/llvm-project@fe611b1da84b | Intel-tensorflow/tensorflow,Intel-Corporation/tensorflow,Intel-Corporation/tensorflow,paolodedios/tensorflow,Intel-Corporation/tensorflow,gautam1858/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-experimental_... | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "fe611b1da84b9442c093739394d336af9e99c1a1"
LLVM_SHA256 = "52edc892b020736f4c53e52b63687ee7caab93c90a0062b4026f4d49fc18266f"
tf_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "bd7ece4e063e7afd08cbaa311878c09aadf5ec21"
LLVM_SHA256 = "e9390dfa94c1143f35437bea8a011b030194e047bc3df45e2627cff88f83d2ed"
tf_http_archive(
... | apache-2.0 | Python |
d8d87a0cdcce8c8ec1770aa722a17a40d25409e6 | Add migration script to migrate all "extra" entries to lists | chennan47/osf.io,Nesiehr/osf.io,adlius/osf.io,aaxelb/osf.io,brianjgeiger/osf.io,mfraezz/osf.io,Nesiehr/osf.io,acshi/osf.io,laurenrevere/osf.io,cslzchen/osf.io,acshi/osf.io,caneruguz/osf.io,caseyrollins/osf.io,mfraezz/osf.io,Johnetordoff/osf.io,adlius/osf.io,sloria/osf.io,baylee-d/osf.io,brianjgeiger/osf.io,hmoco/osf.io... | scripts/migration/migrate_registration_extra_again.py | scripts/migration/migrate_registration_extra_again.py | """
Changes existing question.extra on all registrations and draft registrations
to a list. Required for multiple files attached to a question.
"""
import sys
import logging
from modularodm import Q
from website.app import init_app
from scripts import utils as scripts_utils
from website.models import Node, DraftRegist... | apache-2.0 | Python | |
a973c3b5d1683cd27f8b88c4c38daa934dae75c1 | refactor storeRegiser | Go-In/go-coup,Go-In/go-coup,Go-In/go-coup,Go-In/go-coup,Go-In/go-coup | usermanage/views/storeRegister.py | usermanage/views/storeRegister.py | from django.shortcuts import render, redirect
from django.http import HttpResponseRedirect
from django.contrib.auth import login, authenticate, logout
from django.contrib.auth.models import User, Group
from django.contrib.auth.decorators import login_required, user_passes_test, permission_required
from django.contrib.a... | mit | Python | |
9316bc07c77e2f51332a40bf430cef117f4d89e1 | Add script to check for Dockerfile coverage | rue89-tech/configuration,stvstnfrd/configuration,michaelsteiner19/open-edx-configuration,armaan/edx-configuration,hastexo/edx-configuration,armaan/edx-configuration,stvstnfrd/configuration,gsehub/configuration,stvstnfrd/configuration,hks-epod/configuration,open-craft/configuration,edx/configuration,open-craft/configura... | util/check_dockerfile_coverage.py | util/check_dockerfile_coverage.py | import yaml
import os
import pathlib2
import itertools
import argparse
import logging
import sys
TRAVIS_BUILD_DIR = os.environ.get("TRAVIS_BUILD_DIR")
CONFIG_FILE_PATH = pathlib2.Path(TRAVIS_BUILD_DIR, "util", "parsefiles_config.yml")
LOGGER = logging.getLogger(__name__)
def check_coverage(containers):
# open con... | agpl-3.0 | Python | |
c78c82987feb4dbe91b750ab90a3d163fc1340c6 | Add datatables filter mixin | allanlei/rhinocloud-utils | rhinocloud/contrib/jquery/views.py | rhinocloud/contrib/jquery/views.py | from django.views import generic
from django.db.models import Q
from django.core.exceptions import ImproperlyConfigured
class DataTablesServerDataMixin(object):
query_class = Q
initial_query_kwargs = {}
searchable_fields = ()
def get_searchable_fields(self):
if self.searchable_fields is n... | bsd-3-clause | Python | |
4aeec42ca745db546b66f0a708f1c13f806164f8 | Add commmand to re-assign person cases to facilities | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | custom/enikshay/management/commands/reassign_from_facility.py | custom/enikshay/management/commands/reassign_from_facility.py | from __future__ import absolute_import, print_function
import csv
import datetime
import six
from django.core.management.base import BaseCommand
from casexml.apps.case.util import get_all_changes_to_case_property
from corehq.apps.hqcase.utils import bulk_update_cases
from corehq.util.log import with_progress_bar
fro... | bsd-3-clause | Python | |
5e9a66fb07b8071a8ac3d2130c2796a7cda03739 | Create ConfigurationPIN.py | Timothee38/pythonScriptsAVC | ConfigurationPIN.py | ConfigurationPIN.py | # -*- coding: utf8 -*-
# Imports necessaires
import re
import sys
import os
import random
name = os.popen('whoami').read()
cutName = name.split("\n")
name = cutName[0]
sys.path.append('~/AndroidViewClient/src/')
from com.dtmilano.android.viewclient import ViewClient
from com.dtmilano.android.adb.adbclient import AdbCli... | mit | Python | |
805708048f493ca538a9e0b8d9d40ae1d4baf2c3 | Add a tool to reproduce HTTP KeepAlive races in OpenStack gate jobs. | JordanP/openstack-snippets,JordanP/openstack-snippets | keepalive-race/keep-alive-race.py | keepalive-race/keep-alive-race.py | #!/usr/bin/python3
"""
This script demonstrates a race condition with HTTP/1.1 keepalive
"""
import decimal
import json
import subprocess
import time
import threading
import requests
requests.packages.urllib3.disable_warnings()
CREDS = json.loads(subprocess.check_output(
"openstack --os-cloud devstack token issue... | apache-2.0 | Python | |
e18c1d6a62d8a896e853f1bd16d4ea5bf6f67401 | add statistics script | nikken1/patentprocessor,nikken1/patentprocessor,nikken1/patentprocessor,funginstitute/patentprocessor,funginstitute/patentprocessor,yngcan/patentprocessor,yngcan/patentprocessor,funginstitute/patentprocessor,yngcan/patentprocessor | statistics.py | statistics.py | #!/usr/bin/env python
"""
Takes the database from the output of integrate.py (e.g. after the disambiguated
inventors have been merged into the database) and computes statistics on top of it
"""
import uuid
from datetime import datetime
from lib import alchemy
from collections import Counter, defaultdict
def compute_f... | bsd-2-clause | Python | |
64314d580fac2cf0e0434527437b106a94e8ded0 | Add setup.py build for kivy-launcher reboot | kronenpj/python-for-android,germn/python-for-android,PKRoma/python-for-android,PKRoma/python-for-android,kivy/python-for-android,kivy/python-for-android,germn/python-for-android,germn/python-for-android,rnixx/python-for-android,PKRoma/python-for-android,PKRoma/python-for-android,kronenpj/python-for-android,kronenpj/pyt... | testapps/testlauncherreboot_setup/sdl2.py | testapps/testlauncherreboot_setup/sdl2.py | '''
Clone Python implementation of Kivy Launcher from kivy/kivy-launcher repo,
install deps specified in the OPTIONS['apk']['requirements'] and put it
to a dist named OPTIONS['apk']['dist-name'].
Tested with P4A Dockerfile at 5fc5241e01fbbc2b23b3749f53ab48f22239f4fc,
kivy-launcher at ad5c5c6e886a310bf6dd187e992df97286... | mit | Python | |
e11de6b814da4e5ade9fadaa035d6141ab3c113f | add test that features can be read and written ok | salilab/rmf,salilab/rmf,salilab/rmf,salilab/rmf | test/test_features.py | test/test_features.py | #!/usr/bin/python
import unittest
import RMF
class GenericTest(unittest.TestCase):
def _create(self, path):
fh= RMF.create_rmf_file(path)
rt= fh.get_root_node()
reps=[rt.add_child("rep"+str(i), RMF.REPRESENTATION) for i in range(0,5)]
sf= RMF.ScoreFactory(fh)
fn= rt.add_child("feature... | apache-2.0 | Python | |
48da7ceb86387d3cb6fd53f50110232813123ecc | Add tests for ansible roster virtual | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/pytests/unit/roster/test_ansible.py | tests/pytests/unit/roster/test_ansible.py | import pytest
import salt.roster.ansible as ansible
from tests.support.mock import patch
@pytest.mark.xfail
@pytest.mark.parametrize(
"which_value",
[False, None],
)
def test_virtual_returns_False_if_ansible_inventory_doesnt_exist(which_value):
with patch("salt.utils.path.which", autospec=True, return_val... | apache-2.0 | Python | |
f3e3ab4fea1d367578adffbefd072616beaee65e | Create word_a10n.py | Kunalpod/codewars,Kunalpod/codewars | word_a10n.py | word_a10n.py | #Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Word a10n (abbreviation)
#Problem level: 6 kyu
import re
def abbreviate(s):
words = re.findall('[A-Za-z][A-Za-z][A-Za-z][A-Za-z]+', s)
for word in words:
s = s.replace(word, word[0] + str(len(word) - 2) + word[-1])
return s
| mit | Python | |
ccb2c0c2c2fac64b88248819b00feddeaafd252c | Create evernote_test.py | py-in-the-sky/challenges,py-in-the-sky/challenges,py-in-the-sky/challenges | evernote_test.py | evernote_test.py | from evernote import *
NOTE1 = """<note>
<guid>6BA8DC47-EB38-40D9-BE32-5D5DD82E9EC7</guid>
<created>2013-07-12T19:22:13Z</created>
<tag>poetry</tag>
<tag>whitman</tag>
<content>
Gliding o'er all, through all,
Through Nature, Time, and Space,
As a ship on the waters advancing,
The voyage of th... | mit | Python | |
8dd3207298e7d81f5d4abdfa62604d5849d132fd | Add Python hello client | lizenn/erlang-dbus,lizenn/erlang-dbus | example/hello.py | example/hello.py | #!/usr/bin/env python
import dbus
bus = dbus.SessionBus()
remote_object = bus.get_object("org.za.hem.DBus", "/Root")
dbus_interface = "org.designfu.SampleInterface"
iface = dbus.Interface(remote_object, dbus_interface)
hello_reply_list = remote_object.HelloWorld(17, "Hello from example-client.py!", dbus_interface=d... | apache-2.0 | Python | |
5836eb513b244a21e33e111cd3c3d6f33530aeae | Add a simple widget that sets up basic layout for common controls. | 4degrees/harmony | source/harmony/ui/widget/simple.py | source/harmony/ui/widget/simple.py | # :coding: utf-8
# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
# :license: See LICENSE.txt.
from PySide import QtGui
from .base import Widget
class Simple(Widget):
'''Simple widget that wraps a single control.'''
def _construct(self):
'''Construct widget.'''
super(Simple, self).... | apache-2.0 | Python | |
6b5850d70a1c52b617fc7daeefa57023f6ef63c7 | Add some paramaterized tests for skolemization and de-skolemization | RDFLib/rdflib,RDFLib/rdflib,RDFLib/rdflib,RDFLib/rdflib | test/test_graph/test_skolemization.py | test/test_graph/test_skolemization.py | import logging
import re
from test.testutils import GraphHelper
from typing import Pattern, Union
import pytest
from rdflib import Graph
from rdflib.namespace import Namespace
from rdflib.term import BNode, Literal, URIRef
EG = Namespace("http://example.com/")
base_triples = {
(EG.subject, EG.predicate, EG.obje... | bsd-3-clause | Python | |
a35be4a666c26ec13d61ee30639d9c3894d129e1 | add py script for profiling time | mandiant/capa,mandiant/capa | scripts/profile-time.py | scripts/profile-time.py | import sys
import timeit
import logging
import argparse
import subprocess
import tqdm
import tabulate
import capa.main
import capa.perf
import capa.rules
import capa.engine
import capa.helpers
import capa.features
import capa.features.common
import capa.features.freeze
logger = logging.getLogger("capa.profile")
de... | apache-2.0 | Python | |
8628ab8cbcb185826e97af9148ec7d07861e29e7 | Add setup_pfiles.py to setup parameter files for CIAO tools | liweitianux/chandra-acis-analysis,liweitianux/chandra-acis-analysis,liweitianux/chandra-acis-analysis | scripts/setup_pfiles.py | scripts/setup_pfiles.py | # Copyright (c) 2017 Weitian LI <liweitianux@live.com>
# MIT license
#
# Weitian LI
# 2017-02-06
"""
Prepare the CIAO parameter files and setup the PFILES environment
variable to keep the pfiles locally, in order to avoid the conflicts
between multiple instance of the same CIAO tools.
"""
import os
import subprocess
... | mit | Python | |
6c8966e0e299c12e95d41009a8dde7519946b432 | add db level constraint for one active subscription per domain | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/accounting/migrations/0006_unique_active_domain_subscription.py | corehq/apps/accounting/migrations/0006_unique_active_domain_subscription.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-04-22 17:18
from __future__ import unicode_literals
from django.db import migrations
from corehq.sql_db.operations import HqRunSQL
class Migration(migrations.Migration):
dependencies = [
('accounting', '0005_automatic_downgrade_adjustment_met... | bsd-3-clause | Python | |
faaa206923b99f4d986a32ddfd854b234377e988 | Add ena2fasta script | RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline | bin/ena2fasta.py | bin/ena2fasta.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright [2009-2020] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE... | apache-2.0 | Python | |
c6af972ca6dfd6396b3f16e2e218263faffe16ab | Add run_mraic.py | mgharvey/misc_python | bin/run_mraic.py | bin/run_mraic.py | #!/usr/bin/env python
"""
Name: run_mraic.py
Author: Michael G. Harvey
Date: 5 July 2013
Description: Run mraic.pl (Nylanderb 2004) on a folder of alignments in phylip/phyml format.
Usage: python run_mraic.py mraic_dir in_dir out_dir
python run_mraic.py /Users/michaelharvey/Applications/mraic /Users/michaelharvey... | bsd-3-clause | Python | |
2e43441e43942b2f24a89209cfdc56652523901d | Create test_pir.py | somchaisomph/RPI.GPIO.TH | test/test_pir.py | test/test_pir.py | from ...
if __name__ == "__main__":
try :
pir = PIR()
pir.start()
while 1 :
print(pir.result())
except KeyboardInterrupt :
pir.stop()
pir.cleanup()
| mit | Python | |
ed2548ca027b4fd062a10ddf2ce359d9115f40a4 | add a __main__.py to nuitka works | edgewood/borg,RonnyPfannschmidt/borg,raxenak/borg,RonnyPfannschmidt/borg,edgewood/borg,ionelmc/borg,edgewood/borg,ionelmc/borg,raxenak/borg,edgewood/borg,edgimar/borg,edgimar/borg,raxenak/borg,level323/borg,level323/borg,mhubig/borg,ionelmc/borg,edgimar/borg,edgimar/borg,RonnyPfannschmidt/borg,level323/borg,RonnyPfanns... | borg/__main__.py | borg/__main__.py | from borg.archiver import main
main()
| bsd-3-clause | Python | |
8195278aa5044371c8fa7963be15169209e1b92a | Add new test to call neutron API and check results in dragonflow db. | FrankDuan/df_code,FrankDuan/df_code,openstack/dragonflow,openstack/dragonflow,FrankDuan/df_code,openstack/dragonflow | dragonflow/tests/fullstack/test_neutron_api.py | dragonflow/tests/fullstack/test_neutron_api.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... | apache-2.0 | Python | |
fefe47a03337d072e47b439a940d7b6eeef56b93 | Add OpenTracing example | instana/python-sensor,instana/python-sensor | example/opentracing.py | example/opentracing.py | # encoding=utf-8
import opentracing
import instana
import time
# Loop continuously with a 2 second sleep to generate traces
while True:
entry_span = opentracing.tracer.start_span('universe')
entry_span.set_tag('http.method', 'GET')
entry_span.set_tag('http.url', '/users')
entry_span.set_tag('span.kind... | mit | Python | |
f3448d0b37fdac8976a2cc8e4604a6cb2ea7a4ed | add vsmlib.utils which should have been part of commit 6238f235 | treitter/vehicle_signal_manager,GENIVI/vehicle_signal_manager | vsmlib/utils.py | vsmlib/utils.py | def parse_signal_num_file(filename):
signal_to_num = {}
vsi_version = -1
try:
with open(filename) as signal_to_num_file:
lines = signal_to_num_file.readlines()
for line in lines:
line_stripped = line.strip()
if vsi_version < 0:
... | mpl-2.0 | Python | |
8bd66387ba5cd50dc0b545dc7b627792ed601faa | Add test | samedhi/gaend,samedhi/gaend,talkiq/gaend,talkiq/gaend | tests/context.py | tests/context.py | import os
import sys
sys.path.insert(0, os.path.abspath('..'))
import gaend
| mit | Python | |
59e546ae5afe22aab967e5376c8799e29ccbd86a | Add the basic version of my file comparison script | kirkchambe/random_scripts | directoryFileContentCmp.py | directoryFileContentCmp.py | #! /usr/env/python
import os
import hashlib
import sys
bufsize = 65536
# Path1 = '/Users/kirkchambers/Desktop'
# Path2 = '/Users/kirkchambers/DataSets'
def generate_file_digests_for(path):
path_set = set()
for item in os.walk(path):
(directory, _subdirectories, files) = item
for file in files:
if (file[0] ==... | mit | Python | |
345758259d9ee80826758373c3970db1c28a870b | Bump development version | sephii/djangocms-blog,marty3d/djangocms-blog,dapeng0802/djangocms-blog,mistalaba/djangocms-blog,vnavascues/djangocms-blog,kriwil/djangocms-blog,DjangoBeer/djangocms-blog,EnglishConnection/djangocms-blog,britny/djangocms-blog,mistalaba/djangocms-blog,creimers/djangocms-blog,jedie/djangocms-blog,nephila/djangocms-blog,kr... | djangocms_blog/__init__.py | djangocms_blog/__init__.py | __version__ = '0.3.a3'
| __version__ = '0.3.a2'
| bsd-3-clause | Python |
4af2a6a62e4be78bd20550c3ae5089c51b4fec62 | add separate function for pagination | samitnuk/studentsdb,samitnuk/studentsdb,samitnuk/studentsdb | students/utils.py | students/utils.py | from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
def paginate(objects, size, request, context, var_name='object_list'):
"""Paginate objects provided by view.
This function takes:
* list of elements;
* number of objects per page;
* request object to get url para... | mit | Python | |
0ee1150e1f8f0c8cae7b906c4d349b8867bbe0b4 | Add dmrg example | sunqm/pyscf,gkc1000/pyscf,gkc1000/pyscf,sunqm/pyscf,gkc1000/pyscf,sunqm/pyscf,gkc1000/pyscf,gkc1000/pyscf,sunqm/pyscf | examples/dmrg/30-dmrg_casscf_nevpt2_for_Cr2.py | examples/dmrg/30-dmrg_casscf_nevpt2_for_Cr2.py | #!/usr/bin/env python
import numpy
from pyscf import gto
from pyscf import scf
from pyscf import mcscf
from pyscf.mrpt.nevpt2 import sc_nevpt
from pyscf.dmrgscf.dmrgci import DMRGSCF
#
# This calculation requires about 10 GB memory per processor.
#
b = 1.5
mol = gto.Mole()
mol.verbose = 5
mol.output = 'cr2-%3.2f.out'... | apache-2.0 | Python | |
1830c24988fccd7069bb4f9d4c66940ce623425f | add execute apcupsd cgi sample | thinkAmi-sandbox/apcupsd_python-sample | execute_apcupsd_cgi.py | execute_apcupsd_cgi.py | from http.server import CGIHTTPRequestHandler, test
import os
def main():
# http://stackoverflow.com/questions/11419572/how-to-set-the-documentroot-while-using-pythons-httpserver
os.chdir(r"C:\apcupsd")
# ディレクトリ名の前の`/`を付け忘れると正常に動作しない
CGIHTTPRequestHandler.cgi_directories = ["/cgi"]
test... | unlicense | Python | |
c3afc6c28530c3dfc3bd57d9a1841a60bf92ba4f | Fix bug which caused page cyclers to always clear cache before load. | mohamed--abdel-maksoud/chromium.src,patrickm/chromium.src,chuan9/chromium-crosswalk,jaruba/chromium.src,Chilledheart/chromium,littlstar/chromium.src,fujunwei/chromium-crosswalk,jaruba/chromium.src,chuan9/chromium-crosswalk,Pluto-tv/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,mogoweb/chromium-crosswalk,hgl888/ch... | tools/perf/benchmarks/netsim_top25.py | tools/perf/benchmarks/netsim_top25.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry import test
from perf_tools import page_cycler
class NetsimTop25(test.Test):
"""Measures load time of the top 25 sites under simulated cab... | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry import test
from perf_tools import page_cycler
class NetsimTop25(test.Test):
"""Measures load time of the top 25 sites under simulated cab... | bsd-3-clause | Python |
00a99f80f555ae23aeefa8b8fe284f74c28f4252 | add update example | kisel/trex-core,dimagol/trex-core,kisel/trex-core,dimagol/trex-core,kisel/trex-core,dimagol/trex-core,dimagol/trex-core,kisel/trex-core,dimagol/trex-core,kisel/trex-core,dimagol/trex-core,kisel/trex-core | scripts/automation/trex_control_plane/stl/examples/stl_imix_bidir_update.py | scripts/automation/trex_control_plane/stl/examples/stl_imix_bidir_update.py | import stl_path
from trex_stl_lib.api import *
import imp
import time
import json
from pprint import pprint
import argparse
# IMIX test
# it maps the ports to sides
# then it load a predefind profile 'IMIX'
# and attach it to both sides and inject
# at a certain rate for some time
# finally it checks that all packets... | apache-2.0 | Python | |
b5c21a5eeb8894ae93290c4c78fa23e5207bc0b3 | Create Flaskapp.wsgi | DreamN/Pic-storage,DreamN/Pic-storage,DreamN/Pic-storage | Flaskapp.wsgi | Flaskapp.wsgi | #!/usr/bin/python
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/FlaskApp/")
from FlaskApp import app as application
application.secret_key = 'Add your secret key'
| mit | Python | |
3c2f3baa1a76d386d5604c0c1dc8d4f3a33b11ad | Create Helloworld.py | codyrad/test,codyrad/test,codyrad/test,codyrad/test,codyrad/test,codyrad/test | Helloworld.py | Helloworld.py | print('Hello World!')
| cc0-1.0 | Python | |
13e4fbdf81c9012ff82081d6030191be226d716c | Add script for verifying commit message format. | pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython | tools/verifygitlog.py | tools/verifygitlog.py | #!/usr/bin/env python3
import re
import subprocess
import sys
verbosity = 0 # Show what's going on, 0 1 or 2.
suggestions = 1 # Set to 0 to not include lengthy suggestions in error messages.
def verbose(*args):
if verbosity:
print(*args)
def very_verbose(*args):
if verbosity > 1:
print(*... | mit | Python | |
ee614036b45e9f10f680cef56a5eaa2d86c424fb | Create cybercrimeatmtracker.py | yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti,yeti-platform/yeti | plugins/feeds/public/cybercrimeatmtracker.py | plugins/feeds/public/cybercrimeatmtracker.py | import re
import logging
from dateutil import parser
from datetime import datetime, timedelta
from core.observables import Hash
from core.feed import Feed
from core.errors import ObservableValidationError
class CybercrimeAtmTracker(Feed):
default_values = {
'frequency': timedelta(hours=1),
'name'... | apache-2.0 | Python | |
ece838042acd75ba7edde833856ac02e4efe9977 | Create PPTconnect.py | cadavrege0733/YammerPlus | PPTconnect.py | PPTconnect.py | from TwitterAPI import TwitterAPI
import win32com.client
from MSO import *
# Open PowerPoint
Application = win32com.client.Dispatch("PowerPoint.Application")
# Add a presentation
Presentation = Application.Presentations.Add()
# Go to http://dev.twitter.com and create an app.
# The consumer key and secret will be ge... | apache-2.0 | Python | |
65029a09af9dcafc156a5a0632a63e3cf4b6c50d | add benchmark to compare to lasagne | diogo149/treeano,diogo149/treeano,diogo149/treeano | benchmarks/lag_task_lasgne.py | benchmarks/lag_task_lasgne.py | from __future__ import division, absolute_import
from __future__ import print_function, unicode_literals
import numpy as np
import theano
import theano.tensor as T
import lasagne
fX = theano.config.floatX
# ################################## config ##################################
N_TRAIN = 1000
LAG = 10
LENGTH =... | apache-2.0 | Python | |
33abec38e82e132a6e192d5ae0535b84d8aa47f4 | add import script for Poole | DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_poole.py | polling_stations/apps/data_collection/management/commands/import_poole.py | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E06000029'
addresses_name = 'parl.2017-06-08/Version 1/Democracy_Club__08June2017.CSV'
stations_name = 'parl.2017-06-08/Version 1/Democracy_Club__08June2017.CS... | bsd-3-clause | Python | |
b6b92e278202c27b124909aa5352726799d8d162 | add stack with max python solution | Liuqian0501/elements-of-programming-interview,Liuqian0501/elements-of-programming-interview,Liuqian0501/elements-of-programming-interview | 08-stack-n-queue/8.1-stack-with-max/python/stackMax.py | 08-stack-n-queue/8.1-stack-with-max/python/stackMax.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 18 10:08:25 2017
@author: LiuQianKevin
"""
class Stack:
class cache:
def __init__(self, _max = -float('inf'), count = 0):
self.max = _max;
self.count = count;
def __init__(self):
self._el... | mit | Python | |
f78f74d836d2eca1cafe3b6401b5c8d13e6d139b | Fix type1/type2 | GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,makinacorpus/Geotrek | geotrek/tourism/migrations/0004_auto_20190328_1339.py | geotrek/tourism/migrations/0004_auto_20190328_1339.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2019-03-28 12:39
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tourism', '0003_auto_20190306_1417'),
]
operations = [
migrations.AlterFie... | bsd-2-clause | Python | |
ef751116c597dfbd12eac849dd0cb3ca02eb6315 | Add SettingsFromCategoryModel that lists settings in a certain category | onitake/Uranium,onitake/Uranium | UM/Qt/Bindings/SettingsFromCategoryModel.py | UM/Qt/Bindings/SettingsFromCategoryModel.py | from PyQt5.QtCore import Qt, QCoreApplication, pyqtSlot
from UM.Qt.ListModel import ListModel
from UM.Settings.Setting import Setting
from UM.Resources import Resources
from UM.Application import Application
class SettingsFromCategoryModel(ListModel):
NameRole = Qt.UserRole + 1
TypeRole = Qt.UserRole + 2
... | agpl-3.0 | Python | |
f29a0845bc0983e18ce6484543b206dfb3091818 | Add easier way to import cv2 | OSURoboticsClub/underwater,OSURoboticsClub/underwater,OSURoboticsClub/underwater,OSURoboticsClub/underwater | vision/opencv.py | vision/opencv.py | import sys
sys.path.append('lib/opencv/build/lib')
import cv2
| mit | Python | |
2848955e59b5106ffe48c4ebfa05095a6be460e5 | Add visual script | Bob-King/WifiTrafficAnalyzer,Bob-King/WifiTrafficAnalyzer,Bob-King/WifiTrafficAnalyzer | visual/visual.py | visual/visual.py | #!/usr/bin/env python3
import re
import numpy as np
import matplotlib.pyplot as plt
import unittest
class Parser:
'''Wta log parser'''
def __init__(self):
'''Open log file'''
self._pattern = re.compile(
r'^ra=((?:[0-9a-fA-F]{2}:){5}(?:[0-9a-fA-F]{2}))[ \t]+' +
r'ta=((?:[0-9a-fA-F]{2}:){5}(?:[0-9a-fA-F]{2... | bsd-3-clause | Python | |
b5cc83a705eaa22872d304b92c7b6e57b5581604 | Add unit-test for "readbytes_multiple" | exhuma/puresnmp,exhuma/puresnmp | puresnmp/test/test/test_helpers.py | puresnmp/test/test/test_helpers.py | '''
Tests for unit-test helpers
'''
from textwrap import dedent
from binascii import hexlify
import puresnmp.test as th
from io import StringIO
def test_readbytes_multiple():
data = StringIO(dedent(
'''\
#
# This is a comment
#
30 2d 02 01 01 04 07 70 72 69 76 61 74 65 a... | mit | Python | |
f434e45b58bfa7001d21d1920a65903f941df833 | Add __main__.py so that the package can be executed by `python -m jiebarpc` [ciskip] | messense/jieba-rpc | jiebarpc/__main__.py | jiebarpc/__main__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import sys
import argparse
from jiebarpc import JiebaRPCServer, JiebaRPCDispatcher
def main(host, port, processnum=1):
server = JiebaRPCServer(JiebaRPCDispatcher(processnum))
server.listen(host, port)
s... | mit | Python | |
5d297710416ebaea3a79e1ded0604d53178c493a | add python solution for Project Euler problem 1 | bruckhaus/challenges,bruckhaus/challenges,bruckhaus/challenges,bruckhaus/challenges | python_challenges/project_euler/problem_1.py | python_challenges/project_euler/problem_1.py | __author__ = 'tilmannbruckhaus'
def divisible_by_3_or_5(i):
divisible = i % 3 == 0 or i % 5 == 0
# print("natural number:", i, "is divisible:", divisible)
return divisible
def sum_of_multiples_of_3_or_5(limit):
# If we list all the natural numbers below 10 that are multiples of 3 or 5,
# we get ... | mit | Python | |
1db14473edff479f97703fb68cb1aa8d65c25023 | Add Python benchmark | stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib,stdlib-js/stdlib | lib/node_modules/@stdlib/math/base/special/exp/benchmark/python/benchmark.py | lib/node_modules/@stdlib/math/base/special/exp/benchmark/python/benchmark.py | #!/usr/bin/env python
"""Benchmark exp."""
import timeit
name = "exp"
repeats = 3
iterations = 1000000
def print_version():
"""Print the TAP version."""
print("TAP version 13")
def print_summary(total, passing):
"""Print the benchmark summary.
# Arguments
* `total`: total number of tests
... | apache-2.0 | Python | |
d1f4e257b449b6993e0cdc87055113018b6efabb | Create promoter_bin.py | ShaopengLiu1/Atac-seq_Quality_Control_pipe,ShaopengLiu1/Atac-seq_Quality_Control_pipe,ShaopengLiu1/Atac-seq_Quality_Control_pipe | code_collection/promoter_bin.py | code_collection/promoter_bin.py | import sys
peak=[]
with open(sys.argv[1],'r') as f:
for line in f:
line=line.strip('\n').split('\t')
peak.append(int(line[3]))
f.close()
num=int(len(peak)/100.0)
bin=[]
for i in range(99):
bin.append(str(i+1)+'\t'+str(sum(peak[num*i:num*(i+1)])/(num*1.0))+'\n')
bin.append('100'+'\t'+str(sum(peak[num*99:])/(num*... | mit | Python | |
93a3b7d61877e9350ea2b32ade918755fc874bb8 | Create run_test.py | ceholden/staged-recipes,basnijholt/staged-recipes,patricksnape/staged-recipes,chrisburr/staged-recipes,sannykr/staged-recipes,ReimarBauer/staged-recipes,hadim/staged-recipes,stuertz/staged-recipes,pmlandwehr/staged-recipes,rvalieris/staged-recipes,jakirkham/staged-recipes,jakirkham/staged-recipes,isuruf/staged-recipes,... | recipes/django-environ/run_test.py | recipes/django-environ/run_test.py | import django
from django.conf import settings
settings.configure(INSTALLED_APPS=['environ', 'django.contrib.contenttypes', 'django.contrib.auth'])
django.setup()
import environ
| bsd-3-clause | Python | |
19186f44b1ed4c4b60ffc1ef796fa0894b25da68 | Add garage.partdefs.sockets | clchiou/garage,clchiou/garage,clchiou/garage,clchiou/garage | py/garage/garage/partdefs/sockets.py | py/garage/garage/partdefs/sockets.py | from garage import parameters
from garage import parts
from garage import sockets
PARTS = parts.Parts(sockets.__name__)
PARTS.patch_getaddrinfo = parts.AUTO
PARAMS = parameters.define_namespace(sockets.__name__, 'socket utils')
PARAMS.patch_getaddrinfo = parameters.create(
False, 'enable patching getaddrinfo fo... | mit | Python | |
a25e2c0e5d8466e449641fb4c1c74a6e9872da75 | add connection module for pyRpc | ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study | python/proto/pyRpc/tcp_connection.py | python/proto/pyRpc/tcp_connection.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2016 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyrig... | bsd-2-clause | Python | |
b7d23a337ad121a032a8aa2c395c3705bad12b28 | add migration to grandfather in all existing plans to have Case Sharing via Groups and Child Cases privileges | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/accounting/migrations/0043_grandfather_case_privs.py | corehq/apps/accounting/migrations/0043_grandfather_case_privs.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.21 on 2019-07-23 16:43
from __future__ import unicode_literals
from __future__ import absolute_import
from django.core.management import call_command
from django.db import migrations
from corehq.apps.hqadmin.management.commands.cchq_prbac_bootstrap import (
cchq_... | bsd-3-clause | Python | |
304826205804e3972968b16fbf9bb9021eaf9acd | add FieldOfStudyHierarchy class | citationfinder/scholarly_citation_finder | scholarly_citation_finder/apps/core/migrations/0015_fieldofstudyhierarchy.py | scholarly_citation_finder/apps/core/migrations/0015_fieldofstudyhierarchy.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-11 13:19
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0014_publicationreference_source'),
]
opera... | mit | Python | |
ce4bcc19e61518273e054553494288364ab4f677 | Add lc085_maximal_rectangle.py | bowen0701/algorithms_data_structures | lc085_maximal_rectangle.py | lc085_maximal_rectangle.py | """Leetcode 85. Maximal Rectangle
Hard
URL: https://leetcode.com/problems/maximal-rectangle/
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle
containing only 1's and return its area.
Example:
Input:
[
["1","0","1","0","0"],
["1","0","1","1","1"],
["1","1","1","1","1"],
["1","0","0... | bsd-2-clause | Python | |
5d8af7dec1806e7f897a89d1a54ff5f2dc5bfec0 | Add 'merge-json.py' script to make the final annotations file. | mtholder/propinquity,OpenTreeOfLife/propinquity,mtholder/propinquity,OpenTreeOfLife/propinquity,OpenTreeOfLife/propinquity,mtholder/propinquity | bin/merge-json.py | bin/merge-json.py | #!/usr/bin/env python
from collections import Mapping
import json
import sys
filename1 = sys.argv[1]
filename2 = sys.argv[2]
json_data1=open(filename1).read()
dictA = json.loads(json_data1)
json_data2=open(filename2).read()
dictB = json.loads(json_data2)
merged_dict = {key: value for (key, value) in (dictA.items() +... | bsd-2-clause | Python | |
7f319b9f84e441cbe893fd2cc68ecd77cfcfd987 | create perl-file-which package (#6800) | LLNL/spack,krafczyk/spack,EmreAtes/spack,mfherbst/spack,EmreAtes/spack,tmerrick1/spack,tmerrick1/spack,iulian787/spack,matthiasdiener/spack,krafczyk/spack,tmerrick1/spack,krafczyk/spack,LLNL/spack,iulian787/spack,mfherbst/spack,mfherbst/spack,iulian787/spack,matthiasdiener/spack,matthiasdiener/spack,EmreAtes/spack,iuli... | var/spack/repos/builtin/packages/perl-file-which/package.py | var/spack/repos/builtin/packages/perl-file-which/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
a2b4389db17759086c4cd804b6cbfb1b658d547e | Create equal_sides_of_an_array.py | Kunalpod/codewars,Kunalpod/codewars | equal_sides_of_an_array.py | equal_sides_of_an_array.py | #Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Equal Sides Of An Array
#Problem level: 6 kyu
def find_even_index(arr):
if not sum(arr[1:]): return 0
if not sum(arr[:len(arr)-1]): return len(arr)-1
for i in range(1, len(arr)-1):
if sum(arr[:i])==sum(arr[i+1:]):
return i
retur... | mit | Python | |
d2978eae5b502cc5bc4b020044b88f02522f90cd | Add jobs.utils module | virtool/virtool,virtool/virtool,igboyes/virtool,igboyes/virtool | virtool/jobs/utils.py | virtool/jobs/utils.py | def is_running_or_waiting(document):
latest_state = document["status"][-1]["state"]
return latest_state != "waiting" and latest_state != "running"
| mit | Python | |
3bae93629c81cc33e565912e4b9bafeff536ec22 | Create hostgroup_info.py | linearregression/platform-python-lsf-api,PlatformLSF/platform-python-lsf-api,xlyang0211/platform-python-lsf-api | examples/hostgroup_info.py | examples/hostgroup_info.py | def queryHostGroupInfo():
"""
"query host group info"
"""
if lsf.lsb_init("queryHostGroupInfo") > 0:
return -1;
strArr = lsf.new_stringArray(2);
lsf.stringArray_setitem(strArr, 0, "hg1");
lsf.stringArray_setitem(strArr, 1, "hg2");
for hgroupInfo in lsf.get_hostgroup_info_by_name... | epl-1.0 | Python | |
986b20363cc84be1822588dd7cc935fca7ef7f48 | add test for get_genofile_samplelist in marker_regression/run_mapping.py | pjotrp/genenetwork2,zsloan/genenetwork2,zsloan/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2 | wqflask/tests/wqflask/marker_regression/test_run_mapping.py | wqflask/tests/wqflask/marker_regression/test_run_mapping.py | import unittest
from unittest import mock
from wqflask.marker_regression.run_mapping import get_genofile_samplelist
class AttributeSetter:
def __init__(self,obj):
for k,v in obj.items():
setattr(self,k,v)
class MockDataSetGroup(AttributeSetter):
def get_genofiles(self):
return [{"location":"~/genofiles/g... | agpl-3.0 | Python | |
fe145fd87db777d9eeb361688d502b1b3ec4b2e1 | Add a new Model-View-Projection matrix tool. | microy/MeshToolkit,microy/PyMeshToolkit,microy/MeshToolkit,microy/PyMeshToolkit | Transformation.py | Transformation.py | # -*- coding:utf-8 -*-
# ***************************************************************************
# Transformation.py
# -------------------
# update : 2013-11-13
# copyright : (C) 2013 by Michaël Roy
# email :... | mit | Python | |
c2089b3ed549d89942f57075d0b6d573d980bc30 | make app load in worker in uwsgi.ini, pass db configuration dynamically to docker image as env variable | jacohend/flask-restless-security,jacohend/flask-restless-security | app/config.py | app/config.py | from datetime import timedelta
class Config(object):
DEBUG = False
TESTING = False
SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://{}:{}@{}/{}'
APP_NAME = '{} Server'
SECRET_KEY = '{}'
JWT_EXPIRATION_DELTA = timedelta(days=30)
JWT_AUTH_URL_RULE = '/api/v1/auth'
SECURITY_REGISTERABLE =... | mit | Python | |
2f0700093141643bd66e99d271f9e74087e148e6 | Add Message model migration file. | qubs/climate-data-api,qubs/climate-data-api,qubs/data-centre,qubs/data-centre | core/migrations/0002_message.py | core/migrations/0002_message.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-08-05 19:19
from __future__ import unicode_literals
import django.contrib.postgres.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial')... | apache-2.0 | Python | |
68dbfedf90fb9e6c922971deaeccad148a258a70 | Add tests for PyEcore extension (EClass/EModelElement tests) | aranega/pyecore,pyecore/pyecore | tests/test_dynamic_ecore_extension.py | tests/test_dynamic_ecore_extension.py | import pytest
from pyecore.ecore import *
import pyecore.ecore as ecore
from ordered_set import OrderedSet
def test__EModelElement_extension():
A = EClass('A', superclass=(EModelElement.eClass))
a = A()
assert a.eAnnotations == OrderedSet()
annotation = EAnnotation(source='testAnnot')
annotation.... | bsd-3-clause | Python | |
40431228c8535f325b005bb52485cae87a8be714 | Add test module for napalm_acl | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/unit/modules/test_napalm_acl.py | tests/unit/modules/test_napalm_acl.py | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Anthony Shaw <anthonyshaw@apache.org>`
'''
# Import Python Libs
from __future__ import absolute_import
# Import Salt Testing Libs
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.unit import TestCase, skipIf
from tests.support.mock import (... | apache-2.0 | Python | |
f987b39bb43301c735f30169010832665953efe6 | Add a sample permission plugin for illustrating the check on realm resources, related to #6211. | pkdevbox/trac,pkdevbox/trac,pkdevbox/trac,pkdevbox/trac | sample-plugins/public_wiki_policy.py | sample-plugins/public_wiki_policy.py | from fnmatch import fnmatchcase
from trac.config import Option
from trac.core import *
from trac.perm import IPermissionPolicy
class PublicWikiPolicy(Component):
"""Sample permission policy plugin illustrating how to check
permission on realms.
Don't forget to integrate that plugin in the appropriate pl... | bsd-3-clause | Python | |
784cd71fe24b1f5ce57a1982186dabc768892883 | Fix discount calculation logic | KenMutemi/saleor,maferelo/saleor,car3oon/saleor,tfroehlich82/saleor,laosunhust/saleor,rchav/vinerack,laosunhust/saleor,UITools/saleor,spartonia/saleor,itbabu/saleor,UITools/saleor,mociepka/saleor,UITools/saleor,HyperManTT/ECommerceSaleor,jreigel/saleor,tfroehlich82/saleor,UITools/saleor,jreigel/saleor,HyperManTT/EComme... | saleor/product/models/discounts.py | saleor/product/models/discounts.py | from __future__ import unicode_literals
from django.conf import settings
from django.db import models
from django.utils.translation import pgettext_lazy
from django.utils.encoding import python_2_unicode_compatible
from django_prices.models import PriceField
from prices import FixedDiscount
class NotApplicable(Value... | from __future__ import unicode_literals
from django.conf import settings
from django.db import models
from django.utils.translation import pgettext_lazy
from django.utils.encoding import python_2_unicode_compatible
from django_prices.models import PriceField
from prices import FixedDiscount
class NotApplicable(Value... | bsd-3-clause | Python |
c35fa6caa631b03c3b5b3c9ea5bf494254ed9b1f | add script for usb backend to receive tracing data | nashif/zephyr,Vudentz/zephyr,Vudentz/zephyr,nashif/zephyr,finikorg/zephyr,galak/zephyr,zephyrproject-rtos/zephyr,zephyrproject-rtos/zephyr,Vudentz/zephyr,finikorg/zephyr,zephyrproject-rtos/zephyr,galak/zephyr,Vudentz/zephyr,zephyrproject-rtos/zephyr,finikorg/zephyr,nashif/zephyr,finikorg/zephyr,nashif/zephyr,galak/zeph... | scripts/tracing/trace_capture_usb.py | scripts/tracing/trace_capture_usb.py | #!/usr/bin/env python3
#
# Copyright (c) 2019 Intel Corporation.
#
# SPDX-License-Identifier: Apache-2.0
"""
Script to capture tracing data with USB backend.
"""
import usb.core
import usb.util
import argparse
import sys
def parse_args():
global args
parser = argparse.ArgumentParser(
description=__doc... | apache-2.0 | Python | |
964d01fd9a730d02aac85740bce0ef9dace6517b | add migrations | praekelt/molo,praekelt/molo,praekelt/molo,praekelt/molo | molo/core/migrations/0054_merged_cms_models.py | molo/core/migrations/0054_merged_cms_models.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-02-21 12:13
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0032_add_bulk_del... | bsd-2-clause | Python | |
17b4efb401d36060f51e07da5ace83c008d421c5 | Create table charge_observation. | jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools,jhanley634/testing-tools | problem/charge_state/alembic/versions/2154afa58ba0_create_table_charge_observation.py | problem/charge_state/alembic/versions/2154afa58ba0_create_table_charge_observation.py | """Create table charge_observation.
Revision ID: 2154afa58ba0
Revises:
Create Date: 2020-01-05 12:18:25.331846
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2154afa58ba0'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ###... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.