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 |
|---|---|---|---|---|---|---|---|
8fda2e1330277e98b62d3286e5c208d320fc07db | Add simple api to redis with flask | server.py | server.py | from flask import Flask
from flask import json
from flask import Response
import redis
app = Flask(__name__)
r = redis.StrictRedis(host='localhost', port=6379, db=0)
@app.route("/")
def hello():
return "Hello ld!"
@app.route('/properties/')
def show_properties():
props = r.smembers('daftpunk:properties')
... | Python | 0 | |
ef108d756ae91925ca0afec280151974eae4a696 | add import script to load existing data in influxdb, optional | scripts/influxdb_import.py | scripts/influxdb_import.py | '''
Import biomaj banks statistics in Influxdb if never done before.....
'''
from influxdb import InfluxDBClient
from biomaj.bank import Bank
from biomaj_core.config import BiomajConfig
import sys
if len(sys.argv) != 1:
print('Usage: influxdb_import.py path_to_global.properties')
sys.exit(1)
BiomajConfig.load... | Python | 0 | |
540f913d6b9402512bc2b507504f77f709c17eca | add exec example | examples/exec.py | examples/exec.py | """
Example uses of exec.
exec is a special form which takes 1, 2, or 3 arguments.
exec(expr, globals, locals)
locals and globals are optional.
expr is a string to be executed as code.
globals is a dictionary from symbol names to values.
locals is a dictionary from symbol names to values.
"""
import inspect
import nu... | Python | 0 | |
c48b6ea55969adff7e0662c551a529161a4d0b94 | add kattis/stockprices | Kattis/stockprices.py | Kattis/stockprices.py | """
Problem: stockprices
Link: https://open.kattis.com/problems/stockprices
Source: NWERC 2010
"""
import queue
import sys
def runTest():
N = int(input())
buyHeap = queue.PriorityQueue() # MinHeap
sellHeap = queue.PriorityQueue() # MinHeap
stockPrice = None
for i in range(N):
... | Python | 0.000001 | |
b01445701c2974c0f69c9a43208111f0b80a167f | Create helloWorld.py | helloWorld.py | helloWorld.py | print "Hello World!"
| Python | 0.999992 | |
9ad2a898298667aa6adfbf0c4e786e431c9a96b1 | test test test | python-ver/test.py | python-ver/test.py | print 'blah blah blah'
| Python | 0.000008 | |
27575c3fd6bdc55748b808a98c0b19e3edfb17af | Create ShakeBoussole.py | sense-hat/ShakeBoussole.py | sense-hat/ShakeBoussole.py | from sense_hat import SenseHat
import time
import sys
sense = SenseHat()
led_loop = [4, 5, 6, 7, 15, 23, 31, 39, 47, 55, 63, 62, 61, 60, 59, 58, 57, 56, 48, 40, 32, 24, 16, 8, 0, 1, 2, 3]
sense = SenseHat()
sense.set_rotation(0)
sense.clear()
prev_x = 0
prev_y = 0
led_degree_ratio = len(led_loop) / 360.0
while Tr... | Python | 0 | |
fb96906301515b268d56bb7a494360f794883223 | include migration for uniq | metaci/release/migrations/0002_auto_20180815_2248.py | metaci/release/migrations/0002_auto_20180815_2248.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-08-15 22:48
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('repository', '0005_repository_release_tag_regex'),
('release', '0001_initial'),
]
... | Python | 0 | |
c32a9c28c6f868e479d7107a87ba44478d2bc6b2 | add sequana_mapping standalone | sequana/scripts/mapping.py | sequana/scripts/mapping.py | # -*- coding: utf-8 -*-
#
# This file is part of Sequana software
#
# Copyright (c) 2016 - Sequana Development Team
#
# File author(s):
# Thomas Cokelaer <thomas.cokelaer@pasteur.fr>
# Dimitri Desvillechabrol <dimitri.desvillechabrol@pasteur.fr>,
# <d.desvillechabrol@gmail.com>
#
# Distributed u... | Python | 0 | |
59eeac5ea05d3da37dc9c7034a892c4a8b38f6fb | parse a given xls and generate XML | elife_poa_xls2xml.py | elife_poa_xls2xml.py | from generatePoaXml import *
import xlrd
"""
read from an xls file
output an xml file
# Gotchas
TODO: currnet XLS does not provide author contrib type TODO: query for author contrib type
TODO: we need a decision on what we do with middle names, for now we are ignoring them
"""
## functions for getting data from ... | Python | 0.998832 | |
c503471f3d7318a2519b486b8be74ec1d1f2e235 | Add an admin interface for xmlrpc tokens | linaro_django_xmlrpc/admin.py | linaro_django_xmlrpc/admin.py | from django.contrib import admin
from linaro_django_xmlrpc.models import AuthToken
class AuthTokenAdmin(admin.ModelAdmin):
list_display = ('user', 'description', 'created_on', 'last_used_on')
admin.site.register(AuthToken, AuthTokenAdmin)
| Python | 0.000002 | |
acdc8dd7006955f89507018d1b7e39092f1d2e07 | set r2dbe header without restarting everything | r2dbe_setheader.py | r2dbe_setheader.py | import adc5g, corr
from time import sleep
from datetime import datetime, time, timedelta
roach2 = corr.katcp_wrapper.FpgaClient('r2dbe-1')
roach2.wait_connected()
sblookup = {0:'LSB', 1:'USB'}
pollookup = {0:'X/L', 1:'Y/R'}
sbmap = {'LSB':0, 'USB':1}
polmap = {'X':0, 'Y':1, 'L':0, 'R':1, 'LCP':0, 'RCP':1}
# IF0:sta... | Python | 0 | |
b70da1d4fef84e7d0a5594f5094944c50ff0bb18 | create a day response tool | log_to_graphs/day_response.py | log_to_graphs/day_response.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
day_response.py
a bar plot for day log response
http://matplotlib.org/examples/api/barchart_demo.html
Copyright (c) 2016年 li3huo.com All rights reserved.
"""
import argparse
import numpy as np
import matplotlib.pyplot as plt
# labels = (u'0点', u'1点', u'2点', u'3点', u... | Python | 0.000001 | |
a0702b8ac74c4976cf747880bdfeb86088a16715 | CREATE new Syft Message structure | packages/syft/src/syft/core/node/common/node_service/generic_payload/syft_message.py | packages/syft/src/syft/core/node/common/node_service/generic_payload/syft_message.py | # stdlib
from typing import Any
from typing import Dict
from typing import Optional
# third party
from nacl.signing import VerifyKey
# relative
from .....common.message import ImmediateSyftMessage, SignedMessage
from .....common.uid import UID
from .....io.address import Address
from ....abstract.node_service_interfa... | Python | 0 | |
af61a720abe964c2295d8f0aa555fed9bb67372a | add 4 | 004.py | 004.py | def pal(value):
return str(value) == str(value)[::-1]
p = 1
for i in xrange(999, 99, -1):
for j in xrange(999, 99, -1):
n = i * j
if n > p and pal(n):
p = n
print p | Python | 0.999998 | |
c15c10567a933b605e598129e02ac89bf03d3f02 | add move operation module | lib/filewatcher/operator/mover.py | lib/filewatcher/operator/mover.py | # -*- coding: utf-8 -*-
""" 檔案操作作業模組 """
import os
import shutil
from filewatcher import componentprop
_cached_module_prop_instance = componentprop.OperatorProp('mover', 'move_to', schedule_priority=2, run_priority=2)
def get_module_prop():
""" 取得操作器各項特性/屬性
參數:
(無)
回傳值:
傳回 componentprop.OperatorProp 物件
""... | Python | 0.000001 | |
ee1e049a4cbe47ce106824612a69d738562eceb3 | add simple test for testing that view change messages are checked on the receiver side | plenum/test/view_change/test_instance_change_msg_checking.py | plenum/test/view_change/test_instance_change_msg_checking.py | import pytest
import types
from plenum.common.types import InstanceChange
def test_instance_change_msg_type_checking(nodeSet, looper, up):
nodeA = nodeSet.Alpha
nodeB = nodeSet.Beta
ridBetta = nodeA.nodestack.getRemote(nodeB.name).uid
badViewNo = "BAD"
nodeA.send(InstanceChange(badViewNo), rid... | Python | 0 | |
a85dc832edf2793fd22489f7801fcdd7e74ec79c | add figure composite | fig_composite.py | fig_composite.py | #!/usr/bin/env python2
#-*-coding:utf-8 -*-
import os
import sys
import re
import PIL
from PIL import Image
#fig_in_path = os.path.dirname(os.path.realpath(sys.argv[0]))
fig_in_path = os.path.relpath(os.path.dirname(os.path.realpath(sys.argv[0])))
fig_out_path = fig_in_path + "/fig_trans/"
fig_resize_out_path = fig_... | Python | 0.000001 | |
21b7b4f2be33eb30545292a1c46f4072d3795e97 | Add link.py | misc/link.py | misc/link.py | #!/usr/bin/env python
from signal import signal, SIGPIPE, SIG_DFL
signal(SIGPIPE, SIG_DFL)
import argparse
import csv
import sys
import itertools
from collections import defaultdict, Counter
from math import log
from sklearn.feature_extraction import DictVectorizer
from sklearn.metrics.pairwise import cosine_similari... | Python | 0.000001 | |
e1b47df9fadb888dafc32abc8018b15477d74feb | Add python test unit. | fpsgame/tests.py | fpsgame/tests.py | from ctypes import *
import sys
import os
import xml.etree.ElementTree as ET
binaries = '../../../binaries'
# Work out the platform-dependent library filename
dll_filename = {
'posix': './libCollada_dbg.so',
'nt': 'Collada_dbg.dll',
}[os.name] | Python | 0 | |
eebbc6743f4aa5c29b7b915580cf9ba0362d889a | Add tests for error cases for the array API elementwise functions | numpy/_array_api/tests/test_elementwise_functions.py | numpy/_array_api/tests/test_elementwise_functions.py | from inspect import getfullargspec
from numpy.testing import assert_raises
from .. import asarray, _elementwise_functions
from .._elementwise_functions import bitwise_left_shift, bitwise_right_shift
from .._dtypes import (_all_dtypes, _boolean_dtypes, _floating_dtypes,
_integer_dtypes, _integer... | Python | 0 | |
cfe664f379e229c7145abeb01fd1bc28e84266ab | Add initial boto3store code | simplekv/net/boto3store.py | simplekv/net/boto3store.py | #!/usr/bin/env python
# coding=utf8
from .._compat import imap
from .. import KeyValueStore, UrlMixin, CopyMixin
from contextlib import contextmanager
from shutil import copyfileobj
import io
@contextmanager
def map_boto3_exceptions(key=None, exc_pass=()):
"""Map boto-specific exceptions to the simplekv-API."""
... | Python | 0 | |
412d27b31dc5644c84ac90179fe74669ce8a406c | change description & goal from varchar(100) to text | talkoohakemisto/migrations/versions/221e6ee3f6c9_adjust_goal_and_description_size.py | talkoohakemisto/migrations/versions/221e6ee3f6c9_adjust_goal_and_description_size.py | """adjust goal and description size
Revision ID: 221e6ee3f6c9
Revises: 27f12bb68b12
Create Date: 2014-04-12 17:04:16.750942
"""
# revision identifiers, used by Alembic.
revision = '221e6ee3f6c9'
down_revision = '27f12bb68b12'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.execute(
'... | Python | 0 | |
8c1f1c0728b261526b19c46dbd459bbc0f4e97a8 | add leetcode Maximum Depth of Binary Tree | leetcode/MaximumDepthOfBinaryTree/solution.py | leetcode/MaximumDepthOfBinaryTree/solution.py | # -*- coding:utf-8 -*-
# Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param root, a tree node
# @return an integer
def maxDepth(self, root):
if not root:
... | Python | 0.00001 | |
558c68060903608abe0bbe15303f192eacf529eb | Add way to call converters/harvesters in 0.2.0 | proto_main.py | proto_main.py | from importlib import import_module
def call_harvester(source_name, **kwargs):
harvester = import_module("mdf_indexers.harvesters." + source_name + "_harvester")
harvester.harvest(**kwargs)
def call_converter(sources, input_path=None, metadata=None, verbose=False):
if type(sources) is not list:
so... | Python | 0 | |
ebe0b558d80ca7b7e5e7be50cc7c053020dca9fe | create list app skeleton | app.py | app.py | #!/usr/bin/env python
from flask import Flask
app = Flask(__name__)
# define a list item class
class ListItem(Model):
@app.route('/add', methods=['POST'])
def add_item():
''' add items to the list '''
return "stub"
@app.route('/view')
def view_items():
''' view items in the list '''
return "stub"
... | Python | 0.000002 | |
f052db903a8b0dc07cdc3694267d8bcc64ae1849 | add bot | bot.py | bot.py | #!/usr/bin/env python3
# coding: utf-8
from wxpy import *
from config import *
import re
from wxpy.utils import start_new_thread
import time
import os
'''
使用 cache 来缓存登陆信息,同时使用控制台登陆
'''
bot = Bot('bot.pkl', console_qr=True)
bot.messages.max_history = 0
'''
开启 PUID 用于后续的控制
'''
bot.enable_puid('wxpy_puid.pkl')
'''
邀... | Python | 0.000002 | |
a23eb3f9a921676a3b91ff48b073f9cf4d15cfaa | Create bot.py | bot.py | bot.py | from twython import Twython, TwythonError
from PIL import Image
import os, random, statistics, time
APP_KEY = ''
APP_SECRET = ''
OAUTH_TOKEN = ''
OAUTH_TOKEN_SECRET = ''
brightness_threshold = 35
seconds_between_tweets = 600
def tweet():
twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET)
acce... | Python | 0.000001 | |
3bb4f078f2a03b334c2b44378be2b01e54fb7b37 | Add command load beginner categories | datasets/management/commands/load_beginner_categories.py | datasets/management/commands/load_beginner_categories.py | from django.core.management.base import BaseCommand
import json
from datasets.models import Dataset, TaxonomyNode
class Command(BaseCommand):
help = 'Load field easy categories from json taxonomy file. ' \
'Use it as python manage.py load_beginner_categories.py ' \
'DATASET_ID PATH/TO/TAOXNO... | Python | 0.000001 | |
a06995a686c0509f50a481e7d7d41bb35ffe8f19 | add simple improved Sieve Of Eratosthenes Algorithm (#1412) | maths/prime_sieve_eratosthenes.py | maths/prime_sieve_eratosthenes.py | '''
Sieve of Eratosthenes
Input : n =10
Output : 2 3 5 7
Input : n = 20
Output: 2 3 5 7 11 13 17 19
you can read in detail about this at
https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
'''
def prime_sieve_eratosthenes(num):
"""
print the prime numbers upto n
>>> prime_sieve_eratosthenes(10)
... | Python | 0 | |
f50c1b067375ea8835c814b55484c416fbba6bf5 | Add test_utils.py; for running containers & http server for test fixture data | test_utils.py | test_utils.py | import _thread
import docker
import logging
import os
import socket
from http.server import HTTPServer, SimpleHTTPRequestHandler
class TestFixtureServer(object):
def __init__(self):
self.port = 9999
self.ip = self.get_python_server_ip()
def get_python_server_ip(self):
# https://stac... | Python | 0 | |
e7ab5b39042f3a224a150257dd1aa845e7bb1adc | Add back a missing import | common/djangoapps/xblock_django/models.py | common/djangoapps/xblock_django/models.py | """
Models.
"""
from django.db import models
from django.db.models import TextField
from django.utils.translation import ugettext_lazy as _
from config_models.models import ConfigurationModel
class XBlockDisableConfig(ConfigurationModel):
"""
Configuration for disabling and deprecating XBlocks.
"""
... | """
Models.
"""
from django.db import models
from django.utils.translation import ugettext_lazy as _
from config_models.models import ConfigurationModel
class XBlockDisableConfig(ConfigurationModel):
"""
Configuration for disabling and deprecating XBlocks.
"""
class Meta(ConfigurationModel.Meta):
... | Python | 0.000081 |
40c0d855ba50f39433d6e06f31f4a993a1c98160 | add python | pythontips.py | pythontips.py | # basic
# This is a comment!
# Storing a string to the variable s
s = "Hello world, world"
# printing the type. It shows 'str' which means it is a string type
print type(s)
# printing the number of characters in the string.
print len(s)
# Python gave me an error below! I guess we can't change individual parts of a str... | Python | 0.998891 | |
f44e4fe8fe7f66258241c77680b2bbf58a6f7d0a | Add basic tests for dics_epochs | mne/beamformer/tests/test_dics.py | mne/beamformer/tests/test_dics.py | import os.path as op
from nose.tools import assert_true, assert_raises
import numpy as np
import mne
from mne.datasets import sample
from mne.beamformer import dics_epochs
from mne.time_frequency import compute_csd
data_path = sample.data_path()
fname_data = op.join(data_path, 'MEG', 'sample', 'sample_audvis-ave.fi... | Python | 0 | |
b92625f1fa381f079d81e67b34d9f03e9c8a2282 | Update help for nbgrader autograde | nbgrader/apps/autogradeapp.py | nbgrader/apps/autogradeapp.py | from textwrap import dedent
from IPython.config.loader import Config
from IPython.utils.traitlets import Unicode, Bool, Dict
from IPython.nbconvert.preprocessors import ClearOutputPreprocessor
from nbgrader.apps.baseapp import (
BaseNbConvertApp, nbconvert_aliases, nbconvert_flags)
from nbgrader.preprocessors imp... | from textwrap import dedent
from IPython.config.loader import Config
from IPython.utils.traitlets import Unicode, Bool, Dict
from IPython.nbconvert.preprocessors import ClearOutputPreprocessor
from nbgrader.apps.baseapp import (
BaseNbConvertApp, nbconvert_aliases, nbconvert_flags)
from nbgrader.preprocessors imp... | Python | 0 |
ca5d276a512fccfe9ed0c7a89a48a13b61d67a55 | Add Display.py | Display.py | Display.py | __author__ = 'Tara Crittenden'
# Displays the state of the game in a simple text format.
import Observer
import Message
class Display(Observer.Observer):
#Determine which method to display
def notify(self, msg):
if msg.msgtype == 1:
#start of a tournament
display_start_tourna... | Python | 0.000001 | |
e6e92fb3afff0403091c221328f9023e0e391b0b | Add eventlisten script to watch events on the master and minion | tests/eventlisten.py | tests/eventlisten.py | '''
Use this script to dump the event data out to the terminal. It needs to know
what the sock_dir is.
This script is a generic tool to test event output
'''
# Import Python libs
import optparse
import pprint
import os
import time
import tempfile
# Import Salt libs
import salt.utils.event
def parse():
'''
P... | Python | 0 | |
703d97150de1c74b7c1a62b59c1ff7081dec8256 | Add an example of resolving a known service by service name | examples/resolver.py | examples/resolver.py | #!/usr/bin/env python3
""" Example of resolving a service with a known name """
import logging
import sys
from zeroconf import Zeroconf
TYPE = '_test._tcp.local.'
NAME = 'My Service Name'
if __name__ == '__main__':
logging.basicConfig(level=logging.DEBUG)
if len(sys.argv) > 1:
assert sys.argv[1:] =... | Python | 0.998661 | |
ebe1f99185c9bc8881346bed4088eb74ca076431 | add script for plotting a tracking performance heat map | Utils/py/examples_cppyy/mkbl_plot_performance_heat_map.py | Utils/py/examples_cppyy/mkbl_plot_performance_heat_map.py | import math
import os
import sys
import cppyy
from cppyy import addressof, bind_object
import numpy as np
import matplotlib.pyplot as plt
import select
def get_naoth_dir():
script_path = os.path.abspath(__file__)
return os.path.abspath(os.path.join(script_path, "../../../../"))
def get_toolchain_dir():
... | Python | 0 | |
039a07bde5975cb6ce40edc43bbd3d931ac5cc92 | Test borda ranking and spearman. | exp/influence2/test/RankAggregatorTest.py | exp/influence2/test/RankAggregatorTest.py | import numpy
import unittest
import logging
from exp.influence2.RankAggregator import RankAggregator
import scipy.stats.mstats
import numpy.testing as nptst
class RankAggregatorTest(unittest.TestCase):
def setUp(self):
numpy.random.seed(22)
def testSpearmanFootrule(self):
lis... | Python | 0 | |
afec3bf59fd454d61d5bc0024516610acfcb5704 | Add 1D data viewer. | examples/viewer1D.py | examples/viewer1D.py | from __future__ import print_function
import numpy as np
from viewer import Viewer
from enthought.traits.api import Array
from enthought.chaco.api import Plot, ArrayPlotData, HPlotContainer, gray
import lulu
class Viewer1D(Viewer):
image = Array
result = Array
def _reconstruction_default(self):
... | Python | 0 | |
d9ff51c74c4b41128bc8e2fe61811dba53e7da17 | Create test_client.py | tests/test_client.py | tests/test_client.py | import unittest
from app import create_app, db
from app.models import User, Role
class FlaskClientTestCase(unittest.TestCase):
def setUp(self):
self.app = create_app('testing')
self.app_context = self.app.app_context()
self.app_context.push()
db.create_all()
Role.insert_role... | Python | 0.000003 | |
d37d831e54fbaebab427c9a5b88cb7eb358b31af | transform data to website via Post & Get | WebScraping/4.py | WebScraping/4.py | #!/usr/bin/python
# encoding:utf-8
import sys
import urllib, urllib2
import re
dic = {'hostname': 'n2', 'ip': '2.2.2.2'}
# url = 'http://127.0.0.1:8000/db/' + '?' + urllib.urlencode(dic)
url = 'http://127.0.0.1:8000/db/'
response = urllib2.urlopen(url, urllib.urlencode(dict))
print response.read()
| Python | 0 | |
35a9576dce86c9c3d32c6cc32effb7a8f6c2b706 | Test DjangoAMQPConnection if Django is installed. Closes #10. | tests/test_django.py | tests/test_django.py | import os
import sys
import unittest
import pickle
import time
sys.path.insert(0, os.pardir)
sys.path.append(os.getcwd())
from tests.utils import AMQP_HOST, AMQP_PORT, AMQP_VHOST, \
AMQP_USER, AMQP_PASSWORD
from carrot.connection import DjangoAMQPConnection, AMQPConnection
from UserDict import ... | Python | 0 | |
0390209498c2a604efabe13595e3f69f7dcbd577 | Add script for path init. | tools/init.py | tools/init.py | #!/usr/bin/env python
"""Setup paths for TPN"""
import os.path as osp
import sys
def add_path(path):
if path not in sys.path:
sys.path.insert(0, path)
this_dir = osp.dirname(__file__)
ext_dir = osp.join(this_dir, '..', 'external')
# Add py-faster-rcnn paths to PYTHONPATH
frcn_dir = osp.join(this_dir, ... | Python | 0 | |
bcfd9808377878f440cc030178b33e76eb4f031c | Add presubmit check to catch use of PRODUCT_NAME in resources. | chrome/app/PRESUBMIT.py | chrome/app/PRESUBMIT.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Presubmit script for changes affecting chrome/app/
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the... | Python | 0.00004 | |
f2807e7505598abdc0f11c8d593655c3dc61c323 | add legislative.apps | opencivicdata/legislative/apps.py | opencivicdata/legislative/apps.py | from django.apps import AppConfig
import os
class BaseConfig(AppConfig):
name = 'opencivicdata.legislative'
verbose_name = 'Open Civic Data - Legislative'
path = os.path.dirname(__file__)
| Python | 0.000025 | |
cd7364467de45d63e89eab4e745e29dff9906f69 | Add crawler for 'dogsofckennel' | comics/comics/dogsofckennel.py | comics/comics/dogsofckennel.py | from comics.aggregator.crawler import CreatorsCrawlerBase
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = 'Dogs of C-Kennel'
language = 'en'
url = 'https://www.creators.com/read/dogs-of-c-kennel'
rights = 'Mason Mastroianni, Mick Mastroianni, Johnny Hart'
clas... | Python | 0.998466 | |
0c1ae2fb40e5af5cf732e7ec8e10d2e145be2eb2 | add run.py | run.py | run.py | """Simple Migrator."""
__author__ = 'bkzhn'
if __name__ == '__main__':
print('== Simple Migrator ==')
| Python | 0.000003 | |
0d6a31ade487bea9f0b75b1c3e295176fb3a7555 | Add savecpython script | tools/savecpython.py | tools/savecpython.py | # -*- coding: utf-8 -*-
import urllib, urllib2
from datetime import datetime
SPEEDURL = 'http://127.0.0.1:8000/'#'http://speed.pypy.org/'
HOST = "bigdog"
def save(project, revision, results, options, branch, executable, int_options, testing=False):
testparams = []
#Parse data
data = {}
current_date = ... | Python | 0.000001 | |
91773cb6a09f710002e5be03ab9ec0c19b2d6ea3 | Add script to extract rows from terms. | src/Scripts/show-term-convert.py | src/Scripts/show-term-convert.py | # Convert from show term to list of rows associated with each term.
import re
term_regex = re.compile("Term\(\"(\S+)\"\)")
rowid_regex = re.compile("\s+RowId\((\S+),\s+(\S+)\)")
this_term = ""
with open("/tmp/show.results.txt") as f:
for line in f:
rowid_match = rowid_regex.match(line)
if rowid_ma... | Python | 0 | |
710f6ed188b6139f6469d61775da4fb752bac754 | Create __init__.py | mopidy_ampache/__init__.py | mopidy_ampache/__init__.py | from __future__ import unicode_literals
import os
from mopidy import ext, config
__version__ = '1.0.0'
class AmpacheExtension(ext.Extension):
dist_name = 'Mopidy-Ampache'
ext_name = 'ampache'
version = __version__
def get_default_config(self):
conf_file = os.path.join(os.path.dirname(__fi... | Python | 0.000429 | |
2cd081a6a7c13b40b5db8f667d03e93353630830 | Create leetcode-78.py | python_practice/leetCode/leetcode-78.py | python_practice/leetCode/leetcode-78.py | class Solution:
def subsets(self, nums: List[int]) -> List[List[int]]:
if nums == []:
return [[]]
sub = self.subsets(nums[1:])
newSub = []
for i in sub:
newI = i + [nums[0]]
newSub.append(newI)
sub.extend(newSub)
return sub... | Python | 0.000003 | |
56f8dd435981a28bcb026da0edb395aabd515c29 | Add a frist test for create_random_data | opal/tests/test_command_create_random_data.py | opal/tests/test_command_create_random_data.py | """
Unittests for opal.management.commands.create_random_data
"""
from mock import patch, MagicMock
from opal.core.test import OpalTestCase
from opal.management.commands import create_random_data as crd
class StringGeneratorTestCase(OpalTestCase):
def test_string_generator(self):
mock_field = MagicMock(n... | Python | 0.000006 | |
826c3e3b2787e25d040b3ddf7c4bdabde3da4158 | Add tasks.py the new and improved celery_tasks.py | scrapi/tasks.py | scrapi/tasks.py | import os
import logging
import importlib
from datetime import datetime
from celery import Celery
import settings
app = Celery()
app.config_from_object(settings)
logger = logging.getLogger(__name__)
def import_consumer(consumer_name):
return importlib.import_module('scrapi.consumers.{}'.format(consumer_name)... | Python | 0.004637 | |
3f1663f7cf32b590affb7a306bcc2711b17af296 | Add a monitor example. | example/user_stream_monitor.py | example/user_stream_monitor.py | #!/usr/bin/env python
#
# Copyright (c) 2012 Ralph Meijer <ralphm@ik.nu>
# See LICENSE.txt for details
"""
Print Tweets on a user's timeline in real time.
This connects to the Twitter User Stream API endpoint with the given OAuth
credentials and prints out all Tweets of the associated user and of the
accounts the us... | Python | 0.00024 | |
ac3cd54b93aa6d5cddaac89016d09b9e6747a301 | allow bazel 0.7.x (#1467) | check_bazel_version.bzl | check_bazel_version.bzl | def _parse_bazel_version(bazel_version):
# Remove commit from version.
version = bazel_version.split(" ", 1)[0]
# Split into (release, date) parts and only return the release
# as a tuple of integers.
parts = version.split("-", 1)
# Turn "release" into a tuple of strings
version_tuple = ()... | def _parse_bazel_version(bazel_version):
# Remove commit from version.
version = bazel_version.split(" ", 1)[0]
# Split into (release, date) parts and only return the release
# as a tuple of integers.
parts = version.split("-", 1)
# Turn "release" into a tuple of strings
version_tuple = ()... | Python | 0 |
be3ec5bcf32b86e1daec94f4605cd7d120953a97 | add object finalizer class | usb/_objfinalizer.py | usb/_objfinalizer.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2014 André Erdmann
#
# The following terms apply to all files associated
# with the software unless explicitly disclaimed in individual files.
#
# The authors hereby grant permission to use, copy, modify, distribute,
# and license this software and its documentation for any pur... | Python | 0.002879 | |
b40d064ac5b4e01f11cdb1f6b7ce7f1a0a968be5 | Create set_memory_example.py | examples/set_memory_example.py | examples/set_memory_example.py | from chatbot import Chat, register_call
import os
import warnings
warnings.filterwarnings("ignore")
@register_call("increment_count")
def memory_get_set_example(session, query):
name=query.strip().lower()
# Get memory
old_count = session.memory.get(name, '0')
new_count = int(old_count) + 1
# Set m... | Python | 0.000189 | |
12b7d2b2296b934675f2cca0f35d059a67f58e7f | Create ComputeDailyWage.py | ComputeDailyWage.py | ComputeDailyWage.py | ################################ Compute daily wage
def computepay ( w , m , e , g ):
total = float(wage) - (float(mileage)/float(gas)) - float(expenses)
return total
try:
input = raw_input('Enter Wages: ')
wage = float(input)
input = raw_input('Enter Miles: ')
mileage = float(input)
input... | Python | 0.000011 | |
2429c0bdf5c2db5c2b40dc43d0a4c277e20d72fa | add 0001 | Jaccorot/0001/0001.py | Jaccorot/0001/0001.py | #!/usr/local/bin/python
#coding=utf-8
#第 0001 题:做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激活码(或者优惠券),
#使用 Python 如何生成 200 个激活码(或者优惠券)?
import uuid
def create_code(num, length):
#生成”num“个激活码,每个激活码含有”length“位
result = []
while True:
uuid_id = uuid.uuid1()
temp = str(uuid_id).replace('-', '')[:le... | Python | 0.999999 | |
6913674358d226953c1090ab7c8f5674dac1816c | add 0007 | Jaccorot/0007/0007.py | Jaccorot/0007/0007.py | #!/usr/bin/python
#coding:utf-8
"""
第 0007 题:有个目录,里面是你自己写过的程序,统计一下你写过多少行代码。包括空行和注释,但是要分别列出来。
"""
import os
def walk_dir(path):
file_path = []
for root, dirs, files in os.walk(path):
for f in files:
if f.lower().endswith('py'):
file_path.append(os.path.join(root, f))
re... | Python | 0.99999 | |
f8093f59b77e481231aeca49ef057a4602d21b2e | add tests for appconfig | src/archivematicaCommon/tests/test_appconfig.py | src/archivematicaCommon/tests/test_appconfig.py | from __future__ import absolute_import
import os
import StringIO
from django.core.exceptions import ImproperlyConfigured
import pytest
from appconfig import Config
CONFIG_MAPPING = {
'search_enabled': [
{'section': 'Dashboard', 'option': 'disable_search_indexing', 'type': 'iboolean'},
{'section'... | Python | 0 | |
06dd6ed476549d832159b1dbfe4d415579b4d067 | add wrapper | scripts/fontify.py | scripts/fontify.py | #!/usr/bin/env python2
import argparse
import tempfile
import shutil
import os
import crop_image
def check_input(image):
if not os.path.isfile(image):
raise FileNotFoundError
_, ext = os.path.splitext(image)
if ext.lower() not in [".jpg", ".png"]:
raise ValueError("Unrecognized image exten... | Python | 0.000002 | |
5509839e0af89467eb14ee178807e2898202101b | Add port-security extension API test cases | neutron/tests/api/test_extension_driver_port_security.py | neutron/tests/api/test_extension_driver_port_security.py | # Copyright 2015 OpenStack Foundation
# 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 requ... | Python | 0.000002 | |
6ca1d9f4a3b8a518661409166a9918a20eb61655 | fix wansu cdn url | src/streamlink/plugins/app17.py | src/streamlink/plugins/app17.py | import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import http, useragents
from streamlink.stream import HLSStream, RTMPStream, HTTPStream
API_URL = "https://api-dsa.17app.co/api/v1/liveStreams/getLiveStreamInfo"
_url_re = re.compile(r"https://17.live/live/(?P<channel>[^/&?]+)")
_status_re = r... | import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import http, useragents
from streamlink.stream import HLSStream, RTMPStream, HTTPStream
API_URL = "https://api-dsa.17app.co/api/v1/liveStreams/getLiveStreamInfo"
_url_re = re.compile(r"https://17.live/live/(?P<channel>[^/&?]+)")
_status_re = r... | Python | 0.000002 |
7f51b7a1b6a319595df5c360bae0264386e590e9 | add support for tucao.cc | src/you_get/extractors/tucao.py | src/you_get/extractors/tucao.py | #!/usr/bin/env python
__all__ = ['tucao_download']
from ..common import *
# import re
import random
import time
from xml.dom import minidom
#1. <li>type=tudou&vid=199687639</li>
#2. <li>type=tudou&vid=199506910|</li>
#3. <li>type=video&file=http://xiaoshen140731.qiniudn.com/lovestage04.flv|</li>
#4 may ? <li>type=vid... | Python | 0 | |
617e6741a06fd63f22ec9b28090e39c120061a84 | Add the `vulnerability_tickets.py` sample security plugin to deny access to tickets with "security" or "vulnerability" in the `keywords` or `summary` fields. | sample-plugins/vulnerability_tickets.py | sample-plugins/vulnerability_tickets.py | from trac.core import *
from trac.config import ListOption
from trac.perm import IPermissionPolicy, IPermissionRequestor, PermissionSystem
from trac.ticket.model import Ticket
class SecurityTicketsPolicy(Component):
"""
Require the VULNERABILITY_VIEW permission to view any ticket with the words
"security"... | Python | 0.000038 | |
b8ab0280ffd76419b7418c39a9f0b9d8131a9d39 | Add merge migration | corehq/apps/users/migrations/0022_merge_20200814_2045.py | corehq/apps/users/migrations/0022_merge_20200814_2045.py | # Generated by Django 2.2.13 on 2020-08-14 20:45
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0021_add_view_apps_permission'),
('users', '0021_invitation_email_status'),
]
operations = [
]
| Python | 0.000001 | |
cff300eecbbf6189fe7fc9fe4fafd718b414c80e | add command to create root | src/python/expedient/clearinghouse/commands/management/commands/create_default_root.py | src/python/expedient/clearinghouse/commands/management/commands/create_default_root.py | '''Command to create default administrators.
Created on Aug 26, 2010
@author: jnaous
'''
from django.core.management.base import NoArgsCommand
from django.conf import settings
from django.contrib.auth.models import User
class Command(NoArgsCommand):
help = "Creates the default root user specified by " \
... | Python | 0.000001 | |
760c0fb41ae9e6fd5307563b1cda6eaa8e6336af | add try order | lab/try_order.py | lab/try_order.py | # -*- coding: utf-8 -*-
# pylint: disable=broad-except
"""try except return finally 执行顺序
无论except是否执行,finally都会执行,且最后执行
无论try except是否有return(有return时,程序暂存返回值),finally都会执行, 且最后执行
except, finally中return,则会覆盖之前暂存的返回值, so,不要在finally中写return
"""
import logging
__authors__ = ['"sue.chain" <sue.chain@gmail.com>']
loggi... | Python | 0 | |
787f956539eb5e41467e04b8239ae571fad60da7 | Implement code to return how many characters to delete to make 2 strings into an anagram | all-domains/tutorials/cracking-the-coding-interview/strings-making-anagrams/solution.py | all-domains/tutorials/cracking-the-coding-interview/strings-making-anagrams/solution.py | # https://www.hackerrank.com/challenges/ctci-making-anagrams
# Python 3
def delete_char_at(s, i):
return s[:i] + s[i+1:]
def number_needed(a, b):
counter = 0
loop_over, reference = (a, b) if len(a) > len(b) else (b, a)
for character in loop_over:
index = reference.find(character)
if i... | Python | 0.998758 | |
fe088ec159b4b395bcf463cf7ff31db7f7409fcf | Move czml utils computation to core | src/poliastro/core/czml_utils.py | src/poliastro/core/czml_utils.py | import numpy as np
from numba import njit as jit
@jit
def intersection_ellipsoid_line(x, y, z, u1, u2, u3, a, b, c):
"""Intersection of an ellipsoid defined by its axes a, b, c with the
line p + λu.
Parameters
----------
x, y, z: float
A point of the line
u1, u2, u3: float
The... | Python | 0.000006 | |
b906082034822a825ec2963864b32d6619cf938a | Add testing functions for join and relabel | skimage/segmentation/tests/test_join.py | skimage/segmentation/tests/test_join.py | import numpy as np
from numpy.testing import assert_array_equal, assert_raises
from skimage.segmentation import join_segmentations, relabel_from_one
def test_join_segmentations():
s1 = np.array([[0, 0, 1, 1],
[0, 2, 1, 1],
[2, 2, 2, 1]])
s2 = np.array([[0, 1, 1, 0],
... | Python | 0 | |
6b38f963cf555576157f063e9c026a94814f93a2 | Fix all target for managed install. | build/android/tests/multiple_proguards/multiple_proguards.gyp | build/android/tests/multiple_proguards/multiple_proguards.gyp | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
'package_name': 'multiple_proguard',
},
'targets': [
{
'target_name': 'multiple_proguards_tes... | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
'package_name': 'multiple_proguard',
},
'targets': [
{
'target_name': 'multiple_proguards_tes... | Python | 0.000209 |
c8bcdf4d586277df940b8fd9f977cd72305b5e85 | add StatusReportView | skrill/views.py | skrill/views.py | from django import http
from django.views.generic.base import View
from skrill.models import PaymentRequest, StatusReport
class StatusReportView(View):
def post(self, request, *args, **kwargs):
payment_request = PaymentRequest.objects.get(pk=request.POST['transaction_id'])
report = StatusReport()... | Python | 0 | |
12c3ded4ed05e34a0a44163abd5ae08ab0289c4c | Create Score-Calculator.py | Score-Calculator.py | Score-Calculator.py | midterm = float(input())
if midterm >= 0:
if midterm <= 60:
final = float(input())
if final >= 0:
if final <= 60:
total = midterm + final
avg = total/2
print('Total: ' + str(total))
print('Average: ' + str(avg))
| Python | 0 | |
3b0fdecb60b9c5e8a104564d5703c85c97c10f27 | Introduce an ExtruderStack class | cura/Settings/ExtruderStack.py | cura/Settings/ExtruderStack.py | # Copyright (c) 2017 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from UM.MimeTypeDatabase import MimeType, MimeTypeDatabase
from UM.Settings.ContainerStack import ContainerStack
from UM.Settings.ContainerRegistry import ContainerRegistry
class ExtruderStack(ContainerStack):
def __in... | Python | 0 | |
1e996e3cf1c8e067bbbb8bf23f93b34202b4cd44 | add 401 | leetcode/1.Array_String/401.BinaryWatch.py | leetcode/1.Array_String/401.BinaryWatch.py | # 401. Binary Watch
# A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59).
# Each LED represents a zero or one, with the least significant bit on the right.
# off off on on
# off on on off off ... | Python | 0.001659 | |
5712da6095594360be9010b0fe6b85606ec1e2d0 | Add regression test for #891 | spacy/tests/regression/test_issue891.py | spacy/tests/regression/test_issue891.py | # coding: utf8
from __future__ import unicode_literals
import pytest
@pytest.mark.xfail
@pytest.mark.parametrize('text', ["want/need"])
def test_issue891(en_tokenizer, text):
"""Test that / infixes are split correctly."""
tokens = en_tokenizer(text)
assert len(tokens) == 3
assert tokens[1].text == "/"... | Python | 0.000001 | |
d11ac35410252c108dcd7e8d2ae03df2abc4697b | add statsquid cli util | statsquid/statsquid.py | statsquid/statsquid.py | #!/usr/bin/env python
import os,sys,logging,signal
from argparse import ArgumentParser
#from . import __version__
from listener import StatListener
from collector import StatCollector
__version__ = 'alpha'
log = logging.getLogger('statsquid')
class StatSquid(object):
"""
StatSquid
params:
- role(st... | Python | 0 | |
657834dcc96b8c57c68ef47a3b339c8c81b94320 | Create initial_window_ui_new.py | UI/qt_interfaces/initial_window_ui_new.py | UI/qt_interfaces/initial_window_ui_new.py | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'first_run_new.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8... | Python | 0.000004 | |
59160eeb24f6311dafce2db34a40f8ba879fd516 | Add test showing taint for attr store | python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/test_attr.py | python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/test_attr.py | # Add taintlib to PATH so it can be imported during runtime without any hassle
import sys; import os; sys.path.append(os.path.dirname(os.path.dirname((__file__))))
from taintlib import *
# This has no runtime impact, but allows autocomplete to work
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ..taintlib... | Python | 0.000111 | |
4dbeb72f8c07bcb5e91c71792651b448142beff9 | add script for wrapping shell commands and sending the result to datadog as events | src/dogapi/wrap.py | src/dogapi/wrap.py | import sys
import subprocess
import time
from StringIO import StringIO
from optparse import OptionParser
from dogapi import dog_http_api as dog
from dogapi.common import get_ec2_instance_id
class Timeout(Exception): pass
def poll_proc(proc, sleep_interval, timeout):
start_time = time.time()
returncode = None... | Python | 0 | |
1f92af62d1a58e496c2ce4251676fca3b571e8f1 | Add missing specification model tests | django_project/localities/tests/test_model_Specification.py | django_project/localities/tests/test_model_Specification.py | # -*- coding: utf-8 -*-
from django.test import TestCase
from django.db import IntegrityError
from .model_factories import (
SpecificationF,
DomainF,
AttributeF
)
class TestModelSpecification(TestCase):
def test_model_repr(self):
dom = DomainF.create(id=1, name='A domain')
attr = Att... | Python | 0.000001 | |
15298dd59aabd817b3b160910b423d3448c9e189 | Test for overriding __import__. | tests/import/import_override.py | tests/import/import_override.py | import import1b
assert import1b.var == 123
import builtins
org_import = builtins.__import__
def my_import(*args):
# MicroPython currently doesn't pass globals/locals, so don't print them
# CPython3.5 and lower for "from pkg.mod import foo" appear to call
# __import__ twice - once with 5 args, and once ... | Python | 0.001211 | |
02bf100a05ed6267ab3fb618c52150fc2d4884f2 | Add some basic tests around contact parsing | tests/test_contact_parsing.py | tests/test_contact_parsing.py | import aiosip
def test_simple_header():
header = aiosip.Contact.from_header('<sip:pytest@127.0.0.1:7000>')
assert not header['name']
assert dict(header['params']) == {}
assert dict(header['uri']) == {'scheme': 'sip',
'user': 'pytest',
... | Python | 0 | |
f5720f2609bcb19ffca308a3589c8e6171d1f8b7 | Add test cases for removepunctuation | tests/test_removepunctuation.py | tests/test_removepunctuation.py | #
import pytest
from sdsc.textutil import removepunctuation
@pytest.mark.parametrize("end", [True, False])
@pytest.mark.parametrize("start", [True, False])
@pytest.mark.parametrize("data", [
# 0 - no quotes
'word',
# 1 - single quote at the start
'¸word',
# 2 - single quote at the end
'word... | Python | 0.000018 | |
e8309903b54598358efc20092760fe933cbd8ce7 | check if a string is a permutation of anohter string | CrackingCodingInterview/1.3_string_permutation.py | CrackingCodingInterview/1.3_string_permutation.py | """
check if a string is a permutation of anohter string
"""
#utalize sorted, perhaps check length first to make faster
| Python | 0.999858 | |
6dde05fc401ff615b44dc101bfb7775c65535e79 | Create 2.6_circularlinkedlist.py | CrackingCodingInterview/2.6_circularlinkedlist.py | CrackingCodingInterview/2.6_circularlinkedlist.py | """
return node at begining of a cricularly linked list
"""
| Python | 0.000019 | |
3d64d0be14ea93f53303ead80dcb024c9f8d4b2d | Create save_course_source.py | examples/save_course_source.py | examples/save_course_source.py | # Run with Python 3
# Saves all step sources into foldered structure
import os
import json
import requests
import datetime
# Enter parameters below:
# 1. Get your keys at https://stepic.org/oauth2/applications/
# (client type = confidential, authorization grant type = client credentials)
client_id = "..."
client_secre... | Python | 0.000001 | |
cb2deafae258625f0c4ec8bb68713b391129a27c | add migration of help text changes | isi_mip/climatemodels/migrations/0085_auto_20180215_1105.py | isi_mip/climatemodels/migrations/0085_auto_20180215_1105.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-02-15 10:05
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('climatemodels', '0084_inputdata_protocol_relation'),
]
... | Python | 0.000001 | |
32a7839072f073268f1a90b3521847e59b8ed522 | add logging03.py | trypython/stdlib/logging03.py | trypython/stdlib/logging03.py | """
logging モジュールのサンプルです。
最も基本的な使い方について (フォーマッタの指定)
"""
import logging
from trypython.common.commoncls import SampleBase
class Sample(SampleBase):
def exec(self):
"""サンプル処理を実行します。"""
# -----------------------------------------------------------------------------------
# logging モジュールは、pyt... | Python | 0 | |
5fa3fc6ba78c3e6cf12a25bddb835e9d885bcbd3 | Create 0035_auto_20190712_2015.py | src/submission/migrations/0035_auto_20190712_2015.py | src/submission/migrations/0035_auto_20190712_2015.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.21 on 2019-07-12 19:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('submission', '0034_auto_20190416_1009'),
]
operations = [
migrations.Alter... | Python | 0.000001 | |
e0229179b01805ca7f7e23d3094737a4f366e162 | Add missing files for d8af78447f286ad07ad0736d4202e0becd0dd319 | board/migrations/0001_initial.py | board/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | Python | 0.000006 | |
f8c79535d52384a4891ad56125033d69938d987d | Create get_url.py | get_url.py | get_url.py |
# coding: utf-8
# In[53]:
#huoqu Url
import requests
import re
import os
#下面三行是编码转换的功能
import sys
#hea是我们自己构造的一个字典,里面保存了user-agent。
#让目标网站误以为本程序是浏览器,并非爬虫。
#从网站的Requests Header中获取。【审查元素】
hea = {'User-Agent':'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41... | Python | 0.000001 | |
2a502236de5c28d4f4e6626317565c7bb60ebb13 | Create NumberofDigitOne_001.py | leetcode/233-Number-of-Digit-One/NumberofDigitOne_001.py | leetcode/233-Number-of-Digit-One/NumberofDigitOne_001.py | class Solution:
# @param {integer} n
# @return {integer}
def countDigitOne(self, n):
res, d = 0, 10
while 10 * n >= d:
t = d / 10
r = n % d
res += n / d * t
if t - 1 < r < 2 * t - 1:
res += r - t + 1
elif 2 * t - 1 <... | Python | 0.000057 | |
052dbe05c0e1d3e2821857a035e469be2a1055ae | Add "what is my purpose in life" plugin | plugins/pass_the_butter.py | plugins/pass_the_butter.py | from espresso.main import robot
@robot.respond(r"(?i)pass the butter")
def pass_the_butter(res):
res.reply(res.msg.user, "What is my purpose in life?")
@robot.respond(r"(?i)you pass butter")
def you_pass_butter(res):
res.send("Oh my god.")
| Python | 0.000021 | |
af31fbb5642ddc5734672517e2687216a94b2c6f | Add support for parsing Yahoo | unfurl/parsers/parse_yahoo.py | unfurl/parsers/parse_yahoo.py | # Copyright 2020 Moshe Kaplan
#
# 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 athttps://channel9.msdn.com/Shows/Going+Deep?page=20
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | Python | 0 | |
84a2e9db13b49d8afd1c1bcf5ec5ce9b92c14046 | Add a snippet. | python/pyside/pyside6/widget_QSqlTableModel_sqlite_from_file_with_sort_and_filter_plus_add_and_remove_rows.py | python/pyside/pyside6/widget_QSqlTableModel_sqlite_from_file_with_sort_and_filter_plus_add_and_remove_rows.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Ref: https://doc.qt.io/qtforpython/PySide6/QtSql/QSqlTableModel.html?highlight=qsqltablemodel
import sys
import sqlite3
from PySide6 import QtCore, QtWidgets
from PySide6.QtCore import Qt, QSortFilterProxyModel, QModelIndex
from PySide6.QtWidgets import QApplication, ... | Python | 0.000002 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.