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 |
|---|---|---|---|---|---|---|---|---|
e81658570f6589f3a0e912b5e30dc11f32b1d802 | replace blaze references to datashape in validate | ContinuumIO/datashape,llllllllll/datashape,quantopian/datashape,quantopian/datashape,cpcloud/datashape,cowlicks/datashape,blaze/datashape,llllllllll/datashape,cowlicks/datashape,aterrel/datashape,cpcloud/datashape,aterrel/datashape,ContinuumIO/datashape,blaze/datashape | datashape/validation.py | datashape/validation.py | # -*- coding: utf-8 -*-
"""
Datashape validation.
"""
from .error import DataShapeError
from . import coretypes as T
def traverse(f, t):
"""
Map f over t, calling `f` with type `t` and the map result of the mapping
`f` over `t`s parameters.
"""
if isinstance(t, T.Mono) and not isinstance(t, T.Un... | # -*- coding: utf-8 -*-
"""
Datashape validation.
"""
from .error import DataShapeError
from . import coretypes as T
def traverse(f, t):
"""
Map f over t, calling `f` with type `t` and the map result of the mapping
`f` over `t`s parameters.
"""
if isinstance(t, T.Mono) and not isinstance(t, T.Un... | bsd-2-clause | Python |
cc003f9bf3dfe2d8f4eba8f123fb23be1d9a393c | Add file for tests of grammar copy | PatrikValkovic/grammpy | tests/GrammarCopyTest.py | tests/GrammarCopyTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 16.08.2017 19:16
:Licence GNUv3
Part of grammpy
"""
from unittest import main, TestCase
from grammpy import *
class GrammarCopyTest(TestCase):
pass
if __name__ == '__main__':
main()
| mit | Python | |
39becc8d0c6c47db7d69119ca0c7d2fe49a2a654 | Add a simple jqlsearch script | eucalyptus/jira-scripts | jqlsearch.py | jqlsearch.py | #!/usr/bin/python
import sys
from jiraauth import jclient as jira
'''
Synopsis: This script runs an arbitrary JQL search
Example: jqlsearch.py 'project="SUP" and reporter="nbeard"'
'''
issues = jira.search_issues(sys.argv[1])
for x in issues:
print x.key + " | " + x.fields.summary
| bsd-2-clause | Python | |
9ef6927a99ccdc60ccb075e41d98d5978d63e72e | Add script to update the SkSL fuzzer corpus automatically. | aosp-mirror/platform_external_skia,google/skia,google/skia,google/skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,aosp-mirror/platform_external_skia,google/skia,google/skia,aosp-mirror/pla... | resources/sksl/update_fuzzer.py | resources/sksl/update_fuzzer.py | #!/usr/bin/env python
#
# Copyright 2021 Google LLC
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This tool updates the OSS-Fuzz corpus using Google Cloud's 'gsutil' tool.
# You will need to be given access to the Google Storage fuzzer repo (at
# gs://skia-f... | bsd-3-clause | Python | |
4826893c16a57f61b71b9af6d29feb5c526364dc | clean up records via migration | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/users/migrations/0036_reset_user_history_records.py | corehq/apps/users/migrations/0036_reset_user_history_records.py | # Generated by Django 2.2.24 on 2021-08-24 17:30
from django.db import migrations
import settings
from corehq.apps.users.models import UserHistory
from corehq.util.django_migrations import skip_on_fresh_install
@skip_on_fresh_install
def _reset_records(*args, **kwargs):
if not settings.IS_SAAS_ENVIRONMENT:
... | bsd-3-clause | Python | |
aeb55c6fd9bd9a5fca8f93c9e17b490da37abfac | Add test_live_render | willmcgugan/rich | tests/test_live_render.py | tests/test_live_render.py | import pytest
from rich.live_render import LiveRender
from rich.console import Console, ConsoleOptions
from rich.style import Style
from rich.segment import Segment
@pytest.fixture
def live_render():
return LiveRender(renderable="my string")
def test_renderable(live_render):
assert live_render.renderable ==... | mit | Python | |
6d67213b80350fe63e46ea2a18688f4a5a3f0d81 | Add test for 850: Matcher fails on zero-or-more. | Gregory-Howard/spaCy,honnibal/spaCy,aikramer2/spaCy,Gregory-Howard/spaCy,oroszgy/spaCy.hu,recognai/spaCy,Gregory-Howard/spaCy,oroszgy/spaCy.hu,explosion/spaCy,raphael0202/spaCy,aikramer2/spaCy,aikramer2/spaCy,Gregory-Howard/spaCy,spacy-io/spaCy,spacy-io/spaCy,spacy-io/spaCy,honnibal/spaCy,recognai/spaCy,aikramer2/spaCy... | spacy/tests/regression/test_issue850.py | spacy/tests/regression/test_issue850.py | '''
Test Matcher matches with '*' operator and Boolean flag
'''
from __future__ import unicode_literals
import pytest
from ...matcher import Matcher
from ...vocab import Vocab
from ...attrs import LOWER
from ...tokens import Doc
@pytest.mark.xfail
def test_issue850():
matcher = Matcher(Vocab())
IS_ANY_TOKEN ... | mit | Python | |
5206bc700a3ae1807e1b120f7b06f0e9991e3843 | Add the configobj/_version.py file. | csadorf/signac,csadorf/signac | signac/common/configobj/_version.py | signac/common/configobj/_version.py | __version__ = '5.1.0'
| bsd-3-clause | Python | |
edcfc4ab0a41a7f22f08b9b82876423cdd0c6cb0 | transform summary from json to csv | afunTW/lbps | summary.py | summary.py | import os
import glob
import json
import csv
def main():
summary = open('outfile.csv', 'w+')
csv_writer = csv.writer(summary)
trace_file = glob.glob('metadata/*')
metadata = {}
for filename in trace_file:
with open(filename, 'r') as f:
metadata[filename] = json.load(f)
fo... | mit | Python | |
9531a435c4ef60c80c67b8f2e06ac0abc83d0179 | Add test bluetooth agent | jawsper/snes_controller_emulator | tools/bluetooth-agent.py | tools/bluetooth-agent.py | #!/usr/bin/python2
# bluetooth agent for sixaxis auto connect
import dbus
import dbus.service
from dbus.mainloop.glib import DBusGMainLoop
DBusGMainLoop(set_as_default=True)
class SixAxisManager(dbus.service.Object):
def __init__(self, object_path):
dbus.service.Object.__init__(self, dbus.SystemBus(), object_pat... | mit | Python | |
25f1e9d2b28c98dd8ccfeaab73179fc003deb6f5 | Add a script for driving csmith to generate large compilation inputs. | sbc100/native_client,sbc100/native_client,sbc100/native_client,sbc100/native_client,sbc100/native_client,sbc100/native_client | tools/csmith-gen-many.py | tools/csmith-gen-many.py | #!/usr/bin/python
# Copyright (c) 2013 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# This code uses csmith to generate a large amount of .c files, change the entry
# point of each from main to entry_N and then cr... | bsd-3-clause | Python | |
a80e911ecb80ea39784013604d9dea9bd5ab2bc7 | Create LasR.AHL.py | imwiththou/PathwayNet | LasR.AHL.py | LasR.AHL.py | import ode
def inducer_AHL(t, y):
degradation = 0 * y[0]
return 0.0 - degradation
def mRNA_pTetR(t, y):
production = 0.062233 #Vmax
degradation = 0.0058 * y[1]
return production - degradation
def peptide_RBS1(t, y):
production = 0.595 * y[1]
degradation = 0.00116 ... | mit | Python | |
09a51971d1350fcdaa0d863c3b15d142302a7516 | Add script that requests new capabilities | onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle,onepercentclub/bluebottle | scripts/request_capabilities.py | scripts/request_capabilities.py | from bluebottle.clients.models import Client
from bluebottle.clients.utils import LocalTenant
from bluebottle.funding_stripe.utils import stripe
from bluebottle.funding_stripe.models import StripePayoutAccount
def run(*args):
for client in Client.objects.all():
with LocalTenant(client):
for a... | bsd-3-clause | Python | |
d9efc192acf4220051a865e36eb3cfa06371432a | add script for updating AWIPS counties in nws_ugc table | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | scripts/util/counties_update.py | scripts/util/counties_update.py | """
My purpose in life is to take the NWS AWIPS Geodata Counties Shapefile and
dump them into the NWSChat PostGIS database!
"""
from osgeo import ogr
from osgeo import _ogr
import sys
import os
import urllib2
import iemdb
import psycopg2.extras
mydb = iemdb.connect('postgis')
mcursor = mydb.cursor(cursor_factory=psyco... | mit | Python | |
b04f9c1f6c20e6f56f8d4c266034f865471f6be5 | delete cruft | qedsoftware/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/ex-submodules/casexml/apps/case/signals.py | corehq/ex-submodules/casexml/apps/case/signals.py | import warnings
from django.dispatch.dispatcher import Signal
from couchforms.signals import successful_form_received
from dimagi.utils.decorators.log_exception import log_exception
from couchforms.signals import xform_archived, xform_unarchived
def rebuild_form_cases(sender, xform, *args, **kwargs):
from casexml... | import warnings
from django.dispatch.dispatcher import Signal
from couchforms.signals import successful_form_received
from dimagi.utils.decorators.log_exception import log_exception
from couchforms.signals import xform_archived, xform_unarchived
def process_cases(sender, xform, config=None, **kwargs):
warnings.wa... | bsd-3-clause | Python |
3d8b654ef6552e66664c909249a6e5a26088f1c8 | Create integration_trapezoid.py | rupertsmall/numerical-tools,rupertsmall/numerical-tools | integration_trapezoid.py | integration_trapezoid.py | #numeric integration using the 2-point trapezoidal rule
from math import *
EPSILON = .0001 #base length of trapezoids
def evaluate_function(func, a):
func_at_a = eval(func.replace('x', str(a)))
return func_at_a
#doesnt yet take into account ability of domain a,b to have b<a
def integrate(func, domain):
... | mit | Python | |
4719167b6ee1c6dd276218c84b15b9cba4fefc2e | Add example for using sync protocol in pox | jmiserez/sts,jmiserez/sts | config/pox_sync.py | config/pox_sync.py | from config.experiment_config_lib import ControllerConfig
from sts.control_flow.fuzzer import Fuzzer
from sts.input_traces.input_logger import InputLogger
from sts.simulation_state import SimulationConfig
from sts.invariant_checker import InvariantChecker
from sts.topology import MeshTopology, BufferedPatchPanel
from s... | apache-2.0 | Python | |
77cbf82de63b30fac3ab5f8f6333f72b56af3ed5 | Add basic admin configuration | rlmuraya/ipv6map,rlmuraya/ipv6map,rlmuraya/ipv6map,rlmuraya/ipv6map | ipv6map/geodata/admin.py | ipv6map/geodata/admin.py | from django.contrib import admin
from . import models
class BaseReadOnlyAdmin(admin.ModelAdmin):
list_display_links = None
def has_change_permission(self, request, obj=None):
return False if obj else True
@admin.register(models.Version)
class VersionAdmin(BaseReadOnlyAdmin):
list_display = ['p... | unlicense | Python | |
980307e3854b25653b0494c5e3c476336035a5d1 | Add 100-same-tree.py | mvj3/leetcode | 100-same-tree.py | 100-same-tree.py | """
Question:
Same Tree
Given two binary trees, write a function to check if they are equal or not.
Two binary trees are considered equal if they are structurally identical and the nodes have the same value.
Performance:
1. Total Accepted: 83658 Total Submissions: 200527 Difficulty: Easy
2. Your ... | mit | Python | |
41beca23fff6eab718550d0ce8d22769653c3109 | Update test suite to include dataverse and dataset tests. | ekoi/DANS-DVN-4.6.1,ekoi/DANS-DVN-4.6.1,quarian/dataverse,leeper/dataverse-1,leeper/dataverse-1,bmckinney/dataverse-canonical,bmckinney/dataverse-canonical,JayanthyChengan/dataverse,quarian/dataverse,quarian/dataverse,leeper/dataverse-1,leeper/dataverse-1,JayanthyChengan/dataverse,JayanthyChengan/dataverse,quarian/data... | sauce_test/test_suite.py | sauce_test/test_suite.py | # This contain a list of individual test and will be run from Jenkins.
import unittest
import access_dvn
import test_dataverse
import test_dataset
# This is a list of testFileName.testClass
def suite():
return unittest.TestSuite((\
unittest.makeSuite(access_dvn.AccessDVN),
unittest.makeSuite(test_... | # This contain a list of individual test and will be run from Jenkins.
import unittest
import access_dvn
# This is a list of testFileName.testClass
def suite():
return unittest.TestSuite((\
unittest.makeSuite(access_dvn.AccessDVN),
))
if __name__ == "__main__":
result = unittest.TextTestRunne... | apache-2.0 | Python |
b16ca560e3280851ade3b325101413c1cdeeb4a5 | update to 0.18 | NoRedInk/elm-ops-tooling,NoRedInk/elm-ops-tooling | update_018_elm_package.py | update_018_elm_package.py | #! /usr/bin/env python
from __future__ import print_function
import elm_deps_upgrade as upgrader
from collections import OrderedDict
import json
import requests
import argparse
import sys
import re
import os
import glob
KNOWN_MOVES = {
'evancz/elm-http' : 'elm-lang/http'
}
def upgrade_elm_version(version):
... | bsd-3-clause | Python | |
fc174e8cd6dabf467507de5e93355a02e725bd1b | Add a script for formatting header-guards. | lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan,lowRISC/opentitan | util/fix_include_guard.py | util/fix_include_guard.py | #!/usr/bin/env python3
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
# fix_include_guard.py script takes any number of C or C++ header files as
# input, and formats their include guards to conform to the style mandated... | apache-2.0 | Python | |
abd4edb2b34c81def31f92761078c10d55baf679 | Add tests for HOGFeatureProducer | dave-lab41/pelops,d-grossman/pelops,d-grossman/pelops,Lab41/pelops,Lab41/pelops,dave-lab41/pelops | testci/test_hog_feature.py | testci/test_hog_feature.py | from PIL import Image
from skimage import color
from skimage.feature import hog
import collections
import datetime
import numpy as np
import pytest
from itertools import product
from pelops.features.hog import HOGFeatureProducer
@pytest.fixture
def img_data():
DATA = [[[ 0, 0, 0],
[255, 255, 25... | apache-2.0 | Python | |
41b19d7e9c4064e8914038ded08ffc1332570b2e | add unl harvester | CenterForOpenScience/scrapi,erinspace/scrapi,CenterForOpenScience/scrapi,erinspace/scrapi,fabianvf/scrapi,fabianvf/scrapi | scrapi/harvesters/unl.py | scrapi/harvesters/unl.py | '''
Harvester for the DigitalCommons@University of Nebraska - Lincoln for the SHARE project
Example API call: http://digitalcommons.unl.edu/do/oai/?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals
from scrapi.base import OAIHarvester
class UnlHarvester(OAIHarvester):
short_name... | apache-2.0 | Python | |
7f8780957e52fe06d045098096893ae818fa878a | test that transactions expire from mempool | Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc,Bitcoin-ABC/bitcoin-abc | test/functional/mempool_expiry.py | test/functional/mempool_expiry.py | #!/usr/bin/env python3
# Copyright (c) 2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Tests that a mempool transaction expires after a given timeout and that its
children are removed as well.
B... | mit | Python | |
0d6419ef997ab3c3e47238731d02054b7abab524 | add a test for issue #220 | tommy-u/chaco,tommy-u/chaco,tommy-u/chaco | chaco/tests/test_cmap_image_plot.py | chaco/tests/test_cmap_image_plot.py | import unittest
import mock
import numpy
import scipy.special
from enable.api import AbstractWindow
from chaco.api import (
CMapImagePlot, DataRange1D, DataRange2D, GridDataSource, GridMapper,
ImageData)
from chaco.default_colormaps import Spectral
class TestCMapImagePlot(unittest.TestCase):
def test_r... | bsd-3-clause | Python | |
a13f23b5f1b11b40db3325c46add3508f43cf649 | Add a test for `qilinguist list` | aldebaran/qibuild,aldebaran/qibuild,aldebaran/qibuild,aldebaran/qibuild | python/qilinguist/test/test_qilinguist_list.py | python/qilinguist/test/test_qilinguist_list.py | ## Copyright (c) 2012-2015 Aldebaran Robotics. All rights reserved.
## Use of this source code is governed by a BSD-style license that can be
## found in the COPYING file.
from qibuild.test.conftest import TestBuildWorkTree
def test_simple(qilinguist_action, record_messages):
build_worktree = TestBuildWorkTree()
... | bsd-3-clause | Python | |
12a238b162a56e92fe6e2f06ee2343fd808f7853 | Create BobSubmission.py | JessicaGarson/ExercismSubmissions | BobSubmission.py | BobSubmission.py |
#Bob is a lackadaisical teenager. In conversation, his responses are very limited.
#Bob answers 'Sure.' if you ask him a question.
#He answers 'Whoa, chill out!' if you yell at him.
#He says 'Fine. Be that way!' if you address him without actually saying
#anything.
#He answers 'Whatever.' to anything else.
# Skeleton... | unlicense | Python | |
f3e0664c4b062587badaa86ddfc9e75711ecf631 | Use Trie to find no of words matching pattern | sayak1711/coding_solutions,sayak1711/coding_solutions,sayak1711/coding_solutions,sayak1711/coding_solutions | coding-practice/Trie/count_using_wildcards.py | coding-practice/Trie/count_using_wildcards.py | class Trie:
def __init__(self):
self.root = {}
self.end = '*'
def insert(self, word):
cur = self.root
for c in word:
if c in cur:
cur = cur[c]
else:
cur[c] = {}
cur = cur[c]
cur[self.end] = True
... | mit | Python | |
81113f5e9fb7c9b8ae3434337b1003f1f31f4c51 | Create B_ETA.py | Herpinemmanuel/Oceanography | Cas_4/ETA/B_ETA.py | Cas_4/ETA/B_ETA.py | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import cartopy.crs as ccrs
from xmitgcm import open_mdsdataset
from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER
plt.ion()
dir0 = '/homedata/bderembl/runmit/test_southatlgyre3'
ds0 = open_mdsdataset(dir0... | mit | Python | |
a3720a95fb24b11947d233a49fc7a9139cd456ff | Create aplite_legacy.py | iAbadia/Pebble-Public-Transport-Zgz,iAbadia/Pebble-Urbanos-Zgz,iAbadia/Pebble-Public-Transport-Zgz,iAbadia/Pebble-Urbanos-Zgz,iAbadia/Pebble-Public-Transport-Zgz,iAbadia/Pebble-Public-Transport-Zgz,iAbadia/Pebble-Urbanos-Zgz,iAbadia/Pebble-Urbanos-Zgz | waftools/aplite_legacy.py | waftools/aplite_legacy.py | from waflib.Configure import conf
@conf
def appinfo_bitmap_to_png(ctx, appinfo_json):
if not ctx.supports_bitmap_resource():
for res in appinfo_json['resources']['media']:
if res['type'] == 'bitmap':
res['type'] = 'png'
| mit | Python | |
1edcf8fa6e6d95a53c4c40a63e3c6720082a6e92 | Add files via upload | ejnaren/rhinotools | scripts/ResetBlockScale/ResetBlockScale_cmd.py | scripts/ResetBlockScale/ResetBlockScale_cmd.py | """
@name: ResetBlockScale
@description: Resets the scale of a block, keeping the rotation around the insertion point.
@author: Ejnar Brendsdal
@version: 1.1
@attribution: Inspired by the ResetBlock script by Dale Fugier. Thank you.
@link: https://github.com/ejnaren/rhinotools
... | mit | Python | |
7cf0aec576a83043c1ba68ccce679257502e7c70 | Add example script `clean_up_torrents_directory.py` | JohnDoee/deluge-client | examples/clean_up_torrents_directory.py | examples/clean_up_torrents_directory.py | #!/bin/env python3
from deluge_client import DelugeRPCClient
import os, shutil
deluge_host="172.18.0.9"
deluge_port=58765
deluge_username="localclient"
deluge_password="01a23b45c67d89e01f23a45b67c89d01e23f4567"
cleanup_path="/downloads/tv"
client = DelugeRPCClient(deluge_host, deluge_port, deluge_username, deluge_pa... | mit | Python | |
cce512b1c1e1c0e769dab690e847f292ad1957aa | Create expressive-words.py | tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015 | Python/expressive-words.py | Python/expressive-words.py | # Time: O(n + s), n is the sum of all word lengths, s is the length of S
# Space: O(1)
# Sometimes people repeat letters to represent extra feeling,
# such as "hello" -> "heeellooo", "hi" -> "hiiii".
# Here, we have groups, of adjacent letters that are all the same character,
# and adjacent characters to the group ar... | mit | Python | |
711dc1df6bd1d598968e375a223483ef256da9e9 | Create 10-folds cross-validation data | HaoboGu/Structure-Similarity | CreateExpData.py | CreateExpData.py | import numpy as np
import time
import os
import csv
import random
def read_interacts(filename, pos_interacts, neg_interacts):
# read interaction data
interaction_file = open(filename)
line = interaction_file.readline()
while line:
db_id1, db_id2, interact_level = line[0:-1].split('\t')
... | mit | Python | |
56d2173e8dfc035d518e6d55b6b812b1b2af9e8c | Create xls-print-xlrd.py | werkzeuge/python-xls-print | xls-print-xlrd.py | xls-print-xlrd.py | import xlrd
def func(filename):
book = xlrd.open_workbook(filename)
print book.codepage # Stats
print book.user_name
print book.nsheets,",",book.sheet_names()
sheet = book.sheet_by_index(0)
nr = sheet.nrows
nc = sheet.ncols
for r in xrange(nr):
for c in xrange(nc):
print sheet.cell(r,c).value... | mit | Python | |
d54697211b49ee01f1c56ef373a6461e53b0aea9 | Create srvr.py | iminrhythm/iirmerl | srvr.py | srvr.py | # Source: http://gbeced.github.io/pyalgotrade/docs/v0.17/html/tutorial.html#optimizing
# Accessed: 06/10/16 0517Z
import itertools
from pyalgotrade.barfeed import yahoofeed
from pyalgotrade.optimizer import server
def parameters_generator():
instrument = ["dia"]
entrySMA = range(150, 251)
exitSMA = range... | mit | Python | |
e66c6289a7986048329e86162fa59441df7b9a0a | Add migration for changes to study model. | CenterForOpenScience/lookit-api,CenterForOpenScience/lookit-api,CenterForOpenScience/lookit-api,pattisdr/lookit-api,pattisdr/lookit-api,pattisdr/lookit-api | studies/migrations/0003_auto_20170615_1404.py | studies/migrations/0003_auto_20170615_1404.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-15 14:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('studies', '0002_auto_20170607_1800'),
]
operations = [
migrations.RenameFie... | apache-2.0 | Python | |
92f2d171b3be21f1b6f14eace713fa7653da4ee2 | Add base tests | kmike/psd-tools,psd-tools/psd-tools,kmike/psd-tools | tests/psd_tools2/psd/test_base.py | tests/psd_tools2/psd/test_base.py | from __future__ import absolute_import, unicode_literals
import pytest
import logging
from enum import Enum
from psd_tools2.psd.base import (
BooleanElement, ByteElement, DictElement, EmptyElement, IntegerElement,
ListElement, NumericElement, ShortIntegerElement, StringElement,
ValueElement
)
from ..utils... | mit | Python | |
16e48d18ea43dd3982b21b85822664ec79c07e77 | create pod python script | sebgoa/oreilly-kubernetes,sebgoa/oreilly-kubernetes,sebgoa/oreilly-kubernetes | scripts/create_pod.py | scripts/create_pod.py | #!/usr/bin/env python
from kubernetes import client, config
config.load_kube_config()
v1=client.CoreV1Api()
pod = client.V1Pod()
pod.metadata = client.V1ObjectMeta(name="busybox")
container = client.V1Container()
container.image = "busybox"
container.args = ["sleep", "3600"]
container.name = "busybox"
spec = clie... | apache-2.0 | Python | |
f08eec36ce0114487634a49b803c433569b8da27 | Create hello-grid.py | probml/pyprobml,probml/pyprobml,probml/pyprobml,probml/pyprobml | scripts/hello-grid.py | scripts/hello-grid.py | # based on https://github.com/williamFalcon/hello/blob/main/hello.py
import os
import numpy as np
from argparse import ArgumentParser
import torch
from torch.utils.tensorboard import SummaryWriter
# add arguments
parser = ArgumentParser()
parser.add_argument('--number', default=0, type=int)
parser.add_argument('--foo... | mit | Python | |
737a9286e55a84abd9dcb0634d6bd36cb6e2bdfd | Add new file | duniter/duniter,duniter/duniter,duniter/duniter,duniter/duniter,duniter/duniter,duniter/duniter | .gitlab/test.py | .gitlab/test.py | #!/usr/bin/env python3
import urllib.request
def get_current_message():
'''Get current release message'''
url = "https://git.duniter.org/api/v4/projects/47/repository/tags/0.99.18"
request = urllib.request.Request(url)
response = urllib.request.urlopen(request)
print('status: %s' % response.status... | agpl-3.0 | Python | |
4784702a5d45d2c3fe005b7c30f429f305f4cf39 | add tests for Builder class | tlatsas/wigiki | test/test_builder.py | test/test_builder.py | from nose.tools import assert_equals
from wigiki.builder import Builder
def test_gist():
assert_equals(Builder.gist(100),
'<script src="https://gist.github.com/100.js"></script>')
def test_page_list():
assert_equals(Builder.page_list(['foo', 'bar']),
['<a href="/foo">foo</a... | mit | Python | |
2a8a3c11fee713771c35071d1a6019560a10952c | add test for db migrations | pyfidelity/rest-seed,pyfidelity/rest-seed,pyfidelity/rest-seed | backend/restbase/tests/test_migrations.py | backend/restbase/tests/test_migrations.py | from alembic.config import Config
from alembic.environment import EnvironmentContext
from alembic.migration import MigrationContext
from alembic.script import ScriptDirectory
from difflib import unified_diff
from pkg_resources import resource_filename
from re import split
from sqlalchemy import engine_from_config
from ... | bsd-2-clause | Python | |
d4b7909fdc1f4fa7284e9886ea16df5c3f838a9f | Add boop command based on drink. | corpnewt/CorpBot.py,corpnewt/CorpBot.py | Cogs/Boop.py | Cogs/Boop.py | import asyncio
import discord
import random
from discord.ext import commands
from Cogs import DisplayName
from Cogs import Nullify
def setup(bot):
# Add the bot
bot.add_cog(Drink(bot))
class Drink:
# Init with the bot reference, and a reference to the settings var
def __init__(self, bot):
... | mit | Python | |
5efffc45d24fb061b4647484822a8f7c373f90b0 | Add another version of malwaredomainlistbot | abusesa/abusehelper | contrib/mdlbot/malwaredomainlist.py | contrib/mdlbot/malwaredomainlist.py | from idiokit import threado
from abusehelper.core import utils, cymru, bot, events
class MalwareDomainListBot(bot.PollingBot):
def feed_keys(self, asns, **_ignored):
for asn in set(map(unicode, asns)):
yield (asn,)
@threado.stream
def poll(inner, self, asn, url='http://www.malwaredomai... | mit | Python | |
6b5b3681b7be8546d2479df6862143fff95c2037 | Create Example3.py | cpgoncalves/gameplayer | Example3.py | Example3.py | # Carlos Pedro Gonçalves (2015), Game Theory with Python
# Game Theory and Applied A.I. Classes
# Instituto Superior de Ciências Sociais e Políticas (ISCSP)
# University of Lisbon
# cgoncalves@iscsp.ulisboa.pt
#
# Two Company's Game (Simultaneous) (payoffs correspond to expected Return On Sales)
#
# For more details se... | mit | Python | |
192837ce983112386db09f22ca74e136af0b6186 | add python script that sum light curves | evandromr/bash_xmmscripts | temporal_analysis/lightcurves/addlcs.py | temporal_analysis/lightcurves/addlcs.py | import myscitools
import glob
mos1files = glob.glob('MOS1_lc_net*')
mos2files = glob.glob('MOS2_lc_net*')
pnfiles = glob.glob('PN_lc_net*')
mos1files.sort()
mos2files.sort()
pnfiles.sort()
mossfiles = ['MOSS'+mos1[4:] for mos1 in mos1files]
epicfiles = ['EPIC'+mos1[4:] for mos1 in mos1files]
for mos1, mos2, moss in... | mit | Python | |
ef72df34a42eb32409a4928346382f6b5e670000 | Add migrations for private property of pin | lapo-luchini/pinry,lapo-luchini/pinry,pinry/pinry,pinry/pinry,pinry/pinry,lapo-luchini/pinry,pinry/pinry,lapo-luchini/pinry | core/migrations/0007_pin_private.py | core/migrations/0007_pin_private.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.26 on 2020-02-11 05:32
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0006_remove_pin_origin'),
]
operations = [
migrations.AddField(
... | bsd-2-clause | Python | |
2ef02438149627ab1efc23b80b76f66fc1987871 | Add __version__.py to 'willowtree' folder | federicomariamassari/willow-tree | willowtree/__version__.py | willowtree/__version__.py | '''
Return the version number of the currently installed 'willowtree' package.
Version numbering follows a major.macro.micro convention, with micro omitted
if equal to 0.
To display version number in a Python environment, either call:
willowtree.__version__
or, if willowtree is imported as wt:
wt.__version__
'''
_... | mit | Python | |
3f7d42d0c9db4b8f00d67ed713b3b26838592c4b | Add teh customized admin stuff for results | janLo/Windberg-web,janLo/Windberg-web | windberg_results/admin.py | windberg_results/admin.py | from functools import update_wrapper
from django.conf.urls import patterns, url
from django.contrib import admin
from windberg_results import models
from windberg_results.views import import_entries_from_csv
class ResultEntryInlineAdmin(admin.TabularInline):
model = models.ResultEntry
extra = 0
class Result... | bsd-3-clause | Python | |
78805e702e694bbb787ddaa440321b69230934bd | patch for form/label cleanup | meisterkleister/erpnext,indictranstech/vestasi-erpnext,Suninus/erpnext,saurabh6790/pow-app,indictranstech/fbd_erpnext,indictranstech/reciphergroup-erpnext,suyashphadtare/gd-erp,Tejal011089/paypal_erpnext,sagar30051991/ozsmart-erp,gangadharkadam/v5_erp,hatwar/Das_erpnext,indictranstech/phrerp,tmimori/erpnext,saurabh6790... | erpnext/patches/jan_mar_2012/label_cleanup.py | erpnext/patches/jan_mar_2012/label_cleanup.py | def execute():
import webnotes
from webnotes.model import delete_doc
from webnotes.modules.module_manager import reload_doc
reload_doc('selling', 'doctype', 'sales_order')
webnotes.conn.sql("""delete from `tabDocField`
where label in ('Note1', 'OT Notes', 'Note', 'Note HTML', 'Rates HTML')
and parent in ('... | agpl-3.0 | Python | |
e189fe0ddf4d36794b985d21d2a1e6c27ccfb05b | Add a test case for table cursor | hnakamur/cygroonga | tests/test_table_cursor.py | tests/test_table_cursor.py | import cygroonga as grn
import datetime
import os
import shutil
import tempfile
def test_table_cursor():
work_dir = tempfile.mkdtemp()
try:
with grn.Groonga():
with grn.Context() as ctx:
db_path = os.path.join(work_dir, "test.db")
ctx.create_database(db_path)... | apache-2.0 | Python | |
b92e5b4bc35c47d397b9b66980d9c6075994a6ea | Allow running from here too | liamcurry/py3kwarn | __main__.py | __main__.py | import sys
from py3kwarn.main import main
sys.exit(main())
| mit | Python | |
4d8526164369e8ec98c25fc403dd29fb6b9f8474 | Create Numberof1Bits.py | lingcheng99/Algorithm | Numberof1Bits.py | Numberof1Bits.py | """
Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).
For example, the 32-bit integer ’11' has binary representation 00000000000000000000000000001011, so the function should return 3.
"""
class Solution(object):
def hammingWeight(self, n)... | mit | Python | |
7cb1935727f405951fb92b9182afbaf9022f7b8a | Create cf_defense.py | boisvert42/baseball-for-fun,boisvert42/baseball-for-fun,boisvert42/baseball-for-fun | xkcd_graphs/cf_defense.py | xkcd_graphs/cf_defense.py | import pandas as pd
from matplotlib import pyplot as plt
from scipy.ndimage.filters import gaussian_filter1d
import numpy as np
from sklearn.linear_model import LinearRegression
from scipy.interpolate import interp1d
from matplotlib import cm
#%%
# TZ numbers via https://www.fangraphs.com/leaders.aspx?pos=cf&stats=fld... | mit | Python | |
0d3d40d97ab1866c9bcdf812c5cf8466cb2eebdd | Add scope remover processor | SUNET/SATOSA,irtnog/SATOSA,SUNET/SATOSA,its-dirg/SATOSA,irtnog/SATOSA | src/satosa/micro_services/processors/scope_remover_processor.py | src/satosa/micro_services/processors/scope_remover_processor.py | from ..attribute_processor import AttributeProcessorError
from .base_processor import BaseProcessor
class ScopeRemoverProcessor(BaseProcessor):
"""
Removes the scope from a given attribute
"""
def process(self, internal_data, attribute, **kwargs):
attributes = internal_data.attributes
... | apache-2.0 | Python | |
cbd65243681030ae9e9e1d81b71696987a88c538 | Add Material class | simphony/simphony-lammps-md,simphony/simphony-lammps-md | simlammps/material.py | simlammps/material.py | import uuid
from simphony.core.data_container import DataContainer
class Material(object):
"""A class that represents a material.
Class describes a material and its data.
Attributes
----------
description : str
textual description of the material
uid : uuid.UUID
the id of th... | bsd-2-clause | Python | |
0416499c92ada6fdb6d7fb410ee49fbf54eea528 | Add experimental CDMRemote and xarray integration. | dopplershift/siphon,Unidata/siphon,dopplershift/siphon | siphon/cdmr/xarray.py | siphon/cdmr/xarray.py | # Copyright (c) 2008-2015 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"Experimental backend for using xarray to talk to TDS over CDMRemote"
from xarray import Variable
from xarray.backends.common import AbstractDataStore
from xarray.core import i... | bsd-3-clause | Python | |
64bf49395671f2162ea278f8102da5f9f8561b36 | add cron script to publish weeklystats | ZEDGR/coh2stats,ZEDGR/coh2stats | cron-scripts/publish_weeklystats.py | cron-scripts/publish_weeklystats.py | from datetime import datetime
from time import sleep
import facebook
import requests
import json
import imgkit
import os
STATS_1v1_URL = os.environ.get('STATS_1v1_URL')
STATS_TEAMS_URL = os.environ.get('STATS_TEAMS_URL')
FB_GROUP_ID = os.environ.get('FB_TEST_GROUP_ID') if os.environ.get('FLASK_DEBUG') else os.environ.... | mit | Python | |
3c6cfa0fdbbfe224dc732081d592bcc90f5fea73 | Create OpenWeatherMap.py | MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab,MyRobotLab/pyrobotlab | service/OpenWeatherMap.py | service/OpenWeatherMap.py | OpenWeatherMap=Runtime.createAndStart("OpenWeatherMapTranslator", "OpenWeatherMap")
OpenWeatherMap.setApiKey("YOUR_KEY") #https://home.openweathermap.org/
OpenWeatherMap.setUnits("metric") # or imperial
OpenWeatherMap.setLang("fr") # en / de ...
# fetch raw data:
r=[]
r=OpenWeatherMap.fetchRaw("YOUR CITY")
print r[0],... | apache-2.0 | Python | |
1e565cd2f7b5a2038a9a66b435435409762b4206 | Add upload_link | mohan3d/PyOpenload | examples/upload_link.py | examples/upload_link.py | from __future__ import print_function
from openload import OpenLoad
username = 'FTP Username/API Login'
key = 'FTP Password/API Key'
openload = OpenLoad(username, key)
resp = openload.upload_link()
upload_link = resp.get('url')
print(upload_link) | mit | Python | |
48dbaf596ee8af826d7e9dec96fee0c626005281 | Add example for server-side cookies | z2v/aiohttp,avanov/aiohttp,singulared/aiohttp,alunduil/aiohttp,danielnelson/aiohttp,hellysmile/aiohttp,pfreixes/aiohttp,pathcl/aiohttp,morgan-del/aiohttp,alexsdutton/aiohttp,decentfox/aiohttp,panda73111/aiohttp,alex-eri/aiohttp-1,AraHaanOrg/aiohttp,elastic-coders/aiohttp,pfreixes/aiohttp,elastic-coders/aiohttp,mind1mas... | examples/web_cookies.py | examples/web_cookies.py | #!/usr/bin/env python3
"""Example for aiohttp.web basic server with cookies.
"""
import asyncio
from aiohttp import web
tmpl = '''\
<html>
<body>
<a href="/login">Login</a><br/>
<a href="/logout">Logout</a><br/>
{}
</body>
</html>'''
@asyncio.coroutine
def root(request):
resp = ... | apache-2.0 | Python | |
cc473e10e720071f4c5257bb0f011167f852b305 | test filtering | embali/imgpy | tests/test_filter.py | tests/test_filter.py | from tempfile import TemporaryFile
import pytest
from PIL import ImageFilter
from imgpy import Img
@pytest.mark.parametrize('image', ({
'sub': 'anima/bordered.gif',
'mode': 'RGBA',
'res': 38
}, {
'sub': 'anima/clear.gif',
'mode': 'RGBA',
'res': 12
}, {
'sub': 'fixed/bordered.jpg',
'r... | mit | Python | |
34b6d6c00e4f78f9daaefe5a2663b790f5091894 | Test examples from my thesis. | catch22/moment_polytopes | tests/test_thesis.py | tests/test_thesis.py | from __future__ import absolute_import, print_function
import pytest
from moment_polytopes import *
# prior work
def test_borland_dennis(algorithm):
R = weyl_module(6, [1, 1, 1])
C = ressayre_tester(R, algorithm=algorithm)
assert C.is_ressayre(((0, 0, 0, -1, 1, 1), 0))
def test_8_qubits(algorithm):
... | mit | Python | |
a434db406468eacc4d4618b428d8261f5db32fde | Add script that "vendors" notary into docker and runs trust integration tests. | shin-/docker.github.io,anweiss/docker.github.io,umayr/notary,LuisBosquez/docker.github.io,menglingwei/denverdino.github.io,bdwill/docker.github.io,thaJeztah/docker.github.io,bdwill/docker.github.io,alexisbellido/docker.github.io,jzwlqx/denverdino.github.io,joeuo/docker.github.io,menglingwei/denverdino.github.io,vdemees... | misc/docker-integration-test.py | misc/docker-integration-test.py | """
"vendors" notary into docker and runs integration tests - then builds the
docker client binary with an API version compatible with the existing
daemon
Usage:
python docker-integration-test.py <directory to build notary>
"""
from __future__ import print_function
import inspect
import os
import re
import shutil
impo... | apache-2.0 | Python | |
4c912227660fce693a11520ad18cf46f7f949308 | Add launch method for monitor experiments | geopm/geopm,geopm/geopm,cmcantalupo/geopm,geopm/geopm,cmcantalupo/geopm,cmcantalupo/geopm,geopm/geopm,cmcantalupo/geopm,cmcantalupo/geopm,geopm/geopm | integration/experiment/monitor/monitor.py | integration/experiment/monitor/monitor.py | # Copyright (c) 2015, 2016, 2017, 2018, 2019, 2020, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this... | bsd-3-clause | Python | |
a110009c23ec69077f2f8d0e6107b4cfa982011f | Create PacketSniffer.py | HeyIamJames/Crawlers | PacketSniffer.py | PacketSniffer.py | import socket
import struct
import textwrap
| mit | Python | |
4f6f585a2b9891b798d494dfde30ae47a808ad4b | fix 500 that occured when trying to view an org page when not a member | puttarajubr/commcare-hq,SEL-Columbia/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,gmimano/commcaretest,gmimano/commcaretest,gmimano/commcaretest,dimagi/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,SEL-Columbia/comm... | corehq/apps/orgs/decorators.py | corehq/apps/orgs/decorators.py | from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseRedirect
def no_permissions_redirect(request):
np_page = reverse('no_permissions')
return HttpResponseRedirect(np_page) if request.method == 'GET' else HttpResponse("Missing qualifications")
def org_admin_required(v... | from django.core.urlresolvers import reverse
from django.http import HttpResponse
def org_admin_required(view_func):
def shim(request, org, *args, **kwargs):
if not hasattr(request, 'couch_user') or not \
(request.couch_user.is_org_admin(org) or request.couch_user.is_superuser):
return ... | bsd-3-clause | Python |
16695493e366d4a25d80ba01a1242b3cb762999a | Create SquareRanches.py | hectorpefo/hectorpefo.github.io,hectorpefo/hectorpefo.github.io,hectorpefo/hectorpefo.github.io,hectorpefo/hectorpefo.github.io | _includes/SquareRanches.py | _includes/SquareRanches.py | from random import random
def IsConvex(quad):
answer = True
for i in range(4):
x1,y1 = quad[i-2]
x2,y2 = quad[i-1]
x3,y3 = quad[i]
a,b = x1-x2,y1-y2
c,d = x3-x2,y3-y2
if a*d < b*c:
answer = False
return answer
reps = 1000000
accum = 0
for rep in range(reps):
quad = []
for i in range(4):
quad.ap... | mit | Python | |
927381ad13263a9b27916c17e51abdf2c7fc1431 | Add migration file | uccser/cs4teachers,uccser/cs4teachers,uccser/cs4teachers,uccser/cs4teachers | dthm4kaiako/dtta/migrations/0015_alter_page_page_type.py | dthm4kaiako/dtta/migrations/0015_alter_page_page_type.py | # Generated by Django 3.2.12 on 2022-05-02 08:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dtta', '0014_page_page_type'),
]
operations = [
migrations.AlterField(
model_name='page',
name='page_type',
... | mit | Python | |
d72c2c164ac45c8b214bc6e4e84ec3278ee353c1 | add the activitysim.py module too | bhargavasana/activitysim,synthicity/activitysim,bhargavasana/activitysim,synthicity/activitysim,osPlanning/activitysim | activitysim/activitysim.py | activitysim/activitysim.py | import urbansim.sim.simulation as sim
from urbansim.urbanchoice import interaction, mnl
import pandas as pd
import numpy as np
import os
def random_rows(df, n):
return df.take(np.random.choice(len(df), size=n, replace=False))
def read_model_spec(fname,
description_name="Description",
... | agpl-3.0 | Python | |
dca99dab5e09e6767708e92f9bf92e54a9aa9ed4 | Test build remotely SDict wrong class | bsc-dd/hecuba,bsc-dd/hecuba,bsc-dd/hecuba,bsc-dd/hecuba | hecuba_py/tests/storage_api_tests.py | hecuba_py/tests/storage_api_tests.py | import unittest
from storage.api import getByID
from hecuba.hdict import StorageDict
class ApiTestSDict(StorageDict):
'''
@TypeSpec <<key:int>, value:double>
'''
class StorageApi_Tests(unittest.TestCase):
def setUp(self):
pass
def class_type_test(self):
base_dict = ApiTestSDict(... | apache-2.0 | Python | |
b28d544167dcee75ff7476ae3d43d51191aca717 | Add script to find gaps between on-demand instances and reservations. | kjoconnor/aws | reservation_gap.py | reservation_gap.py | from collections import Counter
from boto.ec2 import connect_to_region
REGION = 'us-east-1'
COUNTER_KEY_FMT = '{availability_zone},{instance_type}'
ec2 = connect_to_region(REGION)
running_instance_counter = Counter()
current_reservations_counter = Counter()
def get_instances(ec2):
reservations = ec2.get_all_... | mit | Python | |
1f69a3c0b85f9c9391d3397a1c28b76654078235 | Add switching hub controller example code | yeardancing/twink,hkwi/twink | test/example_controller_switchinghub.py | test/example_controller_switchinghub.py | import logging
import twink
import twink.ovs
import twink.threading
import twink.ext
import twink.ofp4 as ofp4
import twink.ofp4.parse as ofp4parse
import twink.ofp4.build as b
import twink.ofp4.oxm as oxm
class TestChannel(twink.ovs.OvsChannel,
twink.ext.PortMonitorChannel,
twink.ControllerChannel,
twink.thread... | apache-2.0 | Python | |
446182b5f2f548924612ca8111abcf5549d1ed33 | Create combination_sum2.py | UmassJin/Leetcode | Array/combination_sum2.py | Array/combination_sum2.py | Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.
Each number in C may only be used once in the combination.
Note:
All numbers (including target) will be positive integers.
Elements in a combination (a1, a2, … , ak) must be in... | mit | Python | |
6a5a1466dcb5925fb66c86c42ed1f03c45b93a4c | add basic parsing | cinhtau/cautious-potato,cinhtau/cautious-potato | rpm-info-parser.py | rpm-info-parser.py | import ConfigParser
import io
import rpminfo
def parse(info):
config = ConfigParser.RawConfigParser(allow_no_value=True)
config.readfp(io.BytesIO(info))
return as_dict(config)
def as_dict(config):
"""
Converts a ConfigParser object into a dictionary.
"""
dict = {}
for section in config... | mit | Python | |
03a41b128a447a8a64dc4e4f026675ff35165839 | Add package for example sections files | tanghaibao/goatools,tanghaibao/goatools | goatools/test_data/sections/__init__.py | goatools/test_data/sections/__init__.py | # Contains example 'sections' files to be used with GOATOOLS grouping
| bsd-2-clause | Python | |
cc9ed0aae6d0e8394bb671d24a5bad177e22460a | add contexts constants from the docs | askbow/py-ucsd-api-lib | ucsd_api_contexts.py | ucsd_api_contexts.py | '''
This lists context constants to be used with UCSD API
based on http://www.cisco.com/c/en/us/td/docs/unified_computing/ucs/ucs-director/rest-api-guide/5-0/b_Cisco_UCS_Director_REST_Developer_Guide_50/b_Cisco_UCS_Director_REST_Developer_Guide_41_chapter_01100.html
'''
#Administrative Contexts
CONTEXT_TYPE_GLOBAL=... | mit | Python | |
3f3b475d76db14db5e2091f2eb335d4c7010fd22 | Add rest sensor | MungoRae/home-assistant,pschmitt/home-assistant,caiuspb/home-assistant,florianholzapfel/home-assistant,qedi-r/home-assistant,turbokongen/home-assistant,sffjunkie/home-assistant,DavidLP/home-assistant,rohitranjan1991/home-assistant,tomduijf/home-assistant,open-homeautomation/home-assistant,nugget/home-assistant,dmeulen/... | homeassistant/components/sensor/rest.py | homeassistant/components/sensor/rest.py | """
homeassistant.components.sensor.rest
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The rest sensor will consume JSON responses sent by an exposed REST API.
Configuration:
To use the rest sensor you will need to add something like the following
to your configuration.yaml file.
sensor:
platform: arest
name: REST sens... | apache-2.0 | Python | |
25b3f5a4cca1bfa5d8a298df7f4f41ec2231beca | Create helloWorld.py | ravikant7890/sept29 | helloWorld.py | helloWorld.py | print "hello world"
| apache-2.0 | Python | |
c22d201c6205de011711044b956d0c07b2ced99c | add logging wrapper | luozhaoyu/gallery,luozhaoyu/gallery | logging_wrapper.py | logging_wrapper.py | # -*- coding: utf-8 -*-
"""
logging_wrapper.py
~~~~~~~~~~~~~~
A brief description goes here.
"""
import logging
import logging.handlers
def create_logger(filename, logger_name=None):
logger = logging.getLogger(logger_name or __name__)
fmt='[%(asctime)s] %(levelname)s [#%(process)d %(funcName)s %(... | mit | Python | |
e2cb38fecf1ff9068a450383828b23cd4b88a91c | Add a plot script. | jdhp-sap/data-pipeline-standalone-scripts,jdhp-sap/sap-cta-data-pipeline,jdhp-sap/sap-cta-data-pipeline,jdhp-sap/data-pipeline-standalone-scripts | utils/plot_score_histogram_aggregate.py | utils/plot_score_histogram_aggregate.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Make statistics on score files (stored in JSON files).
"""
import argparse
import json
import math
import os
import matplotlib.pyplot as plt
import numpy as np
# histtype : [‘bar’ | ‘barstacked’ | ‘step’ | ‘stepfilled’]
HIST_TYPE='bar'
ALPHA=0.5
def fetch_score(js... | mit | Python | |
586f9d842c6797e0040d29b846d81a06d1ba75ec | Add gpm script | lambeau/random-hacking,schana/random-hacking,schana/random-hacking,schana/random-hacking | play_music.py | play_music.py | import getpass
import json
from datetime import datetime
import cmd
import gmusicapi # https://github.com/simon-weber/gmusicapi
class Shell(cmd.Cmd):
intro = 'Play music interactive shell. Login required.\nType help or ? to list commands.'
prompt = '(gpm) '
api = None
use_rawinput = False
def d... | apache-2.0 | Python | |
fbb9486fde6d9b62c1c1d5304f121314bc933fc7 | Add working python code | Caronthir/FYS3150,Caronthir/FYS3150,Caronthir/FYS3150 | Project5/morten.py | Project5/morten.py |
# Code for solving du/dt = ddu/ddx on a rectangular grid
# of size L x (T*dt),
# with with L = 1, u(x,0) = g(x), u(0,t) = u(L,t) = 0
#
from __future__ import print_function
import numpy,math
import matplotlib.pyplot as plt
import sys
def forward_step(alpha,u,uPrev,N):
"""
Steps forward-euler algo one step ah... | mit | Python | |
ab814d983afdcf048e28f7398f912575885a9ae7 | add test for nstr | Alwnikrotikz/mpmath,thegooglecodearchive/mpmath,tectronics/mpmath,Alwnikrotikz/mpmath,upiterbarg/mpmath,upiterbarg/mpmath,tectronics/mpmath,thegooglecodearchive/mpmath | mpmath/tests/test_str.py | mpmath/tests/test_str.py | from mpmath import nstr, matrix, inf
def test_nstr():
m = matrix([[0.75, 0.190940654, -0.0299195971],
[0.190940654, 0.65625, 0.205663228],
[-0.0299195971, 0.205663228, 0.64453125e-20]])
assert nstr(m, 4, min_fixed=-inf) == \
'''[ 0.75 0.1909 -0.02992]
... | bsd-3-clause | Python | |
a11f4a3f3e52a5d9848db3e8b78efb2aec38ca05 | ADD codeinspace.py | Groupe24/CodeInSpace | src/codeinspace.py | src/codeinspace.py | import string
def new_game(path):
"""
Create a new game from a '.cis' file.
Parameters
----------
path : to the cis file (str).
Return
-------
game_stats : new game stats (dic).
"""
raise NotImplementedError
def parse_game_file(path):
"""
Parse a cis file give us his ... | mit | Python | |
24e64dcc2cd7a1e70510c19426f37823f0a2f2b6 | Add alembic migration script | lukasjuhrich/pycroft,agdsn/pycroft,agdsn/pycroft,lukasjuhrich/pycroft,lukasjuhrich/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,lukasjuhrich/pycroft | pycroft/model/alembic/versions/7a6449f2489c_extend_patch_port.py | pycroft/model/alembic/versions/7a6449f2489c_extend_patch_port.py | """extend patch_port
Revision ID: 7a6449f2489c
Revises: 8ff6f90b98fa
Create Date: 2018-12-20 23:10:49.889221
"""
from alembic import op
import sqlalchemy as sa
import pycroft
# revision identifiers, used by Alembic.
revision = '7a6449f2489c'
down_revision = '8ff6f90b98fa'
branch_labels = None
depends_on = None
de... | apache-2.0 | Python | |
9f0842ee21abb0caf92a0b268d433d11d0795bf4 | Create an asynchronous lidar controller | TUM-AERIUS/Aerius,TUM-AERIUS/Aerius,TUM-AERIUS/Aerius,TUM-AERIUS/Aerius | Raspberry/lidar.py | Raspberry/lidar.py | from rplidar import RPLidar
import time
from multiprocessing import Pipe
from threading import Thread, Event
class LidarController(object):
"""
Asynchronous controller for the rplidar.
"""
def __init__(self, port='/dev/ttyUSB0'):
self.lidar = RPLidar(port)
print('LidarController:', sel... | mit | Python | |
5906dac784888be77facb1abe8b90a6b090de8bc | Create __init__.py | Programmeerclub-WLG/Agenda-App | __init__.py | __init__.py | apache-2.0 | Python | ||
a3d5378ed582a13b26c613d423fe6dc4571f91e3 | Add __init__ stub | saitoha/canossa | __init__.py | __init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# ***** BEGIN LICENSE BLOCK *****
# Copyright (C) 2012 Hayaki Saito <user@zuse.jp>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either versi... | mit | Python | |
e33d0e86a4ac705ae69abe7428f65825e260b966 | Create b.py | y-sira/atcoder,y-sira/atcoder | abc061/b.py | abc061/b.py | import collections
def main():
n, m = map(int, input().split())
streets = collections.defaultdict(list)
for i in range(m):
a, b = map(int, input().split())
streets[a].append(b)
streets[b].append(a)
for i in range(1, n + 1):
print(len(streets[i]))
if __name__ == '__... | mit | Python | |
4afab780e7bb35b57b9b3112342c3b282cad22bb | Add a purge_batch command to purge outputs from a run batch. | cfe-lab/Kive,cfe-lab/Kive,cfe-lab/Kive,cfe-lab/Kive,cfe-lab/Kive | kive/archive/management/commands/purge_batch.py | kive/archive/management/commands/purge_batch.py | from django.core.management.base import BaseCommand
from archive.models import RunBatch
class Command(BaseCommand):
help = "Purges output datasets from a run batch."
def add_arguments(self, parser):
parser.add_argument(
"batch_id",
type=int)
parser.add_argument(
... | bsd-3-clause | Python | |
d2eecf5774d3e97f0db80273c4728f8204d0db0e | Create new package. (#6505) | matthiasdiener/spack,mfherbst/spack,iulian787/spack,matthiasdiener/spack,EmreAtes/spack,iulian787/spack,tmerrick1/spack,krafczyk/spack,LLNL/spack,krafczyk/spack,tmerrick1/spack,iulian787/spack,EmreAtes/spack,mfherbst/spack,LLNL/spack,iulian787/spack,krafczyk/spack,tmerrick1/spack,tmerrick1/spack,krafczyk/spack,LLNL/spa... | var/spack/repos/builtin/packages/r-rprojroot/package.py | var/spack/repos/builtin/packages/r-rprojroot/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
22e4430a55c17a5b2f77c90f8862530a3ae7f0d6 | Add migration for verbose name. | pattisdr/lookit-api,CenterForOpenScience/lookit-api,CenterForOpenScience/lookit-api,CenterForOpenScience/lookit-api,pattisdr/lookit-api,pattisdr/lookit-api | accounts/migrations/0005_auto_20170621_1843.py | accounts/migrations/0005_auto_20170621_1843.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-21 18:43
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0004_auto_20170607_1800'),
]
operations = [
migrations.AlterFie... | apache-2.0 | Python | |
80950bd071d4f284b2c5a07892bdb1d1f6bdc344 | correct dependencies | funkring/fdoo,Ernesto99/odoo,windedge/odoo,joshuajan/odoo,SAM-IT-SA/odoo,OpenUpgrade-dev/OpenUpgrade,ApuliaSoftware/odoo,dsfsdgsbngfggb/odoo,hanicker/odoo,fuselock/odoo,rubencabrera/odoo,ChanduERP/odoo,abstract-open-solutions/OCB,spadae22/odoo,elmerdpadilla/iv,NL66278/OCB,oihane/odoo,deKupini/erp,camptocamp/ngo-addons-... | addons/anonymous/__openerp__.py | addons/anonymous/__openerp__.py | {
'name': 'Anonymous',
'description': 'Allow anonymous access to OpenERP',
'author': 'OpenERP SA',
'version': '1.0',
'category': 'Tools',
'website': 'http://www.openerp.com',
'installable': True,
'depends': ['web'],
'data': [
'anonymous.xml',
],
'js': [
'static/src/js/anonymous.js',
],
'qweb': [
... | {
'name': 'Anonymous',
'description': 'Allow anonymous access to OpenERP',
'author': 'OpenERP SA',
'version': '1.0',
'category': 'Tools',
'website': 'http://www.openerp.com',
'installable': True,
'data': [
'anonymous.xml',
],
'js': [
'static/src/js/anonymous.js',
],
'qweb': [
'static/src/xml/an... | agpl-3.0 | Python |
b089b8d7f93bf9cbd67f4bc8a0e203748fffcc13 | add migrations for mentor, meetup, coworking models | OKThess/website,OKThess/website,OKThess/website | main/migrations/0005_coworking_meetup_mentor.py | main/migrations/0005_coworking_meetup_mentor.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-03 12:58
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0004_auto_20170803_1135'),
]
operations = [
migrations.CreateModel(... | mit | Python | |
bce3e90abcbb8e14adc4b19fd47798d4eaacab4a | Add caller module | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/cli/caller.py | salt/cli/caller.py | '''
The caller module is used as a frontend to manage direct calls to the salt
minion modules.
'''
# Import salt libs
import salt.loader
class Caller(object):
'''
Object to wrap the calling of local salt modules for the salt-call command
'''
def __init__(self, opts):
'''
Pass in the co... | apache-2.0 | Python | |
407f4f290fe3dbe3ca3ac74c985b169d9b472e39 | add in a from address so people can reply | eviljeff/zamboni,clouserw/zamboni,jasonthomas/zamboni,jasonthomas/zamboni,diox/zamboni,jamesthechamp/zamboni,tsl143/zamboni,kumar303/zamboni,Hitechverma/zamboni,diox/zamboni,tsl143/zamboni,ingenioustechie/zamboni,ayushagrawal288/zamboni,jasonthomas/zamboni,ingenioustechie/zamboni,tsl143/zamboni,eviljeff/zamboni,luckyla... | mkt/users/tasks.py | mkt/users/tasks.py | from datetime import timedelta
import commonware.log
import Crypto
from celery.signals import task_prerun
from celeryutils import task
from django.utils.encoding import force_text
from tower import ugettext_lazy as _
from mkt.account.utils import fxa_preverify_url
from mkt.site.mail import send_html_mail_jinja
fro... | from datetime import timedelta
import commonware.log
import Crypto
from celery.signals import task_prerun
from celeryutils import task
from django.utils.encoding import force_text
from tower import ugettext_lazy as _
from mkt.account.utils import fxa_preverify_url
from mkt.site.mail import send_html_mail_jinja
fro... | bsd-3-clause | Python |
5e229787c013cc66fe202964ffb733a2d8f5aa6a | Add utility to examine depedent tokens retrieved from Globus. | informatics-isi-edu/webauthn,informatics-isi-edu/webauthn,informatics-isi-edu/webauthn | webauthn2/scripts/globus_test_client.py | webauthn2/scripts/globus_test_client.py | from globus_sdk import ConfidentialAppAuthClient
import json
import sys
import pprint
CLIENT_CRED_FILE='/home/secrets/oauth2/client_secret_globus.json'
if __name__ == '__main__':
if len(sys.argv) != 2:
print("Usage: {me} access_token".format(me=sys.argv[0]))
sys.exit(1)
token = sys.argv[1]
... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.