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 |
|---|---|---|---|---|---|---|---|---|
367c0c09179a25157e32e48a23b9503d31862fa4 | Add empty tests of model | uboot/stromx-web,uboot/stromx-web,uboot/stromx-web | test/modeltest.py | test/modeltest.py | # -*- coding: utf-8 -*-
import unittest | apache-2.0 | Python | |
00790a2e32d8055f4f31391b46af572ea02a5dd0 | add migration for the default_service_directory_radius SiteSetting | praekelt/molo-tuneme,praekelt/molo-tuneme,praekelt/molo-tuneme,praekelt/molo-tuneme | tuneme/migrations/0005_auto_20180926_1204.py | tuneme/migrations/0005_auto_20180926_1204.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-09-26 10:04
from __future__ import unicode_literals
from django.db import migrations, models
def add_25_km_as_default(apps, schema_editor):
model = apps.get_model('core', 'SiteSettings')
instance = model.objects.first()
instance.default_servic... | bsd-2-clause | Python | |
43272a76b3ffc950298d599be26ed20cbc5c8ead | add tv example | sightmachine/SimpleCV2,hurdlea/SimpleCV,hayd/SimpleCV,jayrambhia/SimpleCV2,jyt109/SimpleCV,jayrambhia/SimpleCV2,tpltnt/SimpleCV,onaclovtech/SimpleCV,jyt109/SimpleCV,beni55/SimpleCV,nils-werner/SimpleCV,jlegendary/SimpleCV,sightmachine/SimpleCV,gskielian/SimpleCV,onaclovtech/SimpleCV,tpltnt/SimpleCV,tpltnt/SimpleCV,hayd... | SimpleCV/examples/manipulation/tvexample.py | SimpleCV/examples/manipulation/tvexample.py | from SimpleCV import Camera, Image, Display
tv_original = Image("../../sampleimages/family_watching_television_1958.jpg")
tv_coordinates = [(353, 379), (433,380),(432, 448), (354,446)]
tv_mask = Image(tv_original.size()).invert().warp(tv_coordinates)
tv = tv_original - tv_mask
c = Camera()
d = Display(tv.size())
wh... | bsd-3-clause | Python | |
7d16e5b25d094a60f3279e0b35482604aa18b96c | add FITS thumbnail retrieval tools, initial | zpace/stellarmass_pca | imaging_tools.py | imaging_tools.py | import numpy as np
from astroquery.skyview import SkyView
class MaNGA_SkyView(SkyView):
'''
subclass of SkyView, which allows access to FITS thumbnails of
a MaNGA object
'''
@classmethod
def from_drpall_row(cls, row):
raise NotImplementedError
@classmethod
def from_wcs_hea... | mit | Python | |
a989fb1634ba42bbf18037bc50e72f6984b04b0c | Add atomic write stream class | Ghostkeeper/Luna | plugins/storage/localstorage/atomic_write_stream.py | plugins/storage/localstorage/atomic_write_stream.py | #!/usr/bin/env python
#-*- coding: utf-8 -*-
#This software is distributed under the Creative Commons license (CC0) version 1.0. A copy of this license should have been distributed with this software.
#The license can also be read online: <https://creativecommons.org/publicdomain/zero/1.0/>. If this online license dif... | cc0-1.0 | Python | |
44c7cb73a309a02e907ab6d4ded5957e62ec39e3 | Add PipeServer class to manage a pipe server process | guillermooo-forks/dart-sublime-bundle,guillermooo/dart-sublime-bundle,guillermooo-forks/dart-sublime-bundle,guillermooo/dart-sublime-bundle,guillermooo/dart-sublime-bundle,guillermooo/dart-sublime-bundle,guillermooo-forks/dart-sublime-bundle,guillermooo-forks/dart-sublime-bundle | lib/analyzer/pipe_server.py | lib/analyzer/pipe_server.py | '''Wraps a process to make it act as a pipe server. Takes care of supressing
console windows under Windows and other housekeeping.
'''
from subprocess import Popen
from subprocess import PIPE
import threading
from Dart import PluginLogger
from Dart.lib.plat import supress_window
from Dart.lib.path import pushd
_log... | bsd-3-clause | Python | |
5b7697661c90e27ce36e6eae3b854470862f4191 | Add python wrapper for WebP image format support | tensorflow/io,tensorflow/io,tensorflow/io,tensorflow/io,tensorflow/io,tensorflow/io,tensorflow/io | tensorflow_io/image/python/ops/image_dataset_ops.py | tensorflow_io/image/python/ops/image_dataset_ops.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 | Python | |
b6545860fa2ea052b537630a4c6b6096851ef671 | Create 6.py | utsavnarayan/projecteuler | solutions/6.py | solutions/6.py | # The sum of the squares of the first ten natural numbers is,
# 12 + 22 + ... + 102 = 385
# The square of the sum of the first ten natural numbers is,
# (1 + 2 + ... + 10)2 = 552 = 3025
# Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.
def main():
... | mit | Python | |
1131b09b18039ffefcc48c682925e8945de027fd | Update cherry-pickup.py | kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015 | Python/cherry-pickup.py | Python/cherry-pickup.py | # Time: O(n^3)
# Space: O(n^2)
class Solution(object):
def cherryPickup(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
# dp holds the max # of cherries two k-length paths can pickup.
# The two k-length paths arrive at (i, k - i) and (j, k - j),
... | # Time: O(n^3)
# Space: O(n^2)
class Solution(object):
def cherryPickup(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
# dp holds the max # of cherries two k-length paths can pickup.
# The two k-length paths arrive at (i, k - i) and (j, k - j),
... | mit | Python |
81694a11b37634aed080e3579cc71551a6c15d36 | add new functions for generating angles | saimn/astropy,StuartLittlefair/astropy,pllim/astropy,StuartLittlefair/astropy,larrybradley/astropy,larrybradley/astropy,mhvk/astropy,saimn/astropy,pllim/astropy,lpsinger/astropy,pllim/astropy,astropy/astropy,pllim/astropy,saimn/astropy,saimn/astropy,astropy/astropy,StuartLittlefair/astropy,mhvk/astropy,pllim/astropy,mh... | astropy/coordinates/angle_generators.py | astropy/coordinates/angle_generators.py | # -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains functions for generating angles, either randomly or gridded
"""
# Third-party
import numpy as np
# Astropy
import astropy.units as u
from astropy.coordinates.representation import (
UnitSphericalRepre... | bsd-3-clause | Python | |
6ab51cebf44e51e5027ab09dfb5e960989c57760 | Add handy centos-ci python script | purpleidea/oh-my-vagrant,br0ziliy/oh-my-vagrant,br0ziliy/oh-my-vagrant,br0ziliy/oh-my-vagrant,purpleidea/oh-my-vagrant,purpleidea/oh-my-vagrant | extras/centos-ci.py | extras/centos-ci.py | #!/usr/bin/python
# modified from:
# https://github.com/kbsingh/centos-ci-scripts/blob/master/build_python_script.py
# usage: centos-ci.py giturl [branch [commands]]
import os
import sys
import json
import urllib
import subprocess
url_base = 'http://admin.ci.centos.org:8080'
apikey = open('duffy.key', 'r').read().st... | agpl-3.0 | Python | |
6913f90eb656763537e5e8a2047427e25f5c701c | Create tupsize.py | diamontip/pract,diamontip/pract | tupsize.py | tupsize.py | a= (1,2,3);
b= ([1,2,3];
a.__sizeof__() #outcome: 24
b.__sizeof__() #outcome: 32
| mit | Python | |
25c7b8d96b01b0371769ad50df62c48ec712bbb4 | Create unet_torch.py | AdityaSoni19031997/Machine-Learning,AdityaSoni19031997/Machine-Learning | __torch__/unet_torch.py | __torch__/unet_torch.py | # https://arxiv.org/abs/1505.04597
import torch
import torch.nn as nn
def double_conv(in_channels, out_channels):
return nn.Sequential(
nn.Conv2d(in_channels, out_channels, 3, padding=1),
nn.ReLU(inplace=True),
nn.Conv2d(out_channels, out_channels, 3, padding=1),
nn.ReLU(inplace=Tru... | mit | Python | |
58d88e98add31a449de1330fcf0907bbb3f9b11f | add test of ensemble integrate | adrn/StreamMorphology,adrn/StreamMorphology,adrn/StreamMorphology | streammorphology/extern/tests/test_fast_ensemble.py | streammorphology/extern/tests/test_fast_ensemble.py | # coding: utf-8
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os
import sys
import logging
# Third-party
import numpy as np
import gary.potential as gp
from gary.units import galactic
# Project
from ..fast_ensemble import ensemble_integrate
... | mit | Python | |
ada68604864c32ef6ffbd14015328c3619849ae5 | Add comparison xerawdp/pax script | XENON1T/pax,XENON1T/pax | examples/xerawdp_compare.py | examples/xerawdp_compare.py | from tables import openFile
import matplotlib.pyplot as plt
import numpy as np
# Open the file for reading
file_mongo = openFile("output_mongo.h5", mode = "r")
file_xed = openFile("output_xed.h5", mode = "r")
# Get the root group
results = []
skipped_none_in_xed = []
good = []
all = []
for event_xed in file_xed.ro... | bsd-3-clause | Python | |
8cd5ea62ad8ea25f08ca64c98faa366476d7b407 | Prepare v1.2.310.dev | tobinjt/Flexget,JorisDeRieck/Flexget,Flexget/Flexget,poulpito/Flexget,poulpito/Flexget,jacobmetrick/Flexget,crawln45/Flexget,tobinjt/Flexget,oxc/Flexget,ZefQ/Flexget,tsnoam/Flexget,xfouloux/Flexget,jawilson/Flexget,jawilson/Flexget,Danfocus/Flexget,Pretagonist/Flexget,qk4l/Flexget,JorisDeRieck/Flexget,Flexget/Flexget,t... | flexget/_version.py | flexget/_version.py | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | mit | Python |
ef0c15c73226dbc436c06f336dd0bd2d361b77a0 | Create __init__.py | siphio/resting-address | app/__init__.py | app/__init__.py | mit | Python | ||
0eba0470b1d1741b327a15ff0cf70e00ac3a7f8b | Create FindWordsDistanceinFile.py | jenniferwx/Programming_Practice,jenniferwx/Programming_Practice,jenniferwx/Programming_Practice | FindWordsDistanceinFile.py | FindWordsDistanceinFile.py | '''
CTCI Chapter18.5
Given any two words, find the shortest distance between them in the file
'''
import math
import sys
import re
def shortestDistance(str0,ch1,ch2):
DIST = sys.maxint
ch1pos = -1
ch2pos = -1
# convert to lower-case letter
str0 = re.sub(r'[^a-z]',' ',str0.lower())
ch1 = ch1.low... | bsd-3-clause | Python | |
253573fceec5e9c422924cde8923b0767138e04a | Create garageDoorStatus.py | elheffe80/RaspberryPi-Garage | garageDoorStatus.py | garageDoorStatus.py | #!/usr/bin/env python
import RPi.GPIO as GPIO
import time
channel = 24
def main():
GPIO.setmode(GPIO.BCM)
GPIO.setup(channel, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while GPIO.input(channel) == GPIO.LOW:
time.sleep(1)
#door is closed
GPIO.cleanup()
return 1
GPIO.cleanup()
return 0
if __name__=="__main__":
... | mit | Python | |
34b84f2f2cd7ac0748ad2222bcb0e5e0fe321d11 | change 'admin' url, to stay the same as generated by django 1.10 https://github.com/django/django/blob/1.10.1/django/conf/project_template/project_name/urls.py-tpl#L20 | webyneter/cookiecutter-django,Parbhat/cookiecutter-django-foundation,mistalaba/cookiecutter-django,ryankanno/cookiecutter-django,ryankanno/cookiecutter-django,asyncee/cookiecutter-django,asyncee/cookiecutter-django,thisjustin/cookiecutter-django,schacki/cookiecutter-django,aleprovencio/cookiecutter-django,trungdong/coo... | {{cookiecutter.project_slug}}/config/urls.py | {{cookiecutter.project_slug}}/config/urls.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
from django.views import defaults as default_views
urlpat... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
from django.views import defaults as default_views
urlpat... | bsd-3-clause | Python |
dadeb85fdbe6a4fed129cbeffbc305b36cef36c4 | Implement test for the cli | hackebrot/cookiedozer,hackebrot/cookiedozer | {{cookiecutter.repo_name}}/tests/test_cli.py | {{cookiecutter.repo_name}}/tests/test_cli.py | import pytest
from click.testing import CliRunner
from cli import main
@pytest.fixture
def runner():
return CliRunner()
@pytest.fixture(params=['fr', 'en', 'tlh'])
def lang(request):
return request.param
@pytest.fixture(params=['-l', '--language'])
def cli_param(request):
return request.param
@pyte... | mit | Python | |
05cd6cf9e29789276afdf3ec971c8a34b86143c0 | Add grab.tools.metric | kevinlondon/grab,raybuhr/grab,maurobaraldi/grab,pombredanne/grab-1,alihalabyah/grab,DDShadoww/grab,giserh/grab,subeax/grab,lorien/grab,alihalabyah/grab,SpaceAppsXploration/grab,SpaceAppsXploration/grab,istinspring/grab,lorien/grab,codevlabs/grab,shaunstanislaus/grab,shaunstanislaus/grab,giserh/grab,codevlabs/grab,huiyi... | grab/tools/metric.py | grab/tools/metric.py | # coding: utf-8
KB = 1024
MB = 1024 * KB
GB = MB * 1024
metric_labels = {
u'mb': MB,
u'мб': MB,
u'kb': KB,
u'кб': KB,
u'gb': GB,
u'гб': GB,
}
def parse_size(size):
size = size.lower().strip()
if size.isdigit():
return int(size)
else:
for anchor, mult in metric_la... | mit | Python | |
b963755a832afcc05549a378b0a0cd06a47db011 | add service_line | xbfool/hackerrank_xbfool | src/algorithms/arrays_and_sorting/service_line.py | src/algorithms/arrays_and_sorting/service_line.py | params = [(int)(x) for x in raw_input().split(' ')]
n = params[0]
t = params[1]
high_array = [(int)(x) for x in raw_input().split(' ')]
#test_case_array = []
for ii in range(t):
case = [(int)(x) for x in raw_input().split(' ')]
m = 10
i = case[0]
j = case[1]
for kk in range(i, j + 1):
m = min(high_array[kk], m)
... | mit | Python | |
6af695bdceaabdd4144def6a11f930e9d02a2d5c | Add a demo to showcase how to handle local commands with Assistant Library. | google/aiyprojects-raspbian,t1m0thyj/aiyprojects-raspbian,google/aiyprojects-raspbian,google/aiyprojects-raspbian,t1m0thyj/aiyprojects-raspbian,google/aiyprojects-raspbian,google/aiyprojects-raspbian | src/assistant_library_with_local_commands_demo.py | src/assistant_library_with_local_commands_demo.py | #!/usr/bin/env python3
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | apache-2.0 | Python | |
4a9f159d1c0a94f7dfa409da96b2454285a845fe | Create raw_http_request.py | ShySec/code | raw_http_request.py | raw_http_request.py | def get_request_data(url, data=None, headers={}, **kwargs):
import io
buffer = io.BytesIO()
buffer.sendall = buffer.write
targets = [httplib.HTTPConnection,httplib.HTTPSConnection]
old_connects = [target.connect for target in targets]
def fake_connect(self, buffer): self.sock = buffer
for target in targets: ta... | mit | Python | |
b9e79ee99dc98cb78ece29c1633dc1dbc5b9c6df | Add new package: bitlbee (#18735) | iulian787/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/bitlbee/package.py | var/spack/repos/builtin/packages/bitlbee/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 Bitlbee(AutotoolsPackage):
"""An IRC to other chat networks gateway."""
homepage = "h... | lgpl-2.1 | Python | |
36d153967b57805170f6caf0477e690fc3010936 | Add package for cctools (#4417) | matthiasdiener/spack,iulian787/spack,krafczyk/spack,skosukhin/spack,EmreAtes/spack,iulian787/spack,lgarren/spack,tmerrick1/spack,TheTimmy/spack,lgarren/spack,LLNL/spack,tmerrick1/spack,iulian787/spack,EmreAtes/spack,skosukhin/spack,matthiasdiener/spack,iulian787/spack,skosukhin/spack,LLNL/spack,skosukhin/spack,EmreAtes... | var/spack/repos/builtin/packages/cctools/package.py | var/spack/repos/builtin/packages/cctools/package.py | ##############################################################################
# Copyright (c) 2013-2016, 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 | |
e763eeacdde4bd63d5beb1fee0ca6eb8593a0884 | fix format in doxygen/package.py | iulian787/spack,tmerrick1/spack,LLNL/spack,EmreAtes/spack,matthiasdiener/spack,tmerrick1/spack,matthiasdiener/spack,skosukhin/spack,matthiasdiener/spack,matthiasdiener/spack,skosukhin/spack,krafczyk/spack,krafczyk/spack,iulian787/spack,TheTimmy/spack,lgarren/spack,lgarren/spack,EmreAtes/spack,mfherbst/spack,LLNL/spack,... | var/spack/repos/builtin/packages/doxygen/package.py | var/spack/repos/builtin/packages/doxygen/package.py | ##############################################################################
# Copyright (c) 2013-2016, 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... | ##############################################################################
# Copyright (c) 2013-2016, 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 |
3d282b9239991ae95e1eea5090ae956e2e76c5f1 | Add libmesh, needed for some FEM applications (#1846) | tmerrick1/spack,lgarren/spack,LLNL/spack,skosukhin/spack,matthiasdiener/spack,mfherbst/spack,krafczyk/spack,LLNL/spack,EmreAtes/spack,krafczyk/spack,TheTimmy/spack,tmerrick1/spack,LLNL/spack,TheTimmy/spack,mfherbst/spack,EmreAtes/spack,tmerrick1/spack,matthiasdiener/spack,iulian787/spack,lgarren/spack,iulian787/spack,s... | var/spack/repos/builtin/packages/libmesh/package.py | var/spack/repos/builtin/packages/libmesh/package.py | ##############################################################################
# Copyright (c) 2013-2016, 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 | |
a81d8aef2462bce852f52b551eb067659973978f | Add script for setting up rethinkdb | muzhack/muzhack,muzhack/musitechhub,muzhack/musitechhub,muzhack/musitechhub,muzhack/muzhack,muzhack/muzhack,muzhack/muzhack,muzhack/musitechhub | rethinkdb/setup-rethinkdb.py | rethinkdb/setup-rethinkdb.py | #!/usr/bin/env python
import rethinkdb as r
conn = r.connect()
r.db_create('muzhack').run(conn)
r.db('muzhack').table_create('users').run(conn)
r.db('muzhack').table_create('projects').run(conn)
| mit | Python | |
934959af19f882143a32c472e3072c6f8352d955 | Update tf2.py | paolodedios/tensorflow,petewarden/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,freedomtan/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,karllessard/tensorflow,aam-at/tensorflow,aam-at/tensorflow,davidzchen/tensorflow,freedomtan/tensorflow,sarvex/tensorflow,yongtang/tensorflow,sarvex/tensorflow,aam-at/ten... | tensorflow/python/tf2.py | tensorflow/python/tf2.py | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 | Python |
ab8415e783f772ffb3145349415ed11c98159a51 | test for sindy | Ohjeah/sparsereg | test/model/test_sindy.py | test/model/test_sindy.py | import numpy as np
import pytest
from sparsereg.model.sindy import *
@pytest.fixture
def data_linear():
x = 2 * np.linspace(1, 100, 100).reshape(-1, 1)
xdot = 2 * np.ones(100).reshape(-1, 1)
return x, xdot
def test_sindy_derivative(data_linear):
x, xdot = data_linear
s = SINDy(dt=1.0).fit(x)
... | mit | Python | |
ead4cd9aa0c8c371e1cdc53ef27d77c363cf9dcc | Create 03.py | ezralalonde/cloaked-octo-sansa | 03/qu/03.py | 03/qu/03.py | # Given the variable countries defined as:
# Name Capital Populations (millions)
countries = [['China','Beijing',1350],
['India','Delhi',1210],
['Romania','Bucharest',21],
['United States','Washington',307]]
# What multiple of Romania's population is the popul... | bsd-2-clause | Python | |
e21cf8d014a1c1271ff96251ee5895b17be532ba | Create hilightresponses.py | Vlek/plugins | hilightresponses.py | hilightresponses.py | import hexchat
__module_name__ = 'Hilight Responses'
__module_version__ = '0.0.1'
__module_description__ = 'Highlights messages after yours'
__module_author__ = 'Vlek'
_lastresponder = {}
def check_for_highlight(word, word_to_eol, userdata):
global _lastresponder
context = hexchat.get_context()
channelna... | mit | Python | |
2f29888853f32f66c1fe0c669420209d965b5387 | add conftest.py to tests | awbirdsall/popmodel | tests/conftest.py | tests/conftest.py | from __future__ import division
import pytest
import popmodel as pm
from pkg_resources import resource_filename
@pytest.fixture(scope='session')
def hpar():
hpath = resource_filename('popmodel', 'data/hitran_sample.par')
return pm.loadhitran.processhitran(hpath)
| mit | Python | |
8b3d319bd11d4fd10a472f30b3d72b5ae845e2fc | Exclude references back to a term using "this term" | willbarton/regulations-parser,grapesmoker/regulations-parser,adderall/regulations-parser | regparser/grammar/terms.py | regparser/grammar/terms.py | #vim: set encoding=utf-8
from pyparsing import (
LineStart, Literal, OneOrMore, Optional, Regex, SkipTo, srange, Suppress,
Word, ZeroOrMore, NotAny)
from regparser.grammar import atomic, unified
from regparser.grammar.utils import DocLiteral, keep_pos, Marker
smart_quotes = (
Suppress(DocLiteral(u'“', "l... | #vim: set encoding=utf-8
from pyparsing import (
LineStart, Literal, OneOrMore, Optional, Regex, SkipTo, srange, Suppress,
Word, ZeroOrMore)
from regparser.grammar import atomic, unified
from regparser.grammar.utils import DocLiteral, keep_pos, Marker
smart_quotes = (
Suppress(DocLiteral(u'“', "left-smar... | cc0-1.0 | Python |
36e81e41365784463833bdd8a0a9f6380021639e | add missing file in symm | sunqm/pyscf,gkc1000/pyscf,sunqm/pyscf,gkc1000/pyscf,gkc1000/pyscf,gkc1000/pyscf,sunqm/pyscf,sunqm/pyscf,gkc1000/pyscf | symm/addons.py | symm/addons.py | #
# Author: Qiming Sun <osirpt.sun@gmail.com>
#
import numpy
import pyscf.lib.logger
def label_orb_symm(mol, irrep_name, symm_orb, mo):
nmo = mo.shape[1]
s = mol.intor_symmetric('cint1e_ovlp_sph')
mo_s = numpy.dot(mo.T, s)
orbsym = [None] * nmo
for i,ir in enumerate(irrep_name):
moso = num... | apache-2.0 | Python | |
28a37f1ede5dcd0972b947bb94ec7d941f21092d | Create inital.py | gabru-md/faces | resources/_py_in/inital.py | resources/_py_in/inital.py | # PYTHON
# MANISH DEVGAN
# https://github.com/gabru-md
#BEGIN
# a very simple OpenCV program
import cv2
imagePath = "PATH TO THE IMAGE YOU WANT TO OPEN"
_im = cv2.imread(imagePath) # reading the image
# now to show the image
cv2.imshow("JUST TYPE IN WHATEVER YOU WANT TO NAME IT!", _im)
cv2.waitKey(0)
#END
| bsd-3-clause | Python | |
ce5c6c159f7c6690a8045a8525ba50767ea17b85 | Create upload_file_to_vm.py | borland667/pyvmomi-community-samples,stormbeard/pyvmomi-community-samples,jm66/pyvmomi-community-samples,wspi/pyvmomi-community-samples,pfitzer/pyvmomi-community-samples,sti-jans/pyvmomi-community-samples,hartsock/pyvmomi-community-samples,vmware/pyvmomi-community-samples,ddcrjlalumiere/pyvmomi-community-samples,przibo... | samples/upload_file_to_vm.py | samples/upload_file_to_vm.py | """
Written by Reubenur Rahman
Github: https://github.com/rreubenur/
This code is released under the terms of the Apache 2
http://www.apache.org/licenses/LICENSE-2.0.html
Example script to change the network of the Virtual Machine NIC
"""
from __future__ import with_statement
import atexit
import requests
from tools... | apache-2.0 | Python | |
83d510c2b703e61dc985a574c54c95126f23545b | fix users data migrations | rapidpro/ureport,Ilhasoft/ureport,Ilhasoft/ureport,xkmato/ureport,rapidpro/ureport,eHealthAfrica/ureport,rapidpro/ureport,rapidpro/ureport,Ilhasoft/ureport,auduaboki/ureport,Ilhasoft/ureport,auduaboki/ureport,auduaboki/ureport,xkmato/ureport,eHealthAfrica/ureport,eHealthAfrica/ureport,xkmato/ureport | ureport/polls/migrations/0018_auto_20150105_1622.py | ureport/polls/migrations/0018_auto_20150105_1622.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
def fix_users(apps, schema_editor):
User = apps.get_model("auth", "User")
# root2 should be a superuser
User.objects.filter(username="root2").u... | agpl-3.0 | Python | |
966603255bc10353345dc381b5ebab9fe9768a44 | add motorcontrolerboard test script | cowboyhackr/bleno,cowboyhackr/bleno,cowboyhackr/bleno | motorboardcontrollertest.py | motorboardcontrollertest.py | import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BOARD)
Motor1A = 16
Motor1B = 18
Motor2A = 13
Motor2B = 15
GPIO.setup(Motor1A,GPIO.OUT)
GPIO.setup(Motor1B,GPIO.OUT)
GPIO.setup(Motor2A,GPIO.OUT)
GPIO.setup(Motor2B,GPIO.OUT)
print "Turning forward"
GPIO.output(Motor1A,GPIO.HIGH)
GPIO.output(Motor1B,... | mit | Python | |
84953578536ae877c527c1e80b2fa64f1208264c | Add A&M transformer | texastribune/tx_salaries,texastribune/tx_salaries | tx_salaries/utils/transformers/texas_am_system.py | tx_salaries/utils/transformers/texas_am_system.py | from . import base
from . import mixins
from datetime import date
class TransformedRecord(mixins.GenericCompensationMixin,
mixins.GenericDepartmentMixin, mixins.GenericIdentifierMixin,
mixins.GenericJobTitleMixin, mixins.GenericPersonMixin,
mixi... | apache-2.0 | Python | |
e0a7f562b0149adab795907c303e64f2698d021b | Fix test | giumas/python-acoustics,felipeacsi/python-acoustics,antiface/python-acoustics,FRidh/python-acoustics,python-acoustics/python-acoustics | tests/test_aio.py | tests/test_aio.py | import os
import itertools
import pytest
import numpy as np
from .get_data_path import data_path
try:
import pandas
HAS_PANDAS = True
except ImportError:
HAS_PANDAS = False
details_type = ["det_global", "det_oct", "det_third"]
int_time = ["2000ms", "1000ms", "0500ms", "0250ms", "0063ms", "0010ms"]
delim... | import os
import itertools
import pytest
import numpy as np
from .get_data_path import data_path
try:
from acoustics.aio import read_csv_cirrus
HAS_PANDAS = True
except ImportError:
HAS_PANDAS = False
details_type = ["det_global", "det_oct", "det_third"]
int_time = ["2000ms", "1000ms", "0500ms", "0250ms... | bsd-3-clause | Python |
01bbbc1ee82b43505e65446e4657ca7790453fdf | Add unittests for *utility/corr_result_helper* | zsloan/genenetwork2,zsloan/genenetwork2,zsloan/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2,genenetwork/genenetwork2,pjotrp/genenetwork2,zsloan/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,pjotrp/genenetwork2,genenetwork/genenetwork2 | wqflask/tests/utility/test_corr_result_helpers.py | wqflask/tests/utility/test_corr_result_helpers.py | """ Test correlation helper methods """
import unittest
from utility.corr_result_helpers import normalize_values, common_keys, normalize_values_with_samples
class TestCorrelationHelpers(unittest.TestCase):
"""Test methods for normalising lists"""
def test_normalize_values(self):
"""Test that a list ... | agpl-3.0 | Python | |
0e4f154432a4403a93c138292c48c9306b505749 | Load every query from the file | Neki/searchengine | searchengine/parser/query.py | searchengine/parser/query.py | from enum import Enum
from searchengine.evaluation.evaluation import Request
class FieldType(Enum):
id = 1,
text = 2,
rest = 3,
author = 4
class InvalidRequest(Exception):
def __init__(self, pos, *args, **kwargs):
super()
self.pos = pos
def load_from_query_file(path):
"""
... | mit | Python | |
595b4adaecd4a4a2ff4f4ec050d05d9ba48b0721 | Add a test_runner to run all test without IDE. | GGOutfitters/conjure,vishnevskiy/conjure | test_runner.py | test_runner.py | import os.path
import sys
TEST_ROOT = os.path.dirname(__file__)
sys.path.insert(1, os.path.join(TEST_ROOT, "tests"))
import glob
import unittest
test_file_strings = glob.glob('tests/test_*.py')
module_strings = [str[len('tests/'):len(str) - len('.py')]
for str in test_file_strings]
suites = [unittes... | mit | Python | |
ecc76b66affed322bc1374cf5c8e7ef5cd60f8cd | Create FactorilaMemoization__call__.py | prashantas/MyDataScience | GeneralPython/FactorilaMemoization__call__.py | GeneralPython/FactorilaMemoization__call__.py | ## https://stackoverflow.com/questions/5824881/python-call-special-method-practical-example
class Factorial:
def __init__(self):
self.cache = {}
def __call__(self, n):
if n not in self.cache:
if n == 0:
self.cache[n] = 1
else:
self.cache[n]... | bsd-2-clause | Python | |
1cd130f5fd2dc8c0c0a27fbc9958583e2bba030e | Add set tests | nkantar/Parsenvy | tests/test_set.py | tests/test_set.py | import parsenvy
def test_set_several(monkeypatch):
"""'bar,baz,barf'"""
monkeypatch.setenv("foo", "bar,baz,barf")
assert parsenvy.set("foo") == {"bar", "baz", "barf"}
def test_set_one(monkeypatch):
"""'bar'"""
monkeypatch.setenv("foo", "bar")
assert parsenvy.set("foo") == {"bar"}
def tes... | bsd-3-clause | Python | |
201a38091c15a138ba59cf52936a7d222127bc91 | Create maxProfit.py | niravdsouza/LeetCode | maxProfit.py | maxProfit.py | """
Say you have an array for which the ith element is the price of a given stock on day i.
If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an algorithm to find the maximum profit.
Example 1:
Input: [7, 1, 5, 3, 6, 4]
Output: 5
max. difference = 6-... | mit | Python | |
91c7836d0425041831ffa9efb01a02b974dff6d7 | Test for cassandra-7875 | tjake/cassandra-dtest,pauloricardomg/cassandra-dtest,beobal/cassandra-dtest,stef1927/cassandra-dtest,riptano/cassandra-dtest,aweisberg/cassandra-dtest,blerer/cassandra-dtest,thobbs/cassandra-dtest,krummas/cassandra-dtest,bdeggleston/cassandra-dtest,riptano/cassandra-dtest,snazy/cassandra-dtest,mambocab/cassandra-dtest,... | prepared_statements_test.py | prepared_statements_test.py | from dtest import Tester, debug
from cassandra import InvalidRequest
KEYSPACE = "foo"
class TestPreparedStatements(Tester):
"""
Tests for pushed native protocol notification from Cassandra.
"""
def dropped_index_test(self):
"""
Prepared statements using dropped indexes should be hand... | apache-2.0 | Python | |
76cfdf2a94bd721d2f4837b41ccafc398bbc78b5 | Create week4.py | sgranitz/northwestern,sgranitz/nw,sgranitz/northwestern,sgranitz/nw | predict400/week4.py | predict400/week4.py | ## Week 4: Game Applications
# Battleship (http://www.datagenetics.com/blog/december32011/)
# probability of a perfect game. This would be sinking your
# opponent's ships without missing a single shot.
# Since there are 17 targets on the 100 spaces, the probability of this would be:
# 17/100 * 16/99 * 15/98 * ... * 1... | mit | Python | |
70c97094476c1c31db31ac2a076482fb68f17d23 | add a reddit votes dataset | benfred/implicit,benfred/implicit,benfred/implicit | implicit/datasets/reddit.py | implicit/datasets/reddit.py | import h5py
import time
import os
import logging
from scipy.sparse import coo_matrix, csr_matrix
import numpy as np
from implicit.datasets import _download
log = logging.getLogger("implicit")
URL = 'https://github.com/benfred/recommender_data/releases/download/v1.0/reddit.hdf5'
def get_reddit():
""" Returns ... | mit | Python | |
37c00e9d4af66ecb16c10ec05c5d9dd690efa530 | Add forgoten migratio | Semillas/semillas_platform,Semillas/semillas_backend,Semillas/semillas_backend,Semillas/semillas_backend,Semillas/semillas_backend,Semillas/semillas_platform,Semillas/semillas_platform,Semillas/semillas_platform | semillas_backend/users/migrations/0011_user_location_manually_set.py | semillas_backend/users/migrations/0011_user_location_manually_set.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-02-04 22:38
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0010_auto_20171011_2102'),
]
operations = [
migrations.AddField(
... | mit | Python | |
82b1731dedd0cefbe6650382ffc61b9f36ef3b22 | Create new package. (#5984) | LLNL/spack,LLNL/spack,iulian787/spack,matthiasdiener/spack,iulian787/spack,tmerrick1/spack,krafczyk/spack,tmerrick1/spack,matthiasdiener/spack,lgarren/spack,iulian787/spack,LLNL/spack,lgarren/spack,iulian787/spack,mfherbst/spack,LLNL/spack,skosukhin/spack,mfherbst/spack,lgarren/spack,lgarren/spack,matthiasdiener/spack,... | var/spack/repos/builtin/packages/r-agilp/package.py | var/spack/repos/builtin/packages/r-agilp/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 | |
7082b71a78876e0dc77d71634b9f7cebaea573b9 | add migration | liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4,liqd/adhocracy4 | adhocracy4/maps/migrations/0002_change_help_text.py | adhocracy4/maps/migrations/0002_change_help_text.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import adhocracy4.maps.fields
class Migration(migrations.Migration):
dependencies = [
('a4maps', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='area... | agpl-3.0 | Python | |
7b5028ad763cbfc82933f1e0d37ff3ea82ddb8b9 | Create lisas_workbook.py | costincaraivan/hackerrank,costincaraivan/hackerrank | algorithms/implementation/python3/lisas_workbook.py | algorithms/implementation/python3/lisas_workbook.py | chapters, problems_per_page = input().split(" ")
chapters, problems_per_page = int(chapters), int(problems_per_page)
problems_per_chapter = [ list(range(1, int(e) + 1)) for e in input().split() ]
pages = []
for index, problems in enumerate(problems_per_chapter):
pages.extend([problems[e: e + problems_per_page] fo... | mit | Python | |
153983a933cd708cffbfde84a69930b33f747ca1 | Add a manage.py command to add read flags up to the current pointer | zorojean/zulip,developerfm/zulip,ikasumiwt/zulip,yocome/zulip,codeKonami/zulip,ipernet/zulip,PaulPetring/zulip,brockwhittaker/zulip,christi3k/zulip,bastianh/zulip,johnny9/zulip,ufosky-server/zulip,vabs22/zulip,Drooids/zulip,stamhe/zulip,Juanvulcano/zulip,RobotCaleb/zulip,TigorC/zulip,joshisa/zulip,Frouk/zulip,peiwei/zu... | zephyr/management/commands/set_unread_to_pointer.py | zephyr/management/commands/set_unread_to_pointer.py | from optparse import make_option
import logging
from django.core.management.base import BaseCommand
from zephyr.lib.actions import do_deactivate, user_sessions
from zephyr.lib import utils
from zephyr.models import UserMessage, UserProfile
from django.db import transaction, models
class Command(BaseCommand):
he... | apache-2.0 | Python | |
8724e85ba9244e726da64641afc7ce6a43f8fdec | Make constraints iteratable | tengqm/senlin,Alzon/senlin,tengqm/senlin,openstack/senlin,tengqm/senlin-container,openstack/senlin,Alzon/senlin,stackforge/senlin,stackforge/senlin,tengqm/senlin-container,openstack/senlin | senlin/common/constraints.py | senlin/common/constraints.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 unde... | # 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 unde... | apache-2.0 | Python |
ff351f8e0f9ad24424772fb1bb5a4b234ed259f6 | Create download proccessof for OwnStorj | lakewik/storj-gui-client | UI/flask_ownstorj/ownstorj/models/download.py | UI/flask_ownstorj/ownstorj/models/download.py | from UI.utilities import account_manager
from UI.engine import StorjEngine
# Module for node details displaying for OwnStorj
storj_engine = StorjEngine() # init StorjEngine
class OwnStorjDownloadEngine:
def __init__(self):
self.node_details_content = None
def get_file_parametrs_from_public_downloa... | mit | Python | |
6fa1ca5004884596e630254b01dd42735777c485 | Test Case to check "swift object expiry" | vedujoshi/os_tempest,roopali8/tempest,Tesora/tesora-tempest,pandeyop/tempest,manasi24/tempest,Juraci/tempest,Tesora/tesora-tempest,jaspreetw/tempest,LIS/lis-tempest,BeenzSyed/tempest,pandeyop/tempest,NexusIS/tempest,CiscoSystems/tempest,danielmellado/tempest,cisco-openstack/tempest,yamt/tempest,FujitsuEnablingSoftwareT... | tempest/tests/object_storage/test_object_expiry.py | tempest/tests/object_storage/test_object_expiry.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack, LLC
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/... | apache-2.0 | Python | |
25c7731f2192e607e52e0a7e14bd0d07e2e77df1 | Add tests for Trainer.elapsed_time | wkentaro/chainer,okuta/chainer,niboshi/chainer,cupy/cupy,ktnyt/chainer,ktnyt/chainer,ysekky/chainer,chainer/chainer,jnishi/chainer,delta2323/chainer,kiyukuta/chainer,keisuke-umezawa/chainer,keisuke-umezawa/chainer,okuta/chainer,chainer/chainer,ktnyt/chainer,aonotas/chainer,hvy/chainer,chainer/chainer,chainer/chainer,cu... | tests/chainer_tests/training_tests/test_trainer.py | tests/chainer_tests/training_tests/test_trainer.py | import collections
import os
import tempfile
import time
import unittest
import mock
from chainer import serializers
from chainer import testing
from chainer import training
class TestTrainerElapsedTime(unittest.TestCase):
def setUp(self):
self.trainer = _get_mocked_trainer()
def test_elapsed_time... | mit | Python | |
ccfaeecfeb912eb7c3074babcd6c7510ac17ea5e | Add py-google-auth-httplib2 package (#12255) | iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack | var/spack/repos/tutorial/packages/py-google-auth-httplib2/package.py | var/spack/repos/tutorial/packages/py-google-auth-httplib2/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 PyGoogleAuthHttplib2(PythonPackage):
"""Google Authentication Library: httplib2 transport.... | lgpl-2.1 | Python | |
2bb4a53bd3aeb0a89f852d0efedbb26ff4eaf790 | Add MQTT Switch | persandstrom/home-assistant,PetePriority/home-assistant,justyns/home-assistant,nnic/home-assistant,DavidLP/home-assistant,mKeRix/home-assistant,molobrakos/home-assistant,tboyce1/home-assistant,shaftoe/home-assistant,deisi/home-assistant,leoc/home-assistant,instantchow/home-assistant,stefan-jonasson/home-assistant,srcLu... | homeassistant/components/switch/mqtt.py | homeassistant/components/switch/mqtt.py | # -*- coding: utf-8 -*-
"""
homeassistant.components.switch.mqtt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Allows to configure a MQTT switch.
In an ideal scenario, the MQTT device will have a state topic to publish state changes.
If these messages are published with RETAIN flag, the MQTT switch will receive
an instant s... | apache-2.0 | Python | |
02f7bd0cc6dea31113a7516a2b6adb03824a3d26 | Update BasicTemplateFrameworkAlgorithm.py | kaffeebrauer/Lean,QuantConnect/Lean,redmeros/Lean,AlexCatarino/Lean,AnshulYADAV007/Lean,kaffeebrauer/Lean,AnshulYADAV007/Lean,JKarathiya/Lean,Jay-Jay-D/LeanSTP,StefanoRaggi/Lean,AnshulYADAV007/Lean,jameschch/Lean,Jay-Jay-D/LeanSTP,Jay-Jay-D/LeanSTP,AlexCatarino/Lean,StefanoRaggi/Lean,JKarathiya/Lean,AlexCatarino/Lean,S... | Algorithm.Python/BasicTemplateFrameworkAlgorithm.py | Algorithm.Python/BasicTemplateFrameworkAlgorithm.py | # QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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 Lice... | # QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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 Lice... | apache-2.0 | Python |
60b206ab7d0efb278beb9162525a55e00165fc92 | add dummy migration for testing | masschallenge/django-accelerator,masschallenge/django-accelerator | accelerator/migrations/053_dummy-migration.py | accelerator/migrations/053_dummy-migration.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
(
'accelerator',
'0052_cleanup_twitter_urls'
),
]
operations = [
migrations.RunPython(
migr... | mit | Python | |
5a5baa7bcd2827114f93819d0ae70a8b9df45d97 | Add ctypes_generation extended structs _LSA_UNICODE_STRING.py | hakril/PythonForWindows | ctypes_generation/extended_structs/_LSA_UNICODE_STRING.py | ctypes_generation/extended_structs/_LSA_UNICODE_STRING.py | INITIAL_LSA_UNICODE_STRING = _LSA_UNICODE_STRING
class _LSA_UNICODE_STRING(INITIAL_LSA_UNICODE_STRING):
@property
def str(self):
"""The python string of the LSA_UNICODE_STRING object
:type: :class:`unicode`
"""
if not self.Length:
return ""
if getattr(self, ... | bsd-3-clause | Python | |
f1b2e4708c71fb7f574c746684fb94574ece3c53 | add test for sh | badi/pyshc | cmdhq/shell/sh_test.py | cmdhq/shell/sh_test.py | from sh import Sh, CalledProcessError
import unittest
class TestSh(unittest.TestCase):
def test_default(self):
"Default usage should work"
sh = Sh('ls')
out = sh()
self.assertIsInstance(out, str)
def test_error_raises(self):
"Error on subprocess should raise exception... | apache-2.0 | Python | |
49e7b51c28ede7b09313280e466324c8b00ffc48 | Add dryad harvester | mehanig/scrapi,erinspace/scrapi,felliott/scrapi,icereval/scrapi,CenterForOpenScience/scrapi,felliott/scrapi,fabianvf/scrapi,alexgarciac/scrapi,fabianvf/scrapi,CenterForOpenScience/scrapi,jeffreyliu3230/scrapi,mehanig/scrapi,ostwald/scrapi,erinspace/scrapi | scrapi/harvesters/dryad.py | scrapi/harvesters/dryad.py | '''
Harvester for the ASU Digital Repository for the SHARE project
Example API call: http://www.datadryad.org/oai/request?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals
from scrapi.base import OAIHarvester
class DryadHarvester(OAIHarvester):
short_name = 'dryad'
long_name... | apache-2.0 | Python | |
cc936ce9921f3c2bdbbd39ca8e0df47a6c0294ab | Update to v1.1.4 | jackzhao-mj/ok,jordonwii/ok,jackzhao-mj/ok,jordonwii/ok,jackzhao-mj/ok,jordonwii/ok,jackzhao-mj/ok,Cal-CS-61A-Staff/ok,Cal-CS-61A-Staff/ok,Cal-CS-61A-Staff/ok,Cal-CS-61A-Staff/ok,jordonwii/ok,Cal-CS-61A-Staff/ok | client/__init__.py | client/__init__.py | __version__ = 'v1.1.4'
| __version__ = 'v1.1.3'
| apache-2.0 | Python |
62e6a0288239125309d94dd305c6994452be2f2b | Create cred.py | jmarucha/minecraft-client | interface/cred.py | interface/cred.py | from hashlib import sha256
salt = "my_salt"
dict = {'username': sha256('password'+salt)
}
| mit | Python | |
fa470267fff5107e1c4e258e66c677291972c558 | Add a script for building the sbt images | wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api,wellcometrust/platform-api | scripts/build_sbt_image.py | scripts/build_sbt_image.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
Build a Docker image for one of our sbt applications.
Usage:
build_sbt_image.py --project=<PROJECT> [--version=<VERSION>] [--env=<BUILD_ENV>]
build_sbt_image.py -h | --help
Options:
-h --help Show this screen.
--project=<PROJECT> Name... | mit | Python | |
828521e71b2afd93f53b13222fbdfaf9e855d442 | Add scratch Reddit comment scraper | PsyBorgs/redditanalyser,PsyBorgs/redditanalyser | scripts/comment_scraper.py | scripts/comment_scraper.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import praw
# Connect to Reddit
# ----------------------------
user_agent = "Quick comment thread scraper by /u/mediaarts"
r = praw.Reddit(user_agent = user_agent)
# Get comment thread and populate dict
# ----------------------------
submission_id = "1p1j6c"
submissio... | mit | Python | |
5dbbcd78f4c0b0d4021d15ac0b9b391bcc427d91 | Add an alternative script to all admin boundaries in each admin level | opencorato/mapit,New-Bamboo/mapit,Code4SA/mapit,Sinar/mapit,chris48s/mapit,Sinar/mapit,opencorato/mapit,opencorato/mapit,New-Bamboo/mapit,chris48s/mapit,chris48s/mapit,Code4SA/mapit,Code4SA/mapit | bin/get-boundaries-by-admin-level.py | bin/get-boundaries-by-admin-level.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# This script fetches all administrative boundaries from OpenStreetMap
# (at any admin level) and writes them out as KML.
import xml.sax, urllib, os, re, errno, sys
from xml.sax.handler import ContentHandler
import urllib, urllib2
from boundaries import *
from generate_kml i... | agpl-3.0 | Python | |
34299b315cc02044050181ffe73b09042bb19a0a | Add default settings module for API | evewspace/eve-wspace,nyrocron/eve-wspace,Maarten28/eve-wspace,nyrocron/eve-wspace,Zumochi/eve-wspace,Maarten28/eve-wspace,Maarten28/eve-wspace,acdervis/eve-wspace,hybrid1969/eve-wspace,hybrid1969/eve-wspace,marbindrakon/eve-wspace,Unsettled/eve-wspace,mmalyska/eve-wspace,Maarten28/eve-wspace,marbindrakon/eve-wspace,gpa... | evewspace/API/default_settings.py | evewspace/API/default_settings.py | # Eve W-Space
# Copyright (C) 2013 Andrew Austin and other contributors
#
# 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 3 of the License, or
# (at your option... | apache-2.0 | Python | |
3c8329b07c0ea4e88e674ccd9b18a97e1dfcc7e0 | Add migration for ticket | masschallenge/django-accelerator,masschallenge/django-accelerator | accelerator/migrations/0099_update_program_model.py | accelerator/migrations/0099_update_program_model.py | # Generated by Django 2.2.28 on 2022-04-20 13:05
from django.db import (
migrations,
models,
)
class Migration(migrations.Migration):
dependencies = [
('accelerator', '0098_update_startup_update_20220408_0441'),
]
operations = [
migrations.AddField(
model_name='prog... | mit | Python | |
77b5b0aec7ee354731e4ce6255610f9321faba86 | Add basic settings for the demo | django-blog-zinnia/zinnia-wysiwyg-ckeditor | demo_zinnia_ckeditor/settings.py | demo_zinnia_ckeditor/settings.py | """Settings for the zinnia-ckeditor demo"""
import os
gettext = lambda s: s
DEBUG = True
TEMPLATE_DEBUG = DEBUG
DATABASES = {'default':
{'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(os.path.dirname(__file__), 'demo.db')}
}
TIME_ZONE = 'Europe/Paris'
STATIC_UR... | bsd-3-clause | Python | |
788fbaa4fc48482bdc9bc779b89ecdc2fdc03630 | add secret template | Visgean/commitstats,Visgean/commitstats,Visgean/commitstats | secrets_template.py | secrets_template.py |
username = 'visgean'
personal_token = ''
| mit | Python | |
b085c10cceb2dac396cb72fefe4cca353253a37f | Update unit test | AnyBlok/anyblok_furetui,AnyBlok/anyblok_furetui,AnyBlok/anyblok_furetui | anyblok_furetui/furetui/tests/test_view_crud_read.py | anyblok_furetui/furetui/tests/test_view_crud_read.py | # This file is a part of the AnyBlok / FuretUI project
#
# Copyright (C) 2017 Jean-Sebastien SUZANNE <jssuzanne@anybox.fr>
#
# 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/... | mpl-2.0 | Python | |
45920b994e3603dd7b771a55aa695418fba5f769 | split VCF per sample, template taken from bam files | thomasvangurp/epiGBS,thomasvangurp/epiGBS,thomasvangurp/epiGBS | jbrowse/split_vcf.py | jbrowse/split_vcf.py | import vcf
import argparse
import os
"""split watson and crick bam file into sample specific bam files"""
def parse_args():
"""Pass command line arguments"""
parser = argparse.ArgumentParser(description='use bwameth for mapping reads')
parser.add_argument('-i', '--input_dir', help='input directory')
... | mit | Python | |
ffbb2913db6a7f102c1d385f5600f99abde5bb35 | Create beta_permute_a_palindrome.py | Orange9000/Codewars,Orange9000/Codewars | Solutions/beta/beta_permute_a_palindrome.py | Solutions/beta/beta_permute_a_palindrome.py | permute_a_palindrome = lambda s: bool( len(list(filter(lambda x: x%2!=0, [s.count(char) for char in set(s)]))) < 2 )
| mit | Python | |
cb6588b700ba1f75d642620fc7204d95f8b147ac | Put genome example script | Omicia/omicia_api_examples,Omicia/omicia_api_examples,Omicia/omicia_api_examples | python/GenomeWorkflows/edit_genome.py | python/GenomeWorkflows/edit_genome.py | """Edit a genome
"""
import os
import requests
from requests.auth import HTTPBasicAuth
import sys
import json
import argparse
#Load environment variables for request authentication parameters
if "OMICIA_API_PASSWORD" not in os.environ:
sys.exit("OMICIA_API_PASSWORD environment variable missing")
if "OMICIA_API_L... | mit | Python | |
a1f5e6a7e949eb896568e03cded97b69682baec8 | Create __init__.py | sopython/kesh,sopython/kesh | kesh/api/__init__.py | kesh/api/__init__.py | # kesh.api is a package for accessing the data in the SO database.
| bsd-3-clause | Python | |
927a35ec0d40b3eec10335fe88c4fa70e63e1d0d | add missing init file | willprice/weboob,Konubinix/weboob,laurent-george/weboob,frankrousseau/weboob,sputnick-dev/weboob,willprice/weboob,sputnick-dev/weboob,frankrousseau/weboob,RouxRC/weboob,Konubinix/weboob,laurent-george/weboob,nojhan/weboob-devel,nojhan/weboob-devel,RouxRC/weboob,Konubinix/weboob,willprice/weboob,nojhan/weboob-devel,sput... | contrib/plugin.video.videoobmc/resources/__init__.py | contrib/plugin.video.videoobmc/resources/__init__.py | # Dummy file to make this directory a package.
| agpl-3.0 | Python | |
ce2d5953a636eb891db0471b2ae70462952f1e5a | Create new file | rubix1138/load-zipcodes | loadZips2.py | loadZips2.py | from uszipcode import ZipcodeSearchEngine
import psycopg2, pprint, sys
debug = True
zipSearch = ZipcodeSearchEngine()
zipNumber = 0
conString = "dbname=racelocator user=postgres"
con = psycopg2.connect(conString)
con.autocommit = True
sqlString = """INSERT INTO zipcode(city, density, houseofunits, landarea, latitude,... | mit | Python | |
1da94b80f0f5983f4d273d65acb8224161e6e98e | add missing migrations collective rejection | shirishgoyal/crowdsource-platform,crowdresearch/crowdsource-platform,shirishgoyal/crowdsource-platform,crowdresearch/daemo,crowdresearch/daemo,crowdresearch/crowdsource-platform,crowdresearch/daemo,crowdresearch/crowdsource-platform,crowdresearch/daemo,shirishgoyal/crowdsource-platform,shirishgoyal/crowdsource-platform... | crowdsourcing/migrations/0147_auto_20160919_1931.py | crowdsourcing/migrations/0147_auto_20160919_1931.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-09-19 19:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('crowdsourcing', '0146_auto_20160909_0327'),
]
operations = [
migrations.AlterF... | mit | Python | |
ca2d269ed2efa5abb70b349a1ef1a0e925718b76 | Add Qiskit Quantum NOT Gate Example Code (#3255) | TheAlgorithms/Python | quantum/not_gate.py | quantum/not_gate.py | #!/usr/bin/env python3
"""
Build a simple bare-minimum quantum circuit that starts with a single
qubit (by default, in state 0) and inverts it. Run the experiment 1000
times and print the total count of the states finally observed.
Qiskit Docs: https://qiskit.org/documentation/getting_started.html
"""
import qiskit ... | mit | Python | |
40aa069d5af2d76552c335d8a3cd79a47a6bb319 | Add HallEffect Sensor | EricssonResearch/calvin-base,EricssonResearch/calvin-base,EricssonResearch/calvin-base,EricssonResearch/calvin-base | calvin/actorstore/systemactors/sensor/HallEffect.py | calvin/actorstore/systemactors/sensor/HallEffect.py | # -*- coding: utf-8 -*-
# Copyright (c) 2017 Ericsson AB
#
# 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 | |
c6446313f4a06e372cbefa3279025b12400d506e | Create login.py | ckjbgames/textventure,ckjbgames/textventure | launcher/login.py | launcher/login.py | #!/usr/bin/env python
# login.py
| mit | Python | |
49046745e9000281c4cf225836ad988b04a59517 | Add migration to update Language extensions | DMOJ/site,DMOJ/site,DMOJ/site,DMOJ/site | judge/migrations/0112_language_extensions.py | judge/migrations/0112_language_extensions.py | from django.db import migrations
def update_language_extensions(apps, schema_editor):
Language = apps.get_model('judge', 'Language')
extension_mapping = {
'ADA': 'adb',
'AWK': 'awk',
'BASH': 'sh',
'BF': 'c',
'C': 'c',
'C11': 'c',
'CBL': 'cbl',
'... | agpl-3.0 | Python | |
3df9337bbf901e5f1bb72fd635532213ace7182f | Add lc0122_best_time_to_buy_and_sell_stock_ii.py | bowen0701/algorithms_data_structures | lc0122_best_time_to_buy_and_sell_stock_ii.py | lc0122_best_time_to_buy_and_sell_stock_ii.py | """Leetcode 122. Best Time to Buy and Sell Stock II
Easy
URL: https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/
Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profit.
You may complete as many transactions as you like
(i.... | bsd-2-clause | Python | |
16be8db3a34acde4a967f0192319fbbedee26b02 | Create find-smallest-letter-greater-than-target.py | 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,kamyu104/LeetCode | Python/find-smallest-letter-greater-than-target.py | Python/find-smallest-letter-greater-than-target.py | # Time: O(logn)
# Space: O(1)
class Solution(object):
def nextGreatestLetter(self, letters, target):
"""
:type letters: List[str]
:type target: str
:rtype: str
"""
i = bisect.bisect_right(letters, target)
return letters[0] if i == len(letters) else letters[i... | mit | Python | |
53469f148e90fea4206c047ede85a36eca0e346d | Solve 1008 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/uri/1008/1008.py | solutions/uri/1008/1008.py | a = int(input())
b = int(input())
c = float(input())
print("NUMBER = {}".format(a))
print("SALARY = U$ {:.2f}".format(c * b))
| mit | Python | |
ad08307a19fcdb3fda33f8ab444e6067e06265ce | Create quicksort.py | ueg1990/aids | aids/sorting_and_searching/quicksort.py | aids/sorting_and_searching/quicksort.py | '''
In this module, we implement quicksort
Time complexity (average case) : O(n * log n)
Time complexity (worse case) : O(n ^ 2)
'''
def quicksort(arr, left, right):
'''
Sort array using quicksort
'''
pass
def partition(arr, left, right):
pass
| mit | Python | |
5270e315104abc3815ed150a62711dd74a459fdd | add the 40th | cwenao/python_web_learn | base100/base100/base_40.py | base100/base100/base_40.py | #40 将一个数组逆序输出。
# 可以使用第一个与最后一个交换的方法
# 也可以用python语法 [::-1]
a = [1, 2, 3, 5, 6, 7, 8, 9, 0]
print(a[::-1]) | apache-2.0 | Python | |
9e8d3a261b2ed573f9b9ad884ca68a09f5e5352b | Create balanceamento_chaves.py | RodrigoRGRB/Estrutura-de-Dados | balanceamento_chaves.py | balanceamento_chaves.py | mit | Python | ||
d6e6c5caa26469b101333df5a901a94f3fe532f3 | Add tests for class based views | jashandeep-sohi/aiohttp,rutsky/aiohttp,decentfox/aiohttp,alex-eri/aiohttp-1,arthurdarcet/aiohttp,juliatem/aiohttp,esaezgil/aiohttp,pfreixes/aiohttp,mind1master/aiohttp,z2v/aiohttp,KeepSafe/aiohttp,mind1master/aiohttp,decentfox/aiohttp,mind1master/aiohttp,elastic-coders/aiohttp,rutsky/aiohttp,jettify/aiohttp,pfreixes/ai... | tests/test_classbasedview.py | tests/test_classbasedview.py | import asyncio
import pytest
from aiohttp import web
from aiohttp.web_urldispatcher import View
from unittest import mock
def test_ctor():
request = mock.Mock()
view = View(request)
assert view.request is request
@pytest.mark.run_loop
def test_render_ok():
resp = web.Response(text='OK')
class ... | apache-2.0 | Python | |
082bdc7c12074f7df3d0a308b00f0d512ae98a16 | Add the ability to create Tar files | bbockelm/glideinWMS,bbockelm/glideinWMS,bbockelm/glideinWMS,bbockelm/glideinWMS | lib/tarSupport.py | lib/tarSupport.py | import os
import sys
import tarfile
import cStringIO
class GlideinTar:
"""
potential exception needs to be caught by calling routine
"""
def __init__(self):
self.strings = {}
self.files = []
def add_file(self, filename, arc_dirname):
if os.path.exists(filename):
... | bsd-3-clause | Python | |
3355dedb2d3b8104866d57cce2f9ba7b1e873bf2 | build internal overviews for rasters | sgibbes/random-helpers | make_overviews.py | make_overviews.py | import os
import subprocess
def copydown(tileid, masked_loss_s3):
tiletocopy = '{0}{1}_loss_at_30tcd.tif'.format(masked_loss_s3, tileid)
cmd = ['aws', 's3', 'cp', tiletocopy, '.']
subprocess.check_call(cmd)
def buildoverviews(tile_path):
cmd = ['gdaladdo', tile_path, '2', '4', '8', ... | apache-2.0 | Python | |
1ffcb3ebb1fceccb671ef141bcc613a1b54bd08f | Create mediaInventroy.py | sysmadmin/python | mediaInventroy.py | mediaInventroy.py | # Retrieve Media inventory on localhost
import os
home = os.path.expanduser('~')
mediaLocations = [home + '/Movies', home + '/TV']
mediaListName = 'Media List.txt'
if not os.path.exists(os.path.join(home, mediaListName)):
open((os.path.join(home, mediaListName)), 'w')
else:
open((os.path.join(home, mediaList... | mit | Python | |
9d07f759f7d60c186ee341be3294c30c133ec886 | test sample for quick start | muslih/alfanous,muslih/alfanous,muslih/alfanous,muslih/alfanous,muslih/alfanous,muslih/alfanous,muslih/alfanous | src/alfanous-tests/sample.py | src/alfanous-tests/sample.py | # coding: utf-8
# import Output object
from alfanous.Outputs import Raw
# import default Paths
from alfanous.Data import Paths
# Initialize search engines
RAWoutput = Raw(
QSE_index = Paths.QSE_INDEX, # Quranic Main index path
TSE_index = Paths.TSE_INDEX, # Translations index ... | agpl-3.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.