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 |
|---|---|---|---|---|---|---|---|
f7e4ca11c7bfc35bf0fd6becd2a5d5fdd2ca5ed5 | Add a script to split data with partitions. | src/main/python/partition_data.py | src/main/python/partition_data.py | import csv;
import random;
import sys;
in_file = str(sys.argv[1])
out_file = str(sys.argv[2])
num_partitions = int(sys.argv[3])
header = [];
partitions = [];
for i in range(num_partitions):
partitions.append([])
# Load all the training rows
row_num = 0;
with open(in_file) as file:
reader = csv.reader(file);
... | Python | 0 | |
dc76e7c085e7462d75567bf3d0228defb6bbbc58 | Add tests for converter | tests/test_csv_converter.py | tests/test_csv_converter.py | import os
import sys
sys.path.insert(0, os.path.dirname(__file__))
sys.path.insert(1, os.path.dirname(".."))
import unittest
from csv_converter import CsvConverter
class TestCsvConverter(unittest.TestCase):
def test_parse_csv(self):
converter = CsvConverter("tests/data/data_1.csv")
converter.setS... | Python | 0 | |
645507ed9ec43b354880673fbc75afe169ef6697 | Add test capturing bad implementation of contains handler. | tests/unit/test_handlers.py | tests/unit/test_handlers.py | from pmxbot import core
def test_contains_always_match():
"""
Contains handler should always match if no rate is specified.
"""
handler = core.ContainsHandler(name='#', func=None)
assert handler.match('Tell me about #foo', channel='bar')
| Python | 0 | |
d61c42221774f36477b1288396f4e7e7337e905c | add data migration | formly/migrations/0012_fix_multi_text_answer_data.py | formly/migrations/0012_fix_multi_text_answer_data.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2018-01-23 13:46
from __future__ import unicode_literals
import json
from django.db import migrations
def migrate_data(apps, schema_editor):
FieldResult = apps.get_model("formly", "FieldResult")
# alias for Field.MULTIPLE_TEXT
MULTIPLE_TEXT_TYPE = 8... | Python | 0.000001 | |
a1f864de0c5e71f0e9dc0ff4a23dc8101556832b | add new script | icart_mini_navigation/scripts/navigation_strategy.py | icart_mini_navigation/scripts/navigation_strategy.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
import roslib; roslib,load_manifest('rospeex_if')
except:
pass
import rospy
import re
from rospeex_if import ROSpeexInterface
from std_msgs.msg import String
syscommand_pub = rospy.Publisher('syscommand', String, queue_size=10)
rospy.init_node('navigation_s... | Python | 0.000001 | |
b3e9075e819402f93f7dc2e29b61e3e621ab7355 | Add unit tests for avging imputations | impy/imputations/tests/test_averaging_imputations.py | impy/imputations/tests/test_averaging_imputations.py | """test_averaging_imputations.py"""
import unittest
import numpy as np
from impy.imputations import mean_imputation
from impy.imputations import mode_imputation
from impy.imputations import median_imputation
from impy.datasets import random_int
class TestAveraging(unittest.TestCase):
""" Tests for Averaging """
... | Python | 0 | |
dd784f9035f66fd7d4febb8e43a09353821312b9 | add solution for Kth Largest Element in an Array | algorithms/KthLargestElementInAnArray/KthLargestElementInAnArray.py | algorithms/KthLargestElementInAnArray/KthLargestElementInAnArray.py | class Solution:
# @param {integer[]} nums
# @param {integer} k
# @return {integer}
def findKthLargest(self, nums, k):
k = len(nums) - k
def quickselect(st, ed):
pivot = nums[ed]
pos = st
for i in xrange(st, ed):
if nums[i] < pivot:
... | Python | 0 | |
d3afe17fa3f259e2b09f76e4b486e4cbf9e659c3 | Create albumCoverFinder.py | albumCoverFinder.py | albumCoverFinder.py | # albumCoverFinder - Brian Tran, btran29@gmail.com
# This program scans a tree of directories containing mp3 files. For
# each directory, it attempts to download the cover image from the
# Apple iTunes service. Subdirectories must be named <Artist>/<Album>
# contain .mp3 files to be considered. The cover will be saved... | Python | 0 | |
aa411ddcd62b824c0bfe8660c795b71e6e6929ea | add reset command. | axes/utils.py | axes/utils.py | from axes.models import AccessAttempt
def reset(ip=None, silent=False):
if not ip:
attempts = AccessAttempt.objects.all()
if attempts:
for attempt in AccessAttempt.objects.all():
attempt.delete()
else:
if not silent:
print 'No attempts... | Python | 0.001104 | |
ceb8a32637bc0fd9ab0517be7f025755e19ec2c7 | add leetcode Excel Sheet Column Number | leetcode/ExcelSheetColumnNumber/solution.py | leetcode/ExcelSheetColumnNumber/solution.py | # -*- coding:utf-8 -*-
class Solution:
# @param s, a string
# @return an integer
def titleToNumber(self, s):
col = 0
for c in s:
col = col * 26 + ord(c) - ord('A') + 1
return col
| Python | 0.000001 | |
cf7e9dfec0c0cdab913f98ff325210b552610219 | Add new runner, search! | salt/runners/search.py | salt/runners/search.py | '''
Runner frontend to search system
'''
# Import salt libs
import salt.search
import salt.output
def query(term):
'''
Query the search system
'''
search = salt.search.Search(__opts__)
result = search.query(term)
salt.output.display_output(result, 'pprint', __opts__)
return result
| Python | 0 | |
da704e95b010330efd350e7ed85e51f252b8a453 | add missing migration | aldryn_redirects/migrations/0002_on_delete_and_verbose_names.py | aldryn_redirects/migrations/0002_on_delete_and_verbose_names.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-22 08:03
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('aldryn_redirects', '0001_initial'),
]
operations = ... | Python | 0.000258 | |
17ae9e25663d029af11236584b4c759c895ae830 | Improve and consolidate condition scripts of Lithium to support timeouts and regex via optparse. r=Jesse | util/fileIngredients.py | util/fileIngredients.py | #!/usr/bin/env python
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import with_statement
import re
def fileContains(f, s, isRegex):
if isRege... | Python | 0 | |
03baa59cea76ab85f661bfa3e8d910fd6a7ae82a | Remove leading slash in redirections | nikola/plugins/task/redirect.py | nikola/plugins/task/redirect.py | # -*- coding: utf-8 -*-
# Copyright © 2012-2016 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation
# the rights t... | # -*- coding: utf-8 -*-
# Copyright © 2012-2016 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation
# the rights t... | Python | 0.000001 |
21ef2114975a315815d960fd1f28c5e4036fb935 | Update browsermark to use results.AddValue(..) | tools/perf/benchmarks/browsermark.py | tools/perf/benchmarks/browsermark.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Runs Browsermark CSS, DOM, WebGL, JS, resize and page load benchmarks.
Browsermark benchmark suite have five test groups:
a) CSS group: measures your bro... | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Runs Browsermark CSS, DOM, WebGL, JS, resize and page load benchmarks.
Browsermark benchmark suite have five test groups:
a) CSS group: measures your bro... | Python | 0.000001 |
b0a6192649dd47548e007410b9f1a60ec23466de | Add files via upload | XMLAnalyze2.py | XMLAnalyze2.py | # Author: Andrew Sainz
#
# Purpose: XMLParser is designed to iterate through a collection of Post data collected from Stack Overflow
# forums. Data collected to analize the code tagged information to find the language of the code
# being utilized.
#
# How to use: To run from command line input "python... | Python | 0 | |
8204a8b84cdcd515ea1dcf7ab67574b6db5baca6 | Add WS caller | web_services/ws_test.py | web_services/ws_test.py | import functools
import xmlrpclib
HOST = 'localhost'
PORT = 8069
DB = 'odoo_curso'
USER = 'admin'
PASS = 'admin'
ROOT = 'http://%s:%d/xmlrpc/' % (HOST,PORT)
# 1. Login
uid = xmlrpclib.ServerProxy(ROOT + 'common').login(DB,USER,PASS)
print "Logged in as %s (uid:%d)" % (USER,uid)
call = functools.partial(
xmlrpclib... | Python | 0 | |
605fb4c6726d0c66bada870bffe526d493195b33 | Create USN.py | USN.py | USN.py | #Spooky scary skeeletons send shiveers down your spine
#You are a gunner in the Navy. Destroy the Commies.
| Python | 0.000003 | |
129e548ac0be8ee3a60dd85aca9d095456b7d3a6 | Add new py-testresources package (#14031) | var/spack/repos/builtin/packages/py-testresources/package.py | var/spack/repos/builtin/packages/py-testresources/package.py | # Copyright 2013-2019 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 PyTestresources(PythonPackage):
"""Testresources, a pyunit extension for managing expensiv... | Python | 0 | |
3e7b9b69e68c8594eac92d88f0579aab40d7d5ae | Test aborting queued live migration | nova/tests/functional/libvirt/test_live_migration.py | nova/tests/functional/libvirt/test_live_migration.py | # Copyright 2021 Red Hat, Inc.
#
# 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 writin... | Python | 0.000103 | |
226238bf4c672a58bb6c066f79301701d594a5c0 | Add notobuilder script | scripts/notobuilder.py | scripts/notobuilder.py | """Build a Noto font from one or more source files.
By default, places unhinted TTF, hinted TTF, OTF and (if possible) variable
fonts into the ``output/`` directory.
Currently does not support building from Monotype sources.
"""
import logging
import os
import re
import sys
from gftools.builder import GFBuilder
from... | Python | 0 | |
f8712c62ad069b815ff775bd758bdbf693bdbdb7 | Add some constants. | src/pyfuckery/constants.py | src/pyfuckery/constants.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# XXX Update Docstring
"""
pyFuckery - constants.py
Created on 2/12/17.
"""
# Stdlib
import logging
import re
# Third Party Code
# Custom Code
log = logging.getLogger(__name__)
# Brainfuck tokens
SYM_PTR_INC = '>'
SYM_PTR_DEC = '<'
SYM_DATA_INC = '+'
SYM_DATA_DEC = '-'
... | Python | 0.000001 | |
37190d6fba4d2a769ff2dcd154aa8cf1721f7026 | yea yea | gmm.py | gmm.py | """Trains a GMM on formant data (e.g. from the Hillenbrand corpus).
"""
import numpy as np
from sklearn.mixture import GMM
from sklearn import metrics
import pylab as pl
from collections import defaultdict
def parse(fname):
with open(fname) as f:
d = map(lambda l: l.rstrip('\n').split(), f.readlines())
... | Python | 0.999953 | |
c97e44697444b15686bd0a6b5158c90630958238 | Add LRU example | lru.py | lru.py | from datetime import datetime
class LRUCacheItem(object):
"""Data structure of items stored in cache"""
def __init__(self, key, item):
self.key = key
self.item = item
self.timestamp = datetime.now()
class LRUCache(object):
"""A sample class that implements LRU algorithm"""
d... | Python | 0 | |
dd7ffbf97f9ae8426d7f60e465941f3f70bccdd6 | add file | new.py | new.py | print("test")
| Python | 0.000001 | |
494c8b88727dc958a7ba37f76d4c470837d26e1d | Define register files | reg.py | reg.py | EXP = 'EXP'
VAL = 'VAL'
ENV = 'ENV'
UNEV = 'UNEV'
FUNC = 'FUNC'
ARGL = 'ARGL'
CONT = 'CONT'
CURR = 'CURR'
STACK = 'STACK' | Python | 0.000043 | |
1c46aa8a03e577ddb3db55a11df3db70905110d2 | Add serial_logger.py | serial_logger.py | serial_logger.py | #!/usr/bin/env python
# encoding: utf-8
# Log serial monitor data
# TO-DO: add options for serial device, baud rate
import serial
import datetime
ser = serial.Serial('/dev/cu.usbmodemfa131', 9600)
now = datetime.datetime.now()
def get_date_string():
day = now.day
month = now.month
year = now.year
cu... | Python | 0.000021 | |
0df0daf7f52015258c3607bb2822c1c77c5e8207 | add tensorflow sample | python/other/flow.py | python/other/flow.py | import tensorflow as tf
a = tf.constant(1, name="a")
b = tf.constant(1, name="b")
c = a + b
print(c)
graph = tf.get_default_graph()
print(graph.as_graph_def())
with tf.Session() as sess:
print(sess.run(c)) | Python | 0 | |
fdc900d5da48ae9aea1c7537e026dc2d46c62bc8 | add some reuseable aggregation code | shrunk/aggregations.py | shrunk/aggregations.py |
def match_short_url(url):
return {"$match": {"short_url":url}}
def match_id(id):
return {"$match": {"short_url":url}}
#monthly visits aggregations phases
group_ips={"$group": {
"_id": "$source_ip",
"times": {
"$addToSet": "$time"
},
"count": {
"$sum": 1
}
}}
take_first_vi... | Python | 0.000001 | |
f9da8c4aa061223dac5147f6eaec6ad3419d1d6a | Add cli module to accept a language option | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/cli.py | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/cli.py | import os
os.environ["KIVY_NO_ARGS"] = "1"
import click
from {{cookiecutter.repo_name}}.{{cookiecutter.repo_name}} import {{cookiecutter.app_class_name}}
@click.command()
@click.option(
'-l', '--language', help='Default language of the App', default='en',
type=click.Choice(['en', 'de'])
)
def main(language)... | Python | 0.000001 | |
09379060a5acb36462a21a5ad78d12f33270a20e | add python template for searching AD | python/python/templates/ad-template.py | python/python/templates/ad-template.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 | |
d7ea709e50510016bb448cb45e159528e416f08b | Create dianping_spider.py | DataHouse/crawler/dianping/dianping_spider.py | DataHouse/crawler/dianping/dianping_spider.py | """
a web spider for daz hong dian ping
"""
import time
import requests
from bs4 import BeautifulSoup
from lxml import etree
import pandas as pd
from pymongo import MongoClient
CITY_FILEPATH = 'city.xml'
CATEGORY_FILEPATH = 'type.xml'
SLEEP_TIME = 2
class City(object):
def __init__(self, pinyin, id, name):
... | Python | 0.000004 | |
195b74304fa1c5eab3bc2e16df1346c2f92916f8 | Test py | testnet/tests/configs_api_test.py | testnet/tests/configs_api_test.py | #!/usr/bin/env python3
import unittest
import datetime
from exonum import ExonumApi, random_hex
class ConfigsApi(ExonumApi):
def new_config_propose(self, config, height, actual_from_height):
tx, c = self.send_transaction("config/propose", {"config": config, "height": height, "actual_from_height": ac... | Python | 0 | |
1ac0c90037923c06a337b7236b678d8ca2b45e5f | Fix unit test | tests/unit/engines/test_acgsou.py | tests/unit/engines/test_acgsou.py | from collections import defaultdict
import mock
from searx.engines import acgsou
from searx.testing import SearxTestCase
class TestAcgsouEngine(SearxTestCase):
def test_request(self):
query = 'test_query'
dic = defaultdict(dict)
dic['pageno'] = 1
params = acgsou.request(query, dic... | from collections import defaultdict
import mock
from searx.engines import acgsou
from searx.testing import SearxTestCase
class TestAcgsouEngine(SearxTestCase):
def test_request(self):
query = 'test_query'
dic = defaultdict(dict)
dic['pageno'] = 1
params = acgsou.request(query, dic... | Python | 0.000005 |
1f24571c358941932860eab9b46b386adc7c7ecc | Add script to output the users with unassigned tickets | p3/management/commands/users_with_unassigned_tickets.py | p3/management/commands/users_with_unassigned_tickets.py | # -*- coding: utf-8 -*-
""" Print information of the users who got unassigned tickets."""
from django.core.management.base import BaseCommand, CommandError
from django.core import urlresolvers
from conference import models
from conference import utils
from p3 import models as p3_models
from ... | Python | 0 | |
aa720214722ca6ea445cf4ba38aa5f51ef7772b4 | add random user for notes | add_random_user.py | add_random_user.py | #!/usr/bin/python
#coding=utf-8
import sys
import MySQLdb
from DBUtils.PooledDB import PooledDB
import hashlib
import time
import random
g_dbPool = PooledDB(MySQLdb, 5, host='function-hz.com', user='notes', passwd='welc0me', db='db_notes', port=3306, charset = "utf8", use_unicode = True);
def create_ra... | Python | 0 | |
05aa314ac9b5d38bb7a30e30aced9b27b2797888 | Add tests for non-async constructs | python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/test_syntax.py | python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/test_syntax.py | # Add taintlib to PATH so it can be imported during runtime without any hassle
import sys; import os; sys.path.append(os.path.dirname(os.path.dirname((__file__))))
from taintlib import *
# This has no runtime impact, but allows autocomplete to work
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ..taintlib... | Python | 0.000006 | |
388c51ea5f83f718b885d784b566bc1873998c3a | add management command used to find all duplicate districts | custom/icds_reports/management/commands/find_duplicate_district_topojsons.py | custom/icds_reports/management/commands/find_duplicate_district_topojsons.py | from django.core.management import BaseCommand
from custom.icds_reports.utils.topojson_util.topojson_util import get_topojson_file_for_level, \
get_district_topojson_data
class Command(BaseCommand):
help = "Prints out any districts whose names are duplicated across states."
def handle(self, *args, **kwa... | Python | 0.000027 | |
8634db8fe61f819cf24023514d94e4ebfc7e819f | Add Stats() class | auth0/v2/stats.py | auth0/v2/stats.py | from .rest import RestClient
class Stats(object):
"""Auth0 stats endpoints
Args:
domain (str): Your Auth0 domain, e.g: 'username.auth0.com'
jwt_token (str): An API token created with your account's global
keys. You can create one by using the token generator in the
AP... | Python | 0.000001 | |
c1fcf54b63de95c85a9505d83062d8b320b1cbdf | Add python cloudfront update_distribution example to replace ACM Certificate | python/example_code/cloudfront/update_distribution_certificate.py | python/example_code/cloudfront/update_distribution_certificate.py | # Copyright 2010-2018 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file ac... | Python | 0 | |
b861b70e72b582a1bd3ae3ae6fa8ae2478b4ebe4 | add the tests | popgen/test/test_categorizer.py | popgen/test/test_categorizer.py | import pytest
import numpy as np
from ..census_helpers import Census
from .. import categorizer as cat
@pytest.fixture
def c():
return Census("827402c2958dcf515e4480b7b2bb93d1025f9389")
@pytest.fixture
def acs_data(c):
population = ['B01001_001E']
sex = ['B01001_002E', 'B01001_026E']
race = ['B02001... | Python | 0.000028 | |
151293037b941aba874fb2641c1bf982e2143beb | Create solution.py | hackerrank/algorithms/implementation/medium/the_time_in_words/py/solution.py | hackerrank/algorithms/implementation/medium/the_time_in_words/py/solution.py | #!/bin/python3
import sys
def solution(hrs, min):
lookup = {
0: 'zero',
1: 'one',
2: 'two',
3: 'three',
4: 'four',
5: 'five',
6: 'six',
7: 'seven',
8: 'eight',
9: 'nine',
10: 'ten',
11: 'eleven',
12: 'twelve',... | Python | 0.000018 | |
8ba0fcfa893e007f1c6cc794a36bd3604498c380 | add rapiro.py | rapiroController.kivy/rapiro.py | rapiroController.kivy/rapiro.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import serial
import os
import time
import datetime
import threading
_str = ''
if os.name == 'posix':
com = serial.Serial('/dev/ttyAMA0', 57600, timeout = 0.05)
else:
com = sys.stdout
def a2dist(v):
d = 26.59*pow(v/1024.0*5.0,-1.209)
return(d)
... | Python | 0.999586 | |
a2848885e85ad6d9685bb8ae35747300ed4b6b8b | Add a BaseTokenizer | spicedham/tokenizer.py | spicedham/tokenizer.py | class BaseTokenizer(object):
def __init__(self, config):
pass
def tokenize(self, text):
return [text]
| Python | 0.000006 | |
75a882bf38c88d73e38d13fbb8b1499ff4ae4ea6 | Add migration for changing users added by OSF for meetings with emails for fullnames to their guid | scripts/remove_after_use/set_meetings_users_fullnames_to_guids.py | scripts/remove_after_use/set_meetings_users_fullnames_to_guids.py | import sys
import logging
import django
from django.db import transaction
django.setup()
from osf.models import OSFUser
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
def main():
dry_run = '--dry' in sys.argv
with transaction.atomic():
users = OSFUser.objects.filter(ful... | Python | 0 | |
a6b35a9a94b2e4b32c2236258812b44e81184515 | Add management command for resyncing mobile worker location user data | corehq/apps/users/management/commands/fix_location_user_data.py | corehq/apps/users/management/commands/fix_location_user_data.py | from corehq.apps.locations.models import Location
from corehq.apps.users.models import CommCareUser
from dimagi.utils.couch.database import iter_docs
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
args = "domain"
help = "Fix location user data for mobile workers.... | Python | 0 | |
a31ef338ef4029be92b0c578bdd12706a0f1c17d | Move zpool grains into salt.grains.zpool | salt/grains/zpool.py | salt/grains/zpool.py | # -*- coding: utf-8 -*-
'''
ZFS grain provider
:maintainer: Jorge Schrauwen <sjorge@blackdot.be>
:maturity: new
:depends: salt.utils, salt.module.cmdmod
:platform: illumos,freebsd,linux
.. versionadded:: Oxygen
'''
from __future__ import absolute_import
# Import python libs
import logging
# Impo... | Python | 0.001271 | |
bb8a448e5e3f935f5ee4f8da9c78bcb651486c15 | Create ZigZagConversion_002.py | leetcode/006-ZigZag-Conversion/ZigZagConversion_002.py | leetcode/006-ZigZag-Conversion/ZigZagConversion_002.py | class Solution:
# @param {string} s
# @param {integer} numRows
# @return {string}
def convert(self, s, numRows):
if numRows < 2:
return s
halfsize = numRows - 1
size = 2 * halfsize
res = ''
for i in range(numRows):
j, cnt = i, 1
... | Python | 0.000001 | |
95fcdd4f2f65a330adcb115b7ce6d6084efc6ae8 | Add examples. | examples/sampling/metropolis.py | examples/sampling/metropolis.py | #!/usr/bin/env python
import numpy as np
from util import MetropolisSampler, log_gaussian
from matplotlib import pyplot as plt
def __main__():
np.random.seed(4)
# Generate parameters
num_dims = 3
mu = np.random.normal(0, 3, num_dims)
cov = np.diag(np.random.gamma(.5, size=num_dims))
# Create ... | Python | 0 | |
415717bddb00ca650bef61a5c6054a7b47575b56 | Implement unit test for break. | jaspyx/tests/visitor/test_break.py | jaspyx/tests/visitor/test_break.py | import ast
from jaspyx.ast_util import ast_store, ast_load
from jaspyx.tests.visitor.v8_helper import V8Helper
class TestBreak(V8Helper):
def test_break(self):
assert self.run(
[
ast.Assign(
[ast_store('i')],
ast.Num(0),
)... | Python | 0.000001 | |
607c84d56524389a150e940d89f6ecb52420e8f3 | plain, AC | leetcode/0162_find-peak-element.py | leetcode/0162_find-peak-element.py | #
# @lc app=leetcode id=162 lang=python3
#
# [162] Find Peak Element
#
from typing import List
# @lc code=start
INT_MIN = - 2 ** 64 + 1
class Solution:
def findPeakElement(self, nums: List[int]) -> int:
if len(nums) == 1:
return 0
nums.insert(0, INT_MIN)
nums.append(INT_MIN)
... | Python | 0.998553 | |
6db056ed452dfe01e5b6b414d414dd02d8960cef | use new mesolve output format | examples/ex_landau_zener.py | examples/ex_landau_zener.py | #
# Textbook example: Landau-Zener transitions in a quantum two-level system.
#
from qutip import *
from pylab import *
import time
def hamiltonian_t(t, args):
""" evaluate the hamiltonian at time t. """
H0 = args[0]
H1 = args[1]
return H0 + t * H1
def qubit_integrate(delta, eps0, A, gamma1, gamma2, ... | #
# Textbook example: Landau-Zener transitions in a quantum two-level system.
#
from qutip import *
from pylab import *
import time
def hamiltonian_t(t, args):
""" evaluate the hamiltonian at time t. """
H0 = args[0]
H1 = args[1]
return H0 + t * H1
def qubit_integrate(delta, eps0, A, gamma1, gamma2, ... | Python | 0.000126 |
a1e451ab3525c5a0852782d1990f848b2329cb72 | add sinawb token | server/crawler/sinawb/TokenConstant.py | server/crawler/sinawb/TokenConstant.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Author: AsherYang
Email: ouyangfan1991@gmail.com
Date: 2017/9/22.
Desc: sinaWeibo appkey
@see: http://open.weibo.com/apps/2489615368/info/basic?action=review
"""
domain="https://api.weibo.com/2/"
token=""
appkey = "2489615368"
secret = "dbb84df92e9a9c8f8e10d9985a8038a... | Python | 0.999782 | |
1a9b6c7c58c5960df18335552780c3ca668dea5e | add evaluation script for ihm | evaluation/evalutate_ihm.py | evaluation/evalutate_ihm.py | import sklearn.utils as sk_utils
from mimic3models import metrics
import numpy as np
import pandas as pd
import argparse
def main():
parser = argparse.ArgumentParser()
parser.add_argument('prediction', type=str)
parser.add_argument('--test_listfile', type=str, default='../data/in-hospital-mortality/test/l... | Python | 0 | |
e3c17a893ef4e0790af05cc238ac9038923b115a | Create docs directory for sphinx integration | docs/__init__.py | docs/__init__.py | #TODO:Create DOCS files for later integration using Sphinx
| Python | 0 | |
c206cfd940dd8ba58edb86f16691bcf50b6e5e30 | Add modgraph.py demo from Michael Hohn <mhhohn@lbl.gov> | tclpkg/gv/demo/modgraph.py | tclpkg/gv/demo/modgraph.py | #!/usr/bin/python
# display the kernel module dependencies
# author: Michael Hohn <mhholn@lbl.gov>
# based on: modgraph.tcl by John Ellson <ellson@research.att.com>
import sys
# sys.path.append('/usr/lib/graphviz/python')
sys.path.append('/usr/lib64/graphviz/python')
import gv
modules = open("/proc/modules", 'r').... | Python | 0 | |
5c7a4547558e6f6959ae1878f56efef8716456c4 | add script to convert distances into probabilities | scripts/distance2probability.py | scripts/distance2probability.py | #!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2014 Hervé BREDIN
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without lim... | Python | 0.000006 | |
2197e16cf20bba5d373f4b7a250b8f1190be8ede | Add focus attribute example. | examples/focused-windows.py | examples/focused-windows.py | #!/usr/bin/env python3
from argparse import ArgumentParser
import i3ipc
i3 = i3ipc.Connection()
def focused_windows():
tree = i3.get_tree()
workspaces = tree.workspaces()
for workspace in workspaces:
container = workspace
while container:
if not hasattr(container, 'focus') \
or not co... | Python | 0 | |
e7146bbee86ea744d080f18a4f27def9cb26e33e | add corpus_test1.py to see how to parse music21 songs | experiments/corpus_test1.py | experiments/corpus_test1.py | #!/usr/bin/env python3
# Copyright 2016 Curtis Sand
#
# 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 la... | Python | 0.000001 | |
6ccdf23c67af632a46017d63b5f51d2c207be0ab | Add file | scheduled_bots/scripts/merge_duplicate_gene_proteins.py | scheduled_bots/scripts/merge_duplicate_gene_proteins.py | from tqdm import tqdm
from wikidataintegrator.wdi_core import WDItemEngine, MergeError
from wikidataintegrator.wdi_login import WDLogin
from scheduled_bots.local import WDUSER, WDPASS
login = WDLogin(WDUSER, WDPASS)
s_protein = """
SELECT DISTINCT ?item1 ?item2 ?value {{
?item1 wdt:P352 ?value .
?item2 wdt:P352 ?va... | Python | 0.000002 | |
495da73f305a2a0e79a28d251b5b93caea06656d | Add UglifyJS as a filter. | mediagenerator/filters/uglifier.py | mediagenerator/filters/uglifier.py | from django.conf import settings
from django.utils.encoding import smart_str
from mediagenerator.generators.bundles.base import Filter
class Uglifier(Filter):
def __init__(self, **kwargs):
super(Uglifier, self).__init__(**kwargs)
assert self.filetype == 'js', (
'Uglifier only supports c... | Python | 0 | |
660a3c5f3f8a4c63c21c27ce58c5639d37409ae1 | add thing to filter tracts | filter_tracts.py | filter_tracts.py | import json
calif_tracts_data = open('tracts.json')
calif_tracts = json.load(calif_tracts_data)
sf_tracts = []
for r in calif_tracts["features"]:
if r["properties"]["COUNTY"] == "075":
sf_tracts.append(r)
calif_tracts_data.close()
print json.dumps({"type": "FeatureCollection", "features": sf_tracts}) | Python | 0 | |
ce908d76dd624c687ab3c641d474857b6ffe011b | enable create and delete dhcp server | n0core/porter/dhcp.py | n0core/porter/dhcp.py | from ipaddress import IPv4Interface # noqa
import os
from typing import Tuple # noqa
from pyroute2 import IPRoute
from pyroute2 import NetNS
from pyroute2 import NSPopen
class DHCP(object):
"""
Manage namespaces, veth pairs and dnsmasq processes.
"""
ip = IPRoute()
@classmethod
def _get_veth... | Python | 0 | |
68a720ab539c6ba94fdf181328f27be453a9097f | Add examine_latent.py script | examine_latent.py | examine_latent.py | # Examine the Million Song Dataset. Running this script will visualize each Echo
# Nest Taste Profile songs' latent features with t-SNE.
import os, subprocess
import matplotlib.pyplot as plt
from matplotlib.text import Annotation
import numpy as np
from sklearn.preprocessing import StandardScaler
from sklearn.manifold... | Python | 0.000001 | |
e687dce8c8441728f1af6336497f7a131730db4f | Add untracked campaigns.py | framework/auth/campaigns.py | framework/auth/campaigns.py | import httplib as http
from framework.exceptions import HTTPError
from website import mails
VALID_CAMPAIGNS = (
'prereg',
)
EMAIL_TEMPLATE_MAP = {
'prereg': mails.CONFIRM_EMAIL_PREREG
}
def email_template_for_campaign(campaign, default=None):
if campaign in VALID_CAMPAIGNS:
try:
ret... | Python | 0.000001 | |
96ed06f1f3dab3aa9d0f8150c41a5c1b943a86b0 | Add test for config module | frappe/tests/test_config.py | frappe/tests/test_config.py | # Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors
# License: MIT. See LICENSE
import unittest
import frappe
from frappe.config import get_modules_from_all_apps_for_user
class TestConfig(unittest.TestCase):
def test_get_modules(self):
frappe_modules = frappe.get_all("Module Def", filters={"app_n... | Python | 0.000002 | |
d7bfed84d773e7ccbd23e910a533f70b4dd02184 | Add module entrypoint | g2sd/__main__.py | g2sd/__main__.py | from .g2sd import cmd
if __name__ == "__main__":
cmd()
| Python | 0.000001 | |
7421cecfd6b304692eb19d76d3f90a61a950bc83 | add get_reviewers | get_reviewers.py | get_reviewers.py |
import sys
import urllib2
import time
from lxml import html
def get_reviewers(bookid, star=1):
allstar10_list = []
for tag in ['collections', 'doings', 'wishes']:
reached_end = False
i = 0
while not reached_end:
print "start %d" % i
pa... | Python | 0 | |
258a8d38d590f856e144b1e725fe38619c6758ea | Create notes_extractor.py | notes_extractor/notes_extractor.py | notes_extractor/notes_extractor.py | #!/usr/bin/env python3
###############################################################################
# Name : extract_notes.py #
# Version : v. 1.0.0.0 #
# Author : Abel Gancsos ... | Python | 0 | |
c0d135fc40142561e4a2409e47b34c367a6a7ef4 | add script to read device logs from rms dump | util/scripts/devicelogs.py | util/scripts/devicelogs.py | from rmsdump import *
def read_log_entry (log_entry):
return tuple(log_entry.val[i].val for i in range(0, 3))
def print_log (log_atom):
print '%s> %s: %s' % (log_atom[0].strftime('%Y-%m-%d %H:%M:%S'), log_atom[1], log_atom[2])
if __name__ == "__main__":
data = sys.stdin.read()
stream = DataStream(d... | Python | 0 | |
f1ccab2168dea1b0827f4ca929f0036e84170a76 | Add tests for cross domain xhr view | go/base/tests/test_views.py | go/base/tests/test_views.py | """Test for go.base.utils."""
from mock import patch, Mock
from django.core.urlresolvers import reverse
from go.base.tests.utils import VumiGoDjangoTestCase
class BaseViewsTestCase(VumiGoDjangoTestCase):
def cross_domain_xhr(self, url):
return self.client.post(reverse('cross_domain_xhr'), {'url': url})
... | Python | 0 | |
b67cc70a6cf04e605ad93933dd9d8a88db94f093 | add a simple flask app | backend/app.py | backend/app.py | from flask import Flask
import db
@app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
#db.process_db()
app = Flask(__name__)
app.run(debug=True)
| Python | 0.000002 | |
ce894232e3d8b00be3520f9f8d34ceb706b8dd75 | Create removelast2pagesofpdf.py | RemoverLast2PagesOfPDF/removelast2pagesofpdf.py | RemoverLast2PagesOfPDF/removelast2pagesofpdf.py | import PyPDF2, os
import sys
import CmdFormat
import shutil
CDMF = CmdFormat.CmdFormat("PDF分离器")
class PDFMerger(object):
"""docstring for PDFMerger"""
def __init__(self,ROOTPATH):
self.__ROOTPATH = ROOTPATH+"\\"
self.__countriesCount = 0
self.__currentCoutry=""
self.bRegenerate = True
def __messages(sel... | Python | 0.000001 | |
2b25b9ba1c9417e3e25a91055a65551210eb5313 | Add meal migrations | app/timetables/migrations/0002_meal.py | app/timetables/migrations/0002_meal.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-08-16 17:46
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('timetables', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | Python | 0.000003 | |
835d9628513a80215641bc4c63eae1fae7b8442b | rewrite portforwarding api | xos/api/utility/portforwarding.py | xos/api/utility/portforwarding.py | from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework import serializers
from rest_framework import generics
from rest_framework.views import APIView
from core.models import *
from django.forms import widgets
from djang... | Python | 0.000002 | |
33f43dd2e167afd40c4a5c516ae7cae35519b4c5 | Add partial output for testcases to comet | judge/bridge/judgecallback.py | judge/bridge/judgecallback.py | import logging
from .judgehandler import JudgeHandler
from judge.models import Submission, SubmissionTestCase
from judge.simple_comet_client import send_message
logger = logging.getLogger('judge.bridge')
class DjangoJudgeHandler(JudgeHandler):
def finish(self):
JudgeHandler.finish(self)
for id i... | import logging
from .judgehandler import JudgeHandler
from judge.models import Submission, SubmissionTestCase
from judge.simple_comet_client import send_message
logger = logging.getLogger('judge.bridge')
class DjangoJudgeHandler(JudgeHandler):
def finish(self):
JudgeHandler.finish(self)
for id i... | Python | 0.000011 |
f1826b2cf4c4103efe52713a57dc2fcabda1a45d | fix migration for real | kitsune/questions/migrations/0006_ios_questionlocale.py | kitsune/questions/migrations/0006_ios_questionlocale.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def create_questionlocale(apps, schema_editor):
Product = apps.get_model('products', 'Product')
QuestionLocale = apps.get_model('questions', 'QuestionLocale')
p, created = Product.objects.get_or_crea... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
def create_questionlocale(apps, schema_editor):
Product = apps.get_model('products', 'Product')
QuestionLocale = apps.get_model('questions', 'QuestionLocale')
p = Product.objects.get_or_create(slug='... | Python | 0.000001 |
c2e3e122560b8981079e1a89ff90fdf31c9eb8d1 | Reset timer on push. | astm/protocol.py | astm/protocol.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Alexander Shorin
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
import logging
from .asynclib import AsyncChat, call_later
from .records import HeaderRecord, Terminato... | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Alexander Shorin
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
import logging
from .asynclib import AsyncChat, call_later
from .records import HeaderRecord, Terminato... | Python | 0 |
4178691ed3826239721f2d9a6435ef90cfb5cf82 | Add color to input | flask_init/run.py | flask_init/run.py | #!/usr/bin/python
# -*- coding:utf-8 -*-
import os
import six
import templates
from .creator import Creator
from .exceptions import InvalidFolderName
def color_input(color, text):
return six.moves.input(color+text+'\033[0m')
def color_print(color, text):
six.print_(color+text+'\033[0m')
def main():
... | #!/usr/bin/python
# -*- coding:utf-8 -*-
import os
import six
import templates
from .creator import Creator
from .exceptions import InvalidFolderName
def main():
name = six.moves.input('Input project name (default is "flask_proj"): ')
name = name or 'flask_proj'
module = six.moves.input('Input module na... | Python | 0.000002 |
48933f27c098b05276271a62ed3c970e4d5721b0 | add missing file | src/radical/repex/utils.py | src/radical/repex/utils.py |
import radical.utils as ru
# ------------------------------------------------------------------------------
#
def expand_ln(to_link, src_sbox, tgt_sbox, rid, cycle):
expand = {'rid' : rid,
'cycle': cycle}
if not src_sbox: src_sbox = '.'
if not tgt_sbox: tgt_sbox = '.'
ret = list()
... | Python | 0.000003 | |
88788c215c619ab894e21243d584541f311dbfb9 | Add eventlet test check to new tests __init__.py | oslo_concurrency/tests/__init__.py | oslo_concurrency/tests/__init__.py | # Copyright 2014 Red Hat, Inc.
#
# 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 a... | Python | 0.000009 | |
112c3a5a7728aea9be59b4bab1c26932e5faceaf | replace simple_api.py, set filename via commandline param, git add files that dont exist | import_fusion.py | import_fusion.py | #!/usr/bin/python
import json
import requests
import sys
import codecs
import subprocess
from datetime import datetime
from optparse import OptionParser
if __name__ == "__main__":
parser = OptionParser()
parser.add_option("-f", dest="output_file", help="output filename (will be stored under the data/ directo... | Python | 0 | |
43d23f19933e898254d58c4874e6f0c0ac3b1cc6 | Add example config file | config-example.py | config-example.py | # Example configuration file for for Pyaiot
# Configuration options are shared between all pyaiot components.
# Debug
# Enable debug logging for all components.
#debug = False
# Broker host:
# Other component connect to this host for their broker connection. The
# dashboard passes this hostname to the clients for t... | Python | 0.000001 | |
783c3e740c154fb27b247b1cb8af5c853a8be973 | add basic_routing_test on experimental scenario | source/jormungandr/tests/routing_tests_experimental.py | source/jormungandr/tests/routing_tests_experimental.py | # Copyright (c) 2001-2015, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... | Python | 0.000001 | |
b1caa89d75aecc564d504e5baffd0dc7619cd587 | Create foursq_friends.py | foursq_friends.py | foursq_friends.py | import json
from foursq_utils import *
def fetch_usr_friends(user_id):
super_token = 'QEJ4AQPTMMNB413HGNZ5YDMJSHTOHZHMLZCAQCCLXIX41OMP'
url = 'https://api.foursquare.com/v2/users/' + str(user_id) + '/friends?oauth_token=' + super_token + '&v=20210115'
try:
raw = get_raw_info(url)
data = jso... | Python | 0.000028 | |
139524072cc56d19ce887aaa95705dff8a952cc2 | Add lc035_search_insert_position.py | lc035_search_insert_position.py | lc035_search_insert_position.py | """Leetcode 35. Search Insert Position
Easy
URL: https://leetcode.com/problems/search-insert-position/
Given a sorted array and a target value, return the index if the target is found.
If not, return the index where it would be if it were inserted in order.
You may assume no duplicates in the array.
Example 1:
Inpu... | Python | 0.000002 | |
1669cd22d6c8ee5bcb37c6770c98ddcf8848d901 | Make lots of xyz with differing natoms visualizable | pad-trajectory.py | pad-trajectory.py | #!/usr/bin/env python3
#
# Script to generate an ext-xyz trajectory from individual ext-xyz files with varying atom numbers using ASE.
# Appens 'X' atoms at origin to obtain frames with equal lengths
# by Patrick Melix
# 2020/06/08
#
from ase import io, Atom
import os
def main(inList, outFile='traj.xyz', outFormat='e... | Python | 0.000002 | |
900b09803f5c49b8645ba7f3d47eb17515061377 | Create heads_and_legs.py | heads_and_legs.py | heads_and_legs.py | #Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Heads and Legs
#Problem level: 8 kyu
def animals(heads, legs):
if heads==0 and legs==0:
return (0,0)
y = legs//2 - heads
x = heads-y
if x<0 or y<0 or legs%2!=0:
return "No solutions"
return (x,y)
| Python | 0.000431 | |
fed98c8a9723c6fe18c123015b51714dc4ccdf68 | add migrations | actual_play/migrations/0006_game_thumbnail.py | actual_play/migrations/0006_game_thumbnail.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-10-20 22:45
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('actual_play', '0005_auto_20161010_1313'),
]
operations = [
migrations.AddFie... | Python | 0.000001 | |
5c9ffc4a0ab9f8aed3071a0bf4ad0fc69070b628 | Create inside_market.py | inside_market.py | inside_market.py | import pandas as pd
import numpy as np
# update current state of our bid and ask
# iterate thru each trade and determine if a fill was generated
# id
# price
# qty
# side - bid/ask
# status - live, canceled, rejected
LIVE = 0
CANCELED = 1
REJECTED = 2
FILLED = 3
PARTIAL = 4
BID = 5
ASK = 6
MINUS_I... | Python | 0.000059 | |
0dd3894fb8816f6f904e5c7d204ab2672b304588 | Add earth mesh module | gravity_waves/earth_mesh.py | gravity_waves/earth_mesh.py | from __future__ import absolute_import, print_function, division
from firedrake import *
__all__ = ["generate_earth_mesh"]
def generate_earth_mesh(r_level, num_layers, thickness, hexes=False):
"""Generates an Earth-like spherical mesh for the gravity wave
problem.
:arg r_level: An ``int`` denoting the... | Python | 0 | |
5578d11f45e9c41ab9c4311f2bed48b9c24d9bf5 | Create file for Nonterminal have method | tests/grammar_term-nonterm_test/NonterminalHaveTest.py | tests/grammar_term-nonterm_test/NonterminalHaveTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
""" | Python | 0.000001 | |
b40c6ce73c439e7d74b867702fdd2c4cd7ad8b15 | add testrunner to automactically create/delete a test db during python and django tests. | couchdbkit/ext/django/testrunner.py | couchdbkit/ext/django/testrunner.py | from django.test.simple import DjangoTestSuiteRunner
from django.conf import settings
from couchdbkit.ext.django import loading as loading
from couchdbkit.resource import ResourceNotFound
class CouchDbKitTestSuiteRunner(DjangoTestSuiteRunner):
"""
A test suite runner for couchdbkit. This offers the exact same... | Python | 0 | |
159156cb962ad0c8f4ea6f022471c75f33306f7e | Add unit tests for snapshots_client | tempest/tests/services/compute/test_snapshots_client.py | tempest/tests/services/compute/test_snapshots_client.py | # Copyright 2015 NEC Corporation. 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 ... | Python | 0.000001 | |
913c9a10b2eb3b3d9de108a82a3251b2c0de0e10 | Add test for Hostname object | cybox/test/objects/hostname_test.py | cybox/test/objects/hostname_test.py | # Copyright (c) 2014, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import unittest
from cybox.objects.hostname_object import Hostname
from cybox.test.objects import ObjectTestCase
class TestHostname(ObjectTestCase, unittest.TestCase):
object_type = "HostnameObjectType"
k... | Python | 0 | |
514aca20c6f076a86819d7180f36c3b2e8bcc33b | Add integration test checking compatibility of Keras models with TF optimizers. | tests/integration_tests/test_tensorflow_integration.py | tests/integration_tests/test_tensorflow_integration.py | from __future__ import print_function
import os
import tempfile
import pytest
import keras
from keras import layers
from keras.utils.test_utils import get_test_data
from keras.utils.test_utils import keras_test
@pytest.mark.skipif(keras.backend.backend() != 'tensorflow', reason='Requires TF backend')
@keras_test
def... | Python | 0 | |
ebffda0ec0f2619ad1071bb1d00d87ce08d59498 | Add support for SymDIVINE tool | benchexec/tools/symdivine.py | benchexec/tools/symdivine.py | """
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2015 Dirk Beyer
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
... | Python | 0 | |
3840fbe6ca33e48b9bdbd78e85830a13606f612c | Create efi-smc.py | efi-smc.py | efi-smc.py | #!/usr/bin/python
from lxml import html
import requests
# Get the EFI/SMC table from Apple's Website
page = requests.get('http://support.apple.com/en-us/HT1237')
tree = html.fromstring(page.text)
# Count the number of rows which will be used in looping
rows = tree.xpath('//*[@id="kbtable"]/tbody/tr')
# For each row:... | Python | 0.000001 | |
29d58850f54476003b96822c7f46998d3ce6c44d | Update SQLite DB with modified grades from the given filesystem tree | bin/update_db.py | bin/update_db.py |
__author__ = 'Gheorghe Claudiu-Dan, claudiugh@gmail.com'
import sqlite3
import os
from time import *
from stat import *
VMCHECKER_ROOT_ENVAR = 'VMCHECKER_ROOT'
VMCHECKER_DB_NAME = 'vmchecker.db'
GRADE_VALUE_FILE = 'NOTA'
if not os.environ.has_key(VMCHECKER_ROOT_ENVAR):
print "Error: ", VMCHECKER_... | Python | 0.999998 | |
cdc6b62400f66d1b2747b5668a6618c961deb962 | create game class | powerball/game.py | powerball/game.py | #!/usr/bin/env python
from collections import Counter
from .player import Player
class Game:
def __init__(self, players=None):
"""
Initialize the game instance.
players may be initialized by argument or by calling the begin method.
winning_numbers is initialized with an empty list... | Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.