commit stringlengths 40 40 | subject stringlengths 1 3.25k | old_file stringlengths 4 311 | new_file stringlengths 4 311 | old_contents stringlengths 0 26.3k | lang stringclasses 3
values | proba float64 0 1 | diff stringlengths 0 7.82k |
|---|---|---|---|---|---|---|---|
3b8d2cc0279e4da1ab758251f00fd065d951df53 | Add base for `help` command | foxybot/commands/help.py | foxybot/commands/help.py | Python | 0.000004 | @@ -0,0 +1,761 @@
+%22%22%22Command to retrieve help for other commands and topics%22%22%22%0A%0A%0Afrom command import AbstractCommand, bot_command%0Afrom bot_help import HelpManager%0A%0A@bot_command%0Aclass Help(AbstractCommand):%0A _aliases = ('help', 'h')%0A%0A async def execute(self, shards, client, msg):%0... | |
453df6abe7741fe0f24c03754b26c197fa282656 | Create ValidateBST_002_iter.py | leetcode/098-Validate-Binary-Search-Tree/ValidateBST_002_iter.py | leetcode/098-Validate-Binary-Search-Tree/ValidateBST_002_iter.py | Python | 0.000001 | @@ -0,0 +1,685 @@
+# Definition for a binary tree node.%0A# class TreeNode(object):%0A# def __init__(self, x):%0A# self.val = x%0A# self.left = None%0A# self.right = None%0A%0Aclass Solution(object):%0A def isValidBST(self, root):%0A %22%22%22%0A :type root: TreeNode%0A ... | |
0e5bbc4df461c17ff7d1297ee4236afaa9e52a96 | Create solution.py | leetcode/easy/remove_duplicates_from_sorted_array/py/solution.py | leetcode/easy/remove_duplicates_from_sorted_array/py/solution.py | Python | 0.000018 | @@ -0,0 +1,578 @@
+class Solution(object):%0A def removeDuplicates(self, nums):%0A %22%22%22%0A :type nums: List%5Bint%5D%0A :rtype: int%0A %22%22%22%0A %0A # Without this check, the function%0A # will return slow + 1 when called%0A # with an empty array. This ... | |
e8fa15603b275a690d96e37ab9dc560e68dedbb1 | Add tests | test/test_02.py | test/test_02.py | Python | 0.000001 | @@ -0,0 +1,1635 @@
+import unittest%0A%0Aimport os%0Aimport sys%0Aimport lrmq%0Aimport timeout_decorator%0Aimport tempfile%0A%0Aimport pickle%0Aimport struct%0A%0Aimport asyncio%0A%0ATEST_TIMEOUT = 5 # it can fail in slow environment%0A%0Adef read_log(fn):%0A logs = %5B%5D%0A with open(fn, %22rb%22) as f:%0A ... | |
74550ef0c76a941c473c8d024ccc0a0403631c49 | Add basic structure for "/glossary" routes test | wqflask/tests/integration/test_markdown_routes.py | wqflask/tests/integration/test_markdown_routes.py | Python | 0.000021 | @@ -0,0 +1,457 @@
+%22Integration tests for markdown routes%22%0Aimport unittest%0A%0Afrom bs4 import BeautifulSoup%0A%0Afrom wqflask import app%0A%0A%0Aclass TestGenMenu(unittest.TestCase):%0A %22%22%22Tests for glossary%22%22%22%0A%0A def setUp(self):%0A self.app = app.test_client()%0A%0A def tearDown... | |
5e1c48f9d00266290a8739f88085f050b1baa805 | Add test_backend.py in preparation for migrating backend to rigor's database layer | test_backend.py | test_backend.py | Python | 0 | @@ -0,0 +1,1830 @@
+#!/usr/bin/env python%0A%0Aimport types%0Aimport pprint%0A%0Aimport backend%0Aimport config%0Afrom utils import *%0A%0ADBNAME = config.CROWD_DB%0A%0A%0AdebugMain('dbQueryDict')%0Asql = 'SELECT COUNT(*) FROM image;'%0Aconn = backend.getDbConnection(DBNAME)%0Agen = backend.dbQueryDict(conn, sql)%0Aass... | |
a5d93698ad5ae1e6488b536abb8501cd6ec70551 | Add memory usage report to cost analyzer tool; run all default optimizations. | tensorflow/python/grappler/cost_analyzer_tool.py | tensorflow/python/grappler/cost_analyzer_tool.py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Python | 0 | @@ -2247,25 +2247,16 @@
aph)%0A%0A
-if FLAGS.
rewriter
@@ -2267,24 +2267,9 @@
fig
-is not None:%0A
+=
rew
@@ -2284,47 +2284,69 @@
nfig
- = r
+_pb2.R
ewriter
-_c
+C
onfig
-_pb2.R
+()%0A if FLAGS.r
ewriter
-C
+_c
onfig
-()
+ is not None:
%0A
@@ -2406,18 +2406,16 @@
nfig)%0A
-
-
optimize
@@ -247... |
961040f13f1d2b2d8aea019a6649f29f858d2a09 | Correct cleanup code for shutting down firefox in python bindings | py/selenium/webdriver/firefox/webdriver.py | py/selenium/webdriver/firefox/webdriver.py | # Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | Python | 0.000014 | @@ -3316,16 +3316,110 @@
pass%0A
+ if %22marionette%22 in self.capabilities and self.capabilities%5B'marionette'%5D is True:%0A
@@ -3450,16 +3450,35 @@
-'''
+else:%0A
try:%0A
+
@@ -3522,32 +3522,36 @@
th)%0A
+
+
if self.profile.
@@ -3582,32 +3582,3... |
986ff101ce224494a5cdb047a1aefd99c8a6d840 | Add an aioredis example | examples/sanic_aioredis_example.py | examples/sanic_aioredis_example.py | Python | 0.000038 | @@ -0,0 +1,809 @@
+%22%22%22 To run this example you need additional aioredis package%0A%22%22%22%0Afrom sanic import Sanic, response%0Aimport aioredis%0A%0Aapp = Sanic(__name__)%0A%0A%0A@app.route(%22/%22)%0Aasync def handle(request):%0A async with request.app.redis_pool.get() as redis:%0A await redis.set('t... | |
e355a926155355ccc5d8b545534f331bdb683f02 | Add management | podcastsync.py | podcastsync.py | Python | 0.000001 | @@ -0,0 +1,564 @@
+import click%0Afrom getpass import getpass%0Afrom gposerver import create_app, db, User, Device, EpisodeAction%0A%0Aapp = create_app()%0A%0A@app.shell_context_processor%0Adef make_shell_context():%0A return dict(app=app, db=db, User=User, Device=Device, EpisodeAction=EpisodeAction)%0A%0A@app.cli.c... | |
1786ebacb85b2ddce816fb21b80285d991761695 | Implement classes to be used by the deserializer | poyo/_nodes.py | poyo/_nodes.py | Python | 0 | @@ -0,0 +1,2242 @@
+# -*- coding: utf-8 -*-%0A%0A%0Aclass TreeElement(object):%0A %22%22%22Helper class to identify internal classes.%22%22%22%0A def __init__(self, **kwargs):%0A pass%0A%0A%0Aclass ContainerMixin(object):%0A %22%22%22Mixin that can hold TreeElement instances.%0A%0A Containers can be ... | |
9f276fba97318431d85c08fc0718b30bf39ed1bf | Create add-one-row-to-tree.py | Python/add-one-row-to-tree.py | Python/add-one-row-to-tree.py | Python | 0.000017 | @@ -0,0 +1,2104 @@
+# Time: O(n)%0A# Space: O(h)%0A%0A# Given the root of a binary tree, then value v and depth d,%0A# you need to add a row of nodes with value v at the given depth d. The root node is at depth 1.%0A#%0A# The adding rule is: given a positive integer depth d,%0A# for each NOT null tree nodes N in depth... | |
2e7e83a0c3b789a0d0ba89134b64a0f6b723c3af | add forgotten path-building test | bids/layout/tests/test_path_building.py | bids/layout/tests/test_path_building.py | Python | 0.000002 | @@ -0,0 +1,583 @@
+import pytest%0Afrom bids.layout import BIDSLayout%0Afrom os.path import join, abspath, sep%0Afrom bids.tests import get_test_data_path%0A%0A%0A@pytest.fixture(scope='module')%0Adef layout():%0A data_dir = join(get_test_data_path(), '7t_trt')%0A return BIDSLayout(data_dir)%0A%0Adef test_bold_co... | |
4582edfe2b138fd63645caddde198dc7fee9bd0a | Fix adb_install_apk, broken by 9b3e716. | build/android/adb_install_apk.py | build/android/adb_install_apk.py | #!/usr/bin/env python
#
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utility script to install APKs from the command line quickly."""
import argparse
import logging
import os
import sys
from py... | Python | 0.000003 | @@ -2934,32 +2934,37 @@
ll %25s', args.apk
+_name
)%0A device_b
@@ -3168,16 +3168,21 @@
args.apk
+_name
)%0A
|
b447711c4396c36bc845184961d28660735c6f3d | Create window.py | src/new/window.py | src/new/window.py | Python | 0.000001 | @@ -0,0 +1,380 @@
+# window draws%0A%0A# editor window%0Aclass EditorWindow(Fl_Double_Window) :%0A%09search = %22%22%0A%09def __init__(self, w, h, label) :%0A%09%09Fl_Double_Window.__init__(self, w, h, label)%0A%0A# set/update title%0Adef set_title(win):%0A%09global filename, title%0A%09if len(filename) == 0:%0A%09%09t... | |
7ef6c8c3ea0e2481a424bcca91496ce14c0aec4a | add basic file verifier, just checks dimensions, need to add header and vlr checks. | misc/file_verify.py | misc/file_verify.py | Python | 0 | @@ -0,0 +1,651 @@
+#!/usr/bin/env python%0Aimport sys%0Asys.path.append(%22../%22)%0A%0Afrom laspy import file as File%0AinFile1 = File.File(sys.argv%5B1%5D,mode= %22r%22)%0AinFile2 = File.File(sys.argv%5B2%5D,mode= %22r%22)%0A%0Aspec = inFile1.reader.point_format.lookup.keys()%0A%0Adef f(x):%0A return(list(inFile1.... | |
895571ec359e7571f8581f3635ae1c452ed911a5 | add a nova command | cloudmesh_cmd3/plugins/cm_shell_nova.py | cloudmesh_cmd3/plugins/cm_shell_nova.py | Python | 0.000013 | @@ -0,0 +1,2287 @@
+from cmd3.shell import command%0Afrom cloudmesh_common.logger import LOGGER%0Aimport os%0Afrom cloudmesh_common.tables import row_table%0A%0Alog = LOGGER(__file__)%0A%0A%0Aclass cm_shell_nova:%0A%0A %22%22%22opt_example class%22%22%22%0A%0A def activate_cm_shell_nova(self):%0A self.regi... | |
c6a3db1c3fcd99e9dcbf4d6052a8882363c4bc21 | minor change. rename pyunit test name | h2o-py/tests/testdir_misc/pyunit_as_date.py | h2o-py/tests/testdir_misc/pyunit_as_date.py | import sys
sys.path.insert(1, "../../")
import h2o, tests
def download_pojo():
hdf = h2o.import_file(path=h2o.locate("smalldata/jira/v-11.csv"))
print hdf.head()
# NB: columns 1,5 are currently unsupported as date types
# that is, h2o cannot understand:
# 1 integer days since epoch (or since any other date)... | Python | 0.999963 | @@ -56,29 +56,28 @@
ts%0A%0Adef
-download_pojo
+test_as_data
():%0A hd
@@ -2574,19 +2574,18 @@
gv,
-download_pojo
+test_as_data
)%0A
|
2bf2a0849c1524f3ac56533d9f36eb907213f819 | Add WebAPI plugin | proxy/plugins/WebAPI.py | proxy/plugins/WebAPI.py | Python | 0 | @@ -0,0 +1,456 @@
+from ..data import clients, blocks, players%0Afrom twisted.web.server import Site%0Afrom twisted.web.resource import Resource%0Aimport json, time%0A%0AupStart = time.strftime(%22%25a, %25d %25b %25Y %25H:%25M:%25S +0000%22, time.gmtime())%0A%0Aclass WebAPI(Resource):%0A%09def render_GET(self, request... | |
19348f5d8e2832fbf378578d38516df66dc849b6 | Implement IRCv3.1 StartTLS | heufybot/modules/ircv3/starttls.py | heufybot/modules/ircv3/starttls.py | Python | 0.999316 | @@ -0,0 +1,1823 @@
+from twisted.internet.interfaces import ISSLTransport%0Afrom twisted.plugin import IPlugin%0Afrom heufybot.moduleinterface import BotModule, IBotModule%0Afrom zope.interface import implements%0A%0Atry:%0A from twisted.internet import ssl%0Aexcept ImportError:%0A ssl = None%0A%0A%0Aclass IRCv3S... | |
63e14ae4485bcca682b952e5ab7f125f58c3d960 | Add pwnypack ipython extension. | pwnypack/ipython_ext.py | pwnypack/ipython_ext.py | Python | 0 | @@ -0,0 +1,454 @@
+import functools%0Aimport shlex%0Aimport pwny%0Aimport pwnypack.main%0A%0A%0A__all__ = %5B%5D%0A%0A%0Adef call_main_func(func_name, ipython, line):%0A pwnypack.main.main(%5Bfunc_name%5D + shlex.split(line))%0A%0A%0Adef load_ipython_extension(ipython):%0A ipython.push(vars(pwny))%0A for f_nam... | |
7fbfca47b2b435a0aa4df8d39699831f752f351d | Add initial code for scraping standings data | pybaseball/standings.py | pybaseball/standings.py | Python | 0 | @@ -0,0 +1,1248 @@
+from bs4 import BeautifulSoup%0Aimport requests%0Aimport datetime%0A%0Adef get_soup(date):%0A%09#year, month, day = %5Btoday.strftime(%22%25Y%22), today.strftime(%22%25m%22), today.strftime(%22%25d%22)%5D%0A%09#url = %22http://www.baseball-reference.com/boxes?year=%7B%7D&month=%7B%7D&day=%7B%7D%22.f... | |
d187c51ccd9dc1676b6f16eddecee6dce752d668 | Make class test-class name more specific | distarray/tests/test_client.py | distarray/tests/test_client.py | import unittest
from IPython.parallel import Client
from distarray.client import DistArrayContext
class TestClient(unittest.TestCase):
def setUp(self):
self.client = Client()
self.dv = self.client[:]
def testCreateDAC(self):
'''Can we create a plain vanilla context?'''
dac = ... | Python | 0 | @@ -103,21 +103,31 @@
ass Test
-Clien
+DistArrayContex
t(unitte
@@ -239,22 +239,24 @@
def test
-C
+_c
reate
+_
DAC(self
@@ -409,22 +409,26 @@
test
-C
+_c
reate
+_
DAC
+_
with
-T
+_t
arge
|
b5d8b29a34a4675ad5de33511bfca486f648a134 | Create _source.py | static/_source.py | static/_source.py | Python | 0.000002 | @@ -0,0 +1,1264 @@
+# coding: utf-8%0A%0A# BlackSmith general configuration file%0A%0A# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-%0A%0A# Jabber server to connect%0ASERVER = 'example.com'%0A%0A# Connecting Port%0APORT = 5222%0A%0A# Jabber server%60s connecting Host%0AHOST = 'example.com'%0A%0A# Usin... | |
647f0c1409dcd22d69a79d21571d2c03f794a2a8 | Test iter and yield | 99_misc/iterator.py | 99_misc/iterator.py | Python | 0 | @@ -0,0 +1,302 @@
+#/usr/bin/env python%0A# Test yield generator%0Adef my_double(arr):%0A for i in arr:%0A yield i * 2%0A%0Afor i in my_double(range(1, 10)):%0A print(%22%7B0%7D %22.format(i)),%0A%0Aprint(%22%5Cn%22),%0A%0A# Text iteration%0Ai = iter(my_double(range(10, 21)))%0Aprint i%0Afor j in range (1,... | |
28944376472130d53a05f7473e7213c917207cd4 | Add model representing a listing | apartments/models.py | apartments/models.py | Python | 0 | @@ -0,0 +1,811 @@
+from sqlalchemy import create_engine, Column, DateTime, Float, Integer, String%0Afrom sqlalchemy.ext.declarative import declarative_base%0A%0ABase = declarative_base()%0A%0A%0Aclass Listing(Base):%0A __tablename__ = 'listings'%0A%0A id = Column(Integer, primary_key=True)%0A craigslist_id = C... | |
38cbc73f70a9ca896a29d7fa2e000388bbf40d88 | Add script to generate data from an experiment | DilipadTopicModelling/experiment_get_results.py | DilipadTopicModelling/experiment_get_results.py | Python | 0 | @@ -0,0 +1,1516 @@
+import logging%0Aimport os%0Aimport pandas as pd%0A%0Afrom CPTCorpus import CPTCorpus%0Afrom CPT_Gibbs import GibbsSampler%0A%0Alogger = logging.getLogger(__name__)%0Alogging.basicConfig(format='%25(levelname)s : %25(message)s', level=logging.INFO)%0A%0A# select experiment to get parameters from%0An... | |
656d94c0375f6a96cc3a9d4b3227d8f19afe3dea | Add lemon drop elevator model | control/systems/main.py | control/systems/main.py | Python | 0 | @@ -0,0 +1,245 @@
+import numpy as np%0A%0AKt = 1.41/89.0%0AKv = 5840.0/3.0%0AG = 10.0%0AJ = 4.0*(2.54**2.0)/2.0 # 4 kg on a 1 inch pully%0AR = 12.0/89.0%0A%0AA = np.asarray(%5B%5B0, 1%5D,%0A %5B0, -(Kt*Kv)/((G**2)*J*R)%5D%5D)%0AB = np.asarray(%5B%5B0%5D,%0A %5BKt/(G*J*R)%5D%5D)%0A
| |
2ca0d97649529dfc66486dc1d3e7fa1e37d8ee91 | add integration test for api analytics | integrations/test_api_analytics.py | integrations/test_api_analytics.py | Python | 0 | @@ -0,0 +1,1632 @@
+%22%22%22Integration tests for internal analytics.%22%22%22%0A%0A# standard library%0Aimport unittest%0A%0A# third party%0Aimport mysql.connector%0Aimport requests%0A%0A%0A# use the local instance of the Epidata API%0ABASE_URL = 'http://delphi_web_epidata/epidata/api.php'%0A%0A%0Aclass ApiAnalyticsT... | |
8cc622db293816fc96bb7df0139b57a2b5a2eaef | add scanning of live IP addresses with ping sweep, multi threading | Scan_IpAdds_ping.py | Scan_IpAdds_ping.py | Python | 0 | @@ -0,0 +1,2547 @@
+import os, platform, collections%0Aimport socket, subprocess,sys%0Aimport threading%0Afrom datetime import datetime%0A%0Aclass myThread (threading.Thread):%0A def __init__(self,startLastOctet,endLastOctet):%0A threading.Thread.__init__(self)%0A self.startLastOctet = startLastOctet%0A self.... | |
e670de6ecb7be3da56acf2976148574165cb69aa | Add missing test module | h5py/tests/test_utils.py | h5py/tests/test_utils.py | Python | 0.000002 | @@ -0,0 +1,2340 @@
+#+%0A# %0A# This file is part of h5py, a low-level Python interface to the HDF5 library.%0A# %0A# Copyright (C) 2008 Andrew Collette%0A# http://h5py.alfven.org%0A# License: BSD (See LICENSE.txt for full license)%0A# %0A# $Date$%0A# %0A#-%0Aimport sys%0Aimport numpy%0A%0Afrom common import HDF5TestC... | |
3fd4244dbfd33bbf2fa369d81756e82b1cf1c467 | Clear out unaligned NLCD19 GWLF-E results | src/mmw/apps/modeling/migrations/0041_clear_nlcd2019_gwlfe_results.py | src/mmw/apps/modeling/migrations/0041_clear_nlcd2019_gwlfe_results.py | Python | 0 | @@ -0,0 +1,1245 @@
+# Generated by Django 3.2.13 on 2022-10-17 13:47%0A%0Afrom django.db import migrations%0A%0A%0Adef clear_nlcd2019_gwlfe_results(apps, schema_editor):%0A %22%22%22%0A Clear the results for all scenarios belonging to GWLF-E projects made after%0A the release of 1.33.0, which had incorrectly a... | |
34046e290842108212d71f6cf2445d7015bf2423 | Create text.py | dasem/text.py | dasem/text.py | Python | 0.000103 | @@ -0,0 +1,718 @@
+%22%22%22text.%22%22%22%0A%0A%0Afrom nltk import sent_tokenize, word_tokenize%0A%0A%0Adef sentence_tokenize(text):%0A %22%22%22Tokenize a Danish text into sentence.%0A%0A The model from NTLK trained on Danish is used.%0A%0A Parameters%0A ----------%0A text : str%0A The text to b... | |
477de06a99fc4998ec15442e5fae9b919be53392 | Initialize P2_scheduledComicDownloader | books/AutomateTheBoringStuffWithPython/Chapter15/PracticeProjects/P2_scheduledComicDownloader.py | books/AutomateTheBoringStuffWithPython/Chapter15/PracticeProjects/P2_scheduledComicDownloader.py | Python | 0 | @@ -0,0 +1,518 @@
+# Write a program that checks the websites of several web comics and automatically%0A# downloads the images if the comic was updated since the program%E2%80%99s last visit.%0A#%0A# Your operating system%E2%80%99s scheduler (Scheduled Tasks on Windows, launchd on OS X,%0A# and cron on Linux) can run y... | |
5dad4f0e2d9732d7ff4a0feebff332f005cabf01 | Remove foreign keys from deprecated `progress-edx-platform-extensions` (#1874) | common/djangoapps/database_fixups/migrations/0002_remove_foreign_keys_from_progress_extensions.py | common/djangoapps/database_fixups/migrations/0002_remove_foreign_keys_from_progress_extensions.py | Python | 0 | @@ -0,0 +1,3219 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%22%22%22%0AThe %60progress-edx-platform-extensions%60 has been deprecated in favor of %60edx-completion%60.%0AThe requirement was removed in the commit linked as (1) below. However its migra... | |
9eb35140a1790625c32773af6b8a2d76699e86c6 | Move MapEntityForm to mapentity (ref #129) | mapentity/forms.py | mapentity/forms.py | Python | 0 | @@ -0,0 +1,1744 @@
+from django.utils.translation import ugettext_lazy as _%0A%0Aimport floppyforms as forms%0Afrom crispy_forms.helper import FormHelper%0Afrom crispy_forms.layout import Layout, Submit, Div, Button%0Afrom crispy_forms.bootstrap import FormActions%0A%0A%0Aclass MapEntityForm(forms.ModelForm):%0A pk ... | |
2a5012f0b74fa025bbc909fd8bfb10aec272d148 | Create pawn-brotherhood.py | home/pawn-brotherhood.py | home/pawn-brotherhood.py | Python | 0.99898 | @@ -0,0 +1,799 @@
+def safe_pawns ( pawns ) :%0A %0A n = 0%0A %0A for file , rank in pawns :%0A %0A if rank %3C %222%22 : continue%0A %0A if file %3E %22a%22 :%0A %0A first = chr( ord(file) - 1) + str( int(rank) - 1 )%0A %0A if first in... | |
632be2720287425387454fbe2bd9ce1c7eb2cdfb | basic tests | Orange/widgets/data/tests/test_owconcatenate.py | Orange/widgets/data/tests/test_owconcatenate.py | Python | 0.999568 | @@ -0,0 +1,2447 @@
+# Test methods with long descriptive names can omit docstrings%0A# pylint: disable=missing-docstring%0A%0Aimport numpy as np%0A%0Afrom Orange.data import Table%0Afrom Orange.widgets.data.owconcatenate import OWConcatenate%0Afrom Orange.widgets.tests.base import WidgetTest%0A%0A%0Aclass TestOWConcate... | |
eda9d7d6f80ddc1733c395e8f78dab4103f8aaad | version bump for 0.26.3. | oneflow/__init__.py | oneflow/__init__.py |
VERSION = '0.26.2.4'
| Python | 0 | @@ -14,10 +14,8 @@
.26.
-2.4
+3
'%0A%0A
|
7267966b9718b5a57c397447aad075cacb212f39 | version bump for 0.26.1.12. | oneflow/__init__.py | oneflow/__init__.py |
VERSION = '0.26.1.11'
| Python | 0 | @@ -13,12 +13,12 @@
0.26.1.1
-1
+2
'%0A%0A
|
ef026ce3b4bf7fc50499ce5ecb688c02bbc77544 | Add outline for orbital maneuver class | orbital/maneuver.py | orbital/maneuver.py | Python | 0 | @@ -0,0 +1,728 @@
+class Maneuver:%0A def __init__(self):%0A pass%0A%0A @classmethod%0A def raise_apocenter_by(cls, delta, orbit):%0A pass%0A%0A @classmethod%0A def change_apocenter_to(cls, apocenter, orbit):%0A pass%0A%0A @classmethod%0A def lower_apocenter_by(cls, delta, orbi... | |
c191959db6b1a14d527ec41f910682fd017421ee | fix for handling spaces in sys.executable and in sut_path (issue 166) | doc/quickstart/testlibs/LoginLibrary.py | doc/quickstart/testlibs/LoginLibrary.py | import os
import sys
class LoginLibrary:
def __init__(self):
sut_path = os.path.join(os.path.dirname(__file__),
'..', 'sut', 'login.py')
self._command_prefix = '%s %s ' % (sys.executable, sut_path)
self._status = ''
def create_user(self, username, pass... | Python | 0 | @@ -109,16 +109,32 @@
dirname(
+os.path.abspath(
__file__
@@ -134,16 +134,17 @@
_file__)
+)
,%0A
@@ -226,21 +226,25 @@
efix = '
+%22
%25s
-
+%22 %22
%25s
+%22
' %25 (sy
|
ede05f2196dc7e96df01176f20b39772ac26e1ae | add python/logviewer.py | python/logviewer.py | python/logviewer.py | Python | 0.000003 | @@ -0,0 +1,2017 @@
+#!/usr/bin/python3%0A%0Aimport io, os, re, sys%0Afrom http import HTTPStatus, server%0A%0AFILE = None%0A%0AINDEX = %22%22%22%3C!DOCTYPE html%3E%0A%3Cmeta charset=%22utf-8%22%3E%0A%3Ctitle%3ELog Viewer%3C/title%3E%0A%3Cscript%3E%0Avar logBox = null;%0Avar lastOffset = 0;%0Afunction initialize() %7B%0... | |
3cbb02ebb1ba195f373c4b9238a49c30039f821e | revert changes | python/lottosend.py | python/lottosend.py | Python | 0.000001 | @@ -0,0 +1,1988 @@
+import json%0Aimport urllib2%0Aclass LottosendSDK:%0A%09#= Imports%09%0A%09%0A%09#= Contrusctor%0A%09def __init__(self):%09%09%09%09%0A%09%09self.token = ''%0A%09%09self.lottosend_api = ''%0A%09%09self.results_api = ''%0A%09%09self.auto_login_url = ''%09%09%0A%0A%09# signup user in lottosend system%... | |
490af74a5b52d8014a8c3e13cfa6f015a4927cf4 | add a merge migration to ensure the two lead nodes don't cause a crash during a deploy | accelerator/migrations/0021_merge_20181011_1153.py | accelerator/migrations/0021_merge_20181011_1153.py | Python | 0 | @@ -0,0 +1,367 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.10.8 on 2018-10-11 15:53%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('accelerator', '0020_criterion_verbose_names'),%0A ('... | |
46cef615f9d10279ea4907a542a87e4af22b37cd | Add A* pathfinding algorithm to utilities. | enactiveagents/utilities/pathfinding.py | enactiveagents/utilities/pathfinding.py | Python | 0 | @@ -0,0 +1,2978 @@
+%22%22%22%0AModule containing pathfinding utilities.%0A%22%22%22%0A%0Aimport model%0Aimport Queue%0A%0Aclass Pathfinding(object):%0A%0A @staticmethod%0A def get_neighbours(world, position):%0A %22%22%22%0A Get all neighbours of a given position (cell).%0A%0A :param world: ... | |
0ba701bd4459273df726e33709ae0e441bd4a767 | migrate username field to 150 chars | email_auth/migrations/0003_django110.py | email_auth/migrations/0003_django110.py | Python | 0.000002 | @@ -0,0 +1,833 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.10.4 on 2016-12-27 09:08%0Afrom __future__ import unicode_literals%0A%0Afrom django import VERSION%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('email_auth', '0002_aut... | |
650dab63187c6355ce735687d8c9bb06909602bd | remove [contribute] prefix on emails (bug 731369) | apps/mozorg/views.py | apps/mozorg/views.py | from django.core.mail import EmailMessage
from django.views.decorators.csrf import csrf_exempt
from django.conf import settings
import jingo
from product_details import product_details
import basket
import l10n_utils
from forms import ContributeForm, NewsletterCountryForm
@csrf_exempt
def contribute(request):
def... | Python | 0 | @@ -3334,21 +3334,8 @@
= '
-%5BContribute%5D
Inqu
|
659e9ef52aa7fe47bfab7c731c8e028d1f564904 | Allow another process to process submission info if the assigned one dies. #183 | judge/rabbitmq/daemon.py | judge/rabbitmq/daemon.py | import json
import logging
from os import getpid
from . import connection
logger = logging.getLogger('judge.handler')
class AMQPResponseDaemon(object):
def __init__(self):
self.chan = connection.connect().channel()
self._judge_response_handlers = {
'acknowledged': self.on_acknowledg... | Python | 0 | @@ -893,16 +893,50 @@
ags = %7B%7D
+%0A self._submission_ack = %7B%7D
%0A%0A de
@@ -1254,32 +1254,103 @@
perties, body):%0A
+ try:%0A id = int(body)%0A except ValueError:%0A
chan.bas
@@ -1394,39 +1394,8 @@
ag)%0A
- if not body.isdigit():%0A
@@ -1491,30 +1... |
ed20a93e917cfdddc5cd49cc6446b6e80fb4573d | Migrate symbtr uuid field to django type | makam/migrations/0007_auto_20150812_1615.py | makam/migrations/0007_auto_20150812_1615.py | Python | 0.000001 | @@ -0,0 +1,741 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0Aimport django_extensions.db.fields%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('makam', '0006_auto_20150727_1631'),%0A %5D%0A%0A operations... | |
e142530eef5754d4314d97f0d9e144f348d3909a | add docs_create_missing_stubs | maintenance/docs_create_missing_stubs.py | maintenance/docs_create_missing_stubs.py | Python | 0 | @@ -0,0 +1,1620 @@
+import os%0Aimport subprocess%0A%0A# hardcoded paths%0AHUNTER_DIR='..'%0APACKAGES_DIR=os.path.join(HUNTER_DIR, 'cmake/projects')%0ADOCS_PKG_DIR=os.path.join(HUNTER_DIR, 'docs', 'packages', 'pkg')%0A%0A# get all wiki entries%0Adocs_filenames = %5Bx for x in os.listdir(DOCS_PKG_DIR) if x.endswith('.rs... | |
52c50ca6e4c5d2ee75300617c5da118fb1136e76 | Add custom plot style contour_image. | mplstyles/plots.py | mplstyles/plots.py | Python | 0 | @@ -0,0 +1,1200 @@
+from matplotlib import cm%0Aimport matplotlib.pyplot as plt%0Afrom mplstyles import cmap as colormap%0Aimport numpy as np%0A%0Adef contour_image(x,y,Z,cmap=None,vmax=None,vmin=None,interpolation='nearest',contour_labelsize=9,contour_opts=%7B%7D,imshow_opts=%7B%7D,clegendlabels=%5B%5D,label=False):%0... | |
e2a0a27e853e1e8c8913e9851d2a7aa0fb18b3ee | add exception test | tests/exceptions_test.py | tests/exceptions_test.py | Python | 0.000001 | @@ -0,0 +1,1466 @@
+# -*- coding: utf-8 -%0A#%0A# Copyright (c) 2008 (c) Benoit Chesneau %3Cbenoitc@e-engura.com%3E %0A#%0A# Permission to use, copy, modify, and distribute this software for any%0A# purpose with or without fee is hereby granted, provided that the above%0A# copyright notice and this permission notice ap... | |
9231511307631ad92b896941607c4e5f3c7704ce | Create new script for attaching and releasing the gripper's compressor glove. | cs473_baxter/scripts/glove.py | cs473_baxter/scripts/glove.py | Python | 0 | @@ -0,0 +1,1281 @@
+#!/usr/bin/env python%0A%0Aimport argparse%0A%0Aimport rospy%0A%0Aimport baxter_interface%0A%0Aclass Glove():%0A%09def __init__(self, gripper):%0A%09%09self.gripper = Gripper(gripper)%0A%0A%09%09# Verify robot is enabled%0A%09%09print %22Getting robot state...%22%0A%09%09self._rs = baxter_interface.... | |
bc2a707ea12716612422959b107b72c84d9dc946 | add test for dump_table_to_json() | tests/test_dump_table.py | tests/test_dump_table.py | Python | 0.000001 | @@ -0,0 +1,1416 @@
+import scraperwiki%0Aimport unittest%0Afrom dc_base_scrapers.common import dump_table_to_json%0A%0A%0Aclass DumpTableTests(unittest.TestCase):%0A%0A def test_dump_table(self):%0A # create tables with same columns in different order%0A scraperwiki.sqlite.execute(%22%22%22CREATE TABLE... | |
5207d3c91d64170d783388a064334e495b3b562c | Add a new test for the latest RegexLexer change, multiple new states including '#pop'. | tests/test_regexlexer.py | tests/test_regexlexer.py | Python | 0.000007 | @@ -0,0 +1,965 @@
+# -*- coding: utf-8 -*-%0A%22%22%22%0A Pygments regex lexer tests%0A ~~~~~~~~~~~~~~~~~~~~~~~~~~%0A%0A :copyright: 2007 by Georg Brandl.%0A :license: BSD, see LICENSE for more details.%0A%22%22%22%0A%0Aimport unittest%0A%0Afrom pygments.token import Text%0Afrom pygments.lexer import RegexL... | |
9445433b54fcbd7f56617fff853b761107bc94cc | Test add | a.py | a.py | Python | 0 | @@ -0,0 +1,29 @@
+%22%22%22%0AComment%0A%22%22%22%0Aprint %22apa%22%0A%0A
| |
c1b34a71306af1c38f305981dc1d50135b2887d8 | add the missing new executor.py file | asyncio/executor.py | asyncio/executor.py | Python | 0.000004 | @@ -0,0 +1,2378 @@
+from .log import logger%0A%0A__all__ = (%0A 'CancelledError', 'TimeoutError',%0A 'FIRST_COMPLETED', 'FIRST_EXCEPTION', 'ALL_COMPLETED',%0A )%0A%0A# Argument for default thread pool executor creation.%0A_MAX_WORKERS = 5%0A%0Atry:%0A import concurrent.futures%0A import concurrent.future... | |
fad65e68b3fcfa736ba5d6e62fbe0588100dc153 | Create gdax-myTrades-pagination.py | examples/py/gdax-myTrades-pagination.py | examples/py/gdax-myTrades-pagination.py | Python | 0 | @@ -0,0 +1,1045 @@
+# -*- coding: utf-8 -*-%0A%0Aimport os%0Aimport sys%0A%0Aroot = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))%0Asys.path.append(root + '/python')%0A'''%0AExample snippet to traverse GDAX / CoinBase Pro pagination.%0AUseful for reaching back more than 100 myTrades, the ... | |
6cc59b5ad1b70e0b303680d9e58c8d8158bec1e6 | Create solution.py | hackerrank/algorithms/implementation/easy/sock_merchant/py/solution.py | hackerrank/algorithms/implementation/easy/sock_merchant/py/solution.py | Python | 0.000018 | @@ -0,0 +1,205 @@
+#!/bin/python3%0A%0Aimport sys%0Aimport collections%0A%0An = int(input().strip())%0Ac = map(int, input().strip().split(' '))%0A%0ApairCount = sum(count // 2 for count in collections.Counter(c).values())%0A%0Aprint(pairCount)%0A
| |
bf01ea13c046d711939c1bb0aaedf9fbbc7c638d | Add initial systemd module | salt/modules/systemd.py | salt/modules/systemd.py | Python | 0.000001 | @@ -0,0 +1,1246 @@
+'''%0AProvide the service module for systemd%0A'''%0A%0Adef __virtual__():%0A '''%0A Only work on systems which default to systemd%0A '''%0A if __grains__%5B'os'%5D == 'Fedora' and __grains__%5B'osrelease'%5D %3E 15:%0A%09 return 'service'%0A return False%0A%0Adef start(name):%0A '''%0A... | |
b1738d70e3a90e7bf27c9eeccb25b09403b74f1a | Add transport factory | devicehive/transport.py | devicehive/transport.py | Python | 0.000004 | @@ -0,0 +1,574 @@
+def init(name, data_format, data_format_options, handler, handler_options):%0A transport_class_name = '%25sTransport' %25 name.title()%0A transport_module = __import__('devicehive.transports.%25s_transport' %25 name,%0A fromlist=%5Btransport_class_name%5D)%0A ... | |
9ba1dd92919fb37862e6e94bf55cc25e7be3b009 | add co.py | co.py | co.py | Python | 0.000044 | @@ -0,0 +1,1021 @@
+#!/bin/env python3%0Aimport functools%0Adef coroutine(f):%0A @functools.wraps(f)%0A def _coroutine(*args, **kwargs):%0A active_coroutine = f(*args, **kwargs)%0A next(active_coroutine)%0A return active_coroutine%0A return _coroutine%0A@coroutine%0Adef simple_coroutine():... | |
2158408476733010b7416d474226bb3522619aeb | Add level to Group serializer (refs GH-1475) | src/sentry/api/serializers/models/group.py | src/sentry/api/serializers/models/group.py | from __future__ import absolute_import
from collections import defaultdict
from datetime import timedelta
from django.core.urlresolvers import reverse
from django.utils import timezone
from sentry.api.serializers import Serializer, register
from sentry.app import tsdb
from sentry.constants import TAG_LABELS
from sent... | Python | 0 | @@ -3706,16 +3706,62 @@
SOLVED,%0A
+ 'level': obj.get_level_display(),%0A
|
02844d3a2ed329a02afaaf8dc1ad07407768a68b | Create app.py | app.py | app.py | Python | 0.000003 | @@ -0,0 +1,843 @@
+# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4%0Afrom flask import Flask%0Afrom flask import request%0Aimport requests%0A%0Aapp = Flask(__name__)%0A%0A%0Adef get_allergies():%0A URL = 'http://saallergy.info/today'%0A HEADERS = %7B'accept': 'application/json'%7D%0A r = requ... | |
43d73b7bdc8b38b3e2e583a0321936ab80c0f4e0 | Add bot.py | bot.py | bot.py | Python | 0 | @@ -0,0 +1,135 @@
+import praw%0A%0Ar = praw.Reddit('/u/powderblock Glasses Bot')%0A%0Afor post in r.get_subreddit('all').get_new(limit=5):%0A%09print(str(post.url))%0A
| |
42389c93d11de00b50b08fcd1eca74fbe3941365 | Create banner-generator.py | banner-generator.py | banner-generator.py | Python | 0.000001 | @@ -0,0 +1,525 @@
+#!/usr/bin/python%0A%0A#####################################################%0A# grabs a banner image from flaming text%0A# and saves it to the project directory as banner.png%0A#####################################################%0A%0Aimport urllib%0Aimport random%0A%0Aword_file = %22words.txt%22%0... | |
45b789010409e4e2e2afc88cb776c8b70e7768ec | Add unit test for DakotaBase | dakota/tests/test_dakota_base.py | dakota/tests/test_dakota_base.py | Python | 0 | @@ -0,0 +1,690 @@
+#!/usr/bin/env python%0A#%0A# Tests for dakota.dakota_base module.%0A#%0A# Call with:%0A# $ nosetests -sv%0A#%0A# Mark Piper (mark.piper@colorado.edu)%0A%0Aimport os%0Aimport filecmp%0Afrom nose.tools import *%0Afrom dakota.dakota_base import DakotaBase%0A%0A%0A# Fixtures --------------------------... | |
b0ec56421c65c744c62c98850b69719fa6c351a1 | Update base.py | docs/examples/pyramid/base.py | docs/examples/pyramid/base.py | __author__ = 'Bhoomit'
import json
from pyramid.response import Response as PyramidResponse
from oauth2.web import Response
from oauth2.error import OAuthInvalidError, \
ClientNotFoundError, OAuthInvalidNoRedirectError, UnsupportedGrantError, ParameterMissingError
from oauth2.client_authenticator import ClientAuth... | Python | 0.000001 | @@ -1,27 +1,4 @@
-__author__ = 'Bhoomit'%0A
%0Aimp
@@ -2527,8 +2527,9 @@
n/json%22)
+%0A
|
b1aebcccfb3f29bf3bc35ea4e73ba0e86dc0e64d | Fix message output method. | python/OmniSharp.py | python/OmniSharp.py | import vim, urllib2, urllib, urlparse, logging, json, os, os.path, cgi
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from SocketServer import ThreadingMixIn
logger = logging.getLogger('omnisharp')
logger.setLevel(logging.WARNING)
log_dir = os.path.join(vim.eval('expand("<sfile>:p:h")'), '..', 'log')
... | Python | 0.000038 | @@ -1338,22 +1338,26 @@
nd(%22
-call confirm('
+echo 'OmniSharp :
Coul
@@ -1388,17 +1388,16 @@
get + %22'
-)
%22)%0A
|
a5bce21ccfb1a0d231a7d5d782c0e572d8bca86a | use sesolve instead of mesolve for unitary evolution in propagator | qutip/propagator.py | qutip/propagator.py | # This file is part of QuTiP.
#
# QuTiP 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.
#
# QuTiP is distributed in the ... | Python | 0 | @@ -1041,24 +1041,58 @@
ort mesolve%0A
+from qutip.sesolve import sesolve%0A
from qutip.e
@@ -3251,33 +3251,33 @@
output =
-m
+s
esolve(H, psi0,
@@ -3282,28 +3282,24 @@
, tlist, %5B%5D,
- %5B%5D,
args, optio
|
661766d003c85ded302052119bf54f0ae972b9fb | Fix site ID fallback when testing. | mezzanine/utils/sites.py | mezzanine/utils/sites.py | from __future__ import unicode_literals
import os
import sys
from django.contrib.sites.models import Site
from mezzanine.conf import settings
from mezzanine.core.request import current_request
def current_site_id():
"""
Responsible for determining the current ``Site`` instance to use
when retrieving da... | Python | 0 | @@ -1991,16 +1991,94 @@
ite_id)%0A
+ if request and site_id:%0A request.site_id = site_id%0A
if n
@@ -2179,32 +2179,76 @@
uest and site_id
+ and not getattr(settings, %22TESTING%22, False)
:%0A reques
|
ba50883881d3e652c1175489e16c3c5839807feb | add new: GWinstek GDS-840S, RS-232 connection. | serial/serialGDS840S.py | serial/serialGDS840S.py | Python | 0 | @@ -0,0 +1,706 @@
+#!/usr/bin/env python%0A%0A# RS-232 serial support for GW Instek GDS-840S Digital Storage Oscilloscope%0A# http://www.gwinstek.com/html/en/DownloadFile.asp?sn=255&uid=&lv=%0A# Filename: 82DS-82000IA.pdf%0A%0Aimport serial%0A%0A# Values set on unit manually (but these are standard settings)%0Aser = se... | |
096087b4fddf9bc2644bcbb71834fcfc5985558c | add flash order | scripts/flash-order.py | scripts/flash-order.py | Python | 0 | @@ -0,0 +1,3168 @@
+#!/usr/bin/python3%0A%0Afrom pubnub.pnconfiguration import PNConfiguration%0Afrom pubnub.pubnub import PubNub%0A%0Apnconfig = PNConfiguration()%0Apnconfig.subscribe_key = %22my_subkey%22%0Apnconfig.publish_key = %22my_pubkey%22%0Apnconfig.ssl = False%0A%0Apubnub = PubNub(pnconfig)%0A%0Afrom pubnub.c... | |
7dee9be2022bdf481bc5bc6766684058fd9d44e5 | add script for generating the manifest for a given package | scripts/genmanifest.py | scripts/genmanifest.py | Python | 0.000002 | @@ -0,0 +1,1229 @@
+#!/usr/bin/python%0A#%0A# Copyright (c) 2008 rPath, Inc.%0A#%0A# This program is distributed under the terms of the Common Public License,%0A# version 1.0. A copy of this license should have been distributed with this%0A# source file in a file called LICENSE. If it is not present, the license%0A# is... | |
0ca7d4a20c8a65e45ddb7c61ca72c0e6c464a80e | Create template_redacted entry for templates created by migration | migrations/versions/0296_template_redacted_fix.py | migrations/versions/0296_template_redacted_fix.py | Python | 0 | @@ -0,0 +1,617 @@
+%22%22%22%0A%0ARevision ID: 0296_template_redacted_fix%0ARevises: 0295_api_key_constraint%0ACreate Date: 2019-06-07 17:02:14.350064%0A%0A%22%22%22%0Afrom alembic import op%0A%0A%0Arevision = '0296_template_redacted_fix'%0Adown_revision = '0295_api_key_constraint'%0A%0A%0Adef upgrade():%0A op.execu... | |
a38f18b8c51ad83b5c4b92853fa5640137131ad9 | imprime sequencia de gtins, calculando dígito verificador | script/gera_gtin.py | script/gera_gtin.py | Python | 0.000001 | @@ -0,0 +1,212 @@
+from gtin import GTIN%0A%0A%0Acountry = 789%0Acompany = 96188%0Aproduct = 7251%0Aquant = 127%0A%0Afor incr in range(quant):%0A numero_gtin = '%7B%7D%7B%7D%7B%7D'.format(country, company, product+incr)%0A print(str(GTIN(raw=numero_gtin)))%0A
| |
2611476df6f362cd59e4aad38a243fc8f6cbf8a8 | Purge da página de palestra quando salva palestrante | devincachu/purger.py | devincachu/purger.py | # -*- coding: utf-8 -*-
import roan
from django.contrib.flatpages import models
from palestras import models as pmodels
def connect():
flatpages = models.FlatPage.objects.all()
for f in flatpages:
roan.purge(f.url).on_save(models.FlatPage)
palestras = pmodels.Palestra.objects.all()
for p in... | Python | 0 | @@ -485,28 +485,214 @@
on_delete(pmodels.Palestra)%0A
+ roan.purge(p.get_absolute_url_and_link_title()%5B'url'%5D).on_save(pmodels.Palestrante)%0A roan.purge(p.get_absolute_url_and_link_title()%5B'url'%5D).on_delete(pmodels.Palestrante)%0A
|
a01d471bc8bd171de9301b428466f7ccba93872b | Revert "Made the scheduling of Queue.get more fair." | diesel/util/queue.py | diesel/util/queue.py | from time import time
from uuid import uuid4
from collections import deque
from diesel import wait, fire, sleep, first
class QueueEmpty(Exception): pass
class QueueTimeout(Exception): pass
class Queue(object):
def __init__(self):
self.inp = deque()
self.waiters = deque()
def put(self, i=None... | Python | 0 | @@ -247,21 +247,29 @@
elf.
-inp = deque()
+wait_id = uuid4().hex
%0A
@@ -278,23 +278,19 @@
self.
-waiters
+inp
= deque
@@ -359,277 +359,96 @@
-if self.waiters:%0A wait_id = self.waiters.popleft()%0A fire(wait_id)%0A%0A def get(self, waiting=True, timeout=None):%0A start ... |
4fe11f89c008909dd21451ac0e23dce86de7c849 | Add profiling dev script. | dev_scripts/profile_structure.py | dev_scripts/profile_structure.py | Python | 0.000098 | @@ -0,0 +1,402 @@
+#!/usr/bin/env python%0A%0Afrom pymatgen.io.vaspio import Poscar%0Aimport cProfile%0Aimport pstats%0Aimport os%0A%0Ap = Poscar.from_file(%22../test_files/POSCAR.LiFePO4%22, check_for_POTCAR=False)%0As = p.structure%0A%0Adef test():%0A nn = s.get_sites_in_sphere(%5B0, 0, 0%5D, 20)%0A print len(n... | |
ea30b49012af2003049f4b1b7deeecb1232c7513 | Create permutations.py | permutations.py | permutations.py | Python | 0.000202 | @@ -0,0 +1,249 @@
+#Kunal Gautam%0A#Codewars : @Kunalpod%0A#Problem name: Permutations%0A#Problem level: 4 kyu%0A%0Afrom itertools import groupby, permutations as perm%0Adef permutations(string):%0A return %5Bk for k,_ in groupby(sorted(%5B''.join(comb) for comb in perm(string)%5D))%5D%0A
| |
eb943bb45695472483352978060a94e0d48b5e4a | Add scatterplot | plot/scatter.py | plot/scatter.py | Python | 0.000006 | @@ -0,0 +1,693 @@
+import matplotlib.pyplot as plt%0A%0Adef plot_scatter(x, y, ax=None, color=None, alpha=None, size=None, labels=None, title=%22Scatterplot%22, figsize=(10,6)):%0A # TODO: Add x, and y labels%0A # TODO: grid%0A if ax is None:%0A fig, ax = plt.subplots(figsize=figsize)%0A fig.supt... | |
02f207269f7d2773919e520e04ab8f9261357d4b | Add isup plugin | plugins/isup.py | plugins/isup.py | Python | 0.000001 | @@ -0,0 +1,747 @@
+import requests%0Aimport urllib.parse%0A%0Aclass Plugin:%0A def __call__(self, bot):%0A bot.on_respond(r%22is (.*) (up%7Cdown)(%5C?)?%22, self.on_respond)%0A bot.on_respond(r%22isup (.*)$%22, self.on_respond)%0A bot.on_help(%22isup%22, self.on_help)%0A%0A def on_respond(sel... | |
8c6b412e01e81a7c062ba8234ebafc6fca61651c | Add shovel test.quick for sanity check before pushing | shovel/test.py | shovel/test.py | Python | 0 | @@ -0,0 +1,837 @@
+# coding: utf-8%0Afrom __future__ import absolute_import, division, print_function%0A%0Aimport subprocess%0Afrom collections import OrderedDict%0A%0Afrom shovel import task%0A%0A%0A@task%0Adef quick():%0A failed = OrderedDict.fromkeys(%0A %5B'test', 'docs', 'spelling', 'doc8', 'flake8'%5D, ... | |
cdcc45eb6982e68415632a8bcfbc5e7596e0a1cf | add resize_logos.py | scripts/resize_logos.py | scripts/resize_logos.py | Python | 0.000001 | @@ -0,0 +1,993 @@
+#!/usr/bin/env python%0A%0Aimport os%0Aimport os.path as op%0Afrom PIL import Image%0A%0AdirPath = op.abspath('./logos')%0Aout_dir = op.join(dirPath, 'resize')%0A%0Aif not op.exists(out_dir):%0A os.mkdir(out_dir)%0A%0Asupported_formats = %5B'png', 'gif', 'jpg'%5D%0A%0Afor img_file in os.listdir(di... | |
ff994f8bfd7642fc95694d511a1cec81d0ba8f4d | fix bugs | plstackapi/planetstack/api/sites.py | plstackapi/planetstack/api/sites.py | from plstackapi.openstack.client import OpenStackClient
from plstackapi.openstack.driver import OpenStackDriver
from plstackapi.planetstack.api.auth import auth_check
from plstackapi.planetstack.models import Site
def add_site(auth, **fields):
driver = OpenStackDriver(client = auth_check(auth))
site = Site(*... | Python | 0.000001 | @@ -425,16 +425,17 @@
s%5B'name'
+%5D
,%0A
|
1be4972ca39408b8d4770b5722642996908c9a70 | add 5-for.py | python/5-for.py | python/5-for.py | Python | 0.003482 | @@ -0,0 +1,288 @@
+#!/usr/bin/env python%0A%0A%0Afor letter in 'python':%0A print %22Current character is %22, letter%0A%0A%0Afruits = %5B'banana', 'apple', 'mango'%5D%0Afor fruit in fruits:%0A print %22Current fruit is %22, fruit%0A%0Afor index in range(len(fruits)):%0A print %22Current fruit is %22, fruits%5... | |
4cef0dc3af25ec4c781ed04b28d425374f793702 | add socket comm class | socket_communication.py | socket_communication.py | Python | 0 | @@ -0,0 +1,523 @@
+#!/usr/bin/env python%0A%0Aimport socket%0A%0Aclass SocketCommunication:%0A def __init__(self):%0A self.RECEIVER_HOST = '192.168.1.4' # The remote host%0A self.PORT = 3000 # The same port as used by the server%0A%0A def open(self):%0A self.sock = socket.socket(socket.AF_INET, socket.SO... | |
d0f105e1aa50b74025eed0a1e32561c0f16b9ef0 | create counter for facilitate_moves | source/referee_chair.py | source/referee_chair.py | from facilitator_credentials import Facilitator
from announcer_chair import Announcer
from time import sleep
class Referee(Facilitator):
def __init__(self, table_top, player1, player2):
self.announcer = Announcer()
self.table_top = table_top
self.player1 = player1
self.player2 = pl... | Python | 0 | @@ -356,16 +356,45 @@
.player1
+%0A self.moves_taken = 0
%0A%0A de
@@ -964,32 +964,62 @@
able_top.board)%0A
+ self.moves_taken += 1%0A
sleep(1.
@@ -1022,9 +1022,9 @@
p(1.
-7
+2
5)%0A
@@ -1998,43 +1998,8 @@
f):%0A
- tie = self.check_for_tie()%0A
@@ -2116,19 +2116,29 @@
lif ... |
50a7b9bc262c98f4e387746f67a638f50f94ba38 | Add migration merge | portal/migrations/versions/e396fb1974ef_.py | portal/migrations/versions/e396fb1974ef_.py | Python | 0.000001 | @@ -0,0 +1,351 @@
+from alembic import op%0Aimport sqlalchemy as sa%0A%0A%0A%22%22%22empty message%0A%0ARevision ID: e396fb1974ef%0ARevises: ('773b1de060dd', '3271a78bbc8b')%0ACreate Date: 2018-04-24 12:19:56.689921%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = 'e396fb1974ef'%0Adown_revision... | |
85c67110db1fbb5a25faef36bdfe282952f5a034 | Create __init__.py | src/__init__.py | src/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
d686f54aff87d4dea1266ee1fec8c1c320dee5b9 | add tests for fizz_buzz. | test_fizz_buzz.py | test_fizz_buzz.py | Python | 0 | @@ -0,0 +1,662 @@
+from cStringIO import StringIO%0Aimport sys%0Aimport fizz_buzz%0A%0A%0Aclass Capture(list):%0A %22%22%22Context manager for capturing stdout.%22%22%22%0A def __enter__(self):%0A self._stdout = sys.stdout%0A sys.stdout = self._stringio = StringIO()%0A return self%0A%0A de... | |
7d4148a683d8d1a70e81fd1033c535738bab2533 | Fix bug of break when press "[/]" when app start | NEMbox/player.py | NEMbox/player.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: omi
# @Date: 2014-07-15 15:48:27
# @Last Modified by: omi
# @Last Modified time: 2015-01-30 18:05:08
'''
网易云音乐 Player
'''
# Let's make some noise
import subprocess
import threading
import time
import os
import signal
import random
import re
from ui import ... | Python | 0 | @@ -2896,32 +2896,107 @@
f recall(self):%0A
+ if self.idx %3C 0 or self.idx %3E= len(self.songs):%0A return%0A
self.pla
|
4fa2ca578b7015bee68f9f2f7bc26df2f7ab01b4 | add test_cli.py module and initial test | tests/test_cli.py | tests/test_cli.py | Python | 0 | @@ -0,0 +1,557 @@
+#!/usr/bin/env python%0A# coding: utf8%0A%22%22%22%0AUnit tests for cli functionality%0A%22%22%22%0A%0A# --- Imports%0A%0Aimport subprocess%0A%0Aimport geocoder%0A%0A# --- Constants%0A%0A_CLI_EX = './geocoder/cli.py' # CLI executable path%0A%0A%0Aus_address = '595 Market St'%0Aus_city = 'San Francis... | |
8f4ac0b12c0f83ff892e16e312cc5edbfb089850 | add tests for no config startup | tests/test_cli.py | tests/test_cli.py | Python | 0 | @@ -0,0 +1,305 @@
+%0Afrom click.testing import CliRunner%0Afrom vaping import cli%0Aimport pytest%0A%0A%0Adef test_start_no_home():%0A runner = CliRunner()%0A with pytest.raises(ValueError) as excinfo:%0A runner.invoke(cli.cli, %5B'start'%5D, catch_exceptions=False)%0A%0A assert str(excinfo.value).star... | |
1f2f4837e823ff6cc5c9cb961f4852753926f0d7 | Create __init__.py | tumor/__init__.py | tumor/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
f146583961733feb90567fdf03a6a5ee122c550f | Create r34.py | r34.py | r34.py | Python | 0.000001 | @@ -0,0 +1,1109 @@
+# Aradiabot function for searching rule34.xxx%0A# As they don't have an API, this was easier to put in it's own file so I could organize everything.%0A%0Aimport requests%0Afrom html.parser import HTMLParser%0Aimport random%0Aimport sys%0Acounter = %5B10,9,8,7,6,5,4,3,2,1%5D%0Aimages = %5B%5D%0A%0Acl... | |
d0287d9deaa3eb03076cdd199414b772a291e2c5 | Add command for moving zips | calaccess_website/management/commands/mvzips.py | calaccess_website/management/commands/mvzips.py | Python | 0.000001 | @@ -0,0 +1,3803 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*-%0A%22%22%22%0AMove downloaded and cleaned zips to their proper place in the raw data archived dir.%0A%22%22%22%0Aimport boto3%0Afrom django.conf import settings%0Afrom calaccess_raw.management.commands import CalAccessCommand%0Afrom calaccess_raw.model... | |
cdd1f3410b8ae304485f7992ac6048e1277cffe1 | Add local locale from file | parsedatetime/pdt_locales/__init__.py | parsedatetime/pdt_locales/__init__.py | # -*- encoding: utf-8 -*-
"""
pdt_locales
All of the included locale classes shipped with pdt.
"""
try:
import PyICU as pyicu
except:
pyicu = None
def lcase(x):
return x.lower()
from .base import pdtLocale_base, pdtLocale_icu
from .de_DE import *
from .en_AU import *
from .en_US import *
from .es im... | Python | 0.000001 | @@ -93,16 +93,26 @@
pdt.%0A%22%22%22
+%0Aimport os
%0A%0Atry:%0A
@@ -162,16 +162,29 @@
= None%0A%0A
+import yaml%0A%0A
%0Adef lca
@@ -381,24 +381,24 @@
BR import *%0A
-
from .ru_RU
@@ -398,16 +398,797 @@
.ru_RU import *%0A
+%0ApdtLocales = %5B%0A 'icu',%0A 'en_US',%0A 'en_AU',%0A 'es_ES',%0A 'de... |
c98039a25638db0c124efeaa394f89f2a84a2ede | Create aekjdfh.py | aekjdfh.py | aekjdfh.py | Python | 0.000037 | @@ -0,0 +1,18 @@
+sdl;jfhlkjsdhfhdf%0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.