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 |
|---|---|---|---|---|---|---|---|---|
83d1cce09cbed67f5a39185042e0da858047469a | Add a (probably broken) api endpoint for list interface plugins | LynxyssCZ/Flexget,jawilson/Flexget,crawln45/Flexget,dsemi/Flexget,tarzasai/Flexget,qk4l/Flexget,drwyrm/Flexget,oxc/Flexget,JorisDeRieck/Flexget,tobinjt/Flexget,oxc/Flexget,Danfocus/Flexget,JorisDeRieck/Flexget,qvazzler/Flexget,Flexget/Flexget,LynxyssCZ/Flexget,crawln45/Flexget,malkavi/Flexget,tobinjt/Flexget,poulpito/F... | flexget/plugins/api/list.py | flexget/plugins/api/list.py | from __future__ import unicode_literals, division, absolute_import
from flask import jsonify, request
from flexget import plugin
from flexget.api import api, APIResource
from flexget.entry import Entry
list_api = api.namespace('list', description='Manage list plugins')
list_config_schema = {
'allOf': [
... | mit | Python | |
221a5eff694fb123e8545c480b2689883bf694b6 | add love-letter | xbfool/hackerrank_xbfool | src/algorithms/warmup/love-letter.py | src/algorithms/warmup/love-letter.py | #python2.x
times = (int)(raw_input())
res_array = []
for i in range(times):
s = raw_input()
l = len(s)
res = 0
for j in range(l / 2):
res += abs(ord(s[j]) - ord(s[l-j-1]))
res_array.append(res)
for r in res_array:
print r | mit | Python | |
cf7ead683a8f714f1136cca59735dc1c8eae10a9 | Add requests_test.py - can successfully use secret.py with your MSF login/pw to Base64 authenticate the feed and get a 200 response code from MSF | prcutler/nflpool,prcutler/nflpool | requests_test.py | requests_test.py | import requests
from requests.auth import HTTPBasicAuth
import secret
response = requests.get('https://www.mysportsfeeds.com/api/feed/pull/nfl/2016-2017-regular/division_team_standings.json',
auth=HTTPBasicAuth(secret.msf_username, secret.msf_pw))
print(response.status_code)
| mit | Python | |
85ba108f2a2652b28ee8594524b5d771f45772ba | add missing file | dajusc/trimesh,mikedh/trimesh,mikedh/trimesh,dajusc/trimesh,mikedh/trimesh,mikedh/trimesh | trimesh/path/simplify.py | trimesh/path/simplify.py | import numpy as np
from collections import deque
from .arc import fit_circle, angles_to_threepoint
from .entities import Arc
from .constants import *
def simplify(path):
simplify_circles(path)
def simplify_circles(path):
'''
Turn closed paths represented with lines into
closed arc entities (... | mit | Python | |
064b07573a4e2168545ae18fadf247664610e394 | Disable CALENDAR_MECHANISM for now | selahssea/ggrc-core,andrei-karalionak/ggrc-core,hasanalom/ggrc-core,uskudnik/ggrc-core,hasanalom/ggrc-core,edofic/ggrc-core,prasannav7/ggrc-core,selahssea/ggrc-core,hasanalom/ggrc-core,hyperNURb/ggrc-core,josthkko/ggrc-core,plamut/ggrc-core,j0gurt/ggrc-core,kr41/ggrc-core,uskudnik/ggrc-core,edofic/ggrc-core,plamut/ggrc... | src/ggrc/settings/app_engine.py | src/ggrc/settings/app_engine.py | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: dan@reciprocitylabs.com
APP_ENGINE = True
ENABLE_JASMINE = False
LOGIN_MANAGER = 'ggrc.login.appengine'
FU... | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: dan@reciprocitylabs.com
APP_ENGINE = True
ENABLE_JASMINE = False
LOGIN_MANAGER = 'ggrc.login.appengine'
FU... | apache-2.0 | Python |
537a649f849ab0f72fa9abd811dfeec6ed9cd488 | Add test script to we can measure how good our trained models do on non-augmented set | judithfan/pix2svg | generative/tests/triplet_test/test.py | generative/tests/triplet_test/test.py | from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import torch
import torch.optim as optim
import torch.nn.functional as F
import numpy as np
from train import AverageMeter
from sklearn.metrics import accuracy_score
from datasets import ContextFreePreloadedG... | mit | Python | |
6e1ba073e817d7d44c6a39727fa1d6cdb4468806 | add version file | Turgon37/HttpTeepotReply | httpteepotreply/version.py | httpteepotreply/version.py | # -*- coding: utf8 -*-
# This file is a part of HttpTeepotReply
#
# Copyright (c) 2014-2015 Pierre GINDRAUD
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including ... | mit | Python | |
9a95f6f37d883ea26e8a59e070e24ac42780f61b | add missing file | imcleod/anaconda-ec2 | ami_from_image_file.py | ami_from_image_file.py | #!/usr/bin/python
import logging
import sys
from aws_utils import EBSHelper, AMIHelper
if len(sys.argv) != 5:
print
print "Create an AMI on EC2 from a bootable image file"
print
print "usage: %s <ec2_region> <ec2_key> <ec2_secret> <image_file>" % sys.argv[0]
print
sys.exit(1)
region = sys.argv... | lgpl-2.1 | Python | |
ada316dcd318364fcaeb8de9c1074bff1a0f9924 | Create new class to calculate radius of rotation | ssh0/growing-string,ssh0/growing-string | triangular_lattice/filled_kagome.py | triangular_lattice/filled_kagome.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# written by Shotaro Fujimoto
# 2016-10-07
from fill_bucket import FillBucket
from growing_string import Main
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.tri as tri
class FilledKagome:
def __init__(self, L=60, frames=1000, beta=0.):
... | mit | Python | |
53774d451c8fe5249dfb35c1de838adfc0b94cf0 | Add tests | imiric/timebook | tests/test_commands.py | tests/test_commands.py | # -*- coding: utf-8 -*-
import re
from datetime import datetime
import pytest
from timebook.db import Database
from timebook.commands import commands
# Fixtures ###
@pytest.fixture
def patch_raw_input(monkeypatch):
import __builtin__
monkeypatch.setattr(__builtin__, 'raw_input', lambda *a: 'yes')
time_now ... | mit | Python | |
e0d631b4aab431c31689ccd7aa6ac92d95e32e80 | Move to function only tests & fix test for generator based build_file_list | wintersandroid/tvrenamr,ghickman/tvrenamr | tests/test_frontend.py | tests/test_frontend.py | import collections
import os
import sys
from tvrenamr.cli import helpers
from .utils import random_files
def test_passing_current_dir_makes_file_list_a_list(files):
file_list = helpers.build_file_list([files])
assert isinstance(file_list, collections.Iterable)
PY3 = sys.version_info[0] == 3
string... | import os
from tvrenamr.cli import helpers
from .base import BaseTest
class TestFrontEnd(BaseTest):
def setup(self):
super(TestFrontEnd, self).setup()
self.config = helpers.get_config()
def test_passing_current_dir_makes_file_list_a_list(self):
assert isinstance(helpers.build_file_l... | mit | Python |
d47d7931f5531c4fe28598d15c305592e446af2b | Add some test for settings. TODO fix save. | pkkid/python-plexapi,mjs7231/python-plexapi | tests/test_settings.py | tests/test_settings.py |
def test_settings_group(plex):
assert plex.settings.group('general')
def test_settings_get(plex):
# This is the value since it we havnt set any friendlyname
# plex just default to computer name but it NOT in the settings.
assert plex.settings.get('FriendlyName').value == ''
def test_settings_get(pl... | bsd-3-clause | Python | |
0db38995d9cb7733d5dcc7bd88234c4a356fc9fb | Add tool for adding COOP IDs | akrherz/pyWWA,akrherz/pyWWA | util/merge_coop_nwsli.py | util/merge_coop_nwsli.py | # Need to check the log files for shef parser and create new sites
# within database based on what we find
import re, iemdb, os
MESOSITE = iemdb.connect('mesosite', bypass=False)
# Load up our database
sites = {}
for line in open('coop_nwsli.txt'):
tokens = line.split("|")
if len(tokens) < 9:
contin... | mit | Python | |
83349680a35ed6e0510b7d081b82adcf0cca9c61 | add retrace script | simpleton/TAG_obfuscate,simpleton/TAG_obfuscate | ReTraceTag.py | ReTraceTag.py | #!/usr/bin/python
import os
import fnmatch
import fileinput
import re
from Replacement import Replacement
class Retrace(object):
def __init__(self, mapping_file):
self.mapping = self.parse_tag_mapping(mapping_file)
def parse_tag_mapping(self, mapping_file):
mapping = {}
with... | mit | Python | |
1440292ec25298d0ec96c2246f2f0ad7ab8ffad6 | add function to call conductor | tjcsl/director,tjcsl/director,tjcsl/director,tjcsl/director | web3/apps/vms/helpers.py | web3/apps/vms/helpers.py | import requests
import json
import os
from django.conf import settings
from raven.contrib.django.raven_compat.models import client
def call_api(action=None, args={}):
agent_path = "https://deneb.agent.lxc.deneb.csl.tjhsst.edu/"
cert_path = os.path.join(settings.PROJECT_ROOT, "settings/conductor.pem")
re... | mit | Python | |
fd9547f088b2ed15c289235c329be04590689855 | Add foundation for native component testing | metsma/chrome-token-signing,cristiano-andrade/chrome-token-signing,fabiorusso/chrome-token-signing,open-eid/chrome-token-signing,open-eid/chrome-token-signing,fabiorusso/chrome-token-signing,open-eid/chrome-token-signing,open-eid/chrome-token-signing,metsma/chrome-token-signing,fabiorusso/chrome-token-signing,metsma/ch... | host-test/stateless-test.py | host-test/stateless-test.py | import json
import subprocess
import struct
import sys
import unittest
import uuid
exe = None
# The protocol datagram is described here:
# https://developer.chrome.com/extensions/nativeMessaging#native-messaging-host-protocol
#
# The protocol itself is described here:
# https://github.com/open-eid/chrome-token-signin... | lgpl-2.1 | Python | |
2a4cda222bb2b73e123600a554c2938ef8998634 | Add AddthisError exception | creafz/python-addthis | addthis/exceptions.py | addthis/exceptions.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
class AddthisError(Exception):
"""Raised if Addthis service returns anything
with status code other than 200.
"""
def __init__(self, status_code, error_data):
self.status_code = status_code
self.error = error_data
... | mit | Python | |
eb967e41d9cbea3525a3853c56bc8976436a6ceb | add Matrix class | Giraudux/python3-maths | src/matrix.py | src/matrix.py | from array import array
class Matrix:
def __init__(self, p, q, ls=None):
self.p = p
self.q = q
if((ls != None) and (len(ls) == (p*q))):
self.data = array("d", ls)
else:
self.data = array("d", [0]*(p*q))
def __repr__(self):
return 'Point({self.p},... | mit | Python | |
39dd51af16759ae5039fd526112b329e6f03c088 | Add Redis backend. | prophile/django-lightweight-queue,thread/django-lightweight-queue,thread/django-lightweight-queue,prophile/django-lightweight-queue,lamby/django-lightweight-queue | django_lightweight_queue/backends/redis.py | django_lightweight_queue/backends/redis.py | from __future__ import absolute_import # For 'redis'
import redis
from django.conf import settings
from django.utils import simplejson
from ..job import Job
class RedisBackend(object):
KEY = 'django_lightweight_queue'
def __init__(self):
self.client = redis.Redis(
host=settings.REDIS_FE... | bsd-3-clause | Python | |
b57474ba5a3ea92c300c30f51f6df64382ffd2a2 | Create solution.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | leetcode/easy/isomorphic_strings/py/solution.py | leetcode/easy/isomorphic_strings/py/solution.py | class Solution(object):
def isIsomorphic(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
if len(s) != len(t):
return False
#
# Leetcode hasn't upgraded its Python judges to 3.x, however the function
# still ... | mit | Python | |
333ae389c14593421d01bd0c8f6904d1688dfa7e | Add our custom dashboard modules | DjangoAdminHackers/ixxy-admin-utils,DjangoAdminHackers/ixxy-admin-utils | ixxy_admin_utils/dashboard_modules.py | ixxy_admin_utils/dashboard_modules.py | from admin_tools.dashboard.modules import LinkList
from django.core.urlresolvers import reverse
from linkcheck.views import get_status_message
class PermCheckingLinkList(LinkList):
def __init__(self, title=None, **kwargs):
self.required_perms = kwargs.pop('required_perms', [])
super(PermCheckingL... | mit | Python | |
62ec4eca706bbb521d02ec597c0c18a949b37e52 | Add test to set a sysctl value | williambr/py-sysctl,williambr/py-sysctl | sysctl/tests/test_sysctl_setvalue.py | sysctl/tests/test_sysctl_setvalue.py | import os
import sysctl
from sysctl.tests import SysctlTestBase
class TestSysctlANum(SysctlTestBase):
def test_sysctl_setvalue(self):
dummy = sysctl.filter('kern.dummy')[0]
try:
self.command("/sbin/sysctl kern.dummy=0")
except:
if os.getuid() == 0:
... | bsd-2-clause | Python | |
67d41a5e882bc3cac980414b8f1551db777b8c5d | Update and rename 04Dan to 04Dan/listener_select.py | WeirdCoder/LilyPadOS,WeirdCoder/LilyPadOS,WeirdCoder/LilyPadOS,WeirdCoder/LilyPadOS | 04Dan/listener_select.py | 04Dan/listener_select.py | import select
import lcm
from lilylcm import 04Dan
def my_handler(channel, data):
msg = 04Dan.decode(data)
| mit | Python | |
4e2c73d1d4f244d6fc5fcd2a302423554e0f9361 | Create __init__.py | HTTP-APIs/hydrus,xadahiya/hydrus | hydrus/tests/__init__.py | hydrus/tests/__init__.py | mit | Python | ||
3e2d25dbebe7b956123cf249d7aa75c7b5a4c550 | Create data_to_db.py | mfittere/SixDeskDB,mfittere/SixDeskDB | turn_by_turn_data_download-store/data_to_db.py | turn_by_turn_data_download-store/data_to_db.py | # --------------------------------------------------------------------------------------------------------------
# INSERT TRACKING DATA INTO DB
# GIOVANNA CAMPOGIANI
# LAST MODFIIED: 16/09/2014
# This script stores the turn_by_turn tracking data downloaded from CASTOR into an SQL table called tracking
# contained in th... | lgpl-2.1 | Python | |
cb57ff82a89e611b2b6ab9db90d970bf98a07b5b | Create invert_values.py | Kunalpod/codewars,Kunalpod/codewars | invert_values.py | invert_values.py | #Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Invert values
#Problem level: 8 kyu
def invert(lst):
return [-x for x in lst]
| mit | Python | |
d1cfd37ad3f31eb97ce5195e408190edd325a899 | add instance_segmentation eval examples | yuyu2172/chainercv,chainer/chainercv,chainer/chainercv,pfnet/chainercv,yuyu2172/chainercv | examples/instance_segmentation/eval_sbd.py | examples/instance_segmentation/eval_sbd.py | import argparse
import chainer
from chainer import iterators
from chainercv.datasets import sbd_instance_segmentation_label_names
from chainercv.datasets import SBDInstanceSegmentationDataset
from chainercv.evaluations import eval_instance_segmentation_voc
from chainercv.experimental.links import FCISResNet101
from c... | mit | Python | |
3d2ff71ac7edfa7cf4120bc2620c2c5432430a2c | implement main wrapper base methods, and implement getMonitorings endpoint | gdmachado/scup-python | scup/scup_api.py | scup/scup_api.py | try:
import simplejson as json
except ImportError:
import json
import requests
import six
from scup.exceptions import *
from scup.auth import get_request_signature
class ScupAPI(object):
def __init__(self, private_key, public_key, url='http://api.scup.com/1.1', timeout=None):
"""
Initialize ScupAPI wit... | mit | Python | |
2c3c048d23b46c6b201a56d95f825380cfdb154d | Create __init__.py | Contextualist/Quip4AHA,Contextualist/Quip4AHA | lib/flask/ext/__init__.py | lib/flask/ext/__init__.py | # -*- coding: utf-8 -*-
"""
flask.ext
~~~~~~~~~
Redirect imports for extensions. This module basically makes it possible
for us to transition from flaskext.foo to flask_foo without having to
force all extensions to upgrade at the same time.
When a user does ``from flask.ext.foo import bar`` i... | apache-2.0 | Python | |
7bf298e6d56a256352971587fcef45566f22db36 | Create score_seg.py | soeaver/caffe-model | seg/score_seg.py | seg/score_seg.py | import cv2
import numpy as np
gt_root = '/home/prmct/Database/VOC_PASCAL/VOC2012_test/SegmentationClassAug/'
pre_root = './predict/'
val_pth = './val.txt'
n_class = 21
def fast_hist(a, b, n):
k = (a >= 0) & (a < n)
return np.bincount(n * a[k].astype(int) + b[k], minlength=n ** 2).reshape(n, n)
def compute... | mit | Python | |
8893938264674f0f526b6788fe55e8062a264b8d | Test to prevent regression of .grad and .data on torch.Tensor (#5480) | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | tests/syft/lib/torch/tensor/grad_test.py | tests/syft/lib/torch/tensor/grad_test.py | # third party
import torch
# syft absolute
import syft as sy
def torch_grad_test(client: sy.VirtualMachineClient) -> None:
x = client.torch.Tensor([[1, 1], [1, 1]])
x.requires_grad = True
gt = client.torch.Tensor([[1, 1], [1, 1]]) * 16 - 0.5
loss_fn = client.torch.nn.MSELoss()
v = x + 2
y =... | apache-2.0 | Python | |
d6c608871a3673041b8746fbb1c9fb6da084bf37 | Create bot.py | apy2017/Anaconda,apy2017/Anaconda,apy2017/Anaconda | bot.py | bot.py | import config
import telebot
bot = telebot.TeleBot(config.token)
class Bot(TelegramObject):
"""
Атрибуты:
id (int): идентификатор бота.
username (str): никнейм бота.
name (str): @username бота.
Аргументы:
token (str): Bot's unique authentication.
"""
# функции бота... | mit | Python | |
21c13c89f37823373119bdd917117a130c33aa5c | Create change_chunk_names.py | agisoft-llc/photoscan-scripts | src/test/change_chunk_names.py | src/test/change_chunk_names.py | import Metashape
"""
Metashape Chunk Name Changer Script (v 1.0)
Kent Mori, Feb 2021
Usage:
Workflow -> Batch Process -> Add -> Run script
This script changes chunks name refering to the first image name of the chunk.
When the image name include "_", this splits the name and join first three words.
ex) image name: "M... | mit | Python | |
10650db55da24c184939927e73551825f46e31aa | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/0c27d6b34eae0eeca600704ca7c8d76d891c7914. | tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow,Intel-Corporation/tensorflow,Intel-Corporation/tensorflow,yongtang/tensorflow,tensorflow/tensorflow,Intel-tensorflow/tensorflow,Intel-Corporation/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,tensorflow/tensorflow-pywrap_tf_optimi... | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "0c27d6b34eae0eeca600704ca7c8d76d891c7914"
TFRT_SHA256 = "862c1592ae2f11e6d948c508b28f... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "723c79c5e5f33f2b8f0f29f35561fe8c5c4eaaf0"
TFRT_SHA256 = "521ed52e30a42c0b330dcaf3934c... | apache-2.0 | Python |
9283525c5fd657acae674ab6e2c5d7d2206175ad | Update compare tool again | aio-libs/aioes | cmp.py | cmp.py | """Compare tool.
Calculate difference between public API from `elasticsearch` and `aioes`.
"""
from elasticsearch import Elasticsearch as es
from elasticsearch.client.utils import NamespacedClient
from aioes import Elasticsearch as aioes
es_set = {i for i in dir(es([])) if not i.startswith('_')}
aioes_set = {i for i... | """Compare tool.
Calculate difference between public API from `elasticsearch` and `aioes`.
"""
from elasticsearch import Elasticsearch as es
from elasticsearch.client.utils import NamespacedClient
from aioes import Elasticsearch as aioes
es_set = {i for i in dir(es([])) if not i.startswith('_')}
aioes_set = {i for i... | apache-2.0 | Python |
f57994b129267467fb4e0bc691a7dc469a3d747d | Refactor web server to improve quality | platzhirsch/security-cam,platzhirsch/security-cam | server/server.py | server/server.py | from bottle import get, post, request, run, static_file
import logging
LOG = logging.getLogger(__name__)
LOG.setLevel(logging.DEBUG)
LOG.addHandler(logging.StreamHandler())
@get('/motion/detection/start')
def start_motion_detection():
LOG.debug('Start Motion')
@get('/motion/detection/stop')
def stop_motion_det... | mit | Python | |
98e9884d05849868b92e96abfba30bd28189bd1b | Add lc0938_range_sum_of_bst.py | bowen0701/algorithms_data_structures | lc0938_range_sum_of_bst.py | lc0938_range_sum_of_bst.py | """Leetcode 938. Range Sum of BST
Easy
URL: https://leetcode.com/problems/range-sum-of-bst/
Given the root node of a binary search tree, return the sum of values of all
nodes with value between L and R (inclusive).
The binary search tree is guaranteed to have unique values.
Example 1:
Input: root = [10,5,15,3,7,nul... | bsd-2-clause | Python | |
85af653fa060ade5b6894200e248070be5ac6fb3 | Create admin.py | asarch/django | admin.py | admin.py | # Lo que se necesita:
from django.contrib import admin
from django.db.models.base import ModelBase
#from pos import models as pos_models
import models
# Las diferentes versiones:
# notebook/admin.py
#---------------------------------------------------------------------
# Originalmente el codigo era este:
#-------... | artistic-2.0 | Python | |
2920efe4a3c3da2a264c83893c6e8c78ce4b6a72 | add conversion plugin | x89/botologist,x89/botologist,moopie/botologist,anlutro/botologist | ircbot/plugin/convert.py | ircbot/plugin/convert.py | import json
import re
import socket
import urllib.error
import urllib.request
import ircbot.plugin
def get_conversion_result(qs):
url = 'http://api.duckduckgo.com/?q='+qs+'&format=json'
try:
response = urllib.request.urlopen(url, timeout=2)
content = response.read().decode()
except (urllib.error.URLError, soc... | mit | Python | |
490d5110b46afe5210bf2da4489854561e1bb259 | Add a utility to retrieve the latest version of RStudio. | dlab-berkeley/collaboratool-archive,dlab-berkeley/collaboratool-archive,dlab-berkeley/collaboratool-archive,dlab-berkeley/collaboratool-archive,dlab-berkeley/collaboratool-archive | bsd2/vagrant-ansible/provisioning/getrstudio.py | bsd2/vagrant-ansible/provisioning/getrstudio.py | #!/usr/bin/python
#
# RStudio does not provide a "-latest" download link so we deduce it from
# their S3 bucket listing and save the download to /tmp/rstudio-latest.deb.
#
# Test this script by running:
# wget -O /tmp/somefile.xml http://download1.rstudio.org
# python thisscript.py /tmp/somefile.xml
import sys
import ... | apache-2.0 | Python | |
1a42dbfafb5775c238fb7be46188c526e25ed2ee | add bloxplot script | OPU-Surveillance-System/monitoring,OPU-Surveillance-System/monitoring,OPU-Surveillance-System/monitoring | master/scripts/planner/solvers/alpha_boxplot.py | master/scripts/planner/solvers/alpha_boxplot.py | import matplotlib.pyplot as plt
import random
files = ['results_alpha1', 'results_alpha2', 'results_alpha3', 'sim']
data = []
for f in files:
with open(f, 'r') as r:
print(f)
content = r.read().split('\n')[:-1]
data.append([float(c)/10000 for c in content])
print(data)
names = ['alpha-step1', '... | mit | Python | |
a9be5e723977629def451d783d6a4a75296060ba | add gperftools (tcmalloc and friends) | skosukhin/spack,matthiasdiener/spack,lgarren/spack,EmreAtes/spack,tmerrick1/spack,TheTimmy/spack,LLNL/spack,mfherbst/spack,lgarren/spack,lgarren/spack,mfherbst/spack,iulian787/spack,matthiasdiener/spack,iulian787/spack,LLNL/spack,krafczyk/spack,tmerrick1/spack,skosukhin/spack,skosukhin/spack,krafczyk/spack,LLNL/spack,s... | var/spack/packages/gperftools/package.py | var/spack/packages/gperftools/package.py | ##############################################################################
# Copyright (c) 2013, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
... | lgpl-2.1 | Python | |
30e33acc50725ea5f8bb4a094e60dbeadaa6d1f8 | Solve Code Fights cyclic name problem | HKuz/Test_Code | CodeFights/cyclicName.py | CodeFights/cyclicName.py | #!/usr/local/bin/python
# Code Fights Cyclic Name Problem
from itertools import cycle
def cyclicName(name, n):
gen = cycle(name)
res = [next(gen) for _ in range(n)]
return ''.join(res)
def main():
tests = [
["nicecoder", 15, "nicecoderniceco"],
["codefights", 50, "codefightscodefigh... | mit | Python | |
15b086e28b135f0029e9bcd8e8cc8d3eab6e4528 | add quick script for downloading relevant zip files | funginstitute/patentprocessor,funginstitute/patentprocessor,nikken1/patentprocessor,yngcan/patentprocessor,yngcan/patentprocessor,nikken1/patentprocessor,nikken1/patentprocessor,yngcan/patentprocessor,funginstitute/patentprocessor | getpatent.py | getpatent.py | #!/usr/bin/env python
import sys
import re
import time
import mechanize
from BeautifulSoup import BeautifulSoup
if len(sys.argv) < 2:
print "Given a patent id number, will download the relevant zipfile"
print "Usage: ./getpatent.py <patent id number>"
print "Example: ./getpatent.py 7783348"
sys.exit(0... | bsd-2-clause | Python | |
92c8b146783c807b143a60419efd88f2da11d065 | Add tests for C4 model property pages | amolenaar/gaphor,amolenaar/gaphor | gaphor/C4Model/tests/test_propertypages.py | gaphor/C4Model/tests/test_propertypages.py | from gaphor import C4Model
from gaphor.C4Model.propertypages import DescriptionPropertyPage, TechnologyPropertyPage
from gaphor.diagram.tests.fixtures import find
def test_description_property_page(element_factory):
subject = element_factory.create(C4Model.c4model.C4Container)
property_page = DescriptionPrope... | lgpl-2.1 | Python | |
6ff2c5be8bf2fec4139625e53d89136723414e02 | Write test for cudnn | pfnet/chainer,okuta/chainer,chainer/chainer,chainer/chainer,keisuke-umezawa/chainer,anaruse/chainer,okuta/chainer,niboshi/chainer,niboshi/chainer,okuta/chainer,niboshi/chainer,kiyukuta/chainer,cupy/cupy,jnishi/chainer,ysekky/chainer,ktnyt/chainer,keisuke-umezawa/chainer,kashif/chainer,keisuke-umezawa/chainer,wkentaro/c... | tests/cupy_tests/test_cudnn.py | tests/cupy_tests/test_cudnn.py | import unittest
import mock
import numpy
import cupy
import cupy.cuda.cudnn as libcudnn
import cupy.cudnn
from cupy import testing
@testing.parameterize(*testing.product({
'dtype': [numpy.float16, numpy.float32, numpy.float64],
'mode': [
libcudnn.CUDNN_ACTIVATION_SIGMOID,
libcudnn.CUDNN_ACTI... | mit | Python | |
1ed7965b502013caafebd822f5d72399ba46fa90 | Add parsers | ZeroCater/zc_common,ZeroCater/zc_common | zc_common/remote_resource/parsers.py | zc_common/remote_resource/parsers.py | """
Parsers
"""
from rest_framework import parsers
from rest_framework.exceptions import ParseError
from rest_framework_json_api import utils, renderers, exceptions
class JSONParser(parsers.JSONParser):
"""
A JSON API client will send a payload that looks like this:
{
"data": {
... | mit | Python | |
fd3f3902c7da0d13c9825d29b2579441ec1217fb | Create coinversion.py | douedd/coinversion | coinversion.py | coinversion.py | #!/usr/bin/python3
import argparse,json,os,re,socket,sys,urllib.request
def init_argparse():
parser = argparse.ArgumentParser(description='convert cryptocurrencies conveniently.', usage=os.path.basename(sys.argv[0]) + ' amount [currency] [-p ...]')
parser.add_argument('amount', help='coin amount to convert',... | mit | Python | |
3f2a21a2e6230d8c7b23040db5e85d2eb9f9d936 | add validate task | cathydeng/openelections-core,openelections/openelections-core,openelections/openelections-core,cathydeng/openelections-core,datamade/openelections-core,datamade/openelections-core | openelex/tasks/validate.py | openelex/tasks/validate.py | import os
import sys
from invoke import task
from .utils import load_module
@task(help={
'state':'Two-letter state-abbreviation, e.g. NY',
})
def run(state):
"""
Run data validations.
State is required.
"""
state_mod = load_module(state, ['validate'])
for name in dir(state_mod.validate):... | mit | Python | |
5a7423d0503c9ae3cd549d870f5577e0265cf7fe | add new tests | biokit/biokit,biokit/biokit | test/converters/test_bam2sam.py | test/converters/test_bam2sam.py | from biokit.converters.bam2sam import BAM2SAM
from biokit import biokit_data
from easydev import TempFile, md5
def test_conv():
infile = biokit_data("converters/measles.sorted.bam")
#outfile = biokit_data("converters/measles.sam")
with TempFile(suffix=".bam") as tempfile:
convert = BAM2SAM(infile,... | bsd-2-clause | Python | |
43a89ec03553ae55e799b7446c1b78685fdb9042 | Create cut_the_sticks.py | costincaraivan/hackerrank,costincaraivan/hackerrank | algorithms/implementation/python3/cut_the_sticks.py | algorithms/implementation/python3/cut_the_sticks.py | #!/bin/python3
import sys
n = int(input().strip())
arr = [int(arr_temp) for arr_temp in input().strip().split(' ')]
def positive_min(arr):
if arr == None or len(arr) == 0:
return None
min = sys.maxsize
for element in arr:
if min > element and element > 0:
min = element
re... | mit | Python | |
d6feebb7d35daa71d2362d31b203e293c8cdaf4e | Implement defaults.py which contains all default settings, such as weight and volume precision values, default origin and packer opts. Do not forget to include it in the project settings module : `from oscar_shipping.defaults import *` | okfish/django-oscar-shipping,okfish/django-oscar-shipping,okfish/django-oscar-shipping | oscar_shipping/defaults.py | oscar_shipping/defaults.py | # -*- coding: utf-8 -*-
from decimal import Decimal as D
from django.utils.translation import ugettext_lazy as _
OSCAR_SHIPPING_WEIGHT_PRECISION = D('0.000')
OSCAR_SHIPPING_VOLUME_PRECISION = D('0.000')
# per product defaults
# 0.1m x 0.1m x 0.1m
OSCAR_SHIPPING_DEFAULT_BOX = {'width' : float('0.1'),
... | bsd-3-clause | Python | |
aad28f508187c734a0bef9c98629644f69775335 | Add utilities for testing. | google-research/meta-dataset | meta_dataset/test_utils.py | meta_dataset/test_utils.py | # coding=utf-8
# Copyright 2020 The Meta-Dataset Authors.
#
# 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 ... | apache-2.0 | Python | |
aed67dd5ee343d185a136ed8406d0cf32c9759c6 | test for typograhpic misc mappings | rcamba/kanji_to_romaji | tests/test_typographic_misc.py | tests/test_typographic_misc.py | # coding=utf-8
import unittest
from kana_to_romaji.kana_to_romaji import translate_to_romaji, kana_to_romaji
class TestHiraganaRomajiTranslation(unittest.TestCase):
def setUp(self):
print "\nStarting " + self.__module__ + ": " + self._testMethodName
def test_brackets(self):
self.assertEqual("... | mpl-2.0 | Python | |
dd56be9ecb0fd3fba252ff038f20bdd4038ac458 | Integrate LLVM at llvm/llvm-project@e07736fe3c78 | tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow-pywrap_saved_model,tensorflow/tensorflow,gautam1858/tensorflow,tensorflow/tensorflow-experimental_link_static_libraries_once,paolodedios/tensorflow,gautam1858/tensorflow,yongtang/tensorflow,karllessard/tensorflow,tensorflow/tensorflow-experimental_link_stat... | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "e07736fe3c78bf02c1eb922a04065840a8e13935"
LLVM_SHA256 = "164b415e60485aed5340ed9f5a60ff999b5e13ec0461a89080684d15a432d718"
tf_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "7056250f517a9af0e26c019180c88a4bb5e691db"
LLVM_SHA256 = "3aad68dfd3aa9d9c8e58b8a89d7cf13553e22a7886dc1f3e2477a0e3028a31c6"
tf_http_archive(
... | apache-2.0 | Python |
d6461fa77731143487e34882cf7160ae66287088 | Integrate LLVM at llvm/llvm-project@01120fe5b398 | yongtang/tensorflow,yongtang/tensorflow,Intel-Corporation/tensorflow,frreiss/tensorflow-fred,frreiss/tensorflow-fred,tensorflow/tensorflow-pywrap_tf_optimizer,tensorflow/tensorflow-experimental_link_static_libraries_once,yongtang/tensorflow,sarvex/tensorflow,Intel-Corporation/tensorflow,tensorflow/tensorflow-pywrap_tf_... | third_party/llvm/workspace.bzl | third_party/llvm/workspace.bzl | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "01120fe5b39837f87e6fa34a5227b8f8634d7b01"
LLVM_SHA256 = "ddd8fc0aaf987c192fb0032ee4fd9614bbdf6adf4f8a34c57d1dbcd2031c636d"
tf_http_archive(
... | """Provides the repository macro to import LLVM."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo(name):
"""Imports LLVM."""
LLVM_COMMIT = "cb65419b1ac05c3020dd05b64db183712235d2ff"
LLVM_SHA256 = "95fcd4af4b21b6cb2ceda9e45d22c6b0014585258cc21727b5c864f7e9804fab"
tf_http_archive(
... | apache-2.0 | Python |
3f3885b0570fd4bf1b269106696f338c674ff55d | add livequestion factory | liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin,liqd/a4-meinberlin | meinberlin/test/factories/livequestions.py | meinberlin/test/factories/livequestions.py | import factory
from adhocracy4.test import factories as a4_factories
from meinberlin.apps.livequestions import models
from meinberlin.test.factories import CategoryFactory
class LiveQuestionFactory(factory.django.DjangoModelFactory):
class Meta:
model = models.LiveQuestion
text = factory.Faker('tex... | agpl-3.0 | Python | |
cb82d4ecde7c776e3cf41d8bcde7221a09c0acff | Add vgg arg scope | ronrest/convenience_py,ronrest/convenience_py | ml/tf/architectures/vgg.py | ml/tf/architectures/vgg.py | import tensorflow as tf
# USEFUL LAYERS
fc = tf.contrib.layers.fully_connected
conv = tf.contrib.layers.conv2d
# convsep = tf.contrib.layers.separable_conv2d
deconv = tf.contrib.layers.conv2d_transpose
relu = tf.nn.relu
maxpool = tf.contrib.layers.max_pool2d
dropout_layer = tf.layers.dropout
# bn = tf.contrib.layers.b... | apache-2.0 | Python | |
14a455f2086451288833aa045d791cd4a5183775 | Add media benchmark to Telemetry. | patrickm/chromium.src,ondra-novak/chromium.src,chuan9/chromium-crosswalk,Fireblend/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,jaruba/chromium.src,M4sse/chromium.src,dednal/chromium.src,ChromiumWebApps/chromium,mogoweb/chromium-crosswalk,krieger-od/nwjs_chromium.src,axinging/chromium-crosswalk,dednal/chromiu... | tools/perf/benchmarks/media.py | tools/perf/benchmarks/media.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from measurements import media
from telemetry import test
class Media(test.Test):
"""Obtains media metrics for key user scenarios."""
test = media.Media... | bsd-3-clause | Python | |
07786677f3067cb854f52c66c1883c9d9c3f3649 | Implement PASS command | ElementalAlchemist/txircd,Heufneutje/txircd | txircd/modules/rfc/cmd_pass.py | txircd/modules/rfc/cmd_pass.py | from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.module_interface import Command, ICommand, IModuleData, ModuleData
from zope.interface import implements
class PassCommand(ModuleData, Command):
implements(IPlugin, IModuleData, ICommand)
name = "PassCommand"
core =... | bsd-3-clause | Python | |
6d2232358466b499a605a80abd2b503c1b1c13fa | make a bot to Tweet congrassional phone numbers | fionapigott/fiona-bot | get_representatives_bot.py | get_representatives_bot.py | # Author: Fiona Pigott
# Date: 1/13/2017
import tweepy
import yaml
import requests
import re
import json
import random
# set up the Tweepy Twitter API access
# I assume that your creds file looks like the creds file that Twurl creates
creds = yaml.load(open("fionabot.creds"))
keys = creds["profiles"][creds["configurat... | mit | Python | |
846fe89a0c83fbed9358345a1d0b41e2ef58f804 | add initial tests for publish subscribe | pengutronix/aiohttp-json-rpc,pengutronix/aiohttp-json-rpc,pengutronix/aiohttp-json-rpc | tests/test_publish_subscribe.py | tests/test_publish_subscribe.py | import pytest
@pytest.mark.asyncio
async def test_add_topics(rpc_context):
client1 = await rpc_context.make_client()
assert 'topic' not in await client1.get_topics()
rpc_context.rpc.add_topics('topic')
client2 = await rpc_context.make_client()
assert 'topic' in await client2.get_topics()
@pyte... | apache-2.0 | Python | |
1c4429759a3e89ed952b1a025b1470a9e187537f | Add test for the EPSG-3857 spatial reference. | ecometrica/gdal2mbtiles | tests/test_spatial_reference.py | tests/test_spatial_reference.py | # -*- coding: utf-8 -*-
import rasterio
import pytest
from math import pi
from numpy import array
from numpy.testing import assert_array_almost_equal
from gdal2mbtiles.constants import EPSG_WEB_MERCATOR
from gdal2mbtiles.gdal import SpatialReference
# SEMI_MAJOR is a constant referring to the WGS84 Semi Major Ax... | apache-2.0 | Python | |
9d837922a39ddbbe598558ee388942c55142e63a | Add rough finduser command | mozilla/standup,mozilla/standup,mozilla/standup,mozilla/standup | standup/status/management/commands/finduser.py | standup/status/management/commands/finduser.py | import tabulate
from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand
from django.db.models import Q
from standup.status.models import StandupUser
class Command(BaseCommand):
help = 'Find a user given a substring'
def add_arguments(self, parser):
parser.... | bsd-3-clause | Python | |
e46e69de95ce0f2d1881e53a59d4f797a2a27eca | add test for files and directories | wicksy/vagrant-openshift,wicksy/vagrant-openshift,wicksy/vagrant-openshift | test/test_files.py | test/test_files.py | import pytest
@pytest.mark.parametrize("name, user, group, mode, contains", [
("/etc/hosts","root","root","0644","ocptest"),
("/etc/sysconfig/docker","root","root","0644","OPTIONS=' --selinux-enabled --log-driver=json-file --log-opt max-size=50m --insecure-registry 172.30.0.0/16'"),
("/home/vagrant/openshift-ans... | mit | Python | |
3802c747b3c168bc45303a6bee62fa07c2ab075f | Create __init__.py | holtjma/suspenders | MergeImprove/__init__.py | MergeImprove/__init__.py | mit | Python | ||
e605930733af2264629e751af6dc1133a12d84e8 | Simplify the autoslots by slots. | titilambert/alignak,baloo/shinken,Simage/shinken,baloo/shinken,rednach/krill,peeyush-tm/shinken,ddurieux/alignak,fpeyre/shinken,ddurieux/alignak,fpeyre/shinken,Aimage/shinken,fpeyre/shinken,kaji-project/shinken,gst/alignak,naparuba/shinken,mohierf/shinken,Alignak-monitoring/alignak,peeyush-tm/shinken,tal-nino/shinken,c... | src/autoslots.py | src/autoslots.py | #!/usr/bin/python
#Copyright (C) 2009 Gabes Jean, naparuba@gmail.com
#
#This file is part of Shinken.
#
#Shinken is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at yo... | #!/usr/bin/python
#Copyright (C) 2009 Gabes Jean, naparuba@gmail.com
#
#This file is part of Shinken.
#
#Shinken is free software: you can redistribute it and/or modify
#it under the terms of the GNU Affero General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at yo... | agpl-3.0 | Python |
dba9f9b4eb41c488ff5913572f24585cdbc4f123 | update vera++.py script | al2950/mygui,fmwviormv/mygui,Anomalous-Software/mygui,fmwviormv/mygui,al2950/mygui,fmwviormv/mygui,scrawl/mygui,fmwviormv/mygui,Anomalous-Software/mygui,scrawl/mygui,al2950/mygui,scrawl/mygui,al2950/mygui,scrawl/mygui,Anomalous-Software/mygui,Anomalous-Software/mygui | Scripts/vera++/vera++.py | Scripts/vera++/vera++.py | # run from root sources directory: python Scripts/vera++/vera++.py
import os
ignoredEndings = []
ignoredContent = ["CMakeFiles", "MyGUI_UString", "Wrappers", "MyGUI_KeyCode.h:58", "InputConverter.h:896", "MyGUI_RTTLayer.h:21", "HotKeyManager.cpp:43", "HotKeyManager.cpp:44"]
def isIgnoredWarning(warning):
for ignore ... | # run from root sources directory: python Scripts/vera++/vera++.py
import os
ignoredEndings = []
ignoredContent = ["MyGUI_UString", "Wrappers", "MyGUI_KeyCode.h:58", "InputConverter.h:896", "MyGUI_RTTLayer.h:21", "HotKeyManager.cpp:43", "HotKeyManager.cpp:44"]
def isIgnoredWarning(warning):
for ignore in ignoredEndi... | mit | Python |
9d141185d73b1c2645cf5bd6d2fca25269b3eae7 | Define manager module : add log level static variable | RoboAdvisorProj/Crawler | Setting/DefineManager.py | Setting/DefineManager.py | LOG_LEVEL_VERBOSE = 1
LOG_LEVEL_INFO = 2
LOG_LEVEL_DEBUG = 3
LOG_LEVEL_WARN = 4
LOG_LEVEL_ERROR = 5 | mit | Python | |
3cdd65f4ccecf5f63d99cc9a92e64154c15aac70 | Update and rename 04Dan to 04Dan/SensorMotorTest.py | WeirdCoder/LilyPadOS,WeirdCoder/LilyPadOS,WeirdCoder/LilyPadOS,WeirdCoder/LilyPadOS | 04Dan/SensorMotorTest.py | 04Dan/SensorMotorTest.py | import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(18, GPIO.OUT) //servo
GPIO.setup(22, GPIO.OUT) //motor
GPIO.setup(16, GPIO.IN) //button
try:
while True:
i = GPIO.input(16)
print(i)
delay(1)
except Keyboardinterupt:
pass
GPIO.cleanup()
| mit | Python | |
0d92340f2b1cab932f14e376dc776a7c11e3e42f | Add tests for generic relationship batch fetching | konstantinoskostis/sqlalchemy-utils,tonyseek/sqlalchemy-utils,joshfriend/sqlalchemy-utils,cheungpat/sqlalchemy-utils,tonyseek/sqlalchemy-utils,joshfriend/sqlalchemy-utils,spoqa/sqlalchemy-utils,rmoorman/sqlalchemy-utils,marrybird/sqlalchemy-utils,JackWink/sqlalchemy-utils | tests/batch_fetch/test_generic_relationship.py | tests/batch_fetch/test_generic_relationship.py | from __future__ import unicode_literals
import sqlalchemy as sa
from tests import TestCase
from sqlalchemy_utils import batch_fetch, generic_relationship
class TestBatchFetchGenericRelationship(TestCase):
def create_models(self):
class Building(self.Base):
__tablename__ = 'building'
... | bsd-3-clause | Python | |
5613b9ef69d5f16f5ef94ea4be3458888e3595b7 | add prototype for output of the parser | GNU-Pony/splashtool,GNU-Pony/splashtool | src/parse.py | src/parse.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# splashtool – A simple tool for creating SYSLINUX splashes without fuss
#
# Copyright © 2013 Mattias Andrée (maandree@member.fsf.org)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pub... | agpl-3.0 | Python | |
1934a8aaaea6e66f50041b49bbb7686fda1c5670 | Create main_test.py | DQE-Polytech-University/Beamplex | tests/main_test.py | tests/main_test.py | import unittest
import sys
from os import *
import os
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
class TestLaserstructureOutput(unittest.TestCase):
mainPath = path.dirname(path.dirname(path.abspath(__file__))) + '\src\main.py'
jsonPath = os.path.join(path.dirname(path.dirname(path.absp... | mit | Python | |
fb3766204cbb25ccf8ee73ab4f480ba34251542c | Add check on HADS ingest | akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem,akrherz/iem | nagios/check_hads_ingest.py | nagios/check_hads_ingest.py | """
Check how much HADSA data we have
"""
import os
import sys
import stat
import iemdb
HADS = iemdb.connect('iem', bypass=True)
hcursor = HADS.cursor()
def check():
hcursor.execute("""SELECT count(*) from current_shef
WHERE valid > now() - '1 hour'::interval""")
row = hcursor.fetchone()
return row[... | mit | Python | |
f931844003256b86f1e64f1d3eac19f45123b5ab | Add datetime_to_timestamp test cases | jcollado/esis | tests/test_util.py | tests/test_util.py | # -*- coding: utf-8 -*-
"""Utility tools test cases."""
import unittest
from datetime import datetime
import dateutil.tz
from esis.util import datetime_to_timestamp
class DatetimeToTimestampTest(unittest.TestCase):
"""Datetime to timestamp test cases."""
def test_conversion(self):
"""Naive datet... | mit | Python | |
224268396339f121a9c7d45aa2dd95711a6a9d62 | Create nltk1.py | PythonProgramming/Natural-Language-Processing-NLTK-Python-2.7 | nltk1.py | nltk1.py | import time
import urllib2
from urllib2 import urlopen
import re
import cookielib, urllib2
from cookielib import CookieJar
import datetime
cj = CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
def main():
try:
page = 'http://www... | mit | Python | |
3aaef7bcc4ffbf3d2c611d59ef851c7406aed6d7 | add textfiles | real-numbers/pythonLessons | textfiles/hello.py | textfiles/hello.py | print("Hello Ruthie!") | mit | Python | |
fe70e00fc11b69cf2f4ed0af1121cdda5df88188 | Create pebble_sdk_version.py | iAbadia/Pebble-Public-Transport-Zgz,iAbadia/Pebble-Public-Transport-Zgz,iAbadia/Pebble-Public-Transport-Zgz,iAbadia/Pebble-Urbanos-Zgz,iAbadia/Pebble-Public-Transport-Zgz,iAbadia/Pebble-Urbanos-Zgz,iAbadia/Pebble-Urbanos-Zgz,iAbadia/Pebble-Urbanos-Zgz | waftools/pebble_sdk_version.py | waftools/pebble_sdk_version.py | from waflib.Configure import conf
@conf
def compare_sdk_version(ctx, platform, version):
target_env = ctx.all_envs[platform] if platform in ctx.all_envs else ctx.env
target_version = (int(target_env.SDK_VERSION_MAJOR or 0x5) * 0xff +
int(target_env.SDK_VERSION_MINOR or 0x19))
other_v... | mit | Python | |
c85fdd29abe2117b5367fb4da30e475af5f9cc29 | Add files via upload | mandli/surge-examples | atlantic/bathy/thredds.py | atlantic/bathy/thredds.py | #!/usr/bin/env python
# Script to download all .nc files from a THREDDS catalog directory
# Written by Sage 4/5/2016, revised 5/31/2018
from xml.dom import minidom
from urllib.request import urlopen
from urllib.request import urlretrieve
# Divide the url you get from the data portal into two parts
# Everything be... | mit | Python | |
bcfedcd910debf89ba9e38d79792b7ba077bb6ce | add given solution to round number using strings | enlighter/simple-crawler-in-python | baby-steps/roundNumberUsingStrings.py | baby-steps/roundNumberUsingStrings.py | # Given a variable, x, that stores the
# value of any decimal number, write Python
# code that prints out the nearest whole
# number to x.
# If x is exactly half way between two
# whole numbers, round up, so
# 3.5 rounds to 4 and 2.5 rounds to 3.
# You may assume x is not negative.
# Hint: The str function can con... | mit | Python | |
e8c3b63ece1bf912ab36b5f83464ea3c595d91df | Initialize logging_conf.py | JoseALermaIII/clashcallerbot-reddit,JoseALermaIII/clashcallerbot-reddit | logging_conf.py | logging_conf.py | #! python3
# -*- coding: utf-8 -*-
"""Defines logging dictionary.
Module defines dictionary for logging.config.dictConfig()
"""
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'detailed': {
'format': 'F1 %(asctime)s %(name)-15s %(levelname)-8s %(message)s',... | mit | Python | |
a7529057f590f8b5185a77b3ff62889b1357a0e7 | Add w2v create graph from corpus | agnusmaximus/cyclades,agnusmaximus/cyclades,agnusmaximus/cyclades,agnusmaximus/cyclades | data/word_embeddings/create_graph_from_corpus.py | data/word_embeddings/create_graph_from_corpus.py | from __future__ import print_function
import sys
from random import shuffle
DISTANCE = 10
with open(sys.argv[1], 'r') as corpus:
text = corpus.read()
text = text[:1000000]
words_list = list(set(text.split()))
word_to_id = {}
# Write word id mappings
for index, word in enumerate(list(set(word... | apache-2.0 | Python | |
813854eb80d89142e97cc66619aac94ce8f3236d | Add leetcode 026 solutions | aiden0z/snippets,aiden0z/snippets,aiden0z/snippets,aiden0z/snippets,aiden0z/snippets,aiden0z/snippets | leetcode/026_remove_duplicates_from_sorted_array.py | leetcode/026_remove_duplicates_from_sorted_array.py | """Remove Duplicates from Sorted Array
Given a sorted array nums, remove the duplicate in-place sunch that each element appear only once
and return the new length.
Do not allocate extra space for another array, you must to this by modifying the input array
in-place with O(1) extray memory.
Example 1:
Gieven n... | mit | Python | |
32a3ba5c3ff77a216290cd8a7a57be442d6b82dc | allow for multiple cols now in sd | h2oai/h2o-dev,mathemage/h2o-3,madmax983/h2o-3,brightchen/h2o-3,spennihana/h2o-3,brightchen/h2o-3,h2oai/h2o-dev,kyoren/https-github.com-h2oai-h2o-3,junwucs/h2o-3,tarasane/h2o-3,mathemage/h2o-3,datachand/h2o-3,h2oai/h2o-3,junwucs/h2o-3,printedheart/h2o-3,junwucs/h2o-3,michalkurka/h2o-3,pchmieli/h2o-3,YzPaul3/h2o-3,spenni... | h2o-py/tests/testdir_munging/unop/pyunit_sdev.py | h2o-py/tests/testdir_munging/unop/pyunit_sdev.py | ##
# Test out the sdev() functionality
# If NAs in the frame, they are skipped in calculation unless na.rm = F
# If any categorical columns, throw an error
##
import sys
sys.path.insert(1, "../../../")
import h2o
import numpy as np
def sdev(ip,port):
iris_h2o = h2o.import_file(path=h2o.locate("smalldata/iris... | ##
# Test out the sdev() functionality
# If NAs in the frame, they are skipped in calculation unless na.rm = F
# If any categorical columns, throw an error
##
import sys
sys.path.insert(1, "../../../")
import h2o
import numpy as np
def sdev(ip,port):
iris_h2o = h2o.import_file(path=h2o.locate("smalldata/iris... | apache-2.0 | Python |
f86387b5832b37ca80655b1ccc23500451a49d5d | Add turbine_cluster module | wind-python/windpowerlib | windpowerlib/turbine_cluster.py | windpowerlib/turbine_cluster.py | """
The ``turbine_cluster`` module is under development and is not working yet.
"""
# TODO: desciption
__copyright__ = "Copyright oemof developer group"
__license__ = "GPLv3"
import numpy as np
#from windpowerlib import wind_turbine
def gaussian_distribution(function_variable, standard_deviation, median=0):
r"... | mit | Python | |
bcb73da9d30d6737fdbdb4ba2378a612851ec9b9 | Complete word idx dict + prefix/suffix pal sol | bowen0701/algorithms_data_structures | lc0336_palindrome_pairs.py | lc0336_palindrome_pairs.py | """336. Palindrome Pairs
Hard
URL: https://leetcode.com/problems/palindrome-pairs/
Given a list of unique words, find all pairs of distinct indices (i, j) in the given
list, so that the concatenation of the two words, i.e. words[i] + words[j] is a
palindrome.
Example 1:
Input: ["abcd","dcba","lls","s","sssll"]
Outpu... | bsd-2-clause | Python | |
abe923c31dd4b320983580156563dc56aa3b87f7 | add CoreFoundation for osx. BUG: CheckLib doesn't work with frameworks. | tuttleofx/sconsProject | autoconf/corefoundation.py | autoconf/corefoundation.py | from _external import *
corefoundation = LibWithHeaderChecker('CoreFoundation',
'CoreFoundation.h',
'c++',
name='corefoundation')
| mit | Python | |
45b4bd0962516270c97fe815201a62933faee2ba | fix tox | twobraids/configman,mozilla/configman | setup.py | setup.py | from __future__ import absolute_import, division, print_function
# Can't import unicode_literals in setup.py currently
# http://stackoverflow.com/a/23175131
import codecs
import os
from setuptools import setup
import sys
# Prevent spurious errors during `python setup.py test`, a la
# http://www.eby-sarna.com/pipermai... | from __future__ import absolute_import, division, print_function, \
unicode_literals
import codecs
import os
from setuptools import setup
import sys
# Prevent spurious errors during `python setup.py test`, a la
# http://www.eby-sarna.com/pipermail/peak/2010-May/003357.html:
try:
import multiprocessing
except ... | mpl-2.0 | Python |
9e009ab398a7ac4cddcda0205434f9a2f66b1bd1 | clean up setup.py | 4Subsea/evapy | setup.py | setup.py | from setuptools import setup
setup(name='evapy',
version='0.1.1',
license='MIT',
description='Extreme value analysis of time series',
keywords='extreme value statistics',
url='https://github.com/4Subsea/evapy',
author='4Subsea',
author_email='ace@4subsea.com',
packages=... | from setuptools import setup
setup(name='evapy',
version='0.1.0',
description='Extreme value analysis',
author='4Subsea',
author_email='ace@4subsea.com',
url='',
keywords='extreme value statistics',
license='MIT',
packages=[
'evapy'
],
classifiers=... | mit | Python |
760f4345fff0f3f08a4f3877279e13c6a4d8a9bd | use find_packages (#42) | arviz-devs/arviz,arviz-devs/arviz,arviz-devs/arviz,arviz-devs/arviz | setup.py | setup.py |
from setuptools import setup, find_packages
setup(
name="arviz",
version="0.1.0",
packages=find_packages(),
include_package_data=True,
install_requires=[
'matplotlib',
'numpy',
'scipy',
'pandas'
],
)
|
from setuptools import setup
setup(
name="arviz",
version="0.1.0",
packages=['arviz'],
include_package_data=True,
install_requires=[
'matplotlib',
'numpy',
'scipy',
'pandas'
],
)
| apache-2.0 | Python |
1aa4bc2b4214762db83279d4e87b3f13012d7f6a | add getbedlength. useful for debugging | glennhickey/hal,glennhickey/hal,glennhickey/hal,glennhickey/hal,glennhickey/hal,glennhickey/hal,glennhickey/hal,glennhickey/hal | analysis/neutralIndel/getBedLength.py | analysis/neutralIndel/getBedLength.py | #!/usr/bin/env python
import os
import sys
import argparse
def getBedLength(bedPath):
length = 0
bedFile = open(bedPath)
for line in bedFile:
clnLine = line.strip()
if len(clnLine) > 0 and clnLine[0] != "#":
toks = clnLine.split()
if len(toks) > 2:
s... | mit | Python | |
1a932c213ac714f8258af3fdf9b9a1c638cd7d95 | add an example about automation | sdpython/ensae_teaching_cs,sdpython/ensae_teaching_cs,sdpython/ensae_teaching_cs,sdpython/ensae_teaching_cs,sdpython/ensae_teaching_cs,sdpython/ensae_teaching_cs | _doc/examples/automation/copy_lectures.py | _doc/examples/automation/copy_lectures.py | # -*- coding: utf-8 -*-
"""
Copy documentation
==================
Copy all the documentation into one single folder
in order to serve it through a server.
"""
#########################################
# import
import sys
import os
############################
# paramètres
# root est là où sont compilés les packages... | mit | Python | |
7de700ef46e69e4d3d5cd3018770c1dd5be92985 | Create candies.py | mvoronin/competitive-programming | hackerrank/candies.py | hackerrank/candies.py | #!/bin/python
# -*- coding: utf-8 -*-
# https://www.hackerrank.com/challenges/candies
def solution(n, rs, cs):
for i in xrange(1, n):
if rs[i-1] > rs[i]: # предыдущий элемент больше чем текущий
if cs[i-1] <= cs[i]: # у предыдущего конфет меньше или равно, чем у текущего
cs[i-1... | mit | Python | |
7061b26dd3a23a98292870b667401d59cdf6f45b | Update net/data/websocket/close-code-and-reason_wsh.py | Just-D/chromium-1,Pluto-tv/chromium-crosswalk,Jonekee/chromium.src,ltilve/chromium,krieger-od/nwjs_chromium.src,ondra-novak/chromium.src,dednal/chromium.src,markYoungH/chromium.src,Chilledheart/chromium,PeterWangIntel/chromium-crosswalk,Jonekee/chromium.src,Jonekee/chromium.src,TheTypoMaster/chromium-crosswalk,bright-s... | net/data/websocket/close-code-and-reason_wsh.py | net/data/websocket/close-code-and-reason_wsh.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import struct
from mod_pywebsocket import stream
def web_socket_do_extra_handshake(_request):
pass
def web_socket_transfer_data(request):
line =... | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import struct
from mod_pywebsocket import stream
def web_socket_do_extra_handshake(_request):
pass
def web_socket_transfer_data(request):
line =... | bsd-3-clause | Python |
15f6b88adf70b82e04b82ce22066800adbfc9615 | Create myuw_api.person class. | fanglinfang/myuw,fanglinfang/myuw,uw-it-aca/myuw,uw-it-aca/myuw,fanglinfang/myuw,uw-it-aca/myuw,uw-it-aca/myuw | myuw_api/person.py | myuw_api/person.py | from django.conf import settings
import restclients.pws_client
import logging
import json
class Person:
""" The Person class encapsulate the access to the Term data """
__logger = logging.getLogger('myuw_api.person')
__pws_client = PWSClient()
def get_regid(self, uwnetid):
return '9136CCB8F66... | apache-2.0 | Python | |
47e6b6fc0e1479943b470789156c03ab0becdc07 | Create pycon_conference_speakers_scrapper.py | zefferno/Scripts | pycon_conference_speakers_scrapper.py | pycon_conference_speakers_scrapper.py | #! /usr/bin/python
# -*- coding: utf-8 -*-
"""
PyCon speaker names and picture URL web-scrapper
"""
import re
import requests
from bs4 import BeautifulSoup
from prettytable import PrettyTable
URL = "http://il.pycon.org/wwwpyconIL/speakers"
RE_SPEAKERS = "view-speakersandsession*."
if __name__ == "__main__":
pr... | apache-2.0 | Python | |
76137fae30d194b02305ad40855e3f4e75060275 | Add 165_Compare_Version_Numbers (#50) | qiyuangong/leetcode,qiyuangong/leetcode,qiyuangong/leetcode | python/165_Compare_Version_Numbers.py | python/165_Compare_Version_Numbers.py | class Solution:
def compareVersion(self, version1: str, version2: str) -> int:
l1=list(map(int,version1.split('.')))
l2=list(map(int,version2.split('.')))
if l1==l2:
return(0)
a=len(l1)
b=len(l2)
if a>b:
for i in range(a-b):
... | mit | Python | |
8f0c113f5bcaf657cc4a20fe96b1c73393848c91 | create Container Admin Form, add field json on form | YACOWS/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,williamroot/opps,jeanmask/opps,jeanmask/opps,opps/opps,YACOWS/opps,opps/opps,jeanmask/opps,williamroot/opps,williamroot/opps,jeanmask/opps,opps/opps,opps/opps | opps/containers/forms.py | opps/containers/forms.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django import forms
from opps.db.models.fields.jsonf import JSONFormField
from opps.fields.widgets import JSONField
from opps.fields.models import Field, FieldOption
class ContainerAdminForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(Co... | mit | Python | |
ccc7ba3918117a6016c29d0ca8c0014ca7a01cec | Create dell.py | kylehogan/haas,meng-sun/hil,SahilTikale/haas,henn/haas,CCI-MOC/haas,henn/hil,apoorvemohan/haas,apoorvemohan/haas,meng-sun/hil,henn/hil_sahil,kylehogan/hil,SahilTikale/switchHaaS,lokI8/haas,kylehogan/hil,henn/hil,henn/hil_sahil | python-mocutils/mocutils/dell.py | python-mocutils/mocutils/dell.py | #! /usr/bin/python
import os
def make_remove_vlans(vlan_ids,add,switch_ip='192.168.3.245'):
# Expects that you send a string which is a comma separated list of vlan_ids and a bool for adding or removing
for vlan_id in vlan_ids.split(','):
if add:
cmd='''snmpset -v1 -cDell_Network_Manager 1... | apache-2.0 | Python | |
233eb646bca1fca0332dc0d6197bff4a7daeb39b | Add file.py. | foomango/pyex | test/life.py | test/life.py | title = "The Meaning of Life"
| mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.