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
2804024fbee6b825dec512ff13d7b28a1fee5b25
Add root Api object.
routeros_api/api.py
routeros_api/api.py
import hashlib import binascii from routeros_api import api_communicator from routeros_api import api_socket from routeros_api import base_api def connect(host, username='admin', password='', port=8728): socket = api_socket.get_socket(host, port) base = base_api.Connection(socket) communicator = api_commu...
Python
0
52f715af4b1cf6dd964e71cafdf807d1133fe717
add a basic script that tests nvlist_in and nvlist_out functionality
tests/test_nvlist.py
tests/test_nvlist.py
import json import math from libzfs_core.nvlist import * from libzfs_core.nvlist import _lib props_in = { "key1": "str", "key2": 10, "key3": { "skey1": True, "skey2": None, "skey3": [ True, False, True ] }, "key4": [ "ab", "bc" ], "key5": [ int(math.pow(2, 62)), 1, 2, 3 ], "key6":...
Python
0.000001
5348379759caa9576c3194ae0795e2fcc6ed3308
add unit tests
tests/test_region.py
tests/test_region.py
# -*- coding: utf-8 -*- from cooler.region import * import nose def test_bool_ops(): a, b = parse_region(('chr1', 5, 10)), parse_region(('chr1', 15, 20)) assert comes_before(a, b) == True assert comes_after(a, b) == False assert contains(a, b) == False assert overlaps(a, b) == False a, b = pa...
Python
0.000001
c9fc6d4f98ba102d94fa54eedae6a50d38459d71
add test_invalid_files to test_schema
tests/test_schema.py
tests/test_schema.py
import os import jsonschema import json import pathlib import copy def get_example_json(filebase): rootdir = pathlib.Path(__file__).resolve().parent.parent jsonfilepath = str(rootdir / 'examples' / f'{filebase}.json') with open(jsonfilepath) as f: js = json.load(f) return js def get_json_sch...
Python
0.000001
5e4fd7fb37f9e16d27a7751221f6e3725509f2fc
Prepare to use unittests
tests/testapi.py
tests/testapi.py
#!/usr/bin/python from fortigateconf import FortiOSConf import sys import json import pprint import json from argparse import Namespace import logging formatter = logging.Formatter( '%(asctime)s %(name)-12s %(levelname)-8s %(message)s') logger = logging.getLogger('fortinetconflib') hdlr = logging.FileHandler('...
Python
0
e57a73ac2c1a22d97ce40a8954ecb44e3b92a53c
increase to 100%
lob/api_requestor.py
lob/api_requestor.py
import requests import lob import json import resource from lob import error from version import VERSION def _is_file_like(obj): """ Checks if an object is file-like enough to be sent to requests. In particular, file, StringIO and cStringIO objects are file-like. Refs http://stackoverflow.com/question...
import requests import lob import json import resource from lob import error from version import VERSION def _is_file_like(obj): """ Checks if an object is file-like enough to be sent to requests. In particular, file, StringIO and cStringIO objects are file-like. Refs http://stackoverflow.com/question...
Python
0.000013
cd653c3657aa14d3845a253d916e9f0d336910ce
add logger convenience class
loggerglue/logger.py
loggerglue/logger.py
# -*- coding: utf-8 -*- """ An rfc5424/rfc5425 syslog server implementation Copyright © 2011 Evax Software <contact@evax.fr> """ import socket,os,sys from datetime import datetime from loggerglue.rfc5424 import DEFAULT_PRIVAL,SyslogEntry from loggerglue.emitter import UNIXSyslogEmitter class Logger(object): """ ...
Python
0
1ac75fafc9c67e0fc1f898f4653593730ed66326
Create uber.py
modules/uber.py
modules/uber.py
def uber(self): self.send_chan("Prkl, toimii!")
Python
0.000036
7b8d7bf81b094f554f3d820b1e0df5d54917f4c0
Create getCITask.py
src/main/resources/xlr_xldeploy/getCITask.py
src/main/resources/xlr_xldeploy/getCITask.py
# # Copyright 2017 XEBIALABS # # 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, modify, merge, publish, distribute, subli...
Python
0.000001
1e291eb5092d232d84be5914429808aa24c9ee9d
Add HTML 5 WebSocket support (see http://bret.appspot.com/entry/web-sockets-in-tornado)
tornado/websocket.py
tornado/websocket.py
#!/usr/bin/env python # # Copyright 2009 Facebook # # 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 a...
Python
0
116babc38e2e4023eb0b45eabc02050ed433e240
Include a helpful MOD analyser script
scripts/mod_info.py
scripts/mod_info.py
# mod_info.py # # Display information about a Protracker module. # # Written & released by Keir Fraser <keir.xen@gmail.com> # # This is free and unencumbered software released into the public domain. # See the file COPYING for more details, or visit <http://unlicense.org>. import struct, sys with open(sys.argv[1],...
Python
0
e9576468046fd53195f139f5751c9d45f26c51c4
handle NER exceptions.
aleph/analyze/polyglot_entity.py
aleph/analyze/polyglot_entity.py
from __future__ import absolute_import import logging from collections import defaultdict from polyglot.text import Text from aleph.core import db from aleph.model import Reference, Entity, Collection from aleph.model.entity_details import EntityIdentifier from aleph.analyze.analyzer import Analyzer log = logging.ge...
from __future__ import absolute_import import logging from collections import defaultdict from polyglot.text import Text from aleph.core import db from aleph.model import Reference, Entity, Collection from aleph.model.entity_details import EntityIdentifier from aleph.analyze.analyzer import Analyzer log = logging.ge...
Python
0
9e7acd4e7d80cffb0274e3a01aee517fb63d3db9
Create Josuel_Concordance.py
Josuel_Concordance.py
Josuel_Concordance.py
# Author: Josuel Musambaghani # library that breaks text into parts import nltk import string with open('c:/Python27/fileIn.txt', 'r') as in_file: text = in_file.read() f = nltk.sent_tokenize(text) # This code deals with the proble of parenthesis for item in range(len(f)-1): if '(' in f[item] and ')' in f[...
Python
0
2032a823b2dad6f7cebb63ee276bcfb6ea02b7a0
improve notes
notes/code/lolviz.py
notes/code/lolviz.py
import graphviz def lolviz(table): """ Given a list of lists such as: [ [('a','3')], [], [('b',230), ('c',21)] ] return the dot/graphviz to display as a two-dimensional structure. """ s = """ digraph G { nodesep=.05; rankdir=LR; node [shape=record,width=.1,he...
Python
0.000001
70b6fde787018daf5b87f485e60c9a26fa542f2e
add basic affine 3D transforms
lab_3/affine_transform.py
lab_3/affine_transform.py
from util.matrix import Matrix from math import cos, sin def translation(x, y, z): return Matrix([ [1, 0, 0, x], [0, 1, 0, y], [0, 0, 1, z], [0, 0, 0, 1] ]) # den = (phi ** 2 + psi ** 2) ** .5 # phi /= den # psi /= den # return Matrix([ # ...
Python
0.000008
786f75be946427024fa96ae8dcd06d8d1ecd49cc
Add the init method to the node model.
model/node.py
model/node.py
class NodeModel(Query): def __init__(self, db): self.db = db self.table_name = "node" super(NodeModel, self).__init__()
Python
0
ebc6368c11048a9182d848cff7f47e3dd8532933
Add files via upload
my_game_04.py
my_game_04.py
import pygame import os # ширина и высота игрового экрана WIDTH = 640 HEIGHT = 480 # частота кадров FPS = 60 # путь к изображениям game_folder = os.path.dirname(__file__) img_folder = os.path.join(game_folder, "images"); # класс для корабля игрока class PlayerShip(pygame.sprite.Sprite): def __init...
Python
0
07467664b699612e10b51bbeafdce79a9d1e0127
Write unit test for utility functions
test/test_util.py
test/test_util.py
from __future__ import unicode_literals try: import io StringIO = io.StringIO except ImportError: import StringIO StringIO = StringIO.StringIO import os import shutil import sys import tempfile import unittest import cudnnenv class TestSafeTempDir(unittest.TestCase): def test_safe_temp_dir(self...
Python
0.000002
fd7c31cf6039f7640fc01c8b76064afa0318cafd
Build update file
update_game_build.py
update_game_build.py
import pygame import sys from random import * from pygame.locals import * from operator import attrgetter from variables import * from Card import * from Player import * from create_board import * from create_game_options import * from create_player_info import * from handle_mouse_event import * from display_windows i...
Python
0
448f18769d7c701d9dd03ff65489656380513d07
Add test init.
tests/__init__.py
tests/__init__.py
from flexmock import flexmock from flask.ext.storage import MockStorage from flask_uploads import init created_objects = [] added_objects = [] deleted_objects = [] committed_objects = [] class MockModel(object): def __init__(self, **kw): created_objects.append(self) for key, val in kw.iteritems()...
Python
0
256648ad4effd9811d7c35ed6ef45de67f108926
Add pytest option for specifying the typing module to use
tests/conftest.py
tests/conftest.py
import sys def pytest_addoption(parser): parser.addoption('--typing', action='store', default='typing') def pytest_configure(config): if config.option.typing == 'no': sys.modules['typing'] = None elif config.option.typing != 'typing': sys.modules['typing'] = __import__(config.option.typi...
Python
0
08f6d31feb493b24792eaabfa11d08faea68c62b
add textample plug
plugins/textample/textample.py
plugins/textample/textample.py
# coding=utf-8 import gzip import os import random import re def search(regex, base_dir, file_contains=''): reg = re.compile(regex, re.IGNORECASE) for root, _, files in os.walk(base_dir): for file in files: if file.endswith('.gz'): file_path = os.path.join(root, file) ...
Python
0
da3248f782d83c46b698c31736b29a42d380511c
Add the playground
micro/_playground.py
micro/_playground.py
CODE = ''' out str + 2 3 ''' if __name__ == '__main__': import lexer import preparser import parser import builtin_functions import sys import evaluate specific_lexer = lexer.Lexer() specific_preparser = preparser.Preparser(specific_lexer) preast = specific_preparser.preparse(CODE)...
Python
0.999869
686c0d0c8f2e520375315c84e2320b087b9a3831
add scan dir test
tests/scan_dir.py
tests/scan_dir.py
import os import json import datetime import random import hashlib import signal import sys from frontend.cli.irma import _scan_new, _scan_add, _scan_launch, \ _scan_progress, _scan_cancel, IrmaScanStatus, _scan_result import time RES_PATH = "." SRC_PATH = "." DEBUG = True SCAN_TIMEOUT_SEC = 300 BEFORE_NEXT_PROGR...
Python
0
682b064f29c7a6cfea0c9866da03703822e70cb3
Add machinery to slurp dhcpd.leases journal into usable format.
propernoun/leases.py
propernoun/leases.py
from . import parser from . import watch def gen_leases(path): """ Keep track of currently valid leases for ISC dhcpd. Yields dictionaries that map ``ip`` to information about the lease. Will block until new information is available. """ g = watch.watch_dhcp_leases(path) for _ in g: ...
Python
0
ba6c50d0b2fd973c34f2df3779d78df11f671598
Create mongo_import_keywords.py
mongo_import_keywords.py
mongo_import_keywords.py
""" Load mongo database with keywords for annie annotation. The keyword_array pickle is packaged with the GRITS classifier. """ import sys import re import pickle from pymongo import MongoClient def load_keyword_array(file_path): with open(file_path) as f: keyword_array = pickle.load(f) return keyword_...
Python
0.00004
a21ed2d12b763d93722b6c8e9f6d6ff39d15938c
add utility to fetch satellites and corresponding TLEs
python-files/get-satellites.py
python-files/get-satellites.py
#!/usr/bin/env python3 """ Utility to get the station information from a SatNOGS Network server. Collects the paginated objects into a single JSON list and stores in a file. """ import json import sqlite3 import requests import orbit # default expire time is 24 hours orbit.tle.requests_cache.configure(expire_afte...
Python
0
550873226ec0879a86fea2527b56535a329981b1
Add upcoming_match.py
upcoming_match.py
upcoming_match.py
#! /usr/bin/env python # # Tests sending an upcoming_match notification via adb to The Blue Alliance # Android app. import test_notification json_data = {"match_key": "2007cmp_sf1m3", "event_name": "Championship - Einstein Field", "team_keys": ["frc173","frc1319","frc1902","frc177","frc987","frc190"], "s...
Python
0.000001
1d8cbf94f127571358aee97677a09f7cea3bf3a7
Add helper functions for to/from bytes/unicode
p23serialize/util.py
p23serialize/util.py
from . import str_mode if str_mode == 'bytes': unicode_type = unicode else: # str_mode == 'unicode' unicode_type = str def recursive_unicode(obj): if isinstance(obj, bytes): return obj.decode('latin1') elif isinstance(obj, list): return [recursive_unicode(_) for _ in obj] else: ...
Python
0.000001
01f21a16e4bcecccf51a565b51222ab18b79adb4
Add tests for shell utils.
st2common/tests/unit/test_util_shell.py
st2common/tests/unit/test_util_shell.py
# Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use th...
Python
0
f56a902f2e7ca45bb4bf1dfa7dacefd3fefff524
Create config.sample
zhwikt-broken-file-links/config.sample.py
zhwikt-broken-file-links/config.sample.py
# -*- coding: utf-8 -*- cfg = { "category": "Category:含有受损文件链接的页面" }
Python
0
076f65b4d67cb44cd48ee5eedc134a83ab01ca4a
Add unit test for md.pair.lj1208 (duplicated from test_pair_lj.py)
hoomd/md/test-py/test_pair_lj1208.py
hoomd/md/test-py/test_pair_lj1208.py
# -*- coding: iso-8859-1 -*- # Maintainer: unassigned from hoomd import * from hoomd import deprecated from hoomd import md; context.initialize() import unittest import os # md.pair.lj1208 class pair_lj1208_tests (unittest.TestCase): def setUp(self): print self.s = deprecated.init.create_random(N=...
Python
0
2a6036bcb7eda9c75b4ade025e757db961781905
add src/cs_toico.py
src/cs_toico.py
src/cs_toico.py
#!/usr/local/bin/python # -*- coding: utf-8 -*- '''cs_toicon image[.png/.bmp/.ico/etc] to masked .ico inspired http://d.hatena.ne.jp/rsky/20070919/1190163713 ''' import sys, os from PIL import Image from cStringIO import StringIO from struct import pack, unpack def toicon(infile, outfile=None, dim=(32, 32), mp=(0, 0)...
Python
0.000001
18d129613c5a576b770a812f18ff05873925fb2c
refactor to a shorter version.
restclients/digitlib/curric.py
restclients/digitlib/curric.py
""" This is the interface for interacting with the UW Libraries Web Service. """ import logging from restclients.digitlib import get_resource url_prefix = "/php/currics/service.php?code=" sln_prefix = "&sln=" quarter_prefix = "&quarter=" year_prefix = "&year=" logger = logging.getLogger(__name__) def get_subject_g...
""" This is the interface for interacting with the UW Libraries Web Service. """ import logging from restclients.digitlib import get_resource url_prefix = "/php/currics/service.php?code=" sln_prefix = "&sln=" quarter_prefix = "&quarter=" year_prefix = "&year=" logger = logging.getLogger(__name__) def get_subject_g...
Python
0.000174
f22f833efb45bdfe0458d045cfd300721185dc84
Revert "bug fix"
sabToSickBeardwithConverter.py
sabToSickBeardwithConverter.py
import os import sys import autoProcessTV from readSettings import ReadSettings from mkvtomp4 import MkvtoMp4 from extensions import valid_input_extensions settings = ReadSettings(os.path.dirname(sys.argv[0]), "autoProcess.ini") path = str(sys.argv[1]) for r, d, f in os.walk(path): for files in f: if os.p...
import os import sys import autoProcessTV from readSettings import ReadSettings from mkvtomp4 import MkvtoMp4 from extensions import valid_input_extensions settings = ReadSettings(os.path.dirname(sys.argv[0]), "autoProcess.ini") path = str(sys.argv[1]) for r, d, f in os.walk(path): for files in f: if os.p...
Python
0
d3a9824ea2f7675e9e0008b5d914f02e63e19d85
Add new package. (#22639)
var/spack/repos/builtin/packages/liblbfgs/package.py
var/spack/repos/builtin/packages/liblbfgs/package.py
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Liblbfgs(AutotoolsPackage): """libLBFGS is a C port of the implementation of Limited-memor...
Python
0
a568663ebcf8b45a801df2cf2185dd3e7c969a79
Fix fragile command description
vint/linting/policy/prohibit_command_rely_on_user.py
vint/linting/policy/prohibit_command_rely_on_user.py
import re from vint.ast.node_type import NodeType from vint.linting.level import Level from vint.linting.policy.abstract_policy import AbstractPolicy from vint.linting.policy.reference.googlevimscriptstyleguide import get_reference_source from vint.linting.policy_loader import register_policy PROHIBITED_COMMAND_PATTE...
import re from vint.ast.node_type import NodeType from vint.linting.level import Level from vint.linting.policy.abstract_policy import AbstractPolicy from vint.linting.policy.reference.googlevimscriptstyleguide import get_reference_source from vint.linting.policy_loader import register_policy PROHIBITED_COMMAND_PATTE...
Python
0.004767
b55277497559fad19f790ba8821f02ff2ce20c91
add a minimal smoke test of multi-run
bluesky/tests/test_multi_runs.py
bluesky/tests/test_multi_runs.py
from bluesky import preprocessors as bpp from bluesky import plans as bp from bluesky import plan_stubs as bps from bluesky.preprocessors import define_run_wrapper as drw from ophyd.sim import motor, det from bluesky.tests.utils import DocCollector def test_multirun_smoke(RE, hw): dc = DocCollector() RE.subsc...
Python
0
f31b11b2cf1f6924c4373fbfaf4b911102272876
add base serializer
cla_backend/apps/complaints/serializers.py
cla_backend/apps/complaints/serializers.py
# -*- coding: utf-8 -*- from rest_framework import serializers from .models import Category, Complaint class CategorySerializerBase(serializers.ModelSerializer): class Meta: model = Category fields = ('id', 'name') class ComplaintSerializerBase(serializers.ModelSerializer): category = Categ...
Python
0
9d348cba1c800a4de9a0078ded1e03540256f8a6
Add backwards-compatible registration.urls, but have it warn pending deprecation.
registration/urls.py
registration/urls.py
import warnings warnings.warn("Using include('registration.urls') is deprecated; use include('registration.backends.default.urls') instead", PendingDeprecationWarning) from registration.backends.default.urls import *
Python
0
d028db776b92c4d968434a64b2c5d7e02867b32e
Create db_init.py
db_init.py
db_init.py
from sqlalchemy import create_engine, Column, Integer, String, Sequence, update from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker engine = create_engine('sqlite:///passwords.db') Base = declarative_base() Session = sessionmaker(bind=engine) session = Session() class Locke...
Python
0.000009
e7fa141bc8fade9c6a34c0bbe95df9a77eb95e0e
Update __init__.py
tendrl/commons/objects/disk/__init__.py
tendrl/commons/objects/disk/__init__.py
from tendrl.commons.etcdobj import EtcdObj from tendrl.commons import objects class Disk(objects.BaseObject): def __init__(self, disk_id=None, device_name=None, disk_kernel_name=None, parent_id=None, parent_name=None, disk_type=None, fsuuid=None, mount_point=None, model=None, ven...
from tendrl.commons.etcdobj import EtcdObj from tendrl.commons import objects class Disk(objects.BaseObject): def __init__(self, disk_id=None, device_name=None, disk_kernel_name=None, parent_id=None, parent_name=None, disk_type=None, fsuuid=None, mount_point=None, model=None, ven...
Python
0.000072
b40512e834e88f24c20885cddb220188fce11339
Add verbose names to UserProfile fields.
accounts/migrations/0004_auto_20150227_2347.py
accounts/migrations/0004_auto_20150227_2347.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('accounts', '0003_auto_20150227_2158'), ] operations = [ migrations.AlterField( model_name='userprofile', ...
Python
0.000001
18baab37c3f1924b104f4ef86224c1b197ef1dad
add problem 054
problem_054.py
problem_054.py
#!/usr/bin/env python #-*-coding:utf-8-*- ''' ''' import timeit class Poker: def __init__(self, cards): self.numbers = {} self.suits = {} for card in cards: n = self._to_number(card[0]) s = card[1] self.numbers[n] = self.numbers.get(n, 0)+1 ...
Python
0.000847
e21d6d88f49dbdeb2dfb96e68f174ba587eaa27a
Add pre-deploy version match
pre-deploy.py
pre-deploy.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ pre-deploy.py Created by Stephan Hügel on 2017-06-06 A simple check to ensure that the tag version and the library version coincide Intended to be called before a Wheel is written using "upload" """ import os import sys import subprocess import re import io def read...
Python
0
bc1c65315fe22146b2d9a0955acc6e286b069657
Add problem 48
problem_48.py
problem_48.py
''' Problem 48 @author: Kevin Ji ''' def self_power_with_mod(number, mod): product = 1 for _ in range(number): product *= number product %= mod return product MOD = 10000000000 number = 0 for power in range(1, 1000 + 1): number += self_power_with_mod(power, MOD) number %= MOD ...
Python
0.02481
07d89159ad53b404d39b56f133ca19209da98eaa
Create mostrans-trolleybus.py
mostrans-trolleybus.py
mostrans-trolleybus.py
#!/usr/bin/python # -*- coding: utf8 -*- import os import psycopg2 import time import config import argparse def download_osm_dump(): if not os.path.exists('osm'): os.makedirs('osm') os.system('wget --timestamping https://s3.amazonaws.com/metro-extracts.mapzen.com/moscow_russia.osm.pbf'...
Python
0.0001
3e380228088a096ed20ee80f9928b368707e47ed
test parameters are fetched and placed correctly
tests/StarCatalog/test_HIPfromSimbad.py
tests/StarCatalog/test_HIPfromSimbad.py
import unittest from tests.TestSupport.Utilities import RedirectStreams import EXOSIMS.StarCatalog from EXOSIMS.StarCatalog.HIPfromSimbad import HIPfromSimbad from EXOSIMS.util.get_module import get_module import os, sys import pkgutil from io import StringIO import astropy.units as u from EXOSIMS.util.get_dirs import ...
Python
0
008625fef55f8f58ab80b883d34ae5d40e55c721
Add initial test for binheap
test_binheap.py
test_binheap.py
import pytest from binheap import Binheap def test_init_bh(): b = Binheap() assert b.binlist is [] c = Binheap([1, 2]) assert c.binlist == [1, 2]
Python
0.000001
d43c67a59dcf6c43667d633df8b6f8a3eb84d611
add HelloKhalaClient2.py
examples/testClient/HelloKhalaClient2.py
examples/testClient/HelloKhalaClient2.py
#moss's HelloKhala Client #add time type import socket import struct import json def login(): send = {'type': 'login'} return send def logout(): send = {'type': 'logout'} return send def devType(): send = {'type': 'dev'} return send def isLogin(): send = {'type': 'isLogin'} return send def n...
Python
0.000001
80e80bff7603e852710df6c9de613b1781877b2d
Test case for two classes with the same name in one module.
tests/python/typeinference/same_name.py
tests/python/typeinference/same_name.py
class A(object): def method(self): return 1 A().method() ## type int class A(object): def method(self): return "test" A().method() ## type str
Python
0
4887a269a28656c288461165078943f99e2390be
add settings template for ansible later
ansible/crates_settings.py
ansible/crates_settings.py
from base_settings import * # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'zhj_+x#q-&vqh7&)7a3it@tcsf50@fh9$3&&j0*4pmt1x=ye+1' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False ALLOWED_HOSTS = ['.'] # where will nginx look for static files for product...
Python
0
4143f5381b8ff47a80a550065e831c306551cd77
solve problem 035
python/035.py
python/035.py
def base10_to_base2( n ): base2n = 0 if n == 0: return 0 return base10_to_base2( n/2 ) * 10 + n % 2 def palindromes( s ): flag = True str_len = len(s) half_len = str_len / 2 for i in range( 0, half_len+1 ): if s[i] != s[str_len-i-1]: flag = False bre...
Python
0.000285
a5a7d6c3097571a9ef050a75127a2eb24ad2746c
Remove test code.
packs/alertlogic/actions/scan_list_scan_executions.py
packs/alertlogic/actions/scan_list_scan_executions.py
#!/usr/bin/env python # Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "Licens...
#!/usr/bin/env python # Licensed to the StackStorm, Inc ('StackStorm') under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "Licens...
Python
0.000001
675b76f2bc36d7ce97d2e7227582597067be16bd
fix list problem.
crawler/git_crawler.py
crawler/git_crawler.py
# -*- coding: utf-8 -*- from datetime import datetime import envoy from allmychanges.utils import cd, get_package_metadata def git_clone(repo_path, path): """Clone git repo from repo_path to local path""" r = envoy.run('git clone {repo} {path}'.format(repo=repo_path, path=path)) if r.status_code != 0 and...
# -*- coding: utf-8 -*- from datetime import datetime import envoy from allmychanges.utils import cd, get_package_metadata def git_clone(repo_path, path): """Clone git repo from repo_path to local path""" r = envoy.run('git clone {repo} {path}'.format(repo=repo_path, path=path)) if r.status_code != 0 and...
Python
0.000003
7ecec2d2b516d9ae22a3a0f652424045d547d811
Put object_tools in the correct order in settings
test_settings.py
test_settings.py
DEBUG = True DATABASE_ENGINE = 'sqlite3' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } SECRET_KEY = '123' INSTALLED_APPS = [ 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'object_tools', 'djan...
DEBUG = True DATABASE_ENGINE = 'sqlite3' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } SECRET_KEY = '123' INSTALLED_APPS = [ 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.admin', ...
Python
0.000037
35296b1c87a86a87fbcf317e26a497fc91c287c7
Update receiver to catch value error
lexos/receivers/kmeans_receiver.py
lexos/receivers/kmeans_receiver.py
from typing import NamedTuple from lexos.models.filemanager_model import FileManagerModel from lexos.receivers.base_receiver import BaseReceiver class KMeansOption(NamedTuple): """The typed tuple to hold kmeans options.""" n_init: int # number of iterations with different centroids. k_value: int # k val...
from typing import NamedTuple from lexos.models.filemanager_model import FileManagerModel from lexos.receivers.base_receiver import BaseReceiver class KMeansOption(NamedTuple): """The typed tuple to hold kmeans options.""" n_init: int # number of iterations with different centroids. k_value: int # k val...
Python
0
b6f6eb362c8637839cbce4bd133895e73a695cc0
Fix wrong args
cupy/cuda/compiler.py
cupy/cuda/compiler.py
import hashlib import os import re import tempfile import filelock from pynvrtc import compiler import six from cupy.cuda import device from cupy.cuda import function _nvrtc_version = None def _get_nvrtc_version(): global _nvrtc_version if _nvrtc_version is None: interface = compiler.NVRTCInterface...
import hashlib import os import re import tempfile import filelock from pynvrtc import compiler import six from cupy.cuda import device from cupy.cuda import function _nvrtc_version = None def _get_nvrtc_version(): global _nvrtc_version if _nvrtc_version is None: interface = compiler.NVRTCInterface...
Python
0.999193
89d83b9ca8c1c52537aae0c5339b0cb5ae64c6c4
Add additional test for template filters: for filter queries and filter with variable argument
tests/filters.py
tests/filters.py
"""Test cases for variable fields """ import unittest from lighty.templates import Template from lighty.templates.filter import filter_manager def simple_filter(value): return str(value).upper() filter_manager.register(simple_filter) def argument_filter(value, arg): return str(value) + ', ' + str(arg) filte...
"""Test cases for variable fields """ import unittest from lighty.templates import Template from lighty.templates.filter import filter_manager def simple_filter(value): return str(value).upper() filter_manager.register(simple_filter) def argument_filter(value, arg): return str(value) + ', ' + str(arg) filte...
Python
0
c5382580601e25a9fb5b41f42548a6e49929fae0
Put this four languages in options bring problems.
wagtailcodeblock/blocks.py
wagtailcodeblock/blocks.py
from django.forms import Media from django.utils.translation import ugettext_lazy as _ # Wagtail 2.0 compatibility - new package paths try: from wagtail.core.blocks import ( StructBlock, TextBlock, ChoiceBlock, ) except ImportError: from wagtail.wagtailcore.blocks import ...
from django.forms import Media from django.utils.translation import ugettext_lazy as _ # Wagtail 2.0 compatibility - new package paths try: from wagtail.core.blocks import ( StructBlock, TextBlock, ChoiceBlock, ) except ImportError: from wagtail.wagtailcore.blocks import ...
Python
0.000005
b32f01154cce6d7b7572b04e7218b04d052661e0
use apply_detection_link in eval
examples/ssd/eval.py
examples/ssd/eval.py
from __future__ import division import argparse import sys import time import chainer from chainer import iterators from chainercv.datasets import voc_detection_label_names from chainercv.datasets import VOCDetectionDataset from chainercv.evaluations import eval_detection_voc from chainercv.links import SSD300 from ...
from __future__ import division import argparse import sys import time import chainer from chainer import iterators from chainercv.datasets import voc_detection_label_names from chainercv.datasets import VOCDetectionDataset from chainercv.evaluations import eval_detection_voc from chainercv.links import SSD300 from ...
Python
0
8874af7c0db371f63da687c5398db1c7b80f58cd
Fix import of django during install time (for environments like Heroku) (#120)
todo/__init__.py
todo/__init__.py
""" A multi-user, multi-group task management and assignment system for Django. """ __version__ = "2.4.10" __author__ = "Scot Hacker" __email__ = "shacker@birdhouse.org" __url__ = "https://github.com/shacker/django-todo" __license__ = "BSD License" try: from . import check except ModuleNotFoundError: # this can ha...
""" A multi-user, multi-group task management and assignment system for Django. """ __version__ = "2.4.10" __author__ = "Scot Hacker" __email__ = "shacker@birdhouse.org" __url__ = "https://github.com/shacker/django-todo" __license__ = "BSD License" from . import check
Python
0.000005
e3c51012a36fd85781824bd6b66c7e5e1d6696a9
Add documentation
app/resources/companies.py
app/resources/companies.py
from app.models import Company, PostalCode, CompanyPostalCode from flask_restful import Resource, reqparse class Companies(Resource): def get(self): """ List all restaurants --- tags: - Restaurants definitions: - schema: id: Restaurant ...
from app.models import Company, PostalCode, CompanyPostalCode from flask_restful import Resource, reqparse class Companies(Resource): def get(self): parser = reqparse.RequestParser() parser.add_argument('country') parser.add_argument('postal_code') args = parser.parse_args() ...
Python
0
4d2f3ee1343b9aef24f599b8acd07ed8340f0bff
convert that to a list so we can measure it's len in a template
tndata_backend/notifications/views.py
tndata_backend/notifications/views.py
from collections import defaultdict from django.contrib.auth.decorators import user_passes_test from django.contrib import messages from django.shortcuts import render, redirect from . import queue from .models import GCMMessage @user_passes_test(lambda u: u.is_staff, login_url='/') def dashboard(request): """A...
from collections import defaultdict from django.contrib.auth.decorators import user_passes_test from django.contrib import messages from django.shortcuts import render, redirect from . import queue from .models import GCMMessage @user_passes_test(lambda u: u.is_staff, login_url='/') def dashboard(request): """A...
Python
0.000116
6618ea7c1b67d87acff86338415e2a322a01cc3c
add loopback support
testsniff.py
testsniff.py
#!/usr/bin/env python import getopt, sys import dpkt, pcap def usage(): print >>sys.stderr, 'usage: %s [-i device] [pattern]' % sys.argv[0] sys.exit(1) def main(): opts, args = getopt.getopt(sys.argv[1:], 'i:h') name = None for o, a in opts: if o == '-i': name = a else: usage() ...
#!/usr/bin/env python import getopt, sys import pcap from dpkt.ethernet import Ethernet def usage(): print >>sys.stderr, 'usage: %s [-i device] [pattern]' % sys.argv[0] sys.exit(1) def main(): opts, args = getopt.getopt(sys.argv[1:], 'i:h') name = None for o, a in opts: if o == '-i': name...
Python
0.000001
4dc49433ad354b1530207db308f4c7b76f40db70
Add command
tf2server.py
tf2server.py
import os import time import libtmux class CorruptedTf2ServerInstanceError(Exception): """ Raised when an invalid TF2 server instance is found. """ class Tf2Server(object): """ The Tf2Server class represents a single Team Fortress 2 server. """ def __init__(self, name, path): ""...
import os import libtmux class CorruptedTf2ServerInstanceError(Exception): """ Raised when an invalid TF2 server instance is found. """ class Tf2Server(object): """ The Tf2Server class represents a single Team Fortress 2 server. """ def __init__(self, name, path): """ Cr...
Python
0.001952
de695899f757df8f320ac560dea90e84b07e1bd3
Reorganize newer tests a bit
tests/runners.py
tests/runners.py
import sys from invoke.vendor.six import StringIO from spec import Spec, trap, eq_, skip from invoke import Local, Context from _utils import mock_subprocess, mock_pty class Local_(Spec): def _run(self, *args, **kwargs): return Local(Context()).run(*args, **kwargs) class stream_control: @t...
import sys from invoke.vendor.six import StringIO from spec import Spec, trap, eq_, skip from invoke import Local, Context from _utils import mock_subprocess, mock_pty class Local_(Spec): def _run(self, *args, **kwargs): return Local(Context()).run(*args, **kwargs) @trap @mock_subprocess(out="...
Python
0.000001
a1bda82bd06cbfd12e6074f22cb31d88f2abd96a
update py +x
tools/fuckGFW.py
tools/fuckGFW.py
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Update hosts for *nix Author: cloud@txthinking.com Version: 0.0.1 Date: 2012-10-24 14:35:39 ''' import urllib2 import os import sys HOSTS_PATH = "/etc/hosts" HOSTS_SOURCE = "http://tx.txthinking.com/hosts" SEARCH_STRING = "#TX-HOSTS" def GetRemoteHosts(url): f = ...
''' Update hosts for *nix Author: cloud@txthinking.com Version: 0.0.1 Date: 2012-10-24 14:35:39 ''' import urllib2 import os import sys HOSTS_PATH = "/etc/hosts" HOSTS_SOURCE = "http://tx.txthinking.com/hosts" SEARCH_STRING = "#TX-HOSTS" def GetRemoteHosts(url): f = urllib2.urlopen(url, timeout=5) hosts = [l...
Python
0.000001
ed8fc99f0867779db8879b3f6cc142985d01fc58
change RunInstances argument
qingcloud/cli/iaas_client/actions/instance/run_instances.py
qingcloud/cli/iaas_client/actions/instance/run_instances.py
# coding: utf-8 from qingcloud.cli.misc.utils import explode_array from qingcloud.cli.iaas_client.actions.base import BaseAction class RunInstancesAction(BaseAction): action = 'RunInstances' command = 'run-instances' usage = '%(prog)s --image_id <image_id> --instance_type <instance_type> [options] [-f <c...
# coding: utf-8 from qingcloud.cli.misc.utils import explode_array from qingcloud.cli.iaas_client.actions.base import BaseAction class RunInstancesAction(BaseAction): action = 'RunInstances' command = 'run-instances' usage = '%(prog)s --image_id <image_id> --instance_type <instance_type> [options] [-f <c...
Python
0
3d5fc893cee6b7ab1596acedb052366ce86005b7
Use requests module rather than mozsvc.http_helpers
tokenserver/assignment/sqlnode.py
tokenserver/assignment/sqlnode.py
""" SQL Mappers """ import json import sys from zope.interface import implements import time import requests from mozsvc.util import dnslookup from tokenserver.assignment import INodeAssignment from tokenserver.util import get_logger # try to have this changed upstream: # XXX being able to set autocommit=1; # forci...
""" SQL Mappers """ import json import sys from zope.interface import implements import time from mozsvc.util import dnslookup from tokenserver.assignment import INodeAssignment from tokenserver.util import get_logger # try to have this changed upstream: # XXX being able to set autocommit=1; # forcing it for now fro...
Python
0
8f22be125cabf38f00b360e0c6d48a5d1650bef0
Remove wrong dependency
sponsorship_compassion/__openerp__.py
sponsorship_compassion/__openerp__.py
# -*- encoding: utf-8 -*- ############################################################################## # # ______ Releasing children from poverty _ # / ____/___ ____ ___ ____ ____ ___________(_)___ ____ # / / / __ \/ __ `__ \/ __ \/ __ `/ ___/ ___/ / __ \/ __ \ # / /___/ /_/ / / / /...
# -*- encoding: utf-8 -*- ############################################################################## # # ______ Releasing children from poverty _ # / ____/___ ____ ___ ____ ____ ___________(_)___ ____ # / / / __ \/ __ `__ \/ __ \/ __ `/ ___/ ___/ / __ \/ __ \ # / /___/ /_/ / / / /...
Python
0.000086
145e9141af1e1abdf0a9ab3c035ed8df6298ba0f
rebase migration dependency.
accelerator/migrations/0015_expert_bio_add_max_length_validation.py
accelerator/migrations/0015_expert_bio_add_max_length_validation.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.14 on 2018-07-25 15:00 from __future__ import unicode_literals import django.core.validators from django.db import ( migrations, models, ) class Migration(migrations.Migration): dependencies = [ ('accelerator', '0014_alter_fluent_page_type_manage...
# -*- coding: utf-8 -*- # Generated by Django 1.11.14 on 2018-07-25 15:00 from __future__ import unicode_literals import django.core.validators from django.db import ( migrations, models, ) class Migration(migrations.Migration): dependencies = [ ('accelerator', '0013_allocator'), ] opera...
Python
0
0992a05b5f199b6ade27f19af9271e5e8556c372
Clarified an example param
apollo-ws/visualizer-services/GAIA/trunk/VisualizerServiceClient.py
apollo-ws/visualizer-services/GAIA/trunk/VisualizerServiceClient.py
# Copyright 2013 University of Pittsburgh # # 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 ...
# Copyright 2013 University of Pittsburgh # # 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 ...
Python
0.999483
837f05228fac7f6addd28069c6387f798e01ff8c
Add checksum test.
tests/test_fs.py
tests/test_fs.py
from farmfs.fs import normpath as _normalize from farmfs.fs import userPath2Path as up2p from farmfs.fs import Path import pytest def test_create_path(): p1 = Path("/") p2 = Path("/a") p2 = Path("/a/b") p3 = Path(p1) p4 = Path("a", p1) with pytest.raises(AssertionError): p5 = Path("/a/b", p2) with py...
from farmfs.fs import normpath as _normalize from farmfs.fs import userPath2Path as up2p from farmfs.fs import Path import pytest def test_create_path(): p1 = Path("/") p2 = Path("/a") p2 = Path("/a/b") p3 = Path(p1) p4 = Path("a", p1) with pytest.raises(AssertionError): p5 = Path("/a/b", p2) with py...
Python
0.000002
9786c5f242f2b70240e7bb23c866c864cb4ed4ca
Add registrations to admin
expeditions/admin.py
expeditions/admin.py
from django.contrib import admin from expeditions.models import Expedition, Waypoint, Registration # Register your models here. class ExpeditionAdmin(admin.ModelAdmin): list_display = ('id', 'name', 'start_date', 'end_date', 'published') list_display_links = ('id', 'name') search_fields = ('name', 'start_d...
from django.contrib import admin from expeditions.models import Expedition, Waypoint # Register your models here. class ExpeditionAdmin(admin.ModelAdmin): list_display = ('id', 'name', 'start_date', 'end_date', 'published') search_fields = ('name', 'start_date') list_filter = ('published', ) class Waypoi...
Python
0
7184ba85fae4c539e557309f3b15b1b7c64cb8cb
Fix urls.
snapboard/urls.py
snapboard/urls.py
from django.conf.urls.defaults import * from django.contrib.auth.models import User from snapboard.feeds import LatestPosts feeds = {'latest': LatestPosts} js_info_dict = { 'packages': ('snapboard',), } rpc_lookup_dict = { 'queryset':User.objects.all(), 'field':'username', } urlpatterns = patterns('sna...
from django.conf.urls.defaults import * from django.contrib.auth.models import User from snapboard.feeds import LatestPosts from snapboard.rpc import rpc_post, rpc_lookup, rpc_preview from snapboard.views import * feeds = {'latest': LatestPosts} js_info_dict = { 'packages': ('snapboard',), } urlpatterns = patte...
Python
0.000033
44c78525ee886a369be66d671523dd3258ba37d5
Remove hard FPU for Cortex M4 // Resolve #162
platformio/builder/scripts/basearm.py
platformio/builder/scripts/basearm.py
# Copyright (C) Ivan Kravets <me@ikravets.com> # See LICENSE for details. """ Base for ARM microcontrollers. """ from SCons.Script import Builder, DefaultEnvironment env = DefaultEnvironment() env.Replace( AR="arm-none-eabi-ar", AS="arm-none-eabi-as", CC="arm-none-eabi-gcc", CXX="arm-none-eabi-g...
# Copyright (C) Ivan Kravets <me@ikravets.com> # See LICENSE for details. """ Base for ARM microcontrollers. """ from SCons.Script import Builder, DefaultEnvironment env = DefaultEnvironment() env.Replace( AR="arm-none-eabi-ar", AS="arm-none-eabi-as", CC="arm-none-eabi-gcc", CXX="arm-none-eabi-g...
Python
0
98bacbc912513fa33775e2e6c2e41363aea7c793
Remove strange code
stencil/base.py
stencil/base.py
import os import optparse import sys try: from collections import OrderedDict except ImportError: from ordereddict import OrderedDict from .resources import Directory, File, Template class WrongSource(Exception): pass class Stencil(object): source = None variables = [] help = None de...
import os import optparse import sys try: from collections import OrderedDict except ImportError: from ordereddict import OrderedDict from .resources import Directory, File, Template class WrongSource(Exception): pass class Stencil(object): source = None variables = [] help = None de...
Python
0.000538
ab23ea60457720d0a7414b1b84191945f529b23c
Update _version.py
fabsetup/_version.py
fabsetup/_version.py
__version__ = "0.7.9" # semantic versioning: https://semver.org
__version__ = "0.7.9"
Python
0.000002
28c8d1cc6df216dfe1f3bcfa3eb70bb590204613
implement post_vote()
pybooru/api_danbooru.py
pybooru/api_danbooru.py
# -*- coding: utf-8 -*- """pybooru.api_danbooru This module contains all API calls of Danbooru for Pybooru. Classes: Danbooru -- Contains all API calls. """ # __future__ imports from __future__ import absolute_import # pybooru imports from .exceptions import PybooruAPIError class DanbooruApi(object): """...
# -*- coding: utf-8 -*- """pybooru.api_danbooru This module contains all API calls of Danbooru for Pybooru. Classes: Danbooru -- Contains all API calls. """ # __future__ imports from __future__ import absolute_import # pybooru imports from .exceptions import PybooruAPIError class DanbooruApi(object): """...
Python
0.000009
8c4edd4cc8fdd6c7c470e25436b6c6b4c146ad58
Fix error casting datetime objects
data-analysis/utils.py
data-analysis/utils.py
# -*- coding: utf-8 -*- # # Copyright (C) 2015-2016 Bitergia # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This ...
# -*- coding: utf-8 -*- # # Copyright (C) 2015-2016 Bitergia # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This ...
Python
0.000003
9f405a3b4e01ee0a42a8530cfc5b509a38067250
Remove unused import
mugloar/dragon.py
mugloar/dragon.py
class Dragon: # By default, stay home. scaleThickness = 0 clawSharpness = 0 wingStrength = 0 fireBreath = 0 def __init__(self, weather_code): if weather_code == 'T E': # Draught requires a 'balanced' dragon, ha ha self.scaleThickness = 5 self.clawSh...
import json class Dragon: # By default, stay home. scaleThickness = 0 clawSharpness = 0 wingStrength = 0 fireBreath = 0 def __init__(self, weather_code): if weather_code == 'T E': # Draught requires a 'balanced' dragon, ha ha self.scaleThickness = 5 ...
Python
0.000001
b8701f04d049101c8c92b468b4fc3dc863f1e292
Add bulk accept and reject for talks
pygotham/admin/talks.py
pygotham/admin/talks.py
"""Admin for talk-related models.""" from flask.ext.admin import actions from flask.ext.admin.contrib.sqla import ModelView from pygotham.admin.utils import model_view from pygotham.core import db from pygotham.talks import models __all__ = ('CategoryModelView', 'talk_model_view', 'TalkReviewModelView') CATEGORY = ...
"""Admin for talk-related models.""" from pygotham.admin.utils import model_view from pygotham.talks import models __all__ = ('CategoryModelView', 'TalkModelView', 'TalkReviewModelView') CategoryModelView = model_view( models.Category, 'Categories', 'Talks', form_columns=('name', 'slug'), ) TalkMod...
Python
0.000038
54bb5a2320fb88daf9c24ad7b6a9b6cb0a6ab0cc
add send_image_url
pymessenger/send_api.py
pymessenger/send_api.py
import json import requests from requests_toolbelt import MultipartEncoder DEFAULT_API_VERSION = 2.6 class SendApiClient(object): def __init__(self, access_token, api_version=DEFAULT_API_VERSION): self.api_version = api_version self.access_token = access_token self.base_url = ( ...
import json import requests from requests_toolbelt import MultipartEncoder DEFAULT_API_VERSION = 2.6 class SendApiClient(object): def __init__(self, access_token, api_version=DEFAULT_API_VERSION): self.api_version = api_version self.access_token = access_token self.base_url = ( ...
Python
0.000002
ec261fdaf41bd91558e4df143be8dfd9940bde81
Rewrite bubble sort.
py/sorting/05_bubbleSort.py
py/sorting/05_bubbleSort.py
def bubbleSort(A): for k in range(len(A)-1, 0, -1): for i in range(k): if A[i] > A[i+1]: tempValue = A[i] A[i] = A[i+1] A[i+1] = tempValue return A print(bubbleSort([54,26,93,17,77,31,44,55,20])) def bubbleSortReverse(A): for k in range(...
def bubbleSort(A): tempValue = 0 for k in range(1, len(A)): flag = 0 for i in range(0, len(A) - k): if A[i+1] > A[i]: tempValue = A[i+1] A[i+1] = A[i] A[i] = tempValue flag += 1 if flag == 0: break ...
Python
0.000001
2998a776a702d8d8fbd3e5f54f263fce55ba621c
Correct number of new links printed by first scrape
mutube/mutuber.py
mutube/mutuber.py
""" Script to scrape /bleep/ and post to YouTube playlist Upcoming improvements include Management of `live_threads`. This could then be presented as a combination of a module and a script, with command line argument parsing, and inserted to mutube """ from .exceptions import NoPlaylist, BadVideo from .pla...
""" Script to scrape /bleep/ and post to YouTube playlist Upcoming improvements include Management of `live_threads`. This could then be presented as a combination of a module and a script, with command line argument parsing, and inserted to mutube """ from .exceptions import NoPlaylist, BadVideo from .pla...
Python
0
c2a99a33455e3b01ccce3faebd3a541b4a76e579
Bump version
yamale/__init__.py
yamale/__init__.py
from .yamale import make_schema, make_data, validate VERSION = (1, 0, 1, 'final', 0) # Dynamically calculate the version based on VERSION. def get_version(): "Returns a PEP 386-compliant version number from VERSION." version = VERSION assert len(version) == 5 assert version[3] in ('alpha', 'beta', '...
from .yamale import make_schema, make_data, validate VERSION = (1, 0, 0, 'final', 0) # Dynamically calculate the version based on VERSION. def get_version(): "Returns a PEP 386-compliant version number from VERSION." version = VERSION assert len(version) == 5 assert version[3] in ('alpha', 'beta', '...
Python
0
33b4c181b2d9a3d74f45ee1ced971b5bca58b35b
remove unused import
treenav/admin.py
treenav/admin.py
from django.contrib import admin from django.contrib.contenttypes import generic from treenav import models as treenav from treenav.forms import MenuItemForm, GenericInlineMenuItemForm class GenericMenuItemInline(generic.GenericStackedInline): """ Add this inline to your admin class to support editing relate...
from django.contrib import admin from django import forms from django.contrib.contenttypes import generic from treenav import models as treenav from treenav.forms import MenuItemForm, GenericInlineMenuItemForm class GenericMenuItemInline(generic.GenericStackedInline): """ Add this inline to your admin class ...
Python
0.000001
712989db37532a7810139dd2f7007c66652a0dd7
Fix documentation
ditto/flickr/management/commands/__init__.py
ditto/flickr/management/commands/__init__.py
from django.core.management.base import CommandError from ....core.management.commands import DittoBaseCommand class FetchCommand(DittoBaseCommand): """ Parent for all classes that fetch some things from Flickr. Photos, Photosets, Files, etc. """ def add_arguments(self, parser): "All chi...
from django.core.management.base import CommandError from ....core.management.commands import DittoBaseCommand class FetchCommand(DittoBaseCommand): """ Parent for all classes that fetch some things from Flickr. Photos, Photosets, Files, etc. """ def add_arguments(self, parser): "All chi...
Python
0.000001
6c8a9edb6d733ac680ea2cbcb1c8d12511aa72be
Update webserver.py
webserver.py
webserver.py
#!/usr/bin/env python # author: brendan@shellshockcomputer.com.au import ConfigParser from bottle import route, install, run, template, static_file, PasteServer from bottle_sqlite import SQLitePlugin import json import urllib import urllib2 import datetime config = ConfigParser.RawConfigParser() config.read('config....
#!/usr/bin/env python # author: brendan@shellshockcomputer.com.au import ConfigParser from bottle import route, install, run, template, static_file, PasteServer from bottle_sqlite import SQLitePlugin import json import urllib import urllib2 import datetime config = ConfigParser.RawConfigParser() config.read('config....
Python
0
5f839240a4223d599ad57393097bbc19502ae213
add condition not is_retracted
website/discovery/views.py
website/discovery/views.py
import datetime from website import settings from website.project import Node from website.project.utils import recent_public_registrations from modularodm.query.querydialect import DefaultQueryDialect as Q from framework.analytics.piwik import PiwikClient def activity(): popular_public_projects = [] popul...
import datetime from website import settings from website.project import Node from website.project.utils import recent_public_registrations from modularodm.query.querydialect import DefaultQueryDialect as Q from framework.analytics.piwik import PiwikClient def activity(): popular_public_projects = [] popul...
Python
0.001134
5820a92c7945657a38eb5b54eef5e47b2ff1ec39
Fix url coding
src/checker/plugin/links_finder_plugin.py
src/checker/plugin/links_finder_plugin.py
from bs4 import BeautifulSoup from yapsy.IPlugin import IPlugin from requests.exceptions import InvalidSchema from requests.exceptions import ConnectionError from requests.exceptions import MissingSchema import requests import urlparse import urllib import marisa_trie class LinksFinder(IPlugin): def __init__(self...
from bs4 import BeautifulSoup from yapsy.IPlugin import IPlugin from requests.exceptions import InvalidSchema from requests.exceptions import ConnectionError from requests.exceptions import MissingSchema import requests import urlparse import urllib import marisa_trie class LinksFinder(IPlugin): def __init__(self...
Python
0.999981
6902b88472826f6042dda6acda6f8a22d2fef64f
Change food color.
enactiveagents/model/structure.py
enactiveagents/model/structure.py
""" Module that holds classes that represent structures. """ import world class Structure(world.Entity): """ Class representing structures in the world (i.e., static but potentially interactable with by agents). """ def collidable(self): return True class Wall(Structure): """ Clas...
""" Module that holds classes that represent structures. """ import world class Structure(world.Entity): """ Class representing structures in the world (i.e., static but potentially interactable with by agents). """ def collidable(self): return True class Wall(Structure): """ Clas...
Python
0.000019
738ec72f78847bb31c89305247fcbe2d994117f0
Optimize case ObjectMixin.setUp
feder/cases/tests.py
feder/cases/tests.py
from django.core.urlresolvers import reverse from django.test import TestCase from feder.users.factories import UserFactory from feder.main.mixins import PermissionStatusMixin from .factories import CaseFactory class ObjectMixin(object): def setUp(self): self.user = UserFactory(username="john") se...
from django.core.urlresolvers import reverse from django.test import RequestFactory, TestCase from feder.monitorings.factories import MonitoringFactory from feder.cases.models import Case from feder.users.factories import UserFactory from feder.institutions.factories import InstitutionFactory from feder.main.mixins imp...
Python
0.001096
8f280cece4d59e36ebfeb5486f25c7ac92718c13
Clean it up a bit
third_problem.py
third_problem.py
not_vowel = 'bcdfghjklmnpqrtvwxyzBCDFGHJKLMNPQRTVWXYZ' phrase = input() output = '' vowels = '' # Remove sapces phrase = phrase.replace(' ', '') for char in phrase: if char in not_vowel: output += char # Add non vowel to output else: vowels += char # Add vowels to vowels print(output) pri...
letters = 'bcdfghjklmnpqrtvwxyzBCDFGHJKLMNPQRTVWXYZ' phrase = input() output = '' vowels = '' phrase = phrase.replace(' ', '') for char in phrase: if char in letters: output += char else: vowels += char print(output) print(vowels)
Python
0.000027
ac0d1036e56e8c24945abedbc372c717b5d7064a
improve imprort style.
zcode/constants.py
zcode/constants.py
"""Common Numerical and Physical Constants. """ import numpy as np import astropy as ap import astropy.constants import astropy.cosmology # from astropy.cosmology import WMAP9 as cosmo cosmo = astropy.cosmology.WMAP9 # Fundamental Constants # --------------------- NWTG = ap.constants.G.cgs.value SPLC = ap.constants.c...
"""Common Numerical and Physical Constants. """ import numpy as np import astropy as ap import astropy.constants import astropy.cosmology from astropy.cosmology import WMAP9 as cosmo # Fundamental Constants # --------------------- NWTG = ap.constants.G.cgs.value SPLC = ap.constants.c.cgs.value MSOL = ap.constants.M_s...
Python
0
68206c7f6b396d03470b0499716181f978996364
implement url_fix()
feedservice/utils.py
feedservice/utils.py
# -*- coding: utf-8 -*- # # This file is part of my.gpodder.org. # # my.gpodder.org is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or (at your # option) any later versi...
# # This file is part of my.gpodder.org. # # my.gpodder.org is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or (at your # option) any later version. # # my.gpodder.org i...
Python
0.000018
50e1edf150a715367e46d28f15ac8958bcc18644
Remove unused import
tinymce/views.py
tinymce/views.py
# coding: utf-8 # License: MIT, see LICENSE.txt """ django-tinymce4-lite views """ from __future__ import absolute_import import json import logging from django import VERSION from django.core.urlresolvers import reverse from django.http import JsonResponse, HttpResponse from django.template.loader import render_to_st...
# coding: utf-8 # License: MIT, see LICENSE.txt """ django-tinymce4-lite views """ from __future__ import absolute_import import json import logging from django import VERSION from django.core.urlresolvers import reverse from django.http import JsonResponse, HttpResponse from django.shortcuts import render from django...
Python
0.000001
b64e7714e581cfc0c0a0d0f055b22c5edca27e24
Raise KeyboardInterrupt to allow the run to handle logout
susumutakuan.py
susumutakuan.py
import discord import asyncio import os import signal import sys #Set up Client State CLIENT_TOKEN=os.environ['TOKEN'] #Create Discord client client = discord.Client() #Handle shutdown gracefully async def sigterm_handler(signum, frame): print("Logging out...") raise KeyboardInterrupt print('Shutting do...
import discord import asyncio import os import signal import sys #Set up Client State CLIENT_TOKEN=os.environ['TOKEN'] #Create Discord client client = discord.Client() #Handle shutdown gracefully def sigterm_handler(signum, frame): print("Logging out...") client.logout() print('Shutting down...') sy...
Python
0
13e30fe6af93bbb48a4795ee22f4f3ba760adc14
add get_session_names
tmuxback/tmux.py
tmuxback/tmux.py
# -*- coding:utf-8 -*- import subprocess import re #tmux commands #list sessions CMD_LIST_SESSIONS='tmux list-sessions -F#S' def get_session_names(): """ return a list of tmux session names """ s = subprocess.check_output(CMD_LIST_SESSIONS.split(' ')) s = re.sub('\n$','',s) return s.split('\n') #...
# -*- coding:utf-8 -*- def get_session_names(): """get session names""" pass
Python
0.000002