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 |
|---|---|---|---|---|---|---|---|---|
eb828764ddbe3988f71b98082e1560e594c3f65d | Add a bot message to display TeamCity test results | modin-project/modin,modin-project/modin | ci/teamcity/comment_on_pr.py | ci/teamcity/comment_on_pr.py | """
Post the comment like the following to the PR:
```
:robot: TeamCity test results bot :robot:
<Logs from pytest>
```
"""
from github import Github
import os
import sys
# Check if this is a pull request or not based on the environment variable
try:
pr_id = int(os.environ["GITHUB_PR_NUMBER"].split("/")[-1])
exc... | apache-2.0 | Python | |
b0006bf92ae221558d47a0b3c9010cfaacde2bfe | add checkmein.py with __init__ function | bahmanh/Auto-Flight-Check-In | autocheckin/checkmein.py | autocheckin/checkmein.py | from selenium import webdriver
from selinium.webdriver.common.keys import Keys
class CheckMeIn(object):
def __init__(self, firstName, lastName, confNum):
self.firstName = firstName
self.lastName = lastName
self.confNum = confNum
| mit | Python | |
528401b2c5cab29e301814da1754f0c0c41bdcd1 | Update shortest-distance-to-a-character.py | kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015 | Python/shortest-distance-to-a-character.py | Python/shortest-distance-to-a-character.py | # Time: O(n)
# Space: O(1)
# Given a string S and a character C,
# return an array of integers representing the shortest distance
# from the character C in the string.
#
# Example 1:
#
# Input: S = "loveleetcode", C = 'e'
# Output: [3, 2, 1, 0, 1, 0, 0, 1, 2, 2, 1, 0]
#
# Note:
# - S string length is in [1, 10000].
#... | # Time: O(n)
# Space: O(n)
# Given a string S and a character C,
# return an array of integers representing the shortest distance
# from the character C in the string.
#
# Example 1:
#
# Input: S = "loveleetcode", C = 'e'
# Output: [3, 2, 1, 0, 1, 0, 0, 1, 2, 2, 1, 0]
#
# Note:
# - S string length is in [1, 10000].
#... | mit | Python |
231bc7bb7bd7e373d4b4c9a3e33d6539d0637828 | Add xfailing test for #3345 | spacy-io/spaCy,honnibal/spaCy,honnibal/spaCy,explosion/spaCy,explosion/spaCy,honnibal/spaCy,honnibal/spaCy,explosion/spaCy,explosion/spaCy,spacy-io/spaCy,explosion/spaCy,spacy-io/spaCy,spacy-io/spaCy,spacy-io/spaCy,spacy-io/spaCy,explosion/spaCy | spacy/tests/regression/test_issue3345.py | spacy/tests/regression/test_issue3345.py | """Test interaction between preset entities and sentence boundaries in NER."""
import spacy
from spacy.tokens import Doc
from spacy.pipeline import EntityRuler, EntityRecognizer
@pytest.mark.xfail
def test_issue3345():
"""Test case where preset entity crosses sentence boundary."""
nlp = spacy.blank("en")
... | mit | Python | |
d358a799ce726706543ac1d440f5b60112125a52 | Add psf building directory | larrybradley/photutils,astropy/photutils | photutils/psf/building/__init__.py | photutils/psf/building/__init__.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This subpackage contains modules and packages to build point spread
functions.
"""
| bsd-3-clause | Python | |
0c74512159641fa63cf6292439a20c6af9698a02 | add a template program so that we can base others off it :) | akrherz/pyWWA,akrherz/pyWWA | template.py | template.py | # Copyright (c) 2005 Iowa State University
# http://mesonet.agron.iastate.edu/ -- mailto:akrherz@iastate.edu
#
# This program 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 2 of the License, or... | mit | Python | |
e19c8d52719d1bc00023406842e9a445580d98d3 | add wrappers.py just a dispatch wrapper for linear models | jstoxrocky/statsmodels,saketkc/statsmodels,pprett/statsmodels,astocko/statsmodels,rgommers/statsmodels,hlin117/statsmodels,musically-ut/statsmodels,detrout/debian-statsmodels,ChadFulton/statsmodels,josef-pkt/statsmodels,Averroes/statsmodels,saketkc/statsmodels,yarikoptic/pystatsmodels,YihaoLu/statsmodels,DonBeo/statsmo... | scikits/statsmodels/wrappers.py | scikits/statsmodels/wrappers.py | # -*- coding: utf-8 -*-
"""Convenience Wrappers
Created on Sat Oct 30 14:56:35 2010
Author: josef-pktd
License: BSD
"""
import numpy as np
import scikits.statsmodels as sm
from scikits.statsmodels import GLS, WLS, OLS
def remove_nanrows(y, x):
'''remove common rows in [y,x] that contain at least one nan
TO... | bsd-3-clause | Python | |
c63ad26327f294393434dcfe4d5454656a0c1b4b | Add initial generate movie | opcon/plutokore,opcon/plutokore | scripts/generate-movie-plots.py | scripts/generate-movie-plots.py | #!/usr/bin/env python3
import os
import argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument('sim_dir', help='Simulation directory')
parser.add_argument('output_dir', help='Output directory')
parser.add_argument('-s', '--skip', help='Skip pattern for outputs', default=1, type=i... | mit | Python | |
dbdb247ad03ca6b9168f193eadaf28638d718072 | Change docstring for NamedEntity filth | deanmalmgren/scrubadub,datascopeanalytics/scrubadub,datascopeanalytics/scrubadub,deanmalmgren/scrubadub | scrubadub/filth/named_entity.py | scrubadub/filth/named_entity.py | from .base import Filth
class NamedEntityFilth(Filth):
"""
Default filth type, for named entities (e.g. the ones in https://nightly.spacy.io/models/en#en_core_web_lg-labels),
except the ones represented in any other filth.
"""
type = 'named_entity'
def __init__(self, *args, label: str, **kwar... | from .base import Filth
class NamedEntityFilth(Filth):
"""
Named entity filth. Upon initialisation provide a label for named entity (e.g. name, org)
"""
type = 'named_entity'
def __init__(self, *args, label: str, **kwargs):
super(NamedEntityFilth, self).__init__(*args, **kwargs)
s... | mit | Python |
11f4add6873c7c089b5674415276a71b4c03cb42 | add example mbsubmit plugin | pkess/beets,artemutin/beets,Freso/beets,xsteadfastx/beets,diego-plan9/beets,MyTunesFreeMusic/privacy-policy,Freso/beets,SusannaMaria/beets,lengtche/beets,SusannaMaria/beets,sampsyo/beets,shamangeorge/beets,MyTunesFreeMusic/privacy-policy,swt30/beets,artemutin/beets,lengtche/beets,beetbox/beets,jcoady9/beets,shamangeorg... | beetsplug/mbsubmit.py | beetsplug/mbsubmit.py | # -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2015, Adrian Sampson and Diego Moreda.
#
# 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
# wit... | mit | Python | |
27bec5bc3dab9798d4ddbfcd84563b3c5056e8c8 | delete again | CCallahanIV/PyChart,CCallahanIV/PyChart,CCallahanIV/PyChart | pychart/pychart_datarender/migrations/0001_initial.py | pychart/pychart_datarender/migrations/0001_initial.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-15 00:50
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('pychart_profile', '0001_initial'),
... | mit | Python | |
7791ed9269b3d074b84a27f7f72b88a69c9ebd52 | add chaining classes | waliens/sldc | sldc/chaining.py | sldc/chaining.py | # -*- coding: utf-8 -*-
from abc import ABCMeta, abstractmethod
__author__ = "Romain Mormont <r.mormont@student.ulg.ac.be>"
class ImageProvider(object):
"""
An interface for any component that genre
"""
__metaclass__ = ABCMeta
@abstractmethod
def get_images(self):
pass
class Workf... | mit | Python | |
27896063f7632afa327c4933248435c874b91b7a | Create __init__.py | crhaithcock/RushHour,crhaithcock/RushHour,crhaithcock/RushHour | tests/__init__.py | tests/__init__.py | cc0-1.0 | Python | ||
24c85bf4550c4560e2a192fd8513f3788ea2148e | add tools calcuate microseconds between two times | ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study | skills/time-tool/microsecond.py | skills/time-tool/microsecond.py | #!/usr/bin/env python
# -*- coding: 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 copyright... | bsd-2-clause | Python | |
cb3158cbb116153d516a01ba1f63e26301338bbb | Create sigmoid_upper_bounds.py (#629) | probml/pyprobml,probml/pyprobml,probml/pyprobml,probml/pyprobml | scripts/sigmoid_upper_bounds.py | scripts/sigmoid_upper_bounds.py | # Upper bounds for sigmoid function
import numpy as np
import math
import matplotlib.pyplot as plt
import pyprobml_utils as pml
sigmoid = lambda x: np.exp(x) / (1 + np.exp(x))
fstar = lambda eta: -eta * math.log(eta) - (1 - eta) * math.log(1 - eta)
sigmoid_upper = lambda eta, x: np.exp(eta * x - fstar(eta))
eta1, et... | mit | Python | |
9bfb182f92b8ac82ddb1b35c886b4a3f79708696 | Add script for train/test split | YerevaNN/mimic3-benchmarks | scripts/split_train_and_test.py | scripts/split_train_and_test.py | import os
import shutil
import argparse
import random
random.seed(47297)
parser = argparse.ArgumentParser(description='Split data into train and test sets.')
parser.add_argument('subjects_root_path', type=str, help='Directory containing subject sub-directories.')
args, _ = parser.parse_known_args()
def move_to_part... | mit | Python | |
284da54cc9fc322c32e44706716b548bcd652dc4 | Test axe app. | soasme/axe | tests/test_axe.py | tests/test_axe.py | # -*- coding: utf-8 -*-
import pytest
from axe import Axe, errors
@pytest.fixture
def axe():
return Axe()
def test_build_from_urls(axe):
func = lambda: ''
axe.build({'/': func})
assert '/' in axe.urls
assert axe.urls['/'] == func
def test_register_ext_success(axe):
@axe.register_ext
def ... | mit | Python | |
f9d7612dfbad8d5f394bd7c0a9ed6db5f6234eb5 | add imf_tools | zpace/stellarmass_pca | imf_tools.py | imf_tools.py | '''
Define several stellar initial mass functions,
with some tools for working with them
'''
class IMF(object):
'''
stellar initial mass function
'''
__version__ = '0.1'
def __init__(self, imftype='salpeter', ml=0.1, mh=150., mf=1., dm=.005):
'''
set up an IMF with some probab... | mit | Python | |
9efa97198f81f5afce03e30c3bce5f5fc23a8d28 | add test for Row | esjeon/eatable | tests/test_row.py | tests/test_row.py |
import unittest
from eatable import Table, Row
class RowTestCase(unittest.TestCase):
def setUp(self):
self.header = ('A', 'B', 'C')
self.table = Table(self.header)
def test_init(self):
Row(self.table, 0, ('a1', 'b2', 'c2'))
def test_getitem(self):
row = Row(self.table, 0,... | mit | Python | |
e0bfc2bdff3d44c8839e4c04948e8da824f7b260 | Write requests-like get() | Pringley/spyglass | spyglass/util.py | spyglass/util.py | from urllib2 import urlopen
from collections import namedtuple
Response = namedtuple('Response', ['text'])
def get(url):
return Response(text=urlopen(url).read())
| mit | Python | |
96c08b94d40850b5dd703b052943de2827ebf9f9 | create command.py and abstract command template | 6180/foxybot | foxybot/command.py | foxybot/command.py | """Provide a template for making commands and a decorator to register them."""
from abc import abstractmethod, abstractclassmethod, ABCMeta
from enum import Enum
from registrar import CommandRegistrar
def bot_command(cls):
command = cls()
if not issubclass(command.__class__, AbstractCommand):
print(... | bsd-2-clause | Python | |
e85d1f0e9b198184103973f198bf1ceddbca6a65 | declare the federica rspec schemas | onelab-eu/sfa,onelab-eu/sfa,yippeecw/sfa,onelab-eu/sfa,yippeecw/sfa,yippeecw/sfa | sfa/rspecs/versions/federica.py | sfa/rspecs/versions/federica.py | from sfa.rspecs.versions.pgv2 import PGv2Ad, PGv2Request, PGv2Manifest
class FedericaAd (PGv2Ad):
enabled = True
schema = 'http://sorch.netmode.ntua.gr/ws/RSpec/ad.xsd'
namespace = 'http://sorch.netmode.ntua.gr/ws/RSpec'
class FedericaRequest (PGv2Request):
enabled = True
schema = 'http://sorch.ne... | mit | Python | |
c055009077546b22090897f79f4facce8bdb97d5 | change module names in hvc/__init__.py | NickleDave/hybrid-vocal-classifier | hvc/__init__.py | hvc/__init__.py | """
__init__.py imports key functions from modules to package level
"""
from .utils.features import load_feature_file
from .extract import extract
from .predict import predict
from .select import select
from .parseconfig import parse_config
from . import metrics
from . import plot | """
__init__.py imports key functions from modules to package level
"""
from .utils.features import load_feature_file
from .featureextract import extract
from .labelpredict import predict
from .modelselect import select
from .parseconfig import parse_config
from . import metrics
from . import plot | bsd-3-clause | Python |
fa375d06128e493f86524e82fa93c892f4d925b7 | Add script to find forms missing in ES | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/data_pipeline_audit/management/commands/find_sql_forms_not_in_es.py | corehq/apps/data_pipeline_audit/management/commands/find_sql_forms_not_in_es.py | from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
from __future__ import print_function
from datetime import datetime
from django.core.management.base import BaseCommand
import sys
from django.db.models import Q, F
from django.db.models.functions import Grea... | bsd-3-clause | Python | |
51372b15e9abe4c0ae35294ec51694751fe2ae32 | Add a py2exe configuration setup. | robotframework/RIDE,HelioGuilherme66/RIDE,HelioGuilherme66/RIDE,HelioGuilherme66/RIDE,robotframework/RIDE,HelioGuilherme66/RIDE,robotframework/RIDE,robotframework/RIDE | src/bin/setup.py | src/bin/setup.py | from distutils.core import setup
import py2exe, sys
from glob import glob
sys.path.append("C:\\Temp\\Microsoft.VC90.CRT")
data_files = [("Microsoft.VC90.CRT", glob(r'C:\Temp\Microsoft.VC90.CRT\*.*'))]
setup(
data_files=data_files,
console=['ride.py'])
| apache-2.0 | Python | |
d8521011d5be28812c222b58901a07e8f30e87ac | Add testing code for memory leak. | abhiskk/fast-neural-style,onai/fast-neural-style,abhiskk/fast-neural-style,darkstar112358/fast-neural-style,darkstar112358/fast-neural-style | neuralstyle/testing-train.py | neuralstyle/testing-train.py | from __future__ import print_function
import argparse
import numpy as np
import torch
from torch.autograd import Variable
from torch.optim import Adam
from torch.utils.data import DataLoader
from torchvision import transforms
from torchvision import datasets
from transformernet import TransformerNet
from vgg16 impor... | mit | Python | |
5a2308cc98a99e9c74c14611fdb45adf7601d390 | prepare bruteforce for http basic authentication; do not forget to create the b64 encoder in zap payload processor; | DarkLighting/OWASP-ZAP-Scripts | payload_generator/bruteforce.py | payload_generator/bruteforce.py | # Auxiliary variables/constants for payload generation.
INITIAL_VALUE = 0;
count = INITIAL_VALUE;
user = str('admin');
passfile_path = 'C:\\Users\\user\\Documents\\wordlists\\test.txt';
NUMBER_OF_PAYLOADS = sum(1 for line in open(passfile_path));
passwd = list();
for line in open(passfile_path): # initializing pass... | mit | Python | |
0ced2a66affd65a3dda90dc49bac8bd43e1c6fa7 | Remove index on LogRecord.message. | fairview/django-peavy | peavy/migrations/0004_drop_message_index.py | peavy/migrations/0004_drop_message_index.py | # encoding: utf-8
from south.db import db
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing index on 'LogRecord', fields ['message']
db.delete_index('peavy_logrecord', ['message'])
def backwards(self, orm):
# Adding index on 'L... | mit | Python | |
f3e91020f0426fedfe229e94bf1ddc69dd64a136 | Add new example plot for `match_template`. | SamHames/scikit-image,warmspringwinds/scikit-image,ClinicalGraphics/scikit-image,paalge/scikit-image,emmanuelle/scikits.image,newville/scikit-image,almarklein/scikit-image,chintak/scikit-image,warmspringwinds/scikit-image,rjeli/scikit-image,chriscrosscutler/scikit-image,Britefury/scikit-image,GaZ3ll3/scikit-image,Brite... | doc/examples/plot_template_alt.py | doc/examples/plot_template_alt.py | """
=================
Template Matching
=================
In this example, we use template matching to identify the occurrence of an
image patch (in this case, a sub-image centered on a single coin). Here, we
return a single match (the exact same coin), so the maximum value in the
``match_template`` result corresponds... | bsd-3-clause | Python | |
fc1c0a563f8bd4fd33e63285ab6af79825b8b927 | Add a modified terminalcolors.py | joeyates/vim-jgy-256-theme,joeyates/vim-jgy-256-theme | bin/terminalcolors.py | bin/terminalcolors.py | #!/usr/bin/env python
# Copyright (C) 2006 by Johannes Zellner, <johannes@zellner.org>
# modified by mac@calmar.ws to fit my output needs
# modified by crncosta@carloscosta.org to fit my output needs
# modified by joeyates, 2014
from os import system
def foreground(n):
system('tput setaf %u' % n)
def background(... | mit | Python | |
1de610b2460b3b3bff24b79398d214001097e562 | Implement Gmail OAuth 2.0. | blukat29/notifyhere,blukat29/notifyhere | notifyhere/dash/api/gmail.py | notifyhere/dash/api/gmail.py | from httplib import HTTPSConnection
import json
import base
import tools
import secrets
class GmailApi(base.ApiBase):
def __init__(self):
base.ApiBase.__init__(self, "gmail")
self.token = ""
def icon_url(self):
return "https://mail.google.com/favicon.ico"
def oauth_link(self... | mit | Python | |
5f81d53c16816289cf52a5b4118e482b7650defe | Add MaintenanceMiddleware | SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange,SRabbelier/Melange | app/soc/middleware/maintenance.py | app/soc/middleware/maintenance.py | #!/usr/bin/python2.5
#
# Copyright 2009 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | apache-2.0 | Python | |
4f1bb01bba0c2241a190bbf7fb21683be630abfa | Create Glyph3D.py | lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples,lorensen/VTKExamples | src/Python/Filtering/Glyph3D.py | src/Python/Filtering/Glyph3D.py | #!/usr/bin/env python
import vtk
def main():
colors = vtk.vtkNamedColors()
points = vtk.vtkPoints()
points.InsertNextPoint(0,0,0)
points.InsertNextPoint(1,1,1)
points.InsertNextPoint(2,2,2)
polydata = vtk.vtkPolyData()
polydata.SetPoints(points)
# Create anything you wan... | apache-2.0 | Python | |
89262fbd2375724ff9120fe01799a036b1c34f6f | add new package at v1.1.6 (#20598) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-mercantile/package.py | var/spack/repos/builtin/packages/py-mercantile/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyMercantile(PythonPackage):
"""Web mercator XYZ tile utilities."""
homepage = "https... | lgpl-2.1 | Python | |
41bc3c33cc1442105f019e06c40d189c27f65758 | add save_json helper | undertherain/vsmlib | vsmlib/misc/data.py | vsmlib/misc/data.py | import json
def save_json(data, path):
# if not os.path.isdir(path):
# os.makedirs(path)
s = json.dumps(data, ensure_ascii=False, indent=4, sort_keys=True)
f = open(path, 'w')
f.write(s)
f.close()
| apache-2.0 | Python | |
8483a311f75a3d3682e66fba2f805ea20ebf6870 | add memory usage beacon | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/beacons/memusage.py | salt/beacons/memusage.py | # -*- coding: utf-8 -*-
'''
Beacon to monitor memory usage.
.. versionadded::
:depends: python-psutil
'''
# Import Python libs
from __future__ import absolute_import
import logging
import re
# Import Salt libs
import salt.utils
# Import Third Party Libs
try:
import psutil
HAS_PSUTIL = True
except ImportErr... | apache-2.0 | Python | |
16193b302bb07429c604af2a9637850c2e751d1f | Add script to be run as cron job | mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge,mozilla/stoneridge | stoneridge_cronjob.py | stoneridge_cronjob.py | #!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at http://mozilla.org/MPL/2.0/.
import argparse
import ConfigParser
import os
import subprocess
import sys
import tempfile
import ... | mpl-2.0 | Python | |
9e6f8768d60d38e69074c5275637deaa62e6fc9e | check how often URL matching would match the right documents in the test corpus | ModernMT/DataCollection,ModernMT/DataCollection,ModernMT/DataCollection,ModernMT/DataCollection,ModernMT/DataCollection | baseline/url_matching.py | baseline/url_matching.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
from strip_language_from_uri import LanguageStripper
import chardet
from collections import defaultdict
import re
import urlparse
def has_prefix(prefixes, s):
"Returns true if s starts with one of the prefixes"
for p in prefixes:
if s.... | apache-2.0 | Python | |
d1ffd984bae034076244ac4449632a1aa04d5ffe | Refactor to Linter v2 API | yashtrivedi96/coala-bears,horczech/coala-bears,Vamshi99/coala-bears,coala-analyzer/coala-bears,seblat/coala-bears,yash-nisar/coala-bears,sounak98/coala-bears,ku3o/coala-bears,shreyans800755/coala-bears,yash-nisar/coala-bears,seblat/coala-bears,meetmangukiya/coala-bears,mr-karan/coala-bears,damngamerz/coala-bears,shreya... | bears/php/PHPLintBear.py | bears/php/PHPLintBear.py | from coalib.bearlib.abstractions.Linter import linter
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
@linter(executable='php',
output_format='regex',
output_regex=r'(?P<severity>Parse|Fatal) error: (?P<message>.*) in '
r'.* on line (?P<line>\d+)',
severity_map=... | import re
from coalib.bearlib.abstractions.Lint import Lint
from coalib.bears.LocalBear import LocalBear
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
class PHPLintBear(LocalBear, Lint):
executable = 'php'
arguments = '-l -n -d display_errors=On -d log_errors=Off {filename}'
output_regex = r... | agpl-3.0 | Python |
34560978ee8f33ab8ddc60a1a3525979119a952e | Add run script | thomasgibson/firedrake-hybridization | profile_compressible_solver/run_profiler.py | profile_compressible_solver/run_profiler.py | from firedrake.petsc import PETSc
from argparse import ArgumentParser
from driver import run_profliler
import sys
PETSc.Log.begin()
parser = ArgumentParser(description=("""
Profile of 3D compressible solver for the Euler equations (dry atmosphere).
"""), add_help=False)
parser.add_argument("--hybridization",
... | mit | Python | |
ee2a4c1edb6d2f1273bb08080e8fc00b0a0e9074 | add pack1/mymodule1.py | weizhenwei/tech-docs-2016,weizhenwei/tech-docs-2016,weizhenwei/tech-docs-2016,weizhenwei/tech-docs-2016,weizhenwei/tech-docs-2016,weizhenwei/tech-docs-2016 | python/18-package/parent/pack1/mymodule1.py | python/18-package/parent/pack1/mymodule1.py | #!/usr/bin/env python
#-*- coding=utf-8 -*-
def function1():
print "function1 running"
if __name__ == "__main__":
print "mymodule1 running as main program"
else:
print "mymodule1 initializing"
| bsd-2-clause | Python | |
a29e340efa60ecb05d85e9c6d87ec709ba26822f | Add new extractor(closes #14361) | rg3/youtube-dl,ozburo/youtube-dl,rg3/youtube-dl,Tatsh/youtube-dl,ozburo/youtube-dl,Tatsh/youtube-dl | youtube_dl/extractor/bibeltv.py | youtube_dl/extractor/bibeltv.py | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class BibelTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?bibeltv\.de/mediathek/videos/(?:crn/)?(?P<id>\d+)'
_TESTS = [{
'url': 'https://www.bibeltv.de/mediathek/videos/329703-sprachkurs-in-malaiisch',
... | unlicense | Python | |
76cce82d65868619b096d74a5adb3a616cfe771d | Create new package. (#5810) | mfherbst/spack,EmreAtes/spack,EmreAtes/spack,tmerrick1/spack,mfherbst/spack,matthiasdiener/spack,matthiasdiener/spack,matthiasdiener/spack,matthiasdiener/spack,krafczyk/spack,krafczyk/spack,skosukhin/spack,iulian787/spack,tmerrick1/spack,iulian787/spack,tmerrick1/spack,tmerrick1/spack,lgarren/spack,lgarren/spack,LLNL/s... | var/spack/repos/builtin/packages/r-affyilm/package.py | var/spack/repos/builtin/packages/r-affyilm/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 | |
d7017acef8ed540bb2f3c00d268cd417d75f09e3 | add import script for Fareham (closes #858) | chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_fareham.py | polling_stations/apps/data_collection/management/commands/import_fareham.py | from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = 'E07000087'
addresses_name = 'parl.2017-06-08/Version 1/Democracy_Club__08June2017 (1).tsv'
stations_name = 'parl.2017-06-08/Version 1/Democracy_Club__08June201... | bsd-3-clause | Python | |
675b87d5bc072d5b6fbd1f9a54ec61d98b1139ac | Add lab2 file. | greggy/pylessons | lab2.py | lab2.py | # -*- coding: utf-8 -*-
from math import pow
def mymap1(fun, l):
res = []
for i in l:
res.append(fun(i))
return res
#print(mymap1(str, [3, 1, 7, 4, 6, 9]))
def mymap2(fun, *l):
res = []
for i in zip(*l):
print(i)
res.append(fun(*i))
return res
#print(mymap2(lambda a... | lgpl-2.1 | Python | |
bea495bb58146fc3795d2217ef3b27ce0325014b | create the Spider for Israel of McDonalds | iandees/all-the-places,iandees/all-the-places,iandees/all-the-places | locations/spiders/mcdonalds_il.py | locations/spiders/mcdonalds_il.py | # -*- coding: utf-8 -*-
import scrapy
import json
import re
from locations.items import GeojsonPointItem
class McDonalsILSpider(scrapy.Spider):
name = "mcdonalds_il"
allowed_domains = ["www.mcdonalds.co.il"]
start_urls = (
'https://www.mcdonalds.co.il/%D7%90%D7%99%D7%AA%D7%95%D7%A8_%D7%9E%D7%A1%D... | mit | Python | |
252925fa998412ac868eb63790fbd515c429ac67 | add main entry point (untested, but should be complete now) | paultopia/minitrue | main.py | main.py | """
Core namespace. Handles:
1. Call out to hashio to check hashes, save log, and return results
2. Load tweetlog and tweet creds
3. Generate and log tweets for changed files
4. Generate and log tweets for new files
4. Save tweetlog
"""
import hash, hashio, twitter, json
from copy import deepcopy
def load_twe... | mit | Python | |
21028c13585fbcd5315efd74ab55f5d03d69c500 | add probe nsrl | hirokihamasaki/irma,quarkslab/irma,hirokihamasaki/irma,quarkslab/irma,quarkslab/irma,hirokihamasaki/irma,hirokihamasaki/irma,quarkslab/irma,hirokihamasaki/irma | nsrl.py | nsrl.py | import hashlib
from pymongo import MongoClient
from lib.irma.common.exceptions import IrmaDatabaseError
class NsrlInfo(object):
_uri = "mongodb://localhost:27017/"
_dbname = "nsrl"
_collection = "hashset"
def __init__(self):
self._dbh = None
def _connect(self):
try:
if... | apache-2.0 | Python | |
f151d1cc5ddb3b60c6410153e147ccd5c0378904 | Add Sequence object | totallyhuman/py-oeis | oeis.py | oeis.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
py-oeis
A Python library to access the OEIS.
Sumant Bhaskaruni
v0.1
"""
import requests
class Sequence(object):
"""An object to represent a single OEIS sequence.
Initializer arguments:
number (int): The OEIS sequence ID
"""
def __init__(s... | mit | Python | |
eb56d833efad16e9a84724d18121528177f37adb | add 41 | ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler,ericdahl/project-euler | p041.py | p041.py | import utils
primes = utils.primes(7654321)
def p(n):
sn = str(n)
lsn = len(sn)
if lsn > 10:
return False
return set([ int(d) for d in sn ]) == set(range(1, len(sn) + 1))
primes.reverse()
for prime in primes:
if p(prime):
print prime
break
| bsd-3-clause | Python | |
025103ad59d389981532dbb42332dd2a26e475c5 | add torperf2.py script to measure hidden service performance | aaronsw/torperf,aaronsw/torperf,aaronsw/torperf | torperf2.py | torperf2.py | import socket, sys, time, subprocess, threading, signal
import TorCtl.TorCtl
debug = sys.stderr
HOST = '127.0.0.1'
PORT = 10951
shared = dict(
torprocess = None,
torlock = threading.Lock()
)
TORRC = """\
SocksListenAddress %s
SocksPort %d
ControlPort %d
CookieAuthentication 1
RunAsDaemon 0
Log info file logfile
... | bsd-3-clause | Python | |
d433f9926ea14d35a8be9cd258300671051547a5 | Add refine_multiple_shards_joint.py | rstebbing/shards,rstebbing/shards | refine_multiple_shards_joint.py | refine_multiple_shards_joint.py | # refine_multiple_shards_joint.py
# Imports
import argparse
import matplotlib.pyplot as plt
import numpy as np
import visualise_progress as vis
from functools import partial
from operator import itemgetter
from pickle_ import dump
from solve import fit_and_colour_shards
from time import time
# main
de... | mit | Python | |
9efa33b28b86feaa204ebb84955022b7716a98ba | resolve conflicts | ssadedin/seqr,macarthur-lab/xbrowse,macarthur-lab/xbrowse,macarthur-lab/xbrowse,ssadedin/seqr,macarthur-lab/seqr,ssadedin/seqr,macarthur-lab/seqr,macarthur-lab/seqr,macarthur-lab/xbrowse,macarthur-lab/seqr,macarthur-lab/seqr,macarthur-lab/xbrowse,ssadedin/seqr,ssadedin/seqr,macarthur-lab/xbrowse | seqr/migrations/0057_merge_20190513_2009.py | seqr/migrations/0057_merge_20190513_2009.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-13 20:09
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('seqr', '0056_auto_20190513_1621'),
('seqr', '0056_auto_20190424_2059'),
]
operatio... | agpl-3.0 | Python | |
6af2adf3257e9cb9130909fed531cc2f6bae8945 | Add a Mac-specifc snapshot build archive bisecting tool. | wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser,wistoch/meego-app-browser | build/build-bisect.py | build/build-bisect.py | #!/usr/bin/python2.5
# Copyright (c) 2009 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.
"""Snapshot Build Bisect Tool
This script bisects the Mac snapshot archive using binary search. It starts at
a bad revision (it wil... | bsd-3-clause | Python | |
ba8d38f278169b5d71e85e4d74a43fcd4a3892ae | Test decorator | zzz0072/Python_Exercises,zzz0072/Python_Exercises | 99_misc/decorator.py | 99_misc/decorator.py | #/usr/bin/env python
def my_func1(callback):
def func_wrapper(x):
print("my_func1: {0} ".format(callback(x)))
return func_wrapper
@my_func1
def my_func2(x):
return x
# Actuall call sequence is similar to:
# deco = my_func1(my_func2)
# deco("test") => func_wrapper("test")
my_func2("test")
#-------... | bsd-2-clause | Python | |
82d5856b09c42b09f857976075d40b6c6568a7c8 | Create gate_chk_aws.py | EnyaKitakagaya/Tonis,EnyaKitakagaya/Tonis | gate_chk/gate_chk_aws.py | gate_chk/gate_chk_aws.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import nfc
import spidev
import smbus
import re
import mysql.connector
import time
def getid(tag):
global id
a = '%s' % tag
id = re.findall("ID=([0-9A-F]*)",a)[0]
con = mysql.connector.connect(user=‘xxxxxxxxxx', password=‘xxxxxxxxxx', host=‘xxxxxxxxxx-xxxxx-... | apache-2.0 | Python | |
a8266c9ff0526b1ada6f48c849892d1d29907710 | Add the workers which compute who receive which notification and where | jeremycline/fmn,jeremycline/fmn,jeremycline/fmn | fmn/consumer/worker.py | fmn/consumer/worker.py | # FMN worker figuring out for a fedmsg message the list of recipient and
# contexts
import json
import logging
import time
import random
import fmn.lib
import fmn.rules.utils
import fedmsg
import fedmsg.meta
from fmn.consumer.util import load_preferences
from fedmsg_meta_fedora_infrastructure import fasshim
impor... | lgpl-2.1 | Python | |
870d30a0cb7788055cfc9c22854cdbe6293036fa | create class to list preset and metapreset | CaptainDesAstres/Simple-Blender-Render-Manager,CaptainDesAstres/Blender-Render-Manager | settingMod/PresetList.py | settingMod/PresetList.py | #!/usr/bin/python3.4
# -*-coding:Utf-8 -*
'''module to manage preset list'''
import xml.etree.ElementTree as xmlMod
import os
class PresetList:
'''class to manage preset list'''
def __init__(self, xml= None):
'''initialize preset list with default value or values extracted from an xml object'''
if xml is Non... | mit | Python | |
de743ccb3d4b6556c66765a8cab93729abc22fa5 | Add a script for batch provisioning of SecurityMonkey role | Dklotz-Circle/security_monkey,firebitsbr/security_monkey,kevgliss/security_monkey,odin1314/security_monkey,gene1wood/security_monkey,airbnb/security_monkey,daichenge/security_monkey,gene1wood/security_monkey,pradeep-aradhya/security_monkey,firebitsbr/security_monkey,odin1314/security_monkey,Fsero/security_monkey,markof... | scripts/secmonkey_role_setup.py | scripts/secmonkey_role_setup.py | #!/usr/bin/env python
# Copyright 2014 Rocket-Internet
# Luca Bruno <luca.bruno@rocket-internet.de>
#
# 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 | |
430ca4b6a6f134346efaae430fac2bfaff195fe1 | Add files via upload | DiginessForever/machineLearning | 1stANNrecoded2Python.py | 1stANNrecoded2Python.py | #imports here: numpy, os, whatever I need
n = 1000
e = (1.0 + 1.0/n)^n
#Instantiate a new layer with the number of neurons desired, give the neurons (Q: do neurons have separate values than their weights?) random values.
def layerFactory(numberOfNeurons):
#create weights between layers (essentially, populate the f... | mit | Python | |
5b098392cee7f6526947d45bfc620573c631e4cf | Create add-P67-wikidata-url | Xi-Plus/Xiplus-Wikipedia-Bot,Xi-Plus/Xiplus-Wikipedia-Bot | my-ACG/add-P67-wikidata-url/edit.py | my-ACG/add-P67-wikidata-url/edit.py | # -*- coding: utf-8 -*-
import argparse
import csv
import os
os.environ['PYWIKIBOT_DIR'] = os.path.dirname(os.path.realpath(__file__))
import pywikibot
site = pywikibot.Site()
site.login()
datasite = site.data_repository()
def addWikidataUrl(title, targettitle):
print(title)
if title[0] == 'Q':
my... | mit | Python | |
52fd7e5e6ae5ec6ab7de8a858fd2b132fe0d4081 | Create CGOLprintToScreen.py | marcuskainth/game-of-life | CGOLprintToScreen.py | CGOLprintToScreen.py | import sys
tiles_size = 64
class cell:
def __init__(self, location, alive=False):
self.alive = alive
self.location = location
class Rules:
def rule(self): # if alive
for i in range(tiles_size):
for j in range(tiles_size):
c = self.neighbourscounter(tile[... | mit | Python | |
9b5f070705de9896c8c6f8347dc0f733ae748793 | Add harvesting blog data example | fabriciojoc/redes-sociais-web,fabriciojoc/redes-sociais-web | harvesting_blog_data.py | harvesting_blog_data.py | import os
import sys
import json
import feedparser
from bs4 import BeautifulSoup
FEED_URL = 'http://g1.globo.com/dynamo/rss2.xml'
def cleanHtml(html):
return BeautifulSoup(html, 'lxml').get_text()
fp = feedparser.parse(FEED_URL)
print "Fetched %s entries from '%s'" % (len(fp.entries[0].title), fp.feed.title)
b... | apache-2.0 | Python | |
630d857c188259d04794e817f83f7c10e9ce9896 | Add OTP testing | kotfic/girder,Xarthisius/girder,manthey/girder,RafaelPalomar/girder,jbeezley/girder,jbeezley/girder,Kitware/girder,kotfic/girder,data-exp-lab/girder,Kitware/girder,manthey/girder,RafaelPalomar/girder,kotfic/girder,Xarthisius/girder,RafaelPalomar/girder,RafaelPalomar/girder,girder/girder,girder/girder,jbeezley/girder,Xa... | test/test_user_otp.py | test/test_user_otp.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright Kitware 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 ... | apache-2.0 | Python | |
f40788bdc60566fc15a7abb46bfca61bb9131823 | Test update | treyh0/pullrequest-reviewer | test.py | test.py | #!/usr/bin/env python
def main():
print "Hello world"
if __name__ == "__main__":
main()
| agpl-3.0 | Python | |
b07ca938d68dff3386007885a6da4f5b2e593941 | Add prototype | matwey/pybeam | test.py | test.py | #!/usr/bin/python
from construct import *
import sys
def align4(n):
return n + ((n+4) % 4)
chunk_atom = Struct("chunk_atom",
UBInt32("len"),
Array(lambda ctx: ctx.len, PascalString("atom"))
)
chunk_expt = Struct("chunk_expt",
UBInt32("len"),
Array(lambda ctx: ctx.len, Struct("entry",
UBInt32("function"),
... | mit | Python | |
d5aecde4806a130550786f21f8fdd13c27996e16 | add test.py and copyright comments | itmard/persian.py,itmard/Persian | test.py | test.py | # encoding: utf-8
from toPersian import *
print enToPersianNumb('شماره کلاس 312')
print enToPersianNumb(3123123.9012)
print enToPersianNumb(123)
print enToPersianchar('sghl ]i ofv')
print arToPersianNumb('٣٤٥٦')
print arToPersianChar(' ك جمهوري اسلامي ايران')
'''
شماره کلاس ۳۱۲
۳۱۲۳۱۲۳.۹۰۱۲
۱۲۳
سلام چه خبر
۳۴۵۶
ک ج... | apache-2.0 | Python | |
3a160d3aed9d5eb7cebe2427f9009b4e0e2f07c4 | return doi resolver url instead of doi resolver name | jcherqui/searx,dalf/searx,jcherqui/searx,jcherqui/searx,asciimoo/searx,asciimoo/searx,asciimoo/searx,dalf/searx,dalf/searx,dalf/searx,jcherqui/searx,asciimoo/searx | searx/plugins/oa_doi_rewrite.py | searx/plugins/oa_doi_rewrite.py | from flask_babel import gettext
import re
from searx.url_utils import urlparse, parse_qsl
from searx import settings
regex = re.compile(r'10\.\d{4,9}/[^\s]+')
name = gettext('Open Access DOI rewrite')
description = gettext('Avoid paywalls by redirecting to open-access versions of publications when available')
defaul... | from flask_babel import gettext
import re
from searx.url_utils import urlparse, parse_qsl
from searx import settings
regex = re.compile(r'10\.\d{4,9}/[^\s]+')
name = gettext('Open Access DOI rewrite')
description = gettext('Avoid paywalls by redirecting to open-access versions of publications when available')
defaul... | agpl-3.0 | Python |
995e35c2a66fd51f9216ed5acc829bac0ac3ddeb | add i3-debug-console script to examples | acrisci/i3ipc-python | examples/i3-debug-console.py | examples/i3-debug-console.py | #!/usr/bin/env python3
import i3ipc
from curses import wrapper
from threading import Timer
def con_type_to_text(con):
if con.type != 'con':
return con.type
if len(con.nodes):
return 'container'
else:
return 'view'
def layout_txt(con):
if con.layout == 'splith':
return ... | bsd-3-clause | Python | |
1524a8fd55c682bd8b77b52b9d2d5e5c030c9d2d | Add first tests | samuell/sciluigi_deprecated | test/sciluigi_test.py | test/sciluigi_test.py | import sciluigi
from nose.tools import with_setup
# Make these variables global
#shell_task = None
def setup():
global shell_task
shell_task = sciluigi.shell("cat <i:input> > <o:output:out.txt>")
return shell_task
def teardown():
global shell_task
shell_task = None
@with_setup(setup, teardown)
d... | mit | Python | |
ed63c9c828cc609d82eb5afb21f6e24b358bc3cf | Add DoubleLinkedQueue | xliiauo/leetcode,xiao0720/leetcode,xiao0720/leetcode,xliiauo/leetcode,xliiauo/leetcode | DoubleLinkedQueue.py | DoubleLinkedQueue.py | class _DoubleLinkedList:
class _Node:
__slots__ = '_element', '_prev', '_next'
def __init__(self, element, prev, next):
self._element = element
self._prev = prev
self._next = next
def __init__(self):
self.header = self._Node(None, None, None)
... | mit | Python | |
42f66ea6e1921040d6e3055c41372b02511e6a5a | Add directory for CYK tests | PatrikValkovic/grammpy | tests/CYK/__init__.py | tests/CYK/__init__.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 31.08.2017 14:50
:Licence GNUv3
Part of pyparsers
""" | mit | Python | |
4dc6462a0a8231ba4ffca09d5c9546d8b6d0dd6f | Fix bug in config. | ynvb/DIE,nihilus/DIE,ekse/DIE,kakkojc/DIE,AlexWMF/DIE,isra17/DIE,xujun10110/DIE,HackerTool/DIE,melbcat/DIE | DIE/Lib/DieConfig.py | DIE/Lib/DieConfig.py | import logging
import os
import ConfigParser
import idaapi
import yaml
from attrdict import AttrMap
class DIEConfig(object):
DEFAULT = os.path.join(os.path.dirname(__file__), "config.yml")
def __init__(self):
with open(self.DEFAULT, "rb") as f:
default = yaml.safe_load(f)
self.... | import logging
import os
import ConfigParser
import idaapi
import yaml
from attrdict import AttrMap
class DIEConfig(object):
DEFAULT = os.path.join(os.path.dirname(__file__), "config.yml")
def __init__(self):
with open(self.DEFAULT, "rb") as f:
default = yaml.safe_load(f)
self.... | mit | Python |
5ac4f0be3f9f1179a50670989915bae0d3ae157e | Add globals.ffmpeg module to retrieve ffmpeg executable | AntumDeluge/desktop_recorder,AntumDeluge/desktop_recorder | source/globals/ffmpeg.py | source/globals/ffmpeg.py | # -*- coding: utf-8 -*-
## \package globals.ffmpeg
#
# Retrieves the FFmpeg executable
# MIT licensing
# See: LICENSE.txt
import subprocess
from subprocess import PIPE
from subprocess import STDOUT
def GetExecutable(cmd):
sp = subprocess.Popen([u'which', cmd,], stdout=PIPE, stderr=STDOUT)
output, retur... | mit | Python | |
4ae114dd1da8118cc9d2ee87e30f5e0a1f3324f2 | Add some tests for monitor class | jamesoff/simplemonitor,jamesoff/simplemonitor,jamesoff/simplemonitor,jamesoff/simplemonitor,jamesoff/simplemonitor | tests/test_monitor.py | tests/test_monitor.py | import unittest
import Monitors.monitor
class TestMonitor(unittest.TestCase):
safe_config = {'partition': '/', 'limit': '10G'}
one_KB = 1024
one_MB = one_KB * 1024
one_GB = one_MB * 1024
one_TB = one_GB * 1024
def test_MonitorInit(self):
m = Monitors.monitor.Monitor(config_options={... | bsd-3-clause | Python | |
b0f0ee685ca525de90fdcd5a57a203c8b42b936a | test for the bootstrap | pypa/setuptools,pypa/setuptools,pypa/setuptools | tests/install_test.py | tests/install_test.py | import urllib2
import sys
import os
print '**** Starting Test'
print '\n\n'
is_jython = sys.platform.startswith('java')
if is_jython:
import subprocess
print 'Downloading bootstrap'
file = urllib2.urlopen('http://nightly.ziade.org/bootstrap.py')
f = open('bootstrap.py', 'w')
f.write(file.read())
f.close()
# run... | mit | Python | |
f9b2bba394ad6ce31ffae5cf6ccf445dc280ba95 | Solve C Mais ou Menos? in python | deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playgr... | solutions/beecrowd/2486/2486.py | solutions/beecrowd/2486/2486.py | import sys
MIN_VITAMIN_C = 110
MAX_VITAMIN_C = 130
vitamin_c_catalogue = {
'suco de laranja': 120,
'morango fresco': 85,
'mamao': 85,
'goiaba vermelha': 70,
'manga': 56,
'laranja': 50,
'brocolis': 34,
}
for test in sys.stdin:
t = int(test)
if not t:
break
total_c_vit... | mit | Python | |
9db669a311c10b84799084e1d4ba8101137ec234 | Add .ycm_extra_conf.py | krafczyk/KSync,krafczyk/KSync | .ycm_extra_conf.py | .ycm_extra_conf.py | import os
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this softw... | mit | Python | |
96c8d93cf1b6a01e867ca8250fee4dea5e870c79 | Add files via upload | anthonyw12123/4chanwebscraper | 4ChanWebScraper.py | 4ChanWebScraper.py | import requests
import os
import sys
import re
from BeautifulSoup import BeautifulSoup
from PIL import Image
from StringIO import StringIO
# try:
# opts, args = getopt.getopt(argv, "u:", ["url="])
# except getopt.GetoptError:
# print('usage: python 4ChanWebScraper.py... | mit | Python | |
27fca35a08278a44bb7ba693f222c6c182061872 | Add the enemy file and start it up. | di1111/mlg-fite | Enemy.py | Enemy.py | import pygame
class Enemy(pygame.sprite.Sprite):
def __init__(self, x, y):
super().__init__()
self.image = pygame.image.load("images/enemy.png").convert_alpha()
self.rect = self.image.get_rect(center=(x, y))
def
| mit | Python | |
8821024705c6500ea998431656b3c604b3066898 | Add prototype dotcode generator | Iniquitatis/mgba,Iniquitatis/mgba,Iniquitatis/mgba,libretro/mgba,mgba-emu/mgba,libretro/mgba,libretro/mgba,mgba-emu/mgba,Iniquitatis/mgba,libretro/mgba,libretro/mgba,mgba-emu/mgba,mgba-emu/mgba | tools/make-dotcode.py | tools/make-dotcode.py | import numpy as np
import PIL.Image
import PIL.ImageChops
import sys
with open(sys.argv[1], 'rb') as f:
data = f.read()
size = len(data)
blocksize = 104
blocks = size // blocksize
height = 36
width = 35
margin = 2
dots = np.zeros((width * blocks + margin * 2 + 1, height + margin * 2), dtype=np.bool)
anchor = np.... | mpl-2.0 | Python | |
982cd61d7532365d9de56b308c7a4d8308302c15 | Add a test to demonstrate issue with django 1.11 | kmmbvnr/django-fsm,kmmbvnr/django-fsm | tests/testapp/tests/test_model_create_with_generic.py | tests/testapp/tests/test_model_create_with_generic.py | try:
from django.contrib.contenttypes.fields import GenericForeignKey
except ImportError:
# Django 1.6
from django.contrib.contenttypes.generic import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.test import TestCase
from django_fsm im... | mit | Python | |
efcda7dad6efb189713b8cebb20b4d8b64a85c71 | Add tools/msgpack2json.py | takumak/tuna,takumak/tuna | tools/msgpack2json.py | tools/msgpack2json.py | import sys, json, umsgpack
json.dump(umsgpack.unpack(sys.stdin.buffer), sys.stdout)
| mit | Python | |
0dc5154daa12ea196bb5fdeb1342f6f7b3e6e62b | Add markov model baseline | ankur-gos/PSL-Bipedal,ankur-gos/PSL-Bipedal | MarkovModel/model.py | MarkovModel/model.py | '''
Markov Model for transportation
Ankur Goswami
'''
def load_inputs(datafiles):
inputs = {}
for file in datafiles:
with open(file, 'r') as rf:
for line in rf:
split = line.split('\t', 1)
segnum = split[0]
if segnum is in inputs:
... | mit | Python | |
50bfa56b660d5d39c1dd7b3d426fcd589a9719bb | add univdump.py for extracting password dumps [wip] | The-Orizon/nlputils,The-Orizon/nlputils,The-Orizon/nlputils | univdump.py | univdump.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import sys
import collections
'''
This script tries its best to fvck these various esoteric hard-to-process
user database dump or leak files.
'''
re_field = re.compile(r'(<\w+>)')
RecFormat = collections.namedtuple('RecFormat', ('regex', 'fields'))
FORMATS =... | mit | Python | |
b2e27f42b3f8de10e11faf128183ca5fa3c0ea3f | Add 0025 | starlightme/My-Solutions-For-Show-Me-the-Code,starlightme/My-Solutions-For-Show-Me-the-Code | Jimmy66/0025/0025.py | Jimmy66/0025/0025.py | #!/usr/bin/env python3
import speech_recognition as sr
import webbrowser
# obtain path to "test.wav" in the same folder as this script
from os import path
WAV_FILE = path.join(path.dirname(path.realpath(__file__)), "test.wav")
# use "test.wav" as the audio source
r = sr.Recognizer()
with sr.WavFile(WAV_FILE) as sour... | mpl-2.0 | Python | |
07f522bed6a285507aadd66df89b14022e1e2a04 | add new package : openresty (#14169) | iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack | var/spack/repos/builtin/packages/openresty/package.py | var/spack/repos/builtin/packages/openresty/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Openresty(AutotoolsPackage):
"""
OpenResty is a full-fledged web application server by... | lgpl-2.1 | Python | |
20fc164862f72527ef7d06bcbfe9dc4329ef9fa7 | add problem, hackerrank 005 plus minus | caoxudong/code_practice,caoxudong/code_practice,caoxudong/code_practice,caoxudong/code_practice | hackerrank/005_plus_minus.py | hackerrank/005_plus_minus.py | #!/bin/python3
"""
https://www.hackerrank.com/challenges/plus-minus?h_r=next-challenge&h_v=zen
Given an array of integers, calculate which fraction of its elements are positive, which fraction of its elements are negative, and which fraction of its elements are zeroes, respectively. Print the decimal value of ea... | mit | Python | |
6e0f585a8f8433d4f6800cb1f093f97f8a1d4ff7 | Update imports for new functions | mhvk/astropy,saimn/astropy,funbaker/astropy,bsipocz/astropy,tbabej/astropy,pllim/astropy,stargaser/astropy,AustereCuriosity/astropy,aleksandr-bakanov/astropy,dhomeier/astropy,funbaker/astropy,kelle/astropy,saimn/astropy,larrybradley/astropy,lpsinger/astropy,pllim/astropy,dhomeier/astropy,bsipocz/astropy,larrybradley/as... | imageutils/__init__.py | imageutils/__init__.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Image processing utilities for Astropy.
"""
# Affiliated packages may add whatever they like to this file, but
# should keep this content at the top.
# ----------------------------------------------------------------------------
from ._astropy_init im... | bsd-3-clause | Python | |
0573ed88c4de497b2da7088795b0d747bb2bd2ce | Add ICT device | lnls-fac/sirius | pymodels/middlelayer/devices/ict.py | pymodels/middlelayer/devices/ict.py | #!/usr/bin/env python-sirius
from epics import PV
class ICT:
def __init__(self, name):
if name in ['ICT-1', 'ICT-2']:
self._charge = PV('LI-01:DI-' + name + ':Charge-Mon')
self._charge_avg = PV('LI-01:DI-' + name + 'ICT-1:ChargeAvg-Mon')
self._charge_max = PV('LI-01:D... | mit | Python | |
a080713a1dd0dd0c1b9c487f9c5413f3e4419db9 | Create MQTT2StepperMotor.py | Anton04/RaspPy-StepperMotor-Driver | MQTT2StepperMotor.py | MQTT2StepperMotor.py | # Author: Anton Gustafsson
# Released under MIT license
#!/usr/bin/python
from StepperMotorDriver import MotorControl
class
| mit | Python | |
d26069ddbb35a10f4a368c855d94d1dde1872a82 | Add better solution for etl | always-waiting/exercism-python | etl/etl.better.py | etl/etl.better.py | def transform(d):
'''Just reverse the dictionary'''
return {l.lower(): p for p, letters in d.items() for l in letters}
def transform(strs):
result = {}
for k,v in strs.items():
for i in v:
result.update({i.lower():k})
return dict(result.items())
| mit | Python | |
61c2ec9efdf72f0ab02ed12c8486bc9ca8f690e6 | Add MLP code | meet-vora/mlp-classifier | neuralnet.py | neuralnet.py | import numpy as np
from scipy.special import expit
from constants import *
class NeuralNetMLP(object):
def __init__(self, layers, random_state=None):
""" Initialise the layers as list(input_layer, ...hidden_layers..., output_layer) """
np.random.seed(random_state)
self.num_layers = len(layers)
self.layers = l... | mit | Python | |
54b94346d2669347cf2a9a2b24df6b657cf80c5b | Mask computation utilities (from nipy). | abenicho/isvr | nisl/mask.py | nisl/mask.py | import numpy as np
from scipy import ndimage
###############################################################################
# Operating on connect component
###############################################################################
def largest_cc(mask):
""" Return the largest connected component of a 3D m... | bsd-3-clause | Python | |
8e6c1a296be39c5cd1e75d5ff9974f80449690e3 | Add VVT tool class | sosy-lab/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,dbeyer/benchexec,sosy-lab/benchexec,martin-neuhaeusser/benchexec,ultimate-pa/benchexec,IljaZakharov/benchexec,IljaZakharov/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,dbeyer/benchexec,sosy-lab/benchexec,martin-neuhaeusser/benchexec,db... | benchexec/tools/vvt.py | benchexec/tools/vvt.py | """
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2015 Dirk Beyer
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
... | apache-2.0 | Python | |
f333b9c5741a7ffbf49caa0a6130831a834b944f | Add unit tests for recent bugfix and move operation | Bklyn/dotfiles,aparente/Dotfiles,nilehmann/dotfiles-1,aparente/Dotfiles,aparente/Dotfiles,aparente/Dotfiles | test_dotfiles.py | test_dotfiles.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import shutil
import tempfile
import unittest
from dotfiles import core
def touch(fname, times=None):
with file(fname, 'a'):
os.utime(fname, times)
class DotfilesTestCase(unittest.TestCase):
def setUp(self):
"""Create a temporary hom... | isc | Python | |
2b0e13039dad8d116a5719540004bed317bb6960 | Add tests and fixtures for the Organizations API wrapper | jbogarin/ciscosparkapi | tests/api/test_organizations.py | tests/api/test_organizations.py | # -*- coding: utf-8 -*-
"""pytest Licenses functions, fixtures and tests."""
import pytest
import ciscosparkapi
# Helper Functions
def list_organizations(api, max=None):
return list(api.organizations.list(max=max))
def get_organization_by_id(api, orgId):
return api.organizations.get(orgId)
def is_val... | mit | Python | |
feea11952ceab35523052a93a8ca6ff822d1357c | add 141 | zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler,zeyuanxy/project-euler,EdisonAlgorithms/ProjectEuler | vol3/141.py | vol3/141.py | import math
def gcd(a, b):
if a % b == 0:
return b
return gcd(b, a % b)
def is_square(n):
sqrt_n = int(math.sqrt(n))
return n == sqrt_n * sqrt_n
if __name__ == "__main__":
L = 10 ** 12
s = set()
for a in xrange(2, 10000):
for b in xrange(1, a):
if a * a * a * b... | mit | Python | |
284c29d257b7c6902b5973ca05278ee5b05571e9 | test subclassing! | SexualHealthInnovations/callisto-core,SexualHealthInnovations/callisto-core,project-callisto/callisto-core,project-callisto/callisto-core | tests/delivery/test_frontend.py | tests/delivery/test_frontend.py | from wizard_builder.tests import test_frontend as wizard_builder_tests
class EncryptedFrontendTest(wizard_builder_tests.FrontendTest):
secret_key = 'soooooo seekrit'
def setUp(self):
super().setUp()
self.browser.find_element_by_css_selector(
'[name="key"]').send_keys(self.secret_k... | agpl-3.0 | Python | |
bd9f509bbd97f3a28eb24740dc08bc153cf82613 | add voronoi cell class | ipudu/order | order/avc.py | order/avc.py | ###############################################################################
# -*- coding: utf-8 -*-
# Order: A tool to characterize the local structure of liquid water
# by geometric order parameters
#
# Authors: Pu Du
#
# Released under the MIT License
####################################################... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.