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 |
|---|---|---|---|---|---|---|---|---|
a0ba849362163e11c67089ba4d8dbd9908be7d9f | Add example deployment that setups an ssh key | cloudkick/libcloud,cloudkick/libcloud | libcloud/deployment.py | libcloud/deployment.py | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# libcloud.org licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not... | apache-2.0 | Python | |
23f4fbb459bf1bd48c01a8eee55241575864786b | increase length so status message can be seen | Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data | metro/migrations/0031_auto_20200618_1712.py | metro/migrations/0031_auto_20200618_1712.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2020-06-18 15:12
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('metro', '0030_updatefile_status'),
]
operations = [
migrations.AlterField(... | mit | Python | |
5230bb28cc90b258d8c192fd8ef459d0f3980aa8 | Check in JBoxHandler | tanmaykm/JuliaBox,EricForgy/JuliaBox,EricForgy/JuliaBox,mr-justin/JuliaBox,gsd-ufal/Juliabox,mr-justin/JuliaBox,gsd-ufal/Juliabox,tanmaykm/JuliaBox,gsd-ufal/Juliabox,JuliaLang/JuliaBox,JuliaLang/JuliaBox,EricForgy/JuliaBox,mr-justin/JuliaBox,JuliaLang/JuliaBox,mdpradeep/JuliaBox,tanmaykm/JuliaBox,mdpradeep/JuliaBox,mdp... | host/tornado/src/jbox_handler.py | host/tornado/src/jbox_handler.py | from tornado.web import RequestHandler
from jbox_util import LoggerMixin, read_config
__all__ = ["JBoxHandler"]
class JBoxHandler(RequestHandler, LoggerMixin):
_config = read_config()
def rendertpl(self, tpl, **kwargs):
self.render("../www/" + tpl, **kwargs)
def config(self, key=None, default=Non... | mit | Python | |
d989e765906502f8e52b90de79a1efbe1baa0de0 | add the regression test script for beamdyn | OpenFAST/OpenFAST,OpenFAST/OpenFAST,OpenFAST/OpenFAST | reg_tests/executeBeamdynRegressionCase.py | reg_tests/executeBeamdynRegressionCase.py | #
# Copyright 2017 National Renewable Energy Laboratory
#
# 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 la... | apache-2.0 | Python | |
d187926277f2eb8c89298e13bfd1a017d5c2ee0d | test json encoder | dpausp/arguments,dpausp/arguments,dpausp/arguments,dpausp/arguments | tests/helper/test_json.py | tests/helper/test_json.py | from dataclasses import dataclass
from enum import Enum
import json
import ekklesia_portal.helper.json
from ekklesia_portal.helper.json import JSONEncoder
def test_json_encoder():
@dataclass
class AB:
a: int
class E(Enum):
A = 'a'
@dataclass
class A:
b: int
sub:... | agpl-3.0 | Python | |
0c6461fbf2b1832a941426cc4d7758379198c6e6 | Add LR script | rnowling/aranyani,rnowling/asaph,rnowling/asaph | logistic_regression.py | logistic_regression.py | """
Copyright 2017 Ronald J. Nowling
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softw... | apache-2.0 | Python | |
6af7a7e929d9783a9a837f8a71025d638c9f45b4 | Make mcf have 256MB which it needs for 64 bit builds. | hoangt/tpzsimul.gem5,hoangt/tpzsimul.gem5,hoangt/tpzsimul.gem5,pombredanne/http-repo.gem5.org-gem5-,pombredanne/http-repo.gem5.org-gem5-,vovojh/gem5,hoangt/tpzsimul.gem5,pombredanne/http-repo.gem5.org-gem5-,pombredanne/http-repo.gem5.org-gem5-,vovojh/gem5,vovojh/gem5,vovojh/gem5,vovojh/gem5,hoangt/tpzsimul.gem5,hoangt/... | tests/long/10.mcf/test.py | tests/long/10.mcf/test.py | # Copyright (c) 2006-2007 The Regents of The University of Michigan
# 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 ... | # Copyright (c) 2006-2007 The Regents of The University of Michigan
# 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 ... | bsd-3-clause | Python |
79450e3971547cde4578e75d661628c77462eca3 | add Erlang B/C module | m-deck/stimulus | stimulus/erlang.py | stimulus/erlang.py | import math
#TODO: change all wait_time refs to be threshold instead
def intensity(aht, interval, rate):
return aht * (rate / interval)
def erlang_b(server_count, intensity):
ib = 1.0
server_count = int(server_count) # need explicit cast here to prevent range TypeError
for i in range(0, server_count)... | mit | Python | |
a810ec97afe6987333755b3c6c4e2836745499d7 | Add Javascript resource to worker. | praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go | go/apps/jsbox/vumi_app.py | go/apps/jsbox/vumi_app.py | # -*- test-case-name: go.apps.bulk_message.tests.test_vumi_app -*-
# -*- coding: utf-8 -*-
"""Vumi application worker for the vumitools API."""
from twisted.internet.defer import inlineCallbacks
from vumi.application.sandbox import Sandbox, SandboxResource, SandboxCommand
from vumi import log
from go.vumitools.api ... | bsd-3-clause | Python | |
9f2d4c6052089706f9398be3234eb1fc63de95bf | Add a few statement comparison tests | Gustavo6046/ChatterBot,davizucon/ChatterBot,vkosuri/ChatterBot,Reinaesaya/OUIRL-ChatBot,maclogan/VirtualPenPal,gunthercox/ChatterBot,Reinaesaya/OUIRL-ChatBot | tests/test_comparisons.py | tests/test_comparisons.py | """
Test ChatterBot's statement comparison algorithms.
"""
from unittest import TestCase, SkipTest
from chatterbot.conversation import Statement
from chatterbot import comparisons
class LevenshteinDistanceTestCase(TestCase):
def test_levenshtein_distance_statement_false(self):
"""
Falsy values s... | bsd-3-clause | Python | |
0dccb0f29d7c983d3718a767eabedd11c4ed6a9d | Add speech recognizer | WT-Swish/swish | swish/recognize.py | swish/recognize.py | import speech_recognition as sr
from .parse import parse_intent
recognizer = sr.Recognizer()
def speech_to_text(source, recognizer=recognizer):
try:
return recognizer.recognize_google(source)
except sr.UnknownValueError:
return None
except Exception:
return False
def respond_to... | mit | Python | |
abfb1a1cef4b74a6f59f9c59cdf2e3d9e442f90b | add migration for disabled ga | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/domain/migrations/0005_ga_opt_out.py | corehq/apps/domain/migrations/0005_ga_opt_out.py | from django.db import migrations, models
from corehq.apps.domain.models import Domain
from corehq.util.django_migrations import skip_on_fresh_install
@skip_on_fresh_install
def _disable_ga(apps, schema_editor):
for domain in Domain.get_all():
if domain.hipaa_compliant:
domain.ga_opt_out = Tru... | bsd-3-clause | Python | |
c035fefef11499bb1b686385bbe1f982a6895d33 | add convenience functions (#172) | datagovuk/OWSLib,daf/OWSLib,daf/OWSLib,KeyproOy/OWSLib,mbertrand/OWSLib,Jenselme/OWSLib,datagovuk/OWSLib,kalxas/OWSLib,menegon/OWSLib,dblodgett-usgs/OWSLib,geopython/OWSLib,tomkralidis/OWSLib,jachym/OWSLib,gfusca/OWSLib,ocefpaf/OWSLib,geographika/OWSLib,bird-house/OWSLib,JuergenWeichand/OWSLib,kwilcox/OWSLib,robmcmulle... | owslib/util.py | owslib/util.py | #!/usr/bin/python
# -*- coding: ISO-8859-15 -*-
# =============================================================================
# Copyright (c) 2008 Tom Kralidis
#
# Authors : Tom Kralidis <tomkralidis@hotmail.com>
#
# Contact email: tomkralidis@hotmail.com
# ============================================================... | bsd-3-clause | Python | |
97986e04da50feef13cf457f963e8210a01e426e | Add a mtpd dependency to glib. Speculative fix for the Linux clang buildbot. | pozdnyakov/chromium-crosswalk,mogoweb/chromium-crosswalk,junmin-zhu/chromium-rivertrail,hujiajie/pa-chromium,anirudhSK/chromium,chuan9/chromium-crosswalk,pozdnyakov/chromium-crosswalk,ltilve/chromium,anirudhSK/chromium,zcbenz/cefode-chromium,patrickm/chromium.src,junmin-zhu/chromium-rivertrail,chuan9/chromium-crosswalk... | third_party/mtpd/mtpd.gyp | third_party/mtpd/mtpd.gyp | # Copyright (c) 2012 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.
{
'targets': [
{
'target_name': 'mtpd',
'type': 'executable',
'dependencies': [
'../../base/base.gyp:base',
'../.... | # Copyright (c) 2012 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.
{
'targets': [
{
'target_name': 'mtpd',
'type': 'executable',
'dependencies': [
'../../base/base.gyp:base',
'../.... | bsd-3-clause | Python |
145d90259715e826ac88f86715e5a7215f3800ac | Add job to create CIViC VCF | genome/civic-server,genome/civic-server,genome/civic-server,genome/civic-server,genome/civic-server | app/jobs/create_civic_vcf.py | app/jobs/create_civic_vcf.py | class CreateCivicVcf < ActiveJob::Base
def perform
system("python3 #{script_path} #{vcf_path}")
self.class.set(wait_until: Date.tomorrow.midnight).perform_later
end
def script_path
File.join(Rails.root, 'misc_scripts', 'create_civic_vcf.py')
end
private
def civicpy_cache_file_location
File... | mit | Python | |
8fac2cf0cb4d7b530670797ef1c2731238dfa655 | Add patch to delete duplicate issues | yashodhank/frappe,vjFaLk/frappe,StrellaGroup/frappe,frappe/frappe,StrellaGroup/frappe,adityahase/frappe,mhbu50/frappe,saurabh6790/frappe,StrellaGroup/frappe,vjFaLk/frappe,almeidapaulopt/frappe,frappe/frappe,almeidapaulopt/frappe,saurabh6790/frappe,yashodhank/frappe,saurabh6790/frappe,yashodhank/frappe,yashodhank/frappe... | frappe/patches/v12_0/delete_duplicate_indexes.py | frappe/patches/v12_0/delete_duplicate_indexes.py | import frappe
# This patch deletes all the duplicate indexes created for same column
# The patch only checks for indexes with UNIQUE constraints
def execute():
all_tables = frappe.db.get_tables()
final_deletion_map = frappe._dict()
for table in all_tables:
indexes_to_keep_map = frappe._dict()
indexes_to_dele... | mit | Python | |
4bc5d66060b75e63e88a76c8de2f3511d8033546 | Add numerous (14) tests for profile_line() | GaZ3ll3/scikit-image,GaZ3ll3/scikit-image,ClinicalGraphics/scikit-image,bennlich/scikit-image,Britefury/scikit-image,ofgulban/scikit-image,ajaybhat/scikit-image,SamHames/scikit-image,oew1v07/scikit-image,youprofit/scikit-image,rjeli/scikit-image,robintw/scikit-image,juliusbierk/scikit-image,robintw/scikit-image,bsipocz... | skimage/measure/tests/test_profile.py | skimage/measure/tests/test_profile.py | from numpy.testing import assert_equal, assert_almost_equal
import numpy as np
from skimage.measure import profile_line
image = np.arange(100).reshape((10, 10)).astype(np.float)
def test_horizontal_rightward():
prof = profile_line(image, (0, 2), (0, 8), order=0)
expected_prof = np.arange(2, 9)
assert_equ... | bsd-3-clause | Python | |
ce2b07b9f1823201e4317eb5bf12e171c031b0e0 | Add gmdtool for converting GMD files into separate MIDI tracks. | njankowski/dftools | gmdtool.py | gmdtool.py | import argparse
import glob
import os
from formats import gmd
args = None
def convert_gmd():
music_files = glob.glob(args.file)
for music_file in music_files:
music_name = os.path.splitext(music_file)[0]
print('Converting "' + music_name + '"')
tracks = gmd.to_midis(gmd.read(music_fi... | isc | Python | |
aa158e2d97b6d0e18b0bd2e2e7504c794e61064b | add script to make merged calls for all regions in one file | glennhickey/hgvm-graph-bakeoff-evaluations,glennhickey/hgvm-graph-bakeoff-evalutations,BD2KGenomics/hgvm-graph-bakeoff-evalutations,glennhickey/hgvm-graph-bakeoff-evalutations,adamnovak/hgvm-graph-bakeoff-evaluations,BD2KGenomics/hgvm-graph-bakeoff-evalutations,glennhickey/hgvm-graph-bakeoff-evaluations,adamnovak/hgvm-... | scripts/callTotals.py | scripts/callTotals.py | #!/usr/bin/env python2.7
"""
Run as second pass after all call(s) of callVariants. Makes a total calls directory by merging VCFs
Other outputs (vgs and gams) are *not* merged -- just vcfs.
Needs rtg tools
"""
import argparse, sys, os, os.path, random, subprocess, shutil, itertools, glob
import doctest, re, json, coll... | mit | Python | |
c41a48dc519a25c968ac03ef1ca3bb92b8488590 | test script for api | eig-2017/the-magical-csv-merge-machine,eig-2017/the-magical-csv-merge-machine,eig-2017/the-magical-csv-merge-machine | merge_machine/test_api.py | merge_machine/test_api.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 3 15:48:18 2017
@author: leo
"""
import json
import requests
import urllib2
protocol = 'http://'
host = '127.0.0.1:5000/'
# List projects
to_append = 'admin/list_projects'
url = protocol + host + to_append
resp = requests.get(url)
if resp.ok:... | mit | Python | |
ff3108fa20389181b94d3f4ffbb871c71b8c5d13 | Create script.py | JohnLi2012/LitigationSupport,JohnLi2012/LitigationSupport | Scripts/directory_report_script/script.py | Scripts/directory_report_script/script.py | ## To break down a folder by { file ext: count}
## for example, if you point d to a production volume, you will expect to see
## something like this {'.OPT': 1, '.TIF': 6015, '.LFP': 1, '.TXT': 408, '.DII': 1, '.CSV': 1, '.DAT': 2}
## which means in the production there are 6015 tif files, 408 text files, and 1 opt, lf... | mit | Python | |
116017187d129e23df3abe19a35b0c5f92e029d9 | add tests | pedesen/plogx,pedesen/plogx | plogx/tests.py | plogx/tests.py | import unittest
from pymongo import MongoClient
from datetime import datetime
import database
class TestMongoDBFunctions(unittest.TestCase):
def setUp(self):
self.client = MongoClient()
self.db = self.client.test_db
self.dummy_log_items = [{
'path': u'/abc',
'timest... | mit | Python | |
4e6c5c3aac3f3f5ec7e3f9b7572fae42ee3db36c | Test the core apps | Candihub/pixel,Candihub/pixel,Candihub/pixel,Candihub/pixel,Candihub/pixel | apps/core/tests/test_apps.py | apps/core/tests/test_apps.py | from django.apps import apps
from django.test import TestCase
from ..apps import CoreConfig
class CoreConfigTestCase(TestCase):
def test_config(self):
expected = 'core'
self.assertEqual(CoreConfig.name, expected)
expected = 'apps.core'
self.assertEqual(apps.get_app_config('core... | bsd-3-clause | Python | |
dffeef8f09c03d4f759084d93e59569c2ef7eae5 | Create icogen.py | joshhartigan/semicircle,joshhartigan/semicircle,joshhartigan/semicircle,joshhartigan/semicircle,joshhartigan/semicircle,joshhartigan/semicircle,joshhartigan/semicircle,joshhartigan/semicircle,joshhartigan/semicircle,joshhartigan/semicircle,joshhartigan/semicircle | code/icogen.py | code/icogen.py | import pygame
import random
import sys
from pygame.locals import *
WIDTH = 500
HEIGHT = 500
screen = pygame.display.set_mode((WIDTH, HEIGHT))
screen.fill(pygame.Color("#e8e8e8"))
pygame.display.set_caption("icogen")
def draw_icon(r, g, b):
for x in range(5):
for y in range(5):
red = random.randrange(r)
... | bsd-2-clause | Python | |
cb26f56c47e8125f9ac09ddfcd952fc42a9c3669 | Add name to family member | wearespindle/quickly.press,wearespindle/quickly.press,wearespindle/quickly.press | quickly/families/migrations/0002_familymember_name.py | quickly/families/migrations/0002_familymember_name.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-05-17 16:49
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('families', '0001_initial'),
]
operations = [
migrations.AddField(
... | mit | Python | |
e838e52046e5d42aeee49eab3e2cae38aa079743 | Create helpers.py | henrik645/rpp | helpers.py | helpers.py | def tokenize(program, expressions):
pos = 0
tokens = []
match = None
while pos < len(program):
for expression in expressions:
pattern, tag = expression
regex = re.compile(pattern)
match = regex.match(characters, pos)
if match:
text ... | mit | Python | |
c2e5f43adba4de183ec7b0b6a6bc289d6b115c82 | Use file-sequestering for zynq-inversek2j | jck/accept,jck/accept,uwsampa/accept,jck/accept,uwsampa/accept,uwsampa/accept,uwsampa/accept,jck/accept | apps/zynq-inversek2j/eval.py | apps/zynq-inversek2j/eval.py | def load():
return 'file:output.txt'
def _load(fn):
pairs = []
with open('output.txt') as f:
for line in f:
line = line.strip()
if not line:
continue
parts = line.split()
if len(parts) == 2:
try:
... | def load():
pairs = []
with open('output.txt') as f:
for line in f:
line = line.strip()
if not line:
continue
parts = line.split()
if len(parts) == 2:
try:
parts = map(float, parts)
exce... | mit | Python |
46667cca1a4f6ac069906d42150097fc6582b1e7 | Create recommedation.py | firiceguo/Recommendation-NLP,firiceguo/Recommendation-NLP | src/zhang/recommedation.py | src/zhang/recommedation.py | import json
from pyspark.sql.functions import col
from pyspark.ml.evaluation import RegressionEvaluator
from pyspark.ml.recommendation import ALS
from pyspark.sql import Row
from pyspark.sql.window import Window
from pyspark.sql.functions import rank, col
from pyspark.sql import functions as F
def GetRecomList(predict... | mit | Python | |
fee9c862334bfd290a2b9bd1e07b93badfb66ae5 | Add failing test for get_all_names. | letsencrypt/letsencrypt,lmcro/letsencrypt,stweil/letsencrypt,lmcro/letsencrypt,letsencrypt/letsencrypt,stweil/letsencrypt | letsencrypt-postfix/TestPostfixConfigGenerator.py | letsencrypt-postfix/TestPostfixConfigGenerator.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import io
import logging
import unittest
import Config
import PostfixConfigGenerator as pcg
logger = logging.getLogger(_... | apache-2.0 | Python | |
fc4204dc04636a5a9cd5486d714d7b2e91ebfda6 | add jpg compression plugin (think needsmorejpeg) | Rj48/ircbot,Rouji/Yui | plugins/jpg.py | plugins/jpg.py | # coding = utf-8
import re
import humanize
import requests
from PIL import Image
from io import BytesIO
HOST = yui.config_val('jpg', 'host', default='https://x0.at/')
MAX_SIZE = yui.config_val('jpg', 'maxSize', default=20 * 1024 * 1024)
QUALITY = yui.config_val('jpg', 'quality', default=70)
RESIZE = yui.config_val('j... | mit | Python | |
811e990fb13d17f54b7772f25bbde5bb09c9706d | Add parallel.py | Neurita/boyle | boyle/parallel.py | boyle/parallel.py | # -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
# Alexandre Manhaes Savio <alexsavio@gmail.com>
# Grupo de Inteligencia Computational <www.ehu.es/ccwintco>
#
# BSD 3-Clause License
#
# 2015, Alexandre Manhaes Savio
# Use this at your own risk!
# ----------------... | bsd-3-clause | Python | |
cbed1067fd2ad1bf7ed98bce314ebec9a4a36ffe | Add performance measurement helper. | why2pac/dp-tornado,why2pac/dp-tornado,why2pac/dp-tornado,why2pac/dp-tornado | helper/performance.py | helper/performance.py | #
# dp for Tornado
# YoungYong Park (youngyongpark@gmail.com)
# 2014.10.23
#
from __future__ import absolute_import
from engine.helper import Helper as dpHelper
import time
import datetime
class PerformanceMeasurement(object):
def __init__(self, log_prefix, enabled):
self._log_prefix = log_prefix
... | mit | Python | |
c1fd1e5c8478a040c6f4693be3ba4a13cf12fe9e | Stop word filter helper | AFFogarty/SEP-Bot,AFFogarty/SEP-Bot | helpers/stop_words.py | helpers/stop_words.py | import json
class StopWordFilter():
file_name = "stop_words.json"
stop_word_set = None
def __init__(self):
self.stop_word_set = set()
self._load_stop_words()
def _load_stop_words(self):
try:
file = open(self.file_name, 'r')
except IOError:
retu... | mit | Python | |
4d531a4ae2036785dffbb67d96fe013c7ca44784 | Add management command to send welcome email | pculture/mirocommunity,pculture/mirocommunity,pculture/mirocommunity,pculture/mirocommunity | localtv/management/commands/send_welcome_email.py | localtv/management/commands/send_welcome_email.py | # Copyright 2011 - Participatory Culture Foundation
#
# This file is part of Miro Community.
#
# Miro Community is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at ... | agpl-3.0 | Python | |
9e9a000013008e773f35595ebe2a93a8b58ceb92 | Implement safe_eval() in order to armour eval() | akretion/openerp-server,akretion/openerp-server,akretion/openerp-server | bin/tools/safe_eval.py | bin/tools/safe_eval.py | # -*- encoding: utf-8 -*-
#
# Copyright P. Christeas <p_christ@hol.gr> 2008,2009
#
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are look... | agpl-3.0 | Python | |
518dd9401b41fc02c815ee6e0ca3b6b113d87f43 | Add a test that makes a new guide stats database | sot/mica,sot/mica | mica/stats/tests/test_guide_stats.py | mica/stats/tests/test_guide_stats.py | import tempfile
import os
from .. import guide_stats
def test_calc_stats():
guide_stats.calc_stats(17210)
def test_make_gui_stats():
"""
Save the guide stats for one obsid into a newly-created table
"""
# Get a temporary file, but then delete it, because _save_acq_stats will only
# make a n... | bsd-3-clause | Python | |
5636aa3f50763367435ed97408dd6ae56d5df509 | add gpu reconstruct script | paulu/deepmanifold,paulu/deepart,paulu/deepart,paulu/deepart,paulu/deepmanifold,paulu/deepmanifold | reconstruct_amos.py | reconstruct_amos.py | #!/usr/bin/env python2
from __future__ import division
from __future__ import with_statement
from __future__ import print_function
import subprocess
import pipes
import sys
import dmt
if __name__=='__main__':
args=sys.argv[1:]
subprocess.check_call(['rsync','-avzP','mrmaster:/isis2b/git/deepmanifold/{}'.format... | mit | Python | |
82d7f91771ed29163823190ae5234dd725a0f4e2 | Test for invert_no_zero. | radiocosmology/draco,radiocosmology/draco | test/test_tools.py | test/test_tools.py | import numpy as np
import pytest
from draco.util.random import _default_bitgen
from draco.util.tools import invert_no_zero
ARRAY_SIZE = (100, 111)
SEED = 12345
ATOL = 0.0
rng = np.random.Generator(_default_bitgen(SEED))
random_float_array = rng.standard_normal(size=ARRAY_SIZE, dtype=np.float32)
random_double_array =... | mit | Python | |
0f5de6aeae62337797993697307335276fd1d11a | Add solution to problme 5 | gidj/euler,gidj/euler | python/005_smallest_multiple/smallest_multiple.py | python/005_smallest_multiple/smallest_multiple.py | from collections import Counter
from functools import reduce
from operator import mul
from typing import Generator
_range = tuple(range(2, 21))
def _factor_generator(number: int) -> Generator:
while number % 2 == 0:
number = number / 2
yield 2
cursor = 3
while cursor <= number:
if... | bsd-3-clause | Python | |
0124b73484aeb6a35b036842f382f7445fcec258 | Add a gray_code_sequence.py file to the bit_manipulation folder (#5038) | TheAlgorithms/Python | bit_manipulation/gray_code_sequence.py | bit_manipulation/gray_code_sequence.py | def gray_code(bit_count: int) -> list:
"""
Takes in an integer n and returns a n-bit
gray code sequence
An n-bit gray code sequence is a sequence of 2^n
integers where:
a) Every integer is between [0,2^n -1] inclusive
b) The sequence begins with 0
c) An integer appears at most one times... | mit | Python | |
5f53dae25568d79692d77959895e2db43127e292 | Implement channel mode +b | DesertBus/txircd,ElementalAlchemist/txircd,Heufneutje/txircd | txircd/modules/cmode_b.py | txircd/modules/cmode_b.py | # TODO: make sane before committing
from twisted.words.protocols import irc
from txircd.modbase import Mode
from txircd.utils import irc_lower, epoch, now, CaseInsensitiveDictionary
from fnmatch import fnmatch
class BanMode(Mode):
def __init__(self):
self.banMetadata = CaseInsensitiveDictionary()
def checkSet(s... | bsd-3-clause | Python | |
62e8b8ddfa875c4038df3ea2e426e8f46510fb53 | add test for MUC handle ownership | Ziemin/telepathy-gabble,community-ssu/telepathy-gabble,Ziemin/telepathy-gabble,jku/telepathy-gabble,jku/telepathy-gabble,mlundblad/telepathy-gabble,Ziemin/telepathy-gabble,Ziemin/telepathy-gabble,community-ssu/telepathy-gabble,community-ssu/telepathy-gabble,jku/telepathy-gabble,community-ssu/telepathy-gabble,mlundblad/... | tests/test-muc-ownership.py | tests/test-muc-ownership.py |
"""
Test support for the HANDLE_OWNERS_NOT_AVAILABLE group flag, and calling
GetHandleOwners on MUC members.
By default, MUC channels should have the flag set. The flag should be unset
when presence is received that includes the MUC JID's owner JID.
"""
import dbus
from twisted.words.xish import domish, xpath
from... | lgpl-2.1 | Python | |
ba4d52533258f8ee66d90df5c9bee9585c6c79d9 | Add tests for config_reader. | gannon93/gkit_utils | tests/test_config_reader.py | tests/test_config_reader.py | import unittest
import os
from .context import config_reader
BASEDIR = './tests'
DATA_DIR = os.path.join(BASEDIR, 'dat')
class ConfigReaderTests(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_read_config(self):
test_file = os.path.join(DATA_DIR, 't... | mit | Python | |
5a87cd4d7308b3f592855c27a4d5ef2d4f7fc36f | Create schedule_scraper.py | ZackWhiteIT/pickem | schedule_scraper.py | schedule_scraper.py | """
Web Scraper to Get Schedule
"""
import os
import sys
from bs4 import BeautifulSoup
from lxml import html
import requests
def scrape(url):
# headers = {'User-Agent': 'Mozilla/5.0'}
# page = requests.get(url, headers=headers)
soup = BeautifulSoup(open('espn.html'), 'lxml')
tables = soup.find_all('tab... | mit | Python | |
2c200e38897b27cefeaedf97493bbbf7365ee0dd | add TmpVariable class | Nic30/hwtHls,Nic30/hwtHls,Nic30/hwtHls | hwtHls/tmpVariable.py | hwtHls/tmpVariable.py | from hwt.synthesizer.rtlLevel.mainBases import RtlSignalBase
from hwt.synthesizer.rtlLevel.rtlSignal import RtlSignal
class TmpVariable(RtlSignalBase):
def __init__(self, origin: RtlSignal):
self.origin = origin
self.i = None
self._const = False
@property
def _dtype(self):
... | mit | Python | |
518558b62ce0a142115a58fdb6f8a8a33385d749 | test for boolean. | Swall0w/clib | tests/utils/test_boolian.py | tests/utils/test_boolian.py | import unittest
from clib.utils import randombool
class RandomBoolTest(unittest.TestCase):
def test_randombool(self):
self.assertIsInstance(randombool(), bool)
| mit | Python | |
0f95ad2a85054653b7b54a1ef1f0abd04f4f40bb | add convinience wrapper object for KV data | abn/python-cafe-consul | cafe/consul/kv.py | cafe/consul/kv.py | class KVData(object):
def __init__(self, data=None):
if data is None:
raise ValueError('data is expected to be a dictionary')
self.LockIndex = data.get('LockIndex')
self.ModifyIndex = data.get('ModifyIndex')
self.CreateIndex = data.get('CreateIndex')
self.Value = ... | apache-2.0 | Python | |
809c87f3f089d4777cf710ce03dda431dd4e4355 | add test case for i18n | Maxence1/flask-wtf,Maxence1/flask-wtf | tests/test_i18n.py | tests/test_i18n.py | from __future__ import with_statement
from base import TestCase
class TestValidateOnSubmit(TestCase):
def test_submitted_and_valid(self):
self.app.config['CSRF_ENABLED'] = False
response = self.client.post(
"/",
headers={'Accept-Language': 'zh-CN,zh;q=0.8'},
d... | bsd-3-clause | Python | |
d309fc91a225c14a28b88be1986a0edd99ac0ce1 | Update migrations | ukgovdatascience/classifyintentsapp,ukgovdatascience/classifyintentsapp | migrations/versions/c6b8a822a928_.py | migrations/versions/c6b8a822a928_.py | """empty message
Revision ID: c6b8a822a928
Revises: 7b6db31373a3
Create Date: 2017-05-02 20:58:29.065050
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'c6b8a822a928'
down_revision = '7b6db31373a3'
branch_labels = None
depends_on = None
def upgrade():
# ... | mit | Python | |
e1b2ab01054719e5d3fcde13e877d64318ce8e2f | add new package (#25020) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-pretrainedmodels/package.py | var/spack/repos/builtin/packages/py-pretrainedmodels/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 PyPretrainedmodels(PythonPackage):
"""Pretrained models for Pytorch."""
homepage = "h... | lgpl-2.1 | Python | |
10e8ace7c04ef3f200ad0f2077ecc37b45827faf | change access mode | yasokada/python-151113-lineMonitor,yasokada/python-151113-lineMonitor | toLearn/151203a.py | toLearn/151203a.py | import os
from stat import *
os.chmod('aaa.txt', S_IWUSR | S_IRUSR | S_IRGRP | S_IWOTH | S_IROTH)
| mit | Python | |
59fff8308ee4d37c1a0770b3d80b07aeaec44bbe | Fix misleading comment in wsgi loader | Juniper/nova,phenoxim/nova,hanlind/nova,rajalokan/nova,sebrandon1/nova,vmturbo/nova,cloudbase/nova,mahak/nova,mikalstill/nova,jianghuaw/nova,mikalstill/nova,hanlind/nova,phenoxim/nova,klmitch/nova,klmitch/nova,rahulunair/nova,sebrandon1/nova,mahak/nova,rahulunair/nova,rajalokan/nova,openstack/nova,openstack/nova,alaski... | nova/api/openstack/placement/wsgi.py | nova/api/openstack/placement/wsgi.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | apache-2.0 | Python |
4b125b0d6f1c3710499be585b08ecf70663415c3 | Set post stat on draft by default | oktomus/website,oktomus/website,oktomus/website | work/migrations/0002_auto_20170810_1630.py | work/migrations/0002_auto_20170810_1630.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-08-10 14:30
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('work', '0001_initial'),
]
operations = [
migrations.AlterField(
... | mit | Python | |
fb1107059ad4e04d010aa1b8a4299ef1ddaac981 | Add set_tcp_keepalive function for zeromq | pengyao/salt-broker,pengyao/salt-broker | saltbroker/utils/zeromq.py | saltbroker/utils/zeromq.py | # -*- coding: utf-8 -*-
# Import python libs
import logging
# Import third party libs
import zmq
log = logging.getLogger(__name__)
def set_tcp_keepalive(sock, opts=None):
# Warn if ZMQ < 3.2
try:
zmq_version_info = zmq.zmq_version_info()
except AttributeError:
# PyZMQ <= 2.1.9 does not h... | apache-2.0 | Python | |
1d6c17e5adc3df4de86636ef77fc0a406bf065e9 | Add custom normaluze function that will not get non existant items | icereval/scrapi,CenterForOpenScience/scrapi,fabianvf/scrapi,mehanig/scrapi,alexgarciac/scrapi,erinspace/scrapi,felliott/scrapi,felliott/scrapi,CenterForOpenScience/scrapi,erinspace/scrapi,ostwald/scrapi,fabianvf/scrapi,jeffreyliu3230/scrapi,mehanig/scrapi | scrapi/harvesters/dryad.py | scrapi/harvesters/dryad.py | '''
Harvester for Dryad for the SHARE project
Example API call: http://www.datadryad.org/oai/request?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals
from lxml import etree
import logging
from scrapi.base import OAIHarvester
logger = logging.getLogger(__name__)
class DryadHarvest... | '''
Harvester for Dryad for the SHARE project
Example API call: http://www.datadryad.org/oai/request?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals
from scrapi.base import OAIHarvester
class DryadHarvester(OAIHarvester):
short_name = 'dryad'
long_name = 'Dryad Data Reposi... | apache-2.0 | Python |
741290d1fccdaeee50f7a39889f82f5b37104f03 | Add test_data_example | Fiile/qsctl,yunify/qsctl | tests/test_data_example.py | tests/test_data_example.py | zone = ''
valid_bucket = ''
invalid_bucket = ''
retry_wait_time = 3
max_retries = 60
| apache-2.0 | Python | |
69f0a30d8ff68bb2588625a171cb739d80350f6c | add ircv32 features | merc-devel/merc | merc/features/ircv32/__init__.py | merc/features/ircv32/__init__.py | __all__ = ["chghost"]
import importlib
import imp
def install(app):
for name in __all__:
imp.reload(importlib.import_module("." + name, __name__)).install(app)
| mit | Python | |
3f54cb7353f110afca40722a182788f25e660965 | Add a new snippet 'python/tree_structure_tictactoe'. | jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets,jeremiedecock/snippets | python/tree_structure_tictactoe/tree_traversal.py | python/tree_structure_tictactoe/tree_traversal.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012 Jérémie DECOCK (http://www.jdhp.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 withou... | mit | Python | |
3e1a8edcd06aade3252860a99d64eca94e5f7b71 | Add inconsequential migration | ukch/refugeedata,ukch/refugeedata,ukch/refugeedata,ukch/refugeedata | refugeedata/migrations/0006_auto_20150919_1917.py | refugeedata/migrations/0006_auto_20150919_1917.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('refugeedata', '0005_person_number_of_dependents'),
]
operations = [
migrations.AlterField(
model_name='person',
... | mit | Python | |
5a30e5795f70119b12910ca89f2d331b412d6c51 | add package at v2.13 (#22136) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/libapreq2/package.py | var/spack/repos/builtin/packages/libapreq2/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 Libapreq2(AutotoolsPackage):
"""httpd-apreq is subproject of the Apache HTTP Server Projec... | lgpl-2.1 | Python | |
5795f1d7da9a1d792be6c9ee06a954065054ca1a | Add Totalview package (#17643) | LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/totalview/package.py | var/spack/repos/builtin/packages/totalview/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import os
class Totalview(Package):
"""Totalview parallel debugger.
Source must be made av... | lgpl-2.1 | Python | |
c9c7b13fc03dced397f9841d52379f6025175ec3 | Add model_skeleton | amygdala/tensorflow-workshop,amygdala/tensorflow-workshop,amygdala/tensorflow-workshop,amygdala/tensorflow-workshop | workshop_sections/word2vec/word2vec/model_skeleton.py | workshop_sections/word2vec/word2vec/model_skeleton.py | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 | Python | |
339438e97f91958b1fc0cb1c2d85b3c6d97a1efa | Add dummy config file so that tests work. | salilab/allosmod-lib,salilab/allosmod-lib,salilab/allosmod-lib,salilab/allosmod-lib,salilab/allosmod-lib | lib/allosmod/config/__init__.py | lib/allosmod/config/__init__.py | # Dummy config; should not be installed. This is here simply so that the
# test suite works.
import os
datadir = os.path.join(os.path.abspath(os.path.dirname(__file__)),
'..', '..', '..', 'data')
local_scratch='/tmp'
global_scratch='/scrapp'
| lgpl-2.1 | Python | |
176d63f35ae4da06fe4608495b41244d02f9e682 | Create transformations.py | JeffSpies/nonwordlist,CenterForOpenScience/guid-filter | transformations.py | transformations.py | import itertools
import re
def vowel_expand(word, max_size, vowels=['a','e','i','o','u']):
results = []
found_list = list(re.finditer('['+''.join(vowels)+']', word))
for combination in itertools.product(range(0,2), repeat=len(found_list)):
if sum(combination) == 1:
for i, do_process in ... | apache-2.0 | Python | |
e31f80988c50f0d4db863ee0cfe5b3f23fdf5e73 | Add support for an older version of STAR (#4385) | skosukhin/spack,tmerrick1/spack,iulian787/spack,mfherbst/spack,krafczyk/spack,matthiasdiener/spack,iulian787/spack,mfherbst/spack,EmreAtes/spack,mfherbst/spack,tmerrick1/spack,skosukhin/spack,TheTimmy/spack,matthiasdiener/spack,matthiasdiener/spack,EmreAtes/spack,iulian787/spack,LLNL/spack,TheTimmy/spack,EmreAtes/spack... | var/spack/repos/builtin/packages/star/package.py | var/spack/repos/builtin/packages/star/package.py | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python |
64d6c675946980d29c0b94d741391bdc8a226ce9 | Add Color.py | rec/echomesh,rec/echomesh,rec/echomesh,rec/echomesh,rec/echomesh,rec/echomesh | code/python/echomesh/graphics/Color.py | code/python/echomesh/graphics/Color.py | from __future__ import absolute_import, division, print_function, unicode_literals
import colorsys
import numpy
from echomesh.graphics import GammaTable
class Model(tuple):
def __init__(self, values):
super(Model, self).__init__(values)
@classmethod
def from_rgb(cls, r, g, b):
return cls(*cls.FROM_MET... | mit | Python | |
60c99b91cede21a509030f276684bb2ff706ec3c | Add test for window module | miyakogi/wdom,miyakogi/wdom,miyakogi/wdom | wdom/tests/test_window.py | wdom/tests/test_window.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from time import sleep
from unittest.mock import MagicMock
from wdom.document import get_document
from wdom.server import _tornado
from wdom.server.handler import event_handler
from wdom.testing import TestCase
from wdom.window import customElements
class TestWindow(Te... | mit | Python | |
00b35fc6373ec290d92b4b6aa71972b1f9d94105 | Add Jenkins Python3 monster to dials, but don't enable it here yet. | dials/dials,dials/dials,dials/dials,dials/dials,dials/dials | test/python3_regression.py | test/python3_regression.py | from __future__ import absolute_import, division, print_function
import os
def find_new_python3_incompatible_code(module_under_test):
'''
Check source code to see if any files violate Python 3 syntax that
previously did not. Example call:
def test_find_python3_violations():
import xia2
impo... | bsd-3-clause | Python | |
b98ff8fe3c991608f0fe3e4cd84b2661e13e6744 | add stress test | willmcgugan/rich | tools/stress_test_pretty.py | tools/stress_test_pretty.py | from rich.console import Console
from rich.pretty import Pretty
DATA = {
"foo": [1, 2, 3, (1, 2, 3), {4, 5, 6, (7, 8, 9)}, "Hello, World"],
"bar": [None, False, True],
}
console = Console()
for w in range(100):
console.print(DATA, width=w)
| mit | Python | |
3456f42fd0d0377477d3ef3bb247654f637de99e | add quickplot | imrehg/labhardware,imrehg/labhardware | projects/gwmultilog/quickplot.py | projects/gwmultilog/quickplot.py | import numpy as np
import pylab as pl
import sys
sys.path.append('../../lablib')
import ourgui
filename = ourgui.openFile()
dtypes = {'names': ['date', 'value', 'unit'],
'formats': ['f8', 'f4', 'S1']}
data = np.loadtxt(filename,
delimiter=",",
dtype=dtypes,
... | mit | Python | |
4896426059b5d4ab4afd88c2b1deb2b592e23309 | Add first test. | tlamer/teres,tlamer/teres | tests/test_bkr_handlers.py | tests/test_bkr_handlers.py | from __future__ import print_function
import unittest
import sys, os
my_path = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, my_path + '/../')
import requests
import teres
import teres.bkr_handlers
ENV = not bool(os.environ.get("BEAKER_RECIPE_ID") and os.environ.get("BEAKER_LAB_CONTROLLER_URL"))
@un... | lgpl-2.1 | Python | |
96ac17a9c4d12c147ad833ad87a28face05374e0 | test extents' mouse interaction | bopen/ckanext-mapsearch,bopen/ckanext-mapsearch | tests/test_click_extent.py | tests/test_click_extent.py | import unittest
from time import sleep
from helpers import wait_for_ajaxes_to_complete
from helpers import get_result_stats
from helpers import reload_datasets
from selenium import webdriver
class TestExtents(unittest.TestCase):
def setUp(self):
try:
self.driver = webdriver.Firefox()
... | agpl-3.0 | Python | |
5ba0123df1a1aa56227e230dee6ff17dd68429f1 | add pruner plugin | jab1982/opennsa,NORDUnet/opennsa,jab1982/opennsa,NORDUnet/opennsa,NORDUnet/opennsa | opennsa/plugins/pruner.py | opennsa/plugins/pruner.py | """
Plugin to prune paths in order to help the probabilty that a path setup will succeed.
Mostly to work around limitations on certain network equipment, NRM,
and NSI agent implementations.
Author: Henrik Thostrup Jensen < htj at nordu dot net >
Copyright: NORDUnet A/S (2014)
"""
from zope.interface import implemen... | bsd-3-clause | Python | |
696d8bc76c51ab67c41204c92b557b54a96ff310 | add profiler | un33k/django-toolware,un33k/django-toolware | toolware/utils/profiler.py | toolware/utils/profiler.py | import cProfile
import functools
def profileit(func):
@functools.wraps(func) # retain docstring and func name
def wrapper(*args, **kwargs):
datafn = func.__name__ + ".profile" # file name
prof = cProfile.Profile()
retval = prof.runcall(func, *args, **kwargs)
prof.dump_stats(da... | mit | Python | |
d6f61a5668e7ec83c062cc289bcbac13a5aa7bc7 | Create App.py | Fillll/reddit2telegram,Fillll/reddit2telegram | reddit2telegram/channels/avatarmemes/app.py | reddit2telegram/channels/avatarmemes/app.py | #encoding:utf-8
subreddit = 'avatarmemes'
t_channel = '@r_avatar_memes'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| mit | Python | |
b1dceafd153506f602bd091cb202c28ee2e5a756 | Add INJECT-QMK command. | kivhift/qmk,kivhift/qmk | src/commands/inject-qmk.py | src/commands/inject-qmk.py | #
# Copyright (c) 2012 Joshua Hughes <kivhift@gmail.com>
#
import qmk
class InjectQMKCommand(qmk.Command):
'''Inject the QMK.'''
def __init__(self):
super(InjectQMKCommand, self).__init__(self)
self._name = 'INJECT-QMK'
self._help = self.__doc__
def action(self, arg):
qmk.I... | mit | Python | |
b0fcd5091c83256e05213d16d8f3c26c19097dfa | Change the "deps" of tf_py_logged_benchmark rule from a py_binary to a py_library rule. | yongtang/tensorflow,paolodedios/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,yongtang/tensorflow,yongtang/tensorflow,gautam1858/tensorflow,Intel-t... | tensorflow/tools/test/performance.bzl | tensorflow/tools/test/performance.bzl | load("//tensorflow:tensorflow.bzl", "tf_py_test")
# Create a benchmark test target of a TensorFlow C++ test (tf_cc_*_test)
def tf_cc_logged_benchmark(
name = None,
target = None,
benchmarks = "..",
tags = [],
benchmark_type = "cpp_microbenchmark",
**kwargs):
if not n... | load("//tensorflow:tensorflow.bzl", "tf_py_test")
# Create a benchmark test target of a TensorFlow C++ test (tf_cc_*_test)
def tf_cc_logged_benchmark(
name = None,
target = None,
benchmarks = "..",
tags = [],
benchmark_type = "cpp_microbenchmark",
**kwargs):
if not n... | apache-2.0 | Python |
f88707fd7c02dee4843e661e291e6ea1daa8f241 | add pollutionController | elvian/alfred,elvian/alfred,elvian/alfred | pollutionController.py | pollutionController.py | #!/usr/bin/env python
from bs4 import BeautifulSoup
from urllib.request import urlopen
def getSoupAQHI():
html = urlopen("http://www.aqhi.gov.hk/en/aqhi/past-24-hours-aqhi45fd.html?stationid=80")
soup = BeautifulSoup(html)
return soup
def getLatestAQHI(dataTable):
aqhiTable = dataTable.findAll('tr')[1].findAll('... | mit | Python | |
8fb23f57d85f3ce152b8117c02d1fea5b5af8ca8 | Add tests package | rijkstofberg/pyramid.payment | pyramidpayment/tests/__init__.py | pyramidpayment/tests/__init__.py | #
| mit | Python | |
49b8df3387e6839bc2e0025ec8d2454ab61654a2 | Create a helper to check for differences in dataframes | fedspendingtransparency/data-act-broker-backend,fedspendingtransparency/data-act-broker-backend | dataactbroker/helpers/pandas_helper.py | dataactbroker/helpers/pandas_helper.py | import pandas as pd
from dataactcore.interfaces.db import GlobalDB
def check_dataframe_diff(new_data, model, id_col, sort_cols, lambda_funcs=None):
""" Checks if 2 dataframes (the new data and the existing data for a model) are different.
Args:
new_data: dataframe containing the new data to ... | cc0-1.0 | Python | |
5144bd6583765ed0b884a198906cbe0bacff6f1d | Add editor context | guillermooo/dart-sublime-bundle,guillermooo/dart-sublime-bundle,guillermooo/dart-sublime-bundle,guillermooo/dart-sublime-bundle,guillermooo-forks/dart-sublime-bundle,guillermooo-forks/dart-sublime-bundle,guillermooo-forks/dart-sublime-bundle,guillermooo-forks/dart-sublime-bundle | lib/editor_context.py | lib/editor_context.py | '''Holds state about the editor.
'''
import threading
class EditorContext(object):
search_id_lock = threading.Lock()
def __init__(self):
self._search_id = None
self.results_panel = None
@property
def search_id(self):
with EditorContext.search_id_lock:
return self... | bsd-3-clause | Python | |
082912c66773599700254c941537f818524e0da0 | Add Lepton high temp example. | kwagyeman/openmv,kwagyeman/openmv,iabdalkader/openmv,iabdalkader/openmv,openmv/openmv,openmv/openmv,openmv/openmv,kwagyeman/openmv,kwagyeman/openmv,iabdalkader/openmv,iabdalkader/openmv,openmv/openmv | scripts/examples/OpenMV/27-Lepton/lepton_get_object_high_temp.py | scripts/examples/OpenMV/27-Lepton/lepton_get_object_high_temp.py | # Lepton Get Object High Temp Example
#
# This example shows off how to get an object's temperature using color tracking.
# By turning the AGC off and setting a max and min temperature range you can make the lepton into
# a great sensor for seeing objects of a particular temperature. That said, the FLIR lepton is a
# ... | mit | Python | |
e71b7370772c722046903b8bf9f5a2634bc626a4 | Improve description | VitalPet/sale-workflow,Antiun/sale-workflow,kittiu/sale-workflow,anas-taji/sale-workflow,fevxie/sale-workflow,Rona111/sale-workflow,gurneyalex/sale-workflow,factorlibre/sale-workflow,jabibi/sale-workflow,akretion/sale-workflow,diagramsoftware/sale-workflow,xpansa/sale-workflow,damdam-s/sale-workflow,BT-cserra/sale-work... | sale_jit_on_services/__openerp__.py | sale_jit_on_services/__openerp__.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 Camptocamp (<http://www.camptocamp.com>)
# Authors: Joel Grand-Guillaume
#
# This program is free software: you can redistribute it and/or ... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 Camptocamp (<http://www.camptocamp.com>)
# Authors: Joel Grand-Guillaume
#
# This program is free software: you can redistribute it and/or ... | agpl-3.0 | Python |
490f16d2efcfa75ee8f9c7865c8d9c83fa04c672 | Add template dag | google/ads-api-report-fetcher,google/ads-api-report-fetcher,google/ads-api-report-fetcher,google/ads-api-report-fetcher | py/airflow_gaarf/src/template_dag.py | py/airflow_gaarf/src/template_dag.py | from typing import Union
import os
from datetime import datetime
import pathlib
import yaml
from airflow.models import DAG
from airflow.operators.dummy import DummyOperator
from airflow.utils.task_group import TaskGroup
from gaarf.io.writer import WriterFactory
from gaarf.io.reader import FileReader
from airflow_ga... | apache-2.0 | Python | |
90ea0b061be91d5f986cf64f41ed5dfe25f47989 | Add initial redhat scanner | SS-RD/pkgcmp | pkgcmp/scanners/redhat.py | pkgcmp/scanners/redhat.py | '''
Scan an Arch Linux repo full of packages and create the data map
'''
# Download packages
# Extract packages, one at a time
# generate list of files in package
# Save package name, version distro and package list
# Import python libs
import os
import shutil
import tempfile
import subprocess
# Import third party lib... | apache-2.0 | Python | |
0d1ce8eaf0329ab6efb6e1bbbb0edca2e78ce649 | Add a test for `qidoc list` | aldebaran/qibuild,aldebaran/qibuild,aldebaran/qibuild,aldebaran/qibuild | python/qidoc/test/test_qidoc_list.py | python/qidoc/test/test_qidoc_list.py | ## Copyright (c) 2012-2015 Aldebaran Robotics. All rights reserved.
## Use of this source code is governed by a BSD-style license that can be
## found in the COPYING file.
def test_simple(qidoc_action, record_messages):
qidoc_action.add_test_project("world")
qidoc_action.add_test_project("libworld")
qidoc_... | bsd-3-clause | Python | |
b6c51e8e17144531ddc13ba0ed3e6d605087183b | Add DOS detection module | b-mueller/mythril,b-mueller/mythril,b-mueller/mythril,b-mueller/mythril | mythril/analysis/modules/dos.py | mythril/analysis/modules/dos.py | """This module contains the detection code for insecure delegate call usage."""
import logging
from typing import List
from mythril.analysis.swc_data import DOS_WITH_BLOCK_GAS_LIMIT
from mythril.analysis.report import Issue
from mythril.analysis.modules.base import DetectionModule
from mythril.laser.ethereum.state.gl... | mit | Python | |
faa3d603d72eb337be9c76e41853661dc7486cdb | Create sortKeysByValues.py | minesh1291/Learning-Python | sortKeysByValues.py | sortKeysByValues.py | def sortVal(x):
import operator
sorted_x = sorted(x.items(), key=operator.itemgetter(1),reverse=True)
return sorted_x
| apache-2.0 | Python | |
e8331abde357ef4de4add7efed94075fe66809ff | Add local_settings.py | NaoY-2501/comnnpass,NaoY-2501/comnnpass | mysite/local_settings.py | mysite/local_settings.py | import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
DEBUG = True
| mit | Python | |
88dd94982afa76c3e450c9b186fa8054979779d3 | Add a script to count changes per node. | Vaishal-shah/Envision,Vaishal-shah/Envision,mgalbier/Envision,Vaishal-shah/Envision,mgalbier/Envision,Vaishal-shah/Envision,lukedirtwalker/Envision,lukedirtwalker/Envision,lukedirtwalker/Envision,mgalbier/Envision,dimitar-asenov/Envision,mgalbier/Envision,Vaishal-shah/Envision,mgalbier/Envision,lukedirtwalker/Envision,... | InformationScripting/test/scripts/countChanges.py | InformationScripting/test/scripts/countChanges.py | # script $<"<changes>" | "<countChanges>" | "<heatmap>">$
# assume single input
input = inputs[0]
commits = input.take("commit")
nodeCounts = {}
for commit in commits:
sha1 = commit.commit
for change in input.take(sha1):
key = getattr(change, sha1)
nodeCounts[key] = nodeCounts.get(key, 0) + 1
... | bsd-3-clause | Python | |
d65b4a4204c954fe89f6d299245e128bae3c0928 | Add : Start of geoloc support via an external API | nocternology/fail2dash,nocternology/fail2dash | core/geoloc.py | core/geoloc.py | import urllib
import json
class Geoloc(object):
"""
Geoloc class definition.
Given an IP adress, this object will try to reverse identify the IP using
a geolocalisation API.
On the return, it will spit back a list with :
* IP adress,
* Longitude,
* Latitude,
* Country,
* Coun... | mit | Python | |
1618ddf389cb5bb39791f028347a62961bd8dc80 | Create dash-listen.py | LarsPedersen/amazon_dash_tcpdump | dash-listen.py | dash-listen.py | import subprocess as sub
from qhue import Bridge
b = Bridge("192.168.0.99", "username")
print b.url
print b.lights[1]()
p = sub.Popen(('sudo', 'tcpdump', '-e', '-i', 'eth0', 'arp', '-l'), stdout=sub.PIPE)
for line in iter(p.stdout.readline, b''):
if line.rstrip().find("50:f5:da:ed:55:8f") >= 0:
print "Found th... | mit | Python | |
626fcfe5262c46b42aba9732e48d32a99b44806e | Create Clusterer.py | cookietron/CBVGR | Clusterer.py | Clusterer.py | # define a class for the individual logs
class GameLog():
pass
# define a class for a similarity distance between two logs
class Distance():
def __init__(self, Log1, Log2):
# set Distance properties here
pass
# create a list of game logs?
game_index = []
# create a second list for distances?
distance_index = ... | mit | Python | |
bcf735960847dd8a2b8823bc8502c7dd8d1a9747 | Create mayanCalculation.py | NendoTaka/CodeForReference,NendoTaka/CodeForReference,NendoTaka/CodeForReference | Codingame/Python/Medium/mayanCalculation.py | Codingame/Python/Medium/mayanCalculation.py | import sys
import math
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
l, h = [int(i) for i in input().split()]
g = []
for i in range(h):
numeral = input()
g.append([ numeral[start:start+l] for start in range(0, len(numeral), l) ])
s1 = int(input(... | mit | Python | |
7df5244db5bf955bda328beafa86b317a0946991 | define validation states. | ZTH1970/alcide,ZTH1970/alcide,ZTH1970/alcide,ZTH1970/alcide,ZTH1970/alcide | calebasse/actes/validation_states.py | calebasse/actes/validation_states.py | # -*- coding: utf-8 -*-
'''
The state name is for instance the string 'NON_VALIDE'
The value given in the dictionnary can only be used for display.
'''
NON_VALIDE = u'Non validé'
VALIDE = u'Validé'
ABS_NON_EXC = u'Absence non excusée'
ABS_EXC = u'Absence excusée'
ANNUL_NOUS = u'Annulé par nous'
ANNUL_FAMILLE =... | agpl-3.0 | Python | |
58dd13d618fb81ea689ffb62ff3fbba01ac37628 | Implement cpu_stats for cros backend | hgl888/chromium-crosswalk-efl,Chilledheart/chromium,bright-sparks/chromium-spacewalk,dednal/chromium.src,Fireblend/chromium-crosswalk,chuan9/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,axinging/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,anirudhSK/chromium,bright-sparks/chromium-spacewalk,jaruba/c... | tools/telemetry/telemetry/core/platform/cros_platform_backend.py | tools/telemetry/telemetry/core/platform/cros_platform_backend.py | # Copyright (c) 2013 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.
from telemetry.core.platform import platform_backend
from telemetry.core.platform import proc_util
class CrosPlatformBackend(platform_backend.PlatformB... | # Copyright (c) 2013 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.
from telemetry.core.platform import platform_backend
from telemetry.core.platform import proc_util
class CrosPlatformBackend(platform_backend.PlatformB... | bsd-3-clause | Python |
d48714f1d962aef6a3e9db055d937a5d80a71223 | Add description to policies in services.py | jianghuaw/nova,gooddata/openstack-nova,phenoxim/nova,mikalstill/nova,Juniper/nova,mikalstill/nova,Juniper/nova,vmturbo/nova,klmitch/nova,openstack/nova,gooddata/openstack-nova,gooddata/openstack-nova,rahulunair/nova,mahak/nova,jianghuaw/nova,openstack/nova,openstack/nova,klmitch/nova,mahak/nova,jianghuaw/nova,rahulunai... | nova/policies/services.py | nova/policies/services.py | # Copyright 2016 Cloudbase Solutions Srl
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | # Copyright 2016 Cloudbase Solutions Srl
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | apache-2.0 | Python |
52fbd3f92454c103a484c03ae6cbea63dc1329ce | Add Unicode volume name test | Datera/cinder,bswartz/cinder,cloudbase/cinder,bswartz/cinder,phenoxim/cinder,Nexenta/cinder,eharney/cinder,eharney/cinder,mahak/cinder,Nexenta/cinder,Hybrid-Cloud/cinder,ge0rgi/cinder,j-griffith/cinder,openstack/cinder,NetApp/cinder,phenoxim/cinder,j-griffith/cinder,Datera/cinder,openstack/cinder,Hybrid-Cloud/cinder,Ne... | cinder/tests/tempest/api/volume/test_volume_unicode.py | cinder/tests/tempest/api/volume/test_volume_unicode.py | # -*- coding: utf-8 -*-
# Copyright 2016 Red Hat, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#... | apache-2.0 | Python | |
c5d1e52745474d008c9aec481d24959ff798b904 | Add util code | TylerKirby/cltk,kylepjohnson/cltk,D-K-E/cltk,cltk/cltk,TylerKirby/cltk,diyclassics/cltk | cltk/tokenize/latin/utils.py | cltk/tokenize/latin/utils.py | """ Tokenization utilities: Latin
"""
__author__ = ['Patrick J. Burns <patrick@diyclassics.org>']
__license__ = 'MIT License.'
import pickle
from nltk.tokenize.punkt import PunktSentenceTokenizer, PunktTrainer
from nltk.tokenize.punkt import PunktLanguageVars
from cltk.corpus.latin.readers import latinlibrary
from... | mit | Python | |
081b19ed215754ff7ca4f36353d55d8f40b83abe | add blackgate server. | soasme/blackgate | blackgate/server.py | blackgate/server.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import time
import signal
import logging
import tornado.ioloop
import tornado.httpserver
from tornado.web import Application
from blackgate.core import component
MAX_WAIT_SECONDS_BEFORE_SHUTDOWN = 20
def sig_handler(sig, frame):
logging.w... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.