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 |
|---|---|---|---|---|---|---|---|
c658aeed099b4ac85ae4a5868e9e2c9d4d96e335 | Create downloadBingWallpaperNew.pyw | downloadBingWallpaperNew.pyw | downloadBingWallpaperNew.pyw | #!/usr/bin/env python
# -- coding: utf-8 --
import urllib,re,urllib.request,os,win32api,win32gui
from win32api import *
from win32gui import *
import win32con
import sys
import struct
import time
import json
class WindowsBalloonTip:
def __init__(self, title, msg):
message_map = {
win32con.W... | Python | 0 | |
93548efe9eb04dd9659e3cc76c711d967e8770df | Create filereader.py | filereader.py | filereader.py | #!/usr/bin/python
import os
import re
from optparse import OptionParser
SUFFIX=".out"
def main () :
global filename
parser = OptionParser()
parser.add_option("-f", "--file", dest="filename",
help="the file to update", metavar="FILE")
parser.add_option("-n", "--name", dest="name",
... | Python | 0 | |
23ab301f4773892f6db7321105f79ba0c48404a3 | add urls | src/doc/expedient/source/developer/sshaggregate/urls.py | src/doc/expedient/source/developer/sshaggregate/urls.py | from django.conf.urls.defaults import *
urlpatterns = patterns('sshaggregate.views',
url(r'^aggregate/create/$', 'aggregate_crud', name='sshaggregate_aggregate_create'),
url(r'^aggregate/(?P<agg_id>\d+)/edit/$', 'aggregate_crud', name='sshaggregate_aggregate_edit'),
url(r'^aggregate/(?P<agg_id>\d+)/servers... | Python | 0.000006 | |
fed2e3f9bdb3a00b077b5e7df1aed4d927b77b6c | Add test for Clifford drudge by quaternions | tests/clifford_test.py | tests/clifford_test.py | """Test for the Clifford algebra drudge."""
from drudge import CliffordDrudge, Vec, inner_by_delta
def test_clifford_drudge_by_quaternions(spark_ctx):
"""Test basic functionality of Clifford drudge by quaternions.
"""
dr = CliffordDrudge(
spark_ctx, inner=lambda v1, v2: -inner_by_delta(v1, v2)
... | Python | 0 | |
09a0689b8e521c1d5c0ea68ac448dc9ae7abcff5 | Read the header of a fits file and/or look up a single key (case insensitive). | fitsHeader.py | fitsHeader.py | #!/usr/bin/env python
# -*- coding: utf8 -*-
# My imports
from __future__ import division
from astropy.io import fits
from pydoc import pager
import argparse
def _parser():
parser = argparse.ArgumentParser(description='View the header of a fits file')
parser.add_argument('input', help='File name of fits file... | Python | 0 | |
b674f921a8e5cffb2d3e320f564c61ca01455a9f | Add command to generate a csv of talk titles and video reviewers | wafer/management/commands/wafer_talk_video_reviewers.py | wafer/management/commands/wafer_talk_video_reviewers.py | import sys
import csv
from django.core.management.base import BaseCommand
from django.contrib.auth import get_user_model
from wafer.talks.models import Talk, ACCEPTED, PROVISIONAL
class Command(BaseCommand):
help = ("List talks and the associated video_reviewer emails."
" Only reviewers for accepted... | Python | 0.000011 | |
3db3c22d83071550d8bbd70062f957cf43c5e54a | Add a compatibility module, because of Python 2/3 compatibility issues. | cart/_compatibility.py | cart/_compatibility.py | import sys
is_py3 = sys.version_info[0] >= 3
def utf8(string):
"""Cast to unicode DAMMIT!
Written because Python2 repr always implicitly casts to a string, so we
have to cast back to a unicode (and we now that we always deal with valid
unicode, because we check that in the beginning).
"""
if ... | Python | 0 | |
156b7dfc11f24a7d77d2280e8ddade3cb7a474b7 | Add a script for listing all Elasticsearch indexes | misc/list_all_es_indexes.py | misc/list_all_es_indexes.py | #!/usr/bin/env python
# -*- encoding: utf-8
import boto3
import hcl
import requests
def get_terraform_vars():
s3_client = boto3.client("s3")
tfvars_body = s3_client.get_object(
Bucket="wellcomecollection-platform-infra",
Key="terraform.tfvars"
)["Body"]
return hcl.load(tfvars_body)
... | Python | 0 | |
006a921f19f6c4f64d694c86346ad85ada2c8bb8 | Add tests for subclass support | tests/subclass_test.py | tests/subclass_test.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vi:ts=4:et
try:
import unittest2 as unittest
except ImportError:
import unittest
import pycurl
CLASSES = (pycurl.Curl, pycurl.CurlMulti, pycurl.CurlShare)
class SubclassTest(unittest.TestCase):
def test_baseclass_init(self):
# base classes do not a... | Python | 0 | |
c8816f509a661ed53c166d843ebfb7dcb6b8d75a | use only single threaded svrlight | examples/undocumented/python_modular/regression_svrlight_modular.py | examples/undocumented/python_modular/regression_svrlight_modular.py | ###########################################################################
# svm light based support vector regression
###########################################################################
from numpy import array
from numpy.random import seed, rand
from tools.load import LoadMatrix
lm=LoadMatrix()
traindat = lm... | ###########################################################################
# svm light based support vector regression
###########################################################################
from numpy import array
from numpy.random import seed, rand
from tools.load import LoadMatrix
lm=LoadMatrix()
traindat = lm... | Python | 0 |
7327250621dc34a1e7c2f1998333d65024583168 | add simple test | tests/test_commands.py | tests/test_commands.py | # Copyright 2014 Rackspace, 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... | Python | 0.00057 | |
2b2f11cc7650fc5c40cd21a6e8ad671656fc9b21 | add quicksort | quicksort.py | quicksort.py | '''
QuickSort implementation
'''
def quick_sort(arr, l, r):
i = l
j = r
x = arr[(l + r) / 2]
if len(arr) == 0:
return arr
else:
while True:
while arr[i] < x:
i += 1
while arr[j] > x:
j -= 1
if i <= j:
... | Python | 0.00001 | |
ef76498542aec046c2307562db01e4764ae68b50 | Add gce_resize | gce_resize.py | gce_resize.py | #!/usr/bin/env python
# import section
import argparse, os, time
from googleapiclient import discovery
from oauth2client.service_account import ServiceAccountCredentials
from pprint import pprint
# functions
def get_instanceGroup(service, project,zone, instanceGroup):
"""
Returns instance group object.
... | Python | 0.000012 | |
b102a2769dc70deb2055a2d4ae0bf11f48c13f9d | add game window | core/core.py | core/core.py | # -*- coding: utf-8 -*-
import pygame
from pygame.locals import *
class App:
def __init__(self):
self._running = True
self._display_surf = None
self.size = self.weight, self.height = 1024, 576
def on_init(self):
pygame.init()
self._display_surf = pygame.display.set_mode... | Python | 0.000001 | |
fb6dd1a92471697b8665364dfaa7fedc519d00ed | Create properties.py | data/properties.py | data/properties.py | import libtcodpy as libtcod
class Object():
def __init__(self, x, y, char, color, screen):
self.x = x
self.y = y
self.char = char
self.color = color
self.screen = screen
def draw_object(self):
#Set the color of the character and draw it
libtcod.console_s... | Python | 0.000001 | |
a2ba0c1658850064f55de1a99c3c2a49ef847b8d | Add join_by draft | drafts/join_by.py | drafts/join_by.py | def join_by(op, dicts, start=EMPTY):
dicts = list(dicts)
if not dicts:
return {}
elif len(dicts) == 1:
return dicts[0]
result = {}
for d in dicts:
for k, v in iteritems(d):
if k in result:
result[k] = op(result[k], v)
else:
... | Python | 0 | |
79602383ece3835e6ed94d14f3254190104bd03d | Fix aliases with bash | thefuck/shells/bash.py | thefuck/shells/bash.py | import os
from ..conf import settings
from ..const import ARGUMENT_PLACEHOLDER
from ..utils import memoize
from .generic import Generic
class Bash(Generic):
def app_alias(self, alias_name):
# It is VERY important to have the variables declared WITHIN the function
return '''
function {n... | import os
from ..conf import settings
from ..const import ARGUMENT_PLACEHOLDER
from ..utils import memoize
from .generic import Generic
class Bash(Generic):
def app_alias(self, alias_name):
# It is VERY important to have the variables declared WITHIN the function
return '''
function {n... | Python | 0.000001 |
0d8bfef0a629f6f8fb07415df21812eb1d458cde | Remove unnecessary lines after Android gyp fix Review URL: https://codereview.appspot.com/6353066 | gyp/bench.gyp | gyp/bench.gyp | # GYP file to build performance testbench.
#
{
'includes': [
'apptype_console.gypi',
],
'targets': [
{
'target_name': 'bench',
'type': 'executable',
'include_dirs' : [
'../src/core',
'../src/gpu',
],
'includes': [
'bench.gypi'
],
'dependenc... | # GYP file to build performance testbench.
#
{
'includes': [
'apptype_console.gypi',
],
'targets': [
{
'target_name': 'bench',
'type': 'executable',
'include_dirs' : [
'../src/core',
'../src/gpu',
],
'includes': [
'bench.gypi'
],
'dependenc... | Python | 0.000264 |
235cc3a7529b36e11a7935e15c90f496210d7c31 | implement method for generating request signature | scup/auth.py | scup/auth.py | import hashlib
import time
def get_request_signature(private_key):
current_time = int(time.time())
message = '{}{}'.format(current_time, private_key)
digest = hashlib.md5(message).hexdigest()
return current_time, digest
| Python | 0 | |
5834f2e259834b325cf076b36af634dc6b64f442 | Add info if not parsed | intelmq/bots/parsers/generic/parser.py | intelmq/bots/parsers/generic/parser.py | from intelmq.lib.bot import Bot, sys
from intelmq.lib.message import Event
from intelmq.bots import utils
import re
class GenericBot(Bot):
# Generic parser, will simply parse and add named group to event
# for example if you have the regex :
# '^\s*(?P<ip>(?:(?:\d){1,3}\.){3}\d{1,3})'
# You will have an item 'ip' in ... | from intelmq.lib.bot import Bot, sys
from intelmq.lib.message import Event
from intelmq.bots import utils
import re
class GenericBot(Bot):
# Generic parser, will simply parse and add named group to event
# for example if you have the regex :
# '^\s*(?P<ip>(?:(?:\d){1,3}\.){3}\d{1,3})'
# You will have an item 'ip' in ... | Python | 0 |
9b5590458463744597da1769694e826ed9c27414 | Comment failing doctests. | scikits/learn/utils/crossval.py | scikits/learn/utils/crossval.py | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD Style.
# $Id$
import exceptions
import numpy as np
def leave_one_out(n):
"""
Leave-One-Out cross validation:
Provides train/test indexes to split data in train test sets
Parameters
===========
n: int
Total num... | # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# License: BSD Style.
# $Id$
import exceptions
import numpy as np
def leave_one_out(n):
"""
Leave-One-Out cross validation:
Provides train/test indexes to split data in train test sets
Parameters
===========
n: int
Total num... | Python | 0 |
7490c39f958291cc99913d0f36581439d8efdf77 | Add a command to fix candidate image metadata | candidates/management/commands/candidates_fix_image_metadata.py | candidates/management/commands/candidates_fix_image_metadata.py | from PIL import Image
from hashlib import md5
import re
import requests
import sys
from StringIO import StringIO
from candidates.popit import PopItApiMixin, popit_unwrap_pagination
from candidates.update import fix_dates
from moderation_queue.views import PILLOW_FORMAT_MIME_TYPES
from django.core.management.base impo... | Python | 0.999987 | |
ae66cf3153f7285d3ff4430af79c380881b2eb32 | Add a very primitive clang based multifile 'delta'. - Interface is more or less like multidelta. | utils/token-delta.py | utils/token-delta.py | #!/usr/bin/env python
import os
import re
import subprocess
import sys
import tempfile
###
class DeltaAlgorithm(object):
def __init__(self):
self.cache = set()
def test(self, changes):
abstract
###
def getTestResult(self, changes):
# There is no reason to cache successful t... | Python | 0.003954 | |
d046968c5b16239b4ce3fbe17b6359339f3e7b9b | Add vcf convertor | utils/vcf_convertor.py | utils/vcf_convertor.py | #! -*- coding: utf-8 -*-
import re
import json
person_patten = re.compile(r'BEGIN:VCARD(.*?)END:VCARD', re.DOTALL)
fullname_patten = re.compile(r'FN:(.*?)\n')
mobile_patten = re.compile(r':\+*?(\d{9}\d*?)\n')
f = open(r'iCloud vCard.vcf')
fc = f.read()
people = person_patten.findall(fc)
names = {}
for p in people:
... | Python | 0.000001 | |
3a1b4ceb2ae989495d2453c612ac6645fdf59726 | Create cisco_vlan_extract.py | cisco/cisco_vlan_extract.py | cisco/cisco_vlan_extract.py | from ciscoconfparse import CiscoConfParse as ccp
def extract_vlan(vlans):
"""
Will convert ACTIVE vlans in the 'show vlan' command .....
switch#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1... | Python | 0.000049 | |
08d66a82ea47832654aa17f0323df6ce57691fcb | add setup.py | verdenskart/setup.py | verdenskart/setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name="bokeh-worldmap",
version="0.1.0",
packages=find_packages("src"),
package_data={},
package_dir={"": "src"},
entry_points={"console_scripts": []},
)
| Python | 0.000001 | |
d33bd223ec35712d0aa9e4ab3da83a19cf1a1120 | Create httpclient.py | httpclient.py | httpclient.py | #!/usr/bin/env python
# coding: utf-8
# Copyright 2013 Abram Hindle
#
# 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 b... | Python | 0.000001 | |
5bb7d25765655f83c42b5e7abc1093f7f85f7950 | bump version to 0.8.16 | mycroft/version/__init__.py | mycroft/version/__init__.py | # Copyright 2016 Mycroft AI, Inc.
#
# This file is part of Mycroft Core.
#
# Mycroft Core 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 versio... | # Copyright 2016 Mycroft AI, Inc.
#
# This file is part of Mycroft Core.
#
# Mycroft Core 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 versio... | Python | 0 |
bfc6083d9f08e33ec1f96fe66252915da4e1a0d8 | Test suite | minusconf_test.py | minusconf_test.py | #!/usr/bin/env python
import unittest
import minusconf
import socket
import time
class MinusconfUnitTest(unittest.TestCase):
def setUp(self):
sharp_s = chr(223)
self.svc1 = minusconf.Service('-conf-test-service', 'strangeport', 'some name')
self.svc2 = minusconf.Service('-conf-test-service' + sharp_s, 'strange... | Python | 0.000001 | |
32a1781bb5ba4f143e5910fbd841ca6aeeebc8fe | Add test script for color histogram matcher | jsk_2015_05_baxter_apc/node_scripts/test_color_histogram_matcher.py | jsk_2015_05_baxter_apc/node_scripts/test_color_histogram_matcher.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""This script is to test color histogram & its matcher
Usage
-----
$ # to extract color histogram
$ roslaunch jsk_2014_picking_challenge extract_color_histogram.launch
input_image:=/test_color_histogram/train_image
$ rosrun jsk_2014_picking_challeng... | Python | 0 | |
3088fcd2d42b4e59601c103cc01cec1d949f6f57 | Improve OldPersian | ielex/lexicon/migrations/0093_fix_oldPersian.py | ielex/lexicon/migrations/0093_fix_oldPersian.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
def forwards_func(apps, schema_editor):
'''
OldPersian doesn't have lexemes for some meanings.
This migration generates them.
'''
# Models to work with:
Language = apps.get_model('lexicon', 'Langua... | Python | 0 | |
6516b73210a575376bc78005ae28c0e843303b24 | add theano how-to-perform | Theano/how-to-perform-stencil-computations-element-wise-on-a-matrix-in-theano.py | Theano/how-to-perform-stencil-computations-element-wise-on-a-matrix-in-theano.py | import numpy as np
import theano
import theano.tensor as T
from theano.tensor.nnet import conv2d
# original image 3D (3x3x4) (RGB Channel, height, width)
img = [[[1, 2, 3, 4],
[1, 1, 3, 1],
[1, 3, 1, 1]],
[[2, 2, 3, 4],
[2, 2, 3, 2],
[2, 3, 2, 2]],
[[3, 2, 3, 4],
[3, 3,... | Python | 0.000071 | |
a99f0678815c2e998c25a0aaf9f2c79ad0d18610 | Add package 'ui' | source/ui/__init__.py | source/ui/__init__.py | # -*- coding: utf-8 -*-
## \package ui
# MIT licensing
# See: LICENSE.txt
| Python | 0.000034 | |
00b995719aaf11c2d7c3126e29b94b74f0edf8d2 | add test | osf_tests/test_downloads_summary.py | osf_tests/test_downloads_summary.py | # encoding: utf-8
import mock
import pytest
import pytz
import datetime
from django.utils import timezone
from addons.osfstorage import utils
from addons.osfstorage.tests.utils import StorageTestCase
from osf_tests.factories import ProjectFactory
from scripts.analytics.download_count_summary import DownloadCountSum... | Python | 0.000002 | |
d764a483497afc5d029a82db14cc5cc88f45f4c0 | Add an extension to allow for an addFixedIp action on instances | nova/api/openstack/contrib/multinic.py | nova/api/openstack/contrib/multinic.py | # Copyright 2011 OpenStack LLC.
# 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 b... | Python | 0 | |
c13d1347889cf574d3e6b9b835dadbca5fdc2d6c | Add wheel module for the salt key system | salt/wheel/key.py | salt/wheel/key.py | '''
Wheel system wrapper for key system
'''
import salt.key
def list_all():
'''
List the keys under a named status
'''
skey = salt.key.Key(__opts__)
return skey.list_all()
def accept(match):
'''
Accept keys based on a glob match
'''
skey = salt.key.Key(__opts__)
return skey.ac... | Python | 0 | |
c0ebb74ad0ee2eb210266e3610e0b44474628872 | add ismount function from python Lib/posixpath.py | lib/ansible/module_utils/ismount.py | lib/ansible/module_utils/ismount.py | # This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is based on
# Lib/posixpath.py of cpython
# It is licensed under the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
#
# 1. This LICENSE AGREEMENT is between the Python Software Foundation
# ("PSF")... | Python | 0.000004 | |
95a8ed6dcb19f322c9a14957da207efb8be10f5d | Customize makemessages to support ignoring fuzzy | hqscripts/management/commands/makemessages.py | hqscripts/management/commands/makemessages.py | from django.core.management.commands import makemessages
class Command(makemessages.Command):
def add_arguments(self, parser):
super().add_arguments(parser)
parser.add_argument('--no-fuzzy', action='store_true', help='Remove fuzzy strings.')
def handle(self, *args, **options):
no_fuzz... | Python | 0 | |
1bd6d53c7ab8d7b2c2fdfbb8eb2fab2e1cfa1537 | Implement statistics & logger class | mugloar/logger.py | mugloar/logger.py | from datetime import datetime
from tabulate import tabulate
import sys
RED = "\033[1;31m"
BLUE = "\033[1;34m"
CYAN = "\033[1;36m"
GREEN = "\033[0;32m"
RESET = "\033[0;0m"
BOLD = "\033[;1m"
class Logger:
stats = {'NMR': {'win': 0, 'lose': 0},
'FUNDEFINEDG': {'win': 0, 'lose': 0},
'H... | Python | 0 | |
597a1c12223fec5deefcd31b3a00b06d1095b32d | Add check replication step | dbaas/workflow/steps/util/region_migration/check_replication.py | dbaas/workflow/steps/util/region_migration/check_replication.py | # -*- coding: utf-8 -*-
import logging
from util import full_stack
from workflow.steps.util.base import BaseStep
from workflow.exceptions.error_codes import DBAAS_0020
from time import sleep
LOG = logging.getLogger(__name__)
class CheckReplication(BaseStep):
def __unicode__(self):
return "Checking replic... | Python | 0 | |
fb6c84e7703092f495324fe57041717403803e7f | Add scrape_symbols.py placeholder. | scrape_symbols.py | scrape_symbols.py | #!/usr/bin/env python
# encoding: utf-8
def main():
pass
if __name__ == '__main__':
main()
| Python | 0 | |
fe479bf2a8ec547922c6643bbdf0ba768eb79c9d | Add script to simulate multiple games | ludo/simulator.py | ludo/simulator.py | #!/usr/bin/env python3
from game import Game
print("Welcome to a game of ludo!")
average_throw_counter = 0
min_throws_per_game = 10000000
max_throws_per_game = 0
NUM_GAMES = 100
for i in range(0, NUM_GAMES):
game = Game()
throw_counter = 0
while game.next_move():
throw_counter += 1
average... | Python | 0 | |
b5b21a151b219ae5f9a017ea0bda95c1d0be92ca | Fix Csv validation | tools/telemetry/telemetry/csv_page_benchmark_results.py | tools/telemetry/telemetry/csv_page_benchmark_results.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page_benchmark_results import PageBenchmarkResults
class CsvPageBenchmarkResults(PageBenchmarkResults):
def __init__(self, results_write... | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page_benchmark_results import PageBenchmarkResults
class CsvPageBenchmarkResults(PageBenchmarkResults):
def __init__(self, results_write... | Python | 0.000011 |
a8f172752a72d93537820322b9ce62b601be6c5f | Fix cpplint warning. | script/cpplint.py | script/cpplint.py | #!/usr/bin/env python
import fnmatch
import os
import subprocess
import sys
IGNORE_FILES = [
'browser/atom_application_mac.h',
'browser/atom_application_delegate_mac.h',
'browser/native_window_mac.h',
'browser/resources/win/resource.h',
'browser/ui/cocoa/event_processing_window.h',
'browser/ui/cocoa/atom_... | #!/usr/bin/env python
import fnmatch
import os
import subprocess
import sys
IGNORE_FILES = [
'app/win/resource.h',
'browser/atom_application_mac.h',
'browser/atom_application_delegate_mac.h',
'browser/native_window_mac.h',
'browser/ui/cocoa/event_processing_window.h',
'browser/ui/cocoa/atom_menu_controlle... | Python | 0 |
334aa288fc38636f10e25b0d8ab4ecb91d198c9b | Add example SNP analysis script. | examples/nature_protocols/phylogeny/summarize_heterozygosity.py | examples/nature_protocols/phylogeny/summarize_heterozygosity.py | #!/usr/bin/python
#
# Copyright (c) 2012 Mikkel Schubert <MSchubert@snm.ku.dk>
#
# 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
#... | Python | 0 | |
4c5e4cb960a266482dac21eaeb0b568359c58b39 | Add py-backcall (#8701) | var/spack/repos/builtin/packages/py-backcall/package.py | var/spack/repos/builtin/packages/py-backcall/package.py | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | Python | 0.000001 | |
7975ef9f34cc578de968e1a1c8e6f731c164641a | Create 1.5_countstrings.py | CrackingCodingInterview/1.5_countstrings.py | CrackingCodingInterview/1.5_countstrings.py | """
given a string, return a string counting all the occurences
of each character if the count > 1
"""
def compress(string_to_compress):
if len(string_to_compress) < 2
return string_to_compress
groups = []
previous_character = string_to_compress[0]
counter = 1
for c in string_to_compres... | Python | 0.001266 | |
c89cce1a47c1e379958d7cced624ec0317cd3407 | Add demo for non-blocking with poll(). | examples/demo3.py | examples/demo3.py | import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
import logging
import threading
import xmpp2
import time
import select
from xmpp2 import XML
# non-blocking, poll example.
USERNAME = 'yourusername'
PASSWORD = 'yourpassword'
SERVER = 'example.com'
logging.basicConfig(level=logging... | Python | 0 | |
bb1ce480184d4e78f121f9e473e58f47b80de53a | Create FirstLinuxFile.py | FirstLinuxFile.py | FirstLinuxFile.py | #!/usr/bin
| Python | 0 | |
be5db45702c01aadb5ac323cbb6b0ef53c5d1d4c | add mobility/debug.py | mobility/debug.py | mobility/debug.py | #!/usr/bin/python
#coding:utf-8
import numpy as np
import math
import sys
import os
import time
import matplotlib.pyplot as plt
from pprint import pprint
import matplotlib.animation as animation
import cPickle as pickle
from copy import deepcopy
def load_coordiantes(file_path):
with open(file_path, 'rb') as... | Python | 0.000001 | |
f724f5b488f23a6ceb2314aa18933b5fac3f5aab | Add courseware migration. | lms/djangoapps/courseware/migrations/0013_auto_20191001_1858.py | lms/djangoapps/courseware/migrations/0013_auto_20191001_1858.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.25 on 2019-10-01 18:58
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('courseware', '0012_adjust_fields'),
]
operations = [
migrations.AlterModelOptions(... | Python | 0 | |
1e65555a08ff3ee1a06e92d9dd054abf3cfaf711 | Add a migration to update to final tree fields | media_tree/migrations/0003_alter_tree_fields.py | media_tree/migrations/0003_alter_tree_fields.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('media_tree', '0002_mptt_to_treebeard'),
]
operations = [
migrations.AlterField(
model_name='filenode',
... | Python | 0 | |
fb5f6bf999b2cd8b674bc2c89f74f1413fc8ee1e | Add command line interface to play | command_line_tic_tac_toe.py | command_line_tic_tac_toe.py | #!/usr/bin/env python3
import cmd
from tictactoe.ai_player import AIPlayer
from tictactoe.human_player import HumanPlayer
from tictactoe.game_controller import GameController
from tictactoe.board_stringification import BoardStringification
class CommandLineTicTacToe(cmd.Cmd):
def __init__(self,
i... | Python | 0.000001 | |
f91db461b5745689ed356dd740ed7ff3b27524e4 | Add page base classes | feincms3/pages.py | feincms3/pages.py | from __future__ import unicode_literals
from django.core.urlresolvers import reverse
from django.core.validators import RegexValidator
from django.db import models
from django.db.models import signals
from django.dispatch import receiver
from django.utils.encoding import python_2_unicode_compatible
from django.utils.t... | Python | 0.000001 | |
6d59e6d37d6f33f3513a1c6b1cb7d0d9062f391e | Create ClassesandInstances.py | EmployeeManagementSystem/Findings/ClassesandInstances.py | EmployeeManagementSystem/Findings/ClassesandInstances.py | #Creating and instantiating python classes
#classes - they allow us to logically group data(attributes) and functions (methods)
'''class Employee:
pass
print ("Class (Blueprint) vs Instance")
emp1 = Employee()
emp2 = Employee()
print (emp1)
print (emp2)
print ("instance variables contains data unique to each insta... | Python | 0 | |
86618e2e30aa4a129041bd2b6b8c312b00de9ce5 | use separate modules for netlink | shadow/netlink.py | shadow/netlink.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import struct
import os
# Flag values
NLM_F_REQUEST = 1
NLM_F_MULTI = 2
NLM_F_ACK = 4
NLM_F_ECHO = 8
NLM_F_DUMP_INTR = 16
# Modifiers to GET request
NLM_F_ROOT = 0x100
NLM_F_MATCH = 0x200
NLM_F_ATOMIC = 0x400
NLM_F_DUMP = (NLM_F_ROOT | ... | Python | 0 | |
ec22c2d82ff4f045b992014d17ada850359c2ab6 | change folder layout | patterning_algorithm/color_halftone.py | patterning_algorithm/color_halftone.py | # This program takes a raster color image and produces its raster color halftone using patterning algorithm .
# Split the image into C, M, Y, K.
# Rotate each separated image by 0, 15, 30, and 45 degrees respectively.
# Take the half-tone of each image (dot size will be proportional to the intensity).
# Rotate back eac... | Python | 0.000001 | |
eced1499c4b82ce83f954a0364b02f2116a11326 | Add quick verification checker. | src/Scripts/verify.py | src/Scripts/verify.py | # Take a ground truth file produced by the verifier and a match file and compare them.
# Output is in fully normalized format, the same as VerifyCommand.cpp produces.
#
# TODO: remove hardcoded paths.
# file format:
# term,docId,[0-3]
# 0: true positive
# 1: false postive
# 2: false negative
# 3: unverified
from col... | Python | 0 | |
d16d66e520c5f80870957c63694708118d6f9f69 | Add module for MOC (music on console) | i3pystatus/moc.py | i3pystatus/moc.py | import re
from i3pystatus import IntervalModule
from i3pystatus import formatp
from i3pystatus.core.command import run_through_shell
from i3pystatus.core.util import TimeWrapper
class Moc(IntervalModule):
"""
Display various information from MOC (musci on console)
.. rubric:: Available formatters
*... | Python | 0 | |
b1ef133904540b7f49e22ac52a0f844963be829e | Add basic test for discovery loader | nose2/tests/functional/test_discovery_loader.py | nose2/tests/functional/test_discovery_loader.py | from nose2.tests._common import FunctionalTestCase, support_file
from nose2 import events, loader, session
from nose2.plugins.loader.discovery import DiscoveryLoader
class Watcher(events.Plugin):
def __init__(self):
self.called = []
def loadTestsFromModule(self, event):
self.called.append(eve... | Python | 0 | |
2de3ab69c0725312663ecd94378c5b267a6c5ab1 | Add graph_data.py with a graph_ratings function | graph_data.py | graph_data.py | """Graph properties and patterns of the raw data
.. moduleauthor:: Jan Van Bruggen <jancvanbruggen@gmail.com>
"""
import matplotlib.pyplot as plt
def graph_ratings():
num_points = 1e5
ratings = rating_counts('data/mu/all.dta', num_points)
rating_numbers = sorted(ratings.keys())
x = [i - 0.4 for i in ... | Python | 0.000053 | |
7a861623987225bd786301dfe6dea78173ddaf1a | Create generator.py | Testing_Hadoop/generator.py | Testing_Hadoop/generator.py | import time
start_time = time.time()
fo = open("hadoop_test_data.txt", "wb")
for i in range(0,9):
for i in range(0,10000000):
fo.write("Hadoop ");
fo.close()
print("--- %s seconds ---" % (time.time() - start_time))
| Python | 0.000001 | |
7c782954134bbfb7603af7cefd265f85afaf081e | add version.py back | grizli/version.py | grizli/version.py | # Autogenerated by Astropy-affiliated package grizli's setup.py on 2019-10-31 17:36:12 UTC
import datetime
import locale
import os
import subprocess
import warnings
__all__ = ['get_git_devstr']
def _decode_stdio(stream):
try:
stdio_encoding = locale.getdefaultlocale()[1] or 'utf-8'
except ValueErro... | Python | 0 | |
963aa3fd9830d1a4817a26a2e8a5676174e30d19 | Add new migration | planner/migrations/0005_auto_20150711_1117.py | planner/migrations/0005_auto_20150711_1117.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('planner', '0004_auto_20150616_1926'),
]
operations = [
migrations.RenameField(
model_name='route',
o... | Python | 0 | |
ea9b6920c88ac40a72aadd70199a52f27a1c097e | Create RespostaListar.py | backend/Models/Predio/RespostaListar.py | backend/Models/Predio/RespostaListar.py | from Framework.Resposta import Resposta
from Models.Predio.Predio import Predio as ModelPredio
class RespostaListar(Resposta):
def __init__(self,predios):
self.corpo = []
for predio in predios:
self.corpo.append(ModelPredio(predio))
| Python | 0 | |
87804aef17874339e7b58df0c3bcb29338fa412a | add country regions include Minsk | belarus_region_borders_include_minsk.py | belarus_region_borders_include_minsk.py | from _helpers import cursor_wrap, dump
@cursor_wrap
def main(cursor):
sql = """
SELECT r.osm_id, c.name AS country, r.name AS region, ST_AsGeoJSON(r.way)
FROM osm_polygon c
LEFT JOIN osm_polygon r ON ST_Contains(c.way, r.way)
WHERE c.osm_id = -59065 AND r.admin_level = '4'
... | Python | 0.999999 | |
b5bc7827fb2452e82789129b918861157010c58e | Create pokebot.py | pokebot.py | pokebot.py | #!/usr/bin/python3
#
# Author: Luke
import time, ts3, sys, traceback
USER = 'serveradmin' # Query user
PASS = '' # Query Password
HOST = 'localhost' # Query Server-host
PORT = '10011' # Query Server-Port
SID = 1 # Serveradmin sid (dont touch)
def usage():
print ('\n./Poke-bot.py <... | Python | 0.000005 | |
4f87a0e144bf738e523cd1f8d914f39090275fee | add review status to individuals | xbrowse_server/base/migrations/0008_individual_review_status.py | xbrowse_server/base/migrations/0008_individual_review_status.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-10-05 09:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('base', '0007_auto_20160826_1327'),
]
operations = [
migrations.AddField(
... | Python | 0 | |
85b9d1eed3aea2ed56b85819f6e2269aef9dd128 | Add MemAvailable to default keys. | src/collectors/memory/memory.py | src/collectors/memory/memory.py | # coding=utf-8
"""
This class collects data on memory utilization
Note that MemFree may report no memory free. This may not actually be the case,
as memory is allocated to Buffers and Cache as well. See
[this link](http://www.linuxatemyram.com/) for more details.
#### Dependencies
* /proc/meminfo or psutil
"""
im... | # coding=utf-8
"""
This class collects data on memory utilization
Note that MemFree may report no memory free. This may not actually be the case,
as memory is allocated to Buffers and Cache as well. See
[this link](http://www.linuxatemyram.com/) for more details.
#### Dependencies
* /proc/meminfo or psutil
"""
im... | Python | 0 |
34bc4b9e5731c94ae4655deb338d67aa3f9a1f63 | Create project.py | project.py | project.py | from ggame import App, RectangleAsset, ImageAsset, SoundAsset, Sprite, Sound
from ggame import LineStyle, Color
SCREEN_WIDTH = 640
SCREEN_HEIGHT = 480
green = Color(0x00ff00, 1)
black = Color(0, 1)
noline = LineStyle(0, black)
bg_asset = RectangleAsset(SCREEN_WIDTH, SCREEN_HEIGHT, noline, green)
bg = Sprite(bg_asset,... | Python | 0.000001 | |
080df88609ac25eff0b4379e31acb63654d3314c | Create randfor.py | randfor.py | randfor.py | #!/usr/bin/env python
#This script performs randomforests on the blocks for the three variation of the method.
import sys
blocn=sys.argv[1]
min_samples_leaf=int(sys.argv[2])
import math
#The function evi for evidence is meant to make the result homogeneous to
#logistic regression. The if loop avoids having any infini... | Python | 0.000008 | |
6a33fe22f3de00ada2650007731ff19803b60381 | Add script to compute efficiency from gsc parameters | projects/whydense/computation_table.py | projects/whydense/computation_table.py | # -*- coding: utf-8 -*-
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2019, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and condition... | Python | 0 | |
681cc0a4160373fe82de59946b52e0e21611af84 | Print out all links on a page | linkLister.py | linkLister.py | import requests
import re
url = raw_input("Enter URL with http or https prefix : " )
print url
website= requests.get(url)
html = website.text
print html
linklist = re.findall('"((http|ftp)s?://.*?)"',html)
print linklist
for link in linklist:
print link[0]
| Python | 0 | |
6d4c3b77c9f0b4889ad5265113d9a87a0dc88377 | Add space in beused | src/ggrc/converters/errors.py | src/ggrc/converters/errors.py | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
WRONG_FILE_TYPE = (u"Line {line}: Wrong file type. Only .csv files are"
... | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
WRONG_FILE_TYPE = (u"Line {line}: Wrong file type. Only .csv files are"
... | Python | 0.00469 |
51f8b228ff1096769a06b47d026e81a166503a82 | add missing unit tests for previous commit | pymatgen/util/tests/test_decorators.py | pymatgen/util/tests/test_decorators.py | import unittest
from pymatgen.util.decorators import lru_cache
class TestLRUCache(unittest.TestCase):
def test_function(self):
@lru_cache(2)
def cached_func(a, b):
return a + b
#call a few times to get some stats
self.assertEqual(cached_func(1, 2), 3)
self.asse... | Python | 0 | |
3554160654a1cb8e7000ebeea06aecdabc91af8e | Create JustPremium.py | module/plugins/hooks/JustPremium.py | module/plugins/hooks/JustPremium.py | # -*- coding: utf-8 -*-
"""
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 version.
This program is distributed in ... | Python | 0 | |
61a6f6468462ed5db6c8e6c55bf29f0c503ff899 | add solution for H-Index | algorithms/hIndex/hIndex.py | algorithms/hIndex/hIndex.py | class Solution(object):
def hIndex(self, citations):
"""
:type citations: List[int]
:rtype: int
"""
n = len(citations)
c = collections.Counter([min(x, n) for x in citations])
s = reduce(lambda a, x: a + [a[-1] + c[x]], reversed(range(n)), [c[n]])
retur... | Python | 0.000002 | |
c2f0f5184665250949c32d16db0b521c357e3aa7 | Add solution to linkedListCycle problem. | python/src/linkedListCycle/linkedListCycle.py | python/src/linkedListCycle/linkedListCycle.py | # Given a linked list, determine if it has a cycle in it.
# Follow up:
# Can you solve it without using extra space?
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
# @param head, a ListNode
# @return a boolean
... | Python | 0 | |
2ab5d0bfdfe90279f3fffeeb51882cdbcb4e9135 | test genesis tests | tests/unit/modules/genesis_test.py | tests/unit/modules/genesis_test.py | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Rupesh Tare <rupesht@saltstack.com>`
'''
# Import Salt Testing Libs
from salttesting import TestCase, skipIf
from salttesting.mock import (
MagicMock,
patch,
NO_MOCK,
NO_MOCK_REASON
)
# Import Salt Libs
from salt.modules import genesis
# Globals
g... | Python | 0.000001 | |
4ec7abe5df2bdd4a68528fc9af14288b57fd72cc | add integration utest on Session | tests_with_openerp/test_session.py | tests_with_openerp/test_session.py | from unittest import TestCase
from anybox.recipe.odoo.runtime.session import Session
from openerp.tests.common import get_db_name
class SessionTestCase(TestCase):
def setUp(self):
super(SessionTestCase, self).setUp()
self.session = Session(None, None, parse_config=False)
def open_session(sel... | Python | 0 | |
da1bda146b4762bc572cb28da30cfb09b1d083aa | add hikvision (#243) | netdisco/discoverables/hikvision.py | netdisco/discoverables/hikvision.py | """Discover Hikvision cameras."""
from . import MDNSDiscoverable
class Discoverable(MDNSDiscoverable):
"""Add support for discovering Hikvision cameras."""
def __init__(self, nd):
"""Initialize Hikvision camera discovery."""
super(Discoverable, self).__init__(nd, '_http._tcp.local.')
def... | Python | 0 | |
273ab1b5f402e09a6f42fcfdb985fdf2dfa6b3ec | add test for program confirmation | web/impact/impact/tests/test_user_confirm_participation_view.py | web/impact/impact/tests/test_user_confirm_participation_view.py | from unittest.mock import patch
from django.urls import reverse
from accelerator.tests.contexts.context_utils import get_user_role_by_name
from accelerator.models import UserRole
from accelerator.tests.factories import (
ProgramFactory,
ProgramRoleFactory,
ProgramRoleGrantFactory,
UserFactory,
)
from... | Python | 0 | |
54181cf08a60a91abac3a5c7079e39d6496a4583 | Add unit tests for Binomial node | bayespy/inference/vmp/nodes/tests/test_binomial.py | bayespy/inference/vmp/nodes/tests/test_binomial.py | ######################################################################
# Copyright (C) 2014 Jaakko Luttinen
#
# This file is licensed under Version 3.0 of the GNU General Public
# License. See LICENSE for a text of the license.
######################################################################
####################... | Python | 0 | |
f7b2b511bd6cca122782b39c9eb75ed4a4736717 | add benchmark | test/benchmark.py | test/benchmark.py | import urllib2
import json
url = "http://localhost:3000/api?package=com.whatsapp"
for i in range(5):
print 'Downloading '+ str(i)
res = urllib2.urlopen(url).read()
file = "data-"+str(i)+".json"
with open(file, 'w') as outfile:
json.dump(res, outfile)
| Python | 0.000002 | |
27622185e04bb652284597783287262e23bafa7d | Add minimal test case (failing) | plenum/test/node_request/test_apply_stashed_partially_ordered.py | plenum/test/node_request/test_apply_stashed_partially_ordered.py | import pytest
from plenum.common.constants import DOMAIN_LEDGER_ID
from plenum.common.startable import Mode
from plenum.common.txn_util import reqToTxn
from plenum.test.delayers import cDelay
from plenum.test.helper import sdk_get_and_check_replies, sdk_send_random_requests, logger
from plenum.test.node_catchup.helper... | Python | 0.000001 | |
95da7f3b6c03d3d8e711aea4195017a17cb63d5f | Add another version of write libsvm data format. | scripts/python/write_libsvm_data_format_v2.py | scripts/python/write_libsvm_data_format_v2.py | """
A script to write out lib svm expected data format from my collecting data
"""
import os
import sys
import csv
import json
import getopt
import subprocess
CMD_USAGE = """
usage: write_libsvm_data_format.py --inputs="/inputs/folder/" --output="/output/lib_svm_data" <options>
<options>:
-f, --fe... | Python | 0 | |
cc7eb329a7d132947861ca1f2d4713cba1e4274a | Add tests! | test_processor.py | test_processor.py | from ivl_enums import IvlElabType, IvlPortType, IvlDataDirection
from parsers import parse_modules_and_elabs
from utils import IvlNetManager
import pytest
import sure # noqa
@pytest.yield_fixture
def read_netlist():
# Read a netlist and parse it into modules and elabs.
# Create a new net manager.
with o... | Python | 0 | |
823d10795b22b751647e79e77eecd381cf7a809d | create test file | test_threetaps.py | test_threetaps.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for threetaps."""
import unittest
if __name__ == '__main__':
unittest.main()
| Python | 0.000001 | |
f9fd2e3dcc4c25fd7561f8898e3845992553a8a8 | add wrapper script to launch tests | tests/run.py | tests/run.py | #!/usr/bin/python
import os
root = os.path.join(os.path.dirname(__file__), '..')
prog = os.path.join(os.path.dirname(__file__), 'qdjango-tests')
path = []
for component in ['db', 'http', 'script']:
path.append(os.path.join(root, 'src', component))
os.system("LD_LIBRARY_PATH=%s %s" % (':'.join(path), prog))
| Python | 0.000001 | |
e8a6c0adc3aa77f8e0b1399fe076b43720acb823 | Test the API can run | tests/test_api.py | tests/test_api.py | # -*- coding: utf-8 -*-
import subprocess
import requests
from unittest import TestCase
from nose.tools import assert_equal
class Test(TestCase):
def setUp(self):
self.process = subprocess.Popen("openfisca-serve")
def tearDown(self):
self.process.terminate()
def test_response(self):
... | Python | 0 | |
690c08b2b35df2d81dc0977d8bd593c45806e1c2 | Add dumb log view test cases | tests/test_log.py | tests/test_log.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from flask import url_for
def test_view_build_log(test_client):
test_client.get(url_for('log.build_log', sha='123456'))
def test_view_lint_log(test_client):
test_client.get(url_for('log.lint_log', sha='123456'))
| Python | 0 | |
31d8447c689616b5b8d1377461ab70c6ce6d6cb9 | Add doc2vecs module | thinc/doc2vecs.py | thinc/doc2vecs.py | from collections import defaultdict
from .base import Model
class SpacyWindowEncode(Model):
nr_piece = 3
nr_feat = 5
nr_out = None
nr_in = None
@property
def nr_weight(self):
nr_W = self.nr_out * self.nr_in
nr_b = self.nr_out
return self.nr_feat * self.nr_piece * (nr_... | Python | 0 | |
4d500d9abe2da28cdd9bd95019048de445aac265 | Add a history demo in documentation. | docs/source/tutorial/v5/history_demo.py | docs/source/tutorial/v5/history_demo.py | # coding: utf-8
from deprecated.history import deprecated
from deprecated.history import versionadded
from deprecated.history import versionchanged
@deprecated(
reason="""
This is deprecated, really. So you need to use another function.
But I don\'t know which one.
- The first,
- The se... | Python | 0 | |
361333f8b214097469389d0219f339fc59ea469b | Add permissions.py | teams/permisssions.py | teams/permisssions.py | from rest_framework.permissions import BasePermission
class IsOwnerPermission(BasePermission):
def has_permission(self, request, view):
return request.user.is_authenticated()
def has_object_permission(self, request, view, obj):
return request.user == obj.owner
| Python | 0.000001 | |
20ac8a830ef59abc51afe13ac102521767d47c22 | test uffd bad socket path scenarios | tests/integration_tests/functional/test_uffd.py | tests/integration_tests/functional/test_uffd.py | # Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Test UFFD related functionality when resuming from snapshot."""
import logging
import os
from framework.artifacts import SnapshotMemBackendType
from framework.builder import MicrovmBuilder, SnapshotBuilde... | Python | 0 | |
7cb839279bc62b95eb7367814ef71c046d4b2184 | Add 'examples' module which contains some examplary function examples. | tssim/examples.py | tssim/examples.py | """This module contains example time functions"""
import numpy as np
def rand_lin_noise():
beta = np.random.normal()
return lambda x: beta * x + np.random.random(size=len(x))
def const_lin_noise(x):
beta = np.random.normal()
return beta * x + np.random.random(size=len(x))
def random_walk(x):
... | Python | 0 | |
c156ad1379d842924b928c6c80f668f9875e840a | Remove page-filter flag. (which is now user-filter) | tools/telemetry/telemetry/story/story_filter.py | tools/telemetry/telemetry/story/story_filter.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.
import optparse
import re
from telemetry.internal.util import command_line
class _StoryMatcher(object):
def __init__(self, pattern):
self._regex = N... | # 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.
import optparse
import re
from telemetry.internal.util import command_line
class _StoryMatcher(object):
def __init__(self, pattern):
self._regex = N... | Python | 0 |
c39c086f51963678769c1066637ca573c721e827 | Create a simple static gallery script. | static_gallery.py | static_gallery.py | from . import flag
#from go import html
from go import os
from go import path/filepath
def ReadAlbumDirs(input_dir):
f = os.Open(input_dir)
with defer f.Close():
names = f.Readdirnames(-1)
for name in names:
stat = os.Stat(filepath.Join(input_dir, name))
if stat.IsDir():
yield name
def... | Python | 0 | |
f083789e5615d15715f49a7dbdb25505aa5efae2 | Initialize P1_assignChores | books/AutomateTheBoringStuffWithPython/Chapter16/PracticeProjects/P1_assignChores.py | books/AutomateTheBoringStuffWithPython/Chapter16/PracticeProjects/P1_assignChores.py | # Write a program that takes a list of people’s email addresses and a list of chores
# that need to be done and randomly assigns chores to people. Email each person their
# assigned chores.
#
# If you’re feeling ambitious, keep a record of each person’s previously assigned
# chores so that you can make sure the program... | Python | 0.000124 | |
54a9b637aad85a20f3e865185ffed0abfd4192cd | Create tutorial4.py | tutorial4.py | tutorial4.py | from ggame import App, RectangleAsset, ImageAsset, Sprite, LineStyle, Color, Frame
SCREEN_WIDTH = 640
SCREEN_HEIGHT = 480
class SpaceShip(Sprite):
"""
Animated space ship
"""
asset = ImageAsset("images/four_spaceship_by_albertov_with_thrust.png",
Frame(227,0,292-227,125), 4, 'vertical')
... | Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.