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 |
|---|---|---|---|---|---|---|---|
81391212d0e0cecfbce14195e1ca8cd1d96a6671 | Create Euler_2.py | Euler_2.py | Euler_2.py | fib = 1
fib2 = 2
temp = 0
total = 0
while temp <= 4000000:
temp = fib2
if temp % 2 == 0:
total += temp
temp = fib + fib2
fib = fib2
fib2 = temp
print(total)
| Python | 0.002755 | |
2c115a1b437aa36b42f74c04136601d9362dd5f6 | add cutflow | rootpy/tree/cutflow.py | rootpy/tree/cutflow.py | import struct
class Cutflow(object):
def __init__(self, names):
self.__names = names
self.__dict = dict((name, '0') for name in names)
def __setitem__(self, item, value):
self.__dict[item] = str(int(bool(value)))
def bitstring(self):
return ''.join([self.__dict... | Python | 0.000002 | |
a5b2db02926573ec1bc338d611af9f0ca363b237 | add convoluving response function | convoluving_response.py | convoluving_response.py | import numpy as np
import matplotlib.pyplot as plt
import scipy.stats
from scipy.stats import gamma
from stimuli import events2neural
def hrf(times):
""" Return values for HRF at given times """
# Gamma pdf for the peak
peak_values = gamma.pdf(times, 6)
# Gamma pdf for the undershoot
undershoot_val... | Python | 0.00001 | |
7a91235b1d6ed45a5452c455dd86797bbf092d17 | Update S3Session.py | mongodb_consistent_backup/Upload/S3/S3Session.py | mongodb_consistent_backup/Upload/S3/S3Session.py | import logging
import boto
import boto.s3
class S3Session:
def __init__(self, access_key, secret_key, s3_host='s3.amazonaws.com', secure=True, num_retries=5, socket_timeout=15):
self.access_key = access_key
self.secret_key = secret_key
self.s3_host = s3_host
self.se... | import logging
from boto import config
from boto.s3 import S3Connection
class S3Session:
def __init__(self, access_key, secret_key, s3_host='s3.amazonaws.com', secure=True, num_retries=5, socket_timeout=15):
self.access_key = access_key
self.secret_key = secret_key
self.s3_host ... | Python | 0.000001 |
7c755e7839f7c602a6c93b1aa2f5011e89d15c85 | Create command for generating prices for flavors | nodeconductor/iaas/management/commands/addmissingpricelistflavors.py | nodeconductor/iaas/management/commands/addmissingpricelistflavors.py | from __future__ import unicode_literals
from django.contrib.contenttypes.models import ContentType
from django.core.management.base import BaseCommand
from nodeconductor.cost_tracking.models import DefaultPriceListItem
from nodeconductor.iaas.models import Flavor, Instance
class Command(BaseCommand):
def handl... | Python | 0 | |
2616d8f3ef51a8551ac14a9e83b0298b8165093a | Add work-in-progress script to fixup a standalone plugin library. | Superbuild/Projects/apple/fixup_plugin2.py | Superbuild/Projects/apple/fixup_plugin2.py | #!/usr/bin/env python
import subprocess
import os
plugin = 'libVelodyneHDLPlugin.dylib'
paraviewBuildDir = '/source/paraview/build'
nameprefix = '@executable_path/../Libraries/'
prefix = '@executable_path/../Libraries/'
# The official ParaView OSX binaries are built with hdf5, not vtkhdf5.
# Also, they are built wi... | Python | 0 | |
735135c5570edd38324fe3e94aa2f4c2f3043627 | Migrate data from contact_for_research_via and into contact_for_research_methods many to many field | cla_backend/apps/legalaid/migrations/0023_migrate_contact_for_research_via_field.py | cla_backend/apps/legalaid/migrations/0023_migrate_contact_for_research_via_field.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django.db.models import Q
def migrate_contact_for_research_via_field_data(apps, schema_editor):
ContactResearchMethod = apps.get_model("legalaid", "ContactResearchMethod")
research_methods = {method.method: ... | Python | 0.000002 | |
59ac9745064dd02903e35c1c51781505bad505df | add gunicorn config | gunicorn.conf.py | gunicorn.conf.py |
bind = "unix:/tmp/mygpo.sock"
workers = 2
worker_class = "gevent"
max_requests = 10000
| Python | 0.000001 | |
830a41911c5a2bc3982f35a6c6da38f6c659e78b | Create /pypardot/objects/tests/__init__.py | pypardot/objects/tests/__init__.py | pypardot/objects/tests/__init__.py | Python | 0.000005 | ||
f740dd60e7a4493269679e469c7f1ee5e24ff5af | add build/errors file | conary/build/errors.py | conary/build/errors.py |
class BuildError(Exception):
def __init__(self, msg):
self.msg = msg
def __repr__(self):
return self.msg
def __str__(self):
return repr(self)
class RecipeFileError(BuildError):
pass
class RecipeDependencyError(RecipeFileError):
pass
class BadRecipeNameError(RecipeFileError):
... | Python | 0.000001 | |
aed8df0e42fef2b5f100a5bc60cd250457a24880 | Add migrations. | nomination/migrations/0004_auto_20190927_1904.py | nomination/migrations/0004_auto_20190927_1904.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.24 on 2019-09-27 19:04
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('nomination', '0003_project_archive_url'),
]
opera... | Python | 0 | |
18f385de7b287a932192f690cb74ff70a452cf47 | test settings file | fpurlfield/test_settings.py | fpurlfield/test_settings.py | # Django settings for test_project project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = ()
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
},
}
# TIME_ZONE = 'America/Chicago'
# LANGUAGE_CODE = 'en-us'
# USE_I18N = True
# USE_L10N = Tr... | Python | 0.000001 | |
62c85cf12b388411919b86ac498908336bfd5e12 | Create password_checker.py | Challenge-172/02-Intermediate-2/password_checker.py | Challenge-172/02-Intermediate-2/password_checker.py | #!/usr/bin/python
import hashlib
import uuid
password = 'test123'
f = open('salt.txt')
salt = f.read()
f.close()
f = open('encrypted.txt')
hashed_password = f.read()
f.close()
if hashlib.sha512(password + salt).hexdigest() == hashed_password:
print 'ACCESS GRANTED'
else:
print 'ACCESS DENIED'
| Python | 0.000267 | |
a59a2c3cbd9c8f029ab679f386ab61a6bcfb5108 | test py script for multibody | software/perception/constraint_app/scripts/simulate_mb.py | software/perception/constraint_app/scripts/simulate_mb.py | import sys
import os
# for bottime:
import time
import random
import numpy
import termios, atexit
from select import select
def kbhit():
dr,dw,de = select([sys.stdin], [], [], 0)
return dr <> []
myhome = os.environ.get("HOME")
path1 = myhome + "/drc/software/build/lib/python2.7/site-packages"
path2 = myhome ... | Python | 0.000001 | |
446984ad7b102587beac03d4329b5d0c061e2095 | Add preserve_{current_canvas,batch_state} and invisible_canvas context managers | rootpy/context.py | rootpy/context.py | from contextlib import contextmanager
import ROOT
@contextmanager
def preserve_current_canvas():
"""
Context manager which ensures that the current canvas remains the current
canvas when the context is left.
"""
old = ROOT.gPad.func()
try:
yield
finally:
if old:
... | Python | 0.000004 | |
7cb77ef66cad41e1b5d4907272b899a24a689c2d | Test for #423 | test/algorithms/refinement/tst_dials-423.py | test/algorithms/refinement/tst_dials-423.py | #!/usr/bin/env cctbx.python
#
# Copyright (C) (2017) STFC Rutherford Appleton Laboratory, UK.
#
# Author: David Waterman.
#
# This code is distributed under the BSD license, a copy of which is
# included in the root directory of this package.
#
""" Test the situation that led to https://github.com/dials/dials/iss... | Python | 0 | |
32fcd5393402d868d8741385705f58b9e8eb7703 | Update __init__.py | 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.000072 |
9cb122793d531690b621b4fa8f91481a105305e3 | Add new module: minion.list | salt/modules/minion.py | salt/modules/minion.py | # -*- coding: utf-8 -*-
'''
Module to provide information about minions
'''
# Import Python libs
import os
# Import Salt libs
import salt.utils
import salt.key
def list():
'''
Return a list of accepted, denied, unaccepted and rejected keys.
This is the same output as `salt-key -L`
CLI Example:
... | Python | 0.000004 | |
91645e4abf4fa128a59257584ba385c19b642425 | Add @s0undtech's nb_open module | salt/utils/nb_popen.py | salt/utils/nb_popen.py | # -*- coding: utf-8 -*-
'''
saltcloud.utils.nb_popen
~~~~~~~~~~~~~~~~~~~~~~~~
Non blocking subprocess Popen.
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
:copyright: © 2013 by the SaltStack Team, see AUTHORS for more details.
:license: Apache 2.0, see LICENSE for more details.
'''
... | Python | 0 | |
f6e32ae48265232f25866dd9060b7cb80551e333 | Create main.py | main.py | main.py |
def calcProbPos(bPlus,bMinus,cPlus,cMinus):
probPos = ((bPlus/cPlus)*(cPlus/(cPlus+cMinus)))/((bPlus+bMinus)/(cPlus+cMinus))
return probPos
def calcMean(t,i):
m = t/i
return m
print('Enter a statement without punctuation:')
userStatement = input().lower()
print('THINKING...')
userStatemen... | Python | 0.000347 | |
87a9769af3d201b925a5a4a259ccbd007257b1d3 | add python test: read_pack.py | test/read_pack.py | test/read_pack.py | import os
import msgpack
f = open("/tmp/data.bin", "r")
package = f.read(1024)
f.close()
data = msgpack.unpackb(package)
print data | Python | 0.00414 | |
3912416390ebe5df3c883b280cc6acac5169c1f7 | Add test to check if elements have at least one owner | tests/test_elements_have_owner.py | tests/test_elements_have_owner.py | """
For all relevant model elements, check if there is at least one "owner"
("owner" is a derived union).
This is needed to display all elements in the tree view.
"""
import itertools
import pytest
import gaphor.SysML.diagramitems
import gaphor.UML.diagramitems
from gaphor import UML
from gaphor.core.modeling impor... | Python | 0 | |
5307d1cf69c943f7f5fe9dfd475c93f317e8ebb7 | add import script for West Lancashire | polling_stations/apps/data_collection/management/commands/import_west_lancashire.py | polling_stations/apps/data_collection/management/commands/import_west_lancashire.py | from data_collection.management.commands import BaseXpressWebLookupCsvImporter
class Command(BaseXpressWebLookupCsvImporter):
council_id = 'E07000127'
addresses_name = 'West Lancashire - PropertyPostCodePollingStationWebLookup-2017-03-08.TSV'
stations_name = 'West Lancashire - PropertyPostCodePolli... | Python | 0 | |
93997e72f63dd586d1a683475f49a466571a9fb0 | Create index.py | index.py | index.py | #!/usr/bin/python
print("Hello, World!");
| Python | 0.000016 | |
4a48b8dd804f9a287d35b697d851a660eec80a75 | Add tests for simple enums | tests/richenum/test_simple_enums.py | tests/richenum/test_simple_enums.py | import unittest
from richenum import EnumConstructionException, enum
Breakfast = enum(
COFFEE=0,
OATMEAL=1,
FRUIT=2)
class SimpleEnumTestSuite(unittest.TestCase):
def test_members_are_accessible_through_attributes(self):
self.assertEqual(Breakfast.COFFEE, 0)
def test_lookup_by_name(sel... | Python | 0 | |
92075a04b0835b1209eaa806c2aeb44ca371ff2b | Add harfbuzz 0.9.40 | packages/harfbuzz.py | packages/harfbuzz.py | Package ('harfbuzz', '0.9.40',
sources = ['http://www.freedesktop.org/software/%{name}/release/%{name}-%{version}.tar.bz2'],
configure_flags = [
'--disable-silent-rules',
'--without-cairo',
'--without-freetype',
'--without-glib',
'--without-graphite2',
'--with-icu',
])
| Python | 0 | |
e4d09d7d313513c315b1a1065837b7ad9b9eb0f6 | Add tests for _set_netsh_value | tests/unit/modules/test_win_lgpo.py | tests/unit/modules/test_win_lgpo.py | # -*- coding: utf-8 -*-
# Import Python libs
from __future__ import absolute_import, unicode_literals, print_function
# Import Salt Libs
import salt.modules.win_lgpo as win_lgpo
# Import Salt Testing Libs
from tests.support.mixins import LoaderModuleMockMixin
from tests.support.unit import TestCase
from tests.suppor... | Python | 0.000004 | |
564bf6484347fed1d3346ff42d79e4bba02a3c98 | add firs test | test_add_group.py | test_add_group.py | # -*- coding: utf-8 -*-
from selenium.webdriver.firefox.webdriver import WebDriver
from selenium.webdriver.common.action_chains import ActionChains
import time, unittest
def is_alert_present(wd):
try:
wd.switch_to_alert().text
return True
except:
return False
class test_add_group(unitt... | Python | 0.999776 | |
774b59a2bba95c4b617ac49e279bcbe73d6b6f3b | Add a script to plot timing data | profiling/plot.py | profiling/plot.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import glob
import numpy as np
import matplotlib.pyplot as plt
csv_files = glob.glob('*.csv')
fig = plt.figure()
ax = fig.add_subplot(111)
colors = iter(plt.cm.rainbow(np.linspace(0,1,len(csv_files))))
for csv_file in csv_files:
data = np.genfromtxt(csv_file, de... | Python | 0.000002 | |
e4cc622b6c296f57324eccba2b1ed3ff2201868d | Reverse a singly linked list | python/interviewquestions/reverse_linked_list.py | python/interviewquestions/reverse_linked_list.py | """
Given a singly linked list, reverse it in place and return the head
of the new list.
"""
import unittest
class Node(object):
def __init__(self, value):
self.value = value
self.next = None
def __repr__(self):
return "<Node %d>" % self.value
def rev(curr):
last = None
whi... | Python | 0.999671 | |
48c4a4fe9531123d6ca2b9af18162c916af09cc9 | Create moto_parser.py | Bootloader/moto_parser.py | Bootloader/moto_parser.py | Python | 0.000054 | ||
13fdc81cb32842dc5e0f05d2aa84c997cd59daa3 | Add test that, if we failed to open the log file, we don't try to write to it. | IPython/core/tests/test_logger.py | IPython/core/tests/test_logger.py | """Test IPython.core.logger"""
import nose.tools as nt
_ip = get_ipython()
def test_logstart_inaccessible_file():
try:
_ip.logger.logstart(logfname="/") # Opening that filename will fail.
except IOError:
pass
else:
nt.assert_true(False) # The try block should never pas... | Python | 0 | |
a8b3af76c1a6cbf61887f5721fd10bf2ef24b2f8 | Create A_Salinity_vertical_section_zy_movie.py | Cas_6/Vertical_sections/A_Salinity_vertical_section_zy_movie.py | Cas_6/Vertical_sections/A_Salinity_vertical_section_zy_movie.py |
plt.figure(2)
ax = plt.subplot(projection=ccrs.PlateCarree());
ds1['S'].where(ds1.hFacC>0)[nt,:,:,280].plot()
plt.title('Vertical Section (yz) of Salinity (XC = 0E)')
plt.text(5,5,nt,ha='center',wrap=True)
ax.coastlines()
gl = ax.gridlines(draw_labels=True, alpha = 0.5, linestyl... | Python | 0.000574 | |
e653cffcd6711113ceb9ce412149e8155f4d6167 | add the plot file | plot.py | plot.py | # -*- encoding: utf-8 -*-
# -------------------------------------------------------------------------------
# Copyright (c) 2014 Vincent Gauthier Telecom SudParis.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), ... | Python | 0.000001 | |
76e412121b80c39d9facc09a51d9b8aa4cdb9722 | Add Check timeouts functionality | OAB/oab_check_timeouts.py | OAB/oab_check_timeouts.py | #!/usr/bin/python
import argparse
import pycurl
import re
import csv
from StringIO import StringIO
from urllib import urlencode
from sys import exit
# Arguments handling
# Setting output filenames
inputfile = "lalala_nok.csv"
filename_ok = "output_ok.csv"
filename_nok = "output_nok.csv"
# Variable definitions
url ... | Python | 0.000001 | |
a1337ca14fe2f21c849bd27132bdee079ac47e59 | Add Session Support | app/Session.py | app/Session.py | #!/usr/bin/python
# -*- coding:utf-8 -*-
# Powered By KK Studio
# Session Support For Tornado
import hashlib
import os
import time
import json
class Session:
def __init__(self,prefix='',session_id=None,expires=7200,redis=None):
self.redis = redis
self.expires = expires
self.prefix = pre... | Python | 0 | |
f9f5d2b040618bc7d7c26383218fad390bf9dd0a | add unit test_connection_detail_retriever | tests/test_common/test_cloudshell/test_connection_detail_retriever.py | tests/test_common/test_cloudshell/test_connection_detail_retriever.py | from unittest import TestCase
from mock import Mock
from common.cloudshell.conn_details_retriever import ResourceConnectionDetailsRetriever
class TestConnectionDetailRetriever(TestCase):
def test_connection_detail_retriever(self):
helpers = Mock()
cs_retriever_service = Mock()
session = ... | Python | 0.000002 | |
c5a6bfdca30a5111e641ebe4b2eac40b21b8ce74 | FIx CPU time consuming in green_poller poll() | oslo_messaging/_drivers/zmq_driver/poller/green_poller.py | oslo_messaging/_drivers/zmq_driver/poller/green_poller.py | # Copyright 2015 Mirantis, 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 ... | # Copyright 2015 Mirantis, 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 ... | Python | 0.000071 |
0a2a5423daccec928eb33706bca33ac05058feeb | Add nova parser | playback/cli/nova.py | playback/cli/nova.py | import sys
from playback.cliutil import priority
from playback.api import Nova
def create_nova_db_subparser(s):
create_nova_db_parser = s.add_parser('create-nova-db',
help='create the nova and nova_api database')
create_nova_db_parser.add_argument('--root-db-pass',
... | Python | 0.005094 | |
f5675a1cebfe6aa0f8dda3b94aa30139e2528c49 | Create broadcast.py | plugins/broadcast.py | plugins/broadcast.py | @bot.message_handler(commands=['bc'])
def bc_msg(message):
if message.from_user.id in ADMINS_IDS:
if len(message.text.split()) < 2:
bot.reply_to(message, "What should I broadcast?")
return
bcmsg = message.text.replace("/bc ","")
allmembers = list(redisserver.smembers('zigzag_members'))
for... | Python | 0.000001 | |
d34d1d50b853d3a205cbc60a75dd3911a9253b4e | update backend | app/scraper.py | app/scraper.py | import collections
import json
import httplib2
from oauth2client.client import GoogleCredentials
from lib import Term
def get_http():
http = httplib2.Http()
GoogleCredentials.get_application_default().create_scoped([
'https://www.googleapis.com/auth/firebase.database',
'https://www.googleapis.... | Python | 0.000001 | |
620401abdb33b335452df709a1a1f2c4bc55cd4c | Add challenge day 6 | leetcode/challenge/day06.py | leetcode/challenge/day06.py | """
Given an array of strings, group anagrams together.
Example:
Input: ["eat", "tea", "tan", "ate", "nat", "bat"],
Output:
[
["ate","eat","tea"],
["nat","tan"],
["bat"]
]
Note:
All inputs will be in lowercase.
The order of your output does not matter.
"""
class Solution:
def groupAnagr... | Python | 0.000003 | |
7af8cc6d59a1d52e7decc90ecb9472f1c5825aa3 | Create ds_hash_two_sum.py | leetcode/ds_hash_two_sum.py | leetcode/ds_hash_two_sum.py | # @file Two Sum
# @brief Given an array and target, find 2 nums in array that sum to target
# https://leetcode.com/problems/two-sum/
'''
Given an array of integers, return indices of the two numbers such that they
add up to a specific target.
You may assume that each input would have exactly one solution.
Example: G... | Python | 0.000169 | |
d2235db4c78620d1a2b6f6010c041b3eb26ae4d3 | Implement basic IRC client functionality in gygax.irc. | gygax/irc.py | gygax/irc.py | # -*- coding: utf-8 -*-
"""
:mod:`gygax.irc` --- Internet Relay Chat client.
================================================
:mod:`gygax.irc` implements all functionality needed to communicate with an IRC
server. It does so using :mod:`asynchat` from the Python Standard Library,
which handles all asynchronous networ... | Python | 0 | |
6a84ed3872303aa5b05462982406749d7bd447d4 | Create main.py | main.py | main.py | #!/usr/bin/env python
# Command line script to convert a single given number to and from several units
import argparse
from src.convert import kilometers_to_miles, miles_to_kilometers, \
years_to__minutes, minutes_to_years
#parse args
parse = argparse.ArgumentParser()
parse.add_argument('value', type=float, help="Pro... | Python | 0 | |
7629a1cd27c80c5ebff91c4d01bf648f9d4c9b3c | Create main.py | main.py | main.py | Python | 0.000001 | ||
dbb147018a92426c5c9e19a523e0bd8d4c277035 | Create LED_GPIO.py | setup/gpio/LED_GPIO.py | setup/gpio/LED_GPIO.py |
import time
import lgpio
#17,27,22
LED = 17
# open the gpio chip and set the LED pin as output
h = lgpio.gpiochip_open(0)
lgpio.gpio_claim_output(h, LED)
try:
while True:
# Turn the GPIO pin on
lgpio.gpio_write(h, LED, 1)
time.sleep(1)
# Turn the GPIO pin off
lgpio.gpi... | Python | 0.000001 | |
741dac8a1cc80549c74c231a0a7b598748f9fa4b | Create program.py | ProductInventorySystem/program.py | ProductInventorySystem/program.py | from abc import *
class Entity(metaclass = ABCMeta):
@abstractproperty
def id_number(self):
return 0
class Product(Entity):
id = 0 #initially no id exist (this is class variable)
#Constructor
def __init__(self,name = None,value =0,amount =0, scale ='kg'):
self._id = Produc... | Python | 0.000002 | |
d856ea5597230b3befeb03049c45f3706bec5844 | add kael-crontab cli | kael/cron/cli.py | kael/cron/cli.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@version:
@author:
@time: 2017/6/15
"""
import os
import click
@click.group()
def cli():
pass
def _check_task_is_py(command):
command = command.strip()
head = command.split(' ')[0]
if 'py' == head.split('.')[-1]:
return True
return False... | Python | 0.000003 | |
599ed110458d5bcf23b74a95c5c472cc376ed702 | Create field_notes.py | djspace/application/field_notes.py | djspace/application/field_notes.py | # adding all the fields we need for this form..
#
| Python | 0.000001 | |
f4b0135a48ee94d8504ddf24dcc16b8036c05f2c | add test file | tests/app_test.py | tests/app_test.py | import os
import app
import unittest
import tempfile
class FlaskrTestCase(unittest.TestCase):
def setUp(self):
self.db_fd, app.app.config['DATABASE'] = tempfile.mkstemp()
app.app.config['TESTING'] = True
self.app = app.app.test_client()
app.init_db()
def tearDown(self):
... | Python | 0.000001 | |
5b83b5e9a4e07af3f3dcd37d4f613039a42336e3 | Add salt.modules.container_resource | salt/modules/container_resource.py | salt/modules/container_resource.py | # -*- coding: utf-8 -*-
'''
Common resources for LXC and systemd-nspawn containers
These functions are not designed to be called directly, but instead from the
:mod:`lxc <salt.modules.lxc>` and the (future) :mod:`nspawn
<salt.modules.nspawn>` execution modules.
'''
# Import python libs
from __future__ import absolute... | Python | 0.000042 | |
a4eb209150385ff2f9fea3722c0256fe7ea20b40 | Add unit test | test.py | test.py | from langutil import php
import unittest
class TestPHPScalarStringGeneratorFunctions(unittest.TestCase):
def test_generate_scalar_int(self):
self.assertEqual(php.generate_scalar(2), '2')
def test_generate_scalar_float(self):
self.assertEqual(php.generate_scalar(2.001), '2.001')
def test_... | Python | 0.000001 | |
8c2b90d4d2c9fc8ad759284719eab4dd346ccab2 | Add tests | test.py | test.py | """
Simple test of CxoTime. The base Time object is extremely well
tested, so this simply confirms that the add-on in CxoTime works.
"""
import pytest
import numpy as np
from cxotime import CxoTime
try:
from Chandra.Time import DateTime
HAS_DATETIME = True
except ImportError:
HAS_DATETIME = False
def t... | Python | 0.000001 | |
815ef4b4b0dce640077e1f8ecd2fbe95598bf539 | Create existing comments' owners records | src/ggrc/migrations/versions/20160608132526_170e453da661_add_comments_owners_info.py | src/ggrc/migrations/versions/20160608132526_170e453da661_add_comments_owners_info.py | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: peter@reciprocitylabs.com
# Maintained By: peter@reciprocitylabs.com
"""
Add comments' owners information.
Create Date: 2016-06-08 13:25:26.635435... | Python | 0 | |
b73c75bbafb53864a86f95949d6a028f9e79f718 | Add Tile class | tile.py | tile.py | from __future__ import division
class Tile(object):
def __init__(self, x, y, z):
self.x = x
self.y = y
self.height = z
| Python | 0 | |
9cc26c8a95ab4e6ffa9c991b5a575c7e6d62dae4 | add pytest for util.location | pytests/util/test_location.py | pytests/util/test_location.py | import pytest
import json
import util.location
@pytest.fixture
def urllib_req(mocker):
util.location.reset()
return mocker.patch("util.location.urllib.request")
@pytest.fixture
def primaryLocation():
return {
"country": "Middle Earth",
"longitude": "10.0",
"latitude": "20.5",
... | Python | 0 | |
c9690cabe3c4d1d02307e3594a2cac505f4a166d | Add new image moments functions | photutils/utils/_moments.py | photutils/utils/_moments.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
from ..centroids import centroid_com
__all__ = ['_moments_central', '_moments']
def _moments_central(data, center=None, or... | Python | 0.000002 | |
6a3c960640741036c3f444547cada1e1b7a24100 | Add first unit test for api | tests/test_api.py | tests/test_api.py | import os
import sys
import json
import responses
import unittest
CWD = os.path.dirname(os.path.abspath(__file__))
MS_WD = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Allow import of api.py
if os.path.join(MS_WD, 'utils') not in sys.path:
sys.path.insert(0, os.path.join(MS_WD, 'utils'))
# Use mu... | Python | 0 | |
5e8738e29c319c7de0874da93ad4e452a3717955 | Add bot tests | tests/test_bot.py | tests/test_bot.py | import mock
import unittest
from src.bot import Bot
from config.i18n import locales
from src.models.model import db
from src.models.user import User
from src.models.user_friend import UserFriend
from database.factories.model_factory import factory
class TestBot(unittest.TestCase):
def setUp(self):
... | Python | 0.000001 | |
d0432f1d3d48634c00027b71eb131c5e36827c4b | Add dropdown element located in widget bar | src/lib/constants/element/widget_bar/dropdown.py | src/lib/constants/element/widget_bar/dropdown.py | SELECTOR = ".inner-nav-item"
CLAUSES = "Clauses"
CONTRACTS = "Contracts"
DATA_ASSETS = "Data Assets"
FACILITIES = "Facilities"
MARKETS = "Markets"
ORG_GROUPS = "Org Groups"
POLICIES = "Policies"
PROCESSES = "Processes"
PRODUCTS = "Products"
PROJECTS = "Projects"
STANDARDS = "Standards"
SYSTEMS = "Systems"
VENDORS = "V... | Python | 0 | |
763680e57b28a9746050206cd63450bf11c3e512 | Fix ProgramEditor permissions to not include Program delete | src/ggrc_basic_permissions/migrations/versions/20131010001257_10adeac7b693_fix_programeditor_pe.py | src/ggrc_basic_permissions/migrations/versions/20131010001257_10adeac7b693_fix_programeditor_pe.py |
"""Fix ProgramEditor permissions
Revision ID: 10adeac7b693
Revises: 8f33d9bd2043
Create Date: 2013-10-10 00:12:57.391754
"""
# revision identifiers, used by Alembic.
revision = '10adeac7b693'
down_revision = '8f33d9bd2043'
import json
import sqlalchemy as sa
from alembic import op
from datetime import datetime
fro... | Python | 0 | |
da488fa4505de818a5efcec13fdb7963d5051389 | Create util.py | util.py | util.py | import requests
import logging
def downloadRedditUrl(url):
print "downloadRedditUrl(): Downloading url: {}".format(url)
#assert url.startswith('https://www.reddit.com/r/learnprogramming/')
headers = {
'User-Agent': 'Searching Reddit bot version 1.0',
}
r = requests.get(url,headers = headers)
if r.stat... | Python | 0.000002 | |
2beac94eb32fc4adb976c4a10018de8518e4bada | Add wsgi file | wsgi.py | wsgi.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2016 Eugene Frolov <eugene@frolov.net.ru>
#
# 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.000001 | |
7c095c82e1b6a16da65b8fcfaf77d9a606321d76 | Create sum67.py | Python/CodingBat/sum67.py | Python/CodingBat/sum67.py | # http://codingbat.com/prob/p108886
def sum67(nums):
sum = 0
i = 0
while i < len(nums):
if nums[i] == 6:
while nums[i] != 7:
i += 1
else:
sum += nums[i]
i += 1
return sum
| Python | 0.001155 | |
28f41fcfc80bc562343e510e3e0e5e57d97d27ea | Create Scrap_share_marketdata.py | Scrap_share_marketdata.py | Scrap_share_marketdata.py | import urllib
import re
#TItile scrap of any website
# regex='<title>(.+?)</title>'
# pattern =re.compile(regex)
# htmlfile = urllib.urlopen("https://www.cnn.com")
# htmltext=htmlfile.read()
# titles=re.findall(pattern,htmltext)
# print titles
# Scrap using finance yahoo.com
# symbolfile=open("symbols.txt")
# sym... | Python | 0.000002 | |
4f0e82c8f95815ce197d7ce9e58c3f30422d1fa7 | Create exam-room.py | Python/exam-room.py | Python/exam-room.py | # Time: seat: O(logn) on average,
# leave: O(logn)
# Space: O(n)
# In an exam room, there are N seats in a single row,
# numbered 0, 1, 2, ..., N-1.
#
# When a student enters the room,
# they must sit in the seat that maximizes the distance to the closest person.
# If there are multiple such seats, they sit i... | Python | 0.000001 | |
1ec2f110c16de75503092df873693e2929baa8cd | add the "Cargos Importantes" field | candidates/migrations/0018_cr_add_important_posts_field.py | candidates/migrations/0018_cr_add_important_posts_field.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.db import models, migrations
def add_extra_field(apps, schema_editor):
ExtraField = apps.get_model('candidates', 'ExtraField')
if settings.ELECTION_APP == 'cr':
ExtraField.objects.create(
... | Python | 0 | |
0f5a52a215f8f1e16ab5ddf622a541919ab760ce | Fix up language detector. | aleph/analyze/language.py | aleph/analyze/language.py | import logging
import langid
# https://github.com/saffsd/langid.py
from aleph.analyze.analyzer import Analyzer
log = logging.getLogger(__name__)
THRESHOLD = 0.9
CUTOFF = 30
class LanguageAnalyzer(Analyzer):
def analyze_text(self, document, meta):
if len(meta.languages):
return
lang... | import logging
import langid
# https://github.com/saffsd/langid.py
from aleph.analyze.analyzer import Analyzer
log = logging.getLogger(__name__)
THRESHOLD = 0.9
CUTOFF = 30
class LanguageAnalyzer(Analyzer):
def analyze_text(self, document, meta):
if len(meta.languages):
return
lang... | Python | 0.000043 |
57fe1a44c2285f39cc1454bbd6cfb3ce621348c3 | Add a test to validate the user creation | aligot/tests/test_user.py | aligot/tests/test_user.py | # coding: utf-8
from django.core.urlresolvers import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from ..models import User
class TestUser(TestCase):
def setUp(self):
self.client = APIClient()
def test_create_without_params(se... | Python | 0.000001 | |
d63235026ec40857d3cbeef67064879d4b180eeb | add pip_upgrade | _bin/pip_upgrade.py | _bin/pip_upgrade.py | #!/usr/bin/env python
import pip
from subprocess import call
for dist in pip.get_installed_distributions():
call("pip install --upgrade " + dist.project_name, shell=True)
| Python | 0.000001 | |
cba5577517659e13511dcd45c996fd292cbd1cf8 | Add Eq typeclass definition | typeclasses/eq.py | typeclasses/eq.py | # typeclasses, an educational implementation of Haskell-style type
# classes, in Python
#
# Copyright (C) 2010 Nicolas Trangez <eikke eikke com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Fou... | Python | 0.000182 | |
97668e1be3c507ab30867752172a06c55f8bacd4 | Create epigraphscraper_Sqlite.py | epigraphscraper_Sqlite.py | epigraphscraper_Sqlite.py |
#see readme file before using!
#libraries & Global variables ----------------------------------------------------
from bs4 import BeautifulSoup
from os import walk, getcwd, listdir
from os.path import isfile, join
import os
import csv
import re
import sqlite3
import sys
totalEpigraphCount = 0
epigraphlessFileCount... | Python | 0 | |
dead36578f93ab2eb3a0b403a8da75b1ab0e3b12 | Remove the lock on the table ir_sequence and use FOR UPDATE | bin/addons/base/ir/ir_sequence.py | bin/addons/base/ir/ir_sequence.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# $Id$
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of asses... | # -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# $Id$
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of asses... | Python | 0.000042 |
2c7a40679e6202446a2e1076e19832589abf9ef9 | Add test mobile flatpage | geotrek/api/tests/test_mobile_flatpage.py | geotrek/api/tests/test_mobile_flatpage.py | from __future__ import unicode_literals
import json
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test.testcases import TestCase
from geotrek.flatpages.factories import FlatPageFactory
from geotrek.flatpages.models import FlatPage
FLATPAGE_DETAIL_PROPERTIES_JSO... | Python | 0 | |
4afd2553625db404cdfedfcf336079b3d9d723e3 | Add test for auth service pre-run time validation checks. | st2auth/tests/unit/test_validation_utils.py | st2auth/tests/unit/test_validation_utils.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | Python | 0 | |
b413af07917f3555edb4b69c4d4a0e4d5c4a629f | Create boolean_logic_from_scratch.py | boolean_logic_from_scratch.py | boolean_logic_from_scratch.py | #Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Boolean Logic from Scratch
#Problem level: 7 kyu
def func_or(a,b):
#your code here - do no be lame and do not use built-in code!
if bool(a) or bool(b):
return True
return False
def func_xor(a,b):
#your code here - remember to consider trut... | Python | 0.999243 | |
df9c8b2c2e616937afdbf09fc4a76ac7b821c8a5 | Add test (which we fail at the moment) | bugimporters/tests/test_spider.py | bugimporters/tests/test_spider.py | import os
import bugimporters.main
from mock import Mock
HERE = os.path.dirname(os.path.abspath(__file__))
# Create a global variable that can be referenced both from inside tests
# and from module level functions functions.
bug_data_transit = {
'get_fresh_urls': None,
'update': None,
'delete_by_url': ... | Python | 0 | |
cde401e95bef16b3bcc815251187af094240b598 | Create check_linux.py | check_linux.py | check_linux.py | import cups
from twill.commands import *
import html2text
import subprocess
import time
##Emotional words
acceptance = ['congratulat', 'enjoy', 'party']
rejection = ['sorry', 'unfortunately', 'disappoint']
##function to login and save the html
def retrieve():
go('https://decisions.mit.edu/decision.php')
fv("... | Python | 0.000002 | |
fde083c87f0e2582fbf57415e957b93d116ad67a | Create RequestHandler related to GCI. | app/soc/modules/gci/views/base.py | app/soc/modules/gci/views/base.py | #!/usr/bin/env python2.5
#
# Copyright 2011 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | Python | 0.000004 | |
e2669eddb9187db9a71095d8ed860f8b25369e78 | add new package (#20106) | var/spack/repos/builtin/packages/py-catkin-pkg/package.py | var/spack/repos/builtin/packages/py-catkin-pkg/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class PyCatkinPkg(PythonPackage):
"""Library for retrieving information about catkin packages."""
homepage = "ht... | Python | 0 | |
0106355df43bc35a75aafc6b9070f78131e89bef | Test for switching to postgres search backend | tests/search_backend_postgres.py | tests/search_backend_postgres.py | from wolis.test_case import WolisTestCase
class SearchBackendPostgresTest(WolisTestCase):
def test_set_search_backend(self):
self.login('morpheus', 'morpheus')
self.acp_login('morpheus', 'morpheus')
self.change_acp_knob(
link_text='Search settings',
check_pa... | Python | 0 | |
1f12da3d049527f838ab21c042b8f18e1977af49 | Migrate existing platform admin services to not be counted | migrations/versions/0283_platform_admin_not_live.py | migrations/versions/0283_platform_admin_not_live.py | """empty message
Revision ID: 0283_platform_admin_not_live
Revises: 0282_add_count_as_live
Create Date: 2016-10-25 17:37:27.660723
"""
# revision identifiers, used by Alembic.
revision = '0283_platform_admin_not_live'
down_revision = '0282_add_count_as_live'
from alembic import op
import sqlalchemy as sa
STATEMEN... | Python | 0 | |
8e0e28c45616479c3d1fea9be78553185126743b | change case_type to location_type to be more clear about what's expected | corehq/apps/consumption/models.py | corehq/apps/consumption/models.py | from decimal import Decimal
from couchdbkit.ext.django.schema import Document, StringProperty, DecimalProperty
TYPE_DOMAIN = 'domain'
TYPE_PRODUCT = 'product'
TYPE_SUPPLY_POINT_TYPE = 'supply-point-type'
TYPE_SUPPLY_POINT = 'supply-point'
class DefaultConsumption(Document):
"""
Model for setting the default ... | from decimal import Decimal
from couchdbkit.ext.django.schema import Document, StringProperty, DecimalProperty
TYPE_DOMAIN = 'domain'
TYPE_PRODUCT = 'product'
TYPE_SUPPLY_POINT_TYPE = 'supply-point-type'
TYPE_SUPPLY_POINT = 'supply-point'
class DefaultConsumption(Document):
"""
Model for setting the default ... | Python | 0.000002 |
0e71e8716a1e62a417cb4407e26ff60e233dae87 | Add new package: sbml (#16898) | var/spack/repos/builtin/packages/sbml/package.py | var/spack/repos/builtin/packages/sbml/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Sbml(CMakePackage):
"""Library for the Systems Biology Markup Language"""
homepage = ... | Python | 0.000001 | |
6857624e9d6633038f0565a520de856ee40def09 | Test with many envs and large groups | test/many_envs_test.py | test/many_envs_test.py | # Copyright (c) 2012 Lars Hupfeldt Nielsen, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
from .. import ConfigRoot
from ..envs import EnvFactory
ef = EnvFactory()
envs = []
groups = []
for ii in range(0, 16):
local_envs = []
for jj in range(0, 128):
local_envs... | Python | 0 | |
122fa6367dd7162503157b5f6e2739d28d5b2a4d | Fix stopping at breakpoints after stepping | python/helpers/pydev/_pydevd_frame_eval/pydevd_frame_tracing.py | python/helpers/pydev/_pydevd_frame_eval/pydevd_frame_tracing.py | import sys
import traceback
from _pydev_bundle import pydev_log
from _pydev_imps._pydev_saved_modules import threading
from _pydevd_bundle.pydevd_comm import get_global_debugger, CMD_SET_BREAK
from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame, NORM_PATHS_AND_BASE_CONTAINER
def update_globals_d... | import sys
import traceback
from _pydev_bundle import pydev_log
from _pydev_imps._pydev_saved_modules import threading
from _pydevd_bundle.pydevd_comm import get_global_debugger, CMD_SET_BREAK
from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame, NORM_PATHS_AND_BASE_CONTAINER
def update_globals_d... | Python | 0.000013 |
a4b242ebd107f9321cc5b87aee2cf608940007f4 | Make permission name more consistent. | product/migrations/0005_auto_20161015_1536.py | product/migrations/0005_auto_20161015_1536.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-10-15 15:36
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('product', '0004_auto_20161015_1534'),
]
operations = [
migrations.AlterModelOptions... | Python | 0.000001 | |
b0a4f510ed343825a8073a68c4dc0e3066b560ec | add example canICA | nilearn/example_canICA.py | nilearn/example_canICA.py | # -*- coding: utf-8 -*-
from nilearn import datasets
dataset = datasets.fetch_adhd()
func_files = dataset.func # The list of 4D nifti files for each subject
### Apply CanICA ##############################################################
from nilearn.decomposition.canica import CanICA
n_components = 20
canica = CanIC... | Python | 0.000004 | |
25c2502fce4556b5b72e96116745c83d1689677f | Add tests for artist serializers | artists/tests/test_serializers.py | artists/tests/test_serializers.py | from unittest import TestCase
from ..models import Artist, Hyperlink
from ..serializers import ArtistSerializer, HyperlinkSerializer
class HyperlinkSerializerTest(TestCase):
"""Tests for Hyperlink serializer."""
def test_valid_fields(self):
id_ = 4
name = 'jamendo'
display_name = "J... | Python | 0 | |
5e2cb194b174b8e9b99777d125f1fdaaf0eddace | add config handling, #25 | edisgo/tools/config.py | edisgo/tools/config.py | """This file is part of eDisGo, a python package for distribution grid
analysis and optimization.
It is developed in the project open_eGo: https://openegoproject.wordpress.com
eDisGo lives at github: https://github.com/openego/edisgo/
The documentation is available on RTD: http://edisgo.readthedocs.io
Based on code ... | Python | 0 | |
79563ccb72b50ad9b0a7cf037ad46efc98a1f79b | Create call.py | common/call.py | common/call.py | def call(mod,cmd,*args,**kargs):
"""Calls arbitrary python code
Arguments:
mod - The module from which you are calling
cmd - The command in said module
*args - Any arguments you need to give to it
index=0 - A specific index at which to return
end=0 - An end r... | Python | 0.000001 | |
686da2bf6b71961ea82e72640b7e6ff16c4723d7 | Add bubblesort example. Have problems with type inference. | examples/bubblesort.py | examples/bubblesort.py | from numba import *
import numpy as np
from timeit import default_timer as timer
#@autojit
#def bubbleswap(X, i):
# tmp = X[i]
# X[i] = X[i + 1]
# X[i + 1] = tmp
def bubblesort(X, doprint):
N = X.shape[0]
for end in range(N, 1, -1):
for i in range(end - 1):
cur = X[i]
... | Python | 0 | |
8c9ff0787d1d862765bbd657b09357d31a402e1f | add collector for https://torstatus.blutmagie.de/ | collectors/torstatus.blutmagie.py | collectors/torstatus.blutmagie.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import socket
import re
from bs4 import BeautifulSoup
import requests
import ipwhois
from pprint import pprint
def get_url(url):
try:
res = requests.get(url)
except requests.exceptions.ConnectionError:
raise requests.exceptions.ConnectionError("DNS lo... | Python | 0 | |
265b47de5a54d7c3a6a7be70b10f16b05f40d0b2 | add tests for "$ oj login --check URL" | tests/command_login.py | tests/command_login.py | import os
import subprocess
import sys
import time
import unittest
import tests.utils
class LoginTest(unittest.TestCase):
def snippet_call_login_check_failure(self, url):
ojtools = os.path.abspath('oj')
with tests.utils.sandbox(files=[]) as tempdir:
env = dict(**os.environ)
... | Python | 0 | |
0681d3833cd3c82d95ce80f12b492706f26b5ffa | add geco_slo_channel_plot in progress | geco_slow_channel_plot.py | geco_slow_channel_plot.py | #!/usr/bin/env python
# (c) Stefan Countryman 2017
import matplotlib.pyplot as plt
import numpy as np
import geco_gwpy_dump as g
import gwpy.segments
import gwpy.time
import sys
if len(sys.argv) == 1:
job = g.Job.load()
else:
job = g.Job.load(sys.argv[1])
segs = gwpy.segments.DataQualityFlag.query_segdb('L1:... | Python | 0.000001 | |
fa6f2e35db07571759d654088d77cb7a206c5722 | Create test.py | test.py | test.py | import unittest
import awesome
class TestMethods(unittest.TestCase):
def test_add(self):
self.assertEqual(awesome.smile(), ":)")
if __name__ == '__main__':
unittest.main()
| Python | 0.000001 | |
8bda92da85bd666aa91b657319a019e00bf27126 | add sample configuration file | ryu/services/protocols/bgp/bgp_sample_conf.py | ryu/services/protocols/bgp/bgp_sample_conf.py | import os
# =============================================================================
# BGP configuration.
# =============================================================================
BGP = {
# General BGP configuration.
'routing': {
# ASN for this BGP instance.
'local_as': 64512,
... | Python | 0 | |
1fb737426f69d5e5dbe48dd66a13a38918707f23 | Add tests to detcatscores | pysteps/tests/test_detcatscores.py | pysteps/tests/test_detcatscores.py | # -*- coding: utf-8 -*-
import pytest
import numpy as np
from pysteps.verification import det_cat_fcst
from numpy.testing import assert_array_almost_equal
# CREATE A LARGE DATASET TO MATCH
# EXAMPLES IN
# http://www.cawcr.gov.au/projects/verification/
fct_hits = 1.0*np.ones(82)
obs_hits = 1.0*np.ones(82)
fct_fa = 1.... | Python | 0.000001 | |
42af700af58588fccaa84f5348a5c854d095d1a9 | Add ex2.2: multiple simple requests | code/ex2.2-simple_requests.py | code/ex2.2-simple_requests.py | from urllib.request import urlopen
import time
URLS = [
'http://127.0.0.1:8000',
'http://127.0.0.1:8000',
'http://127.0.0.1:8000',
]
def request_greetings():
responses = []
for url in URLS:
resp = urlopen(url)
responses.append(resp.read().decode('utf-8'))
texts = '\n'.join(resp... | Python | 0.000034 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.