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 |
|---|---|---|---|---|---|---|---|---|
5aafda5603ca6a5d2b1b6cfcae41132a46382c86 | add memcached example, closes #344 | smn/onadata,hnjamba/onaclone,mainakibui/kobocat,spatialdev/onadata,piqoni/onadata,kobotoolbox/kobocat,spatialdev/onadata,kobotoolbox/kobocat,GeoODK/onadata,qlands/onadata,qlands/onadata,awemulya/fieldsight-kobocat,piqoni/onadata,hnjamba/onaclone,spatialdev/onadata,GeoODK/onadata,hnjamba/onaclone,GeoODK/onadata,awemulya... | onadata/settings/production_example.py | onadata/settings/production_example.py | from common import * # nopep8
# this setting file will not work on "runserver" -- it needs a server for
# static files
DEBUG = False
# override to set the actual location for the production static and media
# directories
MEDIA_ROOT = '/var/formhub-media'
STATIC_ROOT = "/srv/formhub-static"
STATICFILES_DIRS = (
o... | from common import * # nopep8
# this setting file will not work on "runserver" -- it needs a server for
# static files
DEBUG = False
# override to set the actual location for the production static and media
# directories
MEDIA_ROOT = '/var/formhub-media'
STATIC_ROOT = "/srv/formhub-static"
STATICFILES_DIRS = (
o... | bsd-2-clause | Python |
5c3eaede26381babac281dfa0d9bec3ebe911ba8 | Add tool for building custom packages | HotelsDotCom/rainbow,linuxl0ver/rainbow,linuxl0ver/rainbow,metasyn/rainbow,ccampbell/rainbow,HotelsDotCom/rainbow,cybrox/rainbow,jeremykenedy/rainbow,cybrox/rainbow,segmentio/rainbow,jeremykenedy/rainbow,ptigas/rainbow,greyhwndz/rainbow,linuxl0ver/rainbow,jeremykenedy/rainbow,javipepe/rainbow,greyhwndz/rainbow,metasyn/... | util/compile.py | util/compile.py | #!/usr/bin/env python
import sys, os, subprocess
sys.argv.pop(0)
languages = sys.argv
languages.sort()
js_path = os.path.dirname(__file__) + '/../js/'
js_files_to_include = [js_path + 'rainbow.js']
included_languages = []
for language in languages:
path = js_path + 'language/' + language + '.js'
if not os.p... | apache-2.0 | Python | |
86c4bc1a3aa8c29293e5d77dfbd66ea72f58d832 | add some python tests | zshipko/libtwombly,zshipko/libtwombly,zshipko/libtwombly | py/test.py | py/test.py | import unittest
from twombly import *
class TestDrawing(unittest.TestCase):
def setUp(self):
self.image = new_image(1200, 800)
self.drawing = draw(self.image)
def test_new_drawing(self):
self.assertIsNotNone(self.image)
self.assertEquals(self.image.shape[0], 800)
self... | mit | Python | |
fa12247a378e172b75db8d04378883c9d1231449 | Add tests for children sorting in the admin panel. | lektor/lektor,lektor/lektor,lektor/lektor,lektor/lektor | tests/test_api.py | tests/test_api.py | import os
from operator import itemgetter
import pytest
from flask import json
from lektor.admin import WebAdmin
@pytest.fixture
def children_records_data():
"""Returns test values for children records' `id`, `title`, and `pub_date` fields."""
return (
{'id': '1', 'title': '1 is the first number', '... | bsd-3-clause | Python | |
46735fedcff6c7ee37ecce0912b44fbdb09338e5 | Add test | angr/cle | tests/test_hex.py | tests/test_hex.py | #!/usr/bin/env python
import logging
import nose
import os
import cle
TEST_BASE = os.path.join(os.path.dirname(os.path.realpath(__file__)),
os.path.join('..', '..', 'binaries'))
def test_macho():
"""
Basic smoke-test for the Mach-O loader
:return:
"""
mac... | bsd-2-clause | Python | |
923a90c8678c82a66233008d943f05e865b53ad8 | Add geom_density tests | has2k1/plotnine,has2k1/plotnine | ggplot/tests/test_geom_density.py | ggplot/tests/test_geom_density.py | from __future__ import absolute_import, division, print_function
import numpy as np
import pandas as pd
from .. import ggplot, aes, geom_density
from .conftest import cleanup
n = 6 # Some even number greater than 2
# ladder: 0 1 times, 1 2 times, 2 3 times, ...
df = pd.DataFrame({'x': np.repeat(range(n+1), range(n... | mit | Python | |
296044328ba9e9670db7b051d0160b08aa459414 | Create code.py | NikhilDhyani/GetLyrics | code/code.py | code/code.py | import requests
import re
import webbrowser
import os
from bs4 import BeautifulSoup
flag=0
name = (raw_input("please enter the name to search\n>"))
response = requests.get("https://www.google.co.in/search?&q="+name+"lyrics")
if response.status_code==200:
data = response.text
soup = BeautifulSoup(data,"html... | mit | Python | |
41df6d294b17b6b21af1d32e3c74c3ad1e0591bb | Add custom login form | fmorgner/django-maccman,fmorgner/django-maccman | maccman/forms.py | maccman/forms.py | from django.contrib.auth.forms import AuthenticationForm
from django.forms import forms
from django.utils.translation import gettext as _
from .models import UserProfile
class UserProfileAuthenticationForm(AuthenticationForm):
def confirm_login_allowed(self, user):
try:
UserProfile.objects.ge... | bsd-3-clause | Python | |
c8fd1c96e629e3330dd11416a0eb7432118f1191 | rename for convenience | techtonik/pydotorg.pypi,techtonik/pydotorg.pypi | tools/demodata.py | tools/demodata.py | #!/usr/bin/python
import sys, os, urllib
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(root)
import admin, store, config
cfg = config.Config(root+'/config.ini')
st = store.Store(cfg)
# classifiers
for c in urllib.urlopen("http://pypi.python.org/pypi?%3Aaction=list_classifiers").r... | bsd-3-clause | Python | |
4047c59ed58dc8fef037ecc589bb7d82df967d13 | Create __init__.py | ggreco77/GWsky | GWsky/__init__.py | GWsky/__init__.py | from .GWsky import GWsky
from .version import __version__
| bsd-2-clause | Python | |
e478afec3d706f6d5784937fd33c6feb32ea0218 | Create lastfm.py | TingPing/plugins,TingPing/plugins | HexChat/lastfm.py | HexChat/lastfm.py | from __future__ import print_function
import sys
import json
if sys.version_info[0] == 2:
import urllib2 as urllib_error
import urllib as urllib_request
else:
import urllib.error as urllib_error
import urllib.request as urllib_request
import hexchat
__module_name__ = 'lastfm'
__modul... | mit | Python | |
1de1ca40d73d5d8937593c26bd97f4c9d9461c87 | Add tests for account-tag. | ProgVal/irctest | irctest/server_tests/test_account_tag.py | irctest/server_tests/test_account_tag.py | """
<http://ircv3.net/specs/extensions/account-tag-3.2.html>
"""
from irctest import cases
from irctest.client_mock import NoMessageException
from irctest.basecontrollers import NotImplementedByController
class AccountTagTestCase(cases.BaseServerTestCase, cases.OptionalityHelper):
def connectRegisteredClient(self... | mit | Python | |
21b5fbfc2b400e70ed51876d6046320c974b666d | fix issue #57: add plugin for imagebam | regosen/gallery_get | gallery_plugins/plugin_imagebam.py | gallery_plugins/plugin_imagebam.py | # Plugin for gallery_get.
# Each definition can be one of the following:
# - a string
# - a regex string
# - a function that takes source as a parameter and returns an array or a string. (You may assume that re and urllib are already imported.)
# If you comment out a parameter, it will use the default defined in __in... | mit | Python | |
17335a6165b6070ceb4c4f1e6bb1d5a6a8bf08f2 | Add AttachedNotesMixin | OmeGak/indico,pferreir/indico,mvidalgarcia/indico,DirkHoffmann/indico,indico/indico,ThiefMaster/indico,pferreir/indico,indico/indico,indico/indico,mvidalgarcia/indico,indico/indico,mic4ael/indico,mic4ael/indico,DirkHoffmann/indico,pferreir/indico,OmeGak/indico,DirkHoffmann/indico,ThiefMaster/indico,OmeGak/indico,mvidal... | indico/core/db/sqlalchemy/notes.py | indico/core/db/sqlalchemy/notes.py | # This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | mit | Python | |
f35d5251500268235598e4dbd2ddf91c994e1632 | Fix for django-tagging and automcomplete | DjangoAdminHackers/ixxy-admin-utils,DjangoAdminHackers/ixxy-admin-utils | ixxy_admin_utils/custom_widgets.py | ixxy_admin_utils/custom_widgets.py | from dal_select2_tagging.widgets import TaggingSelect2
from django import VERSION
from tagging.utils import parse_tag_input
class IxxyTaggingSelect2(TaggingSelect2):
# TaggingSelect2 doesn't handle spaces as delimeters in tags
# Django-tagging has a function we can use that just works
def render_options... | mit | Python | |
0d4ea4493484e2d34468e205f392d2025e6c2f87 | Add tower 9 | arbylee/python-warrior | towers/beginner/level_009.py | towers/beginner/level_009.py | # -----------
# |>Ca @ S wC|
# -----------
level.description("Time to hone your skills and apply all of the abilities that you have learned.")
level.tip("Watch your back.")
level.clue("Don't just keep shooting the bow while you are being attacked from behind.")
level.time_bonus(40)
level.ace_score(100)
level.size(... | mit | Python | |
8c0c52712833de31aeb2c4a48c8f4300966f5366 | Add lc230_kth_smallest_element_in_a_bst.py | bowen0701/algorithms_data_structures | lc230_kth_smallest_element_in_a_bst.py | lc230_kth_smallest_element_in_a_bst.py | """Leetcode 230. Kth Smallest Element in a BST
Medium
URL: https://leetcode.com/problems/kth-smallest-element-in-a-bst/
Given a binary search tree, write a function kthSmallest to find the
kth smallest element in it.
Note:
You may assume k is always valid, 1 <= k <= BST's total elements.
Example 1:
Input: root = ... | bsd-2-clause | Python | |
432f69910cb6f963a99b3ed2215c8b6476e8f71a | Add first version of script to merge results according to cases | deib-polimi/Spark-Log-Parser,deib-polimi/Spark-Log-Parser | merge_results.py | merge_results.py | #! /usr/bin/env python3
## Copyright 2018 Eugenio Gianniti
##
## 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 a... | apache-2.0 | Python | |
2475916e0d17e4b03bb93970b88555a229a5f3c0 | add tests for ninefold | andrewsomething/libcloud,Scalr/libcloud,Kami/libcloud,Kami/libcloud,ZuluPro/libcloud,StackPointCloud/libcloud,ByteInternet/libcloud,apache/libcloud,erjohnso/libcloud,andrewsomething/libcloud,ByteInternet/libcloud,Scalr/libcloud,mistio/libcloud,pquentin/libcloud,pquentin/libcloud,ZuluPro/libcloud,Kami/libcloud,apache/li... | libcloud/test/storage/test_ninefold.py | libcloud/test/storage/test_ninefold.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 use ... | apache-2.0 | Python | |
5a0d37668c76c7ed77347f2d59cb5b7a20284385 | Add names updater | Pat-Laugh/gitignore-modifier | names_updater.py | names_updater.py | #!/usr/bin/env python
# Copyright 2017 Patrick Laughrea
# Licensed under the Apache License, Version 2.0
README = '''
## Purpose
This is a script to update names in the `gitignore.py` file.
## Requirements
The gitignore repository must have been cloned on the machine at `~/gitignore`.
The directory where this script... | apache-2.0 | Python | |
3bdc692133c7e9e56fb3eeb77d0951ce21a225ec | Create ds_string_word_pattern.py | ngovindaraj/Python | leetcode/ds_string_word_pattern.py | leetcode/ds_string_word_pattern.py |
# @file Word Pattern
# @brief Given 2 sets check if it is a bijection
# https://leetcode.com/problems/word-pattern/
'''
Given a pattern and a string str, find if str follows the same pattern.
Here follow means a full match, such that there is a bijection between
a letter in pattern and a non-empty word in str.
Exa... | mit | Python | |
36843505e1f8d80768c75487faf7cef20294936b | Add migration file | uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged,uccser/cs-unplugged | csunplugged/topics/migrations/0047_curriculumarea_colour.py | csunplugged/topics/migrations/0047_curriculumarea_colour.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-05 09:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('topics', '0046_glossarydefinition'),
]
operations = [
migrations.AddField(
... | mit | Python | |
f7c0241445cf21d15ea640b199826025b3a85aa6 | Create Enforce2FAMiddleware unit tests | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/users/tests/test_middleware.py | corehq/apps/users/tests/test_middleware.py | from django.test import TestCase
from django.contrib.auth import get_user_model
from django.test.client import Client
from django_otp.middleware import OTPMiddleware
from corehq.util.test_utils import flag_enabled
from corehq.apps.users.models import CouchUser
from corehq.apps.users.middleware import Enforce2FAMiddlewa... | bsd-3-clause | Python | |
79170b41e947557dad23ef2ea93934075548dc32 | Add reactor example with ODEs implemented in Python | Cantera/cantera-svn,Cantera/cantera-svn,Cantera/cantera-svn,Cantera/cantera-svn,Cantera/cantera-svn,Cantera/cantera-svn | interfaces/cython/cantera/examples/reactors/custom.py | interfaces/cython/cantera/examples/reactors/custom.py | """
Solve a constant pressure ignition problem where the governing equations are
implemented in Python.
This demonstrates an approach for solving problems where Cantera's reactor
network model cannot be configured to describe the system in question. Here,
Cantera is used for evaluating thermodynamic properties and kin... | bsd-3-clause | Python | |
d9d59666695ef9bdfce6fc4d8d886d5b492c546b | add code to submit oozie jobs via rest api | usc-isi-i2/mydig-webservice,usc-isi-i2/mydig-webservice,usc-isi-i2/mydig-webservice,usc-isi-i2/mydig-webservice | ws/jobs/manage_oozie_jobs.py | ws/jobs/manage_oozie_jobs.py | # Memex cluster oozie url - http://10.1.94.54:11000/oozie
import requests
class OozieJobs(object):
def __init__(self, oozie_url='http://localhost:11000/oozie'):
self.oozie_url = oozie_url
def submit_oozie_jobs(self, config_xml):
oozie_url = self.oozie_url + "/v1/jobs"
# open files i... | mit | Python | |
193a2cd23d074e346829caaed17194c9a130c134 | Add example app ipxactwriter.py | csquaredphd/ipyxact,olofk/ipyxact,csquaredphd/ipyxact,olofk/ipyxact,csquaredphd/ipyxact | ipxactwriter.py | ipxactwriter.py | import ipyxact.ipyxact as ipyxact
class Signal(object):
def __init__(self, name, width=0, low=0, asc=False):
self.name = name
self.width=width
self.low = low
self.asc = asc
class Vector(ipyxact.Vector):
def __init__(self, width=0, low=0, asc=False):
if asc:
... | mit | Python | |
1cb8f468325825bcadac1d5126a1415e57e8d314 | add test runner for notebooks | fabianrost84/ipycache,ihrke/ipycache,rossant/ipycache | ipynb_runner.py | ipynb_runner.py | """
Script for running ipython notebooks.
"""
from IPython.nbformat.current import read
from IPython.kernel import KernelManager
import argparse
from pprint import pprint
import sys
def get_ncells(nb):
# return number of code cells in a notebook
ncells=0
for ws in nb.worksheets:
for cell in ws.cell... | bsd-3-clause | Python | |
fa855ae48a15cfd9b1e01227952a29249faa55d0 | Create longest-uncommon-subsequence-i.py | kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,jaredkoontz/leetcode,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,jaredkoontz/leetcode,jaredkoontz/leetcode,yiwen-luo/LeetCode,kamyu104/LeetCode,kamy... | Python/longest-uncommon-subsequence-i.py | Python/longest-uncommon-subsequence-i.py | # Time: O(min(a, b))
# Space: O(1)
# Given a group of two strings, you need to find the longest uncommon subsequence of this group of two strings.
# The longest uncommon subsequence is defined as the longest subsequence of one of these strings
# and this subsequence should not be any subsequence of the other strings.... | mit | Python | |
f61d0bffc71c85c3ea57dfae09c1a0275a42e1b0 | Create network.py | thewhitetulip/SamplePythonScripts | network.py | network.py | #uses scapy, you need to have scapy installed
from scapy.all import *
ip = raw_input('Enter IP address')
try:
alive, dead = alive,dead=srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst=ip), timeout=2, verbose=0)
print "MAC - IP"
print alive[0][1].hwsrc # will print the MAC address of the IP address you specify in ... | mit | Python | |
4eeb2f120f42cb0af1cb8aca9c95b98a1c568d18 | add july class, and first script of pyplot | JasonWayne/machine-learning-from-scratch | july-ml-course/first_of_pyplot.py | july-ml-course/first_of_pyplot.py | import matplotlib.pyplot as plt
import math
if __name__ == "__main__":
# prepare data
x = [float(i) / 100 for i in range(1, 300)]
y = [math.log(i) for i in x]
# plot
plt.plot(x, y, 'r-', linewidth=3, label='log curve')
# prepare data
p1 = 20
p2 = 175
a = [x[p1], x[p2]]
b = [y[p1], y[p2]]
# plot
plt.plot... | mit | Python | |
9d60de90e49231f64e2fe1719077a3b58c582faa | Create lcm.py | travisrobinson/coursera-specializations,travisrobinson/coursera-specializations,travisrobinson/coursera-specializations,travisrobinson/coursera-specializations,travisrobinson/coursera-specializations,travisrobinson/coursera-specializations,travisrobinson/coursera-specializations | data-structures-and-algorithms/algorithmic-toolbox/week-2/lcm.py | data-structures-and-algorithms/algorithmic-toolbox/week-2/lcm.py | # Uses python3
import sys
def gcd(a, b):
while b!= 0:
(a,b) = (b,a%b)
return a
def main():
a,b = map(int,sys.stdin.readline().split())
c = gcd(a, b)
d = (a*b)//c
print(d)
main()
| cc0-1.0 | Python | |
51d15d4c94ad9daeea15a559c9201a560971ad10 | Create english_to_hack3r.py | meyersbs/misc_nlp_scripts | english_to_hack3r.py | english_to_hack3r.py | # @AUTHOR: Benjamin Meyers
# @DESCRIPTION: Try to write code to convert text into hAck3r, using regular
# expressions and substitution, where e → 3, i → 1, o → 0,
# l → |, s → 5, . → 5w33t!, ate → 8. Normalize the text to
# lowercase before converting it. Add more substitutions... | mit | Python | |
47ae456b3a4252d7c838219e3ebd15e049316891 | Add three shutters and open/close functions | NSLS-II-CHX/ipython_ophyd,NSLS-II-CHX/ipython_ophyd | profile_collection/startup/25-shutter.py | profile_collection/startup/25-shutter.py | from __future__ import print_function
import epics
import logging
from ophyd.controls import EpicsSignal
from ophyd.controls.signal import SignalGroup
class Shutter(SignalGroup):
def __init__(self, open=None, open_status=None,
close=None, close_status=None):
super(Shutter, self).__init__(... | bsd-2-clause | Python | |
7e0561c01a6e7e321b51dace78a772e6cba61e41 | Rename and add | vicyangworld/AutoOfficer | CmdFormat.py | CmdFormat.py | import ctypes
import os
STD_INPUT_HANDLE = -10
STD_OUTPUT_HANDLE= -11
STD_ERROR_HANDLE = -12
FOREGROUND_BLACK = 0x0
FOREGROUND_BLUE = 0x01 # text color contains blue.
FOREGROUND_GREEN= 0x02 # text color contains green.
FOREGROUND_RED = 0x04 # text color contains red.
FOREGROUND_INTENSITY = 0x08 # text color ... | mit | Python | |
99ab0354c5e0812020d983fbb0480d8b7b649645 | add django migrations | Organice/djangocms-maps,Organice/djangocms-maps,Organice/djangocms-maps,Organice/djangocms-maps | djangocms_googlemap/migrations/0002_auto_20160621_0926.py | djangocms_googlemap/migrations/0002_auto_20160621_0926.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('djangocms_googlemap', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='googlemap',
... | bsd-3-clause | Python | |
5f8282c4533386e8d1e5d2dbdbe030be958540ab | Add not committed file globaleaks/handlers/robots.py | vodkina/GlobaLeaks,vodkina/GlobaLeaks,vodkina/GlobaLeaks,vodkina/GlobaLeaks | backend/globaleaks/handlers/robots.py | backend/globaleaks/handlers/robots.py | # -*- coding: UTF-8
# public
# ****
#
# Implementation of classes handling the HTTP request to /node, public
# exposed API.
from twisted.internet.defer import inlineCallbacks, returnValue
from globaleaks import models, LANGUAGES_SUPPORTED
from globaleaks.handlers.admin.files import db_get_file
from globaleaks.handl... | agpl-3.0 | Python | |
22929adf17184037bff4be87e872a1f39aeda2ff | add migrations | praekelt/molo,praekelt/molo,praekelt/molo,praekelt/molo | molo/core/migrations/0036_auto_add_related_section_to_article.py | molo/core/migrations/0036_auto_add_related_section_to_article.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-05-27 14:17
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0028_merge'),
... | bsd-2-clause | Python | |
db333070b61caef62ea5b68e5bf75f92d879db74 | Add regression test for bug #1922053 | mahak/nova,openstack/nova,mahak/nova,openstack/nova,openstack/nova,mahak/nova | nova/tests/functional/regressions/test_bug_1922053.py | nova/tests/functional/regressions/test_bug_1922053.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | apache-2.0 | Python | |
ecdd4aa60fadd392cdb1cfbdc178d742d260d640 | Add a new example | Dentosal/ImbaPython | examples/example1.py | examples/example1.py | import imba
imba.install(["json", "requests"])
my_ip = "http://httpbin.org/ip".fetch().json["origin"]
print(my_ip)
| mit | Python | |
1d021cd7b52ecc4d9684dc607a1ff9f0b8181b37 | Add python script to read receiver file | RaphaelPoncet/2016-macs2-projet-hpc | read_receiver.py | read_receiver.py | #! /usr/bin/env python
import numpy
from matplotlib import pyplot as plt
import matplotlib.colors as colors
import os
import sys
import seaborn
def ParseVariableBinaryHeader(header):
header_detect = '#'
header = header.strip("\n").split()
assert(header[0] == header_detect)
name = header[1]
dt... | apache-2.0 | Python | |
a737844028a576f08a63767a42da92b53b567a67 | add missing script | sunlightlabs/read_FEC,sunlightlabs/read_FEC,sunlightlabs/read_FEC,sunlightlabs/read_FEC | fecreader/summary_data/management/commands/set_committee_candidate_linkage.py | fecreader/summary_data/management/commands/set_committee_candidate_linkage.py | # Sets the curated_candidate_overlay field in committee_overlay from the Authorized_Candidate_Committees model. Use pop_auth_committees to set the data in Authorized_Candidate_Committees itself.
from django.core.management.base import BaseCommand, CommandError
from summary_data.models import Authorized_Candidate_Com... | bsd-3-clause | Python | |
8a9490a962936c4695fbe639b45807aba012d102 | Create LongSubWRC_001.py | cc13ny/algo,Chasego/cod,cc13ny/algo,cc13ny/Allin,cc13ny/Allin,Chasego/cod,Chasego/codi,Chasego/codirit,cc13ny/Allin,Chasego/cod,cc13ny/algo,Chasego/codi,cc13ny/algo,Chasego/codirit,cc13ny/Allin,Chasego/codirit,Chasego/codi,Chasego/codirit,Chasego/cod,Chasego/cod,cc13ny/algo,Chasego/codi,Chasego/codi,Chasego/codirit,cc1... | leetcode/003-Longest-Substring-Without-Repeating-Characters/LongSubWRC_001.py | leetcode/003-Longest-Substring-Without-Repeating-Characters/LongSubWRC_001.py | class Solution:
# @return an integer
def lengthOfLongestSubstring(self, s):
start, maxlen = 0, 0
dict = {s[i]: -1 for i in range(len(s))}
for i in range(len(s)):
if dict[s[i]] != -1:
while start <= dict[s[i]]:
dict[s[start]] = -1
... | mit | Python | |
1c2d41bebbadfe41cad72e950864dcbfcdc938c0 | test file following new format with C code and header, missing decorators for getting dll handles and hypothesis-based testing | pleiszenburg/zugbruecke | tests/test_devide.py | tests/test_devide.py | # -*- coding: utf-8 -*-
"""
ZUGBRUECKE
Calling routines in Windows DLLs from Python scripts running on unixlike systems
https://github.com/pleiszenburg/zugbruecke
tests/test_devide.py: Tests by reference argument passing (int pointer)
Required to run on platform / side: [UNIX, WINE]
Copyright (C) 2017-2019 Seba... | lgpl-2.1 | Python | |
2dc8ae91713fdd73ac1e835dcb191714c2e93593 | Add unittests for some methods of runner | lordappsec/ooni-probe,juga0/ooni-probe,lordappsec/ooni-probe,Karthikeyan-kkk/ooni-probe,juga0/ooni-probe,0xPoly/ooni-probe,lordappsec/ooni-probe,kdmurray91/ooni-probe,juga0/ooni-probe,0xPoly/ooni-probe,kdmurray91/ooni-probe,lordappsec/ooni-probe,juga0/ooni-probe,Karthikeyan-kkk/ooni-probe,0xPoly/ooni-probe,Karthikeyan-... | tests/test_runner.py | tests/test_runner.py | from twisted.trial import unittest
from ooni.inputunit import InputUnit
from ooni.nettest import NetTestCase
from ooni.reporter import OReporter
from ooni.runner import loadTestsAndOptions, runTestCasesWithInputUnit
class DummyTestCase(NetTestCase):
def test_a(self):
self.report['bar'] = 'bar'
def ... | bsd-2-clause | Python | |
5e5e58b705d30df62423ec8bb6018c6807114580 | Add the app config for osf registrations | laurenbarker/SHARE,aaxelb/SHARE,aaxelb/SHARE,zamattiac/SHARE,zamattiac/SHARE,laurenbarker/SHARE,CenterForOpenScience/SHARE,laurenbarker/SHARE,aaxelb/SHARE,zamattiac/SHARE,CenterForOpenScience/SHARE,CenterForOpenScience/SHARE | providers/io/osf/registrations/apps.py | providers/io/osf/registrations/apps.py | from share.provider import ProviderAppConfig
from .harvester import OSFRegistrationsHarvester
class AppConfig(ProviderAppConfig):
name = 'providers.io.osf.registrations'
version = '0.0.1'
title = 'osf_registrations'
long_title = 'Open Science Framework Registrations'
home_page = 'http://api.osf.io... | apache-2.0 | Python | |
04fa680f4be4afc44dc0df3834b096d8fa7a05ac | Add tests for nbgrader update | jupyter/nbgrader,jhamrick/nbgrader,jupyter/nbgrader,jhamrick/nbgrader,jupyter/nbgrader,jupyter/nbgrader,jhamrick/nbgrader,jhamrick/nbgrader,jupyter/nbgrader | nbgrader/tests/apps/test_nbgrader_update.py | nbgrader/tests/apps/test_nbgrader_update.py | from os.path import join
from .. import run_nbgrader
from .base import BaseTestApp
class TestNbGraderUpdate(BaseTestApp):
def test_help(self):
"""Does the help display without error?"""
run_nbgrader(["update", "--help-all"])
def test_no_args(self):
"""Is there an error if no argumen... | bsd-3-clause | Python | |
48d6c81e79e867d448380a087f81b034b162d5bf | Add GostTrack implementation | Acruxx/ARS | GostTrack.py | GostTrack.py | class GostTrack:
def __init__(self):
self.list_size = 0
self.current_pos = 0
self.pos_list = []
def add_pos(self, ang, rad):
self.list_size += 1
self.pos_list.append((ang, rad))
def get_next_pos(self):
if self.list_size == self.list_size:
self.c... | mit | Python | |
6e74d412681f36b921d84c0cc72929be0a3df828 | Use threadlocals to store middleware data instead of the request | kbussell/django-auditlog,chris-griffin/django-auditlog,johnrtipton/django-auditlog,jjkester/django-auditlog,robmagee/django-auditlog,Zmeylol/auditlog,rauleb/django-auditlog | src/auditlog/middleware.py | src/auditlog/middleware.py | from __future__ import unicode_literals
import threading
import time
from django.conf import settings
from django.db.models.signals import pre_save
from django.utils.functional import curry
from django.db.models.loading import get_model
from auditlog.models import LogEntry
threadlocal = threading.local()
class Au... | from __future__ import unicode_literals
import time
from django.conf import settings
from django.db.models.signals import pre_save
from django.utils.functional import curry
from django.db.models.loading import get_model
from auditlog.models import LogEntry
class AuditlogMiddleware(object):
"""
Middleware to... | mit | Python |
9df5fc2493e38a30f44edcad97d0aebd415f97be | Add doosabin/generate_doosabin_test_data.py | rstebbing/subdivision,rstebbing/subdivision | doosabin/generate_doosabin_test_data.py | doosabin/generate_doosabin_test_data.py | # generate_doosabin_test_data.py
# Imports
from cStringIO import StringIO
from functools import partial
import numpy as np
np.random.seed(1337)
import doosabin
from verification.common import example_extraordinary_patch
s = StringIO()
def savetxt(type_, fmt, name, X):
X = np.atleast_2d(X)
s.w... | mit | Python | |
ba6f426ca3f1eaf909cfa6257673a1800cc1c8fe | add download url script | rboman/progs,rboman/progs,rboman/progs,rboman/progs,rboman/progs,rboman/progs,rboman/progs,rboman/progs,rboman/progs,rboman/progs | sandbox/webapi/dropboxapi_download_url.py | sandbox/webapi/dropboxapi_download_url.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import json
import requests
import os.path
def get_api_token():
"""read my api token
"""
with open('E:\Dropbox\Bin\dropbox_api_token.txt') as f:
token = f.readline().rstrip()
#print "token='{}'".format(token)
return token
def download(url, f... | apache-2.0 | Python | |
7eff8eb8e72b7b23d2a8440f7aa97694625932dc | Add methods for processing raw data from pickled file | borgarlie/TDT4501-Specialization-Project | seq2seq_summarization/process_raw_data.py | seq2seq_summarization/process_raw_data.py | import pickle
import re
def process_text(text):
"""
This function uses multiple steps to process the input properly
1) Remove all html tags from the text
2) Lower case every character
3) Remove all special characters except punctuation, comma, exclamation mark and question mark
4) Make all the... | mit | Python | |
729fda094a195c4c24846e637fcba70b5d416f18 | add .py version of upcoming2posts | thehackerwithin/berkeley,thehackerwithin/berkeley,thehackerwithin/berkeley,thehackerwithin/berkeley,thehackerwithin/berkeley,thehackerwithin/berkeley | docs/upcoming2posts.py | docs/upcoming2posts.py |
# coding: utf-8
# # upcoming2posts
#
# By Stuart Geiger (@staeiou), MIT license
#
# This is a script you run the day after THW, which changes yesterday's file from "upcoming" to "posts" so that the next week's topic shows on the main page.
# In[78]:
# In[1]:
import datetime
from datetime import timedelta
import... | bsd-3-clause | Python | |
c7a9ed8771039be0fa8288cf0cca14f44a1f3d35 | Add timeslice example | tamasgal/km3pipe,tamasgal/km3pipe | examples/offline_analysis/timeslices.py | examples/offline_analysis/timeslices.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ts=4 sw=4 et
"""
==================
Reading Timeslices
==================
This examples show how to access L0, L1, L2 and SN timeslice streams using
km3pipe. Note that you need an activated Jpp environment and jppy installed
(http://git.km3net.de/km3py/jppy.git).
B... | mit | Python | |
5ef616d0563f9e4f29ef7eaa3c163d24cf3e131f | Add simple integration test for memory profiler | jitseniesen/spyder-memory-profiler,jitseniesen/spyder-memory-profiler,spyder-ide/spyder.memory_profiler | spyder_memory_profiler/widgets/tests/test_memoryprofiler.py | spyder_memory_profiler/widgets/tests/test_memoryprofiler.py | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) Spyder Project Developers
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Tests for m... | mit | Python | |
6b3d2ae77f3c1eb9b960cf01e1a94ec6fdbf6632 | load information from res1.mat | judithyueli/pyFKF | CO2simulation.py | CO2simulation.py | import scipy.io
import numpy as np
# class CO2simulation(object):
# def __init__(self, resolution):
# """
# resolution: low(59x55), medium(117x109), large(217x234)
# """
# Load Vp1.mat, Vp2.mat, Vp3.mat into
resolution = 'low'
if resolution is 'low':
Vp_dict = scipy.io.loadmat('./data/Res1.mat')
elif r... | mit | Python | |
58af5137225855ffbfa62a03dc1015570ef0d203 | Purge beffer just in case before getting the result | DMOJ/site,Phoenix1369/site,Phoenix1369/site,monouno/site,Minkov/site,Minkov/site,Minkov/site,monouno/site,monouno/site,monouno/site,Phoenix1369/site,monouno/site,DMOJ/site,DMOJ/site,Minkov/site,DMOJ/site,Phoenix1369/site | judge/math_parser.py | judge/math_parser.py | from HTMLParser import HTMLParser
import re
from django.conf import settings
MATHTEX_CGI = getattr(settings, 'MATHTEX_CGI', 'http://www.forkosh.com/mathtex.cgi')
inline_math = re.compile(r'~(.*?)~|\\\((.*?)\\\)')
display_math = re.compile(r'\$\$(.*?)\$\$|\\\[(.*?)\\\]')
REPLACES = [
(u'\u2264', r'\le'),
(u... | from HTMLParser import HTMLParser
import re
from django.conf import settings
MATHTEX_CGI = getattr(settings, 'MATHTEX_CGI', 'http://www.forkosh.com/mathtex.cgi')
inline_math = re.compile(r'~(.*?)~|\\\((.*?)\\\)')
display_math = re.compile(r'\$\$(.*?)\$\$|\\\[(.*?)\\\]')
REPLACES = [
(u'\u2264', r'\le'),
(u... | agpl-3.0 | Python |
21295e723abbff6c9a04c19179e7c61658f36418 | Create clickhouse_system_metrics.py | site24x7/plugins,site24x7/plugins,site24x7/plugins | clickhouse/clickhouse_system_metrics/clickhouse_system_metrics.py | clickhouse/clickhouse_system_metrics/clickhouse_system_metrics.py | #!/usr/bin/python
'''
Site24x7 Plugin to monitor Clickhouse Asynchronous metrics
'''
from clickhouse_driver import Client
import json
import argparse
### Query: SELECT event, value FROM system.events
### Ignored metrics
### "BackgroundBufferFlushSchedulePoolTask", "BackgroundDistributedSchedulePoolTask", "BackgroundM... | bsd-2-clause | Python | |
e5304549600ab58687c97f58aa37e2734b55c735 | add a command to clear task metas | dstufft/jutils | crate_project/apps/crate/management/commands/clear_celery_meta.py | crate_project/apps/crate/management/commands/clear_celery_meta.py | import redis
from django.conf import settings
from django.core.management.base import BaseCommand
class Command(BaseCommand):
def handle(self, *args, **options):
r = redis.StrictRedis(host=settings.GONDOR_REDIS_HOST, port=settings.GONDOR_REDIS_PORT, password=settings.GONDOR_REDIS_PASSWORD)
i = 0... | bsd-2-clause | Python | |
0bda6b7c6b77144c9a356d3e5846b365d2ce4600 | add TextRenderer protocol | mozman/ezdxf,mozman/ezdxf,mozman/ezdxf,mozman/ezdxf,mozman/ezdxf | src/ezdxf/addons/drawing/text_renderer.py | src/ezdxf/addons/drawing/text_renderer.py | # Copyright (c) 2022, Manfred Moitzi
# License: MIT License
from typing import TypeVar
from typing_extensions import Protocol
from ezdxf.tools.fonts import FontFace, FontMeasurements
from ezdxf.path import Path
T = TypeVar("T")
class TextRenderer(Protocol):
"""Minimal requirement to be usable as a universal te... | mit | Python | |
e05345f3133313c77ebf1dd26c8a44a5d4d98cfe | add test_TreeReaderPackage.py | alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl,TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl | tests/test_TreeReaderPackage.py | tests/test_TreeReaderPackage.py | #!/usr/bin/env python
from AlphaTwirl import TreeReaderPackage
import unittest
##____________________________________________________________________________||
class MockReader(object):
pass
##____________________________________________________________________________||
class MockCollector(object):
def __ini... | bsd-3-clause | Python | |
2ab5dc1d9f2f19811e168aef90df086bcb618909 | Create /tests02_treat/ with __init__.py | ToFuProject/tofu,Didou09/tofu,ToFuProject/tofu | tests/tests02_treat/__init__.py | tests/tests02_treat/__init__.py | """
This module contains tests for tofu.geom in its structured version
"""
# Nose-specific
from nose import with_setup # optional
#######################################################
#
# Setup and Teardown
#
#######################################################
def setup_module(module):
print ("")... | mit | Python | |
60ae1e1288a34e56fe42191e2f496e67a293e808 | Add conversion tool for apocraphya - messy regexes | kiwiheretic/logos-v2,kiwiheretic/logos-v2,kiwiheretic/logos-v2,kiwiheretic/logos-v2 | tools/convert_apo.py | tools/convert_apo.py | # convert TRK apo books to cancelbot format
import os
import csv
import re
import pdb
def convert_file(filename_in, filename_out):
print "Converting %s to %s" % (filename_in, filename_out)
fin = open(filename_in,"r")
fout = open(filename_out + ".txt","w")
chapter = 1 # some files don't have chapter nu... | apache-2.0 | Python | |
d5fdbc97dbf64e2a49a898644f03b2ead27c5095 | Add an interface for ContainerRegistry | onitake/Uranium,onitake/Uranium | UM/Settings/ContainerRegistry.py | UM/Settings/ContainerRegistry.py | # Copyright (c) 2016 Ultimaker B.V.
# Uranium is released under the terms of the AGPLv3 or higher.
from UM.PluginRegistry import PluginRegistry
## Central class to manage all Setting containers.
#
#
class ContainerRegistry:
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
s... | agpl-3.0 | Python | |
548cf8f797abae99658573c289747cc498be3a5a | add dispatch | talkincode/toughlib | toughlib/dispatch.py | toughlib/dispatch.py | #!/usr/bin/env python
# coding=utf-8
import types
class EventDispatcher:
def __init__(self, prefix="event_"):
self.prefix = prefix
self.callbacks = {}
def sub(self, name, meth):
self.callbacks.setdefault(name, []).append(meth)
def register(self, obj):
from twisted.pytho... | mit | Python | |
c8e4fc3cea9cb294a609eccc5024a25fc20ddc29 | Add tests for failedloginblocker | mysociety/django-failedloginblocker | tests.py | tests.py | from django.test import TestCase
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
class FailedLoginBlockerTest(TestCase):
def setUp(self):
self.test_user = User.objects.create_user('test_user', 'test@example.com', 'password')
self.login_url = reverse('login'... | bsd-3-clause | Python | |
71fd282aed8b299e3365c84df6d9a7b282157d45 | Update shopping_app | gr1d99/shopping-list,gr1d99/shopping-list,gr1d99/shopping-list | shopping_app.py | shopping_app.py | import configparser
import os
from flask import Flask
from views import (IndexView, AddItemsView, DashboardView,
LoginView, Logout, RegisterView,
RemoveShoppingList, ShoppingListDetail)
BASEDIR = os.path.dirname(os.path.abspath(__file__))
app = Flask(__name__)
config = configpars... | import configparser
import os
from flask import Flask
from views import (IndexView, AddItemsView, DashboardView,
LoginView, Logout, RegisterView,
RemoveShoppingList, ShoppingListDetail)
BASEDIR = os.path.dirname(os.path.abspath(__file__))
app = Flask(__name__)
config = configpars... | mit | Python |
f1c49a22a57f81a2d9358507c98e6527861ba3f3 | add project tag command | macarthur-lab/seqr,ssadedin/seqr,macarthur-lab/xbrowse,ssadedin/seqr,macarthur-lab/xbrowse,macarthur-lab/seqr,ssadedin/seqr,macarthur-lab/xbrowse,macarthur-lab/seqr,macarthur-lab/xbrowse,ssadedin/seqr,macarthur-lab/xbrowse,macarthur-lab/seqr,macarthur-lab/seqr,ssadedin/seqr,macarthur-lab/xbrowse | seqr/management/commands/add_project_tag.py | seqr/management/commands/add_project_tag.py | from django.core.management.base import BaseCommand, CommandError
from django.db.models.query_utils import Q
from seqr.models import Project, VariantTagType
from seqr.model_utils import create_seqr_model
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('--project', help='... | agpl-3.0 | Python | |
e762fc5b9ceb1fda0c61bec64a5ec795af66e1f0 | add migration to update Meta options | gpodder/mygpo,gpodder/mygpo,gpodder/mygpo,gpodder/mygpo | mygpo/podcasts/migrations/0021_meta.py | mygpo/podcasts/migrations/0021_meta.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('podcasts', '0020_extend_episode_mimetypes'),
('contenttypes', '__first__'),
]
operations = [
migrations.AlterModelOp... | agpl-3.0 | Python | |
c6efc8f73c264dd57a7d248d0aa33858863de826 | Update clipboard_pygame.py | jegger/kivy,Ramalus/kivy,MiyamotoAkira/kivy,viralpandey/kivy,jegger/kivy,kivy/kivy,CuriousLearner/kivy,darkopevec/kivy,denys-duchier/kivy,thezawad/kivy,kived/kivy,Ramalus/kivy,CuriousLearner/kivy,habibmasuro/kivy,jkankiewicz/kivy,xiaoyanit/kivy,xiaoyanit/kivy,dirkjot/kivy,angryrancor/kivy,rnixx/kivy,MiyamotoAkira/kivy,... | kivy/core/clipboard/clipboard_pygame.py | kivy/core/clipboard/clipboard_pygame.py | '''
Clipboard Pygame: an implementation of the Clipboard using pygame.scrap.
'''
__all__ = ('ClipboardPygame', )
from kivy.utils import platform
from kivy.compat import PY2
from kivy.core.clipboard import ClipboardBase
if platform not in ('win', 'linux', 'macosx'):
raise SystemError('unsupported platform for pyg... | '''
Clipboard Pygame: an implementation of the Clipboard using pygame.scrap.
'''
__all__ = ('ClipboardPygame', )
from kivy.utils import platform
from kivy.compat import PY2
from kivy.core.clipboard import ClipboardBase
if platform not in ('win', 'linux', 'macosx'):
raise SystemError('unsupported platform for pyg... | mit | Python |
efd3fbf51be25b46e3d5dd0cb76aaab60de7e4c8 | Add a file allowing you to try it manually | 3DHubs/Ranch | tryit.py | tryit.py | import json
from ranch import Address, InvalidAddressException
filename = input('Read data from: [data/export.json] ')
if filename == '':
filename = 'data/export.json'
with open(filename, 'r') as data:
specs = json.load(data)
a = Address(specs)
while not a.is_valid():
fields = a.get_field_types()
... | apache-2.0 | Python | |
02a2d195ffe1c14fc04eb58fb62ee8dbdee70318 | add Xray | JohanComparat/nbody-npt-functions,JohanComparat/nbody-npt-functions | multidark/bin_SMHMr/add_Ms_Xray.py | multidark/bin_SMHMr/add_Ms_Xray.py | import StellarMass
import XrayLuminosity
import numpy as n
from scipy.stats import norm
from scipy.integrate import quad
from scipy.interpolate import interp1d
import glob
import astropy.io.fits as fits
import os
import time
import numpy as n
import sys
# set up box, and redshift
aexp = 0.74230
z = 1./0.74230 -1.
fi... | cc0-1.0 | Python | |
de438ae338f0fff48edff1e148ae860bf9354fc3 | Create 2-motors.py | CamJam-EduKit/EduKit3 | Code/2-motors.py | Code/2-motors.py | # CamJam EduKit 3 - Robotics
# Worksheet 2 - Motor Test Code
import RPi.GPIO as GPIO # Import the GPIO Library
import time # Import the Time library
# Set the GPIO modes
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
# Set the GPIO Pin mode
GPIO.setup(7, GPIO.OUT)
GPIO.setup(8, GPIO.OUT)
GPIO.setup(9, GPIO.OUT)
GPIO... | mit | Python | |
d32414164552f48226842176e05229f6895e3c1d | Add test utility for creating users. | CTPUG/wafer,CTPUG/wafer,CTPUG/wafer,CTPUG/wafer | wafer/tests/utils.py | wafer/tests/utils.py | """Utilities for testing wafer."""
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Permission
def create_user(username, email=None, superuser=False, perms=()):
if superuser:
create = get_user_model().objects.create_superuser
else:
create = get_user_model(... | isc | Python | |
fb616d3e5e9db85a107b130293944fa53c262649 | add engine_saki | jay-tyler/data-petting-zoo,jay-tyler/data-petting-zoo,jay-tyler/data-petting-zoo | engine_saki.py | engine_saki.py | import pandas as pd
import numpy as np
from pandas import Series, DataFrame
import re
from rules import name_rules, geofeat_rules
# Warn if a value is being assigned to a copy
pd.set_option('mode.chained_assignment', 'warn')
# Imports of needed data
gb = pd.read_pickle("data/pickles/gb.pk1")
def setgb(file_path):
... | mit | Python | |
76d2119cd6b065dddc85046e302f55188ae1207b | Create test_package.py | sebi06/BioFormatsRead,dvdmena/BioFormatsRead | test_package.py | test_package.py | import numpy as np
import os
import bfimage as bf
filename = r'C:\Python_ZEN_Output\Experiment-454.czi'
imgbase = os.path.basename(filename)
imgdir = os.path.dirname(filename)
## get image meta-information
MetaInfo = bf.bftools.get_relevant_metainfo_wrapper(filename)
img6d = bf.bftools.getImage6D(filename, MetaInfo['... | bsd-2-clause | Python | |
089c1529a74cbe8f294b5ef4e81ec144a44a5a7b | Add broker object tests. | AdamGagorik/pydarkstar,LegionXI/pydarkstar | tests/broker.py | tests/broker.py | """
.. moduleauthor:: Adam Gagorik <adam.gagorik@gmail.com>
"""
import unittest
import pydarkstar.logutils
import pydarkstar.database
import pydarkstar.broker
import pydarkstar.rc
pydarkstar.logutils.setDebug()
class TestDarkObject(unittest.TestCase):
def setUp(self):
self.db = pydarkstar.database.Databas... | mit | Python | |
aae317c01772b46cad96adaab5c7611897b1ade5 | add configuration for NDK 25 and Android API 32 (12L) | opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv,opencv/opencv | platforms/android/ndk-25.config.py | platforms/android/ndk-25.config.py | # Docs: https://developer.android.com/ndk/guides/cmake#android_native_api_level
ANDROID_NATIVE_API_LEVEL = int(os.environ.get('ANDROID_NATIVE_API_LEVEL', 32))
cmake_common_vars = {
# Docs: https://source.android.com/docs/setup/about/build-numbers
# Docs: https://developer.android.com/studio/publish/versioning
... | apache-2.0 | Python | |
b62b0c79e5da2312867ce44078e6098edcc09a5c | Implement more unit tests | amicks/Speculator | speculator/tests/unit/test_poloniex.py | speculator/tests/unit/test_poloniex.py | import unittest
from speculator.utils import poloniex
# https://poloniex.com/public?command=returnChartData¤cyPair=USDT_BTC&start=1483228800&end=1483272000&period=86400
EXPECTED_RESPONSE = [{'close': 999.36463982,
'date': 1483228800,
'high': 1008.54999326,
... | mit | Python | |
e6e1a737e729a40dbda35a41fc861720f79c6907 | Fix OSS build. | facebook/SoLoader,facebook/SoLoader,facebook/SoLoader | build_defs/fb_core_android_library.bzl | build_defs/fb_core_android_library.bzl | """OSS shim of the internal fb_core_android_library macros."""
def fb_core_android_library(**kwargs):
native.android_library(**kwargs)
| apache-2.0 | Python | |
251607873e6da532040882a9873c47c7d7998dcf | Add __main__.py file to drupdate package | jalama/drupdates | drupdates/__main__.py | drupdates/__main__.py | from drupdates import main
main()
| mit | Python | |
374428e14e4291856659b0043cd01b51e0aca141 | Add main.py example | openmv/openmv,tianzhihen/openmv,tianzhihen/openmv,kwagyeman/openmv,SmartArduino/openmv,openmv/openmv,SmartArduino/openmv,kwagyeman/openmv,SmartArduino/openmv,iabdalkader/openmv,kwagyeman/openmv,tianzhihen/openmv,openmv/openmv,openmv/openmv,iabdalkader/openmv,iabdalkader/openmv,tianzhihen/openmv,SmartArduino/openmv,kwag... | usr/examples/main.py | usr/examples/main.py | import led, time
while (vcp_is_connected()==False):
led.on(led.BLUE)
time.sleep(150)
led.off(led.BLUE)
time.sleep(100)
led.on(led.BLUE)
time.sleep(150)
led.off(led.BLUE)
time.sleep(600)
| mit | Python | |
38a20b4746230d9e6b62d9a93aaa4102087d20e2 | Add User Handler | kkstu/Torweb,kkstu/Torweb | handler/user.py | handler/user.py | #!/usr/bin/python
# -*- coding:utf-8 -*-
# Powered By KK Studio
from BaseHandler import BaseHandler
class LoginHandler(BaseHandler):
def get(self):
self.render('user/login.html')
class RegisterHandler(BaseHandler):
def get(self):
self.render('user/register.html') | mit | Python | |
4c17b9e487e3e423f77d15fcefc9e78694d3b806 | Add sql2csv utility | Jobava/csvkit,elcritch/csvkit,gepuro/csvkit,KarrieK/csvkit,reubano/csvkit,arowla/csvkit,bmispelon/csvkit,kyeoh/csvkit,dannguyen/csvkit,cypreess/csvkit,aequitas/csvkit,nriyer/csvkit,bradparks/csvkit__query_join_filter_CSV_cli,haginara/csvkit,moradology/csvkit,barentsen/csvkit,tlevine/csvkit,archaeogeek/csvkit,matterker/... | csvkit/utilities/sql2csv.py | csvkit/utilities/sql2csv.py | #!/usr/bin/env python
from argparse import FileType
import sys
from csvkit import CSVKitWriter
from csvkit import sql
from csvkit import table
from csvkit.cli import CSVKitUtility
class SQL2CSV(CSVKitUtility):
description = 'Execute an SQL query on a database and output the result to a CSV file.'
override_fl... | mit | Python | |
1c659e3f58a23beabaab2a2aaa917fe7d35bf4e3 | add a setup_package for ALMA data (needed for the cycle0 table) | ceb8/astroquery,ceb8/astroquery,imbasimba/astroquery,imbasimba/astroquery | astroquery/alma/setup_package.py | astroquery/alma/setup_package.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
def get_package_data():
paths = [os.path.join('data', 'cycle0_delivery_asdm_mapping.txt'),
]
return {'astroquery.alma': paths}
| bsd-3-clause | Python | |
b43501a6f0a01330f5c65a1998319e4edd96d864 | Create IRC2Interview.py | junh1024/IRC2Interview | IRC2Interview.py | IRC2Interview.py | from io import StringIO
text = """
<junh1024> Both upscaled to 2/3 ch
<junh1024> I upscale to 6/7 ch this time
<junh1024> In prev 2, i made fake stereo width, this time, it's all real stereo, but i chopped it up lots
<junh1024> so 3xstereo vs 3xmono
<drf|Desktop> I mean
<drf|Desktop> I'm still fine with just making ... | agpl-3.0 | Python | |
2ab367a28919763d2ec2ebb435b51c1545c16a6f | add s3stat tool | capitalone/cloud-custodian,VeritasOS/cloud-custodian,ocampocj/cloud-custodian,sixfeetup/cloud-custodian,FireballDWF/cloud-custodian,stevenmjo/cloud-custodian,jeffastorey/cloud-custodian,alfredgamulo/cloud-custodian,gwh59/cloud-custodian,scotwk/cloud-custodian,jimmyraywv/cloud-custodian,siddartha1992/cloud-custodian,Joh... | tools/s3stat.py | tools/s3stat.py | from datetime import datetime, timedelta
import boto3
import json
import pprint
import logging
import os
def bucket_info(c, bucket):
result = {'Bucket': bucket}
response = c.get_metric_statistics(
Namespace='AWS/S3',
MetricName='NumberOfObjects',
Dimensions=[
{'Na... | apache-2.0 | Python | |
710a4db6c9e50f09de3359b8b53b3003e41e8480 | Add a simple watchdog python script. | sitedyno/krad_radio,sitedyno/krad_radio,sitedyno/krad_radio,sitedyno/krad_radio | watchdog.py | watchdog.py | #!/usr/bin/env
'''Watchdog script to keep a krad_radio instance running'''
import subprocess
import time
class Daemon:
def __init__(self):
self.cmd = 'krad_radio_daemon'
self.station = 'test'
self.running = False
def log(self, msg):
timestamp = time.strftime('%Y-%M-%d %H:%M:%S', time.gmtime())
... | isc | Python | |
f30d459b8527074e50de504695491ad17bb18f0e | Add tests for exclude passing | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/pytests/unit/states/test_saltmod.py | tests/pytests/unit/states/test_saltmod.py | import pytest
import salt.modules.saltutil as saltutil
import salt.states.saltmod as saltmod
from tests.support.mock import create_autospec, patch
@pytest.fixture(autouse=True)
def setup_loader(request):
setup_loader_modules = {saltmod: {"__opts__": {"__role": "testsuite"}}}
with pytest.helpers.loader_mock(re... | apache-2.0 | Python | |
b7532ac5daa922fd9cf64b0cee01afedc7452101 | Remove hardcoded IP | zdanek/FrameworkBenchmarks,zhuochenKIDD/FrameworkBenchmarks,RockinRoel/FrameworkBenchmarks,circlespainter/FrameworkBenchmarks,testn/FrameworkBenchmarks,ashawnbandy-te-tfb/FrameworkBenchmarks,zapov/FrameworkBenchmarks,greenlaw110/FrameworkBenchmarks,leafo/FrameworkBenchmarks,lcp0578/FrameworkBenchmarks,circlespainter/Fr... | flask/app.py | flask/app.py | from flask import Flask, jsonify, request
from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy import create_engine
from random import randint
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://benchmarkdbuser:benchmarkdbpass@DBHOSTNAME:3306/hello_world'
db = SQLAlchemy(app)
dbraw_engine = c... | from flask import Flask, jsonify, request
from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy import create_engine
from random import randint
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql://benchmarkdbuser:benchmarkdbpass@192.168.0.12:3306/hello_world'
db = SQLAlchemy(app)
dbraw_engine =... | bsd-3-clause | Python |
5c003984a9fa0776e926ced2727b87284e37dbd3 | Create flotation.py | aknh9189/code | flotation.py | flotation.py |
# coding: utf-8
# In[1]:
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import numpy as np
get_ipython().magic(u'matplotlib inline')
# In[2]:
water = [0,2,2,3,1.5,1.5,3,2,2,2,2,2.5,2]
alc = [0,2.5,2.5,2.5,2.5,3,2.5,2.5]
weight = [20.9+(0.41*5*x) for x in range(0,13)]
actWater = [(22)+sum(wa... | mit | Python | |
0c4f140d887e339c8182abb3caf6def3406e700d | add new package at v2.3.3 (#22043) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/professor/package.py | var/spack/repos/builtin/packages/professor/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Professor(Package):
"""Professor Monte-Carlo tuning package"""
homepage = "https://pr... | lgpl-2.1 | Python | |
6143408507468c1718999bc2bc16d7e394741e29 | Add unit test for TimedProc regression | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/unit/utils/test_timed_subprocess.py | tests/unit/utils/test_timed_subprocess.py | # -*- coding: utf-8 -*-
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
# Import Salt Testing libs
from tests.support.unit import TestCase
# Import salt libs
import salt.utils.timed_subprocess as timed_subprocess
class TestTimedSubprocess(TestCase):
def test_timed... | apache-2.0 | Python | |
6b882d76e7ea141b12adb0464555d0f7526002fb | add word2vec skipgrams | raul-jr3/dope-learning | word2vec/gram_skip.py | word2vec/gram_skip.py | from keras.layers.core import Dense, Reshape
from keras.layers.embeddings import Embedding
from keras.models import Sequential
from keras.preprocessing.text import *
from keras.preprocessing.sequence import skipgrams
text = "I love green eggs and ham ."
tokenizer = Tokenizer()
tokenizer.fit_on_texts([text])
word2id... | mit | Python | |
e6cf2eb5bcc164e84672d1c2c2f653da6406220e | add example of querying a specific server | tomlanyon/dnspython | examples/query_specific.py | examples/query_specific.py | #!/usr/bin/env python
# Two ways of querying a specific nameserver.
from __future__ import print_function
import dns.message
import dns.rdataclass
import dns.rdatatype
import dns.query
# This way is just like nslookup/dig:
qname = dns.name.from_text('amazon.com')
q = dns.message.make_query(qname, dns.rdatatype.NS)... | isc | Python | |
5e93c27a8ba8fed12ae871b49e295cf773b3443a | Add the get_arguments function in include | softwaresaved/international-survey | survey_creation/include/get_arguments.py | survey_creation/include/get_arguments.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import getopt
"""
Short script to parse
the argments from the command line
"""
def get_arguments(argv):
"""
"""
country = None
year = None
try:
opts, args = getopt.getopt(argv, 'hc:y:', ['country=', 'year='])
except getopt.Geto... | bsd-3-clause | Python | |
4d6543c3860806730e2f3b7a6534418f0e75ff81 | add solution for Sort List | zhyu/leetcode,zhyu/leetcode | src/sortList.py | src/sortList.py | # Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param head, a ListNode
# @return a ListNode
def sortList(self, head):
if head is None or head.next is None:
return head
fast... | mit | Python | |
7f2f8afa2fcc187374608dbca111ae73dfc9b800 | Create new git-todo script using argparse. | alice1017/gitTools | git-todo2.py | git-todo2.py | #!/usr/bin/env python
#coding: utf-8
import os
import sys
import argparse
from util import core
from util import adjust
from util import objects
from util.git import *
from util.color import *
from util.objects import Todo
from subprocess import Popen, PIPE
from StringIO import String... | mit | Python | |
1f4aadc77bbc5e75db2737d5c580a887f5114945 | Add files via upload | jinro221/opseilen | LinkNaarRules.py | LinkNaarRules.py | import pygame
import sys
import os
from pygame.locals import *
pygame.init()
# Class spelregels openen
class spelregels:
def open_spelregel(self, open1):
self.open1 = img1
# Openen spelregels vanuit bestand (Emma's computer)
img1 = pygame.image.load(os.path.join('/Users/emmadrost/Documents/Developm... | mit | Python | |
754d4dc5feab67f55751ed07c706499e7d3dac89 | add Flask-Table hello.py | Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python,Akagi201/learning-python | flask/Flask-Table/hello.py | flask/Flask-Table/hello.py | # import things
from flask_table import Table, Col
# Declare your table
class ItemTable(Table):
name = Col('Name')
description = Col('Description')
# Get some objects
class Item(object):
def __init__(self, name, description):
self.name = name
self.description = description
items = [Ite... | mit | Python | |
39fc0fe91ca4bf787ceeab9ff594168f70fe0dba | Add a new version of dump source that actually marches along the nodes | michael-okeefe/soep-sandbox | src/python2/dump_source.py | src/python2/dump_source.py | # Import the JModelica.org Python packages
import pymodelica
from pymodelica.compiler_wrappers import ModelicaCompiler
# Create a compiler and compiler target object
mc = ModelicaCompiler()
# Build trees as if for an FMU or Model Exchange v 1.0
#target = mc.create_target_object("me", "1.0")
source = mc.parse_model("C... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.