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 |
|---|---|---|---|---|---|---|---|
f203136772cfdca96a44a848d646426a42111698 | Solve 20. | 020/solution.py | 020/solution.py | """ Project Euler problem #20. """
import math as mt
def problem():
""" Solve the problem.
Find the sum of the digits in the number 100!
Answer: 648
"""
num = mt.factorial(100)
return sum(map(int, str(num)))
if __name__ == '__main__':
print problem()
| Python | 0.999988 | |
fe88269d03915e06cba0d0d228e2f4e78592d172 | Create 0007_ssoaccesslist.py | evewspace/API/migrations/0007_ssoaccesslist.py | evewspace/API/migrations/0007_ssoaccesslist.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
('API', '0006_auto_20161223_1751'),
]
operations = [
migrations.CreateModel(
nam... | Python | 0.000003 | |
5b67f6ddea05cb301a317e500657cb1cd0949bff | Create solution.py | hackerrank/algorithms/sorting/easy/running_time_of_quicksort/py/solution.py | hackerrank/algorithms/sorting/easy/running_time_of_quicksort/py/solution.py | #!/bin/python
class QuickSort(object):
def __init__(self, debugMode = False):
self._debugMode = debugMode
self._swapCount = 0
def partition(self, L, lo, hi):
if hi - lo < 2:
return lo
i = j = lo
v = hi - 1
while i < v:
if L[i] < L[v]:... | Python | 0.000018 | |
5fc58dbb3dbb379eee332e0a96704a1ddecb71c2 | move file | src/docker/utils.py | src/docker/utils.py | """Utility functions."""
from __future__ import absolute_import, division, print_function
import http.client # This should have been backported to Python2.
from ..utils import logger, load_yaml, save_yaml
def indent(instruction, cmd, line_suffix=' \\'):
"""Add Docker instruction and indent command.
Paramete... | Python | 0.000003 | |
844d94619f2cf221ab5bd550f3136be4d164155b | add working dir | working_dir/diff.py | working_dir/diff.py | #! /usr/bin/env python
#! coding: utf8
import os, argparse, re, glob
db_user = 'aleph'
db_pass = 'swbrIcu3Iv4cEhnTzmJL'
# parse args
parser = argparse.ArgumentParser(description='')
parser.add_argument('--locale', '-l', default='zhCN',
help='Locale to extract, eg. zhCN, default zhCN')
parser.add_a... | Python | 0.000002 | |
bb0178d0b97f52bb163cf13be3bd763840426f32 | Add API tests | django/artists/tests/test_api.py | django/artists/tests/test_api.py | import json
from django.core.urlresolvers import reverse
from mock import patch
from rest_framework import status
from rest_framework.test import APITestCase
from artists.models import Artist
from echonest.models import SimilarResponse
class ArtistTest(APITestCase):
@patch('echonest.utils.get_similar_from_api'... | Python | 0 | |
36beb6ae8bc41e5d131dbbdc65d6716d498375c7 | add script to diff bonferonni & benjamini-whitney p-value corrections | server/diffBHvsBon.py | server/diffBHvsBon.py | #!/usr/bin/env python2.7
"""
diffBHvsBon.py
This reports differnences between the BenjaminiWhitney-FDR p-value correction
vs. the Bonferroni
"""
import sys, os, csv, traceback, glob
def diffBHvsBon():
#basePath = '/Users/swat/data/mcrchopra/first/'
#tmpBase = '/Users/swat/tmp/'
tmpBase = '/cluster/home/sw... | Python | 0 | |
55fa30c236095006e6f9c970ef668598c4348a96 | Add microservice plugin for adding static attributes to responses. | src/satosa/micro_service/attribute_modifications.py | src/satosa/micro_service/attribute_modifications.py | import os
import yaml
from satosa.internal_data import DataConverter
from satosa.micro_service.service_base import ResponseMicroService
class AddStaticAttributes(ResponseMicroService):
"""
Add static attributes to the responses.
The path to the file describing the mapping (as YAML) of static attributes... | Python | 0 | |
b72dd1c890491ccfe2de66f89f5adc035e862acb | Create HtmlParser.py | service/HtmlParser.py | service/HtmlParser.py | #########################################
# HtmlParser.py
# description: html parser
# categories: [document]
# possibly more info @: http://myrobotlab.org/service/HtmlParser
#########################################
# start the service
htmlparser = Runtime.start("htmlparser","HtmlParser")
| Python | 0.000002 | |
9c8402bdadb4860a3876aa2ab0f94b9ddac8cfd5 | Add offboard_sample.py | script/offboard_sample.py | script/offboard_sample.py | #!/usr/bin/env python
import rospy
from geometry_msgs.msg import PoseStamped
from mavros_msgs.msg import State
from mavros_msgs.srv import CommandBool, CommandBoolRequest
from mavros_msgs.srv import SetMode, SetModeRequest
current_state = State()
def state_cb(msg):
global current_state
current_state = msg
d... | Python | 0.000001 | |
b883b3066848957376d841cb4ffdf2d5646315c8 | add quick-testlist.py | scripts/quick-testlist.py | scripts/quick-testlist.py | #!/usr/bin/env python
#
# Copyright 2015 Intel Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modif... | Python | 0 | |
718379eea1e0c58ba76ada08d64512d9f4904c07 | add new package (#10060) | var/spack/repos/builtin/packages/eztrace/package.py | var/spack/repos/builtin/packages/eztrace/package.py | # Copyright 2013-2018 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 Eztrace(AutotoolsPackage):
"""EZTrace is a tool to automatically generate execution traces... | Python | 0 | |
cfe9550bfe7d8659c06892af8a32662cb372bea9 | add new package : sysstat (#13907) | var/spack/repos/builtin/packages/sysstat/package.py | var/spack/repos/builtin/packages/sysstat/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Sysstat(AutotoolsPackage):
"""The sysstat package contains various utilities, common to ma... | Python | 0 | |
da6f3bbb10537da5e88340016fa84ea5bcc359b0 | Add support for route 53 dns record manipulation | actions/cloudbolt_plugins/aws/route_53_dns_plugin/route_53_dns_record_manipulation.py | actions/cloudbolt_plugins/aws/route_53_dns_plugin/route_53_dns_record_manipulation.py | '''
http://boto3.readthedocs.io/en/latest/reference/services/route53.html
http://boto3.readthedocs.io/en/latest/reference/services/route53.html#Route53.Client.change_resource_record_sets
'''
from resourcehandlers.aws.models import AWSHandler
from common.methods import set_progress
#dns zone friendly name -- no traili... | Python | 0 | |
56592b10e25cd1f2cf8d122df389268ab24b3729 | refactor and use OOMMF_PATH environment variable to locate oommf.tcl | oommfmif/__init__.py | oommfmif/__init__.py | import os
import subprocess
# Environment variable OOMMF_PATH should point to the directory which
# contains 'oommf.tcl'
oommf_path = os.environ['OOMMF_PATH']
def call_oommf(argstring):
"""Convenience function to call OOMMF: Typicallusage
p = call_oommf("+version")
p.wait()
stdout, stderr = p.stdout... | import subprocess
def get_version():
p = subprocess.Popen("~/git/oommf/oommf/oommf.tcl +version", shell=True,
stderr=subprocess.PIPE, stdout=subprocess.PIPE)
p.wait()
stdout, stderr = p.stdout.read(), p.stderr.read()
# version is returned in stderr
print(stderr.split()[0:... | Python | 0 |
94f5f630c315bc6951c98cd2a9f4908ce05d59a4 | Test float precision in json encoding. | fedmsg/tests/test_encoding.py | fedmsg/tests/test_encoding.py | import unittest
import fedmsg.encoding
from nose.tools import eq_
class TestEncoding(unittest.TestCase):
def test_float_precision(self):
""" Ensure that float precision is limited to 3 decimal places. """
msg = dict(some_number=1234.123456)
json_str = fedmsg.encoding.dumps(msg)
pr... | Python | 0 | |
f50e737a892139cbd5a680441618c2f7af8b1637 | Create largura.py | largura.py | largura.py | class Noh:
def __init__(self, valor, pai = None):
self.valor = valor
self.pai = pai
self.filho_esquerdo = None
self.irmao_direito = None
if pai:
pai.filhos.append(self)
self.filhos = []
def adicionar(self, filhos):
self.filhos.append(filhos)
... | Python | 0.000002 | |
dfb4c5422c79fcd413d0d9a028cb5548e2678454 | Add script for generating test certificates | generate_test_certificates.py | generate_test_certificates.py | import trustme
# Create a CA
ca = trustme.CA()
# Issue a cert signed by this CA
server_cert = ca.issue_cert(u"www.good.com")
# Save the PEM-encoded data to a file
ca.cert_pem.write_to_path("GoodRootCA.pem")
server_cert.private_key_and_cert_chain_pem.write_to_path("www.good.com.pem")
| Python | 0 | |
89a78e09ee52c27df8cd548839b240984b13d61d | add client exception | kafka/exception/client.py | kafka/exception/client.py | class FailedPayloadsException(Exception):
pass
class ConnectionError(Exception):
pass
class BufferUnderflowError(Exception):
pass
class ChecksumError(Exception):
pass
class ConsumerFetchSizeTooSmall(Exception):
pass
class ConsumerNoMoreData(Exception):
pass
| Python | 0.000001 | |
de71fee0a095ea043c66be92ad8bd6685b7fc74f | Fix #7026 adding a new wol parameter (#7144) | homeassistant/components/switch/wake_on_lan.py | homeassistant/components/switch/wake_on_lan.py | """
Support for wake on lan.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.wake_on_lan/
"""
import logging
import platform
import subprocess as sp
import voluptuous as vol
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHE... | """
Support for wake on lan.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.wake_on_lan/
"""
import logging
import platform
import subprocess as sp
import voluptuous as vol
from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHE... | Python | 0 |
05004f8dc48fe15268bc2d0146e5788f0bdf463e | Add missing migration | djedi/migrations/0002_auto_20190722_1447.py | djedi/migrations/0002_auto_20190722_1447.py | # Generated by Django 2.2.3 on 2019-07-22 14:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('djedi', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='node',
name='is_published',
... | Python | 0 | |
2bbca64af8089433e5e9a1a3a57439286affaabb | Create a macro to set metadata to routed stories from desk's default template. [SDCP-375] (#2017) | superdesk/macros/set_default_template_metadata.py | superdesk/macros/set_default_template_metadata.py | import logging
from flask import current_app as app
from flask_babel import lazy_gettext
from superdesk import get_resource_service
logger = logging.getLogger(__name__)
def get_default_content_template(item, **kwargs):
if 'dest_desk_id' in kwargs:
desk = None
desk_id = kwargs['dest_desk_id']
... | Python | 0 | |
f74c20ae5a35eb66b48b1dbc219d00db674bf995 | Add tests for StudentsInfoList component of GCI dashboard. | tests/app/soc/modules/gci/views/test_dashboard.py | tests/app/soc/modules/gci/views/test_dashboard.py | #!/usr/bin/env python2.5
#
# Copyright 2011 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | Python | 0 | |
c201245a01ded92bec91f1f34320e87666330c44 | add mbtiles command | seedsource_core/django/seedsource/management/commands/create_vector_tiles.py | seedsource_core/django/seedsource/management/commands/create_vector_tiles.py | from django.core.management import BaseCommand
from seedsource_core.django.seedsource.models import SeedZone
import subprocess
class Command(BaseCommand):
help = 'Facilitates converting of vector data into vector tiles.'
def handle(self, *args, **options):
def write_out(output):
self.stdou... | Python | 0.00123 | |
08364dae50a68b5d053eadc836c02b51873df250 | Add dog_cat | cnn/dog_cat/dog_cat.py | cnn/dog_cat/dog_cat.py | from keras.models import Sequential
from keras.layers import Convolution2D, MaxPooling2D
from keras.layers import Activation, Dropout, Flatten, Dense
from keras.preprocessing.image import ImageDataGenerator
def save_history(history, result_file):
loss = history.history['loss']
acc = history.history['a... | Python | 0.999994 | |
fa7a24493e6e8029ea2dd7f3bf244b08353c50a3 | create run commnd | manage.py | manage.py | import os
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from app import app, db
app.config.from_object(os.getenv('APP_SETTINGS', 'config.DevelopmentConfig'))
migrate = Migrate(app, db)
manager = Manager(app)
manager.add_command('db', MigrateCommand)
if __name__ == '__main__':... | Python | 0 | |
6bd35a2df0dbeca2668999dafbbd05779911cca7 | add directory for state | src/mugen/state/serialize.py | src/mugen/state/serialize.py | #!/usr/bin/env python
# This script reads a specification of a datastructure with fields in it and writes
# out a class that contains those fields and a way to serialize/deserialize them
# to a stream. This is similar to google's protobuf but using a much simpler
# implementation.
# TODO: grammar of specification
| Python | 0 | |
d5aae9d0a770cad05c76c30754f5fcc57be5bd9b | Solve Fuel Spent in python | solutions/uri/1017/1017.py | solutions/uri/1017/1017.py | h = float(input())
s = float(input())
print(f"{h * s / 12.0:.3f}")
| Python | 0.999999 | |
52f4d72387810994a7106e4fa55c3bfcda798a1c | Create __init__.py | ENN/__init__.py | ENN/__init__.py | Python | 0.000429 | ||
f3f073379b71a13fea4255622c7df19bec02fdd7 | bump version | EMpy/version.py | EMpy/version.py | __author__ = 'Lorenzo Bolla'
version = '0.1.4'
| __author__ = 'Lorenzo Bolla'
version = '0.1.3'
| Python | 0 |
94610546a63a05f81942c43b12c109185a8a4aff | add benchmark.py for cifar_distributed_cnn | examples/cifar_distributed_cnn/benchmark.py | examples/cifar_distributed_cnn/benchmark.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | Python | 0.000001 | |
05e37a58825a6b75ade5ffdd25e887f9c9a7409c | Add net/ip.py containing python function wrapping /sbin/ip | net/ip.py | net/ip.py | #!/usr/bin/env python
# Copyright (c) 2012 Citrix Systems, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation; version 2.1 only. with the special
# exception on linking described in fi... | Python | 0.000015 | |
2b57a443807de26c9e71c97fd029e3d8416db597 | Add feature usage shuffler | SessionTools/feature_usage_shuffler.py | SessionTools/feature_usage_shuffler.py | # Condenses all the feature files into a single location,
# Split by the names of the features
import sys
from os.path import isfile
import os
import json
path = sys.argv[1]
out_path = sys.argv[2]
paths = []
i = 0
skipped = 0
pretty_print_json_output = True
feature_versions_map = {}
def flush():
# Create one... | Python | 0 | |
66bb19a5937091812b80b9c0d98c6f52b9d47165 | add new package : kafka (#14315) | var/spack/repos/builtin/packages/kafka/package.py | var/spack/repos/builtin/packages/kafka/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Kafka(Package):
"""
Kafka is used for building real-time data pipelines and streaming ... | Python | 0 | |
16e6f88e094d4eac8ba154eed5681187f14ab652 | Create __init__.py | spacegame/__init__.py | spacegame/__init__.py | """SpaceGame
A simple 2d space shooter made with python and pygame.
"""
# Make sure you ha python34 and pygame 1.9.1+ installed before run this code.
import pygame
import pygame.locals as c
# this module itself does nothing important, but its good to have pygame
# initialized as soon as possible.
pygame.init()
| Python | 0.000001 | |
00cdcceb131814b24546c36810682ed78ba866c6 | Create database column class (DBCol) | pyfwk/struc/dbcol.py | pyfwk/struc/dbcol.py | #!/usr/bin/env python
"""
dbcol.py: DBCol is a struct describing an sqlite database table column
"""
# ----------------------------DATABASE-COLUMN-----------------------------#
class DBCol:
name = None
datatype = None
def __init__(self, name, datatype):
self.name = name
self.datatype =... | Python | 0 | |
891eef2354e4cf0a552e5c8023c2778bf45a3582 | add py lib and the first py fiel | pylib/EncodingLib.py | pylib/EncodingLib.py | # coding=utf-8
import sys
# sys.stdout = codecs.lookup('iso8859-1')[-1](sys.stdout)
print 'System Encoding is', sys.getdefaultencoding()
# python中的str对象其实就是"8-bit string" ,字节字符串,本质上类似java中的byte[]。
s_chinese = '中文'
# 而python中的unicode对象应该才是等同于java中的String对象,或本质上是java的char[]。
s_unicode_chinese = u'中文'
print 's_chines... | Python | 0.000001 | |
2644625e137963ef2982d7ff0a3241bfcbde1ac6 | Prepend the logs with '...' if they aren't complete | raven_cron/runner.py | raven_cron/runner.py | from os import getenv, SEEK_END
from raven import Client
from subprocess import call
from tempfile import TemporaryFile
from argparse import ArgumentParser
from sys import argv, exit
from time import time
from .version import VERSION
MAX_MESSAGE_SIZE = 1000
parser = ArgumentParser(description='Wraps commands and repo... | from os import getenv, SEEK_END
from raven import Client
from subprocess import call
from tempfile import TemporaryFile
from argparse import ArgumentParser
from sys import argv, exit
from time import time
from .version import VERSION
MAX_MESSAGE_SIZE = 1000
parser = ArgumentParser(description='Wraps commands and repo... | Python | 0.00028 |
c6c5c8e209d8c21037e55302f4720cac4224ede3 | Create wreckuests.py | wreckuests.py | wreckuests.py | # -*- coding: utf-8 -*-
import sys, os, threading, random, requests, time, getopt, asyncio, socket, re
from threading import Thread, Event
from netaddr import IPNetwork, IPAddress
from requests.auth import HTTPBasicAuth
from urllib.parse import urlparse
#versioning
VERSION = (0, 1, 0)
__version__ = '%d.%d.%d' % VERSIO... | Python | 0.000007 | |
e66a690271f23fc2a4904e446bbdf0bf6b491a60 | Add manager migration | osf/migrations/0028_auto_20170504_1548.py | osf/migrations/0028_auto_20170504_1548.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-04 20:48
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('osf', '0027_auto_20170428_1435'),
]
operations = [
migrations.AlterModelOptions(
... | Python | 0.000002 | |
84e3475158797a60312068c284aa8d61d9466c6e | add model | www/models.py | www/models.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Models for user, blog, comment
'''
__author__ = 'Ian Zheng'
import time, uuid
from www.orm import Model, StringField, BooleanField, IntegerField, FloatField
def next_id():
return '%015d%s000' % (int(time.time() * 1000), uuid.uuid4().hex)
class User(Model):
... | Python | 0 | |
3e9d5f9cf1c28619422cb012e532e776c4cc8b99 | fix bug 1369498: remove adi-related tables and stored procedures | alembic/versions/eb8269f6bb85_bug_1369498_remove_adi.py | alembic/versions/eb8269f6bb85_bug_1369498_remove_adi.py | """bug 1369498 remove adi
Remove ADI-related tables and stored procedures.
Revision ID: eb8269f6bb85
Revises: 0db05da17ae8
Create Date: 2018-07-19 20:00:52.933551
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = 'eb8269f6bb85'
down_revision = '0db05da17ae8'
def upgrade():
# Rem... | Python | 0 | |
c413098151bc1cf7d9e37902afe4b110f97b9d57 | Add koth example (WIP) | examples/koth_vmflib_example.py | examples/koth_vmflib_example.py | #!/usr/bin/python3
"""Example map generator: King of the Hill Example
This script demonstrates vmflib by generating a basic "king of the hill" style
map. "King of the hill" is a game mode in Team Fortress 2 where each team tries
to maintain control of a central "control point" for some total defined amount
of time (b... | Python | 0 | |
4f5ce4af85971ea3c15c90b8a482b611b8bf6c4c | move logging code to evaluation directory | src/evaluation/log.py | src/evaluation/log.py | """ This module provides a globally accessible
logger created from the config file """
import logging
import os
def _create_logger_from_config():
""" Create the logger from the config file """
conf = {
"name": "StackLogger",
"log_file": "logs/experiment.log",
"format": "%(asctime)s... | Python | 0 | |
6d93ad1df3eb4a50038b7429fe9ed98a8d44af6f | add solution for Divide Two Integers | src/divideTwoIntegers.py | src/divideTwoIntegers.py | class Solution:
# @return an integer
def divide(self, dividend, divisor):
if divisor == 0:
return 2147483647
positive = (dividend < 0) is (divisor < 0)
dividend, divisor = abs(dividend), abs(divisor)
res = 0
while dividend >= divisor:
tmp, i = div... | Python | 0.000184 | |
51466e360320267afab41704caecebac0dff1dc2 | Add a handler for performing client load testing. | src/example/bench_wsh.py | src/example/bench_wsh.py | # Copyright 2011, Google Inc.
# 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 copyright
# notice, this list of conditions and the f... | Python | 0.000053 | |
bf7d56c748eb42350c4b37a858ee5d6bb4844efa | Add test coverage of existing simple tenant usage policies | nova/tests/unit/policies/test_simple_tenant_usage.py | nova/tests/unit/policies/test_simple_tenant_usage.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.000191 | |
d45bdf62d54c0a5efc77be639f4259807a286d6e | Create pour-water.py | Python/pour-water.py | Python/pour-water.py | # Time: O(v * n)
# Space: O(1)
# We are given an elevation map, heights[i] representing the height of the terrain at that index.
# The width at each index is 1. After V units of water fall at index K, how much water is at each index?
#
# Water first drops at index K and rests on top of the highest terrain or water at... | Python | 0.000006 | |
8dbc2dd48d1d0e25972ad359464694d352d58705 | add transpilation of the arangodb social graph | examples/createSocialGraph.py | examples/createSocialGraph.py | #!/usr/bin/python
import sys
from pyArango.connection import *
from pyArango.graph import *
from pyArango.collection import *
class Social(object):
class male(Collection) :
_fields = {
"name" : Field()
}
class female(Collection) :
_field... | Python | 0.00189 | |
3af86cf1521170ffeb886802f4a96f403e86bf82 | add title | src/slidegen/DataProvider.py | src/slidegen/DataProvider.py | from glob import glob
import random
class DataProviderBase(object):
def __init__(self):
'''
Init your data provider
'''
raise NotImplementedError('Please ')
def image(self, size):
'''
size in ['big', 'medium', 'small']
big for full page background
... | from glob import glob
import random
class DataProviderBase(object):
def __init__(self):
'''
Init your data provider
'''
raise NotImplementedError('Please ')
def image(self, size):
'''
size in ['big', 'medium', 'small']
big for full page background
... | Python | 0.999996 |
06d2d7dd155f5ac888a8c0d2d9c45c61b95de714 | update tests for thresholding for ecm | CPAC/network_centrality/tests/test_thresh_and_sum.py | CPAC/network_centrality/tests/test_thresh_and_sum.py | """
This tests the functions in network_centrality/thresh_and_sum.pyx
"""
import os, sys
import numpy as np
from numpy.testing import *
from nose.tools import ok_, eq_, raises, with_setup
from nose.plugins.attrib import attr # http://nose.readthedocs.org/en/latest/plugins/attrib.html
import sys
sys.path.insert(0,... | Python | 0 | |
8f3767384b1173c2a9921fce055fdec0e2f1bacc | add backupscript | backupscript.py | backupscript.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import datetime, os, shutil
PATH_CONFIG = {
'local_backup_path': '/Users/raphaelprader/Desktop/fake_bu_path'
}
DB_CREDENTIALS = {
'username': 'root',
'password': '',
'host': 'localhost',
'db_names': [
'db_www_sprachtandem_ch',
]
}
GDRIVE_CREDENTIALS = {
'remote_name... | Python | 0.000001 | |
82fa373c46581e84f8e5ea0da733ef5c65928165 | Update MultipleParticleSystems.pyde | mode/examples/Topics/Simulate/MultipleParticleSystems/MultipleParticleSystems.pyde | mode/examples/Topics/Simulate/MultipleParticleSystems/MultipleParticleSystems.pyde | """
Multiple Particle Systems
by Daniel Shiffman.
Click the mouse to generate a burst of particles
at mouse location.
Each burst is one instance of a particle system
with Particles and CrazyParticles (a subclass of Particle).
Note use of Inheritance and Polymorphism here.
"""
from crazy_particle import CrazyParticle... | """
Multiple Particle Systems
by Daniel Shiffman.
Click the mouse to generate a burst of particles
at mouse location.
Each burst is one instance of a particle system
with Particles and CrazyParticles (a subclass of Particle).
Note use of Inheritance and Polymorphism here.
"""
from crazy_particle import CrazyParticle... | Python | 0 |
70bc8413dc3748f606e76f5e4e4abcde6b851cdd | Read and UDP | bari_spitter.py | bari_spitter.py | #!/usr/bin/python3
# coding=utf-8
"""reads barometric pressure sensor and writes it to UDP socket with timestamp
"""
import socket
from datetime import datetime
from time import sleep
from time import time
import ms5637
__author__ = 'Moe'
__copyright__ = 'Copyright 2017 Moe'
__license__ = 'MIT'
__version__ = '0.0.2'... | Python | 0.000001 | |
6811b4014fc0267edf4d397ccab86b0e986c2215 | Implement the INFO command | txircd/modules/rfc/cmd_info.py | txircd/modules/rfc/cmd_info.py | from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd import version
from txircd.module_interface import Command, ICommand, IModuleData, ModuleData
from zope.interface import implements
class InfoCommand(ModuleData, Command):
implements(IPlugin, IModuleData, ICommand)
name... | Python | 0.999339 | |
0f199556df6bd498f01cccdce6316b733c876acc | Add migration file | InvenTree/part/migrations/0046_auto_20200804_0107.py | InvenTree/part/migrations/0046_auto_20200804_0107.py | # Generated by Django 3.0.7 on 2020-08-04 01:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('part', '0045_auto_20200605_0932'),
]
operations = [
migrations.AlterField(
model_name='partcategory',
name='default_... | Python | 0.000001 | |
f8fcae7dd7579b51c3c204337dfa70c702fdbf38 | add new namedtuple Chunk | AlphaTwirl/HeppyResult/Chunk.py | AlphaTwirl/HeppyResult/Chunk.py | # Tai Sakuma <tai.sakuma@cern.ch>
##__________________________________________________________________||
import collections
##__________________________________________________________________||
Chunk = collections.namedtuple('Chunk', 'inputPath treeName maxEvents start component name')
##___________________________... | Python | 0.00003 | |
83986f6ade666e5f12ae599048369ecdd9856737 | VISIBLE not visible | src/sentry/api/endpoints/team_project_index.py | src/sentry/api/endpoints/team_project_index.py | from __future__ import absolute_import
from rest_framework import serializers, status
from rest_framework.response import Response
from sentry.api.base import DocSection
from sentry.api.bases.team import TeamEndpoint
from sentry.api.serializers import serialize
from sentry.models import Project, ProjectStatus, AuditL... | from __future__ import absolute_import
from rest_framework import serializers, status
from rest_framework.response import Response
from sentry.api.base import DocSection
from sentry.api.bases.team import TeamEndpoint
from sentry.api.serializers import serialize
from sentry.models import Project, ProjectStatus, AuditL... | Python | 0.999528 |
16004f8138e16da51a5a1df22f3a23b1c9146256 | Create YelpReviewUsefulnessPrediction_v1.py | src/yyliu/YelpReviewUsefulnessPrediction_v1.py | src/yyliu/YelpReviewUsefulnessPrediction_v1.py | import os
import sys
import numpy as np
import nltk
# Set the path for spark installation
# this is the path where you have built spark using sbt/sbt assembly
os.environ['SPARK_HOME'] = "/Applications/spark-2.1.0"
# os.environ['SPARK_HOME'] = "/home/jie/d2/spark-0.9.1"
# Append to PYTHONPATH so that pyspark could be ... | Python | 0.000023 | |
eeefca1f758b13f53b2f7c0b9fbe6122d3ec9aba | Create MovieTimeAPI.py | MovieTimeAPI.py | MovieTimeAPI.py | #imports for flask framework and command line manipulation
from flask import *
import subprocess ... | Python | 0.000001 | |
658cefded99d140db212b9525f791ce2e0336472 | Fix NameError in custom_csrf_failure | pydotorg/views.py | pydotorg/views.py | from django.http import HttpResponseForbidden
from django.template import Context, Engine, TemplateDoesNotExist, loader
from django.utils.translation import ugettext as _
from django.utils.version import get_docs_version
from django.views.csrf import CSRF_FAILURE_TEMPLATE, CSRF_FAILURE_TEMPLATE_NAME
from django.views.g... | from django.http import HttpResponseForbidden
from django.template import Context, Engine, TemplateDoesNotExist, loader
from django.utils.translation import ugettext as _
from django.utils.version import get_docs_version
from django.views.csrf import CSRF_FAILURE_TEMPLATE, CSRF_FAILURE_TEMPLATE_NAME
from django.views.g... | Python | 0.000008 |
f531eb7d1734d6d715893356a50d11eee6bc009a | Test mobile set password form | corehq/apps/users/tests/forms.py | corehq/apps/users/tests/forms.py | from collections import namedtuple
from django.contrib.auth import get_user_model
from django.test import TestCase
from corehq.apps.users.forms import SetUserPasswordForm
Project = namedtuple('Project', ['name', 'strong_mobile_passwords'])
class TestSetUserPasswordForm(TestCase):
def setUp(self):
super(T... | Python | 0 | |
cb5f676ea015d0d545b0a54c4220de4ba9cbd7a7 | Add a PrivateL1CacheHierarchy to the gem5 components | components_library/cachehierarchies/classic/private_l1_cache_hierarchy.py | components_library/cachehierarchies/classic/private_l1_cache_hierarchy.py | # Copyright (c) 2021 The Regents of the University of California
# 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 copyright
# notice, this lis... | Python | 0.000001 | |
b3f436e14df37d4af602dcdc9882ce27c97fabd4 | Add a yaml sdb module (#37563) | salt/sdb/yaml.py | salt/sdb/yaml.py | # -*- coding: utf-8 -*-
'''
Pull sdb values from a YAML file
:maintainer: SaltStack
:maturity: New
:platform: all
.. versionadded:: Nitrogen
Configuration:
.. code-block:: yaml
my-yaml-file:
driver: yaml
files:
- /path/to/foo.yaml
- /path/to/bar.yaml
The files are merg... | Python | 0 | |
a2151435057e3e42b8ecf6323b8276f4698fdd15 | Create getTermSize.py | ssh_utils/getTermSize.py | ssh_utils/getTermSize.py | #!/usr/bin/env python
""" getTerminalSize()
- get width and height of console
- works on linux,os x,windows,cygwin(windows)
"""
__all__=['getTerminalSize']
def getTerminalSize():
import platform
current_os = platform.system()
tuple_xy=None
if current_os == 'Windows':
tuple_xy = _getTerminalSize... | Python | 0 | |
6c38414d899b00cf0ba386e59721354f3b2a799b | Update bechdel.py | bechdel.py | bechdel.py | # Difficulty level: Advanced
# Goal #1: Create a program that will print out a list of movie titles and a set of ratings defined below into a particular format.
# First, choose any five movies you want.
# Next, look each movie up manually to find out four pieces of information:
# Their parental guidance rating (G, ... | Python | 0 | |
5b0f490cb527b0940dc322b060069f44fb29accd | Add git versioning | expyfun/_git.py | expyfun/_git.py | # -*- coding: utf-8 -*-
| Python | 0 | |
bcfac4b7ea5b10b5b6e84a756d716ef6c47cdd62 | Create finalproject.py | finalproject.py | finalproject.py | code!
| Python | 0.000002 | |
2cdf030ee6d8a545c071f2c033d88c6c2091ef08 | Add freeze_graph tool | freeze_graph.py | freeze_graph.py | # code from https://blog.metaflow.fr/tensorflow-how-to-freeze-a-model-and-serve-it-with-a-python-api-d4f3596b3adc
# Thanks Morgan
import os, argparse
import tensorflow as tf
from tensorflow.python.framework import graph_util
dir = os.path.dirname(os.path.realpath(__file__))
def freeze_graph(model_folder):
# We r... | Python | 0.000001 | |
f632bb5e63035e491ec74bdbcb0537cf03fa2769 | Add salt states for rbenv | salt/states/rbenv.py | salt/states/rbenv.py | import re
def _check_rbenv(ret,runas=None):
if not __salt__['rbenv.is_installed'](runas):
ret['result'] = False
ret['comment'] = 'Rbenv is not installed.'
return ret
def _ruby_installed(ret, ruby, runas=None):
default = __salt__['rbenv.default'](runas=runas)
for version in __salt__['rb... | Python | 0.000003 | |
3cffe6ce42702a1aaa4a01ae1f90962a00fcb911 | Add yum module | salt/modules/yum.py | salt/modules/yum.py | '''
Support for YUM
'''
import subprocess
def _list_removed(old, new):
'''
List the pachages which have been removed between the two package objects
'''
pkgs = []
for pkg in old:
if not new.has_key():
pkgs.append(pkg)
return pkgs
def list_pkgs():
'''
List the packa... | Python | 0.000001 | |
2207e8dfbf1ea0f11cac0a95f7c5317eaae27f9b | Add cron state support | salt/states/cron.py | salt/states/cron.py | '''
Manage cron states
'''
def present(name,
user='root',
minute='*',
hour='*',
daymonth='*',
month='*',
dayweek='*',
):
'''
Verifies that the specified cron job is present for the specified user
'''
ret = {'name': name,
'result': True,... | Python | 0 | |
86c2441be14dbc3303b0bc65356372728a62fd4a | Add infrastructure for counting database queries | test/performance.py | test/performance.py | from contextlib import contextmanager
import json
import os
import re
import sys
from django.conf import settings
from django.db import connection, reset_queries
count = {}
@contextmanager
def count_queries(k):
q = 0
debug = settings.DEBUG
try:
settings.DEBUG = True
reset_queries()
... | Python | 0.000001 | |
059b7c5705d2134ca998e67caf65e3125d503dbc | add sitemap.py | staticpy/page/sitemap.py | staticpy/page/sitemap.py | from __future__ import absolute_import
import os
from jinja2 import Environment, PackageLoader
from ..utils import write_to_file
class Sitemap(object):
def __init__(self, site):
self.env = Environment(loader=PackageLoader('dynamic', 'templates'))
self.site = site
def write(self):
t... | Python | 0.000002 | |
b5568053325bd78c277d4bc0adff59cd12e10f48 | Add a script to build plugin. | build-plugin.py | build-plugin.py | import os
UnrealEnginePath='/home/qiuwch/workspace/UnrealEngine'
UATScript = os.path.join(UnrealEnginePath, 'Engine/Build/BatchFiles/RunUAT.sh')
FullPluginFile = os.path.abspath('UnrealCV.uplugin')
os.system('%s BuildPlugin -plugin=%s' % (UATScript, FullPluginFile))
| Python | 0 | |
01803c0b8f09d8a818f3ca4db4e4b9c5c14634da | Create retrieve_data.py | data_crawler/retrieve_data.py | data_crawler/retrieve_data.py | import rauth
import time
def main():
locations = [(48.44, -123.34), (48.40, -123.37), (48.42, -123.30), (48.44, -123.33), (48.47, -123.32)]
api_calls = []
for lat,longi in locations:
params = get_search_parameters(lat, longi)
api_calls.append(get_results(params))
time.sleep(1.0)
##Do other processing
wi... | Python | 0 | |
3be1c4f57e68b89d3c740a444e1f14ba67f3eada | Add a snippet. | python/pyqt/pyqt5/widget_QTableView_delegate_on_edit_using_timeedit_widget.py | python/pyqt/pyqt5/widget_QTableView_delegate_on_edit_using_timeedit_widget.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Ref:
# - http://doc.qt.io/qt-5/modelview.html#3-4-delegates
# - http://doc.qt.io/qt-5/model-view-programming.html#delegate-classes
# - http://doc.qt.io/qt-5/qabstractitemdelegate.html#details
# - http://doc.qt.io/qt-5/qitemdelegate.html#details
# - http://doc.qt.io/qt-5... | Python | 0.000002 | |
1f98fdc87ef62bb2b7a815f80c56f6957ab303b5 | Add tests for tensor_operators | python-primitiv/tests/tensor_operators.py | python-primitiv/tests/tensor_operators.py | from primitiv import Device
from primitiv import tensor_operators as tF
from primitiv.devices import Naive
import numpy as np
import unittest
class TensorOperatorsTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
pass
@classmethod
def tearDownClass(cls):
pass
def setUp... | Python | 0 | |
bf42dd5246d935b0179faf1d563baa98bbcf0dbc | Create setup.py | Python/setup.py | Python/setup.py | #==================================================================================================
# Copyright (C) 2016 Olivier Mallet - All Rights Reserved
#==================================================================================================
# run with:
# python... | Python | 0.000001 | |
5ae41fc3763f4fd4a25a7863ab139ef2709e9565 | Fix missing import | Python/setup.py | Python/setup.py | #!/usr/bin/env python
from setuptools import setup
import sys
requirements = [x.strip() for x in open("requirements.txt")]
# Automatically run 2to3 for Python 3 support
extra = {}
if sys.version_info >= (3,):
extra['use_2to3'] = True
setup(name='ml_metrics',
version='0.1.2',
description='Machine Lea... | #!/usr/bin/env python
from setuptools import setup
requirements = [x.strip() for x in open("requirements.txt")]
# Automatically run 2to3 for Python 3 support
extra = {}
if sys.version_info >= (3,):
extra['use_2to3'] = True
setup(name='ml_metrics',
version='0.1.2',
description='Machine Learning Evalu... | Python | 0.999463 |
2aa07b8ac9ba2ec8d2b1ac814b5a1fb3074a2616 | test loading dataset | test_loadDataset.py | test_loadDataset.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: test_loadDataset.py
# Author: Rafał Nowak <rafal.nowak@cs.uni.wroc.pl>
import unittest
class TestLoadDataset(unittest.TestCase):
"""Test load_CIFAR_dataset function from utils"""
def test_certain_images(self):
from myutils import load_CIFAR_dataset... | Python | 0.000002 | |
21d931e35d9e0b32415a408f28e45894f0c3e800 | Add task files for celery async process | django_backend_test/noras_menu/tasks.py | django_backend_test/noras_menu/tasks.py | # -*- encoding: utf-8 -*-
#app_mail/tasks.py
import requests
import simplejson as json
from django_backend_test.celery import app
from django.template.loader import render_to_string
from django.utils.html import strip_tags
from django.core.mail import EmailMultiAlternatives
from .models import Subscribers, MenuItems
... | Python | 0.000001 | |
849a29b22d656c8079b4ccaf922848fb057c80c5 | Add migration to assign appropriate sheets to Transnational CountryRegion | forms/migrations/0023_assign_sheets_to_transnational.py | forms/migrations/0023_assign_sheets_to_transnational.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.exceptions import ObjectDoesNotExist
from django.db import migrations
def assign_transnational_region_to_sheets(apps, schema_editor):
from forms.models import sheet_models
CountryRegion = apps.get_model("forms", "CountryRegion"... | Python | 0 | |
22738b2cae0a6c77127bbf5385b7265247ffb306 | migrate also user profiles | geography/management/commands/migrate_geography_user.py | geography/management/commands/migrate_geography_user.py | from proso_user.models import UserProfile
from django.core.management.base import BaseCommand
from optparse import make_option
from contextlib import closing
from django.db import connection
from clint.textui import progress
from django.db import transaction
class Command(BaseCommand):
option_list = BaseCommand.... | Python | 0 | |
fdcb04a71d8163ed87aaa387c3f1d77143c49089 | Made it so I can compare various runs to make sure they're numerically identical. | megadiff.py | megadiff.py | #!/usr/bin/python
# megadiff.py
# Alex Szatmary
# 2009-08-08
# This is useful in comparing different runs with the same set of
# parameters. The idea is that, while revising the code, megadiff can
# be used when numerically identical results are expected from run to
# run. This is useful when making stylistic changes t... | Python | 0.999819 | |
e7640ad635a77eecbcc5291792b514e42958876e | add magic-gen.py | scripts/magic-gen.py | scripts/magic-gen.py | #!/bin/env python
import os, sys
import struct
# This program parses criu magic.h file and produces
# magic.py with all *_MAGIC constants except RAW and V1.
def main(argv):
if len(argv) != 3:
print("Usage: magic-gen.py path/to/image.h path/to/magic.py")
exit(1)
magic_c_header = argv[1]
magic_py = argv[2]
out... | Python | 0 | |
03c0aa498470037ef2aa6a8233198ff521f8d42f | add the links demo | demos/gtk-demo/demos/links.py | demos/gtk-demo/demos/links.py | #!/usr/bin/env python
# -*- Mode: Python; py-indent-offset: 4 -*-
# vim: tabstop=4 shiftwidth=4 expandtab
#
# Copyright (C) 2010 Red Hat, Inc., John (J5) Palmieri <johnp@redhat.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License a... | Python | 0 | |
dc82990f7a00e5e1e4d2a860630507f9cb3b81d4 | add script for just opening a package source | scripts/pkgsource.py | scripts/pkgsource.py | #!/usr/bin/python
import sys
from conary.lib import util
sys.excepthook = util.genExcepthook()
import logging
import updatebot.log
updatebot.log.addRootLogger()
log = logging.getLogger('test')
from aptmd import Client
from updatebot import config
from updatebot import pkgsource
cfg = config.UpdateBotConfig()
cfg.r... | Python | 0 | |
d6fa3fb8aa67d7581990c9278794516e499a3eb3 | Create RegRipbyDate.py | RegRipbyDate.py | RegRipbyDate.py | '''
Created on May 19, 2014
@author: CaptainCrabnasty
----------------------------------------------------------------------------------
Copyright 2014
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... | Python | 0.000001 | |
eeb9b9877f1aa5bc1f22ac4883fe58a57ee0474a | Add script to test HOTS | scripts/test_hots.py | scripts/test_hots.py | import numpy as np
events = [
(1162704874, -5547),
(1179727586, -5548),
(1209562198, -5547),
(1224960594, -5548),
]
t, x = zip(*events)
t = np.array(t)
x = np.array(x)
t = t - t[0] # redefine zero time
alpha = 1/t[-1]
t = alpha*t # scale time values
A = np.ones((4, 4))
A[:, -2] = np.array(t)
fo... | Python | 0 | |
3862ea1b1cae1c3be80824495d1c6937a18378b9 | test added | tests/pycut_test.py | tests/pycut_test.py | #! /usr/bin/python
# -*- coding: utf-8 -*-
# import funkcí z jiného adresáře
import sys
import os.path
import copy
path_to_script = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(path_to_script, "../src/"))
import unittest
import numpy as np
import pycut
class PycutTest(unittest.TestCa... | Python | 0 | |
ee169acf82eff08daa40c461263712f2af2a1131 | Add a standalone simulation script (really a duplicate of sensitivity.py) | scripts/simulate.py | scripts/simulate.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This script runs stand-alone simulation on an RMG job. This is effectively the
same script as sensitivity.py
"""
import os.path
import argparse
from rmgpy.tools.sensitivity import runSensitivity
#####################################################################... | Python | 0 | |
0f31db66a38073e1549d977909c5f4c5d3eab280 | Create permutation-in-string.py | Python/permutation-in-string.py | Python/permutation-in-string.py | # Time: O(n)
# Space: O(1)
# Given two strings s1 and s2, write a function to return true
# if s2 contains the permutation of s1. In other words,
# one of the first string's permutations is the substring of the second string.
#
# Example 1:
# Input:s1 = "ab" s2 = "eidbaooo"
# Output:True
# Explanation: s2 contains on... | Python | 0.999383 | |
ebb797bb7596adc71b1e906cb7d7f94b56e8f535 | Create subarray-sum-equals-k.py | Python/subarray-sum-equals-k.py | Python/subarray-sum-equals-k.py | # Time: O(n)
# Space: O(n)
# Given an array of integers and an integer k,
# you need to find the total number of continuous subarrays whose sum equals to k.
#
# Example 1:
# Input:nums = [1,1,1], k = 2
# Output: 2
#
# Note:
# The length of the array is in range [1, 20,000].
# The range of numbers in the array is [-10... | Python | 0.9988 | |
c9b75d5195666efaef8b52d9f2f2b70d9b11f25f | Create individual file used for initializing db | server/models/db.py | server/models/db.py | from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy() | Python | 0 | |
c0ba4a18433a05f492cfb78716fc77e14c8b4f56 | test solvable:filelist attribute | bindings/python/tests/filelist.py | bindings/python/tests/filelist.py | #
# Check Filelists
#
import unittest
import sys
sys.path.insert(0, '../../../build/bindings/python')
import satsolver
class TestSequenceFunctions(unittest.TestCase):
def test_filelists(self):
pool = satsolver.Pool()
assert pool
pool.set_arch("x86_64")
repo = pool.add_solv( "os11-biarch.solv... | Python | 0.999908 | |
d1eceaf35b74166f3471dea86b194f67a152cb19 | add Python script to diff two source trees | dev-tools/scripts/diffSources.py | dev-tools/scripts/diffSources.py | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | Python | 0.000049 | |
74f3f70337e9924e4fce030d6a5941ce506bfee9 | Add a runserver script to start the application for development purposes | runserver.py | runserver.py | #!/usr/bin/env python
## These two lines are needed to run on EL6
__requires__ = ['SQLAlchemy >= 0.8', 'jinja2 >= 2.4']
import pkg_resources
import sys
from werkzeug.contrib.profiler import ProfilerMiddleware
from fresque import APP
APP.debug = True
if '--profile' in sys.argv:
APP.config['PROFILE'] = True
A... | Python | 0 | |
93039b9cbea2c8355b8d8651ec0d15cdd73169a6 | Create findmean.py | udacity/findmean.py | udacity/findmean.py | # The mean of a set of numbers is the sum of the numbers divided by the
# number of numbers. Write a procedure, list_mean, which takes a list of numbers
# as its input and return the mean of the numbers in the list.
# Hint: You will need to work out how to make your division into decimal
# division instead of integer ... | Python | 0.000009 | |
7e2a1ac8f297223accdf2ec421d8c9c7a2fe4b3c | add the updated script | source/script.py | source/script.py | import os
import sys
import re
from datetime import datetime
import pytz
def replace_meta(content: str):
# all meta has to be between ---, so lets append that
content = '+++\n' + content
# match and replace the `Title: <something>` to `title = "<something>"`
content = re.sub(r'Title: *(.*)\n', r'title... | Python | 0.000001 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.