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 |
|---|---|---|---|---|---|---|---|---|
b3ef51e93b090451718ed4c1240b63b8e99cd085 | rename example | scottprahl/miepython | miepython/02_glass.py | miepython/02_glass.py | #!/usr/bin/env python3
"""
Plot the scattering efficiency as a function of wavelength for 4micron glass spheres
"""
import numpy as np
import matplotlib.pyplot as plt
import miepython
num = 100
radius = 2 # in microns
lam = np.linspace(0.2,1.2,num) # also in microns
x = 2*np.pi*radius/lam
# fr... | mit | Python | |
d1fe5a06f5e082fd8196f510e2eba7daa3468ef8 | Add duplicate_nodes.py file | wjkoh/cs262a,wjkoh/cs262a,wjkoh/cs262a | duplicate_nodes.py | duplicate_nodes.py | from shutil import copytree, ignore_patterns
import glob
import os
import sys
if __name__ == '__main__':
data_dir = './parsedData/'
use_symlink = True
orig_nodes = os.listdir(data_dir)
orig_nodes = [os.path.basename(i) for i in glob.glob(os.path.join(data_dir, '1*'))]
for dup_cnt in range(100):
... | bsd-3-clause | Python | |
77f812f76966b90c27131fd65968f548afcdcace | Add loader for basic csv layers without geoms | gem/oq-svir-qgis,gem/oq-svir-qgis,gem/oq-svir-qgis,gem/oq-svir-qgis | svir/dialogs/load_basic_csv_as_layer_dialog.py | svir/dialogs/load_basic_csv_as_layer_dialog.py | # -*- coding: utf-8 -*-
# /***************************************************************************
# Irmt
# A QGIS plugin
# OpenQuake Integrated Risk Modelling Toolkit
# -------------------
# begin : 2013-10-24
# copyright ... | agpl-3.0 | Python | |
f2a359664bf69a6c8e883d460a49c986b511b80e | add file | EuroPython/ep-tools,PythonSanSebastian/ep-tools,PythonSanSebastian/ep-tools,PythonSanSebastian/ep-tools,EuroPython/ep-tools,EuroPython/ep-tools,EuroPython/ep-tools,PythonSanSebastian/ep-tools | eptools/gspread.py | eptools/gspread.py | """
Functions to access the data in google drive spreadsheets
"""
import pandas as pd
from docstamp.gdrive import (get_spreadsheet,
worksheet_to_dict)
def get_ws_data(api_key_file, doc_key, ws_tab_idx, header=None, start_row=1):
""" Return the content of the spreadsheet in the w... | mit | Python | |
e8d05226f2a8cabf0f38bae6c2e218bd81efa6a1 | Add a utility script for encoding packet traces | haowu4682/gem5,LingxiaoJIA/gem5,LingxiaoJIA/gem5,haowu4682/gem5,haowu4682/gem5,haowu4682/gem5,haowu4682/gem5,LingxiaoJIA/gem5,LingxiaoJIA/gem5,haowu4682/gem5,LingxiaoJIA/gem5,haowu4682/gem5,haowu4682/gem5,haowu4682/gem5,LingxiaoJIA/gem5,LingxiaoJIA/gem5 | util/encode_packet_trace.py | util/encode_packet_trace.py | #!/usr/bin/env python
# Copyright (c) 2013 ARM Limited
# All rights reserved
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implementation... | bsd-3-clause | Python | |
04876b4bea96f983c722cb9bf7845c7cc3b0ecef | add oauth2 example | ikvk/imap_tools | examples/oauth2.py | examples/oauth2.py | from imap_tools import MailBox
# Authenticate to account using OAuth 2.0 mechanism
with MailBox('imap.my.ru').xoauth2('user', 'token123', 'INBOX') as mailbox:
for msg in mailbox.fetch():
print(msg.date_str, msg.subject)
| apache-2.0 | Python | |
c9a0fb540a9ee8005c1ee2d70613c39455891bee | Add analyze_bound_horizontal tests module | danforthcenter/plantcv,danforthcenter/plantcv,danforthcenter/plantcv | tests/plantcv/test_analyze_bound_horizontal.py | tests/plantcv/test_analyze_bound_horizontal.py | import pytest
import cv2
from plantcv.plantcv import analyze_bound_horizontal, outputs
@pytest.mark.parametrize('pos,exp', [[200, 58], [-1, 0], [100, 0], [150, 11]])
def test_analyze_bound_horizontal(pos, exp, test_data):
# Clear previous outputs
outputs.clear()
# Read in test data
img = cv2.imread(te... | mit | Python | |
198cf78895db88a8986926038e817ebb2bf75eb2 | add migration for notification tables | uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal | portal/migrations/versions/458dd2fc1172_.py | portal/migrations/versions/458dd2fc1172_.py | from alembic import op
import sqlalchemy as sa
"""empty message
Revision ID: 458dd2fc1172
Revises: 8ecdd6381235
Create Date: 2017-12-21 16:38:49.659073
"""
# revision identifiers, used by Alembic.
revision = '458dd2fc1172'
down_revision = '8ecdd6381235'
def upgrade():
# ### commands auto generated by Alembic... | bsd-3-clause | Python | |
8c7fa4e16805dc9e8adbd5615c610be8ba92c444 | Add argparse tests for gatherkeys | SUSE/ceph-deploy,zhouyuan/ceph-deploy,shenhequnying/ceph-deploy,ghxandsky/ceph-deploy,zhouyuan/ceph-deploy,ceph/ceph-deploy,SUSE/ceph-deploy,branto1/ceph-deploy,isyippee/ceph-deploy,osynge/ceph-deploy,Vicente-Cheng/ceph-deploy,isyippee/ceph-deploy,ceph/ceph-deploy,trhoden/ceph-deploy,SUSE/ceph-deploy-to-be-deleted,SUSE... | ceph_deploy/tests/parser/test_gatherkeys.py | ceph_deploy/tests/parser/test_gatherkeys.py | import pytest
from ceph_deploy.cli import get_parser
class TestParserGatherKeys(object):
def setup(self):
self.parser = get_parser()
def test_gather_help(self, capsys):
with pytest.raises(SystemExit):
self.parser.parse_args('gatherkeys --help'.split())
out, err = capsys.... | mit | Python | |
2803b237af18c6d5cd0613eaf4eccf2b61e65100 | Create afImgPanel.py | aaronfang/personal_scripts | scripts/afImgPanel.py | scripts/afImgPanel.py | import pymel.core as pm
import pymel.all as pa
imgOp = 0.3
imgDep = 10
#get current camera
curCam = pm.modelPanel(pm.getPanel(wf=True),q=True,cam=True)
#select image and creat imagePlane and setup
fileNm = pm.fileDialog2(ds=0,fm=1,cap='open',okc='Select Image')
ImgPln = pm.imagePlane(fn=fileNm[0],lookThrough=curCam,m... | mit | Python | |
f24fe32329625ec037a9afc8d3bdeed5f41e69a0 | Add a script for easy diffing of two Incars. | gpetretto/pymatgen,aykol/pymatgen,Bismarrck/pymatgen,czhengsci/pymatgen,johnson1228/pymatgen,Bismarrck/pymatgen,gVallverdu/pymatgen,richardtran415/pymatgen,blondegeek/pymatgen,czhengsci/pymatgen,dongsenfo/pymatgen,montoyjh/pymatgen,czhengsci/pymatgen,fraricci/pymatgen,nisse3000/pymatgen,nisse3000/pymatgen,blondegeek/py... | scripts/diff_incar.py | scripts/diff_incar.py | #!/usr/bin/env python
'''
Created on Nov 12, 2011
'''
__author__="Shyue Ping Ong"
__copyright__ = "Copyright 2011, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyue@mit.edu"
__date__ = "Nov 12, 2011"
import sys
import itertools
from pymatgen.io.vaspio import Incar
from p... | mit | Python | |
7e2170feef60866b8938595f674ae4dd70c5cc46 | Add benchmark for F.transpose() | sony/nnabla,sony/nnabla,sony/nnabla | python/benchmark/function/test_transpose.py | python/benchmark/function/test_transpose.py | # Copyright 2022 Sony Group 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 License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | apache-2.0 | Python | |
c36ae47bee44ff8aa8eaf17f8ded88192d7a6573 | implement query term search | anfego/search_IR | queryAnswer.py | queryAnswer.py | import pickle
# Loads the posting Index
index = open("posIndex.dat", "rb");
posIndex = pickle.load(index);
print posIndex['made'];
query = "Juan made of youtube"
# query = raw_input('Please enter your query: ');
queryTerms = ' '.join(query.split());
queryTerms = queryTerms.split(' ');
k = len(queryTerms);
print (que... | mit | Python | |
625d250c7eabcf48292590a6b0ca57f1b3cc7c49 | Add meshprocessing scratch | unidesigner/unidesign | scratch/meshprocessing.py | scratch/meshprocessing.py | import networkx as nx
from time import time
import numpy as np
def mesh2graph(faces):
""" Converts a triangular mesh to a graph only taking
the connectivity into account """
g = nx.Graph()
for i in range(len(faces)):
g.add_edge(faces[i,0], faces[i,1])
g.add_edge(faces[i,1], faces[i,2])
... | bsd-3-clause | Python | |
6a13511db8401a17a5c6feb7071af821211c2836 | Create sitemap urls | opps/opps,williamroot/opps,opps/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,jeanmask/opps,williamroot/opps,williamroot/opps,opps/opps,opps/opps,YACOWS/opps,jeanmask/opps,YACOWS/opps,YACOWS/opps,jeanmask/opps | opps/sitemaps/urls.py | opps/sitemaps/urls.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from django.contrib.sitemaps import views as sitemap_views
from opps.sitemaps.sitemaps import GenericSitemap, InfoDisct
sitemaps = {
'articles': GenericSitemap(InfoDisct(), priority=0.6),
}
sitemaps_googlenews = {
'arti... | mit | Python | |
04d122d88bb9f71843df924e048b12de1976b847 | Add missing migration | keybar/keybar | src/keybar/migrations/0008_entry_salt.py | src/keybar/migrations/0008_entry_salt.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('keybar', '0007_remove_entry_key'),
]
operations = [
migrations.AddField(
model_name='entry',
name='s... | bsd-3-clause | Python | |
531da297c57c7b359c37a743095c10e7ad0592cf | Add test_container | laike9m/pdir2 | tests/test_container.py | tests/test_container.py | import pdir
def test_acting_like_a_list():
dadada = 1
cadada = 1
vadada = 1
apple1 = 1
xapple2 = 1
result, correct = pdir(), dir()
assert len(correct) == len(result)
for x, y in zip(correct, result):
assert x == y
def test_acting_like_a_list_when_search():
dadada = 1
... | mit | Python | |
79ebedc800c31b47bd0cc340de06dafcd6ade7f9 | Add TwrOauth basic test | tchx84/twitter-gobject | tests/test_twr_oauth.py | tests/test_twr_oauth.py | #!/usr/bin/env python
#
# Copyright (c) 2013 Martin Abente Lahaye. - tch@sugarlabs.org
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the righ... | lgpl-2.1 | Python | |
d15c8eaca5fb115b8600a8e743ae73a9edba9a5b | Initialize P04_datetimeModule | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter15/P04_datetimeModule.py | books/AutomateTheBoringStuffWithPython/Chapter15/P04_datetimeModule.py | # This program uses the datetime module to manipulate dates and times.
# The datetime Module
import datetime, time
print(datetime.datetime.now())
dt = datetime.datetime(2015, 10, 21, 16, 29, 0)
print((dt.year, dt.month, dt.day))
print((dt.hour, dt.minute, dt.second))
print(datetime.datetime.fromtimestamp(1000000))
p... | mit | Python | |
8106c22a5c05f438eb9c6436af054fd1e72b103c | Add SK_IGNORE_FASTER_TEXT_FIX define for staging Skia change. | XiaosongWei/blink-crosswalk,XiaosongWei/blink-crosswalk,modulexcite/blink,modulexcite/blink,jtg-gg/blink,nwjs/blink,nwjs/blink,smishenk/blink-crosswalk,Bysmyyr/blink-crosswalk,XiaosongWei/blink-crosswalk,ondra-novak/blink,hgl888/blink-crosswalk-efl,ondra-novak/blink,crosswalk-project/blink-crosswalk-efl,Pluto-tv/blink-... | public/blink_skia_config.gyp | public/blink_skia_config.gyp | #
# Copyright (C) 2012 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions an... | #
# Copyright (C) 2012 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions an... | bsd-3-clause | Python |
f7586e8009ae9d2cfdc471b7dbdc9cf5d171c53b | Create string2.py | laetrid/learning | google/string2.py | google/string2.py | #!/usr/bin/env python
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Additional basic string exercises
# D. verbing
# Given a string, if its length is at l... | apache-2.0 | Python | |
bb940826d78e44a4098023e83d788b3d915b9b1f | Revert "Add the GitHub-supported format extensions." | jbarreras/grip,joeyespo/grip,mgoddard-pivotal/grip,joeyespo/grip,mgoddard-pivotal/grip,ssundarraj/grip,jbarreras/grip,ssundarraj/grip | grip/constants.py | grip/constants.py | # The supported extensions, as defined by https://github.com/github/markup
supported_extensions = ['.md', '.markdown']
# The default filenames when no file is provided
default_filenames = map(lambda ext: 'README' + ext, supported_extensions)
| # The supported extensions, as defined by https://github.com/github/markup
supported_extensions = [
'.markdown', '.mdown', '.mkdn', '.md',
'.textile',
'.rdoc',
'.org',
'.creole',
'.mediawiki', '.wiki',
'.rst',
'.asciidoc', '.adoc', '.asc',
'.pod',
]
# The default filenames when no ... | mit | Python |
f5718764185ce1149ed291601e4fe28f9cd2be06 | add single list module for mini-stl (Python) | ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study,ASMlover/study | python/mini-stl/single_list.py | python/mini-stl/single_list.py | #!/usr/bin/python -e
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2013 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyrigh... | bsd-2-clause | Python | |
0be7f2fe05588d93eb478a4fa648d310055b3ce7 | Add experimental generation code to make drafts from raster images | storborg/pyweaving | pyweaving/generators/raster.py | pyweaving/generators/raster.py | from .. import Draft
from PIL import Image
def point_threaded(im, warp_color=(0, 0, 0), weft_color=(255, 255, 255),
shafts=40, max_float=8, repeats=2):
"""
Given an image, generate a point-threaded drawdown that attempts to
represent the image. Results in a drawdown with bilateral symme... | mit | Python | |
de325dbe53bbd28eddcbbf188f2689474994249b | add migration for new version of storedmessages | geometalab/osmaxx,geometalab/osmaxx-frontend,geometalab/osmaxx,geometalab/osmaxx,geometalab/drf-utm-zone-info,geometalab/osmaxx,geometalab/osmaxx-frontend,geometalab/osmaxx-frontend,geometalab/drf-utm-zone-info,geometalab/osmaxx-frontend | osmaxx-py/osmaxx/third_party_apps/stored_messages/migrations/0002_message_url.py | osmaxx-py/osmaxx/third_party_apps/stored_messages/migrations/0002_message_url.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('stored_messages', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='message',
name=... | mit | Python | |
1472011cb8cd323357626443f714284feedfed62 | add merge of ACIS provided data | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | scripts/climodat/use_acis.py | scripts/climodat/use_acis.py | """Use data provided by ACIS to replace climodat data"""
import requests
import sys
import psycopg2
import datetime
SERVICE = "http://data.rcc-acis.org/StnData"
def safe(val):
if val in ['M', 'S']:
return None
if val == 'T':
return 0.0001
try:
return float(val)
except:
... | mit | Python | |
b333d95f3f4187b9d9b480ba8ff4985a62d65f41 | Add tests for nginx version | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/pytests/unit/modules/test_nginx.py | tests/pytests/unit/modules/test_nginx.py | import pytest
import salt.modules.nginx as nginx
from tests.support.mock import patch
@pytest.fixture
def configure_loader_modules():
return {nginx: {}}
@pytest.mark.parametrize(
"expected_version,nginx_output",
[
("1.2.3", "nginx version: nginx/1.2.3"),
("1", "nginx version: nginx/1"),
... | apache-2.0 | Python | |
e77b9a5dff36b3318759a18a786c7cc08bb8ac3e | Create Scramble_String.py | UmassJin/Leetcode | Array/Scramble_String.py | Array/Scramble_String.py | Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.
Below is one possible representation of s1 = "great":
great
/ \
gr eat
/ \ / \
g r e at
/ \
a t
To scramble the string, we may choose any non-leaf node an... | mit | Python | |
156d3c7035e4b7867d1e715c0bac98cf16d24d77 | add script to fix workspace info for search | briehl/narrative,kbase/narrative,pranjan77/narrative,briehl/narrative,briehl/narrative,briehl/narrative,pranjan77/narrative,kbase/narrative,kbase/narrative,briehl/narrative,pranjan77/narrative,pranjan77/narrative,pranjan77/narrative,kbase/narrative,briehl/narrative,kbase/narrative,pranjan77/narrative,briehl/narrative,p... | src/scripts/fix_workspace_info.py | src/scripts/fix_workspace_info.py | """
Fixes workspace info to do the following.
1. Make sure the "narrative" metadata field contains an int that points to the narrative.
1. Make sure the "narrative_nice_name" metadata field is correct.
2. Make sure the "is_temporary" metadata field exists and is correct.
3. Adds a count of the number of narrative cells... | mit | Python | |
f25b69a6ad6777576e31d0b01c4fc2c2bbe02788 | Create new.py | wulidexixilian/iotprototype,wulidexixilian/iotprototype | simple_mqtt/templates/new.py | simple_mqtt/templates/new.py | mit | Python | ||
0ee5d568ddc1f37abedb94f32d6b7da0439e6a4d | Create title_retriever.py | Souloist/Projects,Souloist/Projects,Souloist/Projects,Souloist/Projects,Souloist/Projects | solutions/title_retriever.py | solutions/title_retriever.py | '''
Script that will scrape the title of the given website
'''
import urllib
import re
def getstock(title):
regex = '<title>(.+?)</title>' #find all contents within title braces
pattern = re.compile(regex) #converts regex into a pattern that can be understood by re module
htmlfile = urllib.urlopen(title) ... | mit | Python | |
071da9c0668d495e052baf5ad4d5bc9e068aa6a7 | Create dict2xml.py | Pilfer/dict2xml | dict2xml.py | dict2xml.py | # Python Dictionary to XML converter
# Written by github.com/Pilfer
# @CodesStuff
class dict2xml:
def __init__(self, debug = False):
self.debug = debug
if self.debug:
print "json2xml class has been loaded"
def genXML(self,xmldict):
tag = xmldict['tag']
attrs = ... | apache-2.0 | Python | |
320da5dcc192d654d09ea631e9684f26e97795c0 | add mitm script | tjcsl/hsf-2015-writeups,tjcsl/hsf-2015-writeups | reversing/400a-graphic/mitm.py | reversing/400a-graphic/mitm.py | vals = [0xdeadbeef,0xcafebabe,0xdeadbabe,0x8badf00d,0xb16b00b5,0xcafed00d,0xdeadc0de,0xdeadfa11,0xdefec8ed,0xdeadfeed,0xfee1dead,0xfaceb00b,0xfacefeed,0x000ff1ce,0x12345678,0x743029ab,0xdeed1234,0x00000000,0x11111111,0x11111112,0x11111113,0x42424242]
start = 0xdeadbeef
target = 0x764c648c
group1 = vals[:11]
group2 = ... | mit | Python | |
d80f9ef4592cde488ece9f95b662f5e1e73eac42 | change database | wecontinue/book-collection,wecontinue/book-collection,wecontinue/book-collection,wecontinue/bookcase,wecontinue/bookcase,wecontinue/bookcase | lib/wunderlist.py | lib/wunderlist.py | #!/usr/bin/env python
from lib.base import BaseHandler
import tornado.locale
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
from datetime import datetime
from tornado.options import define, options
import pymongo
if __name__ == "__main__":
define("port", default=8000,... | mit | Python | |
056bd290a4df08876109ef4e2da1115783a06f25 | Add examples for setting classes attribute | plumdog/flask_table,plumdog/flask_table,plumdog/flask_table | examples/classes.py | examples/classes.py | from flask_table import Table, Col
"""If we want to put an HTML class onto the table element, we can set
the "classes" attribute on the table class. This should be an iterable
of that are joined together and all added as classes. If none are set,
then no class is added to the table element.
"""
class Item(object):... | bsd-3-clause | Python | |
f16187d5943158d82fc87611f998283789b5ecdf | Add libarchive 3.1.2 | BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild,BansheeMediaPlayer/bockbuild | packages/libarchive.py | packages/libarchive.py | Package ('libarchive', '3.1.2', sources = ['http://libarchive.org/downloads/%{name}-%{version}.tar.gz'],
configure_flags = [
'--enable-bsdtar=shared',
'--enable-bsdcpio=shared',
'--disable-silent-rules',
'--without-nettle']
)
| mit | Python | |
b9b2b87f0d630de931765c1c9f448e295440e611 | Create fetch_qt_version.py | keithel/unorganized-scripts,keithel/unorganized-scripts,keithel/unorganized-scripts | fetch_qt_version.py | fetch_qt_version.py | """Module to return the Qt version of a Qt codebase.
This module provides a function that returns the version of a Qt codebase, given
the toplevel qt5 repository directory. Note, the `qt5` directory applies to both
Qt 5.x and Qt 6.x
If it is run standalone with a python interpreter and not as part of another
Python m... | apache-2.0 | Python | |
f9b38f675df9752a4b5309df059c6d15a1e1b3c2 | Add module for range support. | SublimeText/VintageEx | ex_range.py | ex_range.py | from collections import namedtuple
from vintage_ex import EX_RANGE_REGEXP
import location
EX_RANGE = namedtuple('ex_range', 'left left_offset separator right right_offset')
def get_range_parts(range):
parts = EX_RANGE_REGEXP.search(range).groups()
return EX_RANGE(
left=parts[1],
... | mit | Python | |
15cf6b5d35e2fbaf39d419ddbe5da1b16247ccaa | add test_parse_table_options.py | ickc/pantable | tests/test_parse_table_options.py | tests/test_parse_table_options.py | #!/usr/bin/env python3
"""
`header` and `markdown` is checked by `test_to_bool` instead
"""
from .context import pandoc_tables
import panflute
def test_parse_table_options():
options = {
'caption': None,
'alignment': None,
'width': None,
'table-width': 1.0,
'header': True,
... | bsd-3-clause | Python | |
71dd485685a481f21e03af6db5a4bc1f91a64ce9 | Add service settings migration | opennode/nodeconductor,opennode/nodeconductor,opennode/nodeconductor | nodeconductor/structure/migrations/0018_service_settings_plural_form.py | nodeconductor/structure/migrations/0018_service_settings_plural_form.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('structure', '0017_add_azure_service_type'),
]
operations = [
migrations.AlterModelOptions(
name='servicesettings... | mit | Python | |
93a2caab2963423e40714ada59abcfeab5c57aea | Add NetBox pillar | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/pillar/netbox.py | salt/pillar/netbox.py | # -*- coding: utf-8 -*-
'''
A module that adds data to the Pillar structure from a NetBox API.
Configuring the NetBox ext_pillar
====================================
.. code-block:: yaml
ext_pillar:
- netbox:
api_url: http://netbox_url.com/api/
The following are optional, and determine whether or not... | apache-2.0 | Python | |
ca8d7773a2d1a5ce4195ce693ccd66bbf53af394 | Read in proteinGroupts.txt from MS data | dmyersturnbull/pynd-pubs-ms | proteinGroupsParser.py | proteinGroupsParser.py | # -*- coding: utf-8 -*-
"""
Created on Sat Oct 10 08:46:25 2015
@author: student
"""
import pandas as pd
#import numpy as np
# read in file
#peptideNames = """'Protein IDsโ, 'Majority protein IDsโ, 'Peptide counts (all)โ, 'Peptide counts (razor+unique)โ, 'Peptide counts (unique)โ, 'Fasta headersโ, 'Number of protein... | apache-2.0 | Python | |
3509585cd14bb51fb00b60df1dcb295bc561d679 | Add _version.py file | desihub/desidatamodel,desihub/desidatamodel | py/desidatamodel/_version.py | py/desidatamodel/_version.py | __version__ = '0.2.0.dev71'
| bsd-3-clause | Python | |
b3383e6c428eccdd67ddc4cfa90e6d22da35412a | Add lib/sccache.py helper script | atom/libchromiumcontent,electron/libchromiumcontent,atom/libchromiumcontent,electron/libchromiumcontent | script/lib/sccache.py | script/lib/sccache.py | import os
import sys
from config import TOOLS_DIR
VERSION = '0.2.6'
SUPPORTED_PLATFORMS = {
'cygwin': 'windows',
'darwin': 'mac',
'linux2': 'linux',
'win32': 'windows',
}
def is_platform_supported(platform):
return platform in SUPPORTED_PLATFORMS
def get_binary_path():
platform = sys.platform
if no... | mit | Python | |
b7459feac37753928fcfc1fe25a0f40d21d89ecf | add collections07.py | devlights/try-python | trypython/stdlib/collections07.py | trypython/stdlib/collections07.py | # coding: utf-8
"""
collections.namedtupleใซใคใใฆใฎใตใณใใซใงใใ
namedtupleใฎๅบๆฌ็ใชไฝฟใๆนใซใคใใฆใฏใcollections04.py ใๅ็
งใ
"""
import collections as cols
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import pr
class Sample(SampleBase):
def exec(self):
MyVal01 = cols.namedtuple('MyVal01', [... | mit | Python | |
8302536cafa07a078cfb6629b5e9cc85e1798e1e | Add Appalachian Regional Commission. | divergentdave/inspectors-general,lukerosiak/inspectors-general | inspectors/arc.py | inspectors/arc.py | #!/usr/bin/env python
import datetime
import logging
import os
from urllib.parse import urljoin
from bs4 import BeautifulSoup
from utils import utils, inspector
# http://www.arc.gov/oig
# Oldest report: 2003
# options:
# standard since/year options for a year range to fetch from.
#
# Notes for IG's web team:
#
A... | cc0-1.0 | Python | |
d834216bcc93eac7b324d95498d9580e3f769dfa | Add Government Printing Office. | divergentdave/inspectors-general,lukerosiak/inspectors-general | inspectors/gpo.py | inspectors/gpo.py | #!/usr/bin/env python
import datetime
import logging
from urllib.parse import urljoin
from bs4 import BeautifulSoup
from utils import utils, inspector
# http://www.gpo.gov/oig/
# Oldest report: 2004
# options:
# standard since/year options for a year range to fetch from.
#
# Notes for IG's web team:
#
AUDIT_REPO... | cc0-1.0 | Python | |
d3c9a6bdc1b8cfb56f9ad408f5257b9ac518b2ac | Add preprocessor | asi1024/ContestLibrary,asi1024/competitive-library,asi1024/competitive-library,asi1024/competitive-library | scripts/preprocess.py | scripts/preprocess.py | #!/usr/bin/env python
import argparse
import os
def preprocess(path):
includes = set()
res = []
def preprocess_line(path, line):
if line.strip().startswith('#'):
line = line.strip()
if line.startswith('#include') and len(line.split('"')) >= 3:
lx = line.sp... | mit | Python | |
e285c097be60f9db5fae075f21b7450f403640d2 | add scaffold for an AvailabilityAssessment class | Moliholy/cvmfs,MicBrain/cvmfs,cvmfs/cvmfs,DrDaveD/cvmfs,cvmfs-testing/cvmfs,trshaffer/cvmfs,DrDaveD/cvmfs,cvmfs/cvmfs,Gangbiao/cvmfs,Gangbiao/cvmfs,cvmfs-testing/cvmfs,cvmfs/cvmfs,cvmfs/cvmfs,MicBrain/cvmfs,Moliholy/cvmfs,cvmfs-testing/cvmfs,Gangbiao/cvmfs,cvmfs-testing/cvmfs,DrDaveD/cvmfs,alhowaidi/cvmfsNDN,djw8605/cv... | python/cvmfs/availability.py | python/cvmfs/availability.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created by Renรฉ Meusel
This file is part of the CernVM File System auxiliary tools.
"""
import cvmfs
class WrongRepositoryType(Exception):
def __init__(self, repo, expected_type):
assert repo.type != expected_type
self.repo = repo
... | bsd-3-clause | Python | |
0e9da5d0099b9c7b527250d6bf8051242e77103a | Add script for showing the results | ssh0/growing-string,ssh0/growing-string | triangular_lattice/distances_analyze.py | triangular_lattice/distances_analyze.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# written by Shotaro Fujimoto
# 2016-10-12
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d.axes3d import Axes3D
if __name__ == '__main__':
# result_data_path = "./results/data/distances/beta=0.00_161012_171430.npz"
# result_data_pat... | mit | Python | |
29e170f9f92f8327c71a9dfc2b9fb9e18947db72 | create predictions on pre-trained models | Nickil21/Indeed-ML-codesprint-2017 | source/generate_predictions.py | source/generate_predictions.py | import numpy as np
import pandas as pd
from sklearn.externals import joblib
from data_preprocessing import join_strings
from model import mlb, count_vectorizer_test_x, tfidf_vectorizer_test_x, file_cnt, file_tfidf
count_vectorizer_model, tfidf_vectorizer_model = joblib.load(file_cnt), joblib.load(file_tfidf)
print("B... | mit | Python | |
c6358b282ea28dd113c9053dab0fe2fa66f4d59d | Allow metrics to start with a braces expression | zBMNForks/graphite-web,synedge/graphite-web,zBMNForks/graphite-web,cbowman0/graphite-web,synedge/graphite-web,obfuscurity/graphite-web,penpen/graphite-web,zuazo-forks/graphite-web,pu239ppy/graphite-web,Krylon360/vimeo-graphite-web,goir/graphite-web,slackhappy/graphite-web,cybem/graphite-web-iow,evernote/graphite-web,at... | webapp/graphite/render/grammar.py | webapp/graphite/render/grammar.py | from graphite.thirdparty.pyparsing import *
ParserElement.enablePackrat()
grammar = Forward()
expression = Forward()
# Literals
intNumber = Combine(
Optional('-') + Word(nums)
)('integer')
floatNumber = Combine(
Optional('-') + Word(nums) + Literal('.') + Word(nums)
)('float')
aString = quotedString('string')
... | from graphite.thirdparty.pyparsing import *
ParserElement.enablePackrat()
grammar = Forward()
expression = Forward()
# Literals
intNumber = Combine(
Optional('-') + Word(nums)
)('integer')
floatNumber = Combine(
Optional('-') + Word(nums) + Literal('.') + Word(nums)
)('float')
aString = quotedString('string')
... | apache-2.0 | Python |
1fdd1f306d45f6aeee91c7f016f7c37286ee3b3b | clear signing | gpg/gpgme,gpg/gpgme,gpg/gpgme,gpg/gpgme,gpg/gpgme,gpg/gpgme,gpg/gpgme | lang/python/examples/howto/clear-sign-file.py | lang/python/examples/howto/clear-sign-file.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
# Copyright (C) 2018 Ben McGinnes <ben@gnupg.org>
#
# 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 S... | lgpl-2.1 | Python | |
c199892e07217f164ae694d510b206bfa771090b | remove unused import | sigma/vmw.vco | src/vmw/vco/components.py | src/vmw/vco/components.py | # Copyright (c) 2001-2010 Twisted Matrix Laboratories.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, me... | # Copyright (c) 2001-2010 Twisted Matrix Laboratories.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, me... | mit | Python |
f76c06acf52094cd13cdf7087fa8d3914c2b992a | Add interactive module | lnls-fac/sirius | sirius/interactive.py | sirius/interactive.py |
"""Interactive sirius module
Use this module to define variables and functions to be globally available when
using
'from sirius.interactive import *'
"""
from pyaccel.interactive import *
import sirius.SI_V07 as si_model
import sirius.BO_V901 as bo_model
__all__ = [name for name in dir() if not name.startswit... | mit | Python | |
f1e6926f964877acc3bfe0d667a199861b431ed7 | add test_xadc | mithro/HDMI2USB-litex-firmware,cr1901/HDMI2USB-litex-firmware,mithro/HDMI2USB-litex-firmware,cr1901/HDMI2USB-litex-firmware,cr1901/HDMI2USB-litex-firmware,mithro/HDMI2USB-litex-firmware,cr1901/HDMI2USB-litex-firmware,mithro/HDMI2USB-litex-firmware | software/test_xadc.py | software/test_xadc.py | def main(wb):
wb.open()
regs = wb.regs
# # #
print("temperature: %fยฐC" %(regs.xadc_temperature.read()*503.975/4096 - 273.15))
print("vccint: %fV" %(regs.xadc_vccint.read()/4096*3))
print("vccaux: %fV" %(regs.xadc_vccaux.read()/4096*3))
print("vccbram: %fV" %(regs.xadc_vccbram.read()/4096*3))
# # #
wb.close()
| bsd-2-clause | Python | |
c2dab85f24e648c66daae847f19b605271ed858b | Add more threader tests | ergl/pysellus,cgvarela/pysellus,angelsanz/pysellus,Pysellus/pysellus | spec/threader_spec.py | spec/threader_spec.py | import queue
from functools import partial
from doublex import Spy, Mock
from expects import expect, be
from doublex_expects import have_been_called
from pysellus import threader
with description('the threader module'):
with it('should create as many threads as the sum of len(values) of the supplied dict'):
... | from expects import expect, be
from doublex import Spy, Mock
from pysellus import threader
with description('the threader module'):
with it('should create as many threads as keys * values in the supplied dict'):
a_stream = Mock()
another_stream = Mock()
foo = Spy()
a_function = Sp... | mit | Python |
e6a137026ff9b84814199517a452d354e121a476 | Create quiz_3.py | eliecer11/Uip-prog3 | laboratorios/quiz_3.py | laboratorios/quiz_3.py | #dado un intervalo de tiempo en segundos, calcular los segundos restantes
#corresponden para convertirse exactamente en minutos. Este programa debe
#funcionar para 5 oportunidades.
chance = 0
segundos_restantes = 0
while chance < 5:
segundos = int (input("Introduzca sus segundos:"))
chance +=1
if segundos / 60:
... | mit | Python | |
90851f4fdb1eb69bb3d6d953974d9a399d60bd13 | add browser_render.py | EscapeLife/web_crawler | 5.ๅจๆๅ
ๅฎน/5.browser_render.py | 5.ๅจๆๅ
ๅฎน/5.browser_render.py | #!/usr/bin/env python
# coding:utf-8
# ๆธฒๆๆๆ็็ฑปๅฎ็ฐๆนๅผ
# ๅฎๆถๅจ็จไบ่ท่ธช็ญๅพ
ๆถ้ด๏ผๅนถๅจๆชๆญขๆถ้ดๅฐ่พพๆถๅๆถไบไปถๅพช็ฏใๅฆๅ๏ผๅฝๅบ็ฐ็ฝ็ป้ฎ้ขๆถ๏ผไบไปถๅพช็ฏๅฐฑไผๆ ไผๆญขๅฐ่ฟ่กไธๅป ใ
import re
import csv
import time
import lxml.html
try:
from PySide.QtGui import QApplication
from PySide.QtCore import QUrl, QEventLoop, QTimer
from PySide.QtWebKit import QWebView
except ImportEr... | mit | Python | |
58ac46511964ca1dd3de25d2b6053eb785e3e281 | Add outlier detection util script. | Alexx-G/openface,nmabhi/Webface,Alexx-G/openface,nmabhi/Webface,xinfang/face-recognize,francisleunggie/openface,cmusatyalab/openface,nmabhi/Webface,Alexx-G/openface,francisleunggie/openface,nhzandi/openface,xinfang/face-recognize,Alexx-G/openface,nmabhi/Webface,xinfang/face-recognize,cmusatyalab/openface,francisleunggi... | util/detect-outliers.py | util/detect-outliers.py | #!/usr/bin/env python2
#
# Detect outlier faces (not of the same person) in a directory
# of aligned images.
# Brandon Amos
# 2016/02/14
#
# Copyright 2015-2016 Carnegie Mellon University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licens... | apache-2.0 | Python | |
dad13d26aaf58ea186891e138ac9a10153363c8a | add vicon data extraction | scauglog/brain_record_toolbox,scauglog/brain_record_toolbox,scauglog/brain_record_toolbox | script_r448_vicon_process.py | script_r448_vicon_process.py | import pickle
import signal_processing as sig_proc
dir_name = '../data/r448/r448_131022_rH/'
img_ext = '.png'
save_img = True
show = False
save_obj = True
sp = sig_proc.Signal_processing(save_img, show, img_ext)
filename='p0_3RW05'
file_events=sp.load_csv(dir_name+filename+'_EVENTS.csv')
file_analog=sp.load_csv(dir... | mit | Python | |
b46e7e31c5476c48e2a53d5a632354700d554174 | Add test_html_fetchers | Samuel-L/cli-ws,Samuel-L/cli-ws | tests/test_html_fetchers.py | tests/test_html_fetchers.py | import os
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import unittest
from unittest import mock
from web_scraper.core import html_fetchers
def mocked_requests_get(*args, **kwargs):
"""this method will be used by the mock to replace requests.get"""
class MockResponse:... | mit | Python | |
b4f8e8d38636a52d3d4b199fdc670ff93eca33f6 | Add prototype for filters module. | rladeira/mltils | mltils/filters.py | mltils/filters.py | # pylint: disable=missing-docstring, invalid-name, import-error
class VarianceFilter(object):
pass
class SimilarityFilter(object):
pass
class CorrelationFilter(object):
pass
| mit | Python | |
b0f5c33461d08325581cc0ad272c7f2b39b8dc66 | Fix typo. | ahaberlie/MetPy,Unidata/MetPy,dopplershift/MetPy,ahaberlie/MetPy,ahill818/MetPy,dopplershift/MetPy,deeplycloudy/MetPy,ShawnMurd/MetPy,Unidata/MetPy,jrleeman/MetPy,jrleeman/MetPy | metpy/calc/__init__.py | metpy/calc/__init__.py | import basic
from basic import *
__all__ = []
__all__.extend(basic.__all__)
| import basic
from basic import *
__all__ == []
__all__.extend(basic.__all__)
| bsd-3-clause | Python |
167712a6640abca106bbcd50daf5dc22ba90083d | Fix log formatting | ngonzalvez/sentry,alexm92/sentry,BuildingLink/sentry,kevinastone/sentry,TedaLIEz/sentry,JTCunning/sentry,JTCunning/sentry,imankulov/sentry,pauloschilling/sentry,boneyao/sentry,ifduyue/sentry,wujuguang/sentry,camilonova/sentry,ifduyue/sentry,BuildingLink/sentry,felixbuenemann/sentry,1tush/sentry,ewdurbin/sentry,kevinlon... | src/sentry/tasks/email.py | src/sentry/tasks/email.py | """
sentry.tasks.email
~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
import logging
from django.core.mail import get_connection
from sentry.tasks.base import inst... | """
sentry.tasks.email
~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
import logging
from django.core.mail import get_connection
from sentry.tasks.base import inst... | bsd-3-clause | Python |
5e1c58db69adad25307d23c240b905eaf68e1671 | Add fade animation | bitoffdev/perkins-blues | src/fade_animation.py | src/fade_animation.py | import animation, colorsys
def colorunpack(color):
color = int(color)
return ((color >> 16) / 255,
((color >> 8) & 255) / 0xff,
(color & 0xff) / 0xff)
def colorpack(color):
return sum(int(color[i] * 0xff) << (16 - 8*i) for i in range(3))
class FadeAnimation(animation.Animation):
... | mit | Python | |
f537abe2ff1826a9decd9dace5597cbc4f7f318b | Add 1.6 | Dzionek95/Algorithms,Dzionek95/Algorithms,Dzionek95/Algorithms | 1_arrays_hashtables/string_compression.py | 1_arrays_hashtables/string_compression.py | def compress(string):
count_array = []
element_count = 1
for index, character in enumerate(string[1:]):
print(character, string[index])
if string[index] == character:
element_count = element_count + 1
else:
count_array.append(element_count)
element... | mit | Python | |
3e15f6d64ccbb1f98ff64323a25304db662a45ba | Add nice_number function to format decimals to english | linuxipho/mycroft-core,aatchison/mycroft-core,Dark5ide/mycroft-core,linuxipho/mycroft-core,aatchison/mycroft-core,Dark5ide/mycroft-core,forslund/mycroft-core,MycroftAI/mycroft-core,forslund/mycroft-core,MycroftAI/mycroft-core | mycroft/util/format.py | mycroft/util/format.py |
# -*- coding: iso-8859-15 -*-
# Copyright 2017 Mycroft AI, Inc.
#
# This file is part of Mycroft Core.
#
# Mycroft Core 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
# (... | apache-2.0 | Python | |
296efcc28e19fc76371496881a546f1ca52dc622 | add nagios check for iembot availability | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | nagios/check_iembot.py | nagios/check_iembot.py | """Ensure iembot is up."""
import sys
import requests
def main():
"""Go Main Go."""
req = requests.get('http://iembot:9004/room/kdmx.xml')
if req.status_code == 200:
print("OK - len(kdmx.xml) is %s" % (len(req.content), ))
return 0
print("CRITICAL - /room/kdmx.xml returned code %s" % ... | mit | Python | |
1d0c0741f1605f3786a752288161c679ab271ea2 | Add a utility file for aggregating decorators | bdyetton/prettychart,abought/osf.io,chrisseto/osf.io,sbt9uc/osf.io,DanielSBrown/osf.io,laurenrevere/osf.io,fabianvf/osf.io,MerlinZhang/osf.io,rdhyee/osf.io,alexschiller/osf.io,haoyuchen1992/osf.io,asanfilippo7/osf.io,billyhunt/osf.io,monikagrabowska/osf.io,dplorimer/osf,jnayak1/osf.io,jolene-esposito/osf.io,ckc6cz/osf.... | website/addons/osfstorage/decorators.py | website/addons/osfstorage/decorators.py | import functools
from webargs import Arg
from webargs import core
from framework.auth.decorators import must_be_signed
from website.models import User
from framework.exceptions import HTTPError
from website.addons.osfstorage import utils
from website.project.decorators import (
must_not_be_registration, must_hav... | apache-2.0 | Python | |
bb8e7ee023d678e68d1da3018bf6d1d3d36d55bd | Create new package (#6588) | matthiasdiener/spack,LLNL/spack,mfherbst/spack,iulian787/spack,tmerrick1/spack,krafczyk/spack,tmerrick1/spack,krafczyk/spack,tmerrick1/spack,iulian787/spack,EmreAtes/spack,iulian787/spack,EmreAtes/spack,EmreAtes/spack,EmreAtes/spack,iulian787/spack,matthiasdiener/spack,mfherbst/spack,LLNL/spack,tmerrick1/spack,iulian78... | var/spack/repos/builtin/packages/perl-statistics-descriptive/package.py | var/spack/repos/builtin/packages/perl-statistics-descriptive/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 | |
81bcfe4a31d8e9ea92497288c3d264755949d809 | check for some statistics on the dataset. | sanja7s/SR_Twitter | stats_about_tweet_data.py | stats_about_tweet_data.py | from collections import defaultdict
import codecs
import matplotlib.pyplot as plt
import pylab as P
import numpy as np
F_IN = "usrs_with_more_than_20_tweets.dat"
#F_OUT = "tweets_with_usrs_with_more_than_20_tweets.dat"
#f_out = "usrs_with_more_than_20_tweets.dat"
USR_TWEETS = defaultdict(int)
def plot_hist(data):
... | mit | Python | |
d7c0525a1b62bbe6b8425c0bb2dda0e1fad680b8 | Create enforce.py | devzero-xyz/Andromeda-Plugins | enforce.py | enforce.py | """This plugins allows a user to enforce modes set on channels"""
"""e.g. enforcing +o on nick"""
"""Requires admin"""
from utils import add_cmd, add_handler
import utils
from admin import deop
name = "enforce"
cmds = ["enforce"]
def main(irc):
if name not in irc.plugins.keys():
irc.plugins[name] = {}
... | mit | Python | |
12f7dddcbe8c7c2160bf8de8f7a9c3082b950003 | Create longest-harmonious-subsequence.py | jaredkoontz/leetcode,kamyu104/LeetCode,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,jaredkoontz/leetcode,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,kamyu104/LeetCode,jaredkoontz/leetcode,kamyu104/LeetCode,yiwe... | Python/longest-harmonious-subsequence.py | Python/longest-harmonious-subsequence.py | # Time: O(n)
# Space: O(n)
class Solution(object):
def findLHS(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
lookup = collections.defaultdict(int)
result = 0
for num in nums:
lookup[num] += 1
for diff in [-1, 1]:
... | mit | Python | |
d7cc3d6590d1d6d46bdf780b93e76ea6aa50334d | Create peak-index-in-a-mountain-array.py | kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,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 | Python/peak-index-in-a-mountain-array.py | Python/peak-index-in-a-mountain-array.py | # Time: O(logn)
# Space: O(1)
# Let's call an array A a mountain if the following properties hold:
#
# A.length >= 3
# There exists some 0 < i < A.length - 1
# such that A[0] < A[1] < ... A[i-1] < A[i] > A[i+1] > ... > A[A.length - 1]
# Given an array that is definitely a mountain,
# return any i such that
# A[0] < A... | mit | Python | |
64eab4beaf4e00d47423ea027ec6f40129ee2e95 | Create execi-3.py | rafa-impacta/Exercicio | execi-3.py | execi-3.py | n1 = int(input("Digite um valor: "))
if n1 < 0:
print (n1 * -1)
elif n1 > 10:
n2 = int(input("Digite outro valor: "))
print (n1 - n2)
else:
print (n1/5.0)
| apache-2.0 | Python | |
7dce21cc8fa3b81e150ed6586db8ca80cd537fc7 | Add compat module to test package | piotr-rusin/spam-lists | test/compat.py | test/compat.py | # -*- coding: utf-8 -*-
'''
A common module for compatibility related imports and
definitions used during testing
'''
from __future__ import unicode_literals
import unittest
from six import assertCountEqual, PY2
try:
from unittest.mock import Mock, MagicMock, patch # @NoMove
except ImportError:
from mock imp... | mit | Python | |
9a97847419ad569b1f9f3d302507aca8544944e2 | test file | dcrosta/mongo-disco,sajal/MongoDisco,mongodb/mongo-disco,10genNYUITP/MongoDisco,johntut/MongoDisco | test_scheme.py | test_scheme.py | import unittest
import scheme_mongo
class TestScheme(unittest.TestCase):
def runTest(self):
mongo_uri = "mongodb://localhost/test.in"
wrapper = scheme_mongo.open(mongo_uri)
assert wrapper
for result in wrapper:
print result
if __name__ == '__main__':
unittest.main()
| apache-2.0 | Python | |
fc95c998dc8c3caee3e0a4590b96c9ed7e0321a7 | add a test suite for Division | srittau/python-htmlgen | test_htmlgen/block.py | test_htmlgen/block.py | from unittest import TestCase
from asserts import assert_equal
from htmlgen import Division
class DivisionTest(TestCase):
def test_render(self):
div = Division()
div.append("Test")
assert_equal([b"<div>", b"Test", b"</div>"], list(iter(div)))
| mit | Python | |
e4980879f0f4a0d223cccc99a486fb62cbe5807f | change models.py | fwpz/WeiPython,PegasusWang/WeiPython | physics/models.py | physics/models.py | from django.db import models
class Student(models.Model):
"""Student Info"""
stu_id = models.CharField(u'ๅญฆๅท', max_length=30, primary_key=True)
name = models.CharField(u'ๅงๅ', max_length=30)
password = models.CharField(u'ๅฏ็ ', max_length=30)
def __unicode__(self):
return '{stu_id} {name}'.fo... | from django.db import models
class Student(models.Model):
"""Student Info"""
stu_id = models.CharField(u'ๅญฆๅท', max_length=30, primary_key=True)
name = models.CharField(u'ๅงๅ', max_length=30)
password = models.CharField(u'ๅฏ็ ', max_length=30)
def __unicode__(self):
return '{stu_id} {name}'.fo... | mit | Python |
964d1f97df600308b23b6a91b9de8811795509a4 | Add a test for the @cachit decorator. | cccfran/sympy,shipci/sympy,wyom/sympy,Titan-C/sympy,ahhda/sympy,meghana1995/sympy,wanglongqi/sympy,pandeyadarsh/sympy,vipulroxx/sympy,jbbskinny/sympy,jaimahajan1997/sympy,Arafatk/sympy,grevutiu-gabriel/sympy,Gadal/sympy,jerli/sympy,mcdaniel67/sympy,Mitchkoens/sympy,wyom/sympy,oliverlee/sympy,ga7g08/sympy,tovrstra/sympy... | sympy/core/tests/test_cache.py | sympy/core/tests/test_cache.py | from sympy.core.cache import cacheit
def test_cacheit_doc():
@cacheit
def testfn():
"test docstring"
pass
assert testfn.__doc__ == "test docstring"
assert testfn.__name__ == "testfn"
| bsd-3-clause | Python | |
a8ddae9343683ca69067eecbece5ecff6d4e5d1d | Add myStrom switch platform | PetePriority/home-assistant,jaharkes/home-assistant,ct-23/home-assistant,oandrew/home-assistant,florianholzapfel/home-assistant,hmronline/home-assistant,florianholzapfel/home-assistant,morphis/home-assistant,ct-23/home-assistant,joopert/home-assistant,Zac-HD/home-assistant,kyvinh/home-assistant,shaftoe/home-assistant,o... | homeassistant/components/switch/mystrom.py | homeassistant/components/switch/mystrom.py | """
homeassistant.components.switch.mystrom
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support for myStrom switches.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/switch.mystrom/
"""
import logging
import requests
from homeassistant.components.switch imp... | mit | Python | |
fbf5ecffb4249e7f881f53f30625a47a6e779592 | Create selective_array_reversing.py | Kunalpod/codewars,Kunalpod/codewars | selective_array_reversing.py | selective_array_reversing.py | #Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Selective Array Reversing
#Problem level: 6 kyu
def sel_reverse(arr,l):
li=[]
if not l:
return arr
for i in range(0,len(arr),l):
if i+l>len(arr):
li+=(list(reversed(arr[i:])))
else:
li+=(list(reversed(arr[... | mit | Python | |
afe8e16be43b5e66df0f7bf14832f77009aab151 | Create __init__.py | lucasphbs/TradeVIABTC | oauth/__init__.py | oauth/__init__.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Created by bu on 2017-05-10
"""
from __future__ import unicode_literals
import json as complex_json
import requests
from utils import verify_sign
from utils import get_sign
class RequestClient(object):
__headers = {
'Content-Type': 'application/json; charset=u... | apache-2.0 | Python | |
a3bbd175ef5640843cb16b0166b462ffaed25242 | standardize logging interface for fs-drift | parallel-fs-utils/fs-drift,bengland2/fsstress,parallel-fs-utils/fs-drift,bengland2/fsstress | fsd_log.py | fsd_log.py | import logging
# standardize use of logging module in fs-drift
def start_log(prefix):
log = logging.getLogger(prefix)
h = logging.StreamHandler()
log_format = prefix + ' %(asctime)s - %(levelname)s - %(message)s'
formatter = logging.Formatter(log_format)
h.setFormatter(formatter)
log.addHandler... | apache-2.0 | Python | |
52e71001b7e775daaaaf42280ebe06c31291b595 | Add a simplemeshtest variant where all AJ packets of one node are always dropped | freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut,freedesktop-unofficial-mirror/telepathy__telepathy-salut | tests/failmeshtest.py | tests/failmeshtest.py | #!/usr/bin/env python
from twisted.internet import reactor
from mesh import Mesh, MeshNode, packet_type, ATTEMPT_JOIN
import sys
NUMNODES = 5
NUMPACKETS = 10
DELAY = 0.1
nodes = []
# We're optimists
success = True
class TestMeshNode(MeshNode):
nodes = 1
def __init__ (self, name, mesh):
MeshNode.__init__(s... | lgpl-2.1 | Python | |
57fc053939702f4baf04604a9226873c98526ae5 | Add test for Moniker | openlawlibrary/pygls,openlawlibrary/pygls,openlawlibrary/pygls | tests/lsp/test_moniker.py | tests/lsp/test_moniker.py | ############################################################################
# Copyright(c) Open Law Library. All rights reserved. #
# See ThirdPartyNotices.txt in the project root for additional notices. #
# #
# Licensed u... | apache-2.0 | Python | |
20c4df8c61ee1f625ebd77c8613fc470a3e87438 | add another lazy function | chaleaoch/jianshu_repo,chaleaoch/jianshu_repo | lazy_function/another_lazy_class.py | lazy_function/another_lazy_class.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
class lazy_property(object):
def __init__(self, func, name=None, doc=None):
self._func = func
self._name = name or func.func_name
self.__doc__ = doc or func.__doc__
def __get__(self, obj, objtype=None):
if obj is None:
re... | mit | Python | |
1d8fccf6943adf40c77d5d2df002330719dcfcd1 | test for S3Sync | aws-quickstart/taskcat,aws-quickstart/taskcat,aws-quickstart/taskcat | tests/test_s3_sync.py | tests/test_s3_sync.py | import os
import unittest
from pathlib import Path
import mock
from taskcat._s3_sync import S3Sync
class TestS3Sync(unittest.TestCase):
def test_init(self):
m_s3_client = mock.Mock()
m_s3_client.list_objects_v2.return_value = {
"Contents": [{"Key": "test_prefix/test_object", "ETag": ... | apache-2.0 | Python | |
0f1cf524c2b90d77e17d516a30d62632ebb5ed2f | Add pipeline for untar'ing GCS blobs. | GoogleCloudPlatform/healthcare,GoogleCloudPlatform/healthcare,GoogleCloudPlatform/healthcare,GoogleCloudPlatform/healthcare,GoogleCloudPlatform/healthcare,GoogleCloudPlatform/healthcare,GoogleCloudPlatform/healthcare,GoogleCloudPlatform/healthcare | datathon/datathon_etl_pipelines/generic_imagining/untar_gcs.py | datathon/datathon_etl_pipelines/generic_imagining/untar_gcs.py | r"""Untar .tar and .tar.gz GCS files."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import apache_beam as beam
from apache_beam.options.pipeline_options import PipelineOptions
from apache_beam.options.pipeline_options import SetupOption... | apache-2.0 | Python | |
0bf6f0b6021b2ca3801b0d68c0ee63e39ddc36df | Make a ValueBuffer class | google/CFU-Playground,google/CFU-Playground,google/CFU-Playground,google/CFU-Playground | proj/avg_pdti8/util.py | proj/avg_pdti8/util.py | #!/bin/env python
# Copyright 2021 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 agre... | apache-2.0 | Python | |
f2f4accf304cfe1aaed042f7df35bc0ee86a6c59 | Add enums for service/record/assignment/transaction type | otovo/python-netsgiro | netsgiro/enums.py | netsgiro/enums.py | from enum import IntEnum
class ServiceType(IntEnum):
NONE = 0
OCR_GIRO = 9
AVTALEGIRO = 21
class RecordType(IntEnum):
TRANSMISSION_START = 10
ASSIGNMENT_START = 20
TRANSACTION_AMOUNT_1 = 30
TRANSACTION_AMOUNT_2 = 31
TRANSACTION_AMOUNT_3 = 32 # Only for TransactionType 20 and 21
... | apache-2.0 | Python | |
ca16e36b79e9c7dcd5cb31d899ef9c50ebf602c1 | add unit test for _nearest_neighbor() | UDST/urbanaccess | urbanaccess/tests/test_network.py | urbanaccess/tests/test_network.py | import pytest
import pandas as pd
from urbanaccess import network
@pytest.fixture
def nearest_neighbor_dfs():
data = {
'id': (1, 2, 3),
'x': [-122.267546, -122.264479, -122.219119],
'y': [37.802919, 37.808042, 37.782288]
}
osm_nodes = pd.DataFrame(data).set_index('id')
data = ... | agpl-3.0 | Python | |
7c5dbbcd1de6376a025117fe8f00516f2fcbb40d | Add regressiontest for crypto_onetimeauth_verify | RaetProtocol/libnacl,johnttan/libnacl,saltstack/libnacl | tests/unit/test_auth_verify.py | tests/unit/test_auth_verify.py | # Import nacl libs
import libnacl
# Import python libs
import unittest
class TestAuthVerify(unittest.TestCase):
'''
Test onetimeauth functions
'''
def test_auth_verify(self):
msg = b'Anybody can invent a cryptosystem he cannot break himself. Except Bruce Schneier.'
key1 = libnacl.util... | apache-2.0 | Python | |
80ccffb269b04af02224c1121c41d4e7c503bc30 | Add unit test for intersperse | brechtm/rinohtype,brechtm/rinohtype,brechtm/rinohtype | tests/util/test_intersperse.py | tests/util/test_intersperse.py | # This file is part of rinohtype, the Python document preparation system.
#
# Copyright (c) Brecht Machiels.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.
from rinoh.util import intersperse
def test_interspers... | agpl-3.0 | Python | |
8f18a1b75b68d8c97efd57673b160a9ceda608a3 | Add Manifest class | Bloomie/murano-repository,Bloomie/murano-repository,EkaterinaFedorova/murano-repository,EkaterinaFedorova/murano-repository | manifest.py | manifest.py | __author__ = 'fervent'
| apache-2.0 | Python | |
e56d9337cc5c63ef61afe8ffdee2019e19af0963 | Add test for resolved issue 184 | armandobs14/rdflib,RDFLib/rdflib,yingerj/rdflib,yingerj/rdflib,avorio/rdflib,dbs/rdflib,avorio/rdflib,armandobs14/rdflib,dbs/rdflib,marma/rdflib,RDFLib/rdflib,avorio/rdflib,dbs/rdflib,ssssam/rdflib,yingerj/rdflib,RDFLib/rdflib,ssssam/rdflib,armandobs14/rdflib,dbs/rdflib,marma/rdflib,avorio/rdflib,yingerj/rdflib,ssssam/... | test/test_issue184.py | test/test_issue184.py | from rdflib.term import Literal
from rdflib.term import URIRef
from rdflib.graph import ConjunctiveGraph
def test_escaping_of_triple_doublequotes():
"""
Issue 186 - Check escaping of multiple doublequotes.
A serialization/deserialization roundtrip of a certain class of
Literals fails when there are bo... | bsd-3-clause | Python | |
0988a2a18688a8b8e07d94e1609405c17bbe717d | Add test suite for the playlist plugin | jackwilsdon/beets,jackwilsdon/beets,ibmibmibm/beets,SusannaMaria/beets,sampsyo/beets,beetbox/beets,ibmibmibm/beets,ibmibmibm/beets,shamangeorge/beets,jackwilsdon/beets,ibmibmibm/beets,SusannaMaria/beets,beetbox/beets,shamangeorge/beets,SusannaMaria/beets,shamangeorge/beets,shamangeorge/beets,jackwilsdon/beets,beetbox/b... | test/test_playlist.py | test/test_playlist.py | # -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Thomas Scholtes.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation ... | mit | Python | |
71577ec62406c0119ea2282a3011ebbc368a3a04 | add test_pollbot.py | bmintz/reactor-bot | tests/test_pollbot.py | tests/test_pollbot.py | #!/usr/bin/env python3
import pytest
import poll_bot
class TestPollBot:
def test_extract_emoji(self):
lines_and_emojis = {
' M)-ystery meat': 'M',
'๐ dog sandwiches': '๐',
'3 blind mice': '3',
'๐บ๐ธ flags': '๐บ๐ธ',
'<:python3:232720527448342530> python3!': '<:python3:232720527448342530>',
}
... | mit | Python | |
1e9980aff2370b96171011f7fa50d4517957fa86 | Add a script to check TOI coverage for a bbox and zoom range | tilezen/tilepacks | tilepack/check_toi.py | tilepack/check_toi.py | import mercantile
import argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument('min_lon',
type=float,
help='Bounding box minimum longitude/left')
parser.add_argument('min_lat',
type=float,
help='Bounding box minimum latitude/bottom')
parser.add_argu... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.