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
7e0e196c049d41cfee1eb3d4432967e62c6f37ed
Add Unit Tests for Blacklists V2
designate/tests/test_api/test_v2/test_blacklists.py
designate/tests/test_api/test_v2/test_blacklists.py
# Copyright 2014 Rackspace Hosting # All rights reserved # # Author: Betsy Luzader <betsy.luzader@rackspace.com> # # 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...
Python
0.000005
67596d081059a004e5f7ab15f7972773fdf2f15e
ADD PyGrid SetupService message tests
tests/syft/grid/messages/setup_msg_test.py
tests/syft/grid/messages/setup_msg_test.py
# syft absolute import syft as sy from syft.core.io.address import Address from syft.grid.messages.setup_messages import CreateInitialSetUpMessage from syft.grid.messages.setup_messages import CreateInitialSetUpResponse from syft.grid.messages.setup_messages import GetSetUpMessage from syft.grid.messages.setup_messages...
Python
0
08b52fab8c561834996bd23a5a7654bfac7ea75e
Fix MR comments (NC-1168)
nodeconductor/cost_tracking/filters.py
nodeconductor/cost_tracking/filters.py
from __future__ import unicode_literals from django.contrib.contenttypes.models import ContentType from django.db.models import Q import django_filters from rest_framework import filters from nodeconductor.core import filters as core_filters from nodeconductor.cost_tracking import models, serializers from nodeconduct...
from __future__ import unicode_literals from django.contrib.contenttypes.models import ContentType from django.db.models import Q import django_filters from rest_framework import filters from nodeconductor.core import filters as core_filters from nodeconductor.cost_tracking import models, serializers from nodeconduct...
Python
0
cb707785cb165e8570aa8201d2e71b5ed2c2f3bd
Use new rebot model
utest/webcontent/spec/data/create_jsdata_for_specs.py
utest/webcontent/spec/data/create_jsdata_for_specs.py
#!/usr/bin/env python import fileinput from os.path import join, dirname, abspath import sys import os from robot.result.datamodel import DatamodelVisitor BASEDIR = dirname(abspath(__file__)) OUTPUT = join(BASEDIR, 'output.xml') sys.path.insert(0, join(BASEDIR, '..', '..', '..', '..', 'src')) import robot from rob...
#!/usr/bin/env python import fileinput from os.path import join, dirname, abspath import sys import os BASEDIR = dirname(abspath(__file__)) OUTPUT = join(BASEDIR, 'output.xml') sys.path.insert(0, join(BASEDIR, '..', '..', '..', '..', 'src')) import robot from robot.reporting.outputparser import OutputParser from ro...
Python
0
3608c4d3b559ba7fa1bd9629231e98196681caa4
add package py-gdbgui (#7715)
var/spack/repos/builtin/packages/py-gdbgui/package.py
var/spack/repos/builtin/packages/py-gdbgui/package.py
############################################################################## # Copyright (c) 2013-2017, 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
478072e8350d03655364ea9147bbe21bafabbcce
Add tests for template tags
geotrek/feedback/tests/test_template_tags.py
geotrek/feedback/tests/test_template_tags.py
from datetime import datetime from django.test import TestCase from geotrek.authent.tests.factories import UserFactory, UserProfileFactory from geotrek.feedback.templatetags.feedback_tags import ( predefined_emails, resolved_intervention_info, status_ids_and_colors) from geotrek.feedback.tests.factories import (P...
Python
0
8355cb358d14589a194926d37beeb5af7af2a591
Increase event image url limit from 200
falmer/events/migrations/0012_auto_20170905_1208.py
falmer/events/migrations/0012_auto_20170905_1208.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-09-05 11:08 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('events', '0011_auto_20170905_1028'), ] operations = [ migrations.AlterField...
Python
0.000114
a16b4401f37f08d8cb5e1f9ec1b7d4a3221360ab
Add test case for regular extrusion
test/test_regular_extrusion.py
test/test_regular_extrusion.py
# -*- coding: utf-8 -*- """Creates regular cube mesh by extrusion. """ import pygmsh from helpers import compute_volume def test(): x = 5 y = 4 z = 3 x_layers = 10 y_layers = 5 z_layers = 3 geom = pygmsh.built_in.Geometry() p = geom.add_point([0, 0, 0], 1) _, l, _ = geom.extrude(p...
Python
0
5c7b70061d6e96619c6e3a40c87aaec39b408fdf
Enable subscription admin area
subscription/admin.py
subscription/admin.py
from django.contrib import admin from subscription.models import MessageSet, Message, Subscription admin.site.register(MessageSet) admin.site.register(Message) admin.site.register(Subscription)
Python
0
78552d3de73174dd0ffdf9a58009281013dcf640
make interface consistent for add_sample
rlkit/data_management/replay_buffer.py
rlkit/data_management/replay_buffer.py
import abc class ReplayBuffer(object, metaclass=abc.ABCMeta): """ A class used to save and replay data. """ @abc.abstractmethod def add_sample(self, observation, action, reward, terminal, next_observation, **kwargs): """ Add a transition tuple. """ ...
import abc class ReplayBuffer(object, metaclass=abc.ABCMeta): """ A class used to save and replay data. """ @abc.abstractmethod def add_sample(self, observation, action, reward, next_observation, terminal, **kwargs): """ Add a transition tuple. """ ...
Python
0
7bd6f3e7751deecfc3cd555fc071d722c856802c
Implement division using built in library function
chips/compiler/builtins.py
chips/compiler/builtins.py
#!/usr/bin/env python """Support Library for builtin Functionality""" __author__ = "Jon Dawson" __copyright__ = "Copyright (C) 2013, Jonathan P Dawson" __version__ = "0.1" builtins=""" unsigned unsigned_divide_xxxx(unsigned dividend, unsigned divisor){ unsigned denom = divisor; unsigned bit = 1; unsigned...
Python
0.000001
6eb49ae8dcf33a7d7be9ed3c8208bc83a9a46757
Create python_wiki_one.py
ckOLDab/python_wiki_one.py
ckOLDab/python_wiki_one.py
import time import BaseHTTPServer HOST_NAME = '127.0.0.1' # !!!REMEMBER TO CHANGE THIS!!! PORT_NUMBER = 80 # Maybe set this to 9000. class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler): def do_HEAD(s): s.send_response(200) s.send_header("Content-type", "text/html") s.end_headers() ...
Python
0.999848
4fd9984e4187a64906ca9e0b3a7ccf01486c156d
Create Fred14_LeftArmServos.py
home/Ray.Edgley/fred/fred01/Fred14_LeftArmServos.py
home/Ray.Edgley/fred/fred01/Fred14_LeftArmServos.py
######################################################### # Fred14 Setup the Left Arm Servos ######################################################### # We will be using the following services: # Servo Service ######################################################### # I Fred's Left Arm, we have the Bicep Rotator, t...
Python
0
53cdd6e7bcb37567382f3b3688b6a55f1b2968be
Add test_binaryclassifier
tests/test_binaryclassifier.py
tests/test_binaryclassifier.py
import numpy as np from sklearn import svm, datasets from darwin.pipeline import ClassificationPipeline def test_binary_classification_with_classification_pipeline(): # generate the dataset n_samples=100 n_features=20 x, y = datasets.make_gaussian_quantiles(mean=None, cov=1.0, n_samples=n_samples, ...
Python
0.000015
bb80025f3ed8169a2558e9c5c6bc4db5a862d7ae
Integrate LLVM at llvm/llvm-project@529a3d87a799
third_party/llvm/workspace.bzl
third_party/llvm/workspace.bzl
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "529a3d87a799a2cba29bc1d0f426a00d5bb4c88f" LLVM_SHA256 = "3d2ca52bd36ad3904f2f5d0e43935b0e82f3d1ac137e0a89025141e36735944f" tf_http_archive( ...
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "6139626d738fd03b968e07698f5cd26924e3cd65" LLVM_SHA256 = "b9581ac44a7d9dd3a8470497cddb63c387ab6520d82d077fb609bc29b4e7b887" tf_http_archive( ...
Python
0.000001
fee6e923b27947721ba1ea4ce5005f54eabba421
Integrate LLVM at llvm/llvm-project@4504e1134c91
third_party/llvm/workspace.bzl
third_party/llvm/workspace.bzl
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "4504e1134c9118f3c322685f8a90129e09bab92c" LLVM_SHA256 = "2b1d7a96ff37600cae12d2ed51b9f0554b1bbc6511ffe51ac7525928b29bab44" tf_http_archive( ...
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "0ad1d9fdf22dad41312e02b8bc990bf58ce1744c" LLVM_SHA256 = "517db6d771cf24d9f0aea6d4fdd59591347c7eb9d86ef58521fe8cb929fbe82b" tf_http_archive( ...
Python
0.000003
a868b0d057b34dbd487a1e3d2b08d5489651b3ff
Integrate LLVM at llvm/llvm-project@fe611b1da84b
third_party/llvm/workspace.bzl
third_party/llvm/workspace.bzl
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "fe611b1da84b9442c093739394d336af9e99c1a1" LLVM_SHA256 = "52edc892b020736f4c53e52b63687ee7caab93c90a0062b4026f4d49fc18266f" tf_http_archive( ...
"""Provides the repository macro to import LLVM.""" load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" LLVM_COMMIT = "bd7ece4e063e7afd08cbaa311878c09aadf5ec21" LLVM_SHA256 = "e9390dfa94c1143f35437bea8a011b030194e047bc3df45e2627cff88f83d2ed" tf_http_archive( ...
Python
0.000006
ba7bae1d4b193eaf29b827ac6e48be5afc114613
Rename file and fix up paths in code.
kaggle-classification/keras-trainer/model.py
kaggle-classification/keras-trainer/model.py
""" Classifiers for the Toxic Comment Classification Kaggle challenge, https://www.kaggle.com/c/jigsaw-toxic-comment-classification-challenge """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import pandas as pd import os import tensorf...
Python
0
d8d87a0cdcce8c8ec1770aa722a17a40d25409e6
Add migration script to migrate all "extra" entries to lists
scripts/migration/migrate_registration_extra_again.py
scripts/migration/migrate_registration_extra_again.py
""" Changes existing question.extra on all registrations and draft registrations to a list. Required for multiple files attached to a question. """ import sys import logging from modularodm import Q from website.app import init_app from scripts import utils as scripts_utils from website.models import Node, DraftRegist...
Python
0.000001
1ee8ad86132771f8124c7a3a3321b582dd6b816d
add migration
servicerating/migrations/0002_servicerating_dedupe.py
servicerating/migrations/0002_servicerating_dedupe.py
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import DataMigration from django.db import models class Migration(DataMigration): def forwards(self, orm): crontab = orm['djcelery.CrontabSchedule']( month_of_year="*", day_of_week="*", hour="...
Python
0.000001
6b01692fcdaf0dc01bb32eefcf883200d2864f60
make paths work independent of cursor
statscraper/scrapers/PXWebScraper.py
statscraper/scrapers/PXWebScraper.py
# encoding: utf-8 """ A wrapper around the PX-Web API. As implementations and versions vary, this is best used as a base class, for more specific scrapers to extend. If used directly, an API endpoint must be set: scraper = PXWeb(base_url="http://api.example.com/") # ...or: scraper =...
# encoding: utf-8 """ A wrapper around the PX-Web API. As implementations and versions vary, this is best used as a base class, for more specific scrapers to extend. If used directly, an API endpoint must be set: scraper = PXWeb(base_url="http://api.example.com/") # ...or: scraper =...
Python
0.000003
a973c3b5d1683cd27f8b88c4c38daa934dae75c1
refactor storeRegiser
usermanage/views/storeRegister.py
usermanage/views/storeRegister.py
from django.shortcuts import render, redirect from django.http import HttpResponseRedirect from django.contrib.auth import login, authenticate, logout from django.contrib.auth.models import User, Group from django.contrib.auth.decorators import login_required, user_passes_test, permission_required from django.contrib.a...
Python
0.99987
9316bc07c77e2f51332a40bf430cef117f4d89e1
Add script to check for Dockerfile coverage
util/check_dockerfile_coverage.py
util/check_dockerfile_coverage.py
import yaml import os import pathlib2 import itertools import argparse import logging import sys TRAVIS_BUILD_DIR = os.environ.get("TRAVIS_BUILD_DIR") CONFIG_FILE_PATH = pathlib2.Path(TRAVIS_BUILD_DIR, "util", "parsefiles_config.yml") LOGGER = logging.getLogger(__name__) def check_coverage(containers): # open con...
Python
0
c78c82987feb4dbe91b750ab90a3d163fc1340c6
Add datatables filter mixin
rhinocloud/contrib/jquery/views.py
rhinocloud/contrib/jquery/views.py
from django.views import generic from django.db.models import Q from django.core.exceptions import ImproperlyConfigured class DataTablesServerDataMixin(object): query_class = Q initial_query_kwargs = {} searchable_fields = () def get_searchable_fields(self): if self.searchable_fields is n...
Python
0
4aeec42ca745db546b66f0a708f1c13f806164f8
Add commmand to re-assign person cases to facilities
custom/enikshay/management/commands/reassign_from_facility.py
custom/enikshay/management/commands/reassign_from_facility.py
from __future__ import absolute_import, print_function import csv import datetime import six from django.core.management.base import BaseCommand from casexml.apps.case.util import get_all_changes_to_case_property from corehq.apps.hqcase.utils import bulk_update_cases from corehq.util.log import with_progress_bar fro...
Python
0
5e9a66fb07b8071a8ac3d2130c2796a7cda03739
Create ConfigurationPIN.py
ConfigurationPIN.py
ConfigurationPIN.py
# -*- coding: utf8 -*- # Imports necessaires import re import sys import os import random name = os.popen('whoami').read() cutName = name.split("\n") name = cutName[0] sys.path.append('~/AndroidViewClient/src/') from com.dtmilano.android.viewclient import ViewClient from com.dtmilano.android.adb.adbclient import AdbCli...
Python
0.000001
805708048f493ca538a9e0b8d9d40ae1d4baf2c3
Add a tool to reproduce HTTP KeepAlive races in OpenStack gate jobs.
keepalive-race/keep-alive-race.py
keepalive-race/keep-alive-race.py
#!/usr/bin/python3 """ This script demonstrates a race condition with HTTP/1.1 keepalive """ import decimal import json import subprocess import time import threading import requests requests.packages.urllib3.disable_warnings() CREDS = json.loads(subprocess.check_output( "openstack --os-cloud devstack token issue...
Python
0.000029
e18c1d6a62d8a896e853f1bd16d4ea5bf6f67401
add statistics script
statistics.py
statistics.py
#!/usr/bin/env python """ Takes the database from the output of integrate.py (e.g. after the disambiguated inventors have been merged into the database) and computes statistics on top of it """ import uuid from datetime import datetime from lib import alchemy from collections import Counter, defaultdict def compute_f...
Python
0.000001
64314d580fac2cf0e0434527437b106a94e8ded0
Add setup.py build for kivy-launcher reboot
testapps/testlauncherreboot_setup/sdl2.py
testapps/testlauncherreboot_setup/sdl2.py
''' Clone Python implementation of Kivy Launcher from kivy/kivy-launcher repo, install deps specified in the OPTIONS['apk']['requirements'] and put it to a dist named OPTIONS['apk']['dist-name']. Tested with P4A Dockerfile at 5fc5241e01fbbc2b23b3749f53ab48f22239f4fc, kivy-launcher at ad5c5c6e886a310bf6dd187e992df97286...
Python
0
e11de6b814da4e5ade9fadaa035d6141ab3c113f
add test that features can be read and written ok
test/test_features.py
test/test_features.py
#!/usr/bin/python import unittest import RMF class GenericTest(unittest.TestCase): def _create(self, path): fh= RMF.create_rmf_file(path) rt= fh.get_root_node() reps=[rt.add_child("rep"+str(i), RMF.REPRESENTATION) for i in range(0,5)] sf= RMF.ScoreFactory(fh) fn= rt.add_child("feature...
Python
0
48da7ceb86387d3cb6fd53f50110232813123ecc
Add tests for ansible roster virtual
tests/pytests/unit/roster/test_ansible.py
tests/pytests/unit/roster/test_ansible.py
import pytest import salt.roster.ansible as ansible from tests.support.mock import patch @pytest.mark.xfail @pytest.mark.parametrize( "which_value", [False, None], ) def test_virtual_returns_False_if_ansible_inventory_doesnt_exist(which_value): with patch("salt.utils.path.which", autospec=True, return_val...
Python
0
f3e3ab4fea1d367578adffbefd072616beaee65e
Create word_a10n.py
word_a10n.py
word_a10n.py
#Kunal Gautam #Codewars : @Kunalpod #Problem name: Word a10n (abbreviation) #Problem level: 6 kyu import re def abbreviate(s): words = re.findall('[A-Za-z][A-Za-z][A-Za-z][A-Za-z]+', s) for word in words: s = s.replace(word, word[0] + str(len(word) - 2) + word[-1]) return s
Python
0.999953
ccb2c0c2c2fac64b88248819b00feddeaafd252c
Create evernote_test.py
evernote_test.py
evernote_test.py
from evernote import * NOTE1 = """<note> <guid>6BA8DC47-EB38-40D9-BE32-5D5DD82E9EC7</guid> <created>2013-07-12T19:22:13Z</created> <tag>poetry</tag> <tag>whitman</tag> <content> Gliding o'er all, through all, Through Nature, Time, and Space, As a ship on the waters advancing, The voyage of th...
Python
0.000001
8dd3207298e7d81f5d4abdfa62604d5849d132fd
Add Python hello client
example/hello.py
example/hello.py
#!/usr/bin/env python import dbus bus = dbus.SessionBus() remote_object = bus.get_object("org.za.hem.DBus", "/Root") dbus_interface = "org.designfu.SampleInterface" iface = dbus.Interface(remote_object, dbus_interface) hello_reply_list = remote_object.HelloWorld(17, "Hello from example-client.py!", dbus_interface=d...
Python
0.000206
5836eb513b244a21e33e111cd3c3d6f33530aeae
Add a simple widget that sets up basic layout for common controls.
source/harmony/ui/widget/simple.py
source/harmony/ui/widget/simple.py
# :coding: utf-8 # :copyright: Copyright (c) 2013 Martin Pengelly-Phillips # :license: See LICENSE.txt. from PySide import QtGui from .base import Widget class Simple(Widget): '''Simple widget that wraps a single control.''' def _construct(self): '''Construct widget.''' super(Simple, self)....
Python
0
6b5850d70a1c52b617fc7daeefa57023f6ef63c7
Add some paramaterized tests for skolemization and de-skolemization
test/test_graph/test_skolemization.py
test/test_graph/test_skolemization.py
import logging import re from test.testutils import GraphHelper from typing import Pattern, Union import pytest from rdflib import Graph from rdflib.namespace import Namespace from rdflib.term import BNode, Literal, URIRef EG = Namespace("http://example.com/") base_triples = { (EG.subject, EG.predicate, EG.obje...
Python
0
a35be4a666c26ec13d61ee30639d9c3894d129e1
add py script for profiling time
scripts/profile-time.py
scripts/profile-time.py
import sys import timeit import logging import argparse import subprocess import tqdm import tabulate import capa.main import capa.perf import capa.rules import capa.engine import capa.helpers import capa.features import capa.features.common import capa.features.freeze logger = logging.getLogger("capa.profile") de...
Python
0
8628ab8cbcb185826e97af9148ec7d07861e29e7
Add setup_pfiles.py to setup parameter files for CIAO tools
scripts/setup_pfiles.py
scripts/setup_pfiles.py
# Copyright (c) 2017 Weitian LI <liweitianux@live.com> # MIT license # # Weitian LI # 2017-02-06 """ Prepare the CIAO parameter files and setup the PFILES environment variable to keep the pfiles locally, in order to avoid the conflicts between multiple instance of the same CIAO tools. """ import os import subprocess ...
Python
0
6c8966e0e299c12e95d41009a8dde7519946b432
add db level constraint for one active subscription per domain
corehq/apps/accounting/migrations/0006_unique_active_domain_subscription.py
corehq/apps/accounting/migrations/0006_unique_active_domain_subscription.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.7 on 2017-04-22 17:18 from __future__ import unicode_literals from django.db import migrations from corehq.sql_db.operations import HqRunSQL class Migration(migrations.Migration): dependencies = [ ('accounting', '0005_automatic_downgrade_adjustment_met...
Python
0
05c6336c3d3f34994b9597396e86bfd8d20ded4c
implement basic Sentiment Analyzer Dataset: Sentiment140 Classifier: Naive Bayes
nltk/sentiment/sentiment_analyzer.py
nltk/sentiment/sentiment_analyzer.py
from __future__ import print_function from nltk.tokenize import word_tokenize from nltk.probability import FreqDist from nltk.classify.util import apply_features, accuracy from nltk.classify.naivebayes import NaiveBayesClassifier import pdb import csv import sys import time import io import pickle import random # To im...
Python
0.999989
faaa206923b99f4d986a32ddfd854b234377e988
Add ena2fasta script
bin/ena2fasta.py
bin/ena2fasta.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright [2009-2020] EMBL-European Bioinformatics Institute 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...
Python
0
c913d1fc3ac24b2491783dc9c33f401180c7b4b0
test delivering with failures, refactor tests
tests/test_postman.py
tests/test_postman.py
from pytest import fixture from mock import Mock, call from mailthon.postman import Postman from mailthon.envelope import Envelope from mailthon.enclosure import PlainText from mailthon.headers import sender, to, subject @fixture def smtp(): smtp = Mock() smtp.return_value = smtp smtp.noop.return_value = ...
from pytest import fixture from mock import Mock, call from mailthon.postman import Postman from mailthon.envelope import Envelope from mailthon.enclosure import PlainText @fixture def smtp(): smtp = Mock() smtp.return_value = smtp smtp.noop.return_value = (250, 'ok') smtp.sendmail.return_value = {} ...
Python
0.000001
c6af972ca6dfd6396b3f16e2e218263faffe16ab
Add run_mraic.py
bin/run_mraic.py
bin/run_mraic.py
#!/usr/bin/env python """ Name: run_mraic.py Author: Michael G. Harvey Date: 5 July 2013 Description: Run mraic.pl (Nylanderb 2004) on a folder of alignments in phylip/phyml format. Usage: python run_mraic.py mraic_dir in_dir out_dir python run_mraic.py /Users/michaelharvey/Applications/mraic /Users/michaelharvey...
Python
0.000005
2e43441e43942b2f24a89209cfdc56652523901d
Create test_pir.py
test/test_pir.py
test/test_pir.py
from ... if __name__ == "__main__": try : pir = PIR() pir.start() while 1 : print(pir.result()) except KeyboardInterrupt : pir.stop() pir.cleanup()
Python
0.000051
ed2548ca027b4fd062a10ddf2ce359d9115f40a4
add a __main__.py to nuitka works
borg/__main__.py
borg/__main__.py
from borg.archiver import main main()
Python
0.000037
8195278aa5044371c8fa7963be15169209e1b92a
Add new test to call neutron API and check results in dragonflow db.
dragonflow/tests/fullstack/test_neutron_api.py
dragonflow/tests/fullstack/test_neutron_api.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
Python
0.000006
fefe47a03337d072e47b439a940d7b6eeef56b93
Add OpenTracing example
example/opentracing.py
example/opentracing.py
# encoding=utf-8 import opentracing import instana import time # Loop continuously with a 2 second sleep to generate traces while True: entry_span = opentracing.tracer.start_span('universe') entry_span.set_tag('http.method', 'GET') entry_span.set_tag('http.url', '/users') entry_span.set_tag('span.kind...
Python
0
f3448d0b37fdac8976a2cc8e4604a6cb2ea7a4ed
add vsmlib.utils which should have been part of commit 6238f235
vsmlib/utils.py
vsmlib/utils.py
def parse_signal_num_file(filename): signal_to_num = {} vsi_version = -1 try: with open(filename) as signal_to_num_file: lines = signal_to_num_file.readlines() for line in lines: line_stripped = line.strip() if vsi_version < 0: ...
Python
0
8bd66387ba5cd50dc0b545dc7b627792ed601faa
Add test
tests/context.py
tests/context.py
import os import sys sys.path.insert(0, os.path.abspath('..')) import gaend
Python
0.000005
59e546ae5afe22aab967e5376c8799e29ccbd86a
Add the basic version of my file comparison script
directoryFileContentCmp.py
directoryFileContentCmp.py
#! /usr/env/python import os import hashlib import sys bufsize = 65536 # Path1 = '/Users/kirkchambers/Desktop' # Path2 = '/Users/kirkchambers/DataSets' def generate_file_digests_for(path): path_set = set() for item in os.walk(path): (directory, _subdirectories, files) = item for file in files: if (file[0] ==...
Python
0
f4709d2cadfcb5fde3b5a19664e6e316632bd6f7
Add smile_followers module
smile_followers/tools/mail_followers.py
smile_followers/tools/mail_followers.py
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2014 Toyota Industrial Equipment SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Aff...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2014 Toyota Industrial Equipment SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Aff...
Python
0.000001
345758259d9ee80826758373c3970db1c28a870b
Bump development version
djangocms_blog/__init__.py
djangocms_blog/__init__.py
__version__ = '0.3.a3'
__version__ = '0.3.a2'
Python
0
4af2a6a62e4be78bd20550c3ae5089c51b4fec62
add separate function for pagination
students/utils.py
students/utils.py
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger def paginate(objects, size, request, context, var_name='object_list'): """Paginate objects provided by view. This function takes: * list of elements; * number of objects per page; * request object to get url para...
Python
0.000007
0ee1150e1f8f0c8cae7b906c4d349b8867bbe0b4
Add dmrg example
examples/dmrg/30-dmrg_casscf_nevpt2_for_Cr2.py
examples/dmrg/30-dmrg_casscf_nevpt2_for_Cr2.py
#!/usr/bin/env python import numpy from pyscf import gto from pyscf import scf from pyscf import mcscf from pyscf.mrpt.nevpt2 import sc_nevpt from pyscf.dmrgscf.dmrgci import DMRGSCF # # This calculation requires about 10 GB memory per processor. # b = 1.5 mol = gto.Mole() mol.verbose = 5 mol.output = 'cr2-%3.2f.out'...
Python
0
1830c24988fccd7069bb4f9d4c66940ce623425f
add execute apcupsd cgi sample
execute_apcupsd_cgi.py
execute_apcupsd_cgi.py
from http.server import CGIHTTPRequestHandler, test import os def main(): # http://stackoverflow.com/questions/11419572/how-to-set-the-documentroot-while-using-pythons-httpserver os.chdir(r"C:\apcupsd") # ディレクトリ名の前の`/`を付け忘れると正常に動作しない CGIHTTPRequestHandler.cgi_directories = ["/cgi"] test...
Python
0
c3afc6c28530c3dfc3bd57d9a1841a60bf92ba4f
Fix bug which caused page cyclers to always clear cache before load.
tools/perf/benchmarks/netsim_top25.py
tools/perf/benchmarks/netsim_top25.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. from telemetry import test from perf_tools import page_cycler class NetsimTop25(test.Test): """Measures load time of the top 25 sites under simulated cab...
# 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. from telemetry import test from perf_tools import page_cycler class NetsimTop25(test.Test): """Measures load time of the top 25 sites under simulated cab...
Python
0.000008
00a99f80f555ae23aeefa8b8fe284f74c28f4252
add update example
scripts/automation/trex_control_plane/stl/examples/stl_imix_bidir_update.py
scripts/automation/trex_control_plane/stl/examples/stl_imix_bidir_update.py
import stl_path from trex_stl_lib.api import * import imp import time import json from pprint import pprint import argparse # IMIX test # it maps the ports to sides # then it load a predefind profile 'IMIX' # and attach it to both sides and inject # at a certain rate for some time # finally it checks that all packets...
Python
0
b5c21a5eeb8894ae93290c4c78fa23e5207bc0b3
Create Flaskapp.wsgi
Flaskapp.wsgi
Flaskapp.wsgi
#!/usr/bin/python import sys import logging logging.basicConfig(stream=sys.stderr) sys.path.insert(0,"/var/www/FlaskApp/") from FlaskApp import app as application application.secret_key = 'Add your secret key'
Python
0.000206
3c2f3baa1a76d386d5604c0c1dc8d4f3a33b11ad
Create Helloworld.py
Helloworld.py
Helloworld.py
print('Hello World!')
Python
0.000446
13e4fbdf81c9012ff82081d6030191be226d716c
Add script for verifying commit message format.
tools/verifygitlog.py
tools/verifygitlog.py
#!/usr/bin/env python3 import re import subprocess import sys verbosity = 0 # Show what's going on, 0 1 or 2. suggestions = 1 # Set to 0 to not include lengthy suggestions in error messages. def verbose(*args): if verbosity: print(*args) def very_verbose(*args): if verbosity > 1: print(*...
Python
0.000153
ee614036b45e9f10f680cef56a5eaa2d86c424fb
Create cybercrimeatmtracker.py
plugins/feeds/public/cybercrimeatmtracker.py
plugins/feeds/public/cybercrimeatmtracker.py
import re import logging from dateutil import parser from datetime import datetime, timedelta from core.observables import Hash from core.feed import Feed from core.errors import ObservableValidationError class CybercrimeAtmTracker(Feed): default_values = { 'frequency': timedelta(hours=1), 'name'...
Python
0.000156
ece838042acd75ba7edde833856ac02e4efe9977
Create PPTconnect.py
PPTconnect.py
PPTconnect.py
from TwitterAPI import TwitterAPI import win32com.client from MSO import * # Open PowerPoint Application = win32com.client.Dispatch("PowerPoint.Application") # Add a presentation Presentation = Application.Presentations.Add() # Go to http://dev.twitter.com and create an app. # The consumer key and secret will be ge...
Python
0
65029a09af9dcafc156a5a0632a63e3cf4b6c50d
add benchmark to compare to lasagne
benchmarks/lag_task_lasgne.py
benchmarks/lag_task_lasgne.py
from __future__ import division, absolute_import from __future__ import print_function, unicode_literals import numpy as np import theano import theano.tensor as T import lasagne fX = theano.config.floatX # ################################## config ################################## N_TRAIN = 1000 LAG = 10 LENGTH =...
Python
0
33abec38e82e132a6e192d5ae0535b84d8aa47f4
add import script for Poole
polling_stations/apps/data_collection/management/commands/import_poole.py
polling_stations/apps/data_collection/management/commands/import_poole.py
from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter class Command(BaseXpressDemocracyClubCsvImporter): council_id = 'E06000029' addresses_name = 'parl.2017-06-08/Version 1/Democracy_Club__08June2017.CSV' stations_name = 'parl.2017-06-08/Version 1/Democracy_Club__08June2017.CS...
Python
0
b6b92e278202c27b124909aa5352726799d8d162
add stack with max python solution
08-stack-n-queue/8.1-stack-with-max/python/stackMax.py
08-stack-n-queue/8.1-stack-with-max/python/stackMax.py
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Aug 18 10:08:25 2017 @author: LiuQianKevin """ class Stack: class cache: def __init__(self, _max = -float('inf'), count = 0): self.max = _max; self.count = count; def __init__(self): self._el...
Python
0
f78f74d836d2eca1cafe3b6401b5c8d13e6d139b
Fix type1/type2
geotrek/tourism/migrations/0004_auto_20190328_1339.py
geotrek/tourism/migrations/0004_auto_20190328_1339.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.14 on 2019-03-28 12:39 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('tourism', '0003_auto_20190306_1417'), ] operations = [ migrations.AlterFie...
Python
0.999983
ef751116c597dfbd12eac849dd0cb3ca02eb6315
Add SettingsFromCategoryModel that lists settings in a certain category
UM/Qt/Bindings/SettingsFromCategoryModel.py
UM/Qt/Bindings/SettingsFromCategoryModel.py
from PyQt5.QtCore import Qt, QCoreApplication, pyqtSlot from UM.Qt.ListModel import ListModel from UM.Settings.Setting import Setting from UM.Resources import Resources from UM.Application import Application class SettingsFromCategoryModel(ListModel): NameRole = Qt.UserRole + 1 TypeRole = Qt.UserRole + 2 ...
Python
0
f29a0845bc0983e18ce6484543b206dfb3091818
Add easier way to import cv2
vision/opencv.py
vision/opencv.py
import sys sys.path.append('lib/opencv/build/lib') import cv2
Python
0.000003
2848955e59b5106ffe48c4ebfa05095a6be460e5
Add visual script
visual/visual.py
visual/visual.py
#!/usr/bin/env python3 import re import numpy as np import matplotlib.pyplot as plt import unittest class Parser: '''Wta log parser''' def __init__(self): '''Open log file''' self._pattern = re.compile( r'^ra=((?:[0-9a-fA-F]{2}:){5}(?:[0-9a-fA-F]{2}))[ \t]+' + r'ta=((?:[0-9a-fA-F]{2}:){5}(?:[0-9a-fA-F]{2...
Python
0.000001
b5cc83a705eaa22872d304b92c7b6e57b5581604
Add unit-test for "readbytes_multiple"
puresnmp/test/test/test_helpers.py
puresnmp/test/test/test_helpers.py
''' Tests for unit-test helpers ''' from textwrap import dedent from binascii import hexlify import puresnmp.test as th from io import StringIO def test_readbytes_multiple(): data = StringIO(dedent( '''\ # # This is a comment # 30 2d 02 01 01 04 07 70 72 69 76 61 74 65 a...
Python
0.000002
f434e45b58bfa7001d21d1920a65903f941df833
Add __main__.py so that the package can be executed by `python -m jiebarpc` [ciskip]
jiebarpc/__main__.py
jiebarpc/__main__.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import sys import argparse from jiebarpc import JiebaRPCServer, JiebaRPCDispatcher def main(host, port, processnum=1): server = JiebaRPCServer(JiebaRPCDispatcher(processnum)) server.listen(host, port) s...
Python
0.000001
5d297710416ebaea3a79e1ded0604d53178c493a
add python solution for Project Euler problem 1
python_challenges/project_euler/problem_1.py
python_challenges/project_euler/problem_1.py
__author__ = 'tilmannbruckhaus' def divisible_by_3_or_5(i): divisible = i % 3 == 0 or i % 5 == 0 # print("natural number:", i, "is divisible:", divisible) return divisible def sum_of_multiples_of_3_or_5(limit): # If we list all the natural numbers below 10 that are multiples of 3 or 5, # we get ...
Python
0.998958
1db14473edff479f97703fb68cb1aa8d65c25023
Add Python benchmark
lib/node_modules/@stdlib/math/base/special/exp/benchmark/python/benchmark.py
lib/node_modules/@stdlib/math/base/special/exp/benchmark/python/benchmark.py
#!/usr/bin/env python """Benchmark exp.""" import timeit name = "exp" repeats = 3 iterations = 1000000 def print_version(): """Print the TAP version.""" print("TAP version 13") def print_summary(total, passing): """Print the benchmark summary. # Arguments * `total`: total number of tests ...
Python
0.000138
d1f4e257b449b6993e0cdc87055113018b6efabb
Create promoter_bin.py
code_collection/promoter_bin.py
code_collection/promoter_bin.py
import sys peak=[] with open(sys.argv[1],'r') as f: for line in f: line=line.strip('\n').split('\t') peak.append(int(line[3])) f.close() num=int(len(peak)/100.0) bin=[] for i in range(99): bin.append(str(i+1)+'\t'+str(sum(peak[num*i:num*(i+1)])/(num*1.0))+'\n') bin.append('100'+'\t'+str(sum(peak[num*99:])/(num*...
Python
0.000002
93a3b7d61877e9350ea2b32ade918755fc874bb8
Create run_test.py
recipes/django-environ/run_test.py
recipes/django-environ/run_test.py
import django from django.conf import settings settings.configure(INSTALLED_APPS=['environ', 'django.contrib.contenttypes', 'django.contrib.auth']) django.setup() import environ
Python
0.000004
19186f44b1ed4c4b60ffc1ef796fa0894b25da68
Add garage.partdefs.sockets
py/garage/garage/partdefs/sockets.py
py/garage/garage/partdefs/sockets.py
from garage import parameters from garage import parts from garage import sockets PARTS = parts.Parts(sockets.__name__) PARTS.patch_getaddrinfo = parts.AUTO PARAMS = parameters.define_namespace(sockets.__name__, 'socket utils') PARAMS.patch_getaddrinfo = parameters.create( False, 'enable patching getaddrinfo fo...
Python
0.000051
a25e2c0e5d8466e449641fb4c1c74a6e9872da75
add connection module for pyRpc
python/proto/pyRpc/tcp_connection.py
python/proto/pyRpc/tcp_connection.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- # # Copyright (c) 2016 ASMlover. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyrig...
Python
0.000001
b7d23a337ad121a032a8aa2c395c3705bad12b28
add migration to grandfather in all existing plans to have Case Sharing via Groups and Child Cases privileges
corehq/apps/accounting/migrations/0043_grandfather_case_privs.py
corehq/apps/accounting/migrations/0043_grandfather_case_privs.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.21 on 2019-07-23 16:43 from __future__ import unicode_literals from __future__ import absolute_import from django.core.management import call_command from django.db import migrations from corehq.apps.hqadmin.management.commands.cchq_prbac_bootstrap import ( cchq_...
Python
0
8bc0c88ef8436d066d6746c0fde96b3b01408d4e
Add examples for geospatial types for the manual (#618)
tests/integration/examples/test_geospatial_types_example.py
tests/integration/examples/test_geospatial_types_example.py
#!/usr/bin/env python # -*- encoding: utf-8 -*- # Copyright (c) "Neo4j" # Neo4j Sweden AB [http://neo4j.com] # # This file is part of Neo4j. # # 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
304826205804e3972968b16fbf9bb9021eaf9acd
add FieldOfStudyHierarchy class
scholarly_citation_finder/apps/core/migrations/0015_fieldofstudyhierarchy.py
scholarly_citation_finder/apps/core/migrations/0015_fieldofstudyhierarchy.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.4 on 2016-03-11 13:19 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('core', '0014_publicationreference_source'), ] opera...
Python
0.000108
ce4bcc19e61518273e054553494288364ab4f677
Add lc085_maximal_rectangle.py
lc085_maximal_rectangle.py
lc085_maximal_rectangle.py
"""Leetcode 85. Maximal Rectangle Hard URL: https://leetcode.com/problems/maximal-rectangle/ Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area. Example: Input: [ ["1","0","1","0","0"], ["1","0","1","1","1"], ["1","1","1","1","1"], ["1","0","0...
Python
0.002349
5d8af7dec1806e7f897a89d1a54ff5f2dc5bfec0
Add 'merge-json.py' script to make the final annotations file.
bin/merge-json.py
bin/merge-json.py
#!/usr/bin/env python from collections import Mapping import json import sys filename1 = sys.argv[1] filename2 = sys.argv[2] json_data1=open(filename1).read() dictA = json.loads(json_data1) json_data2=open(filename2).read() dictB = json.loads(json_data2) merged_dict = {key: value for (key, value) in (dictA.items() +...
Python
0
eda01dc886cde85ee9ee84d54fa0d5c5a11a776e
Disable failing android tests on cros.
tools/telemetry/telemetry/core/platform/android_platform_backend_unittest.py
tools/telemetry/telemetry/core/platform/android_platform_backend_unittest.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 logging import os import unittest from telemetry import test from telemetry.core import bitmap from telemetry.core import util from telemetry.core.pl...
# 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 logging import os import unittest from telemetry import test from telemetry.core import bitmap from telemetry.core import util from telemetry.core.pl...
Python
0.990071
7f319b9f84e441cbe893fd2cc68ecd77cfcfd987
create perl-file-which package (#6800)
var/spack/repos/builtin/packages/perl-file-which/package.py
var/spack/repos/builtin/packages/perl-file-which/package.py
############################################################################## # Copyright (c) 2013-2017, 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
a2b4389db17759086c4cd804b6cbfb1b658d547e
Create equal_sides_of_an_array.py
equal_sides_of_an_array.py
equal_sides_of_an_array.py
#Kunal Gautam #Codewars : @Kunalpod #Problem name: Equal Sides Of An Array #Problem level: 6 kyu def find_even_index(arr): if not sum(arr[1:]): return 0 if not sum(arr[:len(arr)-1]): return len(arr)-1 for i in range(1, len(arr)-1): if sum(arr[:i])==sum(arr[i+1:]): return i retur...
Python
0.998288
d2978eae5b502cc5bc4b020044b88f02522f90cd
Add jobs.utils module
virtool/jobs/utils.py
virtool/jobs/utils.py
def is_running_or_waiting(document): latest_state = document["status"][-1]["state"] return latest_state != "waiting" and latest_state != "running"
Python
0.000001
3bae93629c81cc33e565912e4b9bafeff536ec22
Create hostgroup_info.py
examples/hostgroup_info.py
examples/hostgroup_info.py
def queryHostGroupInfo(): """ "query host group info" """ if lsf.lsb_init("queryHostGroupInfo") > 0: return -1; strArr = lsf.new_stringArray(2); lsf.stringArray_setitem(strArr, 0, "hg1"); lsf.stringArray_setitem(strArr, 1, "hg2"); for hgroupInfo in lsf.get_hostgroup_info_by_name...
Python
0.000001
986b20363cc84be1822588dd7cc935fca7ef7f48
add test for get_genofile_samplelist in marker_regression/run_mapping.py
wqflask/tests/wqflask/marker_regression/test_run_mapping.py
wqflask/tests/wqflask/marker_regression/test_run_mapping.py
import unittest from unittest import mock from wqflask.marker_regression.run_mapping import get_genofile_samplelist class AttributeSetter: def __init__(self,obj): for k,v in obj.items(): setattr(self,k,v) class MockDataSetGroup(AttributeSetter): def get_genofiles(self): return [{"location":"~/genofiles/g...
Python
0
fe145fd87db777d9eeb361688d502b1b3ec4b2e1
Add a new Model-View-Projection matrix tool.
Transformation.py
Transformation.py
# -*- coding:utf-8 -*- # *************************************************************************** # Transformation.py # ------------------- # update : 2013-11-13 # copyright : (C) 2013 by Michaël Roy # email :...
Python
0
c2089b3ed549d89942f57075d0b6d573d980bc30
make app load in worker in uwsgi.ini, pass db configuration dynamically to docker image as env variable
app/config.py
app/config.py
from datetime import timedelta class Config(object): DEBUG = False TESTING = False SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://{}:{}@{}/{}' APP_NAME = '{} Server' SECRET_KEY = '{}' JWT_EXPIRATION_DELTA = timedelta(days=30) JWT_AUTH_URL_RULE = '/api/v1/auth' SECURITY_REGISTERABLE =...
Python
0
f9874e059df50dc81803fcfdfd1045cc09624894
Add functional regressions tests for server_group_members OverQuota
nova/tests/functional/regressions/test_bug_1780373.py
nova/tests/functional/regressions/test_bug_1780373.py
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the...
Python
0.000031
2f0700093141643bd66e99d271f9e74087e148e6
Add Message model migration file.
core/migrations/0002_message.py
core/migrations/0002_message.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.7 on 2016-08-05 19:19 from __future__ import unicode_literals import django.contrib.postgres.fields from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('core', '0001_initial')...
Python
0
30c5b785863df0269c7abbbc5000d83df4f815c2
Predict some data similar to problem on assignment
outlier_detection/svm_classification_with_synthetic_data.py
outlier_detection/svm_classification_with_synthetic_data.py
import numpy as np from matplotlib import pyplot as plt import matplotlib.font_manager from sklearn import svm def main(): tests = 20 # Generate train data X = (np.random.randn(120, 2) * np.array([0.08, 0.02]) + np.array([0.3, 0.6])) X_train = X[:-tests] X_test = X[-tests...
Python
0.999856
68dbfedf90fb9e6c922971deaeccad148a258a70
Add tests for PyEcore extension (EClass/EModelElement tests)
tests/test_dynamic_ecore_extension.py
tests/test_dynamic_ecore_extension.py
import pytest from pyecore.ecore import * import pyecore.ecore as ecore from ordered_set import OrderedSet def test__EModelElement_extension(): A = EClass('A', superclass=(EModelElement.eClass)) a = A() assert a.eAnnotations == OrderedSet() annotation = EAnnotation(source='testAnnot') annotation....
Python
0
40431228c8535f325b005bb52485cae87a8be714
Add test module for napalm_acl
tests/unit/modules/test_napalm_acl.py
tests/unit/modules/test_napalm_acl.py
# -*- coding: utf-8 -*- ''' :codeauthor: :email:`Anthony Shaw <anthonyshaw@apache.org>` ''' # Import Python Libs from __future__ import absolute_import # Import Salt Testing Libs from tests.support.mixins import LoaderModuleMockMixin from tests.support.unit import TestCase, skipIf from tests.support.mock import (...
Python
0
f987b39bb43301c735f30169010832665953efe6
Add a sample permission plugin for illustrating the check on realm resources, related to #6211.
sample-plugins/public_wiki_policy.py
sample-plugins/public_wiki_policy.py
from fnmatch import fnmatchcase from trac.config import Option from trac.core import * from trac.perm import IPermissionPolicy class PublicWikiPolicy(Component): """Sample permission policy plugin illustrating how to check permission on realms. Don't forget to integrate that plugin in the appropriate pl...
Python
0
784cd71fe24b1f5ce57a1982186dabc768892883
Fix discount calculation logic
saleor/product/models/discounts.py
saleor/product/models/discounts.py
from __future__ import unicode_literals from django.conf import settings from django.db import models from django.utils.translation import pgettext_lazy from django.utils.encoding import python_2_unicode_compatible from django_prices.models import PriceField from prices import FixedDiscount class NotApplicable(Value...
from __future__ import unicode_literals from django.conf import settings from django.db import models from django.utils.translation import pgettext_lazy from django.utils.encoding import python_2_unicode_compatible from django_prices.models import PriceField from prices import FixedDiscount class NotApplicable(Value...
Python
0.000106
c35fa6caa631b03c3b5b3c9ea5bf494254ed9b1f
add script for usb backend to receive tracing data
scripts/tracing/trace_capture_usb.py
scripts/tracing/trace_capture_usb.py
#!/usr/bin/env python3 # # Copyright (c) 2019 Intel Corporation. # # SPDX-License-Identifier: Apache-2.0 """ Script to capture tracing data with USB backend. """ import usb.core import usb.util import argparse import sys def parse_args(): global args parser = argparse.ArgumentParser( description=__doc...
Python
0.000001
964d01fd9a730d02aac85740bce0ef9dace6517b
add migrations
molo/core/migrations/0054_merged_cms_models.py
molo/core/migrations/0054_merged_cms_models.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.12 on 2017-02-21 12:13 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import modelcluster.fields class Migration(migrations.Migration): dependencies = [ ('wagtailcore', '0032_add_bulk_del...
Python
0.000001
17b4efb401d36060f51e07da5ace83c008d421c5
Create table charge_observation.
problem/charge_state/alembic/versions/2154afa58ba0_create_table_charge_observation.py
problem/charge_state/alembic/versions/2154afa58ba0_create_table_charge_observation.py
"""Create table charge_observation. Revision ID: 2154afa58ba0 Revises: Create Date: 2020-01-05 12:18:25.331846 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '2154afa58ba0' down_revision = None branch_labels = None depends_on = None def upgrade(): # ###...
Python
0