commit stringlengths 40 40 | subject stringlengths 1 1.49k | old_file stringlengths 4 311 | new_file stringlengths 4 311 | new_contents stringlengths 1 29.8k | old_contents stringlengths 0 9.9k | lang stringclasses 3
values | proba float64 0 1 |
|---|---|---|---|---|---|---|---|
2321603eb706745e20e70d156a3894a7f3ac38eb | Add the Gamerscore and Tier of the account (#12867) | homeassistant/components/sensor/xbox_live.py | homeassistant/components/sensor/xbox_live.py | """
Sensor for Xbox Live account status.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.xbox_live/
"""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor import PLATF... | """
Sensor for Xbox Live account status.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.xbox_live/
"""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor import PLATF... | Python | 0 |
0f5c0168b257436882f837e5d521cce46a740ad6 | Add symbol translator to make utf-8 variables compilable | finat/greek_alphabet.py | finat/greek_alphabet.py | """Translation table from utf-8 to greek variable names, taken from:
https://gist.github.com/piquadrat/765262#file-greek_alphabet-py
"""
def translate_symbol(symbol):
"""Translates utf-8 sub-strings into compilable variable names"""
name = symbol.decode("utf-8")
for k, v in greek_alphabet.iteritems():
... | Python | 0 | |
03951a227bfafb0b1017354bdbf3a1247322fc9b | Fix cycler tests | axelrod/tests/unit/test_cycler.py | axelrod/tests/unit/test_cycler.py | """Test for the Cycler strategies."""
import itertools
import axelrod
from .test_player import TestPlayer, test_four_vector
C, D = 'C', 'D'
class TestAntiCycler(TestPlayer):
name = "AntiCycler"
player = axelrod.AntiCycler
expected_classifier = {
'memory_depth': float('inf'),
'stochastic... | """Test for the Cycler strategies."""
import itertools
import axelrod
from .test_player import TestPlayer, test_four_vector
C, D = 'C', 'D'
class TestAntiCycler(TestPlayer):
name = "AntiCycler"
player = axelrod.AntiCycler
expected_classifier = {
'memory_depth': float('inf'),
'stochastic... | Python | 0 |
ca2269c5ae568cd63253af7bc614a79d26f7f8ac | Add ns_drop_indexes command. | needlestack/management/commands/ns_drop_indexes.py | needlestack/management/commands/ns_drop_indexes.py | # -*- coding: utf-8 -*-
from __future__ import print_function, absolute_import, unicode_literals
from django.core.management.base import BaseCommand, CommandError
from needlestack import commands
class Command(BaseCommand):
help = 'Sync all defined indexes with a current backend'
option_list = BaseCommand.o... | Python | 0 | |
b8a84e612d67f7948d6dec8c202ac8a73390f9dc | make sure all protein ids are unique in a genbank file | proteins/unique_protein_ids.py | proteins/unique_protein_ids.py | """
Test a genbank file and make sure all the protein_ids are unique
"""
import os
import sys
import argparse
from Bio import SeqIO
__author__ = 'Rob Edwards'
__copyright__ = 'Copyright 2020, Rob Edwards'
__credits__ = ['Rob Edwards']
__license__ = 'MIT'
__maintainer__ = 'Rob Edwards'
__email__ = 'raedwards@gmail.com... | Python | 0 | |
61fa404da3eeb3b695b12f398c27f641e1e681e2 | add codegen script for fname.pyf.src -> _fnamemodule.c | tools/generate_f2pymod.py | tools/generate_f2pymod.py | """
Process f2py template files (`filename.pyf.src` -> `filename.pyf`)
Usage: python generate_pyf.py filename.pyf.src -o filename.pyf
"""
import os
import sys
import subprocess
import argparse
from numpy.distutils.from_template import process_file
def main():
parser = argparse.ArgumentParser()
parser.add_a... | Python | 0 | |
0f94251c7cc844042c9e3ce160d78e4d81d895ea | add log module | src/log.py | src/log.py | import logging
import os
from datetime import datetime
class LOG(object):
logger = None
def __init__(self, log_dir):
if log_dir:
if not os.path.exists(log_dir):
os.makedirs(log_dir)
self.logger = logging.getLogger('simple-db-migrate')
now = datetime.... | Python | 0.000002 | |
bc567eda01abcaf23717f5da5f494c1be46f47da | Create ValAnagram_001.py | leetcode/242-Valid-Anagram/ValAnagram_001.py | leetcode/242-Valid-Anagram/ValAnagram_001.py | class Solution:
# @param {string} s
# @param {string} t
# @return {boolean}
def anaRepresentation(self, s):
p = {}
for c in s:
if c in p:
p[c] += 1
else:
p[c] = 1
return p
def isAnagram(self, s, t):
if l... | Python | 0.000002 | |
682d6b3ca9c4a0dd49f9762ddd20ac746971e3eb | Create solution.py | leetcode/easy/find_the_difference/py/solution.py | leetcode/easy/find_the_difference/py/solution.py | class Solution(object):
def findTheDifference(self, s, t):
"""
:type s: str
:type t: str
:rtype: str
"""
import collections
import itertools
c1 = collections.Counter(s)
c2 = collections.Counter(t)
for char in set(itertools... | Python | 0.000018 | |
9e128fdd5af0598a233416de5a1e8f2d3a74fdc0 | Enforce unique paths and names | spaces/migrations/0006_unique_space_document.py | spaces/migrations/0006_unique_space_document.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-15 02:12
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('spaces', '0005_document_space_doc'),
]
operations = [
migrations.AlterField(
... | Python | 0.00002 | |
0256868a3b261e598689eebdf5ac5f939ea20a0d | add test cases for mni module | lib/neuroimaging/reference/tests/test_mni.py | lib/neuroimaging/reference/tests/test_mni.py | import unittest
import numpy as N
import neuroimaging.reference.mni as mni
class MNITest(unittest.TestCase):
def testMNI(self):
""" ensure all elementes of the interface exist """
m = mni.MNI
g = mni.generic
m_v = mni.MNI_voxel
m_w = mni.MNI_world
m_m = mni... | Python | 0 | |
d91adef072e2150edde62a49bea4eecb6a26a6ac | add sns_notify script | sns_notify.py | sns_notify.py | #!/usr/bin/env python
from datetime import datetime, date
from dateutil import parser
from google_sheets import get_service
SHEET_ID = "1lpa9p_dCyTckREf09-oA2C6ZAMACCrgD9W3HQSKeoSI"
def is_valid_period(start, end):
"""
今日が start, end の範囲内かどうかを返す
:params start: 通知開始日の文字列または空文字
:params end: 通知終了日の文... | Python | 0.000003 | |
a0789a4bad7747073257d8976534b33ab9862ec4 | Add unit test for IssueRegister view | feed/tests/test_issueregisterview.py | feed/tests/test_issueregisterview.py | from django.contrib.auth.models import User
from django.test import TestCase
from rest_framework.test import APIRequestFactory
from feed.views import IssueRegisterViewSet
from workflow.models import IssueRegister, Organization, TolaUser
class IssueRegisterViewsTest(TestCase):
def setUp(self):
self.user =... | Python | 0 | |
05e8f84356c63ab953f5c2a3d3d06ee1760008d0 | Add list_queue plugin | flexget/plugins/filter/list_queue.py | flexget/plugins/filter/list_queue.py | import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger('list_queue')
class ListQueue(object):
schema = {
'type': 'array',
'items': {
'allOf': [
{'$ref': '/schema/plugins?group=list'},
{
'ma... | Python | 0.000002 | |
f7a69e24912c3b9ed52201b52c79be4407884c3a | add module util for trying to resolve an ipv6 netmask to cidr. not perfect, but not meant to be either. | library/module_utils/network/f5/ipaddress.py | library/module_utils/network/f5/ipaddress.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2018 F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
def ipv6_netmask_to_cidr(mask):
"""converts an IPv6 netmask to CIDR for... | Python | 0 | |
8922f9430ec2844a3a14621ad0625aa45999c92a | fix args order | lixian_hash.py | lixian_hash.py | #!/usr/bin/env python
import hashlib
import lixian_hash_ed2k
import lixian_hash_bt
import os
def lib_hash_file(h, path):
with open(path, 'rb') as stream:
while True:
bytes = stream.read(1024*1024)
if not bytes:
break
h.update(bytes)
return h.hexdigest()
def sha1_hash_file(path):
return lib_hash_fil... | #!/usr/bin/env python
import hashlib
import lixian_hash_ed2k
import lixian_hash_bt
import os
def lib_hash_file(h, path):
with open(path, 'rb') as stream:
while True:
bytes = stream.read(1024*1024)
if not bytes:
break
h.update(bytes)
return h.hexdigest()
def sha1_hash_file(path):
return lib_hash_fil... | Python | 0.999403 |
0814bbf6867a4bdd9d92c63e467f237b6129ee28 | add solution for palindrome number | leetcode/palindrome-number/sol.py | leetcode/palindrome-number/sol.py | #!/usr/bin/env python
class Solution:
# @return a boolean
def isPalindrome(self, x):
if x == -1:
return True
def ll(x):
return 0 if x == 0 or x == -1 else ll(x/10)+1
p = x >= 0
l = ll(x)
print "x is %d l is %d" % (x, l)
t = x
... | Python | 0.999935 | |
d2a92c5d628f426c26374dea6cb37bd35ba18812 | print variables | bin/basenji_variables.py | bin/basenji_variables.py | #!/usr/bin/env python
# Copyright 2017 Calico LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python | 0.000103 | |
517a326b2869190bb1c0a676f467e1529e119259 | Create enigma.py | enigma.py | enigma.py | from EnigmaMachine import Plugboard
from EnigmaMachine import Rotor
from EnigmaMachine import Reflector
from EnigmaMachine import Machine
import ConfigParser
def configureRotor(n):
# Opens the Rotor configurations file.
config_file = ConfigParser.RawConfigParser()
config_file.read('Config/rotor_config.cfg')
# Pr... | Python | 0.018018 | |
0598e61d9bcef2217f22cce2deeec08ed6868575 | Add rmd.py | scripts/rmd.py | scripts/rmd.py | #!/usr/bin/env python
import argparse
import sys
import logging
import os
import os.path as pt
import shutil
class App(object):
def run(self, args):
name = pt.basename(args[0])
parser = self.create_parser(name)
opts = parser.parse_args(args[1:])
return self.main(name, opts)
... | Python | 0.000002 | |
30a8e40efee241dd6aa3b534814655b9f70cfffe | Add 020-valid-parentheses.py, but missed case "([])", the description is confused | 020-valid-parentheses.py | 020-valid-parentheses.py | """
Question:
Valid Parentheses My Submissions Question Solution
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
The brackets must close in the correct order, "()" and "()[]{}" are all valid but "(]" and "([)]" are not.
Performance:
... | Python | 0.998825 | |
8249d33898500d9d39e8bee3d44d39c2a6034659 | Add script to create overlays | scripts/create_overlays.py | scripts/create_overlays.py | """Varcan smart tool."""
import click
from dtoolcore import DataSet
@click.command()
@click.argument('dataset_uri')
@click.option('--config-path', type=click.Path(exists=True))
def main(dataset_uri, config_path=None):
dataset = DataSet.from_uri(dataset_uri, config_path=config_path)
def name_from_identifie... | Python | 0.000001 | |
5510f90565809471e545584419b22980b63a1864 | Add metadata | bids_writer/_metadata.py | bids_writer/_metadata.py | # -*- coding: utf-8 -*-
version = "0.1.0"
author = "Nathan Vack"
author_email = "njvack@wisc.edu"
license = "MIT"
copyright = "Copyright 2015 Boards of Regent of the University of Wisconsin System"
url = "https://github.com/njvack/bids-json-writer"
| Python | 0.000044 | |
65f574973bbde545c1c815d0ad21e4a8d3f3b59d | Add initial cbio client | bioagents/cbio_client.py | bioagents/cbio_client.py | import os
import json
import logging
import requests
from collections import defaultdict
logger = logging.getLogger(__name__)
base_url = 'https://www.cbioportal.org/api'
resources_dir = os.path.join(os.path.dirname(
os.path.abspath(__file__)), os.pardir, 'resources')
patient_list_cache = os.path.join(resources... | Python | 0 | |
b38b9e62c174ff55d496bec2fb6599bee8262a3c | Add plot_compare_methods from scikit-learn | manifold/plot_compare_methods.py | manifold/plot_compare_methods.py | # Author: Jake Vanderplas -- <vanderplas@astro.washington.edu>
# print(__doc__)
from time import time
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.ticker import NullFormatter
from sklearn import manifold, datasets
def compare():
# Next line to silence pyflakes. This ... | Python | 0.000001 | |
bf60d3c48a30863571a8700fa5a843be48e7646b | add vat_reckoner | components/vat_reckoner/vat_reckoner.py | components/vat_reckoner/vat_reckoner.py | #! /usr/bin/env python
from json import loads, dumps
from pika import BlockingConnection, ConnectionParameters
RABBIT_MQ_HOST = '54.76.183.35'
RABBIT_MQ_PORT = 5672
def vat(ch, method, properties, body):
product = loads(body)
sku, price = product['sku'], product['price']
vat = price * 0.20
vat_fact =... | Python | 0.000284 | |
77d90ec03eff1946a422e5471cc1a64708eff0f4 | Test dramatis personae | shakespearelang/tests/unit/test_dramatis_personae.py | shakespearelang/tests/unit/test_dramatis_personae.py | from shakespearelang import Shakespeare
from shakespearelang.errors import ShakespeareRuntimeError
import pytest
MANY_CHARACTERS_PLAY = """
A lot of people.
Achilles, a test.
Christopher Sly, a test.
Demetrius, a test.
John of Lancaster, a test.
Juliet, a test.
Mistress Overdone, a test.
Romeo, a test.
Stephano, a te... | Python | 0.000007 | |
0ba11dd47dac04f3f7a314cf320558ccbc9eb148 | Add test for water polygon name dropping. | integration-test/1477-water-layer-too-big.py | integration-test/1477-water-layer-too-big.py | # -*- encoding: utf-8 -*-
from . import FixtureTest
class WaterLayerTooBigTest(FixtureTest):
def test_drop_label(self):
from tilequeue.tile import calc_meters_per_pixel_area
from shapely.ops import transform
from tilequeue.tile import reproject_mercator_to_lnglat
import math
... | Python | 0 | |
a3e538830305d8a6651c5ed46e2dfdffe41c28e6 | Add a module for ssh 'console' API | confluent_server/confluent/plugins/shell/ssh.py | confluent_server/confluent/plugins/shell/ssh.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2015 Lenovo
#
# 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 ... | Python | 0.000043 | |
865dc29421c1e9ef4bf340bf32164863cc5f2006 | Add management command to list installed spiders | app/raw/management/commands/list_spiders.py | app/raw/management/commands/list_spiders.py | from django.core.management import BaseCommand
from raw.utils import list_spiders
class Command(BaseCommand):
help = 'List installed spiders'
def handle(self, *args, **options):
for spider in list_spiders():
print spider
| Python | 0 | |
77966f7f993e526467b2e54e0d12241354efec16 | add spec for re2 | build/fbcode_builder/specs/re2.py | build/fbcode_builder/specs/re2.py | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
def fbcode_builder_spec(builder):
return {
'steps': [
builder.github_project_workdir('google/re2', 'build'),
bu... | Python | 0 | |
15388e09ab537d3731891353c54f53105c4a7ee4 | add files | weixin_pay.py | weixin_pay.py | #!/usr/bin/env python
# coding=utf-8
__author__ = 'youqingkui'
| Python | 0.000002 | |
b7360d6ba397f8654f4e051227aa86a1ebe693f7 | Add main program | follow.py | follow.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from github import Github
# usage
def usage():
print 'Follow GitHub user\'s starred, watching and following.'
print
print 'Usage: python follow.py <token> <user>'
print
print 'token: Go to https://github.com/settings/tokens and `Generate n... | Python | 0.000002 | |
9080d20bd61ac66a534c834a17a9825808416512 | Add pre-stage hook for FrostNumberModel | metadata/FrostNumberModel/hooks/pre-stage.py | metadata/FrostNumberModel/hooks/pre-stage.py | """A hook for modifying parameter values read from the WMT client."""
import os
import shutil
from wmt.utils.hook import find_simulation_input_file
from topoflow_utils.hook import assign_parameters
file_list = []
def execute(env):
"""Perform pre-stage tasks for running a component.
Parameters
-------... | Python | 0 | |
70849edc52acc1c559b35a55c7f1925c1cbf57ad | add new tagcount plugin for yawt rewrite | yawtext/tagcount.py | yawtext/tagcount.py | from flask import current_app, g, Blueprint
import jsonpickle
from yawt.utils import save_file, load_file
import os
tagcountsbp = Blueprint('tagcounts', __name__)
@tagcountsbp.app_context_processor
def tagcounts():
tagcountfile = current_app.config['YAWT_TAGCOUNT_FILE']
tvars = {}
if os.path.isfile(tagcou... | Python | 0 | |
d19aaf0fd3c88c08b2b8563030dd38c0cea3631b | Add unit test for `parse_cluster_info` (#22205) | dashboard/modules/job/tests/test_sdk.py | dashboard/modules/job/tests/test_sdk.py | import pytest
from typing import Dict, Optional, Tuple
from unittest.mock import Mock, patch
from ray.dashboard.modules.job.sdk import parse_cluster_info
@pytest.mark.parametrize(
"address_param",
[
("ray://1.2.3.4:10001", "ray", "1.2.3.4:10001"),
("other_module://", "other_module", ""),
... | Python | 0 | |
c47966819a2bd8450ee731533c50f9c8d92b86a2 | Create smtp_sender.py | smtp_sender.py | smtp_sender.py | #!/usr/bin/env python
'''SMTP sender'''
from __future__ import print_function
from optparse import OptionParser
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email import utils
import smtplib
import os
import sys
import mimetypes
# shut... | Python | 0.000026 | |
4d570475d22cc85dd55c4b68bd7321cec7be8e7e | Add bytecode patcher to change the snooper URL and interval (see wiki.vg/Session#Snoop) | snoop_patch.py | snoop_patch.py | from os import chdir
from tempfile import mkdtemp
from shutil import rmtree
from struct import pack
from subprocess import check_output
def jar_contents(j_path):
return check_output(['jar', 'tf', j_path]).split("\n")
def jar_extract(j_path):
return check_output(['jar', 'xf', j_path])
def ja... | Python | 0 | |
3c685922756a582030980f319014ba308735ee2c | add nextlaunch command | src/tenyksscripts/scripts/rockets.py | src/tenyksscripts/scripts/rockets.py | import datetime
import requests
import time
def run(data, settings):
if data["payload"] != "nextlaunch":
return
launches = requests.get("https://launchlibrary.net/1.2/launch", params={"next": 1, "mode": "verbose"}).json()
if not launches["count"]:
return "No launches scheduled"
launc... | Python | 0.000001 | |
ba3e2a81a5e89c010473820732835d8bf7ccc39a | Create morningstar.py | morningstar.py | morningstar.py | import os
import sys
import threading
import thread
import time
import settings
import subprocess
import psutil
class watchman(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self):
badwinprocs = ['taskmgr', 'regedit', 'mbam', 'cmd', 'command']
if 'lucifer' in sys.argv[0]:
exe... | Python | 0.000007 | |
7d546ca0ce8e2e8ef4f71abda50764817ce83c0b | add mouse_click.py | mouse_click.py | mouse_click.py | from pymouse import PyMouse
from time import sleep
m = PyMouse()
sleep(5)
x=969
y=581
a = 1
while a == 1:
m.click(x,y)#移動到(x,y)並且點擊
sleep(0.1)
p = m.position() #獲取目前位置
if not 900<p[0]<1000: #x座標不在 900~1000內 離開迴圈
break | Python | 0.000006 | |
92d3667471c3e1bfc91c2c925ef7cd33eed477e4 | Add run up problem | proteus/SWFlows/tests/run_up_problem/SWFlow.py | proteus/SWFlows/tests/run_up_problem/SWFlow.py | from __future__ import division
from builtins import object
from past.utils import old_div
from proteus import *
from proteus.default_p import *
from proteus.mprans import SW2D
from proteus.mprans import SW2DCV
from proteus.Domain import RectangularDomain
import numpy as np
from proteus import (Domain, Context,
... | Python | 0.000029 | |
9ef3260ba5d27a3274fa6d3112e36091f04989f9 | add file | resource-4/permutations/permutationToInteger.py | resource-4/permutations/permutationToInteger.py | def permutationToInteger(perm):
permLen = len(perm)
elts = range(permLen)
num = 0
for i in range(permLen):
digit = elts.index(perm[i])
num += digit * math.factorial(permLen - i - 1)
del elts(digit)
return num
| Python | 0.000001 | |
6f36d99229bfc33783511c7efb2f90fb50dda570 | Add importing for rhino pre.rhino | sectionproperties/pre/rhino.py | sectionproperties/pre/rhino.py | import pathlib
from typing import List, Union
from shapely.geometry.polygon import Polygon
from rhino_shapely_interop.importers import RhImporter
def load_3dm(r3dm_filepath: Union[pathlib.Path, str], **kwargs) -> List[Polygon]:
"""Load a Rhino `.3dm` file and import the single surface planer breps.
:param r3d... | Python | 0 | |
dafa0060460a2d4e820fbdafd33e51363bac0259 | Create 01.Mean.py | 01.Python/01.Mean.py | 01.Python/01.Mean.py | import numpy as np
A = np.array([[10,14,11,7,9.5,15,19],[8,9,17,14.5,12,18,15.5],
[15,7.5,11.5,10,10.5,7,11],[11.5,11,9,12,14,12,7.5]])
B = A.T
print B
print(np.mean(B))
print(np.mean(B,axis=0))
print(np.mean(A,axis=1))
| Python | 0 | |
9570da3427121628d4e144c1092da155583a496d | Add Python benchmark | lib/node_modules/@stdlib/math/base/special/asinh/benchmark/python/benchmark.py | lib/node_modules/@stdlib/math/base/special/asinh/benchmark/python/benchmark.py | #!/usr/bin/env python
"""Benchmark asinh."""
import timeit
name = "asinh"
repeats = 3
iterations = 1000000
def print_version():
"""Print the TAP version."""
print("TAP version 13")
def print_summary(total, passing):
"""Print the benchmark summary.
# Arguments
* `total`: total number of test... | Python | 0.000138 | |
d1ba1a02385581375831fd4b394f68ade4cbb101 | Create RX_TX.py | home/hairygael/RX_TX.py | home/hairygael/RX_TX.py | arduino = Runtime.createAndStart("arduino","Arduino")
arduino.setBoardMega()
arduino.connect("COM7")
arduino1 = Runtime.createAndStart("arduino1","Arduino")
arduino1.setBoardAtmega328()
#connecting arduino1 to arduino Serial1 instead to a COMX
arduino1.connect(arduino,"Serial1")
servo = Runtime.createAndStart("servo... | Python | 0.000295 | |
c760c3387b6dcf5bd171960a3e64306c7f2519d0 | add a rotating colored triangle | pynodegl-utils/pynodegl_utils/examples/misc.py | pynodegl-utils/pynodegl_utils/examples/misc.py | import math
from pynodegl import Texture, Shader, TexturedShape, Rotate, AnimKeyFrameScalar, Triangle
from pynodegl_utils.misc import scene
@scene()
def triangle(cfg):
frag_data = '''
#version 100
precision mediump float;
varying vec2 var_tex0_coords;
void main(void)
{
vec2 c = var_tex0_coords;
gl_FragCo... | Python | 0.000003 | |
3e9fc08e096ddb212cf40a285887b7ed5dd8897b | Fix running coverage for nose tests (PY-14869) | python/helpers/coverage_runner/run_coverage.py | python/helpers/coverage_runner/run_coverage.py | """Coverage.py's main entrypoint."""
import os
import sys
bundled_coverage_path = os.getenv('BUNDLED_COVERAGE_PATH')
if bundled_coverage_path:
sys_path_backup = sys.path
sys.path = [p for p in sys.path if p != bundled_coverage_path]
from coverage.cmdline import main
sys.path = sys_path_backup
else:
... | """Coverage.py's main entrypoint."""
import os
import sys
bundled_coverage_path = os.getenv('BUNDLED_COVERAGE_PATH')
if bundled_coverage_path:
sys_path_backup = sys.path
sys.path = [p for p in sys.path if p != bundled_coverage_path]
from coverage.cmdline import main
sys.path = sys_path_backup
else:
... | Python | 0 |
fd5ba7ad61a8c7c9aad6b3f1404d819ae21085d1 | Add 'calc_pb_flux.py' to calculate the particle background | bin/calc_pb_flux.py | bin/calc_pb_flux.py | #!/usr/bin/env python3
#
# Copyright (c) 2017 Weitian LI <liweitianux@live.com>
# MIT license
"""
Calculate the particle background flux (e.g., 9.5-12.0 keV) of the spectra.
flux = counts / exposure / area
where 'counts' is the total photon counts within the specified energy range;
'area' is the value of the ``BACKSC... | Python | 0.000024 | |
d03e19c2bbd16e31bbf5a8f893a3ecaa16283b45 | Add tests for soc.modules.gsoc.logic.duplicates. | tests/app/soc/modules/gsoc/logic/test_duplicates.py | tests/app/soc/modules/gsoc/logic/test_duplicates.py | #!/usr/bin/env python2.5
#
# Copyright 2011 the Melange 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 applic... | Python | 0 | |
6fb6e67792085b6ee910f1d0b8ed3e89f15dd60d | add script to datamine the reports via nltk | smelly_london/all_reports_smell_search_final.py | smelly_london/all_reports_smell_search_final.py |
from map import mapping
# walk through the os and get all files
# read each file in tern and go through line by line
# print lines that contain smell and the report name
from os import listdir
import nltk.data
import json
SMELL_WORDS = ['smell', 'stench', 'stink', 'odour', 'sniff', 'effluvium']
REPORTS_DIR = '/Users/... | Python | 0 | |
5b31e63043e3c3652f751d4a85e6bcdf925f797e | Create q3.py | work/q3.py | work/q3.py | def fibonacci_number(n, m, count):
if count <= 10:
print(n, end=" ")
return fibonacci_number(m, n + m, count + 1)
fibonacci_number(0, 1, 0)
| Python | 0.000019 | |
9e546d3c2e2f77f9345947da5c12bc65b936e576 | Add attention layer | models/attention/decoders/attention_layer.py | models/attention/decoders/attention_layer.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from collections import namedtuple
import tensorflow as tf
# template
AttentionDecoderOutput = namedtuple(
"DecoderOutput",
"logits predicted_ids cell_output attention_scores attention_context")
class AttentionLayer(object):
"""Attention layer. This impleme... | Python | 0.000001 | |
0383796cb681404e6c4794f1321ad62a9945b572 | add script to output all leagues of users | checkLeagues.py | checkLeagues.py | import settings as settings
import funcs
accountMaps = funcs.readAccountsFile("accounts.txt")
def getLeagueForAccountMap(accountMap):
league = funcs.getLeague(settings.regions[accountMap['region']], accountMap['bnet'])
return (accountMap['redditName'], league)
newLeagues = map(getLeagueForAccountMap, accountMaps... | Python | 0 | |
c20cde04d1a5a2939e7f5c0953725fd043c5b849 | add media migration | molo/core/migrations/0067_media_migration.py | molo/core/migrations/0067_media_migration.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
def convert_media_to_molo_media(apps, schema_editor):
from molo.core.models import MoloMedia, ArticlePage
from wagtailmedia.models import Media
for media in Media.objects.all():
new_media = M... | Python | 0.000001 | |
77b6c86359376af5eb8de63ae89d9316776b26bc | Add missing migration | tracpro/polls/migrations/0034_auto_20170323_1315.py | tracpro/polls/migrations/0034_auto_20170323_1315.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('polls', '0033_auto_20170307_1338'),
]
operations = [
migrations.AlterField(
model_name='pollrun',
na... | Python | 0.000008 | |
255c7ff91bc4918ce13d32cba2b871e3d0befad8 | revert that url change | polio/urls.py | polio/urls.py | from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^$', 'polio.views.home', name='home'),
url(r'^datapoints/', include('datapoints.app_urls.urls', namespace="datapoints")),
url(r'^datapoints/indicators... | from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
url(r'^$', 'polio.views.home', name='home'),
url(r'^uf04/datapoints/', include('datapoints.app_urls.urls', namespace="datapoints")),
url(r'^uf04/datapoints/... | Python | 0.000005 |
5f12ada7fe0ddb44274e18decbaea0d05ab4471f | Solve Code Fights lineup problem | CodeFights/lineUp.py | CodeFights/lineUp.py | #!/usr/local/bin/python
# Code Fights Lineup Problem
def lineUp(commands):
aligned, tmp = 0, 0
com_dict = {"L": 1, "A": 0, "R": -1}
for c in commands:
tmp += com_dict[c]
if tmp % 2 == 0:
aligned += 1
return aligned
def main():
tests = [
["LLARL", 3],
[... | Python | 0.0007 | |
8deb0dc2743d1d85899cb636b88ed831c05838a9 | Make machine action button translatable | DiscoverUM3Action.py | DiscoverUM3Action.py | from cura.MachineAction import MachineAction
from UM.Application import Application
from PyQt5.QtCore import pyqtSignal, pyqtProperty, pyqtSlot
from UM.i18n import i18nCatalog
catalog = i18nCatalog("cura")
class DiscoverUM3Action(MachineAction):
def __init__(self):
super().__init__("DiscoverUM3Action", ... | from cura.MachineAction import MachineAction
from UM.Application import Application
from PyQt5.QtCore import pyqtSignal, pyqtProperty, pyqtSlot
class DiscoverUM3Action(MachineAction):
def __init__(self):
super().__init__("DiscoverUM3Action", "Discover printers")
self._qml_url = "DiscoverUM3Action... | Python | 0.000016 |
c486b8df5861fd883b49ea8118d40d73f5b4e7b8 | Add download apikey test case | tardis/tardis_portal/tests/test_download_apikey.py | tardis/tardis_portal/tests/test_download_apikey.py | # -*- coding: utf-8 -*-
from django.core.urlresolvers import reverse
from django.test import TestCase
from tastypie.test import ResourceTestCase
from django.test.client import Client
from django.conf import settings
from django.contrib.auth.models import User
class ApiKeyDownloadTestCase(ResourceTestCase):
def ... | Python | 0 | |
601636b75595031ef9478297f9a52132a9bff9eb | Add herwig3 (#19406) | var/spack/repos/builtin/packages/herwig3/package.py | var/spack/repos/builtin/packages/herwig3/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import shutil
class Herwig3(AutotoolsPackage):
"""Herwig is a multi-purpose particle physics eve... | Python | 0 | |
af67d052fc78e56ac7f934f4c90f00d2eb097bb3 | Add StarFinder tests | photutils/detection/tests/test_starfinder.py | photutils/detection/tests/test_starfinder.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for StarFinder.
"""
from astropy.modeling.models import Gaussian2D
from astropy.tests.helper import catch_warnings
import numpy as np
import pytest
from ..starfinder import StarFinder
from ...datasets import make_100gaussians_image
from ...util... | Python | 0 | |
72203e529f083cbc9427b02348cc178e4443031c | Add new package: libuser (#18916) | var/spack/repos/builtin/packages/libuser/package.py | var/spack/repos/builtin/packages/libuser/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Libuser(AutotoolsPackage):
"""A user and group account administration library."""
hom... | Python | 0 | |
bef4f7e01e048280680287ed3ac27ec3b2464859 | Add thin setup.py | thin.setup.py | thin.setup.py | #!/usr/bin/env python
'''
The setup script for salt
'''
# For Python 2.5. A no-op on 2.6 and above.
from __future__ import with_statement
import os
import sys
from distutils.cmd import Command
from distutils.command.clean import clean
from distutils.sysconfig import get_python_lib, PREFIX
from distutils.core import ... | Python | 0.000001 | |
ac09970129df9c5292344287b04a1be143fac681 | add diag openmp | tests/examples/openmp/diagnostics.py | tests/examples/openmp/diagnostics.py | # coding: utf-8
import numpy as np
from matplotlib import pyplot as plt
def matrix_product():
procs = [1, 4, 8, 16, 28]
times = [1194.849, 305.231, 69.174,37.145, 22.731]
n_groups = len(procs)
# ...
fig, ax = plt.subplots()
index = np.arange(n_groups)
bar_width = 0.2
opacity = 0.4
... | Python | 0.000146 | |
3da13d9597b49a7d929dd84806d1c10b99cf8bea | Create yadisk.py | cogs/utils/api/yadisk.py | cogs/utils/api/yadisk.py | import json
import requests
__version__ = '0.1.2-dev'
USER_AGENT = 'pycopy/{}'.format(__version__)
BASE_URL = 'https://api.copy.com'
AUTH_URL = BASE_URL + '/auth_user' # TODO: should use /rest
OBJECTS_URL = BASE_URL + '/list_objects' # TODO: should use /rest
DOWNLOAD_URL = BASE_URL + '/download_object' # TODO: sho... | Python | 0.000002 | |
52b4faf9ea670cf6c73fffa2e5f6430f57c79a74 | Create GDAL_NDVIoriginal.py | GDAL_NDVIoriginal.py | GDAL_NDVIoriginal.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 3 11:56:48 2011
The main program. The program takes 3 files as input:
#. The red band (any GDAL-compatible format will do)
#. the near-infrarred band (again as above)
#. An output file name
dditionally, one can specify the output forma... | Python | 0 | |
65f6f78008d4f961c9ebe5d8047b0f2c742fe15f | Add unittest for QInputDialog.getXXX() methods | tests/qtgui/qinputdialog_get_test.py | tests/qtgui/qinputdialog_get_test.py | import unittest
from PySide import QtCore, QtGui
from helper import UsesQApplication, TimedQApplication
class TestInputDialog(TimedQApplication):
def testGetDouble(self):
QtGui.QInputDialog.getDouble(None, "title", "label")
def testGetInt(self):
QtGui.QInputDialog.getInt(None, "title", "labe... | Python | 0 | |
52189e2161e92b36df47a04c2150dff38f81f5e9 | Add mocked tests for activation | tests/unit/tests/test_activations.py | tests/unit/tests/test_activations.py | from unittest import mock
from django.test import TestCase
from viewflow import activation, flow
from viewflow.models import Task
class TestActivations(TestCase):
def test_start_activation_lifecycle(self):
flow_task_mock = mock.Mock(spec=flow.Start())
act = activation.StartActivation()
a... | Python | 0 | |
e0df929e07e30c514b2b39f515bfd3102d1ebfe7 | Add annotate experiment | Source/Git/Experiments/git_annotate.py | Source/Git/Experiments/git_annotate.py | #!/usr/bin/python3
import sys
import git
r = git.Repo( sys.argv[1] )
num = 0
for info in r.blame( 'HEAD', sys.argv[2] ):
num += 1
commit = info[0]
all_lines = info[1]
print( '%s %6d:%s' % (commit, num, all_lines[0]) )
for line in all_lines[1:]:
num += 1
print( '%*s %6d:%s' % (4... | Python | 0.000007 | |
51d581c7bca0fcacf8604b898f96394847865e15 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/e1e64a45b138980a6d8c125bacc81f22142d2b53. | 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 = "e1e64a45b138980a6d8c125bacc81f22142d2b53"
TFRT_SHA256 = "5afd4500e88c75188e29e6827343... | """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 = "0dcdcc3f57a96bc354e66f3805dff4f619e2b93f"
TFRT_SHA256 = "940edcaf656cbbfee314689fd7e5... | Python | 0.000001 |
5dd31aa3cfacb6bd157d50ac3d310b8064a46b80 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/5f6e52142a3592d0cfa058dbfd140cad49ed451a. | 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 = "5f6e52142a3592d0cfa058dbfd140cad49ed451a"
TFRT_SHA256 = "8e1efbd7df0fdeb5186b178d7c8b... | """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 = "736eeebfb56c6d0de138f4a29286140d8c26d927"
TFRT_SHA256 = "b584ee5ce5ecaadf289b0997987d... | Python | 0 |
0c13207eeda65754532bab5888cc33693fb06834 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/b87ea071c60db54775b92da8e0eed8477ab96a6a. | 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")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "b87ea071c60db54775b92da8e0eed8477ab96a6a"
TFRT_SHA256 = "61b8951d9236a82c54be8db871cd427013ec24ae17b0e6... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "75318fbce7817886508abd18dd5ea3b35d552372"
TFRT_SHA256 = "233d123e6287e105acb2b464db68b753624dfe5c27f299... | Python | 0.000003 |
1eb980caefcbaaa4b29f7c3d92f27e490003e208 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/9562f24de39c95b4a076f7e0a0eb79cb980a9c72. | 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")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "9562f24de39c95b4a076f7e0a0eb79cb980a9c72"
TFRT_SHA256 = "6fda4b556e5100e83ba292b8907c82f152740bb9eb157d... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "de22adc4126843c3cf142e0a829d153dc94cdd73"
TFRT_SHA256 = "e345d2ae1d385ebaf41531c831bb1025cab260fe20daa5... | Python | 0.000006 |
a73671995e1c5b920f5f93226c7bf3e7501a7448 | Add test for GoogLeNet | tests/test_googlenet.py | tests/test_googlenet.py | import unittest
import numpy
from chainer import cuda
from chainer import testing
from chainer.testing import attr
from chainer.variable import Variable
from .. import googlenet
@unittest.skipUnless(googlenet.available, 'Pillow is required')
@attr.slow
class TestGoogLeNet(unittest.TestCase):
def setUp(self):
... | Python | 0 | |
fd01a25c0f5cb9ba75b2a659d47d1d3902242c5e | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/c3e082762b7664bbc7ffd2c39e86464928e27c0c. | 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 = "c3e082762b7664bbc7ffd2c39e86464928e27c0c"
TFRT_SHA256 = "9b7fabe6e786e6437bb7cd1a4bed... | """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 = "5a604f55b0d725eb537fd1a7cb6a88fcc6fd9b73"
TFRT_SHA256 = "004f312a2c65165e301b101add21... | Python | 0.000003 |
06cfa4c7055ec997dcb3aec11732ee1be5330b75 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/285e48bc47db23a479637fd1e2767b9a35dc2c9b. | 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")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "285e48bc47db23a479637fd1e2767b9a35dc2c9b"
TFRT_SHA256 = "6f0067d0cb7bb407caeef060603b6e33f1231cddf1ce4c... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "962d1c7a123f01ccdb39e0d1959794f432b0ffeb"
TFRT_SHA256 = "ce0f2f86d19850e8951514b0e3f76950d07a8dc79d053d... | Python | 0.000004 |
27cb9279670bd513a1559f4865500d84869bb9f0 | Test module for Predictor class. | tests/test_predictor.py | tests/test_predictor.py | #! /usr/env/bin python
import numpy as np
from pyboas import predictor, models
# Build random 3-parameter normal posterior.
posterior = np.random.randn(100, 3)
def toy_model(param, time):
time = np.atleast_1d(time)[:, np.newaxis]
a = param[:, 0]
b = param[:, 1]
c = param[:, 2]
return a*time**2... | Python | 0 | |
0b443cab974a0d0ce58a2cb4fdd68c7992377eb8 | add chisquare test comparing random sample with cdf (first try of commit) | scipy/stats/tests/test_discrete_chisquare.py | scipy/stats/tests/test_discrete_chisquare.py |
import numpy as np
from scipy import stats
debug = False
def check_discrete_chisquare(distname, arg, alpha = 0.01):
'''perform chisquare test for random sample of a discrete distribution
Parameters
----------
distname : string
name of distribution function
arg : sequence
... | Python | 0 | |
7ac3540c2b49bcfd933fe1167f92a9b3c0cdf438 | Add a stub for matching boss catalogue. | py/legacyproduct/bin/match-boss-catalogue.py | py/legacyproduct/bin/match-boss-catalogue.py | #!/usr/bin/env python
from __future__ import print_function, division
import numpy as np
from legacyproduct.internal import sharedmem
import argparse
import os, sys
from time import time
from scipy.spatial import cKDTree as KDTree
import fitsio
def main():
ns = parse_args()
bricks = list_bricks(ns)
... | Python | 0 | |
34d5b5cdc058f1c9055b82151b518251fa3b4f74 | Add tool to create combined smart contract files | tools/join-contracts.py | tools/join-contracts.py | import os
import click
import re
from click.types import File
IMPORT_RE = re.compile(r'^import +["\'](?P<contract>[^"\']+.sol)["\'];$')
"""
Utility to join solidity contracts into a single output file by recursively
resolving imports.
example usage:
$ cd raiden/smart_contracts
$ python ../../tools/join-contracts.p... | Python | 0 | |
e06416a61826229ebd0cccdc519b6dc39d8a0fd9 | Add migration to remove models. | server/migrations/0088_auto_20190304_1313.py | server/migrations/0088_auto_20190304_1313.py | # Generated by Django 2.1.4 on 2019-03-04 18:13
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('server', '0087_auto_20190301_1424'),
]
operations = [
migrations.AlterUniqueTogether(
name='installedupdate',
unique_togethe... | Python | 0 | |
722c823f8af13d53d5068f1581614f09a042f8d9 | Create techpaisascrap.py | techpaisascrap.py | techpaisascrap.py | import urllib
import re
import msvcrt as m
import json
import datetime as DT
import numpy as np
import csv
import matplotlib.pyplot as plt
from matplotlib.dates import date2num
import operator
def getColumn(filename, column):
results = csv.reader(open(filename))
return [result[column] for result in results]
t... | Python | 0.000001 | |
04a4d7887664753f87d6ccd0921c87160d8ced26 | Create 002_gen.py | 002/002_gen.py | 002/002_gen.py | #!/usr/bin/env python
def fibonatti(n_max=4000000):
f1, f2 = 1, 1
while f2 <= n_max:
yield f2
f2 += f1
f1 = f2 - f1
answer = sum(f for f in fibonatti() if f % 2 == 0)
print(answer)
| Python | 0.000005 | |
92f88fb9021094f1429f5175d01a354c4ad35880 | add initial gyp to build freetype lib (problems with cflags not showing up in xcode) | gyp/freetype.gyp | gyp/freetype.gyp | {
# 'includes': [
# 'common.gypi',
# ],
'targets': [
{
'target_name': 'skfreetype',
'type': 'static_library',
'sources': [
'../third_party/freetype/src/base/ftbbox.c',
'../third_party/freetype/src/base/ftbitmap.c',
'../third_party/freetype/src/base/ftglyph.c',
... | Python | 0.000002 | |
e8efe8de59b32e7b78fcf801dccce36e7ec53768 | implement regular Kmeans | models/Kmeans_2.py | models/Kmeans_2.py | # -*- coding: utf-8 -*-
# My Model
from utils.ops import ops
import tensorflow as tf
import numpy as np
from sklearn.datasets import make_blobs
#############################################
# Deep Adaptive Separator Model #
#############################################
class KMeans:
def __init__(self,... | Python | 0.000102 | |
66137a8710bf3b778c860af8d6278ee0c97bbab4 | Add script to delete unused users on JupyterHub | scripts/delete-unused-users.py | scripts/delete-unused-users.py | #!/usr/bin/env python3
"""
Delete unused users from a JupyterHub.
JupyterHub performance sometimes scales with *total* number
of users, rather than running number of users. While that should
be fixed, we can work around it by deleting unused users once in
a while. This script will delete anyone who hasn't registered
a... | Python | 0 | |
ad6aa623bbd8f316ab7fb8c389d1c9c74b17ae8c | add util module for converting an update job into xml | rpath_repeater/utils/update_job_formatter.py | rpath_repeater/utils/update_job_formatter.py | #!/usr/bin/python
#
# Copyright (c) 2012 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.rp... | Python | 0 | |
7b14028f3796981974b6d01b98277326123c0395 | add get_flatpage template tag | core/templatetags/get_flatpage.py | core/templatetags/get_flatpage.py | from django import template
from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings
from django.contrib.flatpages.models import FlatPage
from django.contrib.sites.models import get_current_site
register = template.Library()
class FlatpageNode(template.Node):
def __init__(self, con... | Python | 0 | |
b8a07ce36cfeb2679ace05b26d6adc1e525d6044 | Add feature computation module | husc/features.py | husc/features.py | import functools as fun
import numpy as np
from scipy.stats.mstats import mquantiles
from scipy import ndimage as nd
from skimage import feature, color, io as imio, img_as_float, \
morphology as skmorph
from skimage import filter as imfilter, measure
def lab_hist(rgb_image, **kwargs):
return np.histogram(col... | Python | 0.000001 | |
f16a7e43ce4d9dc82fd4bfca34d80f0447bd57db | add isStaffOrReadOnly permissions | treeherder/webapp/api/permissions.py | treeherder/webapp/api/permissions.py | from rest_framework.permissions import BasePermission
from rest_framework.permissions import SAFE_METHODS
class IsStaffOrReadOnly(BasePermission):
"""
The request is authenticated as an admin staff (eg. sheriffs), or is a read-only request.
"""
def has_permission(self, request, view):
return ... | Python | 0.00003 | |
5a77678a44ec9838e943b514a586dbd96b8bdfdc | Add migration for license change | modelview/migrations/0042_auto_20171215_0953.py | modelview/migrations/0042_auto_20171215_0953.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-12-15 08:53
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('modelview', '0041_merge_20171211_1420'),
]
operations = [
migrations.AlterF... | Python | 0 | |
5522285af9179441e56f65405037bb3a4c1c1274 | Revert "Important fixes" | soccer/gameplay/plays/testing/triangle_pass.py | soccer/gameplay/plays/testing/triangle_pass.py | import robocup
import play
import behavior
import skills.move
import skills.capture
import tactics.coordinated_pass
import constants
import main
import enum
## A demo play written during a teaching session to demonstrate play-writing
# Three robots form a triangle on the field and pass the ball A->B->C->A and so on.
... | Python | 0 | |
0a4c100f9fb6e7540320fb7c55aeebdffe91c6d1 | add primenumber.py | primenumber.py | primenumber.py | lower = int(input("Enter lower range: "))
upper = int(input("Enter upper range: "))
for num in range(lower,upper + 1):
if num > 1:
for i in range(2,num):
if (num % i) == 0:
break
else:
print(num)
| Python | 0.998844 | |
64ced324f05de20f839782913cfb13d147d49dd6 | create a scheduler example file to test on live | code-samples/web_scraper/jared/scheduling_script.py | code-samples/web_scraper/jared/scheduling_script.py | from time import sleep
from apscheduler.schedulers.background import BackgroundScheduler as Scheduler
import logging
import datetime
# create a scheduler
s = Scheduler()
# This is what I want to happen
def job():
logging.basicConfig(filename='scheduled_task.log',level=logging.INFO,
format='%(asctime)s %(messa... | Python | 0 | |
a9a6a3dafc8901ffeeb89862fdc79f7099ba311a | Add UTF-8 test | test/test_utf8.py | test/test_utf8.py | # -*- coding: utf-8 -*-
# Monary - Copyright 2011-2014 David J. C. Beach
# Please see the included LICENSE.TXT and NOTICE.TXT for licensing information.
import pymongo
import monary
def setup():
with pymongo.Connection("127.0.0.1") as c:
c.drop_database("monary_test")
c.monary_test.data.insert({"... | Python | 0.000569 | |
6740c6192ab9bf37767230981b86e446486d4c43 | implement basic plugin loader for laser | mythril/laser/ethereum/plugins/plugin_loader.py | mythril/laser/ethereum/plugins/plugin_loader.py | from mythril.laser.ethereum.svm import LaserEVM
from mythril.laser.ethereum.plugins.plugin import LaserPlugin
class LaserPluginLoader:
"""
The LaserPluginLoader is used to abstract the logic relating to plugins.
Components outside of laser thus don't have to be aware of the interface that plugins provide
... | Python | 0 | |
a01f4d47410ee1bf164d8b962f6337f8c39f0d16 | add quicksort recursive | sort/quick_sort/python/quicksort-recusive.py | sort/quick_sort/python/quicksort-recusive.py |
def quickSort(arr):
sort(arr,0,len(arr)-1)
def sort(arr, low, high):
if (low < high):
p = partition(arr, low, high)
sort(arr, low, p - 1)
sort(arr, p + 1, high)
def partition(arr, low, high):
pivot = arr[high]
i = (low - 1)
for j in range(low,high):
if (arr[j] <=... | Python | 0.000114 | |
e6b381a617808c500e115d5e3715dc2ae454e896 | Add command line tool | src/psd_tools2/__main__.py | src/psd_tools2/__main__.py | from __future__ import unicode_literals
import logging
import docopt
from psd_tools2 import PSDImage
from psd_tools2.version import __version__
try:
from IPython.lib.pretty import pprint
except ImportError:
from pprint import pprint
logger = logging.getLogger(__name__)
logger.addHandler(logging.StreamHandler... | Python | 0.00002 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.