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 |
|---|---|---|---|---|---|---|---|
301e6b9b997c53aec8f63184153c949e8d6a1983 | Create __init__.py | iq2mongo/__init__.py | iq2mongo/__init__.py | from iq2mongo import Iqfeedhistoricdata
| Python | 0.000429 | |
58d03ad95d2f02a693869faa1081091d6999cd93 | Fix PEP8 in maketest | src/etc/maketest.py | src/etc/maketest.py | # Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or ht... | # Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or ht... | Python | 0.000042 |
22be0d463a7e4f8795c9b14e761bb2f84ef3ce50 | add UDPCollector | src/collectors/udp/udp.py | src/collectors/udp/udp.py | # coding=utf-8
"""
The UDPCollector class collects metrics on UDP stats (surprise!)
It's a copy of the TCPCollector with minor adjustments
#### Dependencies
* /proc/net/snmp
"""
import diamond.collector
import os
class UDPCollector(diamond.collector.Collector):
PROC = '/proc/net/snmp'
def get_default_... | Python | 0.000001 | |
f54a014fa420699f3c161f90b6392075a0134807 | move .ready() to the right place | src/hal/user_comps/pyvcp.py | src/hal/user_comps/pyvcp.py | #!/usr/bin/env python
# This is a component of emc
# Copyright 2007 Anders Wallin <anders.wallin@helsinki.fi>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of... | #!/usr/bin/env python
# This is a component of emc
# Copyright 2007 Anders Wallin <anders.wallin@helsinki.fi>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of... | Python | 0.000003 |
365be4a69571f5eadc8e3446e200594e8497b9b5 | add python password generator | python/python/misc/pwgen.py | python/python/misc/pwgen.py | #!/usr/bin/env python
'''
Copyright (C) 2011 Bryan Maupin <bmaupincode@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later... | Python | 0.000005 | |
525f8afcb132c2bb0eb853207685f291b292c41f | Add strip_openflow utility component | pox/lib/pxpcap/strip_openflow.py | pox/lib/pxpcap/strip_openflow.py | # Copyright 2012,2013 James McCauley
#
# This file is part of POX.
#
# POX is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# POX is d... | Python | 0 | |
148068d99477b5f61a91362a22d56dc3e7ca2dcd | Change where uploads go | meh/vermin/migrations/0002_auto_20150505_0439.py | meh/vermin/migrations/0002_auto_20150505_0439.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('vermin', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='post',
name='image',
... | Python | 0 | |
2ddaadff2033517def793af5bfc0bae122789e6a | add users.py, which plugs a hole in the dev authentication process | rdfdatabank/config/users.py | rdfdatabank/config/users.py | _USERS = {'admin': {'owner': '*', 'first_name': 'Databank', 'last_name': 'Admin', 'role': 'admin'}, 'sandbox_user': {'owner': ['sandbox'], 'role': 'user', 'name': 'Sandbox user', 'description': 'User for silo Sandbox'}}
| Python | 0 | |
a1be18c495802ab07147b30c2455445817a42fa6 | Test for __unicode__ behavior | learningresources/tests/test_models.py | learningresources/tests/test_models.py | """
Tests for learningresources models
"""
from __future__ import unicode_literals
from django.test.testcases import TestCase
from learningresources.models import LearningResourceType
class TestModels(TestCase):
"""Tests for learningresources models"""
def test_unicode(self):
"""Test for __unicode_... | Python | 0.001126 | |
24357efc8b44d916d9d43e262bb7b323cc650e81 | Create get_ip_send_email.py | get_ip_send_email.py | get_ip_send_email.py | #!/usr/bin/python
#-*-coding:utf8-*-
__author__ = 'laixintao'
import socket
import fcntl
import time
import struct
import smtplib
import urllib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
import re
import urllib2
# the e-mail config
# thi... | Python | 0.000009 | |
5a38a989591202fae42da75fde73f486634376e3 | Create 7kyu_simple_fun_new_numeral_system.py | Solutions/7kyu/7kyu_simple_fun_new_numeral_system.py | Solutions/7kyu/7kyu_simple_fun_new_numeral_system.py | from string import ascii_uppercase as AU
def new_numeral_system(number):
idx = AU.index(number)
return ["{} + {}".format(AU[i], AU[idx-i]) for i in range((idx//2)+1)]
| Python | 0.000176 | |
54bbea0d8316b976b46783485dc4262bd9a61d0a | Add win32 key counter | counter.py | counter.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pyHook
import pythoncom
import win32api
import win32con
import win32event
import win32gui
import win32ui
class KeyCounter(object):
def __init__(self):
self.count = 0
self.MESSAGE = win32gui.RegisterWindowMessage('KeyCounterValueUpdate')
... | Python | 0 | |
6174804ab17b621ad010c6ddd3b07f7728d24120 | add script | etc/bsrg.py | etc/bsrg.py | #!/usr/bin/env python
''' Adds a bogus read group to a readgroup-less BAM file '''
import os
import sys
import pysam
from uuid import uuid4
def modhead(header, rgid, fn):
if 'RG' in header:
sys.stderr.write("RG found in header, this script is not what you want!\n")
sys.exit(usage())
header[... | Python | 0.000001 | |
936042aad2e599c864cf31164d2399f6170e38c1 | add updated data, new 05 homework | homework/05_pandas_homework_imdb.py | homework/05_pandas_homework_imdb.py | '''
Pandas Homework with IMDb data
'''
'''
BASIC LEVEL
'''
import pandas as pd
import matplotlib.pyplot as plt
# read in 'imdb_1000.csv' and store it in a DataFrame named movies
movies = pd.read_csv("data/imdb_1000.csv")
# check the number of rows and columns
movies.shape
# check the data type of each column
movie... | Python | 0 | |
9ffe40aaf5ece521020258c4b31fbdb514e02b69 | Add utility function for get latest Build | manager/utilities.py | manager/utilities.py | from typing import Optional
from manager.models import Package, Build
def get_latest_build(package: Package) -> Optional[Build]:
try:
return Build.objects.filter(package=package, status=Build.SUCCESS).order_by('-id')[0]
except IndexError:
return None
| Python | 0 | |
9335023fa896053a5ecbd882e68dd72e8d617ab8 | Create sunshine.py | sunshine.py | sunshine.py | # -*- coding: utf8 -*-
import os
import numpy as np
from myfunctions import station,stationNo,DATAPATH,days36x
from variables import S
''' 要素 '''
sunshine = ['平均日照时数','累计日照时数']
# 定义函数 S_addtod,调用方式如下:
# d = S_addtod(filename,d)
def S_addtod(filename,d):
try:
x = S(filename)
except (IOError,TypeError,N... | Python | 0.999578 | |
0b55d97573fcd196a318b3c901f6dcac1b0a4eef | Create a placeholder for pyauto test scripts. | chrome/test/functional/test_basic.py | chrome/test/functional/test_basic.py | #!/usr/bin/python
# Copyright (c) 2010 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 unittest
from pyauto import PyUITest
class SimpleTest(PyUITest):
def testCanOpenGoogle(self):
self.NavigateToURL("http... | Python | 0.000012 | |
ffdfc05affc88226fda08c4d1924a9c509f4b53e | add GBM detector and datatype attrs | sunpy/net/dataretriever/attrs/gbm.py | sunpy/net/dataretriever/attrs/gbm.py | from sunpy.net.attr import SimpleAttr
__all__ = ['Detector']
class Detector(SimpleAttr):
"""
Detector number for FERMI GBM
"""
class Datatype(SimpleAttr):
"""
Data type of GBM - either CSPEC or CTIME
""" | Python | 0 | |
6906f574fad033f0b68fe7a5a35f4fcef1207ee0 | Load the source from a highlighted URL into a new window | Get_Webpage_Source.py | Get_Webpage_Source.py | import sublime
import sublime_plugin
import urllib
class GetWebpageSourceCommand(sublime_plugin.TextCommand):
def run(self, edit):
url = self.view.substr(self.view.sel()[0])
if len(url) == 0:
return
output = ""
r = urllib.request.urlopen(url)
output = str(r.read(), encoding='utf8')
... | Python | 0.000001 | |
430ad720ef43de501f3fb06901fbf5971cf920c6 | Create nowplaying.py | HexChat/nowplaying.py | HexChat/nowplaying.py | import dbus
import hexchat
__module_name__ = "NowPlaying"
__module_author__ = "TingPing"
__module_version__ = "0"
__module_description__ = "Announce Pithos or Audacious Songs"
# This is just me duct-taping two of my scripts together
# Don't expect adding players to this list.
np_help_msg = 'NP: Valid commands are (s... | Python | 0 | |
a6edfaeb6fc8036c60d9c20bf871795cba198337 | Add unittests for new bridgedb.translations module. | lib/bridgedb/test/test_translations.py | lib/bridgedb/test/test_translations.py | # -*- coding: utf-8 -*-
#
# This file is part of BridgeDB, a Tor bridge distribution system.
#
# :authors: Isis Lovecruft 0xA3ADB67A2CDB8B35 <isis@torproject.org>
# :copyright: (c) 2014, Isis Lovecruft
# (c) 2014, The Tor Project, Inc.
# :license: 3-Clause BSD, see LICENSE for licensing information
from t... | Python | 0 | |
93d80604003e1b3b21498df01f7647e7cea69a5f | Add basic WinEvent object tests. | cybox/test/objects/win_event_test.py | cybox/test/objects/win_event_test.py | # Copyright (c) 2015, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import unittest
from cybox.objects.win_event_object import WinEvent
from cybox.test.objects import ObjectTestCase
class TestWinThread(ObjectTestCase, unittest.TestCase):
object_type = "WindowsEventObjectType"... | Python | 0 | |
6c36729ec7d9f3345f0adb0c5deba13bd62262c6 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/6e84074d5cbda4900ea3f6cf29333e9f0140a661. | 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 = "6e84074d5cbda4900ea3f6cf29333e9f0140a661"
TFRT_SHA256 = "6764720c5901c26c6b92b5b16a12... | """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 = "d5b707f0e4997a401fd14b4a94e4f670e03e502e"
TFRT_SHA256 = "24a0e9963489cb9f5443e9e4a670... | Python | 0 |
05afa4481112f4cc890cfe3d6372044397b774c7 | Create set-timeZone-AsiaJakarta.py | timezone/set-timeZone-AsiaJakarta.py | timezone/set-timeZone-AsiaJakarta.py | >>> import os, time
>>> os.environ['TZ'] = 'Asia/Jakarta'
>>> time.tzset()
>>> time.strftime('%X %x %Z')
'12:26:07 10/15/15 WIB'
>>> print str(datetime.datetime.now()).split()[0]
2015-10-15
>>>
| Python | 0.000001 | |
4c71d31fc4adaec4a21f766530f459c911e03492 | add 0001 | Jaccorot/0001/0001.py | Jaccorot/0001/0001.py | #!/usr/local/bin/python
#coding=utf-8
#第 0001 题:做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),
#使用 Python 如何生成 200 个激活码(或者优惠券)?
import uuid
def create_code(num, length):
#生成”num“个激活码,每个激活码含有”length“位
result = []
while True:
uuid_id = uuid.uuid1()
temp = str(uuid_id).replace('-', '')[:le... | Python | 0.999999 | |
e614c38540d94812dc5acf41f585857563f4a090 | Add 3D Unet Benchmark test. | official/benchmark/unet3d_benchmark.py | official/benchmark/unet3d_benchmark.py | # Lint as: python3
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | Python | 0.000005 | |
ea64c4f44d5c386f9d9b43a8f122987b374b10d3 | Update the bot to use our new Yo emote | moxie/butterfield.py | moxie/butterfield.py | import os
import json
import asyncio
from butterfield.utils import at_bot
from aiodocker import Docker
from aiocore import EventService
WEB_ROOT = os.environ.get("MOXIE_WEB_URL", "http://localhost:8888")
class LogService(EventService):
"""
Provide basic text logging using print()
"""
identifier = "mo... | import os
import json
import asyncio
from butterfield.utils import at_bot
from aiodocker import Docker
from aiocore import EventService
WEB_ROOT = os.environ.get("MOXIE_WEB_URL", "http://localhost:8888")
class LogService(EventService):
"""
Provide basic text logging using print()
"""
identifier = "mo... | Python | 0 |
89d4c1420805a6f2e491f1ab250722cdcf950bd8 | Work towards integration NDTable <-> Minivect | ndtable/engine/mv.py | ndtable/engine/mv.py | import sys
import time
import numpy as np
from minivect import miniast
from minivect import specializers
from minivect import minitypes
from minivect.ctypes_conversion import get_data_pointer, \
get_pointer, convert_to_ctypes
from ndtable.datashape.coretypes import var_generator
from ndtable.expr.visitor import ... | Python | 0 | |
7665aaa458861eda661e7cc1b4828b68fcd15ba6 | Add newrelic install. | fabfile.py | fabfile.py | from fabric.api import *
from fabric.contrib.files import *
root_dir = '/home/www-data'
code_dir = '%s/django_app' % root_dir
virtualenv_name = 'django_venv'
virtualenv_dir = '%s/%s' % (root_dir, virtualenv_name)
newrelic_app_name = 'Census Reporter Django'
def install_newrelic(api_key):
""" Install the New Relic... | from fabric.api import *
from fabric.contrib.files import *
from fabric.colors import red
def deploy(branch='master'):
"Deploy the specified branch to the remote host."
root_dir = '/home/www-data'
code_dir = '%s/django_app' % root_dir
virtualenv_name = 'django_venv'
virtualenv_dir = '%s/%s' % (ro... | Python | 0 |
1146ab654c8b0d6f982f19bafed91f18edb877f3 | Add tests for the `dirty_unzip` rule | tests/rules/test_dirty_unzip.py | tests/rules/test_dirty_unzip.py | import os
import pytest
import zipfile
from thefuck.rules.dirty_unzip import match, get_new_command, side_effect
from tests.utils import Command
@pytest.fixture
def zip_error(tmpdir):
path = os.path.join(str(tmpdir), 'foo.zip')
def reset(path):
with zipfile.ZipFile(path, 'w') as archive:
... | Python | 0.000002 | |
fce66429cb361e9f113b3ec69031502128d192fb | Create OGR_PointIteration.py | OGR_PointIteration.py | OGR_PointIteration.py | from osgeo import ogr
import os
shapefile = "//mnt//hgfs//Biondo//GINF//Florestas_Parana//pr_300_f22.shp"
driver = ogr.GetDriverByName("ESRI Shapefile")
dataSource = driver.Open(shapefile, 0)
layer = dataSource.GetLayer()
for feature in layer:
geom = feature.GetGeometryRef()
pt = geom.Centroid()
pto = (pt... | Python | 0 | |
d3922992a4048dfff356ed91196c9c4d4d62bb08 | Create testcase.py | testcase.py | testcase.py | import unittest
from cal import Calculator
class TddInPythonExample(unittest.TestCase):
def test_calculator_add_method_returns_correct_result(self):
calc = Calculator()
result = calc.add(2,2)
self.assertEqual(4, result)
def test_calculator_returns_error_message_if_both_args_not... | Python | 0.000052 | |
f83250d04fc4f98e97abcdc705046e5b412fc62e | add solution for Set Matrix Zeroes | src/setMatrixZeroes.py | src/setMatrixZeroes.py | class Solution:
# @param matrix, a list of lists of integers
# RETURN NOTHING, MODIFY matrix IN PLACE.
def setZeroes(self, matrix):
if not matrix:
return
n = len(matrix)
if n == 0:
return
m = len(matrix[0])
pos = None
for i in xrange(n... | Python | 0.000001 | |
3926420273dce58076a8ba148e87f5ef268a2846 | add ie6 specific Focus.focus function | library/__ie6__/pyjamas/ui/Focus.py | library/__ie6__/pyjamas/ui/Focus.py | # emulate behaviour of other browsers
def focus(elem):
JS("""
try {
elem.focus();
} catch (e) {
// Only trap the exception if the attempt was mostly legit
if (!elem || !elem.focus) {
// Rethrow the probable NPE or invalid type
throw... | Python | 0.000001 | |
b219f44c754aafb959217ecf4199c8dc23a41ab1 | Create __init__.py | vnpy/app/risk_manager/ui/__init__.py | vnpy/app/risk_manager/ui/__init__.py | from .widget import RiskManager
| Python | 0.000429 | |
b92f204174e8d14fe4912631f5bc1305d7cd9550 | add choose.py; hardly anything in it | choose.py | choose.py | def main(): #get input and if input is bingo return true
x = raw_input("Type a word: ")
return bool(x == "bingo" or x == "Bingo")
print main()
| Python | 0.000001 | |
8188a8327b6269cdb2ae84fd97b19eac50914731 | add time module | allib/time.py | allib/time.py | import math
def format_timedelta(timedelta, short=True):
"""
Format a timedelta into a human-readable string.
"""
seconds = abs(timedelta.total_seconds())
days = max(0, math.floor(seconds / (3600 * 24)))
seconds -= 3600 * 24 * days
hours = max(0, math.floor(seconds / 3600))
seconds -= ... | Python | 0.000002 | |
178d4f3c13fa4baba4a0cb3bcadfa983ee1246ae | Add zenodo harvester | scrapi/harvesters/zenodo.py | scrapi/harvesters/zenodo.py | '''
Harvester for the ASU Digital Repository for the SHARE project
Example API call: https://zenodo.org/oai2d?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals
from scrapi.base import OAIHarvester
class ZenodoHarvester(OAIHarvester):
short_name = 'zenodo'
long_name = 'Zenodo... | Python | 0.999345 | |
0749111442c638569b6e42a11adee70e71e50813 | Add an helper class to write pexpect-based test cases Over time, we should improve this class and port all pexpect based testing over to using this | test/lldbpexpect.py | test/lldbpexpect.py | import lldb
from lldbtest import *
import lldbutil
import os
import unittest2
import sys
import pexpect
class PExpectTest(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
def doTest(self):
# put your commands he... | Python | 0.000011 | |
305c3e0ce2705dd23e00ec801f5588ec1dbcc3a8 | Add py solution for 167. Two Sum II - Input array is sorted | py/two-sum-ii-input-array-is-sorted.py | py/two-sum-ii-input-array-is-sorted.py | class Solution(object):
def twoSum(self, numbers, target):
"""
:type numbers: List[int]
:type target: int
:rtype: List[int]
"""
head, tail = 0, len(numbers) - 1
while head < tail:
s = numbers[head] + numbers[tail]
if s == target:
... | Python | 0.999997 | |
245aa075f89bede4dee4e47cdeab2569e6795aa7 | Create timebomb.py | timebomb.py | timebomb.py | from utils import add_cmd
import utils
import threading
import random
name = "timebomb"
cmds = ["timebomb", "cut"]
def kick(irc, target, channel, noRemove=False):
prepare_nicks = []
reason = "BOOM"
nicks = [target]
already_op = irc.is_opped(irc.get_nick(), channel)
gotop = utils.getop(irc, channe... | Python | 0 | |
b41fc9f56fbeef66612647605b8cbc144e93e66a | add example on how to run parallel func | pdf_lib/lib_build.py | pdf_lib/lib_build.py | # script to execute database building
from pdf_lib.parallel_func import (save_data, learninglib_build,
map_learninglib)
from ipyparallel import Client
rc = Client()
dview = rc[:]
def run_build(cif_dir):
fn_list = sorted([f for f in os.listdir(cif_dir) if f.endswith('.cif')])
... | Python | 0 | |
a7342cf25b850d310b0607f46a86037b26a8ecc4 | Create to_html.py | to_html.py | to_html.py | import pandas as pd
in_file = 'https://raw.githubusercontent.com/ryanswanstrom/awesome-datascience-colleges/master/data_science_colleges.csv'
## Read in the file
df = pd.read_csv(in_file)
# get a full degree name
df['DEGREE_FULL'] = df[['DEGREE']].apply(lambda x:
('Bachelors' if x[0]=='B' else 'Masters' if x[0]=='... | Python | 0.000001 | |
a26303847f8133ea037c7629c4949d061457f7d2 | Add a new module to import configuration data (hosts/services) from a MySQL database | shinken/modules/mysql_import_arbiter.py | shinken/modules/mysql_import_arbiter.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#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... | Python | 0 | |
84eaf8ffc63cda86b2c99924c6e53250f55ec94a | add expect_column_values_to_be_valid_utah_zip (#4799) | contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_valid_utah_zip.py | contrib/experimental/great_expectations_experimental/expectations/expect_column_values_to_be_valid_utah_zip.py | import json
from typing import Optional
import zipcodes
from great_expectations.core.expectation_configuration import ExpectationConfiguration
from great_expectations.exceptions import InvalidExpectationConfigurationError
from great_expectations.execution_engine import (
PandasExecutionEngine,
SparkD... | Python | 0 | |
3bf0a1c0752be428d3259a6639be205f019751d5 | Add lc0056_merge_intervals.py | lc0056_merge_intervals.py | lc0056_merge_intervals.py | """Leetcode 56. Merge Intervals
Medium
URL: https://leetcode.com/problems/merge-intervals/
Given a collection of intervals, merge all overlapping intervals.
Example 1:
Input: [[1,3],[2,6],[8,10],[15,18]]
Output: [[1,6],[8,10],[15,18]]
Explanation: Since intervals [1,3] and [2,6] overlaps, merge them into [1,6].
Exa... | Python | 0.000005 | |
f8e24bf955eb70535b989aad6ab8666ddd013da1 | Add in first py.test tests. | tests/test_basic.py | tests/test_basic.py | import pytest
import subprocess
import os
import sys
prefix = '.'
for i in range(0,3):
if os.path.exists(os.path.join(prefix, 'pyiso.py')):
sys.path.insert(0, prefix)
break
else:
prefix = '../' + prefix
import pyiso
def test_nofiles(tmpdir):
# First set things up, and generate the... | Python | 0 | |
8a2891aa7b4aaf68655654f19998fe3dbc25db38 | Create tree_de.py | tree_de.py | tree_de.py | class nod(object):
def __init__(self ,elem):
self.elem=elem
self.le=None
self.ri=None
def setle(self ,le):
self.le=le
def getle(self):
return self.le
def setri(self ,ri):
self.ri=ri
def getri(self):
return self.ri
class dll(object):
def __i... | Python | 0.000003 | |
4f086cf9f912bd5c1f1b9baf1add5e83b23690cf | Add tests on _parse_ip() and Proxy. | tests/test_proxy.py | tests/test_proxy.py | # Copyright 2012 Rackspace
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | Python | 0 | |
9c6f0cf829f4f0c7ff71ad65bed36269425dae13 | Add test for zoom backend | social_core/tests/backends/test_zoom.py | social_core/tests/backends/test_zoom.py | import json
from .oauth import OAuth2Test
class ZoomOAuth2Test(OAuth2Test):
backend_path = 'social_core.backends.zoom.ZoomOAuth2'
user_data_url = 'https://api.zoom.us/v2/users/me'
expected_username = 'foobar'
access_token_body = json.dumps({
'access_token': 'foobar-token',
'token_type... | Python | 0 | |
6824c741c455339eaaff5481f6e84c42fe1e26cf | Copy of main.py from fergal, reworked | susanplay/mainSusan.py | susanplay/mainSusan.py |
"""
This is a template top level script.
Please don't edit this file. Instead, copy it to
youname_main.py, then run and edit that file.
"""
import dave.pipeline.pipeline as dpp
import dave.pipeline.clipboard as clipboard
def main():
"""A bare bones main program"""
cfg = loadMyConfiguration()
epicList ... | Python | 0 | |
a4a956899008102b993d2268fbf6ae92d191ee6a | Test suite for Wikipedia triggers | ifttt/ifttt-tests.py | ifttt/ifttt-tests.py | # -*- coding: utf-8 -*-
"""
Wikipedia channel for IFTTT
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Copyright 2015 Ori Livneh <ori@wikimedia.org>
Stephen LaPorte <stephen.laporte@gmail.com>
Alangi Derick <alangiderick@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");... | Python | 0 | |
4a8c3043962efa7e2a443a10a0ad13d025699730 | Add script to extract useful lsf job information | support/get_lsf_job_info.py | support/get_lsf_job_info.py | import os
import sys
from subprocess import Popen, PIPE
# --------------------------------------------------------------------------------------------------
def get_job_run_time(lsf_output_file, time='s'):
"""
"""
fp = open(lsf_output_file, 'r')
process = Popen(['grep', 'Run time', lsf_output_file], stdin=PIPE, ... | Python | 0 | |
52d947daa8ea6642472660d0c16c2b05e34bea41 | Add migration file for the model of CoC record | src/users/migrations/0010_cocrecord.py | src/users/migrations/0010_cocrecord.py | # Generated by Django 3.0.2 on 2020-02-23 11:12
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('users', '0009_auto_20160227_1656'),
]
operations = [... | Python | 0 | |
bf55611be1b4c3799ab3e14bdcc1b46e96cffe24 | Add try_f test | tests/util-tests.py | tests/util-tests.py | import unittest, sys, os
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
import framework.util as util
class UtilTests (unittest.TestCase):
def test_try_f(self):
self.assertEqual(util.try_f(int, "10", -1), 10, "Did not convert string to int.")
self.assertEqual(util.t... | Python | 0.000005 | |
b7bc68872a45396358ce20a215e3a3a2c3734b8a | Add pretend ram module to try out the progress bar | py3status/modules/pretend_ram.py | py3status/modules/pretend_ram.py | # -*- coding: utf-8 -*-
from __future__ import division
import random
class Py3status:
"""
"""
format = "{bar}"
thresholds = [(0, "good"), (40, "degraded"), (75, "bad")]
cache_timeout = 1
middle_char = '|'
middle_color = None
left_char = '|'
left_color = None
right_char = '|'
... | Python | 0 | |
a90eb2777c7a6e80c8a57fec7f5d5b2665339d50 | Add fixed_rank.py module for fixed rank matrices | pymanopt/manifolds/fixed_rank.py | pymanopt/manifolds/fixed_rank.py | """
Module containing manifolds of fixed rank matrices.
"""
from pymanopt.manifolds.manifold import Manifold
class FixedRankEmbedded(Manifold):
"""
Manifold struct to optimize fixed-rank matrices w/ an embedded geometry.
FixedRankEmbedded(m, n, k)
Manifold of m-by-n real matrices of fixed rank k. T... | Python | 0 | |
f45fcf799c725a5206e5de4940cd35773ab9a697 | Add ../third_party/harfbuzz to all.gyp. Review URL: http://codereview.chromium.org/63063 | build/all.gyp | build/all.gyp | # Copyright (c) 2009 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.
{
'variables': {
'chromium_code': 1,
'conditions': [
['OS!="win"', {
'all_gyps%': 1,
},{ # else OS=="win"
'all_gyp... | # Copyright (c) 2009 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.
{
'variables': {
'chromium_code': 1,
'conditions': [
['OS!="win"', {
'all_gyps%': 1,
},{ # else OS=="win"
'all_gyp... | Python | 0.000001 |
10b0b790ca503bcabf203e6cdf8cd3ebc0bcfa5a | Create plot_log.py | plot_log.py | plot_log.py | import re
import matplotlib.pyplot as plt
if __name__=='__main__':
file = open('./logs/log.txt','r')
accuracy = []
epochs = []
loss = []
for line in file:
test_accuracy = re.search('"test_accuracy": ([0]\.[0-9]+)*', line)
if test_accuracy:
accuracy.append(test_accuracy.g... | Python | 0 | |
0a557c13dcd55023dc52549d7ca04943bc98ac58 | bump soledad version requirement to >=0.6 | service/setup.py | service/setup.py | #!/usr/bin/env python
#
# Copyright (c) 2014 ThoughtWorks, Inc.
#
# Pixelated 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 your option) any later version.
#
... | #!/usr/bin/env python
#
# Copyright (c) 2014 ThoughtWorks, Inc.
#
# Pixelated 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 your option) any later version.
#
... | Python | 0 |
abc155280052ab2f216342acd7933db3e090d94e | Add some basic tests for flow_exports | test/test_export_flow.py | test/test_export_flow.py | import netlib.tutils
from libmproxy import flow_export
from . import tutils
req_get = netlib.tutils.treq(
method='GET',
headers=None,
content=None,
)
req_post = netlib.tutils.treq(
method='POST',
headers=None,
)
def test_request_simple():
flow = tutils.tflow(req=req_get)
assert flow_expo... | Python | 0 | |
027b1e35a1808b010b30c596b9e98ede72b8c4e4 | add yamladd | yamladd.py | yamladd.py | #!/usr/bin/env python2
import argparse
import yaml
import sys
parser = argparse.ArgumentParser(
description='Insert a key-value pair into each mapping '
'in a YAML sequence of mappings')
parser.add_argument('key', help='Add this key')
parser.add_argument('value', help='with this value')
args = parser.... | Python | 0.999999 | |
5c0ef34788202abefbc36f80899f9b9b54ba17be | Add a fabric file to test the generated output | fabfile.py | fabfile.py | # -*- coding: utf-8 -*
"""
Simple fabric file to test oinspect output
"""
from __future__ import print_function
import webbrowser
import oinspect.sphinxify as oi
def test_basic():
"""Test with an empty context"""
docstring = 'A test'
content = oi.sphinxify(docstring, oi.generate_context())
page_nam... | Python | 0.000001 | |
6cfd5b46b9208d4e47482739732266c598e514df | add test script | test_new_image_loader.py | test_new_image_loader.py | import os
os.environ['MXNET_CPU_WORKER_NTHREADS'] = '1'
os.environ['OMP_NUM_THREADS'] = '1'
import time
import numpy as np
import multiprocessing as mp
import mxnet as mx
from mxnet import gluon as gl
from mxnet.gluon.data.vision import transforms
if __name__ == '__main__':
M = 24
BS = 100
dataset = gl.data.vision... | Python | 0.000001 | |
8d017a1f54bfff98f8f571c69d1e19ddbe8abdde | Add processify decorator | tools/processify.py | tools/processify.py | #!/usr/bin/env python
# encoding: utf-8
"""Taken from https://gist.github.com/schlamar/2311116"""
from __future__ import division, print_function
import sys
import traceback
from functools import wraps
from multiprocessing import Process, Queue
def processify(func):
"""Decorator to run a function as a process. ... | Python | 0.000015 | |
c5da3ee962a05c05d55fd98149c1095a57f03e36 | Add tests for task types for shot route | test/shots/test_task_types_for_shot.py | test/shots/test_task_types_for_shot.py | from test.base import ApiDBTestCase
class ShotTaskTypesTestCase(ApiDBTestCase):
def setUp(self):
super(ShotTaskTypesTestCase, self).setUp()
self.generate_fixture_project_status()
self.generate_fixture_project()
self.generate_fixture_entity_type()
self.generate_fixture_sequ... | Python | 0.000001 | |
554243dd90d6a96e5782f2b3e7ed5a72254fdf5b | Add tests. | test/test_jobs/test_export_userdata.py | test/test_jobs/test_export_userdata.py | # -*- coding: utf8 -*-
# This file is part of PYBOSSA.
#
# Copyright (C) 2018 Scifabric LTD.
#
# PYBOSSA 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 your op... | Python | 0 | |
566b2e9450c0602ea622d5c9b0ea90512336aef5 | Add exceptions from ceilometerclient | tuskarclient/exc.py | tuskarclient/exc.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | Python | 0 | |
ff68543ba0ebe15b5847dfbc0f2d45221b1f3634 | add inflexible fast tests | tests/fast_test_suite.py | tests/fast_test_suite.py | import unittest
from test_evaluation_metrics import EvaluationMetricsTestCase
from test_appliance_trace import ApplianceTraceTestCase
from test_appliance_instance import ApplianceInstanceTestCase
from test_appliance_set import ApplianceSetTestCase
from test_appliance_type import ApplianceTypeTestCase
from test_utils im... | Python | 0.000567 | |
fc74bf1ee86b667221d25c296c305d2d2e478e23 | add inflexible fast tests | tests/fast_test_suite.py | tests/fast_test_suite.py | import unittest
from test_evaluation_metrics import EvaluationMetricsTestCase
from test_appliance_trace import ApplianceTraceTestCase
from test_appliance_instance import ApplianceInstanceTestCase
from test_appliance_set import ApplianceSetTestCase
from test_appliance_type import ApplianceTypeTestCase
from test_utils im... | Python | 0.001224 | |
de15489a27c28c6cb5bf35c325ebdd6e4dad5d2c | Create log.py | lib/log.py | lib/log.py | test
| Python | 0.000002 | |
eba257535e9ccf94c931087272d855ff61838612 | improve tests to cover c++ class type handlers | tests/test-generation.py | tests/test-generation.py | #!/usr/bin/env python
import sys
import pybindgen
from pybindgen import typehandlers
from pybindgen.typehandlers import codesink
from pybindgen.typehandlers.base import Parameter, ReturnValue
from pybindgen.function import Function
from pybindgen.module import Module
from pybindgen import cppclass
class MyReverseWr... | #!/usr/bin/env python
import sys
import pybindgen
from pybindgen import typehandlers
from pybindgen.typehandlers import codesink
from pybindgen.typehandlers.base import Parameter, ReturnValue
from pybindgen.function import Function
from pybindgen.module import Module
class MyReverseWrapper(typehandlers.base.Reverse... | Python | 0.000001 |
21077f751e6cacae2e2383942f9b572a5ede86c9 | Add some example function tests that use gaeftest | tests/test_functional.py | tests/test_functional.py | #!/usr/bin/python2.5
#
# Copyright 2009 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 applicable... | Python | 0.000001 | |
21b8c5317af4ff129f72fa949e32a57eae0df7d4 | Create categoryManager.py | app/utils/categoryManager.py | app/utils/categoryManager.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Category manager utility.
Manage values in the Category table and manage links between Category
and Profiles.
"""
import argparse
import os
import sys
# Allow imports to be done when executing this file directly.
sys.path.insert(0, os.path.abspath(os.path.join(os.path... | Python | 0.000001 | |
a9976160ad297953ecb91ff38fe904a993eba784 | Remove _clean | dajax/core.py | dajax/core.py | from django.utils import simplejson as json
class Dajax(object):
def __init__(self):
self.calls = []
def json(self):
return json.dumps(self.calls)
def alert(self, message):
self.calls.append({'cmd': 'alert', 'val': message})
def assign(self, id, attribute, value):
s... | from django.utils import simplejson as json
class Dajax(object):
def __init__(self):
self.calls = []
def json(self):
return json.dumps(self.calls)
def alert(self, message):
self.calls.append({'cmd': 'alert', 'val': self._clean(message)})
def assign(self, id, attribute, valu... | Python | 0.000066 |
5db1ac3c73ebba56f478c8ee75d725032c5ab34e | Create gui.py | client/gui.py | client/gui.py | Python | 0.000001 | ||
9c6da7e968f6659016fd34fb32a71476bd63c96b | Create emoji.py | cogs/emoji.py | cogs/emoji.py | import discord
from discord.ext import commands
class Emoji:
def __init__(self, bot):
self.bot = bot
@commands.group(invoke_without_command=True)
async def emoji(self, ctx):
await ctx.message.delete()
emb = discord.Embed(colour=self.bot.gold)
emb.add_field(name='Usage', value='{***REMOVED***emoji <emojinam... | Python | 0.999745 | |
26b0c71b43c19984121c3f474b0836981950c468 | Add 0014 file | Drake-Z/0014/0014.py | Drake-Z/0014/0014.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''第 0014 题: 纯文本文件 student.txt为学生信息, 里面的内容(包括花括号)如下所示:
{
"1":["张三",150,120,100],
"2":["李四",90,99,95],
"3":["王五",60,66,68]
}
请将上述内容写到 student.xls 文件中。'''
__author__ = 'Drake-Z'
import os
import re
from collections import OrderedDict
import xlwt
def read_data... | Python | 0 | |
3f6b36d96e7e718ff7fb9d98a8211448f6b0d7e9 | Add upgrade script | scripts/upgrade_appservice_db.py | scripts/upgrade_appservice_db.py | import argparse
import json
import sqlite3
def main(dbname):
con = sqlite3.connect(dbname)
cur = con.cursor()
cur.execute("SELECT id, regex FROM application_services_regex")
for row in cur.fetchall():
try:
print "checking %s..." % row[0]
json.loads(row[1])
p... | Python | 0.000001 | |
fe757d0f17c57f6748ca28e678bb22a9f36271de | Add cd magic test | metakernel/magics/tests/test_cd_magic.py | metakernel/magics/tests/test_cd_magic.py |
import os
from metakernel.tests.utils import get_kernel
def test_cd_magic():
kernel = get_kernel()
kernel.do_execute("%cd ~")
assert os.getcwd() == os.path.expanduser('~'), os.getcwd()
| Python | 0.000001 | |
daef27939bed715d8a7d1f27fbfb4a193fb2de73 | add multiprocessing for cpu-load | src/python/multiprocessing/predict.py | src/python/multiprocessing/predict.py | # -*- coding:utf-8 -*-
import os
import sys
from math import ceil
import time
import signal
os.environ['OMP_NUM_THREADS'] = '1'
import numpy as np
import multiprocessing as mp
MATRIX_SIZE = (20000, 20000)
#MATRIX_SIZE = (2000, 2000)
pool = None
EXIT_FLAG = False
def worker(*args, **kwargs):
mat1 = np.random.rand... | Python | 0 | |
067668ee5879ba80cd29c9ae0ddee2a9be15fc31 | Create weather.py | weather.py | weather.py |
from bs4 import BeautifulSoup
# In[27]:
import urllib2
# In[28]:
f = open('weather_1.txt', 'w')
f.write("Date" + '\t' + "Temp" +'\t' + "precp" +'\n')
# In[29]:
for y in range(2013, 2014):
for m in range(1, 13):
for d in range(1, 32):
# Check if leap year
if y%400 == 0:
leap = True
... | Python | 0.000699 | |
b7975ad7b733eda545e3647d40bc46abbe4df250 | add elseclause01.py | trypython/basic/elseclause01.py | trypython/basic/elseclause01.py | # coding: utf-8
"""
各処理の後に付与できる オプション else節 についてのサンプルです。
"""
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import pr
class Sample(SampleBase):
def exec(self):
#
# Pythonの for, while, try には else をつけることが出来る
# どれも、正常に処理が通った場合に else に入るようになっている。
#... | Python | 0.000002 | |
5a0afa8eead558adf8e24aa1a6a32055c0296b08 | Add docker settings | server/config/settings/docker.py | server/config/settings/docker.py | from .base import * # NOQA
import sys
import logging.config
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATES[0]['OPTIONS'].update({'debug': True})
STATIC_URL = '/static/'
STATIC_ROOT = '/www/static/'
STATICFILES_DIRS = (
('dist', os.path.join(STATIC_ROOT, 'dist'... | Python | 0 | |
bdc9a6525e75014c727eeaf0aeb8b21a5b2290ca | Create wildchr.py | wildchr.py | wildchr.py | def match(str1,str2):
print '_'
if str1=='*' and str2=='' :
return True
if str1=='' and str2=='' :
return True
if str1=='' or str2=='' :
return False
if str1[0] ==str2[0] :
return match(str1[1:],str2[1:])
if str1[0]=='*' and str2[0] != '':
return matc... | Python | 0.00008 | |
14199e0590cf07f791c7422ee0b670d93ff0c5b0 | Create Transformations2D.py (#2310) | linear_algebra/src/transformations_2d.py | linear_algebra/src/transformations_2d.py | """
2D Transformations are regularly used in Linear Algebra.
I have added the codes for reflection, projection, scaling and rotation 2D matrices.
scaling(5) = [[5.0, 0.0], [0.0, 5.0]]
rotation(45) = [[0.5253219888177297, -0.8509035245341184],
[0.8509035245341184, 0.5253219888177297]]
projectio... | Python | 0 | |
0942d2ccf68b88db2616f9839c1ca1ebfacb8ad9 | Migrate in domain model changes | migration/versions/013_dataset_serp.py | migration/versions/013_dataset_serp.py | from sqlalchemy import *
from migrate import *
meta = MetaData()
def upgrade(migrate_engine):
meta.bind = migrate_engine
dataset = Table('dataset', meta, autoload=True)
serp_title = Column('serp_title', Unicode())
serp_title.create(dataset)
serp_teaser = Column('serp_teaser', Unicode())
serp... | Python | 0 | |
c3743e6ba9f38388c6705f59b7991d4ed75d849e | Add helper module | helper.py | helper.py | from itertools import tee
def pairwise(itr):
a, b = tee(itr) # two version of itr
next(b, None) # b goes ahead one step
return zip(a, b) # return iterator
| Python | 0.000001 | |
53f4477776e922455c4a9180ac587ccfe5a3f589 | add Matplotlib1DWidget | src/pymor/gui/matplotlib.py | src/pymor/gui/matplotlib.py | # This file is part of the pyMor project (http://www.pymor.org).
# Copyright Holders: Felix Albrecht, Rene Milk, Stephan Rave
# License: BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, division, print_function
import math as m
import numpy as np
from PySide.... | Python | 0 | |
bbb9c4df3b4bdafb1e3b4c5bc05b19dd56aff407 | Add interactive console to add test cases. | add_testcase.py | add_testcase.py | # coding: utf-8
from six.moves import input
import budou
import json
TESTCASES_PATH = 'test/cases.ndjson'
def colorize(text, color='green'):
ENDC = '\033[0m'
colors = {
'red': '\033[91m',
'green': '\033[92m',
'yellow': '\033[93m',
'blue': '\033[94m',
}
return colors[color] + text + ENDC
def m... | Python | 0 | |
19efe3a61f182c285c8437e356556148bcb4d9ff | rename method to save metadata | castra/core.py | castra/core.py | import tempfile
import bloscpack
import pickle
from bisect import bisect
import os
import pandas as pd
def escape(text):
return str(text)
class Castra(object):
def __init__(self, columns, dtypes, index_dtype, path=None):
if path is None:
path = tempfile.mkdtemp(prefix='castra-')
... | import tempfile
import bloscpack
import pickle
from bisect import bisect
import os
import pandas as pd
def escape(text):
return str(text)
class Castra(object):
def __init__(self, columns, dtypes, index_dtype, path=None):
if path is None:
path = tempfile.mkdtemp(prefix='castra-')
... | Python | 0.000001 |
9961234594b2581707978c20a51b838ba4b70627 | Add lan_ping.py | lan_ping.py | lan_ping.py | #!/usr/bin/env python
# -*- coding:utf8 -*-
import Queue
import threading
import subprocess
import re
import sys
lock = threading.Lock()
DEFAULT_THREAD_NUM = 100
def get_ips(ip):
a = re.match(r'(.*\d+)\.(\d+)-(\d+)', ip)
if not a:
raise Exception('IP range error')
start = int(a.group(2))
end... | Python | 0.999743 | |
b768281bf3b0e069312b64e738c12064cf4bd185 | add missing model migration | features/tags/migrations/0002_auto_20170116_2047.py | features/tags/migrations/0002_auto_20170116_2047.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-16 19:47
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('tags', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
... | Python | 0.000002 | |
b38ddb6c279da63d98e64476b4edc6b4c02f02d6 | add numeric sample | numeric.py | numeric.py | # -*- coding: utf-8 -*-
print(0b11)
print(0o17)
print(0xb)
# int('2.1') # Error
print(type(0xb))
| Python | 0.000005 | |
7f8cc08405639f32cc4a92ee478281f14fb365a9 | Add taobao.com authentication, oauth 2.0 | velruse/providers/taobao.py | velruse/providers/taobao.py | """Taobao Authentication Views"""
from hashlib import md5
from json import loads
import time
import requests
from pyramid.httpexceptions import HTTPFound
from velruse.api import AuthenticationComplete
from velruse.exceptions import AuthenticationDenied
from velruse.exceptions import ThirdPartyFailure
from velruse.utils... | Python | 0.000829 | |
86d7f74be733cd334142e43165cae8aa0de58cf3 | finding largest prime factor of a number | src/lasgest_prime_factor.py | src/lasgest_prime_factor.py | #!/usr/bin/env python
import math
num=input();
lastPrime=0;
for i in range(2,int(math.sqrt(num))+1):
while(num%i==0):
num=num/i;
lastPrime=i;
print lastPrime
| Python | 0.999563 | |
8d22023a065992f2f218920229df0d8de8feb463 | improve naming/organization | lib/oe/test_types.py | lib/oe/test_types.py | import unittest
from oe.maketype import create, factory
class TestTypes(unittest.TestCase):
def assertIsInstance(self, obj, cls):
return self.assertTrue(isinstance(obj, cls))
def assertIsNot(self, obj, other):
return self.assertFalse(obj is other)
def assertFactoryCreated(self, value, typ... | import unittest
from oe.maketype import create, factory
class TestTypes(unittest.TestCase):
def assertIsInstance(self, obj, cls):
return self.assertTrue(isinstance(obj, cls))
def assertIsNot(self, obj, other):
return self.assertFalse(obj is other)
def assertFactoryCreated(self, value, typ... | Python | 0 |
d683fee61eeec1c0ea9d0fbd2519b6c9b35616c2 | rename newton_test to smooth_test, add steepest_descent test | odl/test/solvers/smooth/smooth_test.py | odl/test/solvers/smooth/smooth_test.py | # Copyright 2014-2016 The ODL development group
#
# This file is part of ODL.
#
# ODL is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#... | Python | 0.000015 | |
961d8b3a27ed88f09f6bc59b71003f60efd9e601 | Create bloomberg_spider.py | bloomberg_spider.py | bloomberg_spider.py | import scrapy
class BloombergSpider(scrapy.Spider):
name = 'bloomberg'
start_urls = [
'http://www.bloomberg.com/quote/AAPL:US',
'http://www.bloomberg.com/quote/GOOGL:US',
'http://www.bloomberg.com/quote/AMZN:US',
]
def parse(self, response):
for sel in response.css('met... | Python | 0.001714 | |
aa050504a47f92738831153eee3d04a217ade9b7 | Add rapmap script | workflow-KSHV_RNA-Seq_RapMap.py | workflow-KSHV_RNA-Seq_RapMap.py | #!/usr/bin/env python
# Standard packages
import sys
import argparse
# Third-party packages
from toil.job import Job
# Package methods
from ddb import configuration
from ddb_ngsflow import gatk
from ddb_ngsflow import pipeline
from ddb_ngsflow.rna import rapmap
if __name__ == "__main__":
parser = argparse.Argu... | Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.