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 |
|---|---|---|---|---|---|---|---|
56ee8843c355ffa56f7c2583d8d524e1ecfd29c3 | Create __init__.py | module/submodule/tests/__init__.py | module/submodule/tests/__init__.py | Python | 0.000429 | ||
2cae3441a0a1889ef19a3d120c48f9b30a36e787 | add tests for query and result post process | matgendb/tests/test_postfuncs.py | matgendb/tests/test_postfuncs.py |
import pymongo
from pymongo import MongoClient
import uuid
import unittest
import pprint
from matgendb.query_engine import QueryEngine, QueryResults
# Determine if MongoDB is up and usable
has_mongo = False
try:
conn = pymongo.MongoClient()
has_mongo = True
except:
pass
class SandboxTest(unittest.Te... | Python | 0 | |
5e1d5644b2279b31191870b4a8099f3f6f31e851 | Enable admin for Project, Platform, Dataset | ncharts/admin.py | ncharts/admin.py | from django.contrib import admin
from ncharts.models import Project, Platform, Dataset
class ProjectAdmin(admin.ModelAdmin):
pass
class PlatformAdmin(admin.ModelAdmin):
pass
class DatasetAdmin(admin.ModelAdmin):
pass
admin.site.register(Project,ProjectAdmin)
admin.site.register(Platform,PlatformAdmin)
... | Python | 0 | |
23808a3d65db23163969aeb08adaa29f6403e720 | Fix a test | test/lib/lint/policy/test_abstract_policy.py | test/lib/lint/policy/test_abstract_policy.py | import unittest
from lib.lint.policy.abstract_policy import AbstractPolicy
class ConcretePolicy(AbstractPolicy):
def __init__(self):
super().__init__()
self.description = 'Found something invalid'
self.reference = 'http://example.com'
self.level = 0
class TestAbstractPolicy(unitt... | import unittest
from lib.lint.policy.abstract_policy import AbstractPolicy
class ConcretePolicy(AbstractPolicy):
def __init__(self):
super().__init__()
self.description = 'Found something invalid'
self.reference = 'http://example.com'
self.level = 0
class TestAbstractPolicy(unitt... | Python | 0.999999 |
343a98d8a400467016a70e53d7e6d261bf9f75d8 | add regress.py | suite/regress.py | suite/regress.py | #!/usr/bin/env python
# Capstone Python bindings, by Nguyen Anh Quynnh <aquynh@gmail.com>
from __future__ import print_function
import sys
from capstone import *
all_tests = (
# arch, mode, syntax, address, hexcode, expected output
# issue 456 https://github.com/aquynh/capstone/issues/456
(CS... | Python | 0.000003 | |
e1c6f344e804f0d972dbc685b9492a126d74a7d3 | Create new management app | usingnamespace/management/__init__.py | usingnamespace/management/__init__.py | from pyramid.config import Configurator
from pyramid.session import SignedCookieSessionFactory
from pyramid.settings import asbool
from pyramid.wsgi import wsgiapp2
default_settings = (
('route_path', str, '/management'),
('domain', str, ''),
)
# Stolen from pyramid_debugtoolbar
def parse_settings(settings):
... | Python | 0.000001 | |
4fbb9ca1b055b040214c82dc307f69793947b800 | Add handler for syncing wallets to server | api/sync_wallet.py | api/sync_wallet.py | import urlparse
import os, sys
import json
tools_dir = os.environ.get('TOOLSDIR')
lib_path = os.path.abspath(tools_dir)
sys.path.append(lib_path)
from msc_apps import *
data_dir_root = os.environ.get('DATADIR')
def sync_wallet_response(request_dict):
if not request_dict.has_key('type'):
return (None, 'No field ... | Python | 0 | |
eefa26090a4ff8fc23908afa83c87c2d54568929 | add pager duty sample alert plugin, closes #249 | alerts/plugins/pagerDutyTriggerEvent.py | alerts/plugins/pagerDutyTriggerEvent.py | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Copyright (c) 2014 Mozilla Corporation
#
# Contributors:
# Jeff Bryner jbryner@mozilla.com
import requests
import json... | Python | 0 | |
32ea116ff172da3e7f0eeb7d9dea6b9a0378be08 | Add persistance | persistance.py | persistance.py | import numpy as np
import os
from itertools import izip
T_FILE = "t.npy"
C_FILE = "c.npy"
K_FILE = "k.npy"
U_FILE = "u.npy"
FP_FILE = "fp.npy"
IER_FILE = "ier.npy"
MSG_FILE = "msg.txt"
def saveSplines(directory, splines):
((t, c, k), u), fp, ier, msg = splines[0]
tlst = []
clst = []
klst = []
ulst = []
fplst ... | Python | 0.998588 | |
a34318312199e6dab8ca3db92f247f0bda369e17 | Add missing testcase file | exercises/tests/testcase.py | exercises/tests/testcase.py | # This file is part of Workout Manager.
#
# Workout Manager is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Workout Manage... | Python | 0.000003 | |
b36ef2473c70ff16f4033f24ffc69a3b30b0ce26 | add edit-prowjobs.py | experiment/edit-prowjobs.py | experiment/edit-prowjobs.py | #!/usr/bin/env python3
# Copyright 2021 The Kubernetes 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 appl... | Python | 0 | |
ac8c78682e77d77be44910c36057e0217477b0a4 | Test OAI endpoint model | tests/test_models/test_oai_endpoint.py | tests/test_models/test_oai_endpoint.py | from django.test import TestCase
from core.models import OAIEndpoint
class OAIEndpointTestCase(TestCase):
@classmethod
def setUpTestData(cls):
cls.attributes = {
'name': 'Test OAI Endpoint',
'endpoint': 'http://oai.example.com',
'verb': 'ListRecords',
'm... | Python | 0 | |
613a0056e12a28232542aaf561831d276868e413 | Add parametric map generator, good for wrinkles | programs/kinbody-creator/openraveMapGenerator.py | programs/kinbody-creator/openraveMapGenerator.py | #!/usr/bin/python
#import lxml.etree
#import lxml.builder
from lxml import etree
#E = lxml.builder.ElementMaker()
#KINBODY=E.KinBody
#BODY=E.Body
#GEOM=E.Geom
#EXTENTS=E.Extents
#TRANSLATION=E.Translation
#DIFUSSECOLOR=E.diffuseColor
# User variables
nX = 3
nY = 2
boxHeight = 1.0
resolution = 2.0 # Just to make s... | Python | 0 | |
668c28fd55daa93e0024e14e7137f78919e93e2c | Add python client script | docs/basement_weather.py | docs/basement_weather.py | #!/usr/bin/python
import sys
import commands
import Adafruit_DHT
import twitter
import requests
import json
date = commands.getoutput('TZ=":Canada/Atlantic" date')
#Get temp and humidity
humidity, temperature = Adafruit_DHT.read_retry(11, 4)
message = 'Temp: {0:0.1f} C Humidity: {1:0.1f} %'.format(temperature, humid... | Python | 0.000003 | |
5a221296e9e7cc59e4fe4c85b178db06c1376f13 | Add product streamfield migrations | demo/apps/catalogue/migrations/0012_auto_20160617_1115.py | demo/apps/catalogue/migrations/0012_auto_20160617_1115.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import wagtail.wagtailcore.fields
import wagtail.wagtailcore.blocks
import wagtail.wagtailimages.blocks
class Migration(migrations.Migration):
dependencies = [
('catalogue', '0011_auto_20160616_1335'... | Python | 0 | |
a9b35aff92c099aa52ce9e1ca1cb0df169a54ef5 | Add author to header. | publisher/writer.py | publisher/writer.py | __all__ = ['writer']
import docutils.core as dc
import docutils.writers
from docutils import nodes
from docutils.writers.latex2e import (Writer, LaTeXTranslator,
PreambleCmds)
class Translator(LaTeXTranslator):
def __init__(self, *args, **kwargs):
LaTeXTranslator.__i... | __all__ = ['writer']
import docutils.core as dc
import docutils.writers
from docutils import nodes
from docutils.writers.latex2e import (Writer, LaTeXTranslator,
PreambleCmds)
class Translator(LaTeXTranslator):
def __init__(self, *args, **kwargs):
LaTeXTranslator.__i... | Python | 0 |
6fb3c87f0f9b238eab71df6880568005e3a2b461 | add DuckDuckGo Instant Answer plugin | plugins/ddg.py | plugins/ddg.py | # coding=utf-8
import json
import urllib.request
@yui.threaded
@yui.command('duckduckgo', 'ddg')
def ddg(argv):
'''Returns the Instant Answer for a given query. Usage: ddg -lang <query>'''
lang = 'en_US'
if len(argv) < 1:
return
# check if a language was given
argv = argv[1:]
if len(a... | Python | 0.000002 | |
e8576b67f8a3778c43a85e24d1cbc0e1985fe2ca | Add float.is_integer() example | trypython/basic/builtinfunc/float01.py | trypython/basic/builtinfunc/float01.py | """
組み込みクラス float のサンプルです.
float.is_integer() について
"""
from trypython.common.commoncls import SampleBase
from trypython.common.commonfunc import pr
class Sample(SampleBase):
def exec(self):
num = 1.00
pr('type(num)', type(num))
pr('is_integer', num.is_integer()) # ==> True (整数に出来るので)
... | Python | 0.002001 | |
3b41e3bcc721d47ce5a7314af2ac4d9006598164 | add word class | pythonfiles/word.py | pythonfiles/word.py |
#Comtains models for storing words and data returned from parsing websites
#
class word(object):
def __init__(self,name=None,part_of_speech=None,definition=None,context=None,subwords=None,count=None,rating=None):
self.name=name
self.part_of_speech=part_of_speech
self.definition=definition
se... | Python | 0.006846 | |
4cedd5cf992c180da7d778a9a8adc225a7d8c496 | test various odd characters in the filenames, including some UTF-8 | lib/test_filenames.py | lib/test_filenames.py | from smashbox.utilities import *
from smashbox.utilities.hash_files import count_files
__doc__ = """ Test various characters in the file names.
bug #104648: add UTF-8 escaping in PROPFIND response body (https://savannah.cern.ch/bugs/?104648)
Notes:
- unescaped % characters in propfind response crashes csync
"""
... | Python | 0.000315 | |
83f6febfc051c8d7d3462e9a60f4eae036fa0529 | guessing the number genetic algorithm | numberGuesser.py | numberGuesser.py | import random
import time
def go(lower_bound, upper_bound, bots):
iterations = 1
target = random.randint(lower_bound, upper_bound)
while True:
print(f"Target number: {target}")
answers = [random.randint(lower_bound, upper_bound)
for _ in range(bots)]
scores = [a... | Python | 0.999916 | |
6ac6202837cade41b1dad5af9a474be171255993 | Check that Constant is given Moments instance, not class | bayespy/inference/vmp/nodes/constant.py | bayespy/inference/vmp/nodes/constant.py | ################################################################################
# Copyright (C) 2011-2012,2014 Jaakko Luttinen
#
# This file is licensed under the MIT License.
################################################################################
import numpy as np
from .node import Node, Moments
class C... | ################################################################################
# Copyright (C) 2011-2012,2014 Jaakko Luttinen
#
# This file is licensed under the MIT License.
################################################################################
import numpy as np
from .node import Node
class Constant(N... | Python | 0.998847 |
435004cebce00510db3bf36ae21b2cbf37020f32 | add petpvc specs file | nipype/interfaces/tests/test_auto_PETPVC.py | nipype/interfaces/tests/test_auto_PETPVC.py | # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ...testing import assert_equal
from ..petpvc import PETPVC
def test_PETPVC_inputs():
input_map = dict(alpha=dict(argstr='-a %.4f',
),
args=dict(argstr='%s',
),
debug=dict(argstr='-d',
usedefault=True,
),
environ=dict(nohash=Tru... | Python | 0 | |
99e531ec0e86d7c1d34de154cc49584821f85904 | Make all metavars uppercased | powerline/commands/config.py | powerline/commands/config.py | # vim:fileencoding=utf-8:noet
from __future__ import (division, absolute_import, print_function)
import argparse
import powerline.bindings.config as config
class StrFunction(object):
def __init__(self, function, name=None):
self.name = name or function.__name__
self.function = function
def __call__(self, *ar... | # vim:fileencoding=utf-8:noet
from __future__ import (division, absolute_import, print_function)
import argparse
import powerline.bindings.config as config
class StrFunction(object):
def __init__(self, function, name=None):
self.name = name or function.__name__
self.function = function
def __call__(self, *ar... | Python | 0.999999 |
c94653382a5a8aa2ec9af94f3aaa02ed5cae9b4c | Create test_send_sms.py | test_send_sms.py | test_send_sms.py | import serial
from curses import ascii
# since we need ascii code from CTRL-Z
import time
# here we are testing sending an SMS via virtual serial port ttyUSB0 that was created by a USB serial modem
phonenumber = #enter phone number to send SMS to e.g. "+441234123123"
SMS = "here's your SMS!"
ser = serial.Serial('/dev... | Python | 0.000002 | |
5e723223b5206e6e92a6140f184d41f1abfdbb3d | Create candy-crush.py | Python/candy-crush.py | Python/candy-crush.py | # Time: O((R * C)^2)
# Space: O(1)
# This question is about implementing a basic elimination algorithm for Candy Crush.
#
# Given a 2D integer array board representing the grid of candy,
# different positive integers board[i][j] represent different types of candies.
# A value of board[i][j] = 0 represents that the ce... | Python | 0.9993 | |
c4f0d10e2112a391f716f58ffa449a490549fac6 | find kth smallest | Python/kthsmallest.py | Python/kthsmallest.py | '''
Find the k-th smallest element in a union of two given sorted arrays,
a and b
'''
# O(k) implementation
def findkth(a, b, k):
i = 0
j = 0
found = 1
while i < len(a) and j< len(b):
if a[i] < b[j]:
smaller = a[i]
i += 1
else:
smaller = b[j]
... | Python | 0.999975 | |
1dad9de4cf94d7f321176cf5b339b1a68f4ac6d2 | Add template to LanguageAdmin; #551 | judge/admin/runtime.py | judge/admin/runtime.py | from django.db.models import TextField
from django.forms import TextInput, ModelForm, ModelMultipleChoiceField
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from reversion.admin import VersionAdmin
from judge.models impor... | from django.db.models import TextField
from django.forms import TextInput, ModelForm, ModelMultipleChoiceField
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from reversion.admin import VersionAdmin
from judge.models impor... | Python | 0 |
e262d176ecd7d8871a9e06ebc542cf473acf0925 | Add migration for transnational weights | reports/migrations/0004_transnational_weights.py | reports/migrations/0004_transnational_weights.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from django_countries import countries
def populate_weights(apps, schema_editor):
Weights = apps.get_model("reports", "Weights")
db_alias = schema_editor.connection.alias
for item in COUNTRY_WEIGHTS:
... | Python | 0.000016 | |
6ff99aa939bf07d18595507efeca6ada7fc267a5 | add a test thing for wilk | tools/ast-env.py | tools/ast-env.py | #!/usr/bin/env python
if __name__ == '__main__':
import os
import sys
import copy
import json
sys.path.append(os.path.dirname(__file__))
import logging
logging.basicConfig(level=logging.DEBUG)
import roush.db.database
from roush.db import api as db_api
from roush.db.database... | Python | 0.000003 | |
b0577ce3b8b162ce3702430b189905f9beaae8d5 | Add script to clean up all FD phone and fax numbers. | firecares/firestation/management/commands/cleanup_phonenumbers.py | firecares/firestation/management/commands/cleanup_phonenumbers.py | from django.core.management.base import BaseCommand
from firecares.firestation.models import FireDepartment
from phonenumber_field.modelfields import PhoneNumber
import re
"""
This command is for cleaning up every phone and fax number in the
database. It removes all non-numeric characters, such as parenthesis,
hyphens... | Python | 0 | |
370fa8682b09de76af36129817e412270c8206c8 | add a new mgmt command for data analysis: compute the intersections of every pair of boundaries | boundaries/management/commands/compute_intersections.py | boundaries/management/commands/compute_intersections.py | from optparse import make_option
from django.conf import settings
from django.core.management.base import BaseCommand
from django.contrib.gis.geos import MultiPolygon, Polygon
from boundaries.models import BoundarySet, Boundary
class Command(BaseCommand):
help = 'Create a report of the area of intersection of every... | Python | 0.000158 | |
66306f46417e8b0caa6b4e6d13d72e5ae6b226ef | include builds | corehq/apps/app_manager/management/commands/migrate_to_conditional_case_update.py | corehq/apps/app_manager/management/commands/migrate_to_conditional_case_update.py | from datetime import datetime
import traceback
from corehq.apps.app_manager.dbaccessors import wrap_app
from corehq.apps.app_manager.management.commands.helpers import AppMigrationCommandBase
from corehq.apps.domain.models import Domain
import random
def get_new_case_update_json(name_path):
return {
'ques... | from datetime import datetime
import traceback
from corehq.apps.app_manager.dbaccessors import wrap_app
from corehq.apps.app_manager.management.commands.helpers import AppMigrationCommandBase
from corehq.apps.domain.models import Domain
import random
def get_new_case_update_json(name_path):
return {
'ques... | Python | 0 |
7a75174716ecbc0757c84f29ebbb3fd309521936 | add management command to fire all repeaters in a domain | corehq/apps/cleanup/management/commands/fire_repeaters.py | corehq/apps/cleanup/management/commands/fire_repeaters.py | import datetime
from django.core.management.base import BaseCommand, CommandError
from corehq.apps.receiverwrapper.models import RepeatRecord
from dimagi.utils.post import simple_post
class Command(BaseCommand):
args = '<domain>'
help = 'Fire all repeaters in a domain.'
def handle(self, *args, **options)... | Python | 0 | |
d5d3fcfb331c1486acbfb004705b94b1923a0db8 | Add code to dump features into libsvm file format | Codes/SuperEdge/SuperEdge/dump_libsvm.py | Codes/SuperEdge/SuperEdge/dump_libsvm.py | import numpy as np
from datetime import datetime
from sklearn.datasets import dump_svmlight_file
import os.path as path
def main():
cache_path = 'largecache/'
feat_name = 'feat.dat'
lbl_name = 'lbl.dat'
feat_len = 4224 #1088
now = datetime.now()
lbl_memmap = np.memmap(path.join(cache_path, lbl_... | Python | 0 | |
269f1b743583609ecdc7658e35073db9b985634c | rename http.py | examples/http_example.py | examples/http_example.py | from poyonga.client import Groonga
g = Groonga()
cmds = [("status", {}),
("log_level", {"level": "warning"}),
#("table_create", {"name": "Site", "flags": "TABLE_HASH_KEY"}),
("select", {"table": "Site"})]
for cmd, kwargs in cmds:
ret = g.call(cmd, **kwargs)
print(ret.status)
print(... | Python | 0.00223 | |
fef9b29a9072ce6bc184592c240558ba01fbeb6b | Copy to github | git-credential-libsecret.py | git-credential-libsecret.py | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2016 Tim Hughes <thughes@thegoldfish.org>
#
# Distributed under terms of the MIT license.
"""
Handles storing and providing usernames and passwords to Git using libsecret.
"""
import os
import sys
if __name__ == '__main__':
githelper... | Python | 0 | |
95b304d2f0a9dc851926506795310f96c3312682 | Add SQL example. | examples/sql_rockstar.py | examples/sql_rockstar.py | from RockStar import RockStar
sql_code = "SELECT 'Hello World!';"
rock_it_bro = RockStar(days=400, file_name='hello_world.sql', code=sql_code)
rock_it_bro.make_me_a_rockstar()
| Python | 0.000001 | |
d5cf05e40b638afbf12fd95cf721a22ad0f3281d | Create appointments.py | backend/appointments.py | backend/appointments.py | Python | 0.000001 | ||
b017c43c9bf46cd2e1fd7380904a1b022b6930ba | Create __init__.py | beprof/__init__.py | beprof/__init__.py | pass
| Python | 0.000006 | |
bb462e78221344d71a2605d4af042e5037db3e79 | add colorize.py script | colorize.py | colorize.py | import numpy as np
import os
import skimage.color as color
import matplotlib.pyplot as plt
import scipy.ndimage.interpolation as sni
import caffe
import argparse
def parse_args():
parser = argparse.ArgumentParser(description='iColor: deep interactive colorization')
parser.add_argument('-img_in',dest='img_in',h... | Python | 0.000001 | |
753388550e4ea7a8b09ddb22189021be3585a5e5 | Clean PlexUpdate plugin | beetsplug/plexupdate.py | beetsplug/plexupdate.py | """Updates an Plex library whenever the beets library is changed.
Put something like the following in your config.yaml to configure:
plex:
host: localhost
port: 32400
"""
import requests
from urlparse import urljoin
import xml.etree.ElementTree as ET
from beets import config
from beets.plugins impo... | """Updates an Plex library whenever the beets library is changed.
Put something like the following in your config.yaml to configure:
plex:
host: localhost
port: 32400
"""
import requests
from urlparse import urljoin
import xml.etree.ElementTree as ET
from beets import config
from beets.plugins impo... | Python | 0 |
e5bdbfb075bf95b7834f2db8c7d6ffa69cb03bc0 | Create convnet_basic.py | Classifying_datasets/statoil/convnet_basic.py | Classifying_datasets/statoil/convnet_basic.py | adi
| Python | 0.000004 | |
6f3bb73dd387fd73022a20c3a45adf05213339cf | add new package (#20109) | var/spack/repos/builtin/packages/py-rosinstall-generator/package.py | var/spack/repos/builtin/packages/py-rosinstall-generator/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 PyRosinstallGenerator(PythonPackage):
"""A tool for generating rosinstall files."""
homepage = "https://wi... | Python | 0 | |
0cbb114a70bcbef266c6df776681d1c664d8bdae | Create superClock.py | superClock.py | superClock.py | #This is My Nest but it will slowly be converted to superClock!
import urllib
import urllib2
import sys
import json
import time
# Make sure your higher level directory has the JSON file called passwordFile.json
# The file should contain the information in the JSON format. See below for an example
# {"username": "email... | Python | 0.000024 | |
a2516d28c86fd23efcb893e59de42b33526bfe6f | Add a Python Tkinter example showing how to map a scale widget. | swig/tkgui.py | swig/tkgui.py | #!/usr/bin/env python
import Tkinter
import sys
import mapper
def on_gui_change(x):
# print 'on_gui_change',x,x.__class__
sig_out.update_scalar(int(x))
def on_mapper_change(sig, x):
# print 'on_mapper_change', x, x.__class__
w.set(int(x))
dev = mapper.device("tkgui", 9000)
sig_in = mapper.signal(1, "... | Python | 0 | |
99578401585435c08aed6f29e090fbde955423fd | Create good2d.py | rocksetta-examples/good2d.py | rocksetta-examples/good2d.py | import tensorflow as tf
import numpy as np
# Create 100 phony x, y data points in NumPy, y = x * 0.1 + 0.3
x_data = np.random.rand(100).astype("float32")
y_data = x_data * 0.1 + 0.3
# Try to find values for W and b that compute y_data = W * x_data + b
# (We know that W should be 0.1 and b 0.3, but Tensorflow will
# f... | Python | 0.000004 | |
35e51f55adfbe8383bfb3d34688eb7aee89a8351 | add shuffle_by_year script, to toss messages into yearly folders | shuffle_by_year.py | shuffle_by_year.py | #!/usr/bin/env python
# Q&D script to sort mail into subfolders by year.
# Reduces the burden upon the filesystem gnomes.
DIRPATH = "/stor0/backups/imapbak/rtucker/Fastmail-rey_fmgirl_com"
import email
import mailbox
import imap2maildir
import sys
import time
import os
def main():
db = imap2maildir.open_sql_ses... | Python | 0 | |
7423de8d2222e81693fe380a6b4c8638a96a9db8 | Create urls.py | urls.py | urls.py | from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from pysoldev import settings
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^$', 'pysoldev.views.home', name='home'),
... | Python | 0.000017 | |
0079676729fa8023bea93fcf03bb48c4ff24a495 | add partition | resource-4/combinatorics/integer-partitions/partition1.py | resource-4/combinatorics/integer-partitions/partition1.py | # counting partitions
def partition1(n,k=-1):
if (k == -1):
return sum([partition1(n,i) for i in range(1,n+1)])
if (n < k):
return 0
if((n==0) or (n==1)):
return 1
if((k==1) or (n==k)):
return 1
return sum([partition1(n-k,i) for i in range(1,min(k,n-k)+1)])
| Python | 0.000007 | |
a787ceea91abf1c0fbeb3b97e063d3ec1aa61b57 | Create implement-rand10-using-rand7.py | Python/implement-rand10-using-rand7.py | Python/implement-rand10-using-rand7.py | # Time: O(1)
# Space: O(1)
# Given a function rand7 which generates a uniform random integer in the range 1 to 7,
# write a function rand10 which generates a uniform random integer in the range 1 to 10.
#
# Do NOT use system's Math.random().
#
# Example 1:
#
# Input: 1
# Output: [7]
# Example 2:
#
# Input: 2
# Output... | Python | 0.000022 | |
b659dd572bd92e10bde8899540792bdb26529a45 | add qdb_test | scripts/qdb_test.py | scripts/qdb_test.py | from qdb import set_trace, RemoteCommandManager
def f():
in_f = True
return 'getting out of f'
def main():
set_trace(
uuid='qdb',
host='localhost',
port=8001,
cmd_manager=RemoteCommandManager(),
)
mutable_object = {}
print 'Hello world!'
f()
print mutabl... | Python | 0.000001 | |
d6ce19d526f07b843cbe5c79cc4e292181e6679f | add dumper per requested format #80 | scripts/gridorder2/dumper.py | scripts/gridorder2/dumper.py | """Generate the requested output."""
from pyiem.dep import read_env
from pyiem.util import get_dbconn
from tqdm import tqdm
import pandas as pd
from pandas.io.sql import read_sql
HUCS = (
"102400090102 102300020307 102400020604 102801020801 071000040902 "
"070600040608 070802040604 070802090402"
).split()
XRE... | Python | 0 | |
5c02d7ccb9721e0b02cdd31edc36be095a4568e2 | test the Meta and the MetaMixin classes | tests/meta.py | tests/meta.py | import unittest
import slumber
class MetaTestCase(unittest.TestCase):
def test_init_kwargs_to_attributes(self):
m = slumber.Meta(item1="test", item2=41, item3="example")
self.assertEqual(m.item1, "test")
self.assertEqual(m.item2, 41)
self.assertEqual(m.item3, "example")
class M... | Python | 0 | |
4c3c9c6929ebc3f439ccf3bb7d3696f484b154bc | Add missing noop-migrations for PositiveIntegerField | karspexet/ticket/migrations/0017_positive_integers_20180322_2056.py | karspexet/ticket/migrations/0017_positive_integers_20180322_2056.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2018-03-22 19:56
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ticket', '0016_add_voucher_note_20180213_2307'),
]
op... | Python | 0.00008 | |
af508daaf016b824c7518a36f9b92f571f0f65af | Implement management command for creating demo records of balance history (NC-842) | nodeconductor/structure/management/commands/init_balance_history.py | nodeconductor/structure/management/commands/init_balance_history.py | from datetime import timedelta
from django.core.management.base import BaseCommand
from django.utils import timezone
from nodeconductor.structure.models import BalanceHistory
from nodeconductor.structure.models import Customer
class Command(BaseCommand):
help = """ Initialize demo records of balance history """... | Python | 0 | |
7f1883275e9aa0b489de99947db7daf87f616ed4 | solve k58 | chap06/k58.py | chap06/k58.py | #
# usage: python k58.py {file name} {number}
#
import sys
from xml.etree import ElementTree as ET
def get_tuple(nll, dll):
return [[p, [n[1] for n in nl if n[0] == p][0],
[d[1] for d in dl if d[0] == p][0]]
for nl, dl in zip(nll, dll)
for p in list({n[0] for n in nl} & {d[... | Python | 0.999919 | |
ee8b22fbec74b81521c89c162c47c390cfca1618 | Add unittest with mnist model to test dygraph_to_static (#22777) | python/paddle/fluid/tests/unittests/dygraph_to_static/test_mnist.py | python/paddle/fluid/tests/unittests/dygraph_to_static/test_mnist.py | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | Python | 0 | |
a9d0a3dcc5221adbca5142a0cd7548ef874afd45 | add script to make matrix | matrix/build_maxrix.py | matrix/build_maxrix.py | WIDTH = 10
HEIGHT = 10
HORIZONTAL_NEXT = "hnext"
VERTICAL_NEXT = "vnext"
BASE = "Cell"
print """
abstract sig %(BASE)s {
%(HORIZONTAL_NEXT)s: lone %(BASE)s,
%(VERTICAL_NEXT)s: lone %(BASE)s
}
""" % globals()
for x in range(WIDTH):
for y in range(HEIGHT):
print "one sig Cell_%d_%d extends %s {}" % (x, ... | Python | 0.000001 | |
9efc48eadfb896a70197f8963caa6034d9b4856d | store res_log in database instead of memory, add index | bin/addons/base/res/res_log.py | bin/addons/base/res/res_log.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | Python | 0 |
98cbb29d008fc7abf1a066d9ecf7b3399395aefe | add users api | mcp/interface/users.py | mcp/interface/users.py | import json
from mcp import users
from mcp.interface import common
class UsersHandler(common.AuthorizedHandler):
def forbidden(self):
return True
def do_get(self):
return 200, json.dumps(list(iter(users.user_db)))
class UserHandler(common.AuthorizedHandler):
def __init__(self, request, response, groups):
c... | Python | 0.000001 | |
6e165165974f99a30ba6dce528d97c03152eeab6 | Add tracegraph script | tracegraph.py | tracegraph.py | #!/usr/bin/python
import sys
import re
class Host(object):
def __init__(self, step, name, ip):
self.step = step
self.name = name
self.ip = ip
self.pings = []
def add_ping(self, ping):
self.pings.append(ping)
def max_ping(self):
return max(self.pings) if self.pings else 0
def min_ping... | Python | 0.000001 | |
8bc3c2c82b1b8f7e4582fe401c05c4c4f34cc345 | create structure for python | src/boat_servo_sail/setup.py | src/boat_servo_sail/setup.py | ## ! DO NOT MANUALLY INVOKE THIS setup.py, USE CATKIN INSTEAD
## http://docs.ros.org/api/catkin/html/howto/format2/installing_python.html
## pdf download of the page in sources folder:
## docs-ros_installing_python.pdf
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
# fetc... | Python | 0.000261 | |
dc3df810c3c6ffea429e43ec0f8e6f006a9c1c6f | Create tensorCase.py | tensorCase.py | tensorCase.py | import tensorflow as tf
sess = tf.InteractiveSession()
x = tf.random_uniform([])
y = tf.random_uniform([])
out1 = tf.cond(tf.greater(x,y), lambda:tf.add(x,y), lambda:(tf.subtract(x,y)))
print(x.eval(), y.eval(), out1.eval())
x = tf.random_uniform([],-1,1)
y = tf.random_uniform([],-1,1)
def f1(): return tf.cast(tf.add... | Python | 0.000002 | |
6584d9e71c82097f65f316bf85b2f019350cfa58 | Add run_aiotest.py | run_aiotest.py | run_aiotest.py | import aioeventlet
import aiotest.run
import eventlet
config = aiotest.TestConfig()
config.new_event_pool_policy = aioeventlet.EventLoopPolicy
config.sleep = eventlet.sleep
aiotest.run.main(config)
| Python | 0.000003 | |
50983c0a6d18e1ec8fcaed076f3c82b5935fe913 | Solve problem 23 | problem023.py | problem023.py | #!/usr/bin/env python3
from itertools import *
def divisors(n):
for d in takewhile(lambda d: d * d <= n, count(1)):
if n % d == 0:
yield d
if n // d != d:
yield n // d
def is_abundant_number(n):
return n < sum(divisors(n)) - n
all_abundant = set(filter(is_abun... | Python | 0.999965 | |
8db65dc2a6a99a0e6287b12f7bfdcd423a62e515 | Add test running harness | run_harness.py | run_harness.py | import sys
import os
import subprocess
import shutil
import shlex
import collections
from babi_train import TrainExitStatus
from graceful_interrupt import GracefulInterruptHandler
TaskSpec = collections.namedtuple("TaskSpec", ["task_name", "variant_name", "run_params"])
def run(tasks_dir, output_dir, base_params, spe... | Python | 0 | |
a423b0eb6277c260a16dc11f37088e496964cc0c | Create count-neighbours.py | home/count-neighbours.py | home/count-neighbours.py | def checkio ( data ) :
if len( data ) < 10 : return False
if not any( c in data for c in "abcdefghijklmnopqrstuvwxyz" ) : return False
if not any( c in data for c in "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ) : return False
if not any( c in data for c in "1234567890" ) : return False
return True
... | Python | 0.000009 | |
557d21ffbbbf5cb8a452d6bc0b4c013daf8eabdc | Add new migration | server/store/migrations/0003_alter_testimonial_reviewer_location.py | server/store/migrations/0003_alter_testimonial_reviewer_location.py | # Generated by Django 4.1.3 on 2022-11-14 02:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("store", "0002_initial"),
]
operations = [
migrations.AlterField(
model_name="testimonial",
name="reviewer_location",... | Python | 0 | |
0df48d7159841f66cc4e8dac8e9a52727c69091e | add testcase for settings() | test/model.py | test/model.py | # -*- coding: utf-8 -*-
import unittest
from cliez.conf import settings, Settings
class Model(object):
config_none = settings()
def __init__(self):
self.config = settings()
pass
pass
class ModelTestCase(unittest.TestCase):
def setUp(self):
Settings.bind('cliez.conf')
... | Python | 0 | |
b1c405950ce5be535796d6d31a329b5083dc91a9 | adding test_hello | test_hello.py | test_hello.py | print "Hello All"
| Python | 0.999096 | |
bb0e8032d325d2fd015a53d4513d632d12e8afb3 | Create pset2part3.py | pset2part3.py | pset2part3.py | balance = 270472
annualInterestRate = 0.21
# test case 1
# balance = 320000
# annualInterestRate = 0.2
# Lowest Payment: 29157.09
# test case 2
# balance = 999999
# annualInterestRate = 0.18
# Lowest Payment: 90325.03
epsilon = 0.01
lower = balance / 12
upper = balance * ((1 + annualInterestRate / 12.0) ** 12) / 12.0
... | Python | 0.000003 | |
3f64c94f51698ab69fc1996d73a04bde58da9052 | Update build script. | client/scripts/build-plugin.py | client/scripts/build-plugin.py | import os, sys
import ue4config
import ue4util, gitutil, shutil, uploadutil
plugin_version = gitutil.get_short_version('.')
plugin_output_folder = os.path.abspath('./unrealcv-%s' % plugin_version)
plugin_output_folder = ue4util.get_real_path(plugin_output_folder)
def build_plugin():
UAT_script = ue4config.conf['U... | import os, sys
import ue4config
import ue4util, gitutil, shutil, uploadutil
plugin_version = gitutil.get_short_version('.')
plugin_output_folder = os.path.abspath('./unrealcv-%s' % plugin_version)
def build_plugin():
UAT_script = ue4config.conf['UATScript']
if not os.path.isfile(UAT_script):
print('Ca... | Python | 0 |
0bcd1ced7ddcaccd37a9504d542ba4eff68e479a | Create cefjs.py | cefjs.py | cefjs.py | # -*- coding: UTF-8 -*-
from cefpython3 import cefpython
import wx
application_settings = {
"cache_path": "/tmp/cef/cache/",
"debug": True,
"log_severity": cefpython.LOGSEVERITY_INFO,
"log_file": "/tmp/cef/debug.log",
"resources_dir_path": cefpython.GetModuleDirectory() + "/Resources",
"browser... | Python | 0.000004 | |
1765ac3a12ea2a56b4e25e05cf1f1b531de5b2cf | Add External Temperature Probe from OpenWeather | pyexternal.py | pyexternal.py | #!/usr/bin/env python
# Get External Temperature from OpenWeatherMap
# External informations are :
# - temperature
# - humidity
# - pressure
# - precipitation volume (each 3h)
import urllib.request
import json
import pyowm
from datetime import datetime
from pyserial import pySerial
from imports.pyTemperature import p... | Python | 0 | |
9a37f573aa985b3bd876c2df4c3f83670fddab42 | add script to set script permissions | chmod.py | chmod.py | import os, stat, sublime, sublime_plugin
# Configuration
pkg = 'NSIS'
script = sublime.packages_path() + '/' + pkg + '/nsis_build.sh'
def plugin_loaded():
from package_control import events
# chmod +x <script>
if (events.install(pkg) or events.post_upgrade(pkg)) and os.name is 'posix' or 'mac':
s... | Python | 0.000001 | |
7cd1c65b77eb474f67f1e194ceeb7bcde2d2bdb9 | Create wsgi.py | NGeO/NGeO/wsgi.py | NGeO/NGeO/wsgi.py | """
WSGI config for NGeO project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "NGeO.settings")
from django.core.wsgi im... | Python | 0.000001 | |
a7f1565efbdfa20d4d97d90a688b78da51533113 | Add new package: ycsb (#17788) | var/spack/repos/builtin/packages/ycsb/package.py | var/spack/repos/builtin/packages/ycsb/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 Ycsb(Package):
"""Yahoo! Cloud Serving Benchmark."""
homepage = "https://research.yah... | Python | 0 | |
b7baf1e53f24bb96a0b09e9305f5f1e562cf3547 | Create analog_tester.py | home/moz4r/analog_tester.py | home/moz4r/analog_tester.py | arduino = Runtime.createAndStart("arduino","Arduino")
arduino.setBoardNano()
arduino.connect("COM6")
arduino.setAref("DEFAULT")
def publishPin(pins):
for pin in range(0, len(pins)):print(pins[pin].value)
arduino.addListener("publishPinArray","python","publishPin")
#arduino.enablePin(pinAddress, rate)
#analog pin ra... | Python | 0.000009 | |
17956f008eabcca80dbacdb20e92b819b87d0f57 | Create homework-1-cryptanalysis.py | homework-1-cryptanalysis.py | homework-1-cryptanalysis.py | #! usr/bin/env python3
ORIGINAL_CIPHERTEXT = "\
NAGQNXIIZAGBGIIYXQOMQUGQUZAXTNGMYXQGTTASNISQO\
AMFGZAGEZVOOGUZAGIGMTAMQUTZYMXQGUMCMYZDECMLWS\
RVQYVIEASVQUTXLMQQSZTZMYZZAGDMOMXQSQMPVMYYESR\
WQSNIGUOGZAGEAMZGZSAVQZXLMQAMVIZAGDMQUVYOGZAG\
DQSDSYGQSDSYGLMQXGQUVYGZSBGMYZAGBYVQZSRZAGBSS\
WTZAMZIXGSVZSQZAGUGTWTMRVIIZAYGGTLSY... | Python | 0.000001 | |
5e6cfc84a4b34a292281ea466bf11facb680e72b | initialize radix sort file | radix_sort.py | radix_sort.py | def radix_sort(array):
"""
Sorts an array of numbers using the least signficant digit radix algorithm.
"""
if __name__ == '__main__':
print radix_sort.func_doc
| Python | 0.000001 | |
3e54e311a747b1e032384c7a74a8ed9aeafe1e8d | Fix constructor for Bernoulli node | bayespy/inference/vmp/nodes/bernoulli.py | bayespy/inference/vmp/nodes/bernoulli.py | ######################################################################
# Copyright (C) 2014 Jaakko Luttinen
#
# This file is licensed under Version 3.0 of the GNU General Public
# License. See LICENSE for a text of the license.
######################################################################
####################... | ######################################################################
# Copyright (C) 2014 Jaakko Luttinen
#
# This file is licensed under Version 3.0 of the GNU General Public
# License. See LICENSE for a text of the license.
######################################################################
####################... | Python | 0 |
0a16a2002e1247ad87a877de6aa85bb0844dc9c4 | tag tweaks | boards/NRF51TAG.py | boards/NRF51TAG.py | #!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at h... | #!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at h... | Python | 0.000001 |
e96832e16a6e5746faeaf647c6cd681f1d2f9bca | Create break_fracmorse.py | break_fracmorse.py | break_fracmorse.py | # usage: python break_fracmorse.py 'CIPHERTEXTMESSAGE'
# ideally you'll want 200 or so characters to reliably decrypt, shorter will often work but not as reliably.
import random
from ngram_score import ngram_score
import re
import sys
from pycipher import FracMorse
#ctext = FracMorse('PQRSTUVWXYZABCDEFGHIJKLMNO').enc... | Python | 0.998165 | |
decf4b1916a421fe996a31feb131b7ed9e4e3c36 | Add a simple benchmark script | numpy-benchmark-one.py | numpy-benchmark-one.py | import timeit
normal_py_sec = timeit.timeit('sum (x*x for x in xrange(1000))',number = 10000)
naive_np_sec = timeit.timeit('sum(na*na)',setup='import numpy as np; na=np.arange(1000)', number = 10000)
good_np_sec = timeit.timeit('na.dot(na)',setup='import numpy as np; na=np.arange(1000)', number = 10000)
print("Normal... | Python | 0.000001 | |
cb517a2cd1dea12fadf4f72147fecf0105cbd717 | include missing Message | palaverapi/message.py | palaverapi/message.py | # Adapted from https://github.com/kylef/irctk/blob/master/irctk/message.py
from typing import List, Optional
class Message:
@classmethod
def parse(cls, string: str) -> 'Message':
prefix = None
parameters = []
if string.startswith('@'):
_, string = string[1:].split(' ', 1)... | Python | 0.000027 | |
7aaf42a7b129ba5b9548db0b2a71a095246aeac9 | Add Py3 compatibility support helpers | paramiko/py3compat.py | paramiko/py3compat.py | import sys
__all__ = ['PY3', 'string_types', 'integer_types', 'text_type', 'bytes_type', 'long', 'input', 'bytestring', 'byte_ord', 'byte_chr', 'byte_mask', 'b', 'u', 'StringIO', 'BytesIO', 'is_callable', 'MAXSIZE', 'next']
PY3 = sys.version_info[0] >= 3
if PY3:
import collections
import struct
string_ty... | Python | 0 | |
6db9688d7c078c8cf8d1b17305e89bb680a46e53 | Create lc1001.py | LeetCode/lc1001.py | LeetCode/lc1001.py | xs = {}
ys = {}
fs = {}
ss = {}
grid = {}
def checkdic(xs, x):
if x not in xs:
xs[x] = set()
def checkempty(xs, x):
if x not in xs:
return 1
if len(xs[x]) == 0:
return 1
return 0
def remove(x, y):
if x not in grid:
return
if y not in grid[x]:
return
... | Python | 0.000003 | |
b7762c1b8bc987ed1b72ba0db0dbf47894c2e931 | add score | StuScore/Score.py | StuScore/Score.py | #!/usr/bin/env python
# coding:utf-8
from bs4 import BeautifulSoup
import requests
import re
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
def login(username, pswd='0'):
'''
模拟登录教务系统
:param username:
:param pswd:
:return: 登录状态
'''
login_url = 'http://219.242.68.33/Login.aspx'
f... | Python | 0.998398 | |
98aee2af9aa3f7dcc75969f1ec3118c40539793e | Add clone of Haskell version | pandoc-include-code.py | pandoc-include-code.py | #! /usr/bin/env python3
from sys import stdout, stderr, exit
import json
def walktransform(tree):
if isinstance(tree, list):
return [walktransform(subtree)
for subtree
in tree]
elif not isinstance(tree, dict):
exit('Unsupported AST node', type(tree))
elif i... | Python | 0 | |
70a6553d9323b3522e492c414b67e76111519368 | Add file to create all files to school census. | scripts/data_download/school_census/create_all_files.py | scripts/data_download/school_census/create_all_files.py | import os
import commands
import time
import logging
import sys
if len(sys.argv) != 3 or (sys.argv[1:][0] not in ['pt', 'en']):
print "ERROR! Use:\n python scripts/data_download/school_census/create_files.py en/pt output_path\n"
exit()
logging.basicConfig(filename=os.path.abspath(os.path.join(sys.argv[2],str(... | Python | 0 | |
e8d596ffc074dea152a2d714e9f68bb9e5c75eaa | change serviceClass from CharField to ForeignKey | planetstack/core/models/slice.py | planetstack/core/models/slice.py | import os
from django.db import models
from core.models import PlCoreBase
from core.models import Site
from core.models import User
from core.models import Role
from core.models import DeploymentNetwork
from core.models import ServiceClass
# Create your models here.
class Slice(PlCoreBase):
tenant_id = models.Cha... | import os
from django.db import models
from core.models import PlCoreBase
from core.models import Site
from core.models import User
from core.models import Role
from core.models import DeploymentNetwork
# Create your models here.
class Slice(PlCoreBase):
tenant_id = models.CharField(max_length=200, help_text="Key... | Python | 0 |
91b58112f1c83048511fdab09f9aad58351eb991 | add new package (#23573) | var/spack/repos/builtin/packages/py-pycocotools/package.py | var/spack/repos/builtin/packages/py-pycocotools/package.py | # Copyright 2013-2021 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 PyPycocotools(PythonPackage):
"""Official APIs for the MS-COCO dataset."""
homepage =... | Python | 0 | |
638ee09f0f2958a955fbad42368ffc6bb2a2688a | Add minimal REST API script based on flask | pipeline/scripts/bb_pipeline_api.py | pipeline/scripts/bb_pipeline_api.py | #!/usr/bin/env python3
from tempfile import NamedTemporaryFile
import json
from threading import Lock
import numpy as np
from flask import Flask, request
from scipy.misc import imread
from pipeline import Pipeline
from pipeline.objects import Image, Candidates, Saliencies, IDs
from pipeline.pipeline import get_auto_c... | Python | 0 | |
427caaa998ea03bf80a00aaf90833eb910cf909d | Add migration file | webapp/apps/taxbrain/migrations/0061_auto_20171220_1859.py | webapp/apps/taxbrain/migrations/0061_auto_20171220_1859.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import webapp.apps.taxbrain.models
class Migration(migrations.Migration):
dependencies = [
('taxbrain', '0060_auto_20171219_2153'),
]
operations = [
migrations.AddField(
... | Python | 0.000001 | |
80d75bad57c8be1b08fbb2129bb0511c633446e2 | Create CertPaIT.py | plugins/feeds/public/CertPaIT.py | plugins/feeds/public/CertPaIT.py | import logging
from datetime import datetime, timedelta
from core.observables import Hash
from core.feed import Feed
from core.errors import ObservableValidationError
class CertPaIt(Feed):
default_values = {
"frequency": timedelta(minutes=30),
"name": "CertPaIT",
"source" : "https://infose... | Python | 0 | |
90a467a849bb05cd0922ca0808279bf009657150 | Create reverse_words.py | Google_Code_Jam/2010_Africa/Qualification_Round/B/reverse_words.py | Google_Code_Jam/2010_Africa/Qualification_Round/B/reverse_words.py | #!/usr/bin/python -tt
"""Solves problem B from Google Code Jam Qualification Round Africa 2010
(https://code.google.com/codejam/contest/351101/dashboard#s=p1)
"Reverse Words"
"""
import sys
def main():
"""Reads problem data from stdin and prints answers to stdout.
Args:
None
Returns:
No... | Python | 0.999848 | |
3155a8ab725c1b1535a99229f31008587ceb3e64 | Add continuous finite test | HARK/ConsumptionSaving/tests/test_ConsRiskyContribModel.py | HARK/ConsumptionSaving/tests/test_ConsRiskyContribModel.py | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 26 10:06:51 2021
@author: Mateo
"""
import unittest
from copy import copy
import numpy as np
from HARK.ConsumptionSaving.ConsRiskyAssetModel import (
RiskyContribConsumerType,
init_riskyContrib
)
class test_(unittest.TestCase):
def setUp(self):
... | Python | 0.000178 | |
0f6961c10def1f1343c6c31d117e5ca87cefd4b7 | add openvas_vulns migration | alembic/versions/506c8e35ba7c_create_openvas_vuln_table.py | alembic/versions/506c8e35ba7c_create_openvas_vuln_table.py | """create openvas_vuln table
Revision ID: 506c8e35ba7c
Revises: 13b7c3d4c802
Create Date: 2017-07-21 12:19:35.711173
"""
from alembic import op
import sqlalchemy as sa
import datetime
def _get_date():
return datetime.datetime.now()
# revision identifiers, used by Alembic.
revision = '506c8e35ba7c'
down_revisio... | Python | 0 | |
6ce0d934cfe8b9e93a833ff1d31915ffd14c643d | add new package (#25526) | var/spack/repos/builtin/packages/py-pydantic/package.py | var/spack/repos/builtin/packages/py-pydantic/package.py | # Copyright 2013-2021 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 PyPydantic(PythonPackage):
"""Data validation and settings management using Python type hi... | Python | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.