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
5938a5d751bcac40eac2bf7f7090e1970f097ebc
Add py-rq (#19175)
var/spack/repos/builtin/packages/py-rq/package.py
var/spack/repos/builtin/packages/py-rq/package.py
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyRq(PythonPackage): """RQ (Redis Queue) is a simple Python library for queueing jo...
Python
0
be3428c9fe6de7741cec7f3899bcc71049b113ca
Create HR_IntroToConditionalStatements.py
HR_IntroToConditionalStatements.py
HR_IntroToConditionalStatements.py
#!/bin/python3 import math import os import random import re import sys if __name__ == '__main__': #N = int(input()) # One liner in a lambda function print((lambda N:'Weird' if N % 2 else 'Not Weird')(int(input())))
Python
0
9f2fc78155dc725842ebbc82203994e26d1c7333
Add marv_ros skeleton for ROS specific code
code/marv-robotics/marv_ros/__init__.py
code/marv-robotics/marv_ros/__init__.py
# Copyright 2019 Ternaris. # SPDX-License-Identifier: AGPL-3.0-only
Python
0
cb29ce461eb143dc44b244576b153a0b7a3b1a7d
Create missing_element.py
missing_element.py
missing_element.py
""" There is an array of non-negative integers. A second array is formed by shuffling the elements of the first array and deleting a random element. Given these two arrays, find which element is missing in the second array. http://www.ardendertat.com/2012/01/09/programming-interview-questions/ """
Python
0.000189
527288828306c3620442e611fc9fb23180ee09fe
Add remove-nth-node-from-end-of-list
remove-nth-node-from-end-of-list.py
remove-nth-node-from-end-of-list.py
# Link: https://leetcode.com/problems/remove-nth-node-from-end-of-list/ # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # @param {ListNode} head # @param {integer} n # @return {ListNode} def removeNthF...
Python
0.000003
90218ad99cf9d9f4599f065790ac4d388adc3521
Add markup template filter.
blog/templatetags/markup.py
blog/templatetags/markup.py
from django import template from django.template.defaultfilters import stringfilter from django.utils.safestring import mark_safe from blog.models import markup register = template.Library() @register.filter @stringfilter def markup(value): result = markup(value) return mark_safe(result)
Python
0
28ed25a30ed495cce2d5ace3ac12c00f35f9dbcd
Add AmazonDriver
calplus/v1/object_storage/drivers/amazon.py
calplus/v1/object_storage/drivers/amazon.py
import boto3 from calplus.v1.object_storage.drivers.base import BaseDriver, BaseQuota PROVIDER = 'AMAZON' class AmazonDriver(BaseDriver): """AmazonDriver for Object Storage""" def __init__(self, cloud_config): super(AmazonDriver, self).__init__() self.aws_access_key_id = cloud_config['aws_...
Python
0.000001
b78518df363fb1cb398c70920f219ca9be78f816
Test another implementation of scipy's _spectral
pythran/tests/scipy/_spectral.py
pythran/tests/scipy/_spectral.py
# Author: Pim Schellart # 2010 - 2011 """Tools for spectral analysis of unequally sampled signals.""" import numpy as np #pythran export _lombscargle(float64[], float64[], float64[]) ##runas import numpy; x = numpy.arange(2., 12.); y = numpy.arange(1., 11.); z = numpy.arange(3., 13.); _lombscargle(x, y, z) def _lom...
Python
0
a1e679b4b0802f1c40d08f1f7cba212b13de61a4
Create testing2.py
myPack/testing2.py
myPack/testing2.py
import aldmbmtl aldmbmtl.toolbox.myPack.testing.test()
Python
0.000001
0ae07ef204806ab45b746df16371c3925ea894e9
Create problem6.py
Project-Euler/Problem6/problem6.py
Project-Euler/Problem6/problem6.py
""" [ref.href] https://projecteuler.net/problem=6 Sum square difference. The sum of the squares of the first ten natural numbers is: 1^2 + 2^2 + ... + 10^2 = 385 The square of the sum of the first ten natural numbers is: (1 + 2 + ... + 10)^2 = 55^2 = 3025 Hence the difference between the sum of the square...
Python
0.000035
a8b07a61b56f87509f33cd3f79e7800837ef4f29
Add lc0189_rotate_array.py
lc0189_rotate_array.py
lc0189_rotate_array.py
"""Leetcode 189. Rotate Array Easy URL: https://leetcode.com/problems/rotate-array/ Given an array, rotate the array to the right by k steps, where k is non-negative. Example 1: Input: [1,2,3,4,5,6,7] and k = 3 Output: [5,6,7,1,2,3,4] Explanation: rotate 1 steps to the right: [7,1,2,3,4,5,6] rotate 2 steps to the ri...
Python
0.000061
7bae6e3f490f4986f07ce45bf333a5982b505bd4
add 255
python/255_verify_preorder_sequence_in_binary_search_tree.py
python/255_verify_preorder_sequence_in_binary_search_tree.py
""" Given an array of numbers, verify whether it is the correct preorder traversal sequence of a binary search tree. You may assume each number in the sequence is unique. Follow up: Could you do it using only constant space complexity? """ class Solution(object): def verifyPreorder(self, preorder): """ ...
Python
0.999996
86686926809bfef55b71618888eec6667faaeec9
complete 26 reciprocal cycles
26-reciprocal-cycles.py
26-reciprocal-cycles.py
"""Based on chillee's answer at Fri, 6 Jan 2017, 05:06: There's so many convoluted substring solutions. 1/3 = 3/9 = 0.(3) 1/7 = 148257/999999 = 0.(148257) Therefore, the length of the repeating portion is length of the numerator when you set the denominator equal to some string of 9s. There's one other thing to keep...
Python
0.000069
4c6442382adcb716ea817fbc781a402dec36aac9
set app.debug = True.
app.py
app.py
from flask import Flask import redis import os from rq import Queue app = Flask(__name__) app.debug = True my_redis = redis.from_url( os.getenv("REDIS_URL", "redis://127.0.0.1:6379"), db=10 ) redis_rq_conn = redis.from_url( os.getenv("REDIS_URL", "redis://127.0.0.1:6379"), db=14 ) scopus_queue = Que...
from flask import Flask import redis import os from rq import Queue app = Flask(__name__) my_redis = redis.from_url( os.getenv("REDIS_URL", "redis://127.0.0.1:6379"), db=10 ) redis_rq_conn = redis.from_url( os.getenv("REDIS_URL", "redis://127.0.0.1:6379"), db=14 ) scopus_queue = Queue("scopus", conn...
Python
0.000067
3cd4a151f9f03ecf2674348e9377e00346bbd849
add first revision of the script
rtp.py
rtp.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from bs4 import BeautifulSoup import urllib2 import re import unicodedata import os import string validFilenameChars = "-_. %s%s" % (string.ascii_letters, string.digits) def removeDisallowedFilenameChars(filename): cleanedFilename = unicodedata.normalize('NFKD', file...
Python
0
8947167b0442b8d03cfd328fd77961a864f54638
Create double.py
CodeWars/8kyu/double.py
CodeWars/8kyu/double.py
def doubleInteger(i): return i + i
Python
0.000019
3f2a1aa0ce76dc50662e11da50149d0de231c848
add keys
keys.py
keys.py
G_EMAIL_KEY = ""
Python
0.000003
79b284a723303daa486b97c0da69eb1c4bf56a95
add latex for gini index
skbio/maths/diversity/alpha/gini.py
skbio/maths/diversity/alpha/gini.py
#!/usr/bin/env python from __future__ import division # ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this s...
#!/usr/bin/env python from __future__ import division # ---------------------------------------------------------------------------- # Copyright (c) 2013--, scikit-bio development team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with this s...
Python
0
cec1cc8082854a0fd61ea83bb69ba1e9d013b089
Create libs.py
libs.py
libs.py
# coding: utf-8 '''Библиотеки SEO модуля''' import sublime, sublime_plugin, re, urllib class xenuTools: def download_url_to_string(url): request = urllib.request.Request(url) response = urllib.request.urlopen(request) html = response.read() return html def getrobots(url): #TODO: split single line files...
Python
0.000001
25d90937ecce5e18e32a9f7e14b5744d21c14cfb
add simple box zoom example
examples/box_zoom.py
examples/box_zoom.py
import mpld3 from mpld3.plugins import PluginBase class BoxZoomPlugin(PluginBase): """Box Zoom""" JAVASCRIPT = r""" mpld3.BoxZoomPlugin = function(fig, prop){ this.fig = fig; this.prop = mpld3.process_props(this, prop, {}, []); // add a button to enable/disable box zoom mpld3.ButtonFactory({ t...
Python
0
636b02bbe33e60348b0171241b7a3c264f1c90a7
too soon. sorry
src/pyechonest/decorators.py
src/pyechonest/decorators.py
# from http://wiki.python.org/moin/PythonDecoratorLibrary#Memoize class memoized(object): """Decorator that caches a function's return value each time it is called. If called later with the same arguments, the cached value is returned, and not re-evaluated. """ def __init__(self, func): self...
Python
0.999999
c04610422ffd6e0fe87c62d7a8039116f804467c
Add jupyterhub config
jupyterhub_config.py
jupyterhub_config.py
import os import everware import jupyterhub.handlers.pages jupyterhub.handlers.pages.HomeHandler.get = everware.HomeHandler.get jupyterhub.handlers.pages.HomeHandler.post = everware.HomeHandler.post c = get_config() # spawn with custom docker containers c.JupyterHub.spawner_class = 'everware.CustomDockerSpawner' # ...
Python
0.000001
010f19ab2f9c0f3305d7f2eabcbbd33952a58fdd
Add a dir
stingroc/0002/0002.py
stingroc/0002/0002.py
print "0002"
Python
0.99927
1c6aebcf02d698c6a1722476978fb88fbf6c218d
Add CartPole TF HighLevel
src/CartPole-v0/TF_High_Level_NN.py
src/CartPole-v0/TF_High_Level_NN.py
import gym import time import random import numpy as np import tensorflow as tf from statistics import median, mean from collections import Counter import os tf.logging.set_verbosity(tf.logging.FATAL) LR = 1e-3 env = gym.make("CartPole-v0") env.reset() goal_steps = 500 score_requirement = 50 initial_games = 10000 ...
Python
0
287a89307af6ad720978682f49c01e39259303ec
Create censys_monitor.py
censys_monitor.py
censys_monitor.py
import censys.certificates import json import requests import os import random #UID = "" #SECRET = "" #api for remynseit and remynse UIDS = ["UID1", "UID2", "UID3"] SECRETS = {"secret": "value", "secret2": "value2"} ''' Search (utah.edu.*) AND NOT parsed.subject_dn.raw:/.*utah.edu/ ''' alert_webhook = '' known_cer...
Python
0.000001
731118d82aa41689f12adb32ea37be55be89a757
Add gpu_buffer.py
fafnir/gpu_buffer.py
fafnir/gpu_buffer.py
import panda3d.core as p3d class GpuBuffer: def __init__(self, name, count, data_type, data_format): self.buffer = p3d.Texture(name) self.data_type = data_type self.data_format = data_format self.resize(count) def resize(self, count): self.buffer.setup_buffer_texture( ...
Python
0.002058
3cb7c1cd73dfb73d96af15a183d4e7ef6a9369e8
create src
src/GitApi.py
src/GitApi.py
#!/usr/bin/env python # -*- coding:utf-8 -*- from requests import get from json import loads from argparse import ArgumentParser class GitHub(): def GetRepos(self, user): self.msg = "" req = loads(get('https://api.github.com/users/' + user + '/repos').text) self.m...
Python
0
4f751298176bf2118d4a638e106d5e9572725178
Add utility class
konstrukteur/Util.py
konstrukteur/Util.py
# # Konstrukteur - Static website generator # Copyright 2013 Sebastian Fastner # import re import unidecode def fixCoreTemplating(content): """ This fixes differences between core JS templating and standard mustache templating """ # Replace {{=tagname}} with {{&tagname}} content = re.sub(r"{{=(?P<tag>.+?)}}", "{{...
Python
0.000001
fea74aa88af88ea352b72525ecbf22a0fbd4e3db
Make a histogram and visualize it
ch02/histogram.py
ch02/histogram.py
# Load the parquet file containing flight delay records on_time_dataframe = spark.read.parquet('data/on_time_performance.parquet') # Register the data for Spark SQL on_time_dataframe.registerTempTable("on_time_performance") # Compute a histogram of departure delays on_time_dataframe\ .select("DepDelay")\ .rdd\ ...
Python
0.000114
168f6a9d557d1813649fd060dbfa1217355443df
Implement main for entry
cheat_ext/main.py
cheat_ext/main.py
from __future__ import print_function import argparse from cheat_ext.installer import ( install, upgrade, remove ) from cheat_ext.linker import link def _install(args): install(args.repository) link(args.repository) def _upgrade(args): upgrade(args.repository) def _remove(args): remove(args.r...
Python
0.000002
91bb20158513e5ba2a8fbaccb0c7b80ffabdb36b
Add demo for PyCUDA IAF trig-poly decoder.
demos/iaf_trig_cuda_demo.py
demos/iaf_trig_cuda_demo.py
#!/usr/bin/env python """ Demos for basic time encoding and decoding algorithms that use IAF neurons. The decoding algorithms assume a trigonometric polynomial approximation of the input signals. """ import sys import numpy as np # Set matplotlib backend so that plots can be generated without a # display: import mat...
Python
0
6420dc0127f0f33036fe0f9258d5350da5faef6d
Create filtering.py
sciquence/sequences/filtering.py
sciquence/sequences/filtering.py
def parallel_filter(condition, *lists): ''' Parallelly filter multiple lists. Parameters ---------- condition: callable A function, which has as many arguments as the number of lists lists: list of list Returns ------- filtered_lists: Filtered accordingly s...
Python
0.000001
17de8ac82776c0a44d2a62e0310a7868f913f537
add module for converting bte output to reasoner standard
biothings_explorer/bte2reasoner.py
biothings_explorer/bte2reasoner.py
import hashlib class ReasonerConverter(): def load_bte_query_path(self, path): """Load bte input query in the form of path params ====== path: the path of user input query """ self.path = path def load_bte_output(self, G): """Load bte output i...
Python
0
0bd93c02ab7917d570a74cf151dfb5789c3bf174
Add a brutal script for removing concepts in bulk while testing
scripts/remove_concepts_after.py
scripts/remove_concepts_after.py
# An entirely untested script to delete all the concepts in the # CATMAID database for a particular project. # Mark Longair 2010 import os from jarray import array from java.sql import DriverManager, Connection, SQLException, Types # FIXME: Just hardcode the user_id and project_id for the moment user_id = 3 proje...
Python
0
39b156cb3e208c3d06ced6fb086ab171209ac346
add ctable fixture
psi/ctable_mappings.py
psi/ctable_mappings.py
from ctable.fixtures import CtableMappingFixture from ctable.models import ColumnDef, KeyMatcher class EventsMapping(CtableMappingFixture): name = 'events' domains = ['psi-unicef', 'psi'] couch_view = 'psi/events' schedule_active = True @property def columns(self): columns = [ ...
Python
0.000001
f3a02b3570724964f60d10a8112e0d8eb32dddc7
Add 4chan download script
4chan.py
4chan.py
#!/usr/bin/python # Protip: want to monitor a thread and download all new images every 5 seconds? # while x= 0 ; do 4c [-nf] url; sleep 5; done import re, urllib, urllib2, argparse, os parser = argparse.ArgumentParser(description='Downloads all full-size images in one or more arbitrary 4chan threads.') par...
Python
0
8add47cf7d04f2f5e9cbea4eb036eb513e481ddd
fix populate argument
manage.py
manage.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import logging import click from quokka import create_app from quokka.ext.blueprints import blueprint_commands from quokka.core.db import db app = create_app() if app.config.get("LOGGER_ENABLED"): logging.basicConfig( level=getattr(logging, app.config.get("LOG...
#!/usr/bin/env python # -*- coding: utf-8 -*- import logging import click from quokka import create_app from quokka.ext.blueprints import blueprint_commands from quokka.core.db import db app = create_app() if app.config.get("LOGGER_ENABLED"): logging.basicConfig( level=getattr(logging, app.config.get("LOG...
Python
0.000003
b166caa9fb0efa4aceab315fd6a945d2fe6922e4
Patch fixed
erpnext/patches/v7_2/update_salary_slips.py
erpnext/patches/v7_2/update_salary_slips.py
import frappe from erpnext.hr.doctype.process_payroll.process_payroll import get_month_details def execute(): salary_slips = frappe.db.sql("""select fiscal_year, month, name from `tabSalary Slip` where (month is not null and month != '') and (fiscal_year is not null and fiscal_year != '') and (start_dat...
import frappe from erpnext.hr.doctype.process_payroll.process_payroll import get_month_details def execute(): salary_slips = frappe.db.sql("""select fiscal_year, month, name from `tabSalary Slip` where (month is not null and month != '') and (fiscal_year is not null and fiscal_year != '') and (start_dat...
Python
0.000001
c2151ae33c44f29d15d494d4862645beb33671cb
Add comments tests
kansha/card_addons/comment/tests.py
kansha/card_addons/comment/tests.py
# -*- coding:utf-8 -*- #-- # Copyright (c) 2012-2014 Net-ng. # All rights reserved. # # This software is licensed under the BSD License, as described in # the file LICENSE.txt, which you should have received as part of # this distribution. #-- from nagare import security from kansha.cardextension.tests import CardExt...
Python
0
29a05075e500635b10a25931045702888b12618f
add main file
main.py
main.py
import gas GASANALOG = 0 ALARMLED = 13 gas = machine.ADC(GASANALOG) gasLED = machine.Pin(ALARMLED, machine.Pin.OUT) g = gas.CheckGas(led=gasLED, sensor=gas, time=1000)
Python
0.000001
6b96008b3e89e3ff6a5616a68e49af3e41b2bc0b
Create main.py
main.py
main.py
#!/usr/bin/python """ __version__ = "$Revision: 1.3 $" __date__ = "$Date: 2004/04/14 02:38:47 $" """ import nID import plugin import os repository_nid="all_url:https://www.dropbox.com/s/tvyxx5iidodidz2/nid_sample_list.txt?dl=1@name:Sample Repo Name@owner:myselfminer" from PythonCard import model class MyBackground...
Python
0.000001
ec0ac308420a6cfd24b4093ef279deeb1f8728ec
Add a huge start-to-finish integration test.
tests/integration/test_full_integration.py
tests/integration/test_full_integration.py
#!/usr/bin/env python2.7 '''Test the full client access sequence. It is pretty much the anti-pattern of testing. ''' import unittest from tornado.web import Application from tornado.testing import AsyncHTTPTestCase import sys sys.path.append(".") import json from urllib import urlencode from authserver import PingH...
Python
0
9e388ad5b78967f87a0b3b55235bd1e19183c152
Test for the PaladinSpellSchema values
tests/models/spells/test_paladin_spells.py
tests/models/spells/test_paladin_spells.py
import unittest from tests.delete_test_db import delete_test_db # module that deletes the DB :) import database.main from tests.create_test_db import engine, session, Base database.main.engine = engine database.main.session = session database.main.Base = Base import models.main from models.spells.paladin_spells_tem...
Python
0
8303188f2378bace2974c5eac65fda8433629935
Add exercise 3 checking code
learntools/deep_learning_new/ex3.py
learntools/deep_learning_new/ex3.py
from learntools.core import * _inputs = 50 # Data Preparation class Q1(CodingProblem): _hint = "" _solution = "" def check(self): pass class Q2(CodingProblem): _var = "input_shape" _hints = [ "Think about whether you should look at the processed data `X_train` or the original data...
Python
0
803201baa32fb847f363b6807f92f2d0b6a51c51
Test that an error in pre_gen_project aborts generation
tests/test_abort_generate_on_hook_error.py
tests/test_abort_generate_on_hook_error.py
# -*- coding: utf-8 -*- import pytest from cookiecutter import generate from cookiecutter import exceptions @pytest.mark.usefixtures('clean_system') def test_pre_gen_hook(tmpdir): context = { 'cookiecutter': { "repo_dir": "foobar", "abort_pre_gen": "yes", "abort_post_...
Python
0.000002
b079edc37cd8abb68194637ee90b9fecc51b9b98
Add basic test for document quickcaching
corehq/apps/cachehq/tests.py
corehq/apps/cachehq/tests.py
from copy import deepcopy from mock import patch, MagicMock from django.test import SimpleTestCase from dimagi.ext import couchdbkit as couch from corehq.apps.cachehq.mixins import CachedCouchDocumentMixin class BlogPost(CachedCouchDocumentMixin, couch.Document): title = couch.StringProperty() body = couch.St...
Python
0
fa9421ef98d2dee2b9428d4165f5242aebe51a48
create cliconf plugin for enos - enos.py (#31509)
lib/ansible/plugins/cliconf/enos.py
lib/ansible/plugins/cliconf/enos.py
# This code is part of Ansible, but is an independent component. # This particular file snippet, and this file snippet only, is BSD licensed. # Modules you write using this snippet, which is embedded dynamically by # Ansible still belong to the author of the module, and may assign their own # license to the complete wo...
Python
0
c8cc6f4fc111d5dd2d55295e569a10cd5739ceee
test : fix for python 2.6
lib/spack/spack/test/environment.py
lib/spack/spack/test/environment.py
import unittest import os from spack.environment import EnvironmentModifications, apply_environment_modifications class EnvironmentTest(unittest.TestCase): def setUp(self): os.environ.clear() os.environ['UNSET_ME'] = 'foo' os.environ['EMPTY_PATH_LIST'] = '' os.environ['PATH_LIST'] ...
import unittest import os from spack.environment import EnvironmentModifications, apply_environment_modifications class EnvironmentTest(unittest.TestCase): def setUp(self): os.environ.clear() os.environ['UNSET_ME'] = 'foo' os.environ['EMPTY_PATH_LIST'] = '' os.environ['PATH_LIST'] ...
Python
0.000013
ce5ba72605e93e4fd83f36cced28d7c813c95e54
Create myfile.py
myfile.py
myfile.py
import os import re def searchByExt(rootpath, ext): print '----- File List -----' results = [] for root, dirs, files in os.walk(rootpath): for filename in files: if re.search(r'.*\.%s' % ext, filename): result = os.path.join(root, filename) results.appen...
Python
0.000011
b159433375714c67ac36e58d4323196222759f30
Add missing migration from 096092b.
babybuddy/migrations/0003_add_refresh_help_text.py
babybuddy/migrations/0003_add_refresh_help_text.py
# Generated by Django 2.0.5 on 2018-07-15 14:16 import datetime from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('babybuddy', '0002_add_settings'), ] operations = [ migrations.AlterField( model_name='settings', nam...
Python
0
0104f898a4a54027688411dd20d39aeecfc31f6d
Create player.py
player.py
player.py
import pygame import ss class Player(pygame.sprite.Sprite): def __init__(self, level, *groups): super(Player, self).__init__(*groups) self.Rimg = pygame.image.load('RangerDanR.png') self.Limg = pygame.image.load('RangerDanL.png') self.image = self.Rimg self.rect = pygame.rect.Rect((100,100), self.image.get_...
Python
0
59fa328c62cc7808bce365ddb1e0e1c0d744913b
add a basic reader
reader.py
reader.py
import feedparser rss_url = "http://towerjoo.github.io/feed.xml" feed= feedparser.parse(rss_url) import pdb;pdb.set_trace()
Python
0.000022
49f8a3de02d2e479232c327a3f78409a2297e173
Add a basic implementation of screen recording + audio
record.py
record.py
#!/usr/bin/env python3 # vim: set sts=4 sw=4 et tw=0 : # # Author: Nirbheek Chauhan <nirbheek.chauhan@gmail.com> # License: MIT # import sys, time from gi.repository import Gio, GLib def get_displays(): display_p = Gio.DBusProxy.new_for_bus_sync (Gio.BusType.SESSION, Gio.DBusProxyFlags.NONE, None, ...
Python
0
7a75185e7a7e7f5b3a1c78a21a6b75b24da1911a
Update __init__.py
tendrl/commons/flows/create_cluster/__init__.py
tendrl/commons/flows/create_cluster/__init__.py
# flake8: noqa import json import uuid from tendrl.commons import flows from tendrl.commons.event import Event from tendrl.commons.message import Message from tendrl.commons.flows import utils from tendrl.commons.flows.create_cluster import ceph_help from tendrl.commons.flows.create_cluster import gluster_help from t...
# flake8: noqa import json import uuid from tendrl.commons import flows from tendrl.commons.event import Event from tendrl.commons.message import Message from tendrl.commons.flows import utils from tendrl.commons.flows.create_cluster import ceph_help from tendrl.commons.flows.create_cluster import gluster_help from t...
Python
0.000072
021bf311598350e6fa976f72456e218c74bddbc6
Create mush.py
mush.py
mush.py
import base64 import os import pygsm import gzip #replace with 7zip (LZMA) import uuid import random import string import fnmatch import time import multiprocessing #Python 2.x #need modem info #need to auto-detect modem #need some sort of interface #replace x separator with semicolon #replace with port of GSM Modem ...
Python
0.000833
374f516be38e9630ff1ff6cda4146d0ebd2a9537
remove model
corehq/apps/sms/migrations/0048_delete_sqlicdsbackend.py
corehq/apps/sms/migrations/0048_delete_sqlicdsbackend.py
# Generated by Django 2.2.13 on 2020-10-28 09:55 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('sms', '0047_merge_20200918_1641'), ] operations = [ migrations.DeleteModel( name='SQLICDSBackend', ), ]
Python
0.000001
536e15458090b88962a0fd906b8f6dabfbad73d4
Add files via upload
sklearn/exercise_02_sentiment.py
sklearn/exercise_02_sentiment.py
"""Build a sentiment analysis / polarity model Sentiment analysis can be casted as a binary text classification problem, that is fitting a linear classifier on features extracted from the text of the user messages so as to guess wether the opinion of the author is positive or negative. In this examples we will use a ...
Python
0
6852d12aed061eb7bb9ad8750c0d57160c370427
check format strings for errors
pychecker2/FormatStringChecks.py
pychecker2/FormatStringChecks.py
from pychecker2.Check import Check from pychecker2.util import BaseVisitor from pychecker2.Warning import Warning from compiler import ast, walk from types import * import re class Unknown(Exception): pass def _compute_constant(node): try: if isinstance(node, ast.Const): return node.value ...
Python
0.000001
e41b79855e966977c4484efd4ad6a02475833b3e
Add ex4.4: tornado multiple requests with asyncio integration
code/ex4.4-tornado_with_asyncio.py
code/ex4.4-tornado_with_asyncio.py
from tornado.platform.asyncio import AsyncIOMainLoop, to_asyncio_future from tornado.httpclient import AsyncHTTPClient import asyncio import time URL = 'http://127.0.0.1:8000' @asyncio.coroutine def get_greetings(): http_client = AsyncHTTPClient() response = yield from to_asyncio_future(http_client.fetch(UR...
Python
0.000001
a8e66380cb63e52ad57f66cb9e1a652dca5b32b9
Create __init__.py
puppet/__init__.py
puppet/__init__.py
Python
0.000429
e81426b1f7890c056f926281c5a445bc6e74c80b
Create py-参数传递.py
py-参数传递.py
py-参数传递.py
# 包裹关键字传递 dic是一个字典 收集所有的关键字传递给函数func_t def func_t(**dic): print type(dic) print dic print func_t(a=1, b=2) print func_t(a=3, b=4, c=5)
Python
0.000005
4f265b626c9ff5c333ea6c27cb08b45c2cecc7f3
Add plugin code
gitcommitautosave.py
gitcommitautosave.py
"""Git Commit Auto Save. Sublime Text 3 package to auto save commit messages when the window is closed. This allows the user to close the window without having to save before, or having to deal with the "Save File" popup. """ import sublime_plugin class GitCommitAutoSave(sublime_plugin.EventListener): def on_load(s...
Python
0.000001
ac482caafe8c63de2606bb4894462f7b2e2bcb70
Add initial script to print rosbag files
python/printbag.py
python/printbag.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """Convert a rosbag file to legacy lidar binary format. """ """LIDAR datatype format is: ( timestamp (long), flag (bool saved as int), accelerometer[3] (double), gps[3] (double), distance[LIDAR_NUM_ANGLES] (long), ) 'int...
Python
0
a74cc0f4c06db4dad3007f52ec4eb062773700be
Create quora_duplicate.py
quora_duplicate.py
quora_duplicate.py
""" see: https://www.hackerrank.com/contests/quora-haqathon/challenges/duplicate """ import re from json import loads from sklearn.ensemble import RandomForestClassifier from sklearn.pipeline import Pipeline from sklearn.ensemble import BaggingClassifier from nltk.stem.lancaster import LancasterStemmer WORD_RE = re.c...
Python
0.003744
5cf2c2c4dcbc9e0cca57a7634e5118c2dc278c75
Add media compatibility
twilio/rest/resources/compatibility/media.py
twilio/rest/resources/compatibility/media.py
from twilio.rest.resources import InstanceResource, ListResource class Media(InstanceResource): pass class MediaList(ListResource): def __call__(self, message_sid): base_uri = "%s/Messages/%s" % (self.base_uri, message_sid) return MediaList(base_uri, self.auth, self.timeout)
Python
0
a2e566cc0b925f80c30602141e890cdf9b13306b
Migrate to latest version of db.
migrations/versions/1003fd6fc47_.py
migrations/versions/1003fd6fc47_.py
"""empty message Revision ID: 1003fd6fc47 Revises: 1a54c4cacbe Create Date: 2015-03-24 13:33:50.898511 """ # revision identifiers, used by Alembic. revision = '1003fd6fc47' down_revision = '1a54c4cacbe' from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql def upgrade(): ###...
Python
0
38cf6ee407468e192101cbd456411c56cbf09e68
Add example of distribution fit on any selected feature
examples/extract_distribution.py
examples/extract_distribution.py
#!/usr/bin/env python # Copyright (c) 2015, Ecole Polytechnique Federale de Lausanne, Blue Brain Project # All rights reserved. # # This file is part of NeuroM <https://github.com/BlueBrain/NeuroM> # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the fo...
Python
0
4aced6fea8ff8ccd087362cb237a9f00d111d0d8
Add command to turn on locations flag
corehq/apps/commtrack/management/commands/toggle_locations.py
corehq/apps/commtrack/management/commands/toggle_locations.py
from django.core.management.base import BaseCommand from corehq.apps.domain.models import Domain from corehq.feature_previews import LOCATIONS from corehq.toggles import NAMESPACE_DOMAIN from toggle.shortcuts import update_toggle_cache, namespaced_item from toggle.models import Toggle class Command(BaseCommand): ...
Python
0.000001
1eaab9f929dc748e57865fb4c8717158e6c47fa5
Add more index on contact activities
ureport/stats/migrations/0018_better_indexes.py
ureport/stats/migrations/0018_better_indexes.py
# Generated by Django 3.2.6 on 2021-10-13 12:37 from django.db import migrations # language=SQL INDEX_SQL_CONTACTACTIVITY_ORG_DATE_SCHEME_NOT_NULL = """ CREATE INDEX IF NOT EXISTS stats_contactactivity_org_id_date_scheme_not_null on stats_contactactivity (org_id, date, scheme) WHERE scheme IS NOT NULL; """ class Mi...
Python
0
9becada645e9680974dbb18fee10983d204dfd3d
Create low-res cubes, masks, and moment arrays
14B-088/HI/analysis/cube_pipeline_lowres.py
14B-088/HI/analysis/cube_pipeline_lowres.py
''' Convolve the VLA + GBT data to 2 * beam and 5 * beam, then run the masking and moments pipeline. Make signal masks and compute the moments. ''' from astropy import log import os from radio_beam import Beam from spectral_cube import SpectralCube from cube_analysis import run_pipeline from paths import (fourteenB...
Python
0.000001
7651b436e9d817ffae7f8c64f6ee8088dd1ae889
Add hall.py
raspberry/hall.py
raspberry/hall.py
import os import sys import smbus import time import datetime import RPi.GPIO as GPIO import PyCmdMessenger import subprocess import gpsd import threading import Adafruit_Nokia_LCD as LCD import Adafruit_GPIO.SPI as SPI import lcd_menu as menu from queue import Queue from PIL import Image from PIL import ImageDraw fr...
Python
0.000102
d0a053acf6773c24b5fce2ec1ac56a5800ca1a28
Add discord return types to VoiceStateUpdate props
musicbot/constructs.py
musicbot/constructs.py
import discord from .utils import objdiff class SkipState: def __init__(self): self.skippers = set() self.skip_msgs = set() @property def skip_count(self): return len(self.skippers) def reset(self): self.skippers.clear() self.skip_msgs.clear() def add_sk...
import discord from .utils import objdiff class SkipState: def __init__(self): self.skippers = set() self.skip_msgs = set() @property def skip_count(self): return len(self.skippers) def reset(self): self.skippers.clear() self.skip_msgs.clear() def add_sk...
Python
0
8fbd7421e9517ead4293c62086f3305810c93b1b
Add initial manage/fabfile/ci.py (sketch)
manage/fabfile/ci.py
manage/fabfile/ci.py
from fabric.api import * @task @role('ci') def install(): sudo("apt-get install git") sudo("apt-get install maven2") # TODO: maven3 sudo("apt-get install groovy") # TODO: groovy-1.8, or gradle... configure_groovy_grapes() sudo("apt-get install python-dev") sudo("apt-get install python-pip") ...
Python
0
95d87c541ebf82109b882daebcb5b387f0f1cdb8
Read the american physics society graph
exp/influence2/ReputationExp2.py
exp/influence2/ReputationExp2.py
import numpy try: ctypes.cdll.LoadLibrary("/usr/local/lib/libigraph.so") except: pass import igraph from apgl.util.PathDefaults import PathDefaults from exp.util.IdIndexer import IdIndexer import xml.etree.ElementTree as ET import array metadataDir = PathDefaults.getDataDir() + "aps/aps-dataset-metada...
Python
0.000047
8f391cfd541f68a3c4bfc20be68c32d4e2d6798f
Add server script
server.py
server.py
#!/usr/bin/python3 # import the necessary components from flask import Flask, request, jsonify app = Flask(__name__) # define a dictionary to store our information in info = {} # listen for data at /data @app.route("/data", methods=["GET", "POST"]) def api(): # convert the data to a dict data = request.get_json(si...
Python
0.000001
0cb5d2f3294167ec20f20a5a3239704961e7b421
convert proper motions
gary/coordinates/propermotion.py
gary/coordinates/propermotion.py
# coding: utf-8 """ ...explain... """ from __future__ import division, print_function __author__ = "adrn <adrn@astro.columbia.edu>" # Standard library import os import sys # Third-party import numpy as np from astropy import log as logger import astropy.coordinates as coord import astropy.units as u __all__ = ['p...
Python
0.999992
a49d1d96b49eb6006e864bbaf2757cd5358b0110
Create func.py
func.py
func.py
#it's fun, c? def read_poi(file): poi_dict = {} #taken from project2 for line in file: line = line.rstrip() if len(line) == 0: continue parts = line.split(' ', 2) print(parts[0],parts[1],parts[2]) poi_dict[parts[2]] = parts[0],parts[1] return poi_dic...
Python
0.000037
4810c88d484bc02fe5f7983dbf9cac0be5a440cd
Create reverse_word_order.py
09-revisao/practice_python/reverse_word_order.py
09-revisao/practice_python/reverse_word_order.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Exercise 15: Reverse Word Order Write a program (using functions!) that asks the user for a long string containing multiple words. Print back to the user the same string, except with the words in backwards order. For example, say I type the string: My name is Mich...
Python
0.998843
c460874436ee087a50f9f7ec06c15ae9a110a656
Initialize web spider class definition & imports
spider.py
spider.py
from scrapy.contrib.spiders import CrawlSpider, Rule from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor from scrapy.selector import Selector
Python
0
3f6e3d60588dec447fffbfc7e5fc65f34cbd3aa7
fix bug in version.py subprocess call
cobra/version.py
cobra/version.py
#!/usr/bin/env python """ Tracks the version number. If git is installed and file script is located within a git repository, git describe is used to get the version information. This version string is sanitized to comply with PEP 386 and stored in the RELEASE-VERSION file. If git describe can not be run, the RELEASE-...
#!/usr/bin/env python """ Tracks the version number. If git is installed and file script is located within a git repository, git describe is used to get the version information. This version string is sanitized to comply with PEP 386 and stored in the RELEASE-VERSION file. If git describe can not be run, the RELEASE-...
Python
0.000001
10e1866abffadf61f8593159006b8dbf431afd6b
Add convert module tests
tests/test_convert.py
tests/test_convert.py
""" Tests for the NURBS-Python package Released under The MIT License. See LICENSE file for details. Copyright (c) 2018 Onur Rauf Bingol Tests B-Spline to NURBS conversions. Requires "pytest" to run. """ from geomdl import BSpline from geomdl import convert SAMPLE_SIZE = 5 C_DEGREE = 2 C_CTRLPTS = [...
Python
0
957490251e5038d9fb963f0c43ea3973e763c134
Add test
tests/test_plotter.py
tests/test_plotter.py
from moca.plotter import create_plot import os import pytest @pytest.mark.mpl_image_compare(baseline_dir='data/images', filename='ENCSR000AKB_PhyloP_1.png') def join_path(head, leaf): return os.path.join(head, leaf) def test_image(): base_path = 'tests/data/ENCSR000AKB/' me...
Python
0.000005
08047dddf65f44bf4312e639ad0009bd1ab6f837
Add routing tests (incl. one xfail for nesting)
tests/test_routing.py
tests/test_routing.py
from unittest.mock import MagicMock import django import pytest from django.conf.urls import url from channels.http import AsgiHandler from channels.routing import ChannelNameRouter, ProtocolTypeRouter, URLRouter def test_protocol_type_router(): """ Tests the ProtocolTypeRouter """ # Test basic oper...
Python
0
ed0a2a8fc20a44499d9db03d2eb8fcd58c1b0cd3
Add unit tests
tests/test_session.py
tests/test_session.py
# Local imports from uplink import session def test_base_url(uplink_builder_mock): # Setup uplink_builder_mock.base_url = "https://api.github.com" sess = session.Session(uplink_builder_mock) # Run & Verify assert uplink_builder_mock.base_url == sess.base_url def test_headers(uplink_builder_mock...
Python
0.000001
f1b22c952dabb3b66638000078e1ab2d0b7acea2
Add missing utils file
homedisplay/homedisplay/utils.py
homedisplay/homedisplay/utils.py
import redis import json redis_instance = redis.StrictRedis() def publish_ws(key, content): redis_instance.publish("home:broadcast:generic", json.dumps({"key": key, "content": content}))
Python
0
f338d34e750fd4d06cd0992c7f457c403b1cff3b
add a simple tool to dump the GETLBASTATUS provisioning status
tools/getlbastatus.py
tools/getlbastatus.py
#!/usr/bin/env python # coding: utf-8 import sys from pyscsi.pyscsi.scsi import SCSI from pyscsi.pyscsi.scsi_device import SCSIDevice from pyscsi.pyscsi.scsi_enum_getlbastatus import P_STATUS def usage(): print 'Usage: getlbastatus.py [--help] [-l <lba>] <device>' def main(): i = 1 lba = 0 while i...
Python
0
f7f122be60e8ffe03f8d449d619b21ec314b37a1
Include total sync time used in sync_status_stats.
stats_cron.py
stats_cron.py
from tapiriik.database import db from datetime import datetime, timedelta # total distance synced distanceSynced = db.sync_stats.aggregate([{"$group": {"_id": None, "total": {"$sum": "$Distance"}}}])["result"][0]["total"] # sync time utilization db.sync_worker_stats.remove({"Timestamp": {"$lt": datetime.utcnow() - ti...
from tapiriik.database import db from datetime import datetime, timedelta # total distance synced distanceSynced = db.sync_stats.aggregate([{"$group": {"_id": None, "total": {"$sum": "$Distance"}}}])["result"][0]["total"] # sync time utilization db.sync_worker_stats.remove({"Timestamp": {"$lt": datetime.utcnow() - ti...
Python
0
46c816f169b29a8fe91f14ab477222873d9bed88
Add DocTestParser
robot/docparser.py
robot/docparser.py
import re class DocTestParser(object): """Find all externaltestcaseid's in a test's docstring. If your externaltestcaseid prefix is abc and the test has 'abc-123' in it's docstring. `DocTestParser('abc').get_testcases()` would return `['abc-123']`. """ def __init__(self, doc_matcher=None, doc_mat...
Python
0
4f2c91c06ab13eec02ef0199ef45d0eeaf555ea7
Add dunder init for lowlevel.
astrodynamics/lowlevel/__init__.py
astrodynamics/lowlevel/__init__.py
# coding: utf-8 from __future__ import absolute_import, division, print_function
Python
0
6473cf17576fb0f52c653d96e22c4c9bf316250a
Remove elipses from examples instead of commenting them out
src/etc/extract-tests.py
src/etc/extract-tests.py
# Script for extracting compilable fragments from markdown # documentation. See prep.js for a description of the format # recognized by this tool. Expects a directory fragements/ to exist # under the current directory, and writes the fragments in there as # individual .rs files. import sys, re; if len(sys.argv) < 3: ...
# Script for extracting compilable fragments from markdown # documentation. See prep.js for a description of the format # recognized by this tool. Expects a directory fragements/ to exist # under the current directory, and writes the fragments in there as # individual .rs files. import sys, re; if len(sys.argv) < 3: ...
Python
0
de10593be3c513d41423dffcedd220c02dd37d6c
Add config_default.py
config_default.py
config_default.py
# -*- coding: utf-8 -*- """ Created on 2015-10-23 08:06:00 @author: Tran Huu Cuong <tranhuucuong91@gmail.com> """ import os # Blog configuration values. # You may consider using a one-way hash to generate the password, and then # use the hash again in the login view to perform the comparison. This is just # for sim...
Python
0.000004
95bb2d362e6a41b4e6421b5e8752b5040ea23d3f
Test file
main.py
main.py
from flir.stream import Stream from flir.flir import FLIR import time #h = Stream("129.219.136.149", 4000) #h.connect() #time.sleep(5) #h.write("PP-500".encode("ascii")) x = FLIR("129.219.136.149", 4000) x.connect() x.pan(30) print(x.pan()) x.pan_offset(10) print(x.pan()) x.stream.close()
Python
0.000001
e2020af5ccd41f8571a2d0db4f5345ca9a8b561e
Add migration for db changes
gmn/src/d1_gmn/app/migrations/0010_auto_20170805_0107.py
gmn/src/d1_gmn/app/migrations/0010_auto_20170805_0107.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.2 on 2017-08-05 01:07 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('app', '0009_auto_20170603_0546'), ] operations = [...
Python
0
a0cd167b9f19e2a4a9d1f2a80bc3586cce15c6ab
Add GMN DB migration to current
gmn/src/d1_gmn/app/migrations/0019_auto_20190418_1512.py
gmn/src/d1_gmn/app/migrations/0019_auto_20190418_1512.py
# Generated by Django 2.2 on 2019-04-18 20:12 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('app', '0018_auto_20180901_0115'), ] operations = [ migrations.AlterModelOptions( name='eventlog', options={}, ), ...
Python
0
c86b9051ac87f9ceb2b406e2816b4e946454f4a4
Create main.py
main.py
main.py
from xml.dom import minidom import urllib2 from time import sleep #get gamday URL #gameday=raw_input("Please paste the URL of the game you wish to track: ") #str(gameday) #get the xml. Use linescore.xml html=urllib2.urlopen('http://gd2.mlb.com/components/game/mlb/year_2017/month_07/day_04/gid_2017_07_04_kcamlb_sea...
Python
0.000001
9ffc52e4cfabff9ee1bd669d76e25c54a3cafffc
Revert "shit"
main.py
main.py
# GetJams - get some new jams for ya mental import musicbrainzngs as jams import random,sys,os,wx jams.set_useragent("GetJams","1.0","inhumanundead@gmail.com") def GetArtist(genre): x = jams.search_artists(tag=genre)['artist-list'] y = [] y.append(x[random.randint(0,len(x)-1)]['sort-name']) y.append(x[random.rand...
Python
0
3586ad5bae877ca2473b6329671aaa076d45f09a
Implement DHCPRELEASE functionality
src/hades/deputy/dhcp.py
src/hades/deputy/dhcp.py
import ctypes import random import socket from contextlib import closing from typing import Optional import logging import netaddr logger = logging.getLogger(__name__) class DHCPPacket(ctypes.BigEndianStructure): _pack_ = 1 _fields_ = ( ("op", ctypes.c_ubyte), ("htype", ctypes.c_ubyte), ...
Python
0
a6ef1e2456f84b50102c4192984b0c18b9c81a27
Create scriptGenerator.py
scriptGenerator.py
scriptGenerator.py
#!/usr/bin/env python #GENERATE A NEW SCRIPT def Creation(): fichero=open('generator.py','w') fichero.close() def Save(): fichero=open('generator.py','a') fichero.write('from PyQt4.QtGui import *\n') fichero.write('import sys\n') fichero.write('class Window(QWidget):\n') fichero.write('\tdef __init__(self,parent=None)...
Python
0.000001
f3f07d6e8218d523227c63eea4b088573ca632ef
Add release script
scripts/release.py
scripts/release.py
#!/usr/bin/env python from __future__ import annotations import subprocess from dataclasses import dataclass from datetime import datetime from pathlib import Path from typing import TYPE_CHECKING, Literal, overload from zoneinfo import ZoneInfo import click if TYPE_CHECKING: from typing_extensions import Self ...
Python
0.000001
844810f393724684d855e6e12fd20c392b6f06a0
check if key even exists before going into os.environ
src/pyechonest/config.py
src/pyechonest/config.py
""" Global configuration variables for accessing the Echo Nest web API. """ ECHO_NEST_API_KEY = None __version__ = "$Revision: 0 $" # $Source$ import os if('ECHO_NEST_API_KEY' in os.environ): ECHO_NEST_API_KEY = os.environ['ECHO_NEST_API_KEY'] else: ECHO_NEST_API_KEY = None API_HOST = 'developer.echonest....
""" Global configuration variables for accessing the Echo Nest web API. """ ECHO_NEST_API_KEY = None __version__ = "$Revision: 0 $" # $Source$ import os if(os.environ['ECHO_NEST_API_KEY']): ECHO_NEST_API_KEY = os.environ['ECHO_NEST_API_KEY'] else: ECHO_NEST_API_KEY = None API_HOST = 'developer.echonest.co...
Python
0.000001