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 |
|---|---|---|---|---|---|---|---|---|
c8c679221e0a36ac6074c0869bfc4b75d9745ae2 | Create a.py | y-sira/atcoder,y-sira/atcoder | abc066/a.py | abc066/a.py | a, b, c = map(int, input().split())
print(min(a + b, b + c, a + c))
| mit | Python | |
365152787cae36c12691e4da52a0575bd56d7d1b | Add tests for tril, triu and find | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | tests/cupyx_tests/scipy_tests/sparse_tests/test_extract.py | tests/cupyx_tests/scipy_tests/sparse_tests/test_extract.py | import unittest
import numpy
try:
import scipy.sparse
scipy_available = True
except ImportError:
scipy_available = False
import cupy
from cupy import testing
from cupyx.scipy import sparse
@testing.parameterize(*testing.product({
'shape': [(8, 3), (4, 4), (3, 8)],
'a_format': ['dense', 'csr', 'c... | mit | Python | |
a4d3056bbbe71d73d901c13927264157c9c51842 | Add lc004_median_of_two_sorted_arrays.py | bowen0701/algorithms_data_structures | lc004_median_of_two_sorted_arrays.py | lc004_median_of_two_sorted_arrays.py | """Leetcode 4. Median of Two Sorted Arrays
Hard
There are two sorted arrays nums1 and nums2 of size m and n respectively.
Find the median of the two sorted arrays.
The overall run time complexity should be O(log (m+n)).
You may assume nums1 and nums2 cannot be both empty.
Example 1:
nums1 = [1, 3]
nums2 = [2]
The ... | bsd-2-clause | Python | |
8a836213f7466de51c6d3d18d1a5ba74bb28de4a | Add hdf5-vol-async package. (#26874) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/hdf5-vol-async/package.py | var/spack/repos/builtin/packages/hdf5-vol-async/package.py | # Copyright 2013-2021 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 Hdf5VolAsync(CMakePackage):
"""This package enables asynchronous IO in HDF5."""
homep... | lgpl-2.1 | Python | |
034fe49d29f229e8fafc6b1034fc2685cd896eb2 | Create create-studio-item | Xi-Plus/Xiplus-Wikipedia-Bot,Xi-Plus/Xiplus-Wikipedia-Bot | my-ACG/create-studio-item/edit.py | my-ACG/create-studio-item/edit.py | # -*- coding: utf-8 -*-
import argparse
import csv
import os
import re
import urllib.parse
os.environ['PYWIKIBOT_DIR'] = os.path.dirname(os.path.realpath(__file__))
import pywikibot
site = pywikibot.Site()
site.login()
datasite = site.data_repository()
def main(studio):
data = {
'labels': {
... | mit | Python | |
9b572d4f53b23f3dc51dbfb98d46d0daa68d3569 | fix pep8 on core admin profile | YACOWS/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,opps/opps,opps/opps,YACOWS/opps,opps/opps,jeanmask/opps,YACOWS/opps,opps/opps,jeanmask/opps,jeanmask/opps,williamroot/opps,williamroot/opps,williamroot/opps | opps/core/admin/profile.py | opps/core/admin/profile.py | # -*- coding: utf-8 -*-
from django.contrib import admin
from opps.core.models import Profile
class ProfileAdmin(admin.ModelAdmin):
pass
admin.site.register(Profile, ProfileAdmin)
| # -*- coding: utf-8 -*-
from django.contrib import admin
from opps.core.models import Profile
class ProfileAdmin(admin.ModelAdmin):
pass
admin.site.register(Profile, ProfileAdmin)
| mit | Python |
419e001591566df909b03ffd0abff12171b62491 | Create binary_search_iter.py | lironhp/animated-octo-doodle | binary_search_iter.py | binary_search_iter.py | #GLOBALS
#=======
FIRST_IDX = 0
def chop(number, int_list):
list_size = length(int_list)
start_idx = FIRST_IDX
end_idx = list_size-1
current_idx = end_idx/2
itr_counter = list_size
while itr_counter>0:
current_value = int_list[current_idx]
if current_value == number:
return current_idx
else if curren... | mit | Python | |
6c4c26f5383740257b8bca56ce1ea9011053aff6 | add new package : keepalived (#14463) | LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack | var/spack/repos/builtin/packages/keepalived/package.py | var/spack/repos/builtin/packages/keepalived/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 Keepalived(AutotoolsPackage):
"""
Keepalived implements a set of checkers to dynamical... | lgpl-2.1 | Python | |
5ef097bc394ef5be9b723ca0732bb842ab82e9e1 | Include app.wsgi into repository as an example #8 | reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/ActiveDriverDB,reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/ActiveDriverDB,reimandlab/ActiveDriverDB,reimandlab/ActiveDriverDB,reimandlab/Visualistion-Framework-for-Genome-Mutations,reimandlab/Visualistion-Framework-for-Genome-Mutati... | website/app.wsgi | website/app.wsgi | import sys
from pathlib import Path
path = Path(__file__)
# when moving virual environment, update following line
venv_location = str(path.parents[2])
# in Python3 there is no builtin execfile shortcut - let's define one
def execfile(filename):
globals = dict( __file__ = filename)
exec(open(filename).read(),... | lgpl-2.1 | Python | |
fb0f5340d9dcd28725f43dc3b7f93def78bdab92 | Add serialization tests for TMRegion | rcrowder/nupic,lscheinkman/nupic,vitaly-krugl/nupic,rhyolight/nupic,rcrowder/nupic,rhyolight/nupic,vitaly-krugl/nupic,rcrowder/nupic,vitaly-krugl/nupic,alfonsokim/nupic,neuroidss/nupic,ywcui1990/nupic,alfonsokim/nupic,scottpurdy/nupic,neuroidss/nupic,neuroidss/nupic,alfonsokim/nupic,ywcui1990/nupic,scottpurdy/nupic,sub... | tests/unit/nupic/regions/tm_region_test.py | tests/unit/nupic/regions/tm_region_test.py | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2017, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | agpl-3.0 | Python | |
8d6676f2e19ab9df01c681b6590c6f4adb0f938c | add profile model | ben-cunningham/pybot,ben-cunningham/python-messenger-bot | fbmsgbot/models/profile.py | fbmsgbot/models/profile.py | class Profile():
def __init__(self, **kwargs):
self.first_name = kwargs['first_name']
self.last_name = kwargs['last_name']
self.profile_pic = kwargs['profile_pic']
self.locale = kwargs['locale']
self.timezone = kwargs['timezone']
self.gender = kwargs['gender']
| mit | Python | |
519b141349b4d39902416be560b989160d48b141 | add echo_delay to estimate the delay between two wav files | xiongyihui/tdoa,xiongyihui/tdoa | echo_delay.py | echo_delay.py |
import sys
import wave
import numpy as np
from gcc_phat import gcc_phat
if len(sys.argv) != 3:
print('Usage: {} near.wav far.wav'.format(sys.argv[0]))
sys.exit(1)
near = wave.open(sys.argv[1], 'rb')
far = wave.open(sys.argv[2], 'rb')
rate = near.getframerate()
N = rate
window = np.hanning(N)
while True:... | apache-2.0 | Python | |
c71924d4baea473a36f0c22f0878fea7a9ff2800 | Create constants.py | a2monkey/boatbot | a2/constants.py | a2/constants.py | import re
import time
#first link to view the cruise
base_link = 'https://www.princess.com/find/cruiseDetails.do?voyageCode=2801'
#element to find
button_element = 'md-hidden'
#gets the current time
time = time.strftime('%I:%M:%S')
forming = 'building request'
seperator = 'โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ... | mit | Python | |
3dcd012977d4dfea69ec4a51650ac9a4fd375842 | add missing migration file | pythonkr/pyconapac-2016,pythonkr/pyconapac-2016,pythonkr/pyconapac-2016 | registration/migrations/0007_auto_20160416_1217.py | registration/migrations/0007_auto_20160416_1217.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-04-16 03:17
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('registration', '0006_auto_20160416_1202'),
]
operations = [
migrations.Alter... | mit | Python | |
64d675304b2d66d89e55dcff167d1dd20e6b000c | add fragment molecule class for monte carlo simulation | KEHANG/AutoFragmentModeling | afm/molecule.py | afm/molecule.py |
class FragmentMolecule(object):
def __init__(self, composition):
self.composition = composition
def __str__(self):
"""
Return a string representation.
"""
return self.composition
| mit | Python | |
f3c2b9087a06b508a278cb8e6f79200caae1ac07 | Add a tool to encode udot instructions in asm code so we compile on any toolchain. | google/gemmlowp,google/gemmlowp,google/gemmlowp,google/gemmlowp | standalone/encode.py | standalone/encode.py | import sys
import re
def encode_udot_vector(line):
m = re.search(
r'\budot[ ]+v([0-9]+)[ ]*.[ ]*4s[ ]*,[ ]*v([0-9]+)[ ]*.[ ]*16b[ ]*,[ ]*v([0-9]+)[ ]*.[ ]*16b',
line)
if not m:
return 0, line
match = m.group(0)
accum = int(m.group(1))
lhs = int(m.group(2))
rhs = int(m.group(3))
assert a... | apache-2.0 | Python | |
74c23aff06485f323c45b24e7e3784dd3c72d576 | Create dokEchoServer.py | Dokument/BM_Echo | dokEchoServer.py | dokEchoServer.py | #!/usr/bin/env python2.7
# Created by Adam Melton (.dok) referenceing https://bitmessage.org/wiki/API_Reference for API documentation
# Distributed under the MIT/X11 software license. See the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# This is an example of an echo server for P... | mit | Python | |
fb8b1d7cb6e98e97fb383ca7457cb1cd237f8184 | Add usernamer.py | SeattleCentral/ITC110 | examples/username.py | examples/username.py | # Madenning Username Generator
# Returns first char of first name and first 7 chars of last name
def usernamer(first_name, last_name):
username = first_name[0] + last_name[:7]
return username.lower()
if __name__ == '__main__':
# Testing
assert usernamer("Joshua", "Wedekind") == "jwedekin"
firs... | mit | Python | |
1417d5345d68ef67ba6e832bbc45b8f0ddd911bc | Create testTemplate.py | lilsweetcaligula/Algorithms,lilsweetcaligula/Algorithms,lilsweetcaligula/Algorithms | data_structures/linked_list/utils/testTemplate.py | data_structures/linked_list/utils/testTemplate.py | # A test template for Python solutions.
import sys
def TestMain(sol, log=sys.stdout, doNotLogPassed=True) -> bool:
"""
@param sol: the function to be tested.
@param log: a stream or a file to log the tester output to.
@param doNotLogPassed: if True, all successful tests will n... | mit | Python | |
3ea318cf5c1b66106bf496d513efdd6e86d0f665 | add vowpal_wabbit requirement installation | braincorp/robustus,braincorp/robustus | robustus/detail/install_vowpal_wabbit.py | robustus/detail/install_vowpal_wabbit.py | # =============================================================================
# COPYRIGHT 2013 Brain Corporation.
# License under MIT license (see LICENSE file)
# =============================================================================
import logging
import os
from requirement import RequirementException
from u... | mit | Python | |
30567284410b9bb7154b8d39e5dfe7bc4bb1b269 | Add migration for on_delete SET_NULL | worthwhile/django-herald,jproffitt/django-herald,jproffitt/django-herald,worthwhile/django-herald | herald/migrations/0006_auto_20170825_1813.py | herald/migrations/0006_auto_20170825_1813.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.8 on 2017-08-25 23:13
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('herald', '0005_merge_201704... | mit | Python | |
05ecbd6ea7692ac85a96b35a39ca4609f0a88d86 | Create gapminder_data_analysis.py | duttashi/Data-Analysis-Visualization | gapminder_data_analysis.py | gapminder_data_analysis.py | # Importing the required libraries
# Note %matplotlib inline works only for ipython notebook. It will not work for PyCharm. It is used to show the plot distributions
%matplotlib inline
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(color_codes=True)
# Reading the d... | mit | Python | |
1999295556ba404c7542d2001d7fdca80de54b5f | update api | danielecook/Genomic-API-lambda,danielecook/Genomic-API-lambda,danielecook/Genomic-API-lambda,danielecook/Genomic-API-lambda | functions/bcftools/main.py | functions/bcftools/main.py | """
Lambda example with external dependency
"""
import logging
from subprocess import Popen, PIPE
import json
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def return_msg(out, err, status = 200):
return {
'statusCode': status,
'body': json.dumps({"out": out, "err": er... | mit | Python | |
f3c4bac262c6d09730b3f0c4a24639fde8b4d923 | Add wsgi compatible example gunicorn application | voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts | gunicorn-app.py | gunicorn-app.py | from __future__ import unicode_literals
import multiprocessing
import gunicorn.app.base
from gunicorn.six import iteritems
def number_of_workers():
return (multiprocessing.cpu_count() * 2) + 1
def handler_app(environ, start_response):
response_body = b'Works fine'
status = '200 OK'
response_head... | mit | Python | |
8d8522c95492f034db2a43e95a6c9cd3fb60c798 | Create glove2word2vec.py | manasRK/glove-gensim | glove2word2vec.py | glove2word2vec.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 Manas Ranjan Kar <manasrkar91@gmail.com>
# Licensed under the MIT License https://opensource.org/licenses/MIT
"""
CLI USAGE: python glove2word2vec.py <GloVe vector file> <Output model file>
Convert GloVe vectors into Gensim compatible format to inst... | mit | Python | |
c718cf1d483b2570b886269cf990458b195500b5 | Remove Access-Control-Allow-Origin after all | gratipay/gratipay.com,mccolgst/www.gittip.com,studio666/gratipay.com,studio666/gratipay.com,eXcomm/gratipay.com,eXcomm/gratipay.com,studio666/gratipay.com,gratipay/gratipay.com,gratipay/gratipay.com,mccolgst/www.gittip.com,studio666/gratipay.com,gratipay/gratipay.com,eXcomm/gratipay.com,eXcomm/gratipay.com,mccolgst/www... | gratipay/utils/cache_static.py | gratipay/utils/cache_static.py | """
Handles caching of static resources.
"""
from base64 import b64encode
from hashlib import md5
from aspen import Response
ETAGS = {}
def asset_etag(path):
if path.endswith('.spt'):
return ''
if path in ETAGS:
h = ETAGS[path]
else:
with open(path) as f:
h = ETAGS[p... | """
Handles caching of static resources.
"""
from base64 import b64encode
from hashlib import md5
from aspen import Response
ETAGS = {}
def asset_etag(path):
if path.endswith('.spt'):
return ''
if path in ETAGS:
h = ETAGS[path]
else:
with open(path) as f:
h = ETAGS[p... | mit | Python |
2f6bfddbff166115e59db7763a62258a06b4e789 | Apply orphaned migration | barberscore/barberscore-api,barberscore/barberscore-api,dbinetti/barberscore,barberscore/barberscore-api,dbinetti/barberscore,dbinetti/barberscore-django,dbinetti/barberscore-django,barberscore/barberscore-api | project/apps/api/migrations/0010_remove_chart_song.py | project/apps/api/migrations/0010_remove_chart_song.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0009_auto_20150722_1041'),
]
operations = [
migrations.RemoveField(
model_name='chart',
name=... | bsd-2-clause | Python | |
b3ab8fa855a08f0d63885b6df206715d1f36a817 | Add DNS-over-HTTPS example script | SpotlightKid/micropython-stm-lib | mrequests/examples/dns-over-https.py | mrequests/examples/dns-over-https.py | import mrequests
from urlencode import urlencode
DOH_IP = "1.1.1.1"
DOH_SERVER = b"cloudflare-dns.com"
DOH_PATH = "/dns-query"
def gethostbyname(name):
params = urlencode({
"name": name,
"type": "A"
})
headers = {
b"accept": b"application/dns-json",
b"user-agent": b"mreque... | mit | Python | |
4f765997c740f1f9b2dc985e7f3b0a467e8c311a | add code. | nag4/image_to_dir | image_to_yymmdd_dir_by_EXIF.py | image_to_yymmdd_dir_by_EXIF.py | # -*- coding: utf-8 -*-
from PIL import Image
import os
import shutil
user_name = os.getlogin()
# image/hoge.jpg, image/fuga.png, etc...
src_dir = "/Users/" + user_name + "/Desktop/image/"
# create dst_dir/yyyymmdd/
dst_dir = "/Users/" + user_name + "/Desktop/dst_dir/"
if os.path.exists(dst_dir) == False:
os.mk... | mit | Python | |
920dbe007501ea99b95c41f94fb8f4a48c40717a | Add SensorsCollector, which collects data from libsensors via PySensors | szibis/Diamond,anandbhoraskar/Diamond,datafiniti/Diamond,Nihn/Diamond-1,jriguera/Diamond,bmhatfield/Diamond,eMerzh/Diamond-1,gg7/diamond,Slach/Diamond,joel-airspring/Diamond,disqus/Diamond,signalfx/Diamond,TinLe/Diamond,sebbrandt87/Diamond,Ensighten/Diamond,rtoma/Diamond,mfriedenhagen/Diamond,disqus/Diamond,EzyInsights... | src/collectors/SensorsCollector/SensorsCollector.py | src/collectors/SensorsCollector/SensorsCollector.py | import diamond.collector
import sensors
class SensorsCollector(diamond.collector.Collector):
"""
This class collects data from libsensors. It should work against libsensors 2.x and 3.x, pending
support within the PySensors Ctypes binding: http://pypi.python.org/pypi/PySensors/
Requires: 'sensors' to ... | mit | Python | |
68e43eafc1bb8e060ee105bcc9e3c354486dfcd2 | add unit tests for dataset.py | DucAnhPhi/LinguisticAnalysis | dataset_tests.py | dataset_tests.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 28 16:18:02 2017
Unit tests for dataset.py
@author: duc
"""
import unittest
import dataset as ds
import numpy as np
from flesch_kincaid import get_flesch_grade_level as lvl
from nltk.corpus import cmudict
pronDict = cmudict.dict()
class Dataset... | mit | Python | |
66f32607d9d140be2a8e71270862074c53121a68 | Create dataUIwgt.py | satishgoda/learningqt,satishgoda/learningqt | pyside/pyside_basics/jamming/dataUIwgt.py | pyside/pyside_basics/jamming/dataUIwgt.py | from PySide import QtGui
class Data(object):
def __init__(self):
self.requiredNames = "A B C D E".split(' ')
self.availableActions = "Set Select Delete".split(' ')
def Set(self, name):
print "setting ", name
def Select(self, name):
print "selecting ", name
de... | mit | Python | |
ae948c95ea0087f33f13ef3463dc022eda0301a2 | Add a solution for the MadLibs lab | google/cssi-labs,google/cssi-labs | python/labs/make-a-short-story/mystory.py | python/labs/make-a-short-story/mystory.py | # Create a function for adjectives so I don't repeat myself in prompts.
def get_adjective():
return raw_input("Give me an adjective: ")
def get_noun():
return raw_input("Give me a noun: ")
def get_verb():
return raw_input("Give me a verb: ")
adjective1 = get_adjective()
noun1 = get_noun()
verb1 = get_ver... | apache-2.0 | Python | |
3cf1eb01540a126ef6a38219f89a41a0f05ad63f | Format fixing | Lowingbn/iccpy | constants.py | constants.py | UNITS = "SI"
UNIT_LENGTH = 1
UNIT_MASS = 1
UNIT_TIME = 1
DEFAULT_GRAVITATIONAL_CONSTANT = 6.673e-11 # m3 kg-1 s-2
DEFAULT_SPEED_OF_LIGHT = 299792458 # m s-1
DEFAULT_SOLAR_MASS = 1.98892e30 # kg
DEFAULT_PARSEC = 3.08568025e16 # m
DEFAULT_YEAR ... | mit | Python | |
476f2493576c55c0f412165e3c3ce8225599ba0a | Copy caller_checker.py | zstars/weblabdeusto,zstars/weblabdeusto,weblabdeusto/weblabdeusto,porduna/weblabdeusto,porduna/weblabdeusto,zstars/weblabdeusto,zstars/weblabdeusto,morelab/weblabdeusto,weblabdeusto/weblabdeusto,morelab/weblabdeusto,morelab/weblabdeusto,porduna/weblabdeusto,morelab/weblabdeusto,porduna/weblabdeusto,zstars/weblabdeusto,... | server/src/voodoo/gen2/caller_checker.py | server/src/voodoo/gen2/caller_checker.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# list... | bsd-2-clause | Python | |
77b34390345208a6e0bc5ad30cdce62e42ca0c56 | Add simple command to list speakers and tickets | CTPUG/wafer,CTPUG/wafer,CarlFK/wafer,CTPUG/wafer,CTPUG/wafer,CarlFK/wafer,CarlFK/wafer,CarlFK/wafer | wafer/management/commands/pycon_speaker_tickets.py | wafer/management/commands/pycon_speaker_tickets.py | import sys
import csv
from optparse import make_option
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
from wafer.talks.models import ACCEPTED
class Command(BaseCommand):
help = "List speakers and associated tickets."
option_list = BaseCommand.option_list + t... | isc | Python | |
c2e882855ea56c265ef46646ec5e20f78d0ad064 | add migrations for missing phaselogs after fixing bulk project status updates | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | bluebottle/projects/migrations/0028_auto_20170619_1555.py | bluebottle/projects/migrations/0028_auto_20170619_1555.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-06-19 13:55
from __future__ import unicode_literals
import datetime
from django.db import migrations
def fix_phaselog_for_incorrect_project_statuses(apps, schema_editor):
"""
#BB-9886 : Fix to add a new project phase status logs for projects whose st... | bsd-3-clause | Python | |
c628e5ed57effd4386c913b0cb47884e61c7db88 | Use camera height, and display disk | fhennecker/semiteleporter,fhennecker/semiteleporter,fhennecker/semiteleporter | research/triangulation_3/Triangulation.py | research/triangulation_3/Triangulation.py |
# coding: utf-8
# In[1]:
import numpy as np
import matplotlib.pyplot as plt
from math import sin, cos, tan, atan, pi
from pylab import imread
from mpl_toolkits.mplot3d import Axes3D
# In[2]:
image = imread("lines1.png")
plt.imshow(image)
plt.show()
#### Formules de position
# In[3]:
def position(laser, gamma,... | mit | Python | |
9cb5658c53a2202931e314ced3ee66714301a087 | Create _im_rot_manual_detect.py | gabru-md/faces | resources/_py_in/_im_rot_manual_detect.py | resources/_py_in/_im_rot_manual_detect.py | # PYTHON
# MANISH DEVGAN
# https://github.com/gabru-md
# Program helps in detecting faces which are
# tilted right or left! The detection is done by
# rotating the image and the trying to detect the
# potential faces in it!
#BEGIN
# importing
import cv2
import numpy as np
import os
import sys
# function to rot... | bsd-3-clause | Python | |
36ada2dc33ccb3cb1803f67a112e3559efd7e821 | Add file to initialize item endpoint - Add item_fields | Elbertbiggs360/buckelist-api | app/api/item.py | app/api/item.py | """ Routes for bucket_item Functionality"""
# from flask import g
# from flask import Blueprint, request, jsonify
from flask_restplus import fields
# from app.models.bucketlist import Bucketlist
# from app import api
item_fields = {
'id': fields.Integer,
'name': fields.String,
'date_created': fields.DateTi... | mit | Python | |
bf53f738bb5408622b08eedb9b0b0c6f80487a0c | Create 0603_verbs_vehicles.py | boisvert42/npr-puzzle-python | 2019/0603_verbs_vehicles.py | 2019/0603_verbs_vehicles.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
NPR 2019-06-02
https://www.npr.org/2019/06/02/728600551/sunday-puzzle-lets-go-toe-to-toe?utm_medium=RSS&utm_campaign=sundaypuzzle
Think of a verb in its present and past tense forms.
Drop the first letter of each word.
The result will name two vehicles. What are the... | cc0-1.0 | Python | |
60f54674cc7bb619d5275dbd49e346ecee276ff2 | fix reload module | nanqinlang-shadowsocksr/shadowsocksr-python,nanqinlang-shadowsocksr/shadowsocksr-python | importloader.py | importloader.py | ๏ปฟ#!/usr/bin/python
# -*- coding: UTF-8 -*-
def load(name):
try:
obj = __import__(name)
reload(obj)
return obj
except:
pass
try:
import importlib
obj = importlib.__import__(name)
importlib.reload(obj)
return obj
except:
pass
def loads(namelist):
for name in namelist:
obj = load(name)
if obj... | apache-2.0 | Python | |
152db7b696b949c67b5121d42fba28ec31eceb47 | Create everyeno_keys.py | vgan/everyeno | everyeno_keys.py | everyeno_keys.py | tumblr_consumer_key = ''
tumblr_consumer_secret = ''
tumblr_token_key = ''
tumblr_token_secret = ''
google_developerKey = ''
twitter_consumer_key = ''
twitter_consumer_secret = ''
twitter_token_key = ''
twitter_token_secret = ''
discogs_user_token = ''
| cc0-1.0 | Python | |
faff5fc7665abfcbcf5ab497ca533d7d3d4e53ac | Split property system into it's own file. | dednal/chromium.src,jaruba/chromium.src,jaruba/chromium.src,dushu1203/chromium.src,junmin-zhu/chromium-rivertrail,dushu1203/chromium.src,anirudhSK/chromium,ChromiumWebApps/chromium,hgl888/chromium-crosswalk,Fireblend/chromium-crosswalk,patrickm/chromium.src,chuan9/chromium-crosswalk,junmin-zhu/chromium-rivertrail,junmi... | ppapi/generators/idl_propertynode.py | ppapi/generators/idl_propertynode.py | #!/usr/bin/python
#
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Hierarchical property system for IDL AST """
import re
import sys
from idl_log import ErrOut, InfoOut, WarnOut
from idl_option i... | bsd-3-clause | Python | |
d86bdff73f2c90667c8cd07750cfc120ca8a5a7d | Add BERT example. | iree-org/iree-torch,iree-org/iree-torch | examples/bert.py | examples/bert.py | # Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 | Python | |
768b6fd5f4af994ca9af1470cfcc7fa7eb216a8f | Add a binding.gyp file. | karatheodory/ws,websockets/ws,guymguym/ws | binding.gyp | binding.gyp | {
'targets': [
{
'target_name': 'validation',
'cflags': [ '-O3' ],
'sources': [ 'src/validation.cc' ]
},
{
'target_name': 'bufferutil',
'cflags': [ '-O3' ],
'sources': [ 'src/bufferutil.cc' ]
}
]
}
| mit | Python | |
3bbf06964452683d986db401556183f575d15a55 | Add script for inserting project into DB | muzhack/muzhack,muzhack/muzhack,praneybehl/muzhack,muzhack/musitechhub,praneybehl/muzhack,praneybehl/muzhack,muzhack/musitechhub,praneybehl/muzhack,muzhack/muzhack,muzhack/muzhack,muzhack/musitechhub,muzhack/musitechhub | insert-project.py | insert-project.py | #!/usr/bin/env python3
import pymongo
import subprocess
import re
from datetime import datetime
import argparse
from json import load as load_json
import sys
def _info(msg):
sys.stdout.write(msg + '\n')
sys.stdout.flush()
cl_parser = argparse.ArgumentParser(description='Insert a project into Meteor\'s local... | mit | Python | |
28e483c32d3e946f0f9159fe7459531f284d50aa | Add shared counter support to cache. | MapofLife/MOL,MapofLife/MOL,MapofLife/MOL,MapofLife/MOL,MapofLife/MOL,MapofLife/MOL,MapofLife/MOL,MapofLife/MOL | app/molcounter.py | app/molcounter.py | from google.appengine.api import memcache
from google.appengine.ext import db
import random
import collections
import logging
class GeneralCounterShardConfig(db.Model):
"""Tracks the number of shards for each named counter."""
name = db.StringProperty(required=True)
num_shards = db.IntegerProperty(required=True... | bsd-3-clause | Python | |
2c6700d7a16ec7e76847f3664655aaf6c8f171eb | Create test_servo5v.py | somchaisomph/RPI.GPIO.TH | test/test_servo5v.py | test/test_servo5v.py | from gadgets.motors.servos import Servo5V
import time
import random
servo = Servo5V(pin_number=12,freq=100)
count = 0
while count < 185:
time.sleep(0.1)
servo.write(count)
count += 5
servo.cleanup()
| mit | Python | |
7c9c95795dbbc5f64b532720f5749b58361c222b | add collector for http://www.dshield.org/ | spantons/attacks-pages-collector | collectors/dshield.py | collectors/dshield.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import socket
import requests
import ipwhois
from pprint import pprint
def get_url(url):
try:
res = requests.get(url)
except requests.exceptions.ConnectionError:
raise requests.exceptions.ConnectionError("DNS lookup failures")
else:
if res... | mit | Python | |
8fe73523b7141f93d8523e56a7c6a5cc2ed82051 | Test case for ioddrivesnmp class | datafiniti/Diamond,stuartbfox/Diamond,joel-airspring/Diamond,disqus/Diamond,Netuitive/Diamond,metamx/Diamond,cannium/Diamond,hvnsweeting/Diamond,MichaelDoyle/Diamond,MediaMath/Diamond,Precis/Diamond,anandbhoraskar/Diamond,socialwareinc/Diamond,joel-airspring/Diamond,h00dy/Diamond,mfriedenhagen/Diamond,socialwareinc/Dia... | src/collectors/iodrivesnmp/test/testiodrivesnmp.py | src/collectors/iodrivesnmp/test/testiodrivesnmp.py | #!/usr/bin/python
# coding=utf-8
################################################################################
from test import CollectorTestCase
from test import get_collector_config
from iodrivesnmp import IODriveSNMPCollector
class TestIODriveSNMPCollector(CollectorTestCase):
def setUp(self, allowed_names... | mit | Python | |
2460bd91632da0e6b02e0faf379fe27b273575bc | Add rotate.py | bm5w/practice | rotate.py | rotate.py | """Funtion to rotate image 90 degress."""
def rotate(matrix):
pass | mit | Python | |
7a068872a071af2e60bf24ca7a00b3f1e999f139 | add request builder | nittyan/QiitaAPI | builders.py | builders.py | # -*- coding: utf-8 -*-
import json
class PostBuilder(object):
def __init__(self):
self.parameters = {
'title': '',
'body': '',
'coediting': False,
'gist': False,
'private': False,
'tags': [],
'tweet': False
}
... | mit | Python | |
857a5cb7effa03e9cd700fa69ae4d3b231212754 | Create business.py | getlucas/flaming-lucas,getlucas/flaming-lucas,getlucas/flaming-lucas,getlucas/flaming-lucas | business.py | business.py | # business logic here
# - account managing
# - create
# - edit
# - delete
# - payment data -> tokens
# - scripts running
# - statistics
| mit | Python | |
4a45256b614ebf8a8455562b63c1d50ec1521c71 | add a test class for auth.py | longaccess/bigstash-python,longaccess/bigstash-python | BigStash/t/test_auth.py | BigStash/t/test_auth.py | from mock import Mock
from testtools.matchers import Contains
from testtools import TestCase
class AuthTest(TestCase):
def setUp(self):
super(AuthTest, self).setUp()
def tearDown(self):
super(AuthTest, self).tearDown()
def _makeit(self, *args, **kwargs):
from BigStash.auth import... | apache-2.0 | Python | |
c212d1c25095f3b6e2f88cfccdc5c49280b22be0 | Add test for tilequeue changes related to #1387. | mapzen/vector-datasource,mapzen/vector-datasource,mapzen/vector-datasource | integration-test/1387-business-and-spur-routes.py | integration-test/1387-business-and-spur-routes.py | from . import FixtureTest
class BusinessAndSpurRoutes(FixtureTest):
def test_first_capitol_dr_i70_business(self):
self.load_fixtures([
'https://www.openstreetmap.org/relation/1933234',
])
# check that First Capitol Dr, part of the above relation, is given
# a network ... | mit | Python | |
672210c3af1a1b56a145b5265e5f316a1f6f36df | Add test folder | nitsas/py3utils | py3utils/test/__init__.py | py3utils/test/__init__.py | mit | Python | ||
7ec15caf8f2c9d0a21581261a356f6decc548061 | Add some basic UI tests | spacewiki/spacewiki,tdfischer/spacewiki,spacewiki/spacewiki,spacewiki/spacewiki,tdfischer/spacewiki,tdfischer/spacewiki,tdfischer/spacewiki,spacewiki/spacewiki | test/ui_test.py | test/ui_test.py | from app import app
import unittest
class UiTestCase(unittest.TestCase):
def setUp(self):
self.app = app.test_client()
def test_index(self):
self.assertEqual(self.app.get('/').status_code, 200)
def test_no_page(self):
self.assertEqual(self.app.get('/missing-page').status_code, 200... | agpl-3.0 | Python | |
59cc25693f2185ddfe36370d7f6641b2795d4798 | Test File Upload | boris-p/ladybug,boris-p/ladybug | ladybug/test.py | ladybug/test.py | import epw
from comfort.pmv import PMV
| agpl-3.0 | Python | |
d1b2d330d2a43814d89c7f17a347e425c434957d | Add Eoin's resampling function. | willu47/pyrate,UCL-ShippingGroup/pyrate,UCL-ShippingGroup/pyrate,willu47/pyrate | pyrate/tools/resampler.py | pyrate/tools/resampler.py | import pandas as pd
import numpy
# Does the resampling
# Called internally, one of the wrapper functions should be called if its needed
######################
def convert_messages_to_hourly_bins(df,period='H',fillnans=False,run_resample=True):
if df.empty:
return df
if run_resample:
... | mit | Python | |
3b064d6933ef7e910fab5634420358562866f1bc | Add test | JokerQyou/pitools | tests/test_camera.py | tests/test_camera.py | # coding: utf-8
from __future__ import unicode_literals
import unittest
import tempfile
import shutil
from flask import Flask
from pitools import camera
app = Flask(__name__)
app.register_blueprint(camera.blueprint)
class CameraTestCase(unittest.TestCase):
def setUp(self):
self.workspace = tempfile.mkd... | bsd-2-clause | Python | |
7ddfb39256229aa8c985ed8d70a29479187c76ad | Create script for beta invites | HelloLily/hellolily,HelloLily/hellolily,HelloLily/hellolily,HelloLily/hellolily | lily/management/commands/generate_beta_invites.py | lily/management/commands/generate_beta_invites.py | import csv
import gc
import logging
from datetime import date
from hashlib import sha256
from django.conf import settings
from django.core.files.storage import default_storage
from django.core.management import call_command
from django.core.management.base import BaseCommand
from django.core.urlresolvers import revers... | agpl-3.0 | Python | |
5bc089a98bf578fd0c56e3e50cf76888ee74aba2 | Add py solution for 537. Complex Number Multiplication | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | py/complex-number-multiplication.py | py/complex-number-multiplication.py | import re
class Solution(object):
def complexNumberMultiply(self, a, b):
"""
:type a: str
:type b: str
:rtype: str
"""
pat = re.compile(r'(-?\d+)\+(-?\d+)i')
mata = pat.match(a)
matb = pat.match(b)
a = int(mata.group(1)), int(mata.group(2))
... | apache-2.0 | Python | |
400ad736a271946569efa438e8fc9d00a7ce0075 | test for #22 | fopina/tgbotplug | tests/test_issues.py | tests/test_issues.py | from tgbot import plugintest
from tgbot.botapi import Update
from test_plugin import TestPlugin
class TestPluginTest(plugintest.PluginTestCase):
def setUp(self):
self.plugin = TestPlugin()
self.bot = self.fake_bot(
'',
plugins=[self.plugin],
)
self.received_... | mit | Python | |
06e82c471afa83bf0f08f0779b32dd8a09b8d1ba | Add py solution for 350. Intersection of Two Arrays II | ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode,ckclark/leetcode | py/intersection-of-two-arrays-ii.py | py/intersection-of-two-arrays-ii.py | from collections import Counter
class Solution(object):
def intersect(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: List[int]
"""
c1, c2 = Counter(nums1), Counter(nums2)
return list((c1 & c2).elements())
| apache-2.0 | Python | |
742e827178ee28663699acbb4a5f0ad5440649fc | add new keyboard_locks module | valdur55/py3status,ultrabug/py3status,guiniol/py3status,ultrabug/py3status,ultrabug/py3status,alexoneill/py3status,vvoland/py3status,valdur55/py3status,Andrwe/py3status,tobes/py3status,tobes/py3status,valdur55/py3status,docwalter/py3status,Andrwe/py3status,guiniol/py3status | py3status/modules/keyboard_locks.py | py3status/modules/keyboard_locks.py | # -*- coding: utf-8 -*-
"""
Monitor CapsLock, NumLock, and ScrLock keys
NumLock: Allows the user to type numbers by pressing the keys on the number pad,
rather than having them act as up, down, left, right, page up, end, and so forth.
CapsLock: When enabled, letters the user types will be in uppercase by default
rath... | bsd-3-clause | Python | |
3ff7c739cfc688c757396c465799ab42638c4a80 | Add toopher-pair utility | toopher/toopher-pam,toopher/toopher-pam,toopher/toopher-pam | toopher-pair.py | toopher-pair.py | import StringIO
import getpass
import argparse
import signal
import time
import os
import sys
from wsgiref import validate
import configobj
import toopher
import validate
from common import *
TIMEOUT_PAIRING = 30
DEFAULT_USER_CONFIG_FILE = StringIO.StringIO("""\
# This is a user-specific Toopher configuration file... | epl-1.0 | Python | |
9d7c348170fc0f9d339a2ef57a9e64b1ceaa7516 | Add demo MNH event scraper | andrewgleave/whim,andrewgleave/whim,andrewgleave/whim | web/whim/core/scrapers/mnh.py | web/whim/core/scrapers/mnh.py | from datetime import datetime, timezone, time
import requests
from bs4 import BeautifulSoup
from django.db import transaction
from .base import BaseScraper
from .exceptions import ScraperException
from whim.core.models import Event, Source, Category
from whim.core.utils import get_object_or_none
from whim.core.time... | mit | Python | |
632fea66f57f72d176fb8ad56f0cdaf5e4884110 | add test for multi-arch disasm | williballenthin/python-idb | tests/test_multiarch_disasm.py | tests/test_multiarch_disasm.py | import os.path
import idb
def test_armel_disasm():
cd = os.path.dirname(__file__)
idbpath = os.path.join(cd, 'data', 'armel', 'ls.idb')
with idb.from_file(idbpath) as db:
api = idb.IDAPython(db)
assert api.idc.GetDisasm(0x00002598) == 'push\t{r4, r5, r6, r7, r8, sb, sl, fp, lr}'
as... | apache-2.0 | Python | |
423554349177a5c8ed987f249b13fac9c8b8d79a | Add links to upgrade actions in the change log | ratoaq2/Flexget,crawln45/Flexget,patsissons/Flexget,camon/Flexget,qvazzler/Flexget,tobinjt/Flexget,tobinjt/Flexget,LynxyssCZ/Flexget,thalamus/Flexget,ZefQ/Flexget,jacobmetrick/Flexget,dsemi/Flexget,malkavi/Flexget,antivirtel/Flexget,ZefQ/Flexget,sean797/Flexget,JorisDeRieck/Flexget,tobinjt/Flexget,Flexget/Flexget,patsi... | gen-changelog.py | gen-changelog.py | # Writes a changelog in trac WikiFormatting based on a git log
from __future__ import unicode_literals, division, absolute_import
import codecs
from itertools import ifilter
import os
import re
import subprocess
import sys
import dateutil.parser
import requests
from flexget.utils.soup import get_soup
out_path = 'Ch... | # Writes a changelog in trac WikiFormatting based on a git log
from __future__ import unicode_literals, division, absolute_import
import codecs
from itertools import ifilter
import os
import re
import subprocess
import sys
import dateutil.parser
out_path = 'ChangeLog'
if len(sys.argv) > 1:
dir_name = os.path.dir... | mit | Python |
35b1fc5e43f553e95ad4c8a42c37ca66639d9120 | add test for core.py | econ-ark/HARK,econ-ark/HARK | HARK/tests/test_core.py | HARK/tests/test_core.py | """
This file implements unit tests for interpolation methods
"""
from HARK.core import HARKobject
import numpy as np
import unittest
class testHARKobject(unittest.TestCase):
def setUp(self):
self.obj_a = HARKobject()
self.obj_b = HARKobject()
def test_distance(self):
self.assertRaise... | apache-2.0 | Python | |
be17fa5026fd7cd64ccfc6e7241137a3f864725b | add google doc generator | gnawhleinad/pad,gnawhleinad/pad | generate_gpad.py | generate_gpad.py | import httplib2
import webbrowser
from apiclient.discovery import build
from oauth2client import client
flow = client.flow_from_clientsecrets(
'client_secret.json',
scope=['https://www.googleapis.com/auth/drive.file',
'https://www.googleapis.com/auth/urlshortener'],
redirec... | unlicense | Python | |
f9e6176bc43262882a0d50f4d850c04c3460b9d8 | Add SS :-) | m4rx9/rna-pdb-tools,m4rx9/rna-pdb-tools | rna_pdb_tools/SecondaryStructure.py | rna_pdb_tools/SecondaryStructure.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Seq and secondary structure prediction"""
import os
import tempfile
import shutil
VARNA_PATH = '/Users/magnus/skills/rnax/varna_tut/'
def draw_ss(title,seq, ss, img_out):
""""""
curr = os.getcwd()
os.chdir(VARNA_PATH)#VARNAv3-93-src')
print os.getcwd... | mit | Python | |
e5fed1895b69d824e3dc773dd6c6f88974e24f67 | discard module (#61452) | thaim/ansible,thaim/ansible | lib/ansible/modules/network/checkpoint/cp_mgmt_discard.py | lib/ansible/modules/network/checkpoint/cp_mgmt_discard.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage CheckPoint Firewall (c) 2019
#
# Ansible 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 op... | mit | Python | |
1bd0669e67fc082cbd496b3aa54c6a6f6a0d5fce | Add grab.util.log::print_dict method for fuzzy displaying of dict objects in console | subeax/grab,maurobaraldi/grab,liorvh/grab,alihalabyah/grab,maurobaraldi/grab,lorien/grab,giserh/grab,huiyi1990/grab,subeax/grab,istinspring/grab,istinspring/grab,SpaceAppsXploration/grab,pombredanne/grab-1,lorien/grab,kevinlondon/grab,raybuhr/grab,DDShadoww/grab,subeax/grab,DDShadoww/grab,huiyi1990/grab,raybuhr/grab,po... | grab/util/log.py | grab/util/log.py | def repr_value(val):
if isinstance(val, unicode):
return val.encode('utf-8')
elif isinstance(val, (list, tuple)):
return '[%s]' % ', '.join(repr_val(x) for x in val)
elif isinstance(val, dict):
return '{%s}' % ', '.join('%s: %s' % (repr_val(x), repr_val(y)) for x, y in val.items())
... | mit | Python | |
e5bd12b67f58c1a099c2bd2dd66b043b43969267 | Add a tool to publish packages in the repo to pub. Review URL: https://codereview.chromium.org//11415191 | dart-archive/dart-sdk,dartino/dart-sdk,dart-lang/sdk,dart-lang/sdk,dartino/dart-sdk,dart-lang/sdk,dart-lang/sdk,dartino/dart-sdk,dart-archive/dart-sdk,dartino/dart-sdk,dart-archive/dart-sdk,dart-lang/sdk,dartino/dart-sdk,dart-lang/sdk,dart-archive/dart-sdk,dart-lang/sdk,dartino/dart-sdk,dart-archive/dart-sdk,dart-archi... | tools/publish_pkg.py | tools/publish_pkg.py | #!/usr/bin/env python
#
# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
#
# Script to push a package to pub.
#
# Usage: publish_pkg.py pkg_dir
import os... | bsd-3-clause | Python | |
f734cbd91ff8997b9f2aac6bbec2238f8b5f7511 | Create __init__.py | ETCBC/laf-fabric | graf/__init__.py | graf/__init__.py | unlicense | Python | ||
a1c2423c349757f4725ef1250b9de084a469683c | Fix indentation | alfredodeza/ceph-doctor | ceph_medic/checks/cluster.py | ceph_medic/checks/cluster.py | from ceph_medic import metadata
#
# Error checks
#
def check_osds_exist():
code = 'ECLS1'
msg = 'There are no OSDs available'
osd_count = len(metadata['osds'].keys())
if not osd_count:
return code, msg
def check_nearfull():
"""
Checks if the osd capacity is at nearfull
"""
c... | from ceph_medic import metadata
#
# Error checks
#
def check_osds_exist():
code = 'ECLS1'
msg = 'There are no OSDs available'
osd_count = len(metadata['osds'].keys())
if not osd_count:
return code, msg
def check_nearfull():
"""
Checks if the osd capacity is at nearfull
... | mit | Python |
84990a4ef20c2e0f42133ed06ade5ce2d4e98ae3 | Save team member picture with extension. | cdriehuys/chmvh-website,cdriehuys/chmvh-website,cdriehuys/chmvh-website | chmvh_website/team/models.py | chmvh_website/team/models.py | import os
from django.db import models
def team_member_image_name(instance, filename):
_, ext = os.path.splitext(filename)
return 'team/{0}{1}'.format(instance.name, ext)
class TeamMember(models.Model):
bio = models.TextField(
verbose_name='biography')
name = models.CharField(
max_... | from django.db import models
def team_member_image_name(instance, filename):
return 'team/{0}'.format(instance.name)
class TeamMember(models.Model):
bio = models.TextField(
verbose_name='biography')
name = models.CharField(
max_length=50,
unique=True,
verbose_name='name')... | mit | Python |
bf993439a7c53bcffe099a61138cf8c17c39f943 | Add Partner label factory | masschallenge/django-accelerator,masschallenge/django-accelerator | accelerator/migrations/0066_partnerlabel.py | accelerator/migrations/0066_partnerlabel.py | # Generated by Django 2.2.10 on 2021-08-24 13:27
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accelerator', '0065_organization_note'),
]
operations = [
migrations.CreateModel(
name='Partne... | mit | Python | |
6f9dcee86d986f05e289b39f6b4700d5d302f551 | add tests for base models | clach04/json-rpc,lorehov/json-rpc | jsonrpc/tests/test_base.py | jsonrpc/tests/test_base.py | """ Test base JSON-RPC classes."""
import unittest
from ..base import JSONRPCBaseRequest, JSONRPCBaseResponse
class TestJSONRPCBaseRequest(unittest.TestCase):
""" Test JSONRPCBaseRequest functionality."""
def test_data(self):
request = JSONRPCBaseRequest()
self.assertEqual(request.data, {})... | mit | Python | |
216b96e7f36d8b72ccd3ddf6809f0cc5af14d15a | Add fat_ready.py | cataliniacob/misc,cataliniacob/misc | fat_ready.py | fat_ready.py | #!/usr/bin/env python3
'''Make all files in a directory suitable for copying to a FAT filesystem.
'''
from __future__ import print_function
import os
import os.path
import sys
from six import u
if __name__ == u('__main__'):
if len(sys.argv) != 2:
print(u('Usage: {} <directory to make FAT ready>').format... | mit | Python | |
40070b6bab49fa0bd46c1040d92bc476e557b19b | add algorithms.fractionation to assess gene loss, bites, etc. | sgordon007/jcvi_062915,tanghaibao/jcvi | algorithms/fractionation.py | algorithms/fractionation.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Catalog gene losses, and bites within genes.
"""
import sys
from optparse import OptionParser
from itertools import groupby
from jcvi.formats.blast import Blast
from jcvi.utils.range import range_minmax, range_overlap
from jcvi.utils.cbook import gene_name
from jcvi... | bsd-2-clause | Python | |
257134bdaea7c250d5956c4095adf0b917b65aa6 | Fix null case for event details | verycumbersome/the-blue-alliance,the-blue-alliance/the-blue-alliance,nwalters512/the-blue-alliance,nwalters512/the-blue-alliance,the-blue-alliance/the-blue-alliance,tsteward/the-blue-alliance,nwalters512/the-blue-alliance,phil-lopreiato/the-blue-alliance,nwalters512/the-blue-alliance,tsteward/the-blue-alliance,jaredhas... | database/dict_converters/event_details_converter.py | database/dict_converters/event_details_converter.py | from database.dict_converters.converter_base import ConverterBase
class EventDetailsConverter(ConverterBase):
SUBVERSIONS = { # Increment every time a change to the dict is made
3: 0,
}
@classmethod
def convert(cls, event_details, dict_version):
CONVERTERS = {
3: cls.even... | from database.dict_converters.converter_base import ConverterBase
class EventDetailsConverter(ConverterBase):
SUBVERSIONS = { # Increment every time a change to the dict is made
3: 0,
}
@classmethod
def convert(cls, event_details, dict_version):
CONVERTERS = {
3: cls.even... | mit | Python |
1a296a5203c422a7eecc0be71a91994798f01c10 | copy name->title for BehaviorAction and BehaviorSequences | izzyalonso/tndata_backend,izzyalonso/tndata_backend,tndatacommons/tndata_backend,tndatacommons/tndata_backend,izzyalonso/tndata_backend,izzyalonso/tndata_backend,tndatacommons/tndata_backend,tndatacommons/tndata_backend | tndata_backend/goals/migrations/0020_populate_basebehavior_title_slugs.py | tndata_backend/goals/migrations/0020_populate_basebehavior_title_slugs.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django.utils.text import slugify
def _copy_name_to_title(model, apps):
"""Copy the values from the Model's name -> title and name_slug -> title_slug."""
M = apps.get_model("goals", model)
for obj in M.ob... | mit | Python | |
94cfc0a7598dd8dcf455311f8bb41c2016c7c3a8 | Create solution.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | hackerrank/algorithms/warmup/easy/plus_minus/py/solution.py | hackerrank/algorithms/warmup/easy/plus_minus/py/solution.py | #include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int main(void)
{
int n;
scanf("%d",&n);
int arr[n];
for(int arr_i = 0; arr_i < n; arr_i++){
scanf("%d",&arr[arr_i]);
}
const double UNIT_RATIO ... | mit | Python | |
a27d30c4514cef93e054d5597829dc758b04c95e | add xycut in util | Transkribus/TranskribusDU,Transkribus/TranskribusDU,Transkribus/TranskribusDU | TranskribusDU/util/XYcut.py | TranskribusDU/util/XYcut.py | # -*- coding: utf-8 -*-
"""
XYcut.py
vertical/ horizontal cuts for page elements:
copyright Naver Labs Europe 2018
READ project
"""
def mergeSegments(lSegment, iMin):
"""Take as input a list of interval on some axis,
together with the object that contributed to this interval.
In... | bsd-3-clause | Python | |
e5e24ddccf5de2fba743a97c1790406259399d18 | Create one fixture for all tests | ujilia/python_training2,ujilia/python_training2,ujilia/python_training2 | conftest.py | conftest.py | import pytest
from fixture.application import Application
@pytest.fixture(scope = "session")
def app(request):
fixture = Application()
request.addfinalizer(fixture.destroy)
return fixture
| apache-2.0 | Python | |
74d274f02fa23f1a6799e9f96ccb1ef77162f1bc | Add new package: consul (#18044) | LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/consul/package.py | var/spack/repos/builtin/packages/consul/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 Consul(MakefilePackage):
"""Consul is a distributed, highly available,
and data cen... | lgpl-2.1 | Python | |
6427406fc627b467dd4851f32b6a15a74356ef2d | Create new package. (#6043) | LLNL/spack,EmreAtes/spack,EmreAtes/spack,skosukhin/spack,iulian787/spack,matthiasdiener/spack,LLNL/spack,lgarren/spack,lgarren/spack,matthiasdiener/spack,matthiasdiener/spack,mfherbst/spack,tmerrick1/spack,lgarren/spack,iulian787/spack,EmreAtes/spack,mfherbst/spack,mfherbst/spack,iulian787/spack,mfherbst/spack,tmerrick... | var/spack/repos/builtin/packages/r-gviz/package.py | var/spack/repos/builtin/packages/r-gviz/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 | |
3603669e0359f612b8e68a24b035849e9694aaaf | Add win_system state module | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/states/win_system.py | salt/states/win_system.py | # -*- coding: utf-8 -*-
'''
Management of Windows system information
========================================
This state is used to manage system information such as the computer name and
description.
.. code-block:: yaml
ERIK-WORKSTATION:
system:
- computer_name
This is Erik's computer, don't... | apache-2.0 | Python | |
0f68667e2ddfee6a370afe5c816a1358cfba799e | Correct GitHub URL. | openfisca/openfisca-matplotlib,openfisca/openfisca-qt,adrienpacifico/openfisca-matplotlib,openfisca/openfisca-matplotlib,openfisca/openfisca-qt | openfisca_qt/widgets/__init__.py | openfisca_qt/widgets/__init__.py | # -*- coding: utf-8 -*-
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca is free software; you can redistribute it and/or modify
# it ... | # -*- coding: utf-8 -*-
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014 OpenFisca Team
# https://github.com/openfisca/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca is free software; you can redistribute it and/or mo... | agpl-3.0 | Python |
b02b3e2e385bc04b2f1b1160371d55f8b6122006 | add migration file | nanchenchen/script-analysis,nanchenchen/script-analysis,nanchenchen/script-analysis,nanchenchen/script-analysis,nanchenchen/script-analysis | pyanalysis/apps/corpus/migrations/0001_initial.py | pyanalysis/apps/corpus/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Dataset',
fields=[
... | mit | Python | |
980594ab26887a4628620e9e0e00d89ddbdc4e49 | Create hackstring.py | gvaduha/homebrew,gvaduha/homebrew,gvaduha/homebrew,gvaduha/homebrew,gvaduha/homebrew,gvaduha/homebrew | hackstring.py | hackstring.py | #! /usr/bin/env python
import sys
print "".join(["%%%02x" % ord(x) for x in sys.argv[1]])
print "".join(["\\u%04x" % ord(x) for x in sys.argv[1]])
| mit | Python | |
739af3ccb50df93b108185ac1e7c0b47cd0bbf31 | Add happycopy2.py. | dw/scratch,dw/scratch,shekkbuilder/scratch,dw/scratch,shekkbuilder/scratch,shekkbuilder/scratch | happycopy2.py | happycopy2.py | #!/usr/bin/env python
#
# Like happycopy.py, but make efforts to fill the buffer when encountering many
# small files (e.g. OS X .sparsebundle)
#
# Picture the scene: converting a drive from HFS+ to NTFS so your TV can play
# movies from it directly.
#
# Problem: copying media files from partition at the end of the d... | mit | Python | |
084dd7fa3836f63d322a5bbf9e0289aa49488abb | Add fastagz field to data objects of process upload-fasta-nucl | genialis/resolwe-bio,genialis/resolwe-bio,genialis/resolwe-bio,genialis/resolwe-bio | resolwe_bio/migrations/0011_nucletide_seq.py | resolwe_bio/migrations/0011_nucletide_seq.py | import gzip
import os
import shutil
from django.conf import settings
from django.db import migrations
from resolwe.flow.migration_ops import DataDefaultOperation, ResolweProcessAddField, ResolweProcessRenameField
from resolwe.flow.utils import iterate_fields
FASTA_SCHEMA = {
'name': 'fasta',
'label': 'FASTA ... | apache-2.0 | Python | |
2df34105a58a05fd1f50f88bc967360b4bd9afc8 | Create LongestIncreasingSubseq_001.py | Chasego/codirit,cc13ny/algo,cc13ny/algo,Chasego/codi,Chasego/codi,Chasego/codirit,Chasego/cod,cc13ny/Allin,Chasego/codi,Chasego/codirit,Chasego/cod,cc13ny/algo,cc13ny/Allin,Chasego/codi,Chasego/codirit,cc13ny/algo,Chasego/cod,Chasego/codi,Chasego/cod,cc13ny/Allin,cc13ny/Allin,cc13ny/Allin,Chasego/codirit,Chasego/cod,cc... | leetcode/300-Longest-Increasing-Subsequence/LongestIncreasingSubseq_001.py | leetcode/300-Longest-Increasing-Subsequence/LongestIncreasingSubseq_001.py | class Solution(object):
def lengthOfLIS(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
n = len(nums)
if n == 0:
return 0
maxlen = [1 for i in range(n)]
for i in range(1, n):
for j in range(i):
... | mit | Python | |
d37f57bc2b6816759a6e7108cef4a03322a622ce | Create generator.py | imreeciowy/wfrp-gen | generator.py | generator.py | #!/usr/bin/python3
import random
import time
import sys
import Being
# print python version- dev purposes
print(sys.version)
# generic dice
def x_dices_n(x,n):
result = 0
for i in range(0, x):
roll_dice_n = random.randint(1,n)
result = roll_dice_n + result
return result
# crude race sele... | mit | Python | |
c2d26a5942cb22f4510abd6d5ff8c83d6a386810 | make migrations and model updates | linea-it/masterlist,linea-it/masterlist,linea-it/masterlist | masterlist/candidates/migrations/0005_auto_20160725_1759.py | masterlist/candidates/migrations/0005_auto_20160725_1759.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('candidates', '0004_auto_20160708_1422'),
]
operations = [
migrations.RemoveField(
model_name='candidate',
... | mit | Python | |
94e4d30dbdbcf9765bf731b1bd792d0fcf3f9d4a | Add prettification middleware | fmorgner/django-maccman,fmorgner/django-maccman | maccman/middleware/prettify.py | maccman/middleware/prettify.py | from bs4 import BeautifulSoup
class PrettifyMiddleware(object):
def process_response(self, request, response):
if response.status_code == 200:
if response["content-type"].startswith("text/html"):
beauty = BeautifulSoup(response.content)
response.content = beauty.... | bsd-3-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.