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 |
|---|---|---|---|---|---|---|---|---|
edbc9f2c31f98e1447c352058aa05e6884a0927b | Create fold_eigenvalues.py | mlaloux/QGIS_structural_geology | fold_eigenvalues.py | fold_eigenvalues.py | #Definition of inputs and outputs
#==================================
##[Mes scripts GEOL]=group
##entree=vector
##dip_dir=field entree
##dip=field entree
#Algorithm body
#==================================
from qgis.core import *
from apsg import *
layer = processing.getObject(entree)
dipdir = layer.fieldNameIndex(... | apache-2.0 | Python | |
f55771da6a617c71f2eb620c11fb54e033c64338 | Migrate upload-orange-metadata process type | genialis/resolwe-bio,genialis/resolwe-bio,genialis/resolwe-bio,genialis/resolwe-bio | resolwe_bio/migrations/0002_metadata_table_type.py | resolwe_bio/migrations/0002_metadata_table_type.py | from django.db import migrations
from resolwe.flow.migration_ops import ResolweProcessChangeType
class Migration(migrations.Migration):
"""
Change the ``upload-orange-metadata`` process type.
"""
dependencies = [
("resolwe_bio", "0001_squashed_0015_sample_indices"),
]
operations = [... | apache-2.0 | Python | |
4170807e4a1c70eef6416fe3f1661c9c1c99a9da | Add pysal test | Kaggle/docker-python,Kaggle/docker-python | tests/test_pysal.py | tests/test_pysal.py | import unittest
from pysal.weights import lat2W
class TestPysal(unittest.TestCase):
def test_distance_band(self):
w = lat2W(4,4)
self.assertEqual(16, w.n) | apache-2.0 | Python | |
484a2bf0c28aa2bbc910ca20849840bf518d4329 | Add utils.banners test case | gogoair/foremast,gogoair/foremast | tests/test_utils.py | tests/test_utils.py | # Foremast - Pipeline Tooling
#
# Copyright 2016 Gogo, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | apache-2.0 | Python | |
45efbbdfd62cd0f9f8232bfd7ebd1aae0ac6cd17 | Create humidity.py | ariegg/webiopi-drivers,ariegg/webiopi-drivers | abstractions/sensor/humidity/humidity.py | abstractions/sensor/humidity/humidity.py | # This code has to be added to __init__.py in folder .../devices/sensor
class Humidity():
def __family__(self):
return "Humidity"
def __getHumidity__(self):
raise NotImplementedError
@api("Humidity", 0)
@request("GET", "sensor/humidity/*")
@response(contentType=M_JSON)
def h... | apache-2.0 | Python | |
c9bd5ba167284d79ae0cbe7aaaf9ec8536bef918 | add hiprec.py | ultimate-pa/benchexec,martin-neuhaeusser/benchexec,martin-neuhaeusser/benchexec,ultimate-pa/benchexec,martin-neuhaeusser/benchexec,dbeyer/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,dbeyer/benchexec,IljaZakharov/benchexec,dbeyer/benchexec,sosy-lab/benchexe... | benchexec/tools/hiprec.py | benchexec/tools/hiprec.py | #!/usr/bin/env python
"""
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 ... | apache-2.0 | Python | |
d726fd9b05b846097ee877ad0897f8416dbceaf7 | Add missing __init__ | olgabot/pelican-plugins,talha131/pelican-plugins,UHBiocomputation/pelican-plugins,MarkusH/pelican-plugins,kdheepak89/pelican-plugins,rlaboiss/pelican-plugins,olgabot/pelican-plugins,clokep/pelican-plugins,rlaboiss/pelican-plugins,howthebodyworks/pelican-plugins,FuzzJunket/pelican-plugins,yuanboshe/pelican-plugins,pestr... | gallery/__init__.py | gallery/__init__.py | from .gallery import *
| agpl-3.0 | Python | |
76ea7119e075cf6eb86d64768e90cfda124cedf9 | Add benchmarking script | drobilla/serd,drobilla/serd | serd_bench.py | serd_bench.py | #!/usr/bin/env python
import optparse
import os
import subprocess
import sys
class WorkingDirectory:
"Scoped context for changing working directory"
def __init__(self, working_dir):
self.original_dir = os.getcwd()
self.working_dir = working_dir
def __enter__(self):
os.chdir(self.... | isc | Python | |
c206969facfc0e46d7ec4d3f60ce2e6a07956dbd | Use filfinder to get the average radial width of features in the moment 0 | e-koch/VLA_Lband,e-koch/VLA_Lband | 14B-088/HI/analysis/run_filfinder.py | 14B-088/HI/analysis/run_filfinder.py |
from fil_finder import fil_finder_2D
from basics import BubbleFinder2D
from spectral_cube.lower_dimensional_structures import Projection
from astropy.io import fits
from radio_beam import Beam
from astropy.wcs import WCS
import astropy.units as u
import matplotlib.pyplot as p
'''
Filaments in M33? Why not?
'''
mom0_... | mit | Python | |
da2de3d9d4b36bf2068dbe5b80d785748f532292 | Add __init__.py for the schedule package | PyGotham/pygotham,djds23/pygotham-1,PyGotham/pygotham,djds23/pygotham-1,pathunstrom/pygotham,djds23/pygotham-1,pathunstrom/pygotham,pathunstrom/pygotham,PyGotham/pygotham,djds23/pygotham-1,PyGotham/pygotham,pathunstrom/pygotham,djds23/pygotham-1,pathunstrom/pygotham,PyGotham/pygotham | pygotham/schedule/__init__.py | pygotham/schedule/__init__.py | """Schedule package."""
| bsd-3-clause | Python | |
da5fed886d519b271a120820668d21518872f52c | Remove Duplicates from Sorted Array problem | zsmountain/leetcode,zsmountain/leetcode,zsmountain/leetcode | remove_duplicates_from_sorted_array.py | remove_duplicates_from_sorted_array.py | '''
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.
Do not allocate extra space for another array, you must do this in place with constant memory.
For example,
Given input array A = [1,1,2],
Your function should return length = 2, and A is now [... | apache-2.0 | Python | |
14302f83d755d2319a00db123dab14b300c8c93f | Add python patch script | rephormat/ripme,sleaze/ripme,sleaze/ripme,rephormat/ripme,sleaze/ripme,rephormat/ripme,metaprime/ripme,metaprime/ripme,metaprime/ripme | patch.py | patch.py | import json
import subprocess
# This script will:
# - read current version
# - increment patch version
# - update version in a few places
# - insert new line in ripme.json with message
message = raw_input('message: ')
with open('ripme.json') as dataFile:
ripmeJson = json.load(dataFile)
currentVersion = ripmeJson... | mit | Python | |
048e6960d9e6408ef5dbfad2e32d2d1768ead1da | set P(A) | Adamssss/projectEuler | pb151.py | pb151.py | import math
import time
import random
t1 = time.time()
# A1:16
# A2:8
# A3:4
# A4:2
# A5:1
'''
def getRandom(n):
return random.randint(1,n)
def getbatch(env,l):
i = getRandom(l)-1
t = env[i]
env.pop(i)
if t == 1:
return env
if t == 2:
return env+[1]
if t == 4:
retu... | mit | Python | |
f0684a5bb5860c2b9caffefb47dc55781092819e | Add eTools engine | asciimoo/searx,dalf/searx,asciimoo/searx,dalf/searx,asciimoo/searx,asciimoo/searx,dalf/searx,dalf/searx | searx/engines/etools.py | searx/engines/etools.py | """
eTools (Web)
@website https://www.etools.ch
@provide-api no
@using-api no
@results HTML
@stable no (HTML can change)
@parse url, title, content
"""
from lxml import html
from searx.engines.xpath import extract_text
from searx.url_utils import quote
from searx.utils import eval_xp... | agpl-3.0 | Python | |
4523621d2dd8913cb9c4156bf20e800652318a9d | add whileloop | BhaskarNaidu/python | whileloop.py | whileloop.py | a = 1
while a < 10:
print (a)
a = a+1
| apache-2.0 | Python | |
bd7a84353b298ad14634e5c9a7b442146e9bfeeb | Create __init__.py | sopython/kesh,sopython/kesh | kesh/__init__.py | kesh/__init__.py | # Empty __init__.py
| bsd-3-clause | Python | |
66d7ebe5210669284a335f83e2b8af7392285baa | add holistic video-to-pose | AmitMY/pose-format,AmitMY/pose-format,AmitMY/pose-format | pose_format/utils/holistic.py | pose_format/utils/holistic.py | import mediapipe as mp
import numpy as np
from tqdm import tqdm
from .openpose import hand_colors
from ..numpy.pose_body import NumPyPoseBody
from ..pose import Pose
from ..pose_header import PoseHeaderComponent, PoseHeaderDimensions, PoseHeader
mp_holistic = mp.solutions.holistic
BODY_POINTS = mp_holistic.PoseLandm... | mit | Python | |
9b169bf42bfb2c674460fc317cfb96f929ba0953 | Add tests suite for text modifier tags. | TamiaLab/PySkCode | tests/tests_tags/tests_textmodifiers.py | tests/tests_tags/tests_textmodifiers.py | """
SkCode text modifier tags test code.
"""
import unittest
from skcode.etree import TreeNode
from skcode.tags.textmodifiers import TextModifierBaseTagOptions
from skcode.tags import (LowerCaseTextTagOptions,
UpperCaseTextTagOptions,
CapitalizeTextTagOptions,
... | agpl-3.0 | Python | |
11f47fcad839b198d134f34b4489537360703a07 | Add helpers.py | ViderumGlobal/ckanext-orgdashboards,ViderumGlobal/ckanext-orgdashboards,ViderumGlobal/ckanext-orgdashboards,ViderumGlobal/ckanext-orgdashboards | ckanext/orgdashboards/tests/helpers.py | ckanext/orgdashboards/tests/helpers.py | from ckan.tests import factories
def create_mock_data(**kwargs):
mock_data = {}
mock_data['organization'] = factories.Organization()
mock_data['organization_name'] = mock_data['organization']['name']
mock_data['organization_id'] = mock_data['organization']['id']
mock_data['dataset'] = factories.... | agpl-3.0 | Python | |
46e1afd7faae8bd8c62f6b4f5c01322804e68163 | add script to visualize simulation coefficient (us, g, us') | fmilano/mitk,fmilano/mitk,fmilano/mitk,fmilano/mitk,iwegner/MITK,RabadanLab/MITKats,iwegner/MITK,fmilano/mitk,fmilano/mitk,iwegner/MITK,RabadanLab/MITKats,MITK/MITK,MITK/MITK,RabadanLab/MITKats,iwegner/MITK,RabadanLab/MITKats,MITK/MITK,RabadanLab/MITKats,MITK/MITK,RabadanLab/MITKats,MITK/MITK,fmilano/mitk,iwegner/MITK,... | Modules/Biophotonics/python/iMC/script_visualize_simulation_coefficients.py | Modules/Biophotonics/python/iMC/script_visualize_simulation_coefficients.py | '''
Created on Sep 22, 2015
@author: wirkert
'''
import math
import numpy as np
import matplotlib.pyplot as plt
from mc.usuag import UsG
if __name__ == '__main__':
# set up plots
f, axarr = plt.subplots(1, 4)
usplt = axarr[0]
usplt.grid()
usplt.set_xlabel("wavelengths [nm]")
usplt.set_ylabe... | bsd-3-clause | Python | |
b9c9a1f5cfea61050803ecc442232f2f8b4d7011 | Create yaml2json.py | cristicalin/tools | yaml2json.py | yaml2json.py | #!/usr/bin/python
import sys
import yaml
import json
if __name__ == '__main__':
content = yaml.load(sys.stdin)
print json.dumps(content, indent=2)
| mit | Python | |
7714b3c640a3d6d7fae9dba3496adfddd9354e0e | Add CFFI binding generator | thread/wide-product,thread/wide-product | build_wide.py | build_wide.py | import cffi
ffibuilder = cffi.FFI()
ffibuilder.set_source(
'_wide',
r"""
#include "wide.c"
""",
extra_compile_args=['-Werror', '-fno-unwind-tables', '-fomit-frame-pointer'],
)
ffibuilder.cdef(
r"""
typedef uint32_t wp_index;
typedef double wp_number;
wp_index wide_product(
... | mit | Python | |
6610483e55f5371d5dcfe06e984f791c3f051e4a | fix InMoov launching button | MyRobotLab/myrobotlab,MyRobotLab/myrobotlab,MyRobotLab/myrobotlab,MyRobotLab/myrobotlab,MyRobotLab/myrobotlab,MyRobotLab/myrobotlab,MyRobotLab/myrobotlab | src/main/resources/resource/Intro/InMoov01_start.py | src/main/resources/resource/Intro/InMoov01_start.py | #########################################
# InMoov01_start.py
# categories: inmoov
# more info @: http://myrobotlab.org/service/InMoov
#########################################
# uncomment for virtual hardware
# Platform.setVirtual(True)
i01 = Runtime.start('i01', 'InMoov2') | apache-2.0 | Python | |
9ba00cc698a5ce38d8cfb8eb6e921df0e24525cc | Create netstew.py | jpegleg/netstew | netstew.py | netstew.py | #!/opt/anaconda/bin/python2.7
# Print the links to stndard out.
from bs4 import BeautifulSoup
soup = BeautifulSoup(open("index.html"))
for link in soup.find_all('a'):
print(link.get('href'))
| mit | Python | |
2e3af241d989bf2b62bba5e344240246e8ff516b | add leave module | sammdot/circa | modules/leave.py | modules/leave.py | class LeaveModule:
def __init__(self, circa):
self.circa = circa
def onload(self):
self.circa.add_listener("cmd.leave", self.leave)
self.circa.add_listener("cmd.goaway", self.leave)
self.circa.add_listener("cmd.quit", self.quit)
def onunload(self):
self.circa.remove_listener("cmd.leave", self.leave)
se... | bsd-3-clause | Python | |
3411020a0445afcb626e7079ae2f4d17a02d27a0 | Add simple YTid2AmaraID mapper. | danielhollas/AmaraUpload,danielhollas/AmaraUpload | map_ytid2amaraid.py | map_ytid2amaraid.py | #!/usr/bin/env python3
import argparse, sys
from pprint import pprint
from amara_api import *
from utils import answer_me
def read_cmd():
"""Function for reading command line options."""
desc = "Program for mapping YouTube IDs to Amara IDs. If given video is not on Amara, it is created."
parser = argparse.Arg... | mit | Python | |
9fef390248387e02498d18ab7bba5b23e3632c7b | Add missing file | AudioCommons/ac-mediator,AudioCommons/ac-mediator,AudioCommons/ac-mediator | api/constants.py | api/constants.py | QUERY_PARAM_QUERY = 'q'
QUERY_PARAM_SORT = 's'
QUERY_PARAM_SIZE = 'size'
QUERY_PARAM_PAGE = 'page'
QUERY_PARAM_FIELDS = 'fields'
QUERY_PARAM_OFFSET = 'offset'
QUERY_PARAM_INCLUDE = 'include'
QUERY_PARAM_EXCLUDE = 'exclude'
QUERY_PARAM_WAIT_UNTIL_COMPLETE = 'wuc'
| apache-2.0 | Python | |
8f9c979fc2936d53321a377c67cbf2e3b4667f95 | Create status_light.py | grvrulz/BookPlayer,nerk/BookPlayer | status_light.py | status_light.py | import time
class StatusLight(object):
"""available patterns for the status light"""
patterns = {
'blink_fast' : (.1, [False, True]),
'blink' : (.5, [False, True]),
}
"""placeholder for pattern to tenmporarily interrupt
status light with different pattern"""
interrupt_pattern = [0, []]
"""continue fla... | mit | Python | |
a4ad0ffbda8beb4c2ea4ef0d181ec9ef0de3d1e1 | add the md5 by python | MiracleWong/aming_python,MiracleWong/aming_python | SystemInfo/1_hashlib.py | SystemInfo/1_hashlib.py | #!/usr/bin/python
#-*- coding:utf-8 -*-
import hashlib
import sys
def md5sum(f):
m = hashlib.md5()
with open(f) as fd:
while True:
data = fd.read(4096)
if data:
m.update(data)
else:
break
return m.hexdigest()
if __name__ == '__main__':
print md5sum(sys.argv[1])
| mit | Python | |
0abb8f6d266408f20c751726460ae2d87f307583 | solve 1 problem | Shuailong/Leetcode | solutions/factorial-trailing-zeroes.py | solutions/factorial-trailing-zeroes.py | #!/usr/bin/env python
# encoding: utf-8
"""
factorial-trailing-zeroes.py
Created by Shuailong on 2016-02-21.
https://leetcode.com/problems/factorial-trailing-zeroes/.
"""
class Solution(object):
def trailingZeroes(self, n):
"""
:type n: int
:rtype: int
"""
count = 0
... | mit | Python | |
c8fa91104d712bf2743b07b5edd5f38a040d6507 | Add unit tests for invoke_post_run | nzlosh/st2,tonybaloney/st2,Plexxi/st2,StackStorm/st2,nzlosh/st2,Plexxi/st2,tonybaloney/st2,tonybaloney/st2,Plexxi/st2,nzlosh/st2,StackStorm/st2,StackStorm/st2,Plexxi/st2,StackStorm/st2,nzlosh/st2 | st2common/tests/unit/test_runners_utils.py | st2common/tests/unit/test_runners_utils.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | apache-2.0 | Python | |
8977f320979998c9f18cfa7629c1811c7082dddf | Add setup.py (sigh) | shiplu/webxpath | setup.py | setup.py | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="webxpath", # Replace with your own username
version="0.0.2",
author="Shiplu Mokaddim",
author_email="shiplu@mokadd.im",
description="Run XPath query and expressions against websites",
... | apache-2.0 | Python | |
9af2c53af417295842f8ae329a8bb8abc99f693d | add setup.py file | sigurdga/samklang-blog,sigurdga/samklang-blog | setup.py | setup.py | #!/usr/bin/env python
from distutils.core import setup
setup(
name = 's7n-blog',
version = "1a1",
packages = ['s7n', 's7n.blog'],
)
| agpl-3.0 | Python | |
e1be390ab7a90d1efdb75a0b2e04c6414645a23c | Create setup.py | planetarypy/pdsspect | setup.py | setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('HISTORY.rst') as history_file:
history = history_file.read().replace('.. :changelog:', ... | bsd-3-clause | Python | |
18c0682306ee383d0eaad467d8fd7c9f74bb6e4f | add setup.py | BYUFLOWLab/pyoptsparsewrapper | setup.py | setup.py | #!/usr/bin/env python
# encoding: utf-8
from setuptools import setup # , find_packages
setup(
name='pyoptwrapper',
version='1.0',
description='wrapper to pyopt',
author='Andrew Ning',
author_email='aning@byu.edu',
py_modules=['pyoptwrapper'],
license='Apache License, Version 2.0',
zip... | mit | Python | |
a03fa3d725f296d3fa3fda323171924671ec65c0 | add setup.py for setuptools support | devkev/mtools,yaowenqiang/mtools,ces0712/mtools,ces0712/mtools,devkev/mtools,parkhyeonghwa/mtools,devkev/mtools,yaowenqiang/mtools,gormanb/mtools,ces0712/mtools,aerrami/mtools,parkhyeonghwa/mtools,parkhyeonghwa/mtools,tomzhang/mtools,gormanb/mtools,rueckstiess/mtools,yaowenqiang/mtools,gormanb/mtools,corymintz/mtools,a... | setup.py | setup.py | from setuptools import setup, find_packages
setup(
name='mtools',
version='1.0.0',
packages=find_packages(),
scripts=['scripts/mlaunch','scripts/mlog2json','scripts/mlogdistinct',
'scripts/mlogfilter','scripts/mlogmerge','scripts/mlogversion',
'scripts/mlogvis','scripts/mplotqueries'],... | apache-2.0 | Python | |
b106d4fdaf1667061879dd170ddeec1bde2042aa | Add setup.py. | praekelt/twitty-twister,dustin/twitty-twister | setup.py | setup.py | from distutils.core import setup
setup(name='twittytwister',
version='0.1',
description='Twitter client for Twisted Python',
author='Dustin Sallings',
author_email='dustin@spy.net',
url='http://github.com/dustin/twitty-twister/',
license='MIT',
platforms='any',
packages=['twittytwister'... | mit | Python | |
e0efdff7380101437c75ce6a50dd93302a3315e2 | Increase version dependency. | binarydud/pyres,guaijiao/pyres,TylerLubeck/pyres,Affectiva/pyres | setup.py | setup.py | from setuptools import setup, find_packages
version='0.9'
setup(
name='pyres',
version=version,
description='Python resque clone',
author='Matt George',
author_email='mgeorge@gmail.com',
maintainer='Matt George',
license='MIT',
url='http://github.com/binarydud/pyres',
packages=find_... | from setuptools import setup, find_packages
version='0.9'
setup(
name='pyres',
version=version,
description='Python resque clone',
author='Matt George',
author_email='mgeorge@gmail.com',
maintainer='Matt George',
license='MIT',
url='http://github.com/binarydud/pyres',
packages=f... | mit | Python |
8781799d2511dbafa7b11f2f8fb45356031a619b | Bump the sqlalchemy-citext version requirement | robhudson/warehouse,mattrobenolt/warehouse,mattrobenolt/warehouse,robhudson/warehouse,techtonik/warehouse,mattrobenolt/warehouse,techtonik/warehouse | setup.py | setup.py | #!/usr/bin/env python
# Copyright 2013 Donald Stufft
#
# 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 ag... | #!/usr/bin/env python
# Copyright 2013 Donald Stufft
#
# 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 ag... | apache-2.0 | Python |
18d899f36a140e677637118039e245127b0d138a | remove the long description | wintersandroid/tvrenamr,ghickman/tvrenamr | setup.py | setup.py | from setuptools import setup, find_packages
from tvrenamr import get_version
setup(
name = 'tvrenamr',
version = get_version(),
description = 'Rename tv show files using online databases',
author = 'George Hickman',
author_email = 'george@ghickman.co.uk',
url = 'http://github.com/ghickman/tvre... | from os.path import dirname, join
from setuptools import setup, find_packages
from tvrenamr import get_version
def fread(fname):
return open(join(dirname(__file__), fname)).read()
setup(
name = 'tvrenamr',
version = get_version(),
description = 'Rename tv show files using online databases',
long_... | mit | Python |
934e73247156b28d919957d738d8a5b03e403160 | Add setup.py. | peteflorence/simple_img_gallery,peteflorence/simple_img_gallery | setup.py | setup.py | """
setup.py for simple_img_gallery.
"""
from distutils.core import setup
setup(name="simple_img_gallery",
version="0.0.1",
description="Simple image gallery generation.",
author="Pete Florence",
author_email="",
url="https://github.com/peteflorence/simple_img_gallery",
scripts=['g... | mit | Python | |
ff5c68ccd566ba388f919bb663c5055685be3070 | Add initial setup.py | speechkey/mdx_picture | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup
setup(
name='mdx_picture',
version='1.0',
author='Artem Grebenkin',
author_email='speechkey@gmail.com',
description='Python-Markdown extension supports the <picture> tag.',
url='http://www.artemgrebenkin.com/',
py_modules=['mdx_picture'],
... | mit | Python | |
6972c0a6fc0431c7e41b110ea8c41dd9a4ed076c | Add distutils setup script | HearthSim/python-fsb5 | setup.py | setup.py | #!/usr/bin/env python3
from distutils.core import setup
setup(
name='python-fsb5',
version='1.0',
author='Simon Pinfold',
author_email='simon@uint8.me',
description='Library and to extract audio from FSB5 (FMOD Sample Bank) files',
download_url='https://github.com/synap5e/python-fsb5/tarball/master',
license='... | mit | Python | |
0bf30432084a5b6e71ea2ac36af165f7c4cee133 | Add setup.py | skwashd/python-acquia-cloud | setup.py | setup.py | #!/usr/bin/env python
from setuptools import setup
setup(name='acapi',
version='0.1',
description='Acquia Cloud API client.',
author='Dave Hall',
author_email='me@davehall.com.au',
url='http://github.com/skwashd/python-acquia-cloud',
install_requires=['httplib2==0.9', '... | mit | Python | |
28970e7d54186e1bf360cb91389b9ba6b3df4679 | Add script to validate mvn repositories | avikurapati/elasticsearch,weipinghe/elasticsearch,dongjoon-hyun/elasticsearch,JSCooke/elasticsearch,sneivandt/elasticsearch,socialrank/elasticsearch,hafkensite/elasticsearch,mortonsykes/elasticsearch,caengcjd/elasticsearch,wimvds/elasticsearch,yanjunh/elasticsearch,obourgain/elasticsearch,socialrank/elasticsearch,kalim... | dev-tools/validate-maven-repository.py | dev-tools/validate-maven-repository.py | # Licensed to Elasticsearch under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Elasticsearch licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except... | apache-2.0 | Python | |
3a235f8525ae89ae91c333f7cd10ed307c33011c | Exclude local data from package. | JostCrow/django-forms-builder,stephenmcd/django-forms-builder,nimbis/django-forms-builder,stephenmcd/django-forms-builder,iddqd1/django-forms-builder,vinnyrose/django-forms-builder,vinnyrose/django-forms-builder,simas/django-forms-builder,JostCrow/django-forms-builder,GetHappie/django-forms-builder,Afnarel/django-forms... | setup.py | setup.py |
from __future__ import with_statement
import os
from setuptools import setup, find_packages
exclude = ["forms_builder/example_project/dev.db",
"forms_builder/example_project/local_settings.py"]
exclude = dict([(e, None) for e in exclude])
for e in exclude:
if e.endswith(".py"):
try:
... |
from setuptools import setup, find_packages
setup(
name = "django-forms-builder",
version = __import__("forms_builder").__version__,
author = "Stephen McDonald",
author_email = "stephen.mc@gmail.com",
description = ("A Django reusable app providing the ability for admin "
"users to create... | bsd-2-clause | Python |
207116ee7ba8d8da521f497997da90066831a551 | Add codemod to replace __unicode__ with __str__ | edx/repo-tools,edx/repo-tools | django3_codemods/replace_unicode_with_str.py | django3_codemods/replace_unicode_with_str.py | import sys
from bowler import Query
(
Query(sys.argv[1])
.select_function("__unicode__")
.rename('__str__')
.idiff()
),
(
Query(sys.argv[1])
.select_method("__unicode__")
.is_call()
.rename('__str__')
.idiff()
)
| apache-2.0 | Python | |
d85a68e36443bfcdeed2d8f1f3960d1596ef762a | Create catchtheball.py | kapoorkkartik/pythongames | catchtheball.py | catchtheball.py | import simplegui
import random
FRAME_WIDTH=STAGE_WIDTH=GROUND_WIDTH=821
FRAME_HEIGHT=498
STAGE_HEIGHT=FRAME_HEIGHT-30
PADDLE_HEIGHT=STAGE_HEIGHT
PADDLE_WIDTH=8
PADDLE_POS=[STAGE_WIDTH/2,PADDLE_HEIGHT]
image=simplegui.load_image("http://mrnussbaum.com/calendarclowns1/images/game_background.png")
list_of_balls=[]
col... | apache-2.0 | Python | |
54bb69cd3646246975f723923254549bc5f11ca0 | Add default paver commands | ella/citools,ella/citools | citools/paver.py | citools/paver.py | @task
@consume_args
@needs('unit', 'integrate')
def test():
""" Run whole testsuite """
def djangonize_test_environment(test_project_module):
sys.path.insert(0, abspath(join(dirname(__file__))))
sys.path.insert(0, abspath(join(dirname(__file__), "tests")))
sys.path.insert(0, abspath(join(dirname(__fil... | bsd-3-clause | Python | |
0575a141153fb07a5f03c0681cdf727450348fc0 | Create space.py | Chuck8521/LunchtimeBoredom,Chuck8521/LunchtimeBoredom,Chuck8521/LunchtimeBoredom | space.py | space.py | def ParentOf(n, arr):
if arr[n] == n:
return n
else:
return ParentOf(arr[n],arr)
n, p = list(map(int, input().split()))
arr = []
for t in range(0,n):
arr.append(t)
for q in range(p):
#Quick Union the line
first, sec = list(map(int,input().split()))
arr[first] = ParentOf(sec)
... | mit | Python | |
3c074ab5c630590ca32f8951eecb3087afd8ae01 | add solution for Binary Tree Level Order Traversal II | zhyu/leetcode,zhyu/leetcode | src/binaryTreeLevelOrderTraversalII.py | src/binaryTreeLevelOrderTraversalII.py | # Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param root, a tree node
# @return a list of lists of integers
def levelOrderBottom(self, root):
self.res = []
... | mit | Python | |
f22b6368bdfe91cff06ede51c1caad04f769b437 | add management command to load location type into supply point | puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,SEL... | custom/colalife/management/commands/load_location_type_into_supply_point.py | custom/colalife/management/commands/load_location_type_into_supply_point.py | from corehq.apps.commtrack.models import SupplyPointCase
from corehq.apps.locations.models import Location
from django.core.management import BaseCommand
class Command(BaseCommand):
help = 'Store location type with supply point.'
def handle(self, *args, **options):
for location_type in ["wholesaler",... | bsd-3-clause | Python | |
3e02fe79f4fad6f5252af750a13d74d7a4f82cc5 | read in the file, probably badly | kinsamanka/machinekit,narogon/linuxcnc,cdsteinkuehler/MachineKit,bmwiedemann/linuxcnc-mirror,cnc-club/linuxcnc,ikcalB/linuxcnc-mirror,unseenlaser/machinekit,ianmcmahon/linuxcnc-mirror,unseenlaser/linuxcnc,kinsamanka/machinekit,bmwiedemann/linuxcnc-mirror,ArcEye/MK-Qt5,cnc-club/linuxcnc,kinsamanka/machinekit,RunningLigh... | src/emc/usr_intf/touchy/filechooser.py | src/emc/usr_intf/touchy/filechooser.py | # Touchy is Copyright (c) 2009 Chris Radek <chris@timeguy.com>
#
# Touchy 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
# (at your option) any later version.
#
# Touchy i... | # Touchy is Copyright (c) 2009 Chris Radek <chris@timeguy.com>
#
# Touchy 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
# (at your option) any later version.
#
# Touchy i... | lgpl-2.1 | Python |
2c98e54c7f2138b4472336520ab18af8f49b9b48 | test networks on test data corresponding to each dataset | santiagolopezg/MODS_ConvNet | test_network.py | test_network.py | import keras
from keras.optimizers import SGD, adadelta, rmsprop, adam
from keras.preprocessing.image import ImageDataGenerator
from keras.utils import np_utils
from keras.metrics import matthews_correlation, precision, recall
import cPickle
import numpy as np
import getpass
username = getpass.getuser()
from foo_two... | mit | Python | |
ed94317df99493c24c58a1e1aa553a8f822e793f | Test cases | gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext | erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py | erpnext/accounts/report/sales_payment_summary/test_sales_payment_summary.py | # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import unittest
import frappe
import erpnext
from erpnext.accounts.report.sales_payment_summary.sales_payment_summary import get_mode_of_payments, get_m... | agpl-3.0 | Python | |
37793ec10e2b27e64efaa3047ae89a6d10a6634d | Update urlrewrite_redirect.py | tobinjt/Flexget,crawln45/Flexget,crawln45/Flexget,ianstalk/Flexget,xfouloux/Flexget,tsnoam/Flexget,jawilson/Flexget,qvazzler/Flexget,oxc/Flexget,OmgOhnoes/Flexget,malkavi/Flexget,tsnoam/Flexget,Danfocus/Flexget,JorisDeRieck/Flexget,ibrahimkarahan/Flexget,Flexget/Flexget,antivirtel/Flexget,ZefQ/Flexget,tvcsantos/Flexget... | flexget/plugins/urlrewrite_redirect.py | flexget/plugins/urlrewrite_redirect.py | from __future__ import unicode_literals, division, absolute_import
import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger('urlrewrite_redirect')
class UrlRewriteRedirect(object):
"""Rewrites urls which actually redirect somewhere else."""
def __init__(self):
... | from __future__ import unicode_literals, division, absolute_import
import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger('urlrewrite_redirect')
class UrlRewriteRedirect(object):
"""Rewrites urls which actually redirect somewhere else."""
def __init__(self):
... | mit | Python |
e4ca040124e26b06a11e7fb51c3622a213285d24 | Create thresholding.py | jeffsp/kaggle_denoising,jeffsp/kaggle_denoising | thresholding.py | thresholding.py | import numpy as np
from PIL import Image
def discretize(a):
return np.uint8((a > 50)*255)
image_id = 101
dirty_image_path = "../input/train/%d.png" % image_id
clean_image_path = "../input/train_cleaned/%d.png" % image_id
dirty = Image.open(dirty_image_path)
clean = Image.open(clean_image_path)
dirty.save("dirty... | mit | Python | |
d78444cdb6018e2fe49905638ce7645e8de5738b | add util/csv_melt.py | shenwei356/bio_scripts,shenwei356/bio_scripts,shenwei356/bio_scripts,shenwei356/bio_scripts | util/csv_melt.py | util/csv_melt.py | #!/usr/bin/env python
# https://github.com/shenwei356/bio_scripts"
import argparse
import csv
import re
import sys
import pandas as pd
parser = argparse.ArgumentParser(
description="Melt CSV file, you can append new column",
epilog="https://github.com/shenwei356/bio_scripts")
parser.add_argument(
'key',
... | mit | Python | |
326010629c6d5bb1274d1db1231f5b84c394b4e4 | Add some api tests for ZHA (#20909) | sander76/home-assistant,mKeRix/home-assistant,turbokongen/home-assistant,partofthething/home-assistant,nugget/home-assistant,robbiet480/home-assistant,leppa/home-assistant,titilambert/home-assistant,joopert/home-assistant,aronsky/home-assistant,rohitranjan1991/home-assistant,nkgilley/home-assistant,jabesq/home-assistan... | tests/components/zha/test_api.py | tests/components/zha/test_api.py | """Test ZHA API."""
from unittest.mock import Mock
import pytest
from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.components.switch import DOMAIN
from homeassistant.components.zha.api import (
async_load_api, WS_ENTITIES_BY_IEEE, WS_ENTITY_CLUSTERS, ATTR_IEEE, TYPE,
ID, NAME, WS_ENTITY_CLUSTER_... | mit | Python | |
0b1fc2eb8dad6e5b41e80c5b0d97b9f8a20f9afa | Add utils.py | ssut/py-krcurrency | krcurrency/utils.py | krcurrency/utils.py | """:mod:`krcurrency.utils` --- Helpers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from bs4 import BeautifulSoup as BS
import requests
__all__ = 'request',
def request(url, encoding='utf-8', parselib='lxml'):
"""url로 요청한 후 돌려받은 값을 BeautifulSoup 객체로 변환해서 반환합니다.
"""
r = requests.get(url)
if r.status_c... | mit | Python | |
76a2c80b015228dd4c6aa932ca9b2faece23a714 | Create multiplesof3and5.py | GirlGeekUpNorth/Project-Euler | multiplesof3and5.py | multiplesof3and5.py | #If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9.
#The sum of these multiples is 23.
#Find the sum of all the multiples of 3 or 5 below 1000.
answer = 0
for i in range (1,1000);
if i%3 = 0 or i%5 = 0;
answer = answer + i
else;
continue
print answer
| mit | Python | |
2d1624f088431e5f71214988499f732695a82b16 | Bump version 0.15.0rc3 --> 0.15.0rc4 | lbryio/lbry,lbryio/lbry,zestyr/lbry,lbryio/lbry,zestyr/lbry,zestyr/lbry | lbrynet/__init__.py | lbrynet/__init__.py | import logging
__version__ = "0.15.0rc4"
version = tuple(__version__.split('.'))
logging.getLogger(__name__).addHandler(logging.NullHandler())
| import logging
__version__ = "0.15.0rc3"
version = tuple(__version__.split('.'))
logging.getLogger(__name__).addHandler(logging.NullHandler())
| mit | Python |
5dd4deba3d5a53406e735aadad5ac917919b3852 | add tests for PlotableObject | morgenst/PyAnalysisTools,morgenst/PyAnalysisTools,morgenst/PyAnalysisTools | tests/unit/TestPlotableObject.py | tests/unit/TestPlotableObject.py | import os
import unittest
import ROOT
from PyAnalysisTools.PlottingUtils import PlotableObject as po
cwd = os.path.dirname(__file__)
ROOT.gROOT.SetBatch(True)
class TestPlotableObject(unittest.TestCase):
def test_ctor(self):
obj = po.PlotableObject()
self.assertIsNone(obj.plot_object)
se... | mit | Python | |
854a1ab7c13b4d4d8e28ab13f0cdaef5c1fcb9a6 | Create solution.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | hackerrank/algorithms/warmup/easy/compare_the_triplets/py/solution.py | hackerrank/algorithms/warmup/easy/compare_the_triplets/py/solution.py | #!/bin/python3
import sys
cmp = lambda a, b: (a > b) - (b > a)
aliceScores = tuple(map(int, input().strip().split(' ')))
bobScores = tuple(map(int, input().strip().split(' ')))
scoreCmp = tuple(map(lambda a, b: cmp(a, b), aliceScores, bobScores))
aliceScore = len(tuple(filter(lambda x: x > 0, scoreCmp... | mit | Python | |
4764b5248cf91042a12ce6aef77a04c37360eb4f | Add initial shell of Pyglab class. | sloede/pyglab,sloede/pyglab | pyglab/pyglab.py | pyglab/pyglab.py | import requests
class Pyglab(object):
def __init__(self, token):
self.token = token
self.headers = {'PRIVATE-TOKEN', token}
self.user = None
def sudo(self, user):
"""Permanently set a different username. Returns the old username."""
previous_user = self.user
s... | mit | Python | |
70e04b20c5d78b41546aa4ea1a1e2fd82af7527f | Add JSON HttpResponse that does the encoding for you. | bueda/django-comrade | comrade/http/__init__.py | comrade/http/__init__.py | from django.core.serializers import json, serialize
from django.db.models.query import QuerySet
from django.http import HttpResponse
from django.utils import simplejson
class HttpJsonResponse(HttpResponse):
def __init__(self, object, status=None):
if isinstance(object, QuerySet):
content = seri... | mit | Python | |
d3ba2b8cf84ba54d932fcc48b464f125798c0b27 | Add simple bash with git install script | nephomaniac/nephoria,nephomaniac/nephoria | toolbox/install_script_git.sh.py | toolbox/install_script_git.sh.py | #!/bin/bash
venv="nephoria_venv"
neph_branch="oldboto"
adminapi_branch="master"
yum install -y python-devel gcc git python-setuptools python-virtualenv
if [ ! -d adminapi ]; then
git clone https://github.com/nephomaniac/adminapi.git
fi
if [ ! -d nephoria ]; then
git clone https://github.com/nephomaniac/nephoria... | bsd-2-clause | Python | |
5ae194cacef0a24c3d6a0714d3f435939973b3cb | Add some helpful utilities | drkitty/python3-base,drkitty/python3-base | utils.py | utils.py | from functools import wraps
def cached_property(f):
name = f.__name__
@property
@wraps(f)
def inner(self):
if not hasattr(self, "_property_cache"):
self._property_cache = {}
if name not in self._property_cache:
self._property_cache[name] = f(self)
return... | unlicense | Python | |
93b1253389075174fa942e848d6c1f7666ffc906 | add solution for Combination Sum II | zhyu/leetcode,zhyu/leetcode | src/combinationSumII.py | src/combinationSumII.py | class Solution:
# @param candidates, a list of integers
# @param target, integer
# @return a list of lists of integers
def combinationSum2(self, candidates, target):
if not candidates:
return []
candidates.sort()
n = len(candidates)
res = set()
def s... | mit | Python | |
19d5b2f58d712f49638dad83996f9e60a6ebc949 | Add a release script. | n-someya/pgcli,koljonen/pgcli,joewalnes/pgcli,janusnic/pgcli,darikg/pgcli,janusnic/pgcli,lk1ngaa7/pgcli,d33tah/pgcli,thedrow/pgcli,johshoff/pgcli,darikg/pgcli,dbcli/vcli,bitemyapp/pgcli,thedrow/pgcli,nosun/pgcli,suzukaze/pgcli,stuartquin/pgcli,dbcli/vcli,zhiyuanshi/pgcli,suzukaze/pgcli,MattOates/pgcli,dbcli/pgcli,j-ben... | release.py | release.py | #!/usr/bin/env python
import re
import ast
import subprocess
def version():
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('pgcli/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-8')).group(1)))
return version
def create... | bsd-3-clause | Python | |
0003b3fe31a1b92dda994b2f7eacf6cef7e08ce4 | Add check_blocked.py | osamak/okbot,osamak/okbot | check_blocked.py | check_blocked.py | # This script is licensed under the GNU Affero General Public License
# either version 3 of the License, or (at your option) any later
# version.
#
# This script was tested on GNU/Linux opreating system.
#
# To run this script:
# 1) Download the list of articles for the Wikipedia edition that
# you want to scan ... | agpl-3.0 | Python | |
9b3e0c7eb28a67e2383cad6cbfa97fc4fd575756 | Add error classification | ContinuumIO/pypi-conda-builds | classify_logs.py | classify_logs.py | import re
import yaml
error_types = ["no package found",
"unclassified"]
def classify_build_log(log_file):
"""
Takes a build log file object as an input and returns
a tupe `(category, sub-category, sub-category)`
- missing dependency:
- Build Dependency
- Test Dependen... | bsd-3-clause | Python | |
aafa99714eff3c5021594ae5021bdd47b41c9c6b | save tpl environs after invoke shell constructor | faycheng/tpl,faycheng/tpl | assets/save_tpl_envs.py | assets/save_tpl_envs.py | # -*- coding:utf-8 -*-
import os
import sys
import json
def save_tpl_envs(path):
envs = {}
for key, value in os.environ.items():
if key.startswith('TPL_'):
envs[key[4:]] = value
with open(path, 'w') as fd:
fd.write(json.dumps(envs))
if __name__ == '__main__':
path = sys.... | mit | Python | |
af9b0ee39d18ca174b19143bdda0d478c4d5a834 | add a driver for hourly reporting | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | scripts/iemre/rerun_hourly.py | scripts/iemre/rerun_hourly.py | import mx.DateTime
import stage4_hourlyre
sts = mx.DateTime.DateTime(2010,5,1)
ets = mx.DateTime.DateTime(2010,5,13)
interval = mx.DateTime.RelativeDateTime(hours=1)
now = sts
while now < ets:
print now
stage4_hourlyre.merge( now )
now += interval
| mit | Python | |
0920a23a72e1e14179b75b4d2a50e956ee9deec0 | add skeleton generation file | dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy,dssg/wikienergy | disaggregator/generate.py | disaggregator/generate.py | from appliance import ApplianceTrace
from appliance import ApplianceInstance
from appliance import ApplianceSet
from appliance import ApplianceType
import fhmm
| mit | Python | |
8ccab210054c2776a36b7e3648fa1e27eb49a27b | add deeplearning cross-validation NOPASS. PUBDEV-1696. | YzPaul3/h2o-3,mathemage/h2o-3,PawarPawan/h2o-v3,tarasane/h2o-3,weaver-viii/h2o-3,michalkurka/h2o-3,h2oai/h2o-dev,nilbody/h2o-3,h2oai/h2o-dev,weaver-viii/h2o-3,h2oai/h2o-3,jangorecki/h2o-3,mrgloom/h2o-3,brightchen/h2o-3,bospetersen/h2o-3,tarasane/h2o-3,spennihana/h2o-3,h2oai/h2o-dev,nilbody/h2o-3,h2oai/h2o-3,michalkurka... | h2o-py/tests/testdir_algos/deeplearning/pyunit_NOPASS_cv_carsDeepLearning.py | h2o-py/tests/testdir_algos/deeplearning/pyunit_NOPASS_cv_carsDeepLearning.py | import sys
sys.path.insert(1, "../../../")
import h2o
import random
def cv_carsDL(ip,port):
# Connect to h2o
h2o.init(ip,port)
# read in the dataset and construct training set (and validation set)
cars = h2o.import_frame(path=h2o.locate("smalldata/junit/cars_20mpg.csv"))
# choose the type model-... | apache-2.0 | Python | |
1483f6cece70cb5de115ea1edc630e98292a8170 | Add Sorting/Selection.py & Selection() | besirkurtulmus/AdvancedAlgorithms | Sorting/Selection.py | Sorting/Selection.py | # @auther Besir Kurtulmus
# coding: utf-8
'''
The MIT License (MIT)
Copyright (c) 2014 Ahmet Besir Kurtulmus
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... | mit | Python | |
973696b0c50f235cfcef9e0cb30c6fc2f1028058 | add an index for the story_storytags table | ColdrickSotK/storyboard,ColdrickSotK/storyboard,ColdrickSotK/storyboard | storyboard/db/migration/alembic_migrations/versions/063_index_story_storytags.py | storyboard/db/migration/alembic_migrations/versions/063_index_story_storytags.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
# distributed under t... | apache-2.0 | Python | |
bd4153ff3c0824f7e901dd25e77cdaaeea2072c0 | add tests for basic outdoor pois | mapzen/vector-datasource,mapzen/vector-datasource,mapzen/vector-datasource | test/662-basic-outdoor-pois.py | test/662-basic-outdoor-pois.py | #http://www.openstreetmap.org/node/1387024181
assert_has_feature(
16, 10550, 25297, 'pois',
{ 'kind': 'bbq', 'min_zoom': 18 })
#http://www.openstreetmap.org/node/3497698404
assert_has_feature(
16, 10471, 25343, 'pois',
{ 'kind': 'bicycle_repair_station', 'min_zoom': 18 })
#http://www.openstreetmap.org... | mit | Python | |
3c4fd0477c7d6f9d0f30654271e73466d192d1e1 | Add data type for vectors | tschijnmo/drudge,tschijnmo/drudge,tschijnmo/drudge | drudge/vec.py | drudge/vec.py | """Vectors and utilities."""
import collections.abc
from sympy import sympify
class Vec:
"""Vectors.
Vectors are the basic non-commutative quantities. Its objects consist of
an base and some indices. The base is allowed to be any Python object,
although small hashable objects, like string, are ad... | mit | Python | |
d0d4688a8768dceeeb5d609a05de72fc24ac6b75 | Create pwned.py | 0x424D/crappy,0x424D/crappy | pwned/src/pwned.py | pwned/src/pwned.py | import hashlib, sys, urllib.request
def main():
hash = hashlib.sha1(bytes(sys.argv[1], "utf-8"))
digest = hash.hexdigest().upper()
url = f"https://api.pwnedpasswords.com/range/{digest[:5]}"
request = urllib.request.Request(url, headers={"User-Agent":"API-Programming-Exercise"})
page = urllib.request.urlopen(requ... | agpl-3.0 | Python | |
a81e65eaabb0f3e99721854d2dcaa7dd1f8b0a21 | Create SVM.py | rmatam/Deep-Learning | 02.Algorithms/SVM.py | 02.Algorithms/SVM.py | # -*- coding: utf-8 -*-
"""
Created on Thu Jan 19 13:23:12 2017
@author: rmatam
"""
# -*- coding: utf-8 -*-
# 2015/01/11
# Script passed in py2 & py3 with Ubuntu 14.04 env.
# Prerequirement: pip install numpy scipy scikit-learn
# furthermore info http://scikit-learn.org/stable/modules/generated/sklearn.feature_extra... | apache-2.0 | Python | |
806594afc5468d3cee183defba24501516b791f0 | add cities borders | opendataby/osm-geodata | belarus_city_borders.py | belarus_city_borders.py | from _helpers import cursor_wrap, dump
@cursor_wrap
def main(cursor):
sql = """
SELECT ct.osm_id, c.name AS country, '' AS region, '' AS subregion, ct.name AS city, ST_AsGeoJSON(ct.way)
FROM osm_polygon c
LEFT JOIN osm_polygon ct ON ST_Contains(c.way, ct.way)
WHERE c.osm_id = -5906... | mit | Python | |
fdb901a59e8dd61892f5033efe49e3bbbdae097f | Create CNlab1.py | gopika1697/DS,gopika1697/DS | CNlab1.py | CNlab1.py | #To check the validity of ip address
import sys
import textwrap
def valid(ip):
if ip.count('.')!=3:
print("Invalid")
sys.exit(0)
ipl=[]
ipl=ip.split('.')
for i in ipl:
if not i.isdigit():
print("Invalid")
sys.exit(0)
if int(i)>255:
print("Inval... | apache-2.0 | Python | |
bf6f58d5958275070c1018174217873ea08db904 | Add test pull task | opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor | nodeconductor/structure/tests/tasks.py | nodeconductor/structure/tests/tasks.py | from celery import shared_task
from nodeconductor.core import utils as core_utils
@shared_task
def pull_instance(serialized_instance, pulled_disk):
""" Test-only task that allows to emulate pull operation """
instance = core_utils.deserialize_instance(serialized_instance)
instance.disk = pulled_disk
... | mit | Python | |
7ce8c06c5447d89f941d482c84693e432384def6 | rename `file` to `filename` for clarity. | ergl/pysellus,Pysellus/pysellus,cgvarela/pysellus,angelsanz/pysellus | pysellus/loader.py | pysellus/loader.py | import os
import sys
from inspect import isfunction
from importlib import import_module
def load(path):
if _is_python_file(path):
sys.path.insert(0, os.path.dirname(path))
module = import_module(_get_module_name_from_path(path))
return _get_checks_from_module(module)
functions = []
... | import os
import sys
from inspect import isfunction
from importlib import import_module
def load(path):
if _is_python_file(path):
sys.path.insert(0, os.path.dirname(path))
module = import_module(_get_module_name_from_path(path))
return _get_checks_from_module(module)
functions = []
... | mit | Python |
cc5f55fa6eb6d0ecaaef1c1e269fb40c2731fef5 | Add test helpers | andrei-karalionak/ggrc-core,j0gurt/ggrc-core,selahssea/ggrc-core,NejcZupec/ggrc-core,prasannav7/ggrc-core,andrei-karalionak/ggrc-core,kr41/ggrc-core,josthkko/ggrc-core,plamut/ggrc-core,NejcZupec/ggrc-core,josthkko/ggrc-core,AleksNeStu/ggrc-core,edofic/ggrc-core,jmakov/ggrc-core,NejcZupec/ggrc-core,j0gurt/ggrc-core,Vinn... | src/lib/test_helpers.py | src/lib/test_helpers.py | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: jernej@reciprocitylabs.com
# Maintained By: jernej@reciprocitylabs.com
"""
Utility classes for page objects used in tests.
Details:
Most of the te... | apache-2.0 | Python | |
8e7350cbfc96541d9a3ddc970309c60793bb4126 | fix TermsFacet | qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq | corehq/apps/es/facets.py | corehq/apps/es/facets.py | class FacetResult(object):
def __init__(self, raw, facet):
self.facet = facet
self.raw = raw
self.result = raw.get(self.facet.name, {}).get(self.facet.type, {})
class Facet(object):
name = None
type = None
params = None
result_class = FacetResult
def __init__(self):
... | class FacetResult(object):
def __init__(self, raw, facet):
self.facet = facet
self.raw = raw
self.result = raw.get(self.facet.name, {}).get(self.facet.type, {})
class Facet(object):
name = None
type = None
params = None
result_class = FacetResult
def __init__(self):
... | bsd-3-clause | Python |
04ded12c05b20fc3a25956712f8e0fb1723c3edb | Add a snippet (python/warnings). | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | python/warnings.py | python/warnings.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Jérémie DECOCK (http://www.jdhp.org)
import warnings
def custom_formatwarning(message, category, filename, lineno, line=""):
"""Ignore everything except the message."""
return "Warning: " + str(message) + "\n"
def main():
"""Main functio... | mit | Python | |
630413b6bdc385095fe8da549b691d54fc6a4504 | Add ITWeek.py | Ophixia/scrape | ITWeek.py | ITWeek.py | import requests
from bs4 import BeautifulSoup
def main():
url = 'https://ex-portal3.reed.jp/list/SODECS2017_ja.html'
res = requests.get(url)
soup = BeautifulSoup(res.content, 'html.parser')
companies = soup.find_all('tr')
for company in companies:
print(company.text)
if __name__... | mit | Python | |
1f71153cf814f7d34835cea6eafe44683035d874 | Add compare_files.py | theDrake/python-experiments | compare_files.py | compare_files.py | import difflib
def compare_files(filename1, filename2):
f = open(filename1, "r")
filelines1 = f.readlines()
f.close()
f = open(filename2, "r")
filelines2 = f.readlines()
f.close()
diffs = difflib.context_diff(filelines1,
filelines2,
... | mit | Python | |
3ce2e0b8825c7abc219a812c5abda45184fbfdec | add wot wikia plugin | rascul/botwot | plugins/wotwikia.py | plugins/wotwikia.py | """ WoT Wikia Plugin (botwot plugins.wiki) """
# Copyright 2015 Ray Schulz <https://rascul.io>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... | apache-2.0 | Python | |
46818f540d48bd967e8e0e5d846f0757f2ca6c1c | Add test for set_shard() | peastman/deepchem,peastman/deepchem,deepchem/deepchem,deepchem/deepchem | deepchem/data/tests/test_setshard.py | deepchem/data/tests/test_setshard.py | import deepchem as dc
import numpy as np
def test_setshard_with_X_y():
"""Test setharding on a simple example"""
X = np.random.rand(10, 3)
y = np.random.rand(10,)
dataset = dc.data.DiskDataset.from_numpy(X, y)
assert dataset.get_shape()[0][0] == 10
assert dataset.get_shape()[1][0] == 10
for i, (X, y, w,... | mit | Python | |
a8bbbb77e2036b66a5083bd2a1393b0de588af0c | Rename to alg_count_changes.py & count_changes() | bowen0701/algorithms_data_structures | alg_count_changes.py | alg_count_changes.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
"""Count Changes.
Count how many distinct ways you can make change that amount.
Assume that you have an infinite number of each kind of coin.
"""
def count_changes_recur(amount, coins, n):
"""Count chan... | bsd-2-clause | Python | |
6ad081e91e337e1627b70674109f45ba35248f8c | Add missing migration file to the repo | cgwire/zou | zou/migrations/versions/e839d6603c09_add_person_id_to_shot_history.py | zou/migrations/versions/e839d6603c09_add_person_id_to_shot_history.py | """add person id to shot history
Revision ID: e839d6603c09
Revises: 346250b5304c
Create Date: 2020-12-14 12:00:19.045783
"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
import sqlalchemy_utils
import uuid
# revision identifiers, used by Alembic.
revision = 'e839d6603c09'
down_revision = '3... | agpl-3.0 | Python | |
0538523f617ec1d410861b52a647c788c06c267a | Fix llg tests. | fangohr/oommf-python,ryanpepper/oommf-python,fangohr/oommf-python,ryanpepper/oommf-python,fangohr/oommf-python,ryanpepper/oommf-python,ryanpepper/oommf-python | pyoommf/test_llg.py | pyoommf/test_llg.py | from llg import LLG
def test_llg_mif():
t = 1.5e-9
m_init = (0, 1, 0)
Ms = 1e6
alpha = 0.01
gamma = 2.21e5
name = 'llgtest'
llg = LLG(t, m_init, Ms, alpha, gamma, name)
mif_string = llg.get_mif()
lines = mif_string.split('\n')
assert 'Specify Oxs_RungeKuttaEvolve {' in lines... | from llg import LLG
def test_llg_mif():
t = 1.5e-9
m_init = (0, 1, 0)
Ms = 1e6
alpha = 0.01
gamma = 2.21e5
llg = LLG(t, m_init, Ms, alpha, gamma)
mif_string = llg.get_mif()
lines = mif_string.split('\n')
assert 'Specify Oxs_RungeKuttaEvolve {' in lines[0]
line2 = lines[1... | bsd-2-clause | Python |
22252d6978f237a2a46415dcf54d4adbed92b1ce | Add LLG tests. | ryanpepper/oommf-python,ryanpepper/oommf-python,fangohr/oommf-python,ryanpepper/oommf-python,ryanpepper/oommf-python,fangohr/oommf-python,fangohr/oommf-python | pyoommf/test_llg.py | pyoommf/test_llg.py | from llg import LLG
def test_llg_mif():
t = 1.5e-9
m_init = (0, 1, 0)
Ms = 1e6
alpha = 0.01
gamma = 2.21e5
llg = LLG(t, m_init, Ms, alpha, gamma)
mif_string = llg.get_mif()
lines = mif_string.split('\n')
assert 'Specify Oxs_RungeKuttaEvolve {' in lines[0]
line2 = lines[1... | bsd-2-clause | Python | |
b21fbb09b33e40a33ad3ea33b0394fed421c8a6e | add num02 | muzuco/pythonstudy2014 | pythonTest/num02.py | pythonTest/num02.py | def reverse(x):
changeTuple=tuple(x)
reverseTuple=changeTuple[::-1]
print(''.join(reverseTuple))
test = "this is test string"
reverse(test)
| apache-2.0 | Python | |
edc35e4aefe336eb1bf02dbf7104925389276fa6 | Add shellcheck for sh filetype | maralla/vim-linter,maralla/validator.vim,maralla/vim-fixup,maralla/vim-linter,maralla/vim-fixup | pythonx/lints/sh.py | pythonx/lints/sh.py | # -*- coding: utf-8 -*-
from validator import Validator
class Sh(Validator):
__filetype__ = "sh"
checker = "shellcheck"
args = "-x -f gcc"
regex = r"""
.+:
(?P<lnum>\d+):
(?P<col>\d+):
.*
\s
(
(?P<error>error)
... | mit | Python | |
c25cebf31648466111cb3d576e0a398bb4220ccf | Add test for sabnzbd cleanupfilename.py | FreekKalter/linux-scripts,FreekKalter/linux-scripts,FreekKalter/linux-scripts,FreekKalter/linux-scripts | sabnzbd/test_cleanupfilename.py | sabnzbd/test_cleanupfilename.py | import unittest
from cleanupfilename import rename
class TestRename(unittest.TestCase):
files = []
dirs = []
def setUp(self):
self.files = [('filename-sample.x264.mp4', 'filename.mp4'),
('filename.mp4', 'filename.mp4')]
self.dirs = [('filename sample mp4', 'filename'... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.