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
255a7e7e15eec5b20dda416bc269a468fcd9c7c5
test of new getStudyIngestMessagesForNexSON treemachine service... the rest of the commit.
OpenTreeOfLife/opentree-testrunner,OpenTreeOfLife/opentree-testrunner
test_gols_get_study_ingest_messages.py
test_gols_get_study_ingest_messages.py
#!/usr/bin/env python import sys import requests import json from opentreetesting import config, summarize_json_response DOMAIN = config('host', 'golshost') p = '/ext/GoLS/graphdb/getStudyIngestMessagesForNexSON' if DOMAIN.startswith('http://127.0.0.1'): p = '/db/data' + p SUBMIT_URI = DOMAIN + p payload = { 'n...
bsd-2-clause
Python
796dd87582c5327865602fdeeac74f8e35407ccf
Add compiler file
Diego999/compiler
compiler.py
compiler.py
from lex_1 import generate_lex from parser_2 import generate_parser from semantic_3 import generate_semantic from generator_4 import generate_output if __name__ == "__main__": import os test_dir = "./tests/compiling/" for file in os.listdir(test_dir): prog = open(test_dir+file).read() gener...
mit
Python
b75de39ae75b3780988673ffbab869dec20c1521
Add uwsgi conf file for star and shadow
BenMotz/cubetoolkit,BenMotz/cubetoolkit,BenMotz/cubetoolkit,BenMotz/cubetoolkit
serverconfig/toolkit_uwsgi_star_shadow.py
serverconfig/toolkit_uwsgi_star_shadow.py
# mysite_uwsgi.ini file # http://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html [uwsgi] # Django-related settings # the base directory (full path) chdir = /home/users/starandshadow/star_site # Django's wsgi file module = wsgi # the virtualenv (full path) home = /home...
agpl-3.0
Python
4bfc3f650bd5560f2e2e469252ea1166496a4b6b
Add dodgy NetCDF creation example
omad/datacube-experiments
example1.py
example1.py
from __future__ import print_function from datacube.api.model import DatasetType, Satellite, Ls57Arg25Bands, Fc25Bands, Pq25Bands from datacube.api.query import list_tiles_as_list from datacube.api.utils import get_dataset_metadata from datacube.api.utils import get_dataset_data from geotiff_to_netcdf import BandAsDim...
bsd-3-clause
Python
f12500c836d2d5f04d3ad68b2b227f11b68af136
Add python script to send example task to the queue to test it
leibowitz/perfmonitor,leibowitz/perfmonitor,leibowitz/perfmonitor
bin/send.py
bin/send.py
#!/usr/bin/env python import pika import json msg = { 'url':'http://www.google.co.uk', 'site': 'gtk', 'account': 'me', 'type': 'har' } connection = pika.BlockingConnection(pika.ConnectionParameters( 'localhost')) channel = connection.channel() channel.exchange_declare(exchange='perfmonit...
mit
Python
bbf28b1c7fa3fb9f9074b9d4879c30e810ab3f31
Add premise of Bench Manager
ktbs/ktbs-bench,ktbs/ktbs-bench
ktbs_bench/utils/bench_manager.py
ktbs_bench/utils/bench_manager.py
from contextlib import contextmanager from ktbs_bench.utils.decorators import bench as util_bench class BenchManager: def __init__(self): self._contexts = [] self._bench_funcs = [] def bench(self, func): """Prepare a function to be benched and add it to the list to be run later.""" ...
mit
Python
cbb182ff0e999954c7a5c8fd19097a441762666b
Add sdb driver for etcd
saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt
salt/sdb/etcd_db.py
salt/sdb/etcd_db.py
# -*- coding: utf-8 -*- ''' etcd Database Module :maintainer: SaltStack :maturity: New :depends: python-etcd :platform: all This module allows access to the etcd database using an ``sdb://`` URI. This package is located at ``https://pypi.python.org/pypi/python-etcd``. Like all sdb modules, the etc...
apache-2.0
Python
23bb5deda2f6217ceab6a6e60e26234919a1f24e
Add buildbot.py
steinwurf/kw,steinwurf/kw
buildbot.py
buildbot.py
#!/usr/bin/env python # encoding: utf-8 import os import sys import json import subprocess project_name = 'kw' def run_command(args): print("Running: {}".format(args)) sys.stdout.flush() subprocess.check_call(args) def get_tool_options(properties): options = "" if 'tool_options' in properties...
bsd-3-clause
Python
916c453d2ba939fb7eb15f4d87557c37bfc57a21
Add test for shell command
Julian/home-assistant,ct-23/home-assistant,mezz64/home-assistant,pottzer/home-assistant,joopert/home-assistant,FreekingDean/home-assistant,eagleamon/home-assistant,betrisey/home-assistant,eagleamon/home-assistant,open-homeautomation/home-assistant,aequitas/home-assistant,open-homeautomation/home-assistant,bdfoster/blum...
tests/components/test_shell_command.py
tests/components/test_shell_command.py
""" tests.test_shell_command ~~~~~~~~~~~~~~~~~~~~~~~~ Tests demo component. """ import os import tempfile import unittest from homeassistant import core from homeassistant.components import shell_command class TestShellCommand(unittest.TestCase): """ Test the demo module. """ def setUp(self): # pylint: di...
mit
Python
029de4a3a10f31b2d300e100db7767722698f00a
Test for newly refactored literal rule
cmancone/mygrations,cmancone/mygrations
tests/core/parse/test_parse_literal.py
tests/core/parse/test_parse_literal.py
import unittest from mygrations.core.parse.rule_literal import rule_literal class test_parse_regexp( unittest.TestCase ): def get_rule( self, name, literal ): return rule_literal( False, { 'name': name, 'value': literal }, {} ) def test_name_not_required( self ): rule = self.get_rule( '', ...
mit
Python
9bcd540b4ba9e9e38f674b02b47e42eb29a1cf2f
add gender choices data migration
masschallenge/django-accelerator,masschallenge/django-accelerator
accelerator/migrations/0029_add_gender_choices_data.py
accelerator/migrations/0029_add_gender_choices_data.py
# Generated by Django 2.2.10 on 2020-12-01 19:01 from django.db import migrations from accelerator_abstract.models.base_gender_choices import GENDER_CHOICES def add_gender_choices(apps, schema_editor): GenderChoices = apps.get_model('accelerator', 'GenderChoices') db_gender_choices = GenderChoices.objects.al...
mit
Python
795bd9bca8779b32b1e48e420ab42fefbb73fdfc
add Driver migration
SRJ9/django-driver27,SRJ9/django-driver27,SRJ9/django-driver27
migrations/0001_initial.py
migrations/0001_initial.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.1 on 2016-09-23 15:48 from __future__ import unicode_literals from django.db import migrations, models import django_countries.fields class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.Create...
mit
Python
82301349226ec43dcec53d5ceceaa952d8d4b9b5
Test the use_plus_uconst optimizer
gbenson/i8c
i8c/tests/test_opt_use_plus_uconst.py
i8c/tests/test_opt_use_plus_uconst.py
from i8c.tests import TestCase SOURCE = """\ define test::optimize_use_plus_uconst returns int argument int x load %s add """ class TestOptimizeUsePlusUconst(TestCase): def test_optimize_use_plus_uconst(self): """Check that DW_OP_plus_uconst is used where possible.""" for value in ("T...
lgpl-2.1
Python
b583bf5dbd4a375df7824463dda0789ddc980f2e
Create lasagne-script.py
KhaledSharif/numerai-scripts
lasagne-script.py
lasagne-script.py
import numpy as np import pandas as pd from lasagne.init import Orthogonal, Constant from lasagne.layers import DenseLayer, MergeLayer from lasagne.layers import DropoutLayer from lasagne.layers import InputLayer from lasagne.nonlinearities import softmax, rectify, sigmoid from lasagne.objectives import categorical_cro...
mit
Python
a72516f4faae6993d55b7a542ef9b686c6e659fb
Add NoCommandAction to only continue execution when a non-command text event is received
alvarogzp/telegram-bot,alvarogzp/telegram-bot
bot/action/core/command/no_command.py
bot/action/core/command/no_command.py
from bot.action.core.action import IntermediateAction from bot.action.core.command import CommandAction class NoCommandAction(IntermediateAction): def process(self, event): for entity in self.get_entities(event): if self.is_valid_command(entity): break else: ...
agpl-3.0
Python
31717dc26912aedd42ca475b4e3d1a406523e44a
add to connect mysql with pymysql
cwenao/python_web_learn
base100/crawler/data_store.py
base100/crawler/data_store.py
#!/usr/bin/python # --*-- UTF8 --*-- import pymysql def db_connect(): ''' 数据库配置 :return: con ''' con = pymysql.connect( host='172.16.223.10', user='root', passwd='123456', db='crawler', charset='utf8' ) return con def execute_query_sql(sql): ...
apache-2.0
Python
b5b329af74f66443d33062f8a17a99b98833e7bb
add UiBench workload
ARM-software/lisa,ARM-software/lisa,bjackman/lisa,ARM-software/lisa,credp/lisa,mdigiorgio/lisa,mdigiorgio/lisa,ARM-software/lisa,arnoldlu/lisa,joelagnel/lisa,arnoldlu/lisa,bjackman/lisa,credp/lisa,joelagnel/lisa,credp/lisa,credp/lisa
libs/utils/android/workloads/uibench.py
libs/utils/android/workloads/uibench.py
# SPDX-License-Identifier: Apache-2.0 # # Copyright (C) 2015, ARM Limited and contributors. # # 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
bc3ded5eda2cb31523dfaf9bf7eec4fbe1030a0b
add find_pcs.py, but only with some prep code and eline masking
zpace/stellarmass_pca
find_pcs.py
find_pcs.py
import numpy as np from astropy import constants as c, units as u class StellarPop_PCA(object): ''' class for determining PCs of a library of synthetic spectra ''' def __init__(self, l, spectra, dlogl=None): ''' params: - l: length-n array-like defining the wavelength bin cente...
mit
Python
2e20d0bb09234f36b5d43fc1f4b99cdb1da0e7f8
Add unsigned-workup utility script.
SaturdayNeighborhoodHealthClinic/clintools,SaturdayNeighborhoodHealthClinic/clintools,SaturdayNeighborhoodHealthClinic/clintools
scripts/check_unsigned.py
scripts/check_unsigned.py
from datetime import date from pttrack.models import Provider, Workup unsigned_workups = Workup.objects.filter(signer=None) print unsigned_workups for wu in unsigned_workups: d = wu.clinic_day.clinic_date providers = Provider.objects.filter( signed_workups__in=Workup.objects.filter( clini...
mit
Python
ffefdb6e9ac678d0b7e1f65a7712e01a874507fb
ADD script to collect nemo results
mlindauer/EPM_DNN
scripts/collect_result.py
scripts/collect_result.py
import numpy as np import pandas as pd from _collections import OrderedDict data = {} flat_data = OrderedDict() scens = ["SPEAR-SWV","SPEAR-IBM","CPLEX-RCW","CPLEX-REG","CPLEX-CORLAT"] models = ["DNN", "RF"] EVA_BUDGETs = [1]#,3600] WC_BUDGET = 86400 # sec RUNS = 3 for scen in scens: for model in models: ...
bsd-2-clause
Python
e41ce4338334794466ba6918fc3b8a1f118d6b41
Add first example test of using h2o python API to gradle build regression suite.
mrgloom/h2o-3,brightchen/h2o-3,kyoren/https-github.com-h2oai-h2o-3,nilbody/h2o-3,madmax983/h2o-3,jangorecki/h2o-3,pchmieli/h2o-3,kyoren/https-github.com-h2oai-h2o-3,madmax983/h2o-3,YzPaul3/h2o-3,ChristosChristofidis/h2o-3,brightchen/h2o-3,jangorecki/h2o-3,michalkurka/h2o-3,printedheart/h2o-3,h2oai/h2o-3,PawarPawan/h2o-...
py/testdir_multi_jvm/test_gbm_prostate.py
py/testdir_multi_jvm/test_gbm_prostate.py
import sys sys.path.insert(1, '../../h2o-py/src/main/py') from h2o import H2OConnection from h2o import H2OFrame from h2o import H2OGBM from tabulate import tabulate ###################################################### # Parse command-line args. # # usage: python test_name.py --usecloud ipaddr:port # ip_port = sy...
apache-2.0
Python
c27685da10c85cb9876b4c73012da3ebff1915dc
Add exercise horse racing duals
AntoineAugusti/katas,AntoineAugusti/katas,AntoineAugusti/katas
codingame/easy/horse-racing_duals.py
codingame/easy/horse-racing_duals.py
N = int(raw_input()) lst = [] # Read the list for i in xrange(N): lst.append(int(raw_input())) # Sort the list, ascending order a = sorted(lst) # Find the min difference print min(y-x for x,y in zip(a, a[1:]))
mit
Python
cf592b24b0cc8e8944f32e1389379d57c8b9d96a
add list of universities
Impactstory/total-impact-webapp,total-impact/total-impact-webapp,Impactstory/total-impact-webapp,total-impact/total-impact-webapp,Impactstory/total-impact-webapp,total-impact/total-impact-webapp,total-impact/total-impact-webapp,Impactstory/total-impact-webapp
scripts/make_unis_list.py
scripts/make_unis_list.py
import re import json def make_country_key_to_iso_code_dict(country_lines): country_key_to_iso_code = {} for line in country_lines: m = re.match("\((\d+),", line) if m is not None: country_key = int(m.group(1)) iso_code = line.split(",")[1].replace("'", "").strip() ...
mit
Python
c1894e280f7d4b8d2afac6b4febaae451894306c
Add command to view exons in the database
Clinical-Genomics/scout,Clinical-Genomics/scout,Clinical-Genomics/scout
scout/commands/view/exons.py
scout/commands/view/exons.py
import logging import click from pprint import pprint as pp from flask.cli import with_appcontext from scout.server.extensions import store LOG = logging.getLogger(__name__) @click.command('exons', short_help='Display exons') @click.option('-b', '--build', default='37', type=click.Choice(['37', '38'])) @click.opti...
bsd-3-clause
Python
685e9cc5f285bb6fadddea8d94d5a9820ace39e6
Initialize manager module for server
TheUnderscores/midi-beeper-orchestra
src/server/manager.py
src/server/manager.py
class Event: def __init__(self, t, hz): self.t = t self.hz = hz class Layer: def __init__(self): self.events = [] def addEvent(self, e): self.events.append(e) class Client: def __init__(self, connection): self.connection = connection class Manager: def __i...
agpl-3.0
Python
6be3900d26a25495101de2a14a9f62b59d9b776a
use posixpath to generate thumbnail-src
Chilledheart/seahub,miurahr/seahub,miurahr/seahub,cloudcopy/seahub,madflow/seahub,Chilledheart/seahub,Chilledheart/seahub,miurahr/seahub,madflow/seahub,cloudcopy/seahub,Chilledheart/seahub,madflow/seahub,madflow/seahub,cloudcopy/seahub,cloudcopy/seahub,madflow/seahub,Chilledheart/seahub,miurahr/seahub
seahub/thumbnail/utils.py
seahub/thumbnail/utils.py
import posixpath from seahub.utils import get_service_url def get_thumbnail_src(repo_id, obj_id, size): return posixpath.join(get_service_url(), "thumbnail", repo_id, obj_id, size)
import os from seahub.utils import get_service_url def get_thumbnail_src(repo_id, obj_id, size): return os.path.join(get_service_url(), "thumbnail", repo_id, obj_id, size, '')
apache-2.0
Python
ccadcfe891871032ea5e4c1974db67ed1b69a0e8
add undocumented function to display new messages.
michael-lazar/rtv,5225225/rtv,TheoPib/rtv,TheoPib/rtv,shaggytwodope/rtv,5225225/rtv,michael-lazar/rtv,bigplus/rtv,shaggytwodope/rtv,yskmt/rtv,michael-lazar/rtv,yskmt/rtv
rtv/docs.py
rtv/docs.py
from .__version__ import __version__ __all__ = ['AGENT', 'SUMMARY', 'AUTH', 'CONTROLS', 'HELP', 'COMMENT_FILE', 'SUBMISSION_FILE', 'COMMENT_EDIT_FILE'] AGENT = """\ desktop:https://github.com/michael-lazar/rtv:{} (by /u/civilization_phaze_3)\ """.format(__version__) SUMMARY = """ Reddit Terminal Viewer is...
from .__version__ import __version__ __all__ = ['AGENT', 'SUMMARY', 'AUTH', 'CONTROLS', 'HELP', 'COMMENT_FILE', 'SUBMISSION_FILE', 'COMMENT_EDIT_FILE'] AGENT = """\ desktop:https://github.com/michael-lazar/rtv:{} (by /u/civilization_phaze_3)\ """.format(__version__) SUMMARY = """ Reddit Terminal Viewer is...
mit
Python
9ffcadf3a79459b6685cf64a6a77d5186f8fc691
add main file, data base connection and one simple insertion test
sebasvega95/dist-systems-chat,sebasvega95/dist-systems-chat,sebasvega95/dist-systems-chat
main.py
main.py
from users_handler import UsersHandler import pymongo import logging import sys logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.DEBUG) try: client = pymongo.MongoClient("mongodb://root:chat1234@ds135797.mlab.com:35797/chat") logging.info("Connected to the data base: {}".format(client.ad...
mit
Python
7ca529e9afe68033c5f6f552aae6f5316a406555
check for peru file before running
olson-sean-k/peru,buildinspace/peru,oconnor663/peru,buildinspace/peru,scalp42/peru,olson-sean-k/peru,scalp42/peru,oconnor663/peru,enzochiau/peru,enzochiau/peru,ierceg/peru,ierceg/peru,nivertech/peru,nivertech/peru
main.py
main.py
#! /usr/bin/env python3 import os import sys import runtime import module def main(): peru_file_name = os.getenv("PERU_FILE_NAME") or "peru" if not os.path.isfile(peru_file_name): print("no peru file found") sys.exit(1) r = runtime.Runtime() m = module.parse(r, peru_file_name) if ...
#! /usr/bin/env python3 import os import sys import runtime import module def main(): r = runtime.Runtime() peru_file_name = os.getenv("PERU_FILE_NAME") or "peru" m = module.parse(r, peru_file_name) if len(sys.argv) > 1: target = sys.argv[1].split('.') else: target = [] m.buil...
mit
Python
a7ba6c3872103bf46d838202da37e1426e285525
Add example skeleton
alepulver/my-thesis,alepulver/my-thesis,alepulver/my-thesis,alepulver/my-thesis
main.py
main.py
from random import random from kivy.app import App from kivy.uix.widget import Widget from kivy.uix.button import Button from kivy.graphics import Color, Ellipse, Line class MyPaintWidget(Widget): def on_touch_down(self, touch): color = (random(), 1, 1) with self.canvas: Color(*color,...
mit
Python
b627cccbd77dbb4f8d87189d7d85cb66d2324b2e
add helpers.py file to notebooks folder for common helper functions for notebooks to use
joeymeyer/raspberryturk
notebooks/helpers.py
notebooks/helpers.py
import itertools import numpy as np import matplotlib.pyplot as plt def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues): """ This function prints and plots the confusion matrix. No...
mit
Python
59ba6d2db5fa27878653f000cb1e6f8cfd6ccc89
Check ptavi.p3
arealg/ptavi-p3
check-p3.py
check-p3.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ Script de comprobación de entrega de práctica Para ejecutarlo, desde la shell: $ python check-p3.py login_github """ import os import random import sys if len(sys.argv) != 2: print() sys.exit("Usage : $ python3 check-p3.py login_github") repo_git = "http://...
apache-2.0
Python
db689744216f19ed425e3155dd8d57d792497f4a
create VersionList module and class to manage the list of blender version installed on user system
CaptainDesAstres/Simple-Blender-Render-Manager,CaptainDesAstres/Blender-Render-Manager
settingMod/VersionList.py
settingMod/VersionList.py
#!/usr/bin/python3.4 # -*-coding:Utf-8 -* '''module to manage list of all know version of Blender in the system''' import xml.etree.ElementTree as xmlMod class VersionList: '''class dedicated to Blender version managing''' def __init__(self, xml= None): '''initialize Blender version list with default value or...
mit
Python
56e48a414b1145e4955aeea58e409cebd0b4d9d0
Add serialize tests
absent1706/sqlalchemy-mixins
sqlalchemy_mixins/tests/test_serialize.py
sqlalchemy_mixins/tests/test_serialize.py
import unittest import sqlalchemy as sa from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import Session from sqlalchemy_mixins import SerializeMixin Base = declarative_base() class BaseModel(Base, SerializeMixin): __abstract__ = True pass cl...
mit
Python
d84b0a0c882737971787b6a4da20733301de56b6
add weixin backend
duoduo369/python-social-auth,duoduo369/python-social-auth
social/backends/weixin.py
social/backends/weixin.py
#coding:utf8 # author:duoduo3369@gmail.com https://github.com/duoduo369 """ Weixin OAuth2 backend, docs at: """ from requests import HTTPError from social.backends.oauth import BaseOAuth2 from social.exceptions import AuthCanceled, AuthUnknownError class WeixinOAuth2(BaseOAuth2): """Weixin OAuth authentication ...
bsd-3-clause
Python
238f62cadfe4514b116ffaa0b0c2206e31132d8e
Add poll.py, which polls an F5 load balancer for virtual service stats and sends them to Graphite
mjulian/pysnmp-examples
poll.py
poll.py
#!/usr/bin/env python from pysnmp.entity.rfc3413.oneliner import cmdgen from pysnmp.smi import builder import time import socket import struct import pickle hostname = socket.gethostname().split('.') colo = hostname[1] CARBON_SERVER = "" CARBON_PORT = 2004 COMMUNITY_STRING = "" cmdGen = cmdgen.CommandGenerator() m...
mit
Python
013016bf533a91e7dceffd806a8a1db0e8b6a74c
add admin.py to device logs for text-based searching
SEL-Columbia/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,SEL-Columbia/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,q...
corehq/ex-submodules/phonelog/admin.py
corehq/ex-submodules/phonelog/admin.py
from django.contrib import admin from .models import * class DeviceReportEntryAdmin(admin.ModelAdmin): model = DeviceReportEntry list_display = [ 'xform_id', 'msg', 'type', 'domain', 'date', 'username', ] search_fields = [ 'xform_id', '...
bsd-3-clause
Python
717f3c5d4babe9feeb4e0d82fb2ea839d735c4b4
Test database.common for full coverage of database
LINKIWI/linkr,LINKIWI/linkr,LINKIWI/linkr
test/backend/test_database/test_common.py
test/backend/test_database/test_common.py
import mock from linkr import db import database.common from test.backend.test_case import LinkrTestCase class TestCommon(LinkrTestCase): def test_create_tables(self): with mock.patch.object(db, 'create_all') as mock_create: database.common.create_tables() self.assertTrue(mock_cre...
mit
Python
62962e852b24e9659b82615190cf184896fe08d7
Add account tasks
fin/froide,stefanw/froide,fin/froide,fin/froide,stefanw/froide,stefanw/froide,fin/froide,stefanw/froide,stefanw/froide
froide/account/tasks.py
froide/account/tasks.py
from django.conf import settings from django.utils import translation from froide.celery import app as celery_app from .models import User @celery_app.task def cancel_account_task(user_pk): from .utils import cancel_user translation.activate(settings.LANGUAGE_CODE) try: user = User.objects.get...
mit
Python
97c93e1c678c93dccb9a361bdffe5b1edd51f144
make ansi
scopatz/xolors
make_ansi.py
make_ansi.py
#!/usr/bin/env python import re import math from pprint import pprint, pformat from colortrans import rgb2short from from pygments.styles import get_style_by_name, get_all_styles BASE_COLORS = { 'BLACK': (0, 0, 0), 'RED': (170, 0, 0), 'GREEN': (0, 170, 0), 'YELLOW': (170, 85, 0), 'BLUE': (0, 0, 170...
bsd-2-clause
Python
4316122225d2e523ff310f65479ea676e0aa02e3
Add methods for loading data sets
brilee/MuGo
load_data_sets.py
load_data_sets.py
import os import numpy as np import sgf_wrapper def load_sgf_positions(*dataset_names): for dataset in dataset_names: dataset_dir = os.path.join(os.getcwd(), 'data', dataset) dataset_files = [os.path.join(dataset_dir, name) for name in os.listdir(dataset_dir)] all_datafiles = filter(os.pat...
apache-2.0
Python
263fb51df80a9da6efc567f7e6e3b26012e12a4c
Fix bug for url_to_s3
dkuner/example-modules,dkuner/example-modules,DataCanvasIO/example-modules,dkuner/example-modules,DataCanvasIO/example-modules,DataCanvasIO/example-modules,DataCanvasIO/example-modules,dkuner/example-modules
modules/data_source/url_to_s3/main.py
modules/data_source/url_to_s3/main.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from specparser import get_settings_from_file import os import sys import boto import requests from StringIO import StringIO def percent_cb(complete, total): sys.stdout.write('.') sys.stdout.flush() def s3_multipart_upload(bucket, url, remote_filename): from ...
#!/usr/bin/env python # -*- coding: utf-8 -*- from specparser import get_settings_from_file import os import sys import boto import requests from StringIO import StringIO def percent_cb(complete, total): sys.stdout.write('.') sys.stdout.flush() def s3_multipart_upload(bucket, url, remote_filename): from ...
bsd-3-clause
Python
02401c9cdccaa52cf933ffc16225dc6bcbc2a1c3
Create matrix.py
fnielsen/dasem,fnielsen/dasem
dasem/matrix.py
dasem/matrix.py
"""Matrix. Usage: dasem.docterm save-wikipedia-doc-term-matrix [options] <filename> Options: --output-filename Filename to write to -h --help Help message --max-n-pages=<int> Maximum number of pages -v --verbose Verbose debug messaging """ import json from scipy import io from ....
apache-2.0
Python
715e02da3f2bdf8bff6d18258295e0152c27acef
Add the procedure generator
SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder
src-backend/api/generator.py
src-backend/api/generator.py
from xml.etree import ElementTree from xml.dom import minidom from models import * class ProcedureGenerator: def __init__(self, procedure): self.name = 'Procedure' self.procedure = procedure def _get_properties(self): props = { 'title': self.procedure.title, 'a...
bsd-3-clause
Python
b97c67277c049602b6a41d7222539ba459155cdb
Create imagebot.py
CallmeTorre/TelegramBot
imagebot.py
imagebot.py
import urllib import time import json import requests import os TOKEN = "<your-bot-token>" URL = "https://api.telegram.org/bot{}/".format(TOKEN) IMAGE_URL = "https://api.telegram.org/file/bot{}/".format(TOKEN) DOWNLOADED_IMAGE_PATH = "/Telegram/" def get_url(url): """Downloads the content from a URL and gives us ...
mit
Python
9707ccdab7f51e61dda2ac290ffda882d3610ee8
Create retrieve_newest_file_from_nas.py
jebstone/datascience
retrieve_newest_file_from_nas.py
retrieve_newest_file_from_nas.py
#!/bin/env python3 """ Copies the most recent datafile from a secure NAS to a local file. """ key_file = 'key_rsa' # NOT .pub import paramiko import sqlite3 from datetime import datetime host = 'hostname' port = 22 username = '' filecount = 15 localdir = r"C:/" remotedir = r"/nas/data/" # SSH Key my_key = paramiko....
unlicense
Python
d88c53ba3dac62c361f60523196d3dc7b9bd90b1
Add spider for Einstein Bros. Closes #784
iandees/all-the-places,iandees/all-the-places,iandees/all-the-places
locations/spiders/einsteinbros.py
locations/spiders/einsteinbros.py
# -*- coding: utf-8 -*- import datetime import re import scrapy from locations.items import GeojsonPointItem from locations.hours import OpeningHours DAY_MAPPING = { 'Monday': 'Mo', 'Tuesday': 'Tu', 'Wednesday': 'We', 'Thursday': 'Th', 'Friday': 'Fr', 'Saturday': 'Sa', 'Sunday': 'Su' } cl...
mit
Python
38587aa6c906b87e5a908a6b963d89cbc2fc5505
move manage.py into src folder
telefonicaid/orchestrator,telefonicaid/orchestrator
src/manage.py
src/manage.py
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
agpl-3.0
Python
e8880307030922f1ab7b2445ee67179fe276f1b1
add trayicon test
cr33dog/pyxfce,cr33dog/pyxfce,cr33dog/pyxfce
netk/tests/testtrayicon.py
netk/tests/testtrayicon.py
#!/usr/bin/env python import pygtk pygtk.require("2.0") import xfce4 label = gtk.Label("Boo!") label.show() ti = xfce4.netk.TrayIcon(gtk.gdk.screen_get_default()) ti.add(label) ti.show() gtk.main()
bsd-3-clause
Python
ca000b194397d314473040cd634d203b8aa0828a
add task generator for subtask 2
google/BIG-bench,google/BIG-bench
bigbench/benchmark_tasks/unit_conversion/2_novel_systems/task_generator.py
bigbench/benchmark_tasks/unit_conversion/2_novel_systems/task_generator.py
#!/usr/bin/env python # coding: utf-8 import json from math import floor, log10, sqrt import numpy as np import random def generate_question(q_type, amount1, amount2, q_ind1, q_ind2, conv_rate): # Generate question to ask model to convert $amount of unit1 into unit2. unit1 = base_quantity[q_ind1] unit2 = ...
apache-2.0
Python
b3265f241ad4c405bc56cc1b4a5154dc3a4098bd
Create settings.py
marmikcfc/tweet-search
settings.py
settings.py
API_KEY = "API_KEY" API_SECRET = "API_SECRET" ACCESS_TOKEN="ACCESS_TOKEN" ACCESS_TOKEN_SECRET="ACCESS_TOKEN_SECRET"
mit
Python
97c149057bf68ef8063316acad2b4c86f6579452
Create maximum-vacation-days.py
kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,jaredkoontz/leetcode,yiwen-luo/LeetCode,kamyu104/LeetCode,jaredkoontz/leetcode,kamyu104/LeetCode,jaredkoontz/leetcode,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,jaredkoon...
Python/maximum-vacation-days.py
Python/maximum-vacation-days.py
# Time: O(n^2 * k) # Space: O(k) class Solution(object): def maxVacationDays(self, flights, days): """ :type flights: List[List[int]] :type days: List[List[int]] :rtype: int """ if not days or not flights: return 0 dp = [[0] * len(days) for _ in ...
mit
Python
612fb44b33c4f52488f3565c009188d61a8343c2
Add an auto join script
arai-wa/hexchat-addons
python/autojoin_on_invite.py
python/autojoin_on_invite.py
__module_name__ = "autojoin on invite" __module_version__ = "1.0" import hexchat def join(word, word_eol, userdata): hexchat.command('join ' + word[0]) hexchat.hook_print('Invited', join)
apache-2.0
Python
3fd3b376b1334dba0ffea3641dcbb32d788f4083
Add migration script to fix templated orphans.
amyshi188/osf.io,fabianvf/osf.io,mluke93/osf.io,GaryKriebel/osf.io,KAsante95/osf.io,ckc6cz/osf.io,revanthkolli/osf.io,cslzchen/osf.io,Nesiehr/osf.io,zkraime/osf.io,reinaH/osf.io,mluke93/osf.io,haoyuchen1992/osf.io,ckc6cz/osf.io,asanfilippo7/osf.io,laurenrevere/osf.io,zkraime/osf.io,aaxelb/osf.io,emetsger/osf.io,Ghalko/...
scripts/fix_templated_orphans.py
scripts/fix_templated_orphans.py
# -*- coding: utf-8 -*- """Find orphaned templated nodes without parents, then attempt to identify and restore their parent nodes. Due to a bug in templating that has since been fixed, several templated nodes were not attached to the `nodes` lists of their parents. """ import logging from modularodm import Q from ...
apache-2.0
Python
8f6bbbe30b77c2722c5ea0f03432e2c77b2eb4c6
add CLI stub for calendar service
quantrocket-llc/quantrocket-client,quantrocket-llc/quantrocket-client
quantrocket/cli/subcommands/calendar.py
quantrocket/cli/subcommands/calendar.py
# Copyright 2017 QuantRocket - 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 ...
apache-2.0
Python
f18e500ff7eb1b73097786892673934346c9a94f
Create sign_rpm.py
CyberAnalyticDevTeam/SimpleRock,CyberAnalyticDevTeam/SimpleRock,rocknsm/rock,CyberAnalyticDevTeam/SimpleRock,rocknsm/SimpleRock,spartan782/rock,spartan782/rock,rocknsm/SimpleRock,spartan782/rock,rocknsm/SimpleRock,rocknsm/rock,rocknsm/rock
sign_rpm.py
sign_rpm.py
+#!/bin/python + +import argparse, subprocess, shlex, os +defaults = {} +defaults['rpm_dir'] = '' + +def get_args(): + parser = argparse.ArgumentParser(description="Setup a GPG macro to be used in signing an rpm. Optionally you can provide the location of rpm's and sign them as well") + parser.add...
unknown
Python
8995e45946812f5cd982d52bd12a99915a8b03cc
Add script to migrate artifact references
apache/allura,leotrubach/sourceforge-allura,heiths/allura,leotrubach/sourceforge-allura,apache/incubator-allura,leotrubach/sourceforge-allura,Bitergia/allura,apache/incubator-allura,apache/allura,apache/allura,lym/allura-git,Bitergia/allura,Bitergia/allura,heiths/allura,lym/allura-git,apache/allura,lym/allura-git,heith...
scripts/migrate-artifact-refs.py
scripts/migrate-artifact-refs.py
import sys import logging from cPickle import loads from pylons import c from allura import model as M log = logging.getLogger('allura.migrate-artifact-refs') # Threads have artifact references that must be migrated to the new system def main(): test = sys.argv[-1] == 'test' all_projects = M.Project.query.f...
apache-2.0
Python
e7394973e5383fc72c4f8004390a05bc91b9053e
Add a skeleton Python file that can be reused.
aawc/cryptopals
skeleton.py
skeleton.py
# Copyright 2017 Varun Khaneja # 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, merge, publish, distribute...
mit
Python
4b44eec7bde92c77f513aac664fe5b52736b874c
Add test code.
segfaulthunter/burrahobbit,segfaulthunter/burrahobbit
burrahobbit/test/test_dict.py
burrahobbit/test/test_dict.py
# Copyright (C) 2011 by Florian Mayer <flormayer@aim.com> # # 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, modif...
mit
Python
df17f792faab74955f5e9573bf7dd9812b489bd3
Add a hybridization example using Slate manually
thomasgibson/firedrake-hybridization
hybridization_solver.py
hybridization_solver.py
from __future__ import absolute_import, print_function, division from firedrake import * qflag = False degree = 1 mesh = UnitSquareMesh(8, 8, quadrilateral=qflag) n = FacetNormal(mesh) if qflag: RT = FiniteElement("RTCF", quadrilateral, degree) DG = FiniteElement("DQ", quadrilateral, degree - 1) Te = Fi...
mit
Python
efa84ed71e6804d71dd639715299a6438824fd64
add unit tests for nacelle's session handling
nacelle/nacelle,nacelle/nacelle
nacelle/tests/tests_session_handling.py
nacelle/tests/tests_session_handling.py
""" Test nacelle's session handling """ # third-party imports import webapp2 # local imports from nacelle.conf import settings from nacelle.test.testcases import NacelleTestCase # test fixtures: we need to set up a local wsgi app so we can test the login # decorators against real handlers def set_session_var(reques...
mit
Python
3523879c9b67766a3d248c7c1260715534ee0671
add test_list
Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python
misc/test_list.py
misc/test_list.py
# -*- coding: utf-8 -*- # 可以看出这四种方式都可以向列表中添加一个新元素,除了"+"之外,其他三种方式都是在原列表上添加数据, # "+"则会创建一个新的列表,并且"+"只能连接两个列表,如果连接一个元素跟一个列表会报错 # 添加一个元素到列表中 a = ["a", "b", "c"] print ("append|添加前id:%s" % id(a)), a.append("d") print ("添加后id:%s, %s" % (id(a), a)) print ("-"*62) a = ["a", "b", "c"] print ("extend|添加前id:%s" % id(a)), a.ext...
mit
Python
ba2d1a707a0869ad0266380b818f88fe626e0267
Add alphabet_lstm.py
aidiary/keras_examples,aidiary/keras_examples
alphabet_lstm.py
alphabet_lstm.py
import numpy as np from keras.models import Sequential from keras.layers import Dense from keras.layers import LSTM from keras.utils import np_utils # http://machinelearningmastery.com/understanding-stateful-lstm-recurrent-neural-networks-python-keras/ if __name__ == "__main__": # fix random seed for reproducibil...
mit
Python
46e66f00ab8c340ca1f104c40c6b9a76762d7ec3
Add example script
modin-project/modin,modin-project/modin
examples/cluster/experimental_cloud.py
examples/cluster/experimental_cloud.py
# Licensed to Modin Development Team under one or more contributor license agreements. # See the NOTICE file distributed with this work for additional information regarding # copyright ownership. The Modin Development Team licenses this file to you under the # Apache License, Version 2.0 (the "License"); you may not u...
apache-2.0
Python
3ddb3c93693822f0fdb3256a360754a4994a954e
add qutebrowser config
charlesdaniels/dotfiles,charlesdaniels/dotfiles,charlesdaniels/dotfiles
overlay/.config/qutebrowser/config.py
overlay/.config/qutebrowser/config.py
c.url.start_pages = ["https://start.duckduckgo.com"] c.content.javascript.enabled = False c.content.headers.accept_language = "en-US,en;q=0.5" c.content.headers.custom = {"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"} c.content.headers.user_agent = 'Mozilla/5.0 (Windows NT 6.1; rv:52.0) G...
bsd-3-clause
Python
73a00c9ac8e237dbd317e3e81ab19521cd7942de
Add donorresponse types
pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality,pwyf/IATI-Data-Quality
iatidq/donorresponse.py
iatidq/donorresponse.py
# IATI Data Quality, tools for Data QA on IATI-formatted publications # by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith # # Copyright (C) 2013 Publish What You Fund # # This programme is free software; you may redistribute and/or modify # it under the terms of the GNU Affero General Public License v3...
agpl-3.0
Python
4107696d3605d600b09ebf1f0a5a2c97fbae0b10
Move wordcount with metrics to its own file.
lukecwik/incubator-beam,chamikaramj/beam,lukecwik/incubator-beam,chamikaramj/beam,robertwb/incubator-beam,apache/beam,lukecwik/incubator-beam,robertwb/incubator-beam,robertwb/incubator-beam,chamikaramj/beam,lukecwik/incubator-beam,chamikaramj/beam,robertwb/incubator-beam,lukecwik/incubator-beam,robertwb/incubator-beam,...
sdks/python/apache_beam/examples/wordcount_with_metrics.py
sdks/python/apache_beam/examples/wordcount_with_metrics.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. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
apache-2.0
Python
4ca364980441dc3f41339db62f774f077588be40
Add first version of the manager
NeutronUfscarDatacom/DriverDatacom
dcclient/xml_manager/manager.py
dcclient/xml_manager/manager.py
""" Methos to create and manipulate the XML """ import data_structures class ManagedXml: def __init__(self): self.xml = data_structures.Cfg_data() def addVlan(self, vid, name='', ports=[]): """ This method adds a vlan to the XML an returns it's instance. """ vlan = data_struc...
apache-2.0
Python
8e982c72829574a00a97f389ac169e5760d53f3c
Create restartable_thread.py
ev0x/stuff,ev0x/stuff
restartable_thread.py
restartable_thread.py
import threading import time class ThreadRestartable(threading.Thread): def __init__(self, theName): threading.Thread.__init__(self, name=theName) def run(self): print "In ThreadRestartable\n" time.sleep(10) thd = ThreadRestartable("WORKER") thd.start() while(1): i = 0 for t ...
mit
Python
8a844b78c5ded93ce7a75585a6ad2b86d8b4cb13
Add recognize decoding typedef or local type
goodwinxp/ATFGenerator,goodwinxp/ATFGenerator,goodwinxp/ATFGenerator
pida_type_decoder.py
pida_type_decoder.py
from pida_types import IDA_TYPES from pida_tlocal_type import IdaTLocalType def decode_step(ida_type): # TODO : pass def decode_hybrid_type(ida_type): value = {'idt': None, 'value': None} rbyte = ord(ida_type[0]) if not (ida_type[1] == '#' and rbyte in [4, 5]): value = {'idt': IDA_TYPES[...
mit
Python
a8507ef2f4d3eaa4f3eeeebbb9dbeb5f008b2737
Add tmux-process-search.py
MikeDacre/mike_tools,MikeDacre/mike_tools,MikeDacre/mike_tools
bin/tmux-process-search.py
bin/tmux-process-search.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Search the tmux process tree. """ import sys as _sys import argparse as _argparse import subprocess as sub import shlex as sh import psutil TMUX_LIST_CMD = 'tmux list-panes -a -F "#{pane_pid} #{session_name}" | grep {0}' def find_session(pid): """Return the tmu...
unlicense
Python
f0c1263f1ca6d9a4f45eea3b19b9f818ed303d26
Add examples/tic_ql_tab_simple_selfplay.py
davidrobles/mlnd-capstone-code
examples/tic_ql_tab_simple_selfplay.py
examples/tic_ql_tab_simple_selfplay.py
''' The Q-learning algorithm is used to estimate the state-action values for a simple Tic-Tac-Toe position by playing games against itself (self-play). ''' from capstone.game.games import TicTacToe from capstone.game.players import RandPlayer from capstone.game.utils import tic2pdf from capstone.rl import Environment, ...
mit
Python
6b00d2a2ca774bff57b523339c10759be4619da6
add cluster name to detected cluster
Tendrl/node_agent,Tendrl/node_agent,Tendrl/node-agent,Tendrl/node-agent,r0h4n/node-agent,Tendrl/node-agent,r0h4n/node-agent,r0h4n/node-agent
tendrl/node_agent/node_sync/sds_detect.py
tendrl/node_agent/node_sync/sds_detect.py
import etcd from tendrl.commons.event import Event from tendrl.commons.message import Message, ExceptionMessage from tendrl.node_agent.discovery.sds import manager as sds_manager def load_and_execute_sds_discovery_plugins(): Event( Message( priority="info", publisher=NS.publisher...
import etcd from tendrl.commons.event import Event from tendrl.commons.message import Message, ExceptionMessage from tendrl.node_agent.discovery.sds import manager as sds_manager def load_and_execute_sds_discovery_plugins(): Event( Message( priority="info", publisher=NS.publisher...
lgpl-2.1
Python
0663a2f90870e0f8b902aa97a479ee9d8ab3b23c
Add usage example to tf.keras.utils.to_categorical
davidzchen/tensorflow,aldian/tensorflow,tensorflow/tensorflow-pywrap_saved_model,Intel-tensorflow/tensorflow,freedomtan/tensorflow,Intel-Corporation/tensorflow,sarvex/tensorflow,karllessard/tensorflow,gautam1858/tensorflow,paolodedios/tensorflow,renyi533/tensorflow,tensorflow/tensorflow-experimental_link_static_librari...
tensorflow/python/keras/utils/np_utils.py
tensorflow/python/keras/utils/np_utils.py
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
Python
8dc22c4c575b7c6931ab3ed14ef40b43dc03a685
TEST initiated
JohnGriffiths/dipy,demianw/dipy,beni55/dipy,StongeEtienne/dipy,samuelstjean/dipy,matthieudumont/dipy,mdesco/dipy,beni55/dipy,oesteban/dipy,Messaoud-Boudjada/dipy,demianw/dipy,villalonreina/dipy,StongeEtienne/dipy,samuelstjean/dipy,FrancoisRheaultUS/dipy,nilgoyyou/dipy,villalonreina/dipy,maurozucchelli/dipy,jyeatman/dip...
dipy/core/tests/test_stensor.py
dipy/core/tests/test_stensor.py
""" Testing qball """ import os from os.path import join as pjoin import numpy as np import dipy.core.stensor as ten from nose.tools import assert_true, assert_false, \ assert_equal, assert_raises from numpy.testing import assert_array_equal, assert_array_almost_equal from dipy.testing import parametric fr...
bsd-3-clause
Python
45c836283232e48e13c139188dac0b11128cb0ac
Add drawcrowd support
kupiakos/LapisMirror,Shugabuga/LapisMirror
plugins/drawcrowd.py
plugins/drawcrowd.py
# The MIT License (MIT) # Copyright (c) 2015 kupiakos # 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
775bca5465022e905a58859d72a970749973dba4
Create main.py
0x424D/crappy,0x424D/crappy
msort/src/main.py
msort/src/main.py
def split(L:list) -> list: ret = [] for i in L: ret.append([i]) while len(ret) > 1: ret[0] = merge(ret[0], ret[1]) del ret[1] return ret[0] def merge(L1:list, L2:list) -> list: for i in L2: for n, j in enumerate(L1): if i <= j: L1.insert(n, i) break else: L1.append(i) return L1 def mai...
agpl-3.0
Python
ac8759778ba3bb9af64259685f4f9526b7a452e3
add shortcuts for number localization
eXcomm/gratipay.com,eXcomm/gratipay.com,studio666/gratipay.com,gratipay/gratipay.com,mccolgst/www.gittip.com,studio666/gratipay.com,mccolgst/www.gittip.com,gratipay/gratipay.com,eXcomm/gratipay.com,eXcomm/gratipay.com,studio666/gratipay.com,gratipay/gratipay.com,mccolgst/www.gittip.com,studio666/gratipay.com,mccolgst/w...
gittip/utils/i18n.py
gittip/utils/i18n.py
from __future__ import print_function, unicode_literals import os from aspen.utils import utcnow from babel.dates import format_timedelta import babel.messages.pofile from babel.numbers import ( format_currency, format_decimal, format_number, format_percent ) def to_age(dt, loc): return format_timedelta(utc...
from __future__ import print_function, unicode_literals import os from aspen.utils import utcnow from babel.dates import format_timedelta import babel.messages.pofile def to_age(dt, loc): return format_timedelta(utcnow() - dt, add_direction=True, locale=loc) def load_langs(localeDir): langs = {} for f...
mit
Python
915dd2ca82bd42ed58768cb1139ceaceada42c84
add simple bmp station application
lagopus/ryu-lagopus-ext,TakeshiTseng/ryu,shinpeimuraoka/ryu,Tesi-Luca-Davide/ryu,habibiefaried/ryu,gopchandani/ryu,lsqtongxin/ryu,openvapour/ryu,alanquillin/ryu,zangree/ryu,zyq001/ryu,pichuang/ryu,ysywh/ryu,fkakuma/ryu,alanquillin/ryu,Tesi-Luca-Davide/ryu,lagopus/ryu-lagopus-ext,jazzmes/ryu,fkakuma/ryu,diogommartins/ry...
ryu/app/bmpstation.py
ryu/app/bmpstation.py
import socket import logging logging.basicConfig(level=logging.DEBUG) from ryu.base import app_manager from ryu.lib import hub from ryu.lib.hub import StreamServer from ryu.lib.packet.bmp import * SERVER_HOST = '0.0.0.0' SERVER_PORT = 11019 class BMPStation(app_manager.RyuApp): def __init__(self): supe...
apache-2.0
Python
b077fb6e577e013cf95b57b1ea7d42febc3b03e7
Add encoding module.
dbarella/steganographic-image-processing
encoding.py
encoding.py
"""Script for encoding a payload into an image.""" from PIL import Image, ImageMath def encode(host, payload): # type: (PIL.Image, PIL.Image) -> PIL.Image """Encode a payload into an image.""" output_rgb_channels = [] for host_channel, payload_channel in zip(host.split(), payload.split()): # M...
mit
Python
241a2820c90817be6dbabb6642b499cf1a224925
Add limb drawing example
dpshelio/sunpy,dpshelio/sunpy,dpshelio/sunpy
examples/gallery/plot_AIA_limb_STEREO.py
examples/gallery/plot_AIA_limb_STEREO.py
# -*- coding: utf-8 -*- """ ================================= Drawing AIA Limb on STEREO Images ================================= In this example we use a STEREO-B and an SDO image to demonstrate how to overplot the limb as seen by AIA on an EUVI-B image. This makes use of functionality added in Astropy 1.3. """ ###...
bsd-2-clause
Python
38b416453c0e0b64d86270232879fb73b2f67d36
Add async Api class
xeroc/python-graphenelib
grapheneasync/api.py
grapheneasync/api.py
# -*- coding: utf-8 -*- import asyncio import logging from grapheneapi.exceptions import NumRetriesReached from grapheneapi.api import Api as OriginalApi from .websocket import Websocket from .http import Http log = logging.getLogger(__name__) class Api(OriginalApi): def __init__(self, *args, **kwargs): ...
mit
Python
0ad8d8665f064542346c3788cecaffdcb68f168a
Create tests for custom exceptions and warnings
StanczakDominik/PlasmaPy
plasmapy/utils/tests/test_exceptions.py
plasmapy/utils/tests/test_exceptions.py
import pytest import warnings from .. import (PlasmaPyError, PhysicsError, RelativityError, AtomicError) from .. import (PlasmaPyWarning, PhysicsWarning, RelativityWarning, AtomicWarning) plasmapy_exceptions = [ Plas...
bsd-3-clause
Python
47bc22166213e50b4f5a2bc583752ff10babd188
add scripts/check_dict.py
fortranlee/cppjieba,fortranlee/cppjieba,songinfo/cppjieba,fortranlee/cppjieba,songinfo/cppjieba,songinfo/cppjieba
scripts/check_dict.py
scripts/check_dict.py
#!/usr/bin/python import sys if len(sys.argv) == 1: print "usage : %s dict_file1 dict_file2 ..." exit(1) d = {} for fname in sys.argv[1:]: with open(fname, "r") as fin: for i, line in enumerate(fin): try: word, cnt, tag = line.strip().split(" ") if wor...
mit
Python
7a039a9c99e0a3fbd786de7794a798063b271b2f
Create parse_selected_language.py
mewturn/Python
parse_selected_language.py
parse_selected_language.py
# # Main idea: to extract only a particular "language" from text content containing words / characters from different language. # Using regex, we search for characters within particular unicode ranges and exclude the rest. # import re def parse_only_text(string, setting): ''' Available settings: * "alphab...
mit
Python
ad934a9abd973141434a12eb346a339d876b5baf
Add regression test for #693
raphael0202/spaCy,raphael0202/spaCy,raphael0202/spaCy,Gregory-Howard/spaCy,explosion/spaCy,honnibal/spaCy,oroszgy/spaCy.hu,recognai/spaCy,recognai/spaCy,spacy-io/spaCy,raphael0202/spaCy,recognai/spaCy,explosion/spaCy,recognai/spaCy,oroszgy/spaCy.hu,oroszgy/spaCy.hu,Gregory-Howard/spaCy,aikramer2/spaCy,Gregory-Howard/sp...
spacy/tests/regression/test_issue693.py
spacy/tests/regression/test_issue693.py
# coding: utf8 from __future__ import unicode_literals import pytest @pytest.mark.xfail @pytest.mark.models def test_issue693(EN): """Test that doc.noun_chunks parses the complete sentence.""" text1 = "the TopTown International Airport Board and the Goodwill Space Exploration Partnership." text2 = "the ...
mit
Python
6cd12f2aaa6170daef88a913ee78b725b6450d61
Add check for 'not guilty beyond a reasonable doubt'
amperser/proselint,amperser/proselint,amperser/proselint,amperser/proselint,amperser/proselint
proselint/checks/garner/not_guilty.py
proselint/checks/garner/not_guilty.py
# -*- coding: utf-8 -*- """Not guilty beyond a reasonable doubt. --- layout: post source: Garner's Modern American Usage source_url: http://bit.ly/1T4alrY title: Not guilty beyond a reasonable doubt. date: 2016-03-09 15:50:31 categories: writing --- This phrasing is ambiguous. The standard by which...
bsd-3-clause
Python
5127914f6842e77e9a1613b58ff28fae420b0da8
Create chi_make_a_smoothie_bot.py
jbzdarkid/Random,jbzdarkid/Random,jbzdarkid/Random,jbzdarkid/Random,jbzdarkid/Random,jbzdarkid/Random,jbzdarkid/Random,jbzdarkid/Random,jbzdarkid/Random
chi_make_a_smoothie_bot.py
chi_make_a_smoothie_bot.py
from asyncio import sleep import discord import subprocess import time from datetime import datetime import sys from pathlib import Path client = discord.Client() client.started = False @client.event async def on_ready(): if client.started: # @Hack: Properly deal with disconnection / reconnection ...
apache-2.0
Python
024280702c11d896195706b299767fdbd73d59f6
add script
adamewing/tebreak,adamewing/tebreak
scripts/map_filter.py
scripts/map_filter.py
#!/usr/bin/env python import pysam import argparse def avgmap(maptabix, chrom, start, end): ''' return average mappability across chrom:start-end region; maptabix = pysam.Tabixfile''' scores = [] if None in (start, end): return None if chrom in maptabix.contigs: for rec in maptabix.fetch(ch...
mit
Python
62dc9c91c277bc4755f81597adca030a43d0ce5f
Add async_apple_scanner example (#719)
jstasiak/python-zeroconf
examples/async_apple_scanner.py
examples/async_apple_scanner.py
#!/usr/bin/env python3 """ Scan for apple devices. """ import argparse import asyncio import logging from typing import Any, Optional, cast from zeroconf import DNSQuestionType, IPVersion, ServiceStateChange, Zeroconf from zeroconf.aio import AsyncServiceBrowser, AsyncServiceInfo, AsyncZeroconf HOMESHARING_SERVICE:...
lgpl-2.1
Python
3740edf4488456e5b04d3943d47f9a2586f3b0e5
add a Riemann phase plot
JeffDestroyerOfWorlds/hydro_examples,zingale/hydro_examples
compressible/riemann-phase.py
compressible/riemann-phase.py
# plot the Hugoniot loci for a compressible Riemann problem import numpy as np import pylab gamma = 1.4 class State: """ a simple container """ def __init__(self, p=1.0, u=0.0, rho=1.0): self.p = p self.u = u self.rho = rho def u_hugoniot(p, state, dir): c = np.sqrt(gamma*st...
bsd-3-clause
Python
3eb70001e175077b9f8e6a696f009ca2a2b76002
Add python solution to 001
whoshuu/euler
001/001.py
001/001.py
print sum([a * b for a, b in zip(map(lambda n: sum(filter(lambda x: not x % n, range(1000))), (3, 5, 15)), (1, 1, -1))])
unlicense
Python
2c9760da48caaf9656c8b1e3f81e70671b7e7c5e
Add missing migration for audit app.
wlanslovenija/django-postgres
postgres/audit/migrations/0003_auditlog_app_session.py
postgres/audit/migrations/0003_auditlog_app_session.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('audit', '0002_auditlog'), ] operations = [ migrations.AddField( model_name='auditlog', name='app_ses...
bsd-3-clause
Python
9198b5f153fa21a6a1134cbb3499b767f7780fb1
add the first version of enemy class
TsvetaKandilarova/Escape-The-Labyrinth
enemy.py
enemy.py
import entity class Enemy(entity.Entity): def __init__(self, health, damage): super().__init__(health, damage) def __str__(self): return "enemy:\n" + super().__str__()
mit
Python
d138b826d1c26853ad9ec2cb49c39c2a11617b84
Add __init__.py to appease older python versions
vikasgorur/wrangler
wrangler/__init__.py
wrangler/__init__.py
mit
Python
b261a85300dfd6413bb436114b549b087aab211b
allow module execution (#184)
coveralls-clients/coveralls-python,coagulant/coveralls-python
coveralls/__main__.py
coveralls/__main__.py
from .cli import main if __name__ == '__main__': main()
mit
Python
a4be10de8f6b7ef59e73f6e5c81bb73a3d769145
Create fetchseq.py
goyalsid/phageParser,goyalsid/phageParser,phageParser/phageParser,phageParser/phageParser,mbonsma/phageParser,mbonsma/phageParser,phageParser/phageParser,mbonsma/phageParser,mbonsma/phageParser,goyalsid/phageParser,phageParser/phageParser
fetchseq.py
fetchseq.py
# -*- coding: utf-8 -*- """ Created on Fri Jun 3 14:15:58 2016 @author: Ahmed """ """Fetch sequences in fasta format for given antiCRISPR protein accession numbers. Adapted from https://www.biostars.org/p/66921/ + acc2gb.py USAGE: cat <file> | python fetchseq.py <email> > <output> where: <file> is the name of a fil...
mit
Python
b90b57adae8a5a32c3c914c880d8900bd008e9f3
Add fedjax/experimental/__init__.py
google/fedjax,google/fedjax
fedjax/experimental/__init__.py
fedjax/experimental/__init__.py
# 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
apache-2.0
Python
7ada16150f5a77bf9578de40a2bd8390c0ddea7e
Add minimal Info cog
sliceofcode/dogbot,sliceofcode/dogbot,slice/dogbot,slice/dogbot,slice/dogbot
dog/ext/info.py
dog/ext/info.py
""" Information extension. """ import discord from discord.ext import commands from dog import Cog from dog.core import utils cm = lambda v: utils.commas(v) SERVER_INFO_MEMBERS = '''{} total member(s) {} online, {} offline {}% online''' SERVER_INFO_COUNT = '''{} role(s) {} text channel(s), {} voice channel(s) {} c...
mit
Python
9b0c3888912b6da4c4632da2623075c4eef9444d
Create fizzbuzz.py
bluewitch/Code-Blue-Python
fizzbuzz.py
fizzbuzz.py
# Python: fizzbuzz.py import sys for i in range(-50, 100): if i%3==0: sys.stdout.write('Fizz') if i%5==0: sys.stdout.write('Buzz') if (i%5<>0 and i%3<>0): print i, print
mit
Python