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 |
|---|---|---|---|---|---|---|---|
f1268d95f224b0bb3df00f3a76c92074f0db037a | Update utils.py | tendrl/commons/central_store/utils.py | tendrl/commons/central_store/utils.py | from tendrl.commons.etcdobj import fields
def to_etcdobj(cls_etcd, obj):
for attr, value in vars(obj).iteritems():
if attr.startswith("_"):
continue
if attr in ["attrs", "enabled", "obj_list", "obj_value", "atoms",
"flows", "value", "list"]:
continue
... | Python | 0.000001 | @@ -114,16 +114,63 @@
tems():%0A
+ if value is None:%0A continue%0A
|
71bbd57214cd8be6ac8583884eb1fc2e5b270eb8 | Add conf file for Emmaus Ideasbox in France | ideascube/conf/idb_fra_emmaus.py | ideascube/conf/idb_fra_emmaus.py | Python | 0 | @@ -0,0 +1,1788 @@
+# -*- coding: utf-8 -*-%0A%22%22%22Ideaxbox for Emmaus, France%22%22%22%0Afrom .idb import * # noqa%0Afrom django.utils.translation import ugettext_lazy as _%0A%0AIDEASCUBE_NAME = u%22Emmaus%22%0AIDEASCUBE_PLACE_NAME = _(%22city%22)%0ACOUNTRIES_FIRST = %5B'FR'%5D%0ATIME_ZONE = None%0ALANGUAGE_CODE ... | |
f7f76bc7eb217e4c7b81e58afec41726f0dd2848 | Add another dip example | examples/dip2.py | examples/dip2.py | Python | 0 | @@ -0,0 +1,1636 @@
+#!/usr/bin/env python3%0A# Copyright (c) 2015 Matthew Earl%0A# %0A# Permission is hereby granted, free of charge, to any person obtaining a copy%0A# of this software and associated documentation files (the %22Software%22), to deal%0A# in the Software without restriction, including without limitation... | |
60a6b98d0bc3f8e55414dd1f6461ad863bcfd12a | Create matching_ending_items.py | hacker_rank/regex/repetitions/matching_ending_items.py | hacker_rank/regex/repetitions/matching_ending_items.py | Python | 0.000017 | @@ -0,0 +1,55 @@
+Regex_Pattern = r'%5E%5Ba-zA-Z%5D*%5Bs%5D$'%09# Do not delete 'r'.%0A
| |
4822b3c55478bd76b66d5afbfabf0c9ec51a9c8e | Add an example ('move.py'). | examples/move.py | examples/move.py | Python | 0.00009 | @@ -0,0 +1,1092 @@
+#!/usr/bin/env python3%0A# -*- coding: utf-8 -*-%0A%0Aimport pydynamixel.packet as pk%0Aimport pydynamixel.connection%0Aimport pydynamixel.instruction_packet as ip%0A%0Aimport time%0A%0Adef main():%0A serial_connection = pydynamixel.connection.Connection()%0A%0A # Goto to 180%C2%B0%0A%0A in... | |
1e9b1c2270d8dfc722f92b8b046581ce6172016a | update divergence | utils/divergences.py | utils/divergences.py | Python | 0.000001 | @@ -0,0 +1,779 @@
+%22%22%22%0AAuthor: Rahul G. Krishnan%0AFile containing divergences used between probability measures %0A%22%22%22%0Aimport theano.tensor as T%0Adef KL(mu_1,cov_1,mu_2,cov_2):%0A %22%22%22%0A Estimate the KL divergence between two gaussians with diagonal covariance%0A KL(q%7C%7Cp) 0.5*(log%7... | |
ee633ae9576ee1d2c0edd55551319879a9c32864 | Add initial version of fit_sota_model | fit_sota_model.py | fit_sota_model.py | Python | 0 | @@ -0,0 +1,1635 @@
+#!/usr/bin/env python%0A%0Afrom __future__ import division%0A%0Aimport numpy as np%0A%0A%0ASOTA2013_FIT = %5B0.18, 0.99, -0.49, # Scale%0A -1.49, 0.89, 0.28%5D # Offset%0A%0Aif 'data' not in globals():%0A import cPickle as pickle%0A with open('data/mini_acq_table.pkl', 'r') as... | |
ae553ef472d63e6b05d87f1ad28c604e0fb67347 | Fix Docstring: "inject" can be an action too | pathod/language/writer.py | pathod/language/writer.py | import time
from netlib.exceptions import TcpDisconnect
BLOCKSIZE = 1024
# It's not clear what the upper limit for time.sleep is. It's lower than the
# maximum int or float. 1 year should do.
FOREVER = 60 * 60 * 24 * 365
def send_chunk(fp, val, blocksize, start, end):
"""
(start, end): Inclusive lower bo... | Python | 0.000039 | @@ -711,22 +711,32 @@
be %22
-pause%22%0A
+inject%22,%0A %22pause%22
or
|
4ea892fe28b3045ab265cfd9fd5aa6a2b7c1ee52 | add report related to the fix contaminant | sequana/report_fix.py | sequana/report_fix.py | Python | 0 | @@ -0,0 +1,2215 @@
+import easydev%0Aimport os%0A%0A%0Afrom .report_main import BaseReport%0A%0A# a utility from external reports package%0Afrom reports import HTMLTable%0A%0Aimport pandas as pd%0A%0A%0Adef _get_template_path(name):%0A # Is it a local directory ?%0A if os.path.exists(name):%0A return nam... | |
9c67d72fbbdec53e2adc5ff2718bae8b3493b219 | add a simple test for celery config | ichnaea/tests/test_worker.py | ichnaea/tests/test_worker.py | Python | 0.000001 | @@ -0,0 +1,358 @@
+from unittest2 import TestCase%0A%0A%0Aclass TestWorkerConfig(TestCase):%0A%0A def _get_target(self):%0A from ichnaea.worker import celery%0A return celery%0A%0A def test_config(self):%0A celery = self._get_target()%0A self.assertTrue(celery.conf%5B'CELERY_ALWAYS_EAG... | |
a990292ec2d3e2ebc74dd548cfc9ee55427bf5f0 | Create news_url.py | news_url.py | news_url.py | Python | 0.000002 | @@ -0,0 +1,393 @@
+%22%22%22 PROJECT SCRAPER %22%22%22%0A'''GET URL FROM BBC NEWS'''%0A%0Afrom bs4 import BeautifulSoup%0Aimport urllib2%0A%0Aurl='http://www.bbc.com/news'%0A%0Aweb=urllib2.urlopen(url)%0Asoup=BeautifulSoup(web,'html.parser')%0A%0A%0Awith open('news_url.txt','w') as file:%0A%09for tag in soup.find_all('... | |
4d747b0ff0f700e41ff31b028618163d180301fa | Add Utils | Utils.py | Utils.py | Python | 0 | @@ -0,0 +1,174 @@
+%22%22%22%0AHolds various common functions and variables which will be useful in general%0Aby the other classes.%0A%22%22%22%0A%0A%0Adef log(*args, **kwargs):%0A print(%22 COALA -%22, *args, **kwargs)%0A
| |
dbc64554694f117dfe2def082acaeb60117a4f1e | add template for classifier test | weiss/tests/test_dialogue.py | weiss/tests/test_dialogue.py | Python | 0.000001 | @@ -0,0 +1,146 @@
+from django.test import TestCase%0A%0A%0A%0Aclass StateTestCase(TestCase):%0A def setUp(self):%0A pass%0A%0A def test_classifier(self):%0A pass%0A
| |
c193b4718a707f16b436d62f6b6a26882b742251 | test for branching and shas | ws-tests/test_integration.py | ws-tests/test_integration.py | Python | 0 | @@ -0,0 +1,1858 @@
+#!/usr/bin/env python%0Afrom opentreetesting import test_http_json_method, config%0Aimport datetime%0Aimport codecs%0Aimport json%0Aimport sys%0Aimport os%0A%0A%0Astudy_id = '9'%0ADOMAIN = config('host', 'apihost')%0A%0A#A full integration test, with GET, PUT, POST, MERGE and a merge conflict, %0A%0... | |
4641195df10da114b896fbe16c89324954833d22 | Create main.py | web/src/main.py | web/src/main.py | Python | 0.000001 | @@ -0,0 +1,144 @@
+from flask import Flask%0Aapp = Flask(__name__)%0A%0A@app.route(%22/%22)%0Adef hello():%0A return %22Hello World!%22%0A%0Aif __name__ == %22__main__%22:%0A app.run()%0A
| |
a4af8609686386d3371289ea24e019a897ca13bd | introduce a new kind of exception: RedirectWarning (warning with an additional redirection button) | openerp/exceptions.py | openerp/exceptions.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the G... | Python | 0.000001 | @@ -1225,16 +1225,516 @@
pass%0A%0A
+class RedirectWarning(Exception):%0A %22%22%22 Warning with a possibility to redirect the user instead of simply%0A discarding the warning message.%0A %22%22%22%0A def __init__(self, msg, action_id, button_text):%0A %22%22%22%0A :param int action_id: id ... |
7e7f0585971f472c25fda3b6370e37eb4d8d0ea5 | test import of ssh.tunnel | zmq/tests/test_imports.py | zmq/tests/test_imports.py | # Copyright (C) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
import sys
from unittest import TestCase
class TestImports(TestCase):
"""Test Imports - the quickest test to ensure that we haven't
introduced version-incompatible syntax errors."""
def test_toplevel(self):
... | Python | 0.000001 | @@ -1638,10 +1638,105 @@
pi%0A %0A
+ def test_ssh(self):%0A %22%22%22test ssh imports%22%22%22%0A from zmq.ssh import tunnel%0A %0A
%0A%0A
|
74c251b18b1727bcd0f01ba5c12f7895a45b140f | make user parameter optional for legacy purposes | quora/user.py | quora/user.py | from bs4 import BeautifulSoup
import feedparser
import re
import requests
import string
### Configuration ###
POSSIBLE_FEED_KEYS = ['link', 'id', 'published', 'title', 'summary']
### Enumerated Types ###
def enum(*sequential, **named):
enums = dict(zip(sequential, range(len(sequential))), **named)
reverse = d... | Python | 0 | @@ -625,16 +625,43 @@
TOPIC=4)
+%0ADEFAULT_USER = None
%0A%0A######
@@ -4221,24 +4221,37 @@
_(self, user
+=DEFAULT_USER
):%0A s
|
df9fc9f64b5450851abef90b50804e56e0d152bf | add fragment reaction class | afm/reaction.py | afm/reaction.py | Python | 0 | @@ -0,0 +1,657 @@
+%0Aclass FragmentReaction(object):%0A%0A%09def __init__(self,%0A%09%09%09%09index=-1,%0A%09%09%09%09reactants=None,%0A%09%09%09%09products=None,%0A%09%09%09%09kinetics=None,%0A%09%09%09%09reversible=False,%0A%09%09%09%09pairs=None,%0A%09%09%09%09family=None%0A%09%09%09%09):%0A%0A%09%09%0A%09%09self.i... | |
9192fe92621d6f79b0f99802f50014d27c967d26 | Add alg_knapsack.py | alg_knapsack.py | alg_knapsack.py | Python | 0.998627 | @@ -0,0 +1,218 @@
+from __future__ import absolute_import%0Afrom __future__ import division%0Afrom __future__ import print_function%0A%0A%0Adef main():%0A%09wt_cap = 10%0A%09wt = %5B1, 2, 4, 2, 5%5D%0A%09val = %5B5, 3, 5, 3, 2%5D%0A%0A%0Aif __name__ == '__main__':%0A%09main()%0A
| |
a101bd9ccb280348e6da32b3f2c0540ca6c65807 | Implement String field | polygraph/types/fields.py | polygraph/types/fields.py | Python | 0.000196 | @@ -0,0 +1,888 @@
+from collections import OrderedDict%0A%0Afrom graphql.type.definition import GraphQLField, GraphQLNonNull%0Afrom graphql.type.scalars import GraphQLString%0Afrom marshmallow import fields%0A%0A%0Aclass String(fields.String):%0A def __init__(self, description, nullable=False, args=None,%0A ... | |
f0033f87e0b4082e55dd3641282e65369e03c03e | Create natural_sort.py (#3286) | sorts/natural_sort.py | sorts/natural_sort.py | Python | 0 | @@ -0,0 +1,1207 @@
+from __future__ import annotations%0A%0Aimport re%0A%0A%0Adef natural_sort(input_list: list%5Bstr%5D) -%3E list%5Bstr%5D:%0A %22%22%22%0A Sort the given list of strings in the way that humans expect.%0A%0A The normal Python sort algorithm sorts lexicographically,%0A so you might not get ... | |
bba04c867055715bb93e2fc2736538337b9f26ac | Add caesar cipher | CaesarCipher.py | CaesarCipher.py | Python | 0.999999 | @@ -0,0 +1,585 @@
+class CaesarCipher:%0A def encrypt(self, plain, n):%0A rst = %5BNone%5D * len(plain)%0A%0A for i in range(len(plain)):%0A rst%5Bi%5D = chr((ord(plain%5Bi%5D) - ord('A') + n) %25 26 + ord('A'))%0A %0A return ''.join(rst)%0A%0A def decrypt(self, encrypted, n... | |
e5442b54f172afdca477d34e6396556689b87951 | Calculator task done | 01/if-elif-else/calculator.py | 01/if-elif-else/calculator.py | Python | 0.999904 | @@ -0,0 +1,352 @@
+a = input(%22Enter a: %22)%0Aa = int(a)%0Ab = input(%22Enter b: %22)%0Ab = int(b)%0Aoper = input(%22Enter operation: %22)%0A%0A%0Aif oper == %22+%22:%0A result = a + b%0Aelif oper == %22-%22:%0A result = a - b%0Aelif oper == %22*%22:%0A result = a * b%0Aelif oper == %22/%22:%0A result = a... | |
4fef2ff44b2f195a9a135ba3ca5c70bb08572d39 | Add sphinx configuration | zeppelin-docs/src/main/spinx/conf.py | zeppelin-docs/src/main/spinx/conf.py | Python | 0.000003 | @@ -0,0 +1,2114 @@
+#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or agreed to in ... | |
a5aadd892df181a8e4a48ceebedff48211d5d22c | Add paver file. | pavement.py | pavement.py | Python | 0 | @@ -0,0 +1,2678 @@
+import os%0Aimport subprocess%0A%0Aimport sphinx%0A%0Aimport setuptools%0Aimport numpy.distutils%0A%0Aimport paver%0Aimport paver.doctools%0A%0Aimport common%0Afrom setup import configuration%0A%0Aoptions(%0A setup=Bunch(%0A name=common.DISTNAME,%0A namespace_packages=%5... | |
91d83745d94ba0eeb06d6d12eb32d5950963ad2a | move backend definition | ldapdb/backends/ldap/base.py | ldapdb/backends/ldap/base.py | Python | 0.000002 | @@ -0,0 +1,3689 @@
+# -*- coding: utf-8 -*-%0A# %0A# django-ldapdb%0A# Copyright (c) 2009-2010, Bollor%C3%A9 telecom%0A# All rights reserved.%0A# %0A# See AUTHORS file for a full list of contributors.%0A# %0A# Redistribution and use in source and binary forms, with or without modification,%0A# are permitted provided th... | |
f3eb1c8efbcd3695dba0037faa4f90328625f547 | Add script for creating numeric passwordlists using permutation & combination. | permcomb.py | permcomb.py | Python | 0 | @@ -0,0 +1,571 @@
+#!/usr/bin/python%0A%0Aimport itertools%0Aimport sys%0A%0A%0Adef combination(elements,items):%0A for combination in itertools.product(xrange(elements), repeat=items):%0A print ''.join(map(str, combination))%0A%0A%0Aif len(sys.argv) == 3:%0A allSet = int(sys.argv%5B1%5D)%0A setItems =... | |
b01076381ebc91f20c527f1632c7b3f2aa82d39a | Add a very simple performance testing tool. | perftest.py | perftest.py | Python | 0.000001 | @@ -0,0 +1,1393 @@
+%22%22%22%0ASimple peformance tests.%0A%22%22%22%0A%0Aimport sys%0Aimport time%0A%0Aimport couchdb%0A%0A%0Adef main():%0A%0A print 'sys.version : %25r' %25 (sys.version,)%0A print 'sys.platform : %25r' %25 (sys.platform,)%0A%0A tests = %5Bcreate_doc, create_bulk_docs%5D%0A if len(sys.arg... | |
29c59fcbe8b15e37e96fec43e613d6f537727ea2 | Create Base64_Demo.py | Base64_Demo/Base64_Demo.py | Base64_Demo/Base64_Demo.py | Python | 0.000002 | @@ -0,0 +1,536 @@
+# -*- coding: utf8 -*-%0A'''%0A@brief %E7%94%A8base64%E5%8A%A0%E5%AF%86,%E8%A7%A3%E5%AF%86(%E5%BF%85%E9%A1%BB%E4%B8%BAascii)%0A'''%0Aimport base64%0A%0A%0A'''%0A@brief %E7%BC%96%E7%A0%81%E5%8A%A0%E5%AF%86%0A@params content %E8%A6%81%E7%BC%96%E7%A0%81%E5%8A%A0%E5%AF%86%E7%9A%84%E5%86%85%E5%AE%B9(%E5%... | |
55ee2e14a173ea68f3ed02edbd525a6538dd0c0c | add deploy.py script | improv/deploy.py | improv/deploy.py | Python | 0.000002 | @@ -0,0 +1,1010 @@
+%0Aimport os, shutil, zipfile%0A%0AAppName = 'ImprovAlpha4.app'%0A%0Adef mkdir(path):%0A if os.path.exists(path):%0A return%0A os.mkdir(path)%0A%0Adef rmdir(path):%0A if not os.path.exists(path):%0A return%0A if os.path.isdir(path):%0A shutil.rmtree(path)%0A else:... | |
fbf91352da4cf16be8462f57c71aa9f86f21746f | Add class balance checking code | amaranth/data_analysis/class_balance.py | amaranth/data_analysis/class_balance.py | Python | 0 | @@ -0,0 +1,1689 @@
+# Lint as: python3%0A%22%22%22This script checks the balance of classes in the FDC dataset.%0A%0AClasses are split based on LOW_CALORIE_THRESHOLD and%0AHIGH_CALORIE_THRESHOLD in the amaranth module.%0A%22%22%22%0A%0Aimport os%0Aimport pandas as pd%0A%0Aimport amaranth%0Afrom amaranth.ml import lib%0... | |
7432e7fb9ad5199ef3f55e7c85e542eaef4237da | Add pelicanconf_sample.py | pelicanconf_sample.py | pelicanconf_sample.py | Python | 0.000002 | @@ -0,0 +1,642 @@
+#!/usr/bin/env python%0A# -*- coding: utf-8 -*- #%0A%0Afrom __future__ import unicode_literals%0A%0A# The followings are recommanded to set them up.%0AAUTHOR = ''%0ASITENAME = ''%0ASITEURL = ''%0ASITE_DESCRIPTION = ''%0A%0ASELF_INTRO = 'A brief introduction about yourself.'%0A%0APATH = 'content'%0A%0... | |
93b2d93098c395d866f18e51b6ac42a9ba81a9b5 | Test if C changes with more examples. | exp/modelselect/RealDataSVMExp.py | exp/modelselect/RealDataSVMExp.py | Python | 0 | @@ -0,0 +1,2138 @@
+%22%22%22%0AObserve if C varies when we use more examples %0A%22%22%22%0Aimport logging %0Aimport numpy %0Aimport sys %0Aimport multiprocessing %0Afrom apgl.util.PathDefaults import PathDefaults %0Afrom apgl.predictors.AbstractPredictor import computeTestError %0Afrom exp.modelselect.ModelSelectUtil... | |
d8e0104c92d9457ba60285cb856d8f435e0e08bd | Add initial setup script | initial-setup.py | initial-setup.py | Python | 0.000001 | @@ -0,0 +1,317 @@
+import pickle%0Afrom pathlib import Path%0Aimport joseconfig as jcfg%0A%0A# touch files%0APath(jcfg.jcoin_path).touch()%0APath('db/jose-data.txt').touch()%0A%0Adef initialize_db(path):%0A with open(path, 'wb') as f:%0A pickle.dump(%7B%7D, f)%0A%0A# initialize databases%0Ainitialize_db(jcfg.... | |
40d8cf13bd91b2da43c5cecedcabc8e794f7febd | Add __init__.py to suite/wrappers directory. | dm_control/suite/wrappers/__init__.py | dm_control/suite/wrappers/__init__.py | Python | 0.000005 | @@ -0,0 +1,742 @@
+# Copyright 2018 The dm_control Authors.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless re... | |
7515f9de3e1aab11eb6ffae93cbff7290557c6af | Make functions visible | maediprojects/views/codelists.py | maediprojects/views/codelists.py | Python | 0.000013 | @@ -0,0 +1,750 @@
+from flask import Flask, render_template, flash, request, Markup, %5C%0A session, redirect, url_for, escape, Response, abort, send_file, jsonify%0Afrom flask.ext.login import login_required, current_user%0A %0Afrom maediprojects import app, db, models%0Afrom maediproject... | |
9d490a562577a8391d673d20d6a5f84b86affa5d | basic language supporting framework | src/arena/language.py | src/arena/language.py | Python | 0.998859 | @@ -0,0 +1,1094 @@
+from arena.cmd import Cmd%0A%0A%0Aclass Language(object):%0A def __init__(self, cmd: str, run_switch: str):%0A self._cmd = cmd%0A self._run_switch = run_switch%0A%0A @property%0A def cmd(self):%0A return self._cmd%0A%0A @property%0A def run_switch(self):%0A ... | |
476ccea37c0509f55be1bbeb90fdd999e3b3f3b4 | Create bip-0070-payment-protocol.py | examples/bip-0070-payment-protocol.py | examples/bip-0070-payment-protocol.py | Python | 0.000006 | @@ -0,0 +1,1997 @@
+#!/usr/bin/python2.7%0A#%0A# bip-0070-payment-protocol.py%0A#%0A# Distributed under the MIT/X11 software license, see the accompanying%0A# file COPYING or http://www.opensource.org/licenses/mit-license.php.%0A#%0A%0A%22%22%22Bip-0070-related functionality%0A%0AHandles incoming serialized string data... | |
5a471d778a8affea5552923a8fbd74a61bcc81f1 | add radiometric_normalization.py - need to test on remote server | radiometric_normalization/radiometric_normalization.py | radiometric_normalization/radiometric_normalization.py | Python | 0 | @@ -0,0 +1,1878 @@
+import numpy%0A%0Afrom radiometric_normalization.time_stack import time_stack%0Afrom radiometric_normalization.pif import pif%0Afrom radiometric_normalization.transformation import transformation%0Afrom radiometric_normalization.validation import validation%0Afrom radiometric_normalization import gi... | |
87f6b91a76e80cfefb3d942b67309aa2d88eae79 | Add Module.add_include API and Module.header member (codesink) | pybindgen/module.py | pybindgen/module.py | """
Code to generate code for a C/C++ Python extension module.
"""
from function import Function, OverloadedFunction
from typehandlers.base import CodeBlock, DeclarationsScope
from cppclass import CppClass
class Module(object):
"""
A Module object takes care of generating the code for a Python module.
""... | Python | 0 | @@ -170,16 +170,65 @@
nsScope%0A
+from typehandlers.codesink import MemoryCodeSink%0A
from cpp
@@ -249,16 +249,16 @@
ppClass%0A
-
%0A%0Aclass
@@ -614,16 +614,82 @@
es = %5B%5D%0A
+ self.header = MemoryCodeSink()%0A self.includes = %5B%5D%0A
@@ -1908,16 +1908,522 @@
former%0A%0A
+ def a... |
08493dd851a5023057c6f5b3439d3e965b256bf8 | add aux script | genomes/scripts/other/fix_hg19_exons.py | genomes/scripts/other/fix_hg19_exons.py | Python | 0.000001 | @@ -0,0 +1,521 @@
+#!/usr/bin/env python%0A%0Aimport numpy as np%0Aimport sys%0Aimport re%0A%0Afin = open(%22genes.hg19.out%22, 'r')%0Afout = open(%22genes.hg19.exons.temp%22, 'w')%0A%0Aline=fin.readline()%0A%0Afor line in fin:%0A fields = line.strip().split()%0A chr = fields%5B2%5D%0A strand = fields%5B3%5D%0A gen... | |
7997d02e52172b8ad0e96a845f953f90a6e739b7 | Add VSYNC GPIO output example. | scripts/examples/02-Board-Control/vsync_gpio_output.py | scripts/examples/02-Board-Control/vsync_gpio_output.py | Python | 0 | @@ -0,0 +1,1101 @@
+# VSYNC GPIO output example.%0A#%0A# This example shows how to toggle the IR LED pin on VSYNC interrupt.%0A%0Aimport sensor, image, time%0Afrom pyb import Pin%0A%0Asensor.reset() # Reset and initialize the sensor.%0Asensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB56... | |
7d88a914cba0141a0f1b0b35a84e2d82aa7b080e | Create code_3.py | MPI_Practice_Examples/code_3.py | MPI_Practice_Examples/code_3.py | Python | 0.001391 | @@ -0,0 +1,727 @@
+import numpy%0Aimport sys%0Afrom mpi4py import MPI%0A%0Acomm = MPI.COMM_WORLD%0Arank = comm.Get_rank()%0A%0ArandNum = numpy.zeros(1)%0A%0Arank = 1%0Aa=input(%22number of processes ?? %5Cn%22)%0A%0Awhile(rank%3Ca): %0A randNum = numpy.random.random_sample(1)%0A print %22Process%22, ra... | |
4d4a862aa81218b788e961916115667a212f42e0 | Add conftest.py to allow skipping slow test. | conftest.py | conftest.py | Python | 0 | @@ -0,0 +1,285 @@
+import pytest%0A%0A%0Adef pytest_addoption(parser):%0A parser.addoption(%22--runslow%22, action=%22store_true%22, help=%22run slow tests%22)%0A%0A%0Adef pytest_runtest_setup(item):%0A if 'slow' in item.keywords and not item.config.getoption(%22--runslow%22):%0A pytest.skip(%22need --runs... | |
4d0e0a4c7fb70838427212180bb213061f0b67ea | Create config11.py | config11.py | config11.py | Python | 0.000002 | @@ -0,0 +1,145 @@
+provider %22aws%22 %7B%0A access_key = %22AKIAJCJUB35JFIDR5XWW%22%0A secret_key = %22eDez8kRsqE2fTFaz0HzyZDXudPKDLlRwjcazVTLe%22%0A region = %22$%7Bvar.region%7D%0A%7D%0A
| |
1e79c1580055d2279b1a8523a2b382d98fe6cad3 | Configure minimal django settings | conftest.py | conftest.py | Python | 0 | @@ -0,0 +1,404 @@
+from django.conf import settings%0A%0Adef pytest_configure():%0A settings.configure(%0A INSTALLED_APPS = (%0A 'caspy',%0A 'rest_framework',%0A ),%0A%0A ROOT_URLCONF = 'caspy.urls',%0A%0A DATABASES = %7B%0A 'default': %7B%0A ... | |
7d29d96385ec9a3274f5e6409e04635e89f8c8c9 | Create find-anagram-mappings.py | Python/find-anagram-mappings.py | Python/find-anagram-mappings.py | Python | 0.000096 | @@ -0,0 +1,429 @@
+# Time: O(n)%0A# Space: O(n)%0A%0Aclass Solution(object):%0A def anagramMappings(self, A, B):%0A %22%22%22%0A :type A: List%5Bint%5D%0A :type B: List%5Bint%5D%0A :rtype: List%5Bint%5D%0A %22%22%22%0A lookup = collections.defaultdict(collections.deque)%0A ... | |
da9ed4dacbeaf7f8ec3873b658547a215f9d6920 | Create __init__.py | anemoi/io/__init__.py | anemoi/io/__init__.py | Python | 0.000429 | @@ -0,0 +1 @@
+%0A
| |
a228f5874d6d419a6333b91abceaf2c50843f92e | Create multObjShapeUpdate.py | af_scripts/tmp/multObjShapeUpdate.py | af_scripts/tmp/multObjShapeUpdate.py | Python | 0 | @@ -0,0 +1,2548 @@
+import maya.cmds as cmds%0A%0Adef multObjShapeImport():%0A files_to_import = cmds.fileDialog2(fileFilter = '*.obj', dialogStyle = 2, caption = 'import multiple object files', fileMode = 4,okc=%22Import%22)%0A for file_to_import in files_to_import:%0A object_name = file_to_import.split... | |
8056aa34ac52a09952e3588605ce0e1a8642e29a | Create Final-Project.py | Final-Project.py | Final-Project.py | Python | 0 | @@ -0,0 +1 @@
+%0A
| |
4a1644452b7ddf8e18a57e6520bf7be8b060b7f7 | Add Sorting Comparator solution | algorithms/sorting/sorting_comparator.py | algorithms/sorting/sorting_comparator.py | Python | 0 | @@ -0,0 +1,721 @@
+# https://www.hackerrank.com/challenges/ctci-comparator-sorting/problem%0A%0Afrom functools import cmp_to_key%0A%0A%0Aclass Player:%0A%0A def __init__(self, name, score):%0A self.name = name%0A self.score = score%0A%0A def comparator(a, b):%0A if a.score == b.score:%0A ... | |
15d21e8ce24e8058db26035e192ee2ba240c7184 | Update clusters tasks | api/clusters/tasks.py | api/clusters/tasks.py | Python | 0.000001 | @@ -0,0 +1,1952 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import absolute_import, division, print_function%0A%0Aimport logging%0A%0Afrom polyaxon_k8s.manager import K8SManager%0A%0Afrom api.settings import CeleryTasks, CeleryRoutedTasks%0Afrom api.celery_api import app as celery_app%0A%0Alogger = logging.getLogger(... | |
ffed6fb5b853f621af0e242abf00d97defc2a4a8 | add audio setup routine | audio.py | audio.py | Python | 0 | @@ -0,0 +1,1235 @@
+#%0A# Set Up Audio Pairing with Alexa from a Pi%0A#%0A%0Aimport os%0Aimport sys%0Aimport secrets as s%0Afrom pulsectl import Pulse%0A%0Adef run(cmd):%0A print(%22Executing:%22+cmd)%0A os.system(cmd)%0A%0Adef btctl(cmd):%0A print(%22Sending %22+cmd+%22 to bluetoothctl...%22)%0A os.system(... | |
b2a4709eae73786b40b4d0f58b1e02075ce023b3 | Create blink.py | blink.py | blink.py | Python | 0.000024 | @@ -0,0 +1,430 @@
+import RPi.GPIO as GPIO %0Aimport time %0A# blinking function %0Adef blink(pin): %0A GPIO.output(pin,GPIO.HIGH) %0A time.sleep(1) %0A GPIO.output(pin,GPIO.LOW) %0A time.sleep(1) %0A return %0A# to use Raspberry Pi board pin numbers %0AGPIO.setmode(GPIO.BOA... | |
bae50ccc70a077944c92738faf2009df28ae75a7 | Add Python boilerplate | bp/bp.py | bp/bp.py | Python | 0.000189 | @@ -0,0 +1,100 @@
+# Python 3.6.1%0A%0Awith open('input.txt', 'r') as f:%0A puzzle_input = f.read().split()%0A%0A%0A# Code here%0A
| |
2585b44484b175bb116c228496069cc4269440c0 | Add python tests for cosine squared angles | hoomd/md/test-py/test_angle_cosinesq.py | hoomd/md/test-py/test_angle_cosinesq.py | Python | 0.000015 | @@ -0,0 +1,2105 @@
+# -*- coding: iso-8859-1 -*-%0A# Maintainer: joaander%0A%0Afrom hoomd import *%0Afrom hoomd import md%0Acontext.initialize()%0Aimport unittest%0Aimport os%0Aimport numpy%0A%0A# tests md.angle.cosinesq%0Aclass angle_cosinesq_tests (unittest.TestCase):%0A def setUp(self):%0A print%0A ... | |
cbbe6f4709763c44ca0185f7e9127a0737525aff | add test_iterator_example.py | tests/test_iterator_example.py | tests/test_iterator_example.py | Python | 0.00003 | @@ -0,0 +1,1878 @@
+#!/usr/bin/env python%0Aimport alphatwirl%0Aimport unittest%0A%0A##____________________________________________________________________________%7C%7C%0Adef genFunc():%0A yield 101%0A yield 102%0A yield 103%0A%0A##____________________________________________________________________________%7... | |
ea4e0742317b2b26dc8fa9ddca79b1179f301329 | Add protocol module | protocol.py | protocol.py | Python | 0.000001 | @@ -0,0 +1,989 @@
+#Copyright (C) 2017 Oscar Triano 'dotoscat' %3Cdotoscat (at) gmail (dot) com%3E%0A%0A#This program is free software: you can redistribute it and/or modify%0A#it under the terms of the GNU Affero General Public License as%0A#published by the Free Software Foundation, either version 3 of the%0A#Licens... | |
9912b5a8fd981bae9ab003eb8386643661918cde | fix name OUtsideBrightness Sensor | all_module/OutsideBrightnessSensor.py | all_module/OutsideBrightnessSensor.py | Python | 0.999776 | @@ -0,0 +1,345 @@
+from twisted.internet import reactor%0Aimport core.module%0Aimport core.fields%0Aimport core.fields.io%0Aimport core.fields.persistant%0Aimport time%0A%0Aclass OutsideBrightness(core.module.Base):%0A update_rate = 10%0A class Brightness(%0A core.fields.sensor.Light,%0A cor... | |
6b142bc64f5966c695907692c29f52fce808a78d | add poll demo for linux platform | network/echo-server/echo-poll/lnx_poll.py | network/echo-server/echo-poll/lnx_poll.py | Python | 0.000001 | @@ -0,0 +1,2551 @@
+#!/usr/bin/env python%0A# -*- coding: UTF-8 -*-%0A#%0A# Copyright (c) 2016 ASMlover. All rights reserved.%0A#%0A# Redistribution and use in source and binary forms, with or without%0A# modification, are permitted provided that the following conditions%0A# are met:%0A#%0A# * Redistributions of sourc... | |
d168256dd4b75375770b3391f716ceaba2cf722e | Add scrapper of Bureau of Labor Statistis Employment status | cpsScrap.py | cpsScrap.py | Python | 0 | @@ -0,0 +1,752 @@
+#user/local/bin/python%0A#uses python3%0Aimport urllib.request%0Afrom bs4 import BeautifulSoup%0A%0Aurl = %22http://www.bls.gov/cps/cpsaat01.htm%22 #access the search term through website%0Apage = urllib.request.urlopen(url).read()%0Asoup = BeautifulSoup(page)%0Atables = soup.findAll('table') #find a... | |
7bdfc081cee0326d54c667bed8f870427fe2eeb6 | Add new file createDB.py | createDB.py | createDB.py | Python | 0.000002 | @@ -0,0 +1,695 @@
+#!/usr/bin/python%0A#coding=utf-8%0A%0Aimport MySQLdb%0A%0Adb = MySQLdb.connect(%22localhost%22, %22root%22, %22soeasy%22, %22free_time%22)%0A%0Acursor = db.cursor();%0A%0Acursor.execute(%22drop table lib%22);%0A%0Acursor.execute('''%0Acreate table lib (%0Aid char(8) not null,%0Aname varchar(10) not ... | |
eebe75ffbe39e7f8f91c3e3a425c7058f7bd8f01 | Write some preliminary code for undersampling component | projects/component.py | projects/component.py | Python | 0.000002 | @@ -0,0 +1,2344 @@
+from tfx import v1 as tfx%0Afrom tfx.types import artifact_utils%0Afrom tfx.utils import io_utils%0Afrom tfx.components.util import tfxio_utils%0Afrom tfx.dsl.component.experimental.decorators import component%0Aimport apache_beam as beam%0Aimport random%0A%0A@component%0Adef UndersamplingComponent(... | |
d377867ea501c4d9dae1f5c3ce1efc02f0a9639b | check Python version | pympler/sizer/__init__.py | pympler/sizer/__init__.py | from asizeof import *
| Python | 0.000001 | @@ -1,8 +1,169 @@
+%0A # check supported Python version%0Aimport sys%0Aif getattr(sys, 'hexversion', 0) %3C 0x2020000:%0A raise NotImplementedError('sizer requires Python 2.2 or newer')%0A%0A
from asi
|
39de01462baf3db60c5a0f5d8a3b529f798730ab | Add script to check the performance | pygraphc/bin/Check.py | pygraphc/bin/Check.py | Python | 0 | @@ -0,0 +1,1178 @@
+import csv%0Afrom os import listdir%0Afrom pygraphc.evaluation.ExternalEvaluation import ExternalEvaluation%0A%0A# read result and ground truth%0Aresult_dir = '/home/hudan/Git/pygraphc/result/improved_majorclust/Kippo/per_day/'%0Agroundtruth_dir = '/home/hudan/Git/labeled-authlog/dataset/Kippo/attac... | |
477d310ca2add1a5fd539159592f36ca626502f0 | add way to read geotiffs | python/geotiffgrid.py | python/geotiffgrid.py | Python | 0 | @@ -0,0 +1,540 @@
+import gdal%0Afrom spacegrid import SpatialGrid%0A%0Aclass GeotiffGrid(SpatialGrid):%0A def __init__(self, filepath):%0A ds = gdal.Open(filepath)%0A x0_corner, sizex, zero1, y0_corner, zero2, sizey = ds.GetGeoTransform()%0A band = ds.GetRasterBand(1)%0A array = band.Rea... | |
8da927a0a196301ce5fb2ef2224e556b4d414729 | Add solution for counting DNA nucleotides | problem1.py | problem1.py | Python | 0.00001 | @@ -0,0 +1,256 @@
+from collections import Counter%0A%0Aif __name__ == '__main__':%0A%0A with open('data/rosalind_dna.txt', mode='r') as f:%0A sequence = f.read()%0A%0A counts = Counter(sequence)%0A%0A print '%25d %25d %25d %25d' %25 (counts%5B'A'%5D, counts%5B'C'%5D, counts%5B'G'%5D, counts%5B'T'%5D)%0... | |
a2f6a399c643b89c73aca2335b938f584cd572d5 | create Page object to better organize Links | page.py | page.py | Python | 0 | @@ -0,0 +1,1395 @@
+from bs4 import BeautifulSoup, SoupStrainer%0Afrom link import Link%0Aimport requests%0A%0A%0Aclass Page(object):%0A%0A def __init__(self, full_hyperlink, links=None):%0A self.full_hyperlink = full_hyperlink%0A self.links = links%0A%0A # This doesn't feel great, maybe pull ro... | |
5178b104993401f47b1c4d8e3c796bef379e389e | Add migration for `communities` app. | letsmeet/communities/migrations/0011_auto_20160318_2240.py | letsmeet/communities/migrations/0011_auto_20160318_2240.py | Python | 0 | @@ -0,0 +1,408 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.9 on 2016-03-18 21:40%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A dependencies = %5B%0A ('communities', '0010_auto_20160108_1618'),%0A %5D%0A%0A oper... | |
3b00a03240ba4c19c1b6a0dc03e22616ae3fda80 | Make grip import optional so that grip installation is optional. | py/generate_rest_api_docs.py | py/generate_rest_api_docs.py | # TODO: ugh:
import sys, pprint, argparse, string, errno
sys.path.extend(['.','py'])
import h2o, h2o_util
import os
# https://github.com/joeyespo/grip
# Transform GitHub-flavored Markdown to HTML
from grip import export
# print "ARGV is:", sys.argv
here=os.path.dirname(os.path.realpath(__file__))
parser = argparse... | Python | 0 | @@ -115,113 +115,8 @@
os%0A%0A
-# https://github.com/joeyespo/grip%0A# Transform GitHub-flavored Markdown to HTML%0Afrom grip import export%0A%0A
# pr
@@ -2921,32 +2921,160 @@
.generate_html:%0A
+ # https://github.com/joeyespo/grip%0A # Transform GitHub-flavored Markdown to HTML%0A from grip imp... |
50c8982bf2225225e9fa4de410f772f9d70b03bf | fix hd indicator | bihar/reports/indicators/calculations.py | bihar/reports/indicators/calculations.py | from bihar.reports.indicators.filters import A_MONTH, is_pregnant_mother, get_add, get_edd
from datetime import datetime, timedelta
from bihar.reports.indicators.visits import visit_is
EMPTY = (0,0)
GRACE_PERIOD = timedelta(days=7)
def _done_due(done, due):
return "%s/%s" % (done, due)
def _in_last_month(date):... | Python | 0.000001 | @@ -1889,16 +1889,22 @@
case.add
+, days
)%0A%0Adef _
@@ -2377,16 +2377,109 @@
nd add:%0A
+ add = datetime.combine(add, datetime.time(datetime.now())) #convert date to datetime%0A
@@ -4160,14 +4160,12 @@
e, '
-public
+home
', 2
@@ -4177,26 +4177,25 @@
cases)%0A d
-on
+u
e = len(vali
@@ -4200,... |
eee85e5157d69cee515c01fa0f638b064de74a6e | Add a script to graph problem reports over time by transport mode | script/graph-reports-by-transport-mode.py | script/graph-reports-by-transport-mode.py | Python | 0 | @@ -0,0 +1,2485 @@
+#!/usr/bin/python%0A%0A# A script to draw graphs showing the number of reports by transport%0A# type each month. This script expects to find a file called%0A# 'problems.csv' in the current directory which should be generated%0A# by:%0A# DIR=%60pwd%60 rake data:create_problem_spreadsheet%0A%0A... | |
bdbf5f538ea15360004a4efe769b629c3032b4bb | add admin view for eventschedule | lib/rapidsms/contrib/scheduler/admin.py | lib/rapidsms/contrib/scheduler/admin.py | Python | 0 | @@ -0,0 +1,261 @@
+#!/usr/bin/env python%0A# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8%0A%0Afrom django.contrib import admin%0Afrom .models import EventSchedule%0A%0Aclass EventScheduleAdmin(admin.ModelAdmin):%0A model = EventSchedule%0A%0Aadmin.site.register(EventSchedule, EventScheduleAdmin)%0A
| |
26d56afb094db4b471ec6bd6d5e496e0f9b547d0 | check all dataset shapes | pygam/tests/test_datasets.py | pygam/tests/test_datasets.py | Python | 0.000001 | @@ -0,0 +1,2494 @@
+# -*- coding: utf-8 -*-%0A%0Aimport numpy as np%0Aimport pytest%0A%0Afrom pygam.datasets import cake%0Afrom pygam.datasets import coal%0Afrom pygam.datasets import default%0Afrom pygam.datasets import faithful%0Afrom pygam.datasets import hepatitis%0Afrom pygam.datasets import mcycle%0Afrom pygam.da... | |
255a7e7e15eec5b20dda416bc269a468fcd9c7c5 | test of new getStudyIngestMessagesForNexSON treemachine service... the rest of the commit. | test_gols_get_study_ingest_messages.py | test_gols_get_study_ingest_messages.py | Python | 0 | @@ -0,0 +1,666 @@
+#!/usr/bin/env python%0Aimport sys%0Aimport requests%0Aimport json%0Afrom opentreetesting import config, summarize_json_response%0ADOMAIN = config('host', 'golshost')%0Ap = '/ext/GoLS/graphdb/getStudyIngestMessagesForNexSON'%0Aif DOMAIN.startswith('http://127.0.0.1'):%0A p = '/db/data' + p%0ASUBMI... | |
796dd87582c5327865602fdeeac74f8e35407ccf | Add compiler file | compiler.py | compiler.py | Python | 0.000002 | @@ -0,0 +1,456 @@
+from lex_1 import generate_lex%0Afrom parser_2 import generate_parser%0Afrom semantic_3 import generate_semantic%0Afrom generator_4 import generate_output%0A%0Aif __name__ == %22__main__%22:%0A import os%0A test_dir = %22./tests/compiling/%22%0A for file in os.listdir(test_dir):%0A pr... | |
b75de39ae75b3780988673ffbab869dec20c1521 | Add uwsgi conf file for star and shadow | serverconfig/toolkit_uwsgi_star_shadow.py | serverconfig/toolkit_uwsgi_star_shadow.py | Python | 0 | @@ -0,0 +1,1277 @@
+# mysite_uwsgi.ini file%0A# http://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html%0A%5Buwsgi%5D%0A%0A# Django-related settings%0A# the base directory (full path)%0Achdir = /home/users/starandshadow/star_site%0A%0A# Django's wsgi file%0Amodule = wsgi%0A# the vi... | |
4bfc3f650bd5560f2e2e469252ea1166496a4b6b | Add dodgy NetCDF creation example | example1.py | example1.py | Python | 0 | @@ -0,0 +1,1741 @@
+from __future__ import print_function%0Afrom datacube.api.model import DatasetType, Satellite, Ls57Arg25Bands, Fc25Bands, Pq25Bands%0Afrom datacube.api.query import list_tiles_as_list%0Afrom datacube.api.utils import get_dataset_metadata%0Afrom datacube.api.utils import get_dataset_data%0A%0Afrom ge... | |
f12500c836d2d5f04d3ad68b2b227f11b68af136 | Add python script to send example task to the queue to test it | bin/send.py | bin/send.py | Python | 0 | @@ -0,0 +1,564 @@
+#!/usr/bin/env python%0Aimport pika%0Aimport json%0A%0Amsg = %7B%0A 'url':'http://www.google.co.uk',%0A 'site': 'gtk',%0A 'account': 'me',%0A 'type': 'har'%0A%7D%0Aconnection = pika.BlockingConnection(pika.ConnectionParameters(%0A 'localhost'))%0Achannel = connection.channel... | |
c4b084dab7e343d2fa33c229716525096450e568 | Correct import style for SleekXMPP | flexget/plugins/output/notify_xmpp.py | flexget/plugins/output/notify_xmpp.py | from __future__ import unicode_literals, division, absolute_import
import logging
import sleekxmpp
from flexget.plugin import register_plugin
from flexget.utils.template import RenderError, render_from_task
log = logging.getLogger('notify_xmpp')
class SendMsgBot(sleekxmpp.ClientXMPP):
def __init__(self, jid, p... | Python | 0 | @@ -78,25 +78,8 @@
ging
-%0Aimport sleekxmpp
%0A%0Afr
@@ -118,16 +118,33 @@
r_plugin
+, DependencyError
%0Afrom fl
@@ -243,16 +243,51 @@
mpp')%0A%0A%0A
+try:%0A import sleekxmpp%0A %0A
class Se
@@ -318,17 +318,25 @@
tXMPP):%0A
-%0A
+ %0A
def
@@ -386,16 +386,20 @@
ssage):%0A
+
... |
bbf28b1c7fa3fb9f9074b9d4879c30e810ab3f31 | Add premise of Bench Manager | ktbs_bench/utils/bench_manager.py | ktbs_bench/utils/bench_manager.py | Python | 0.000169 | @@ -0,0 +1,661 @@
+from contextlib import contextmanager%0A%0Afrom ktbs_bench.utils.decorators import bench as util_bench%0A%0A%0Aclass BenchManager:%0A def __init__(self):%0A self._contexts = %5B%5D%0A self._bench_funcs = %5B%5D%0A%0A def bench(self, func):%0A %22%22%22Prepare a function to ... | |
cbb182ff0e999954c7a5c8fd19097a441762666b | Add sdb driver for etcd | salt/sdb/etcd_db.py | salt/sdb/etcd_db.py | Python | 0 | @@ -0,0 +1,1791 @@
+# -*- coding: utf-8 -*-%0A'''%0Aetcd Database Module%0A%0A:maintainer: SaltStack%0A:maturity: New%0A:depends: python-etcd%0A:platform: all%0A%0AThis module allows access to the etcd database using an %60%60sdb://%60%60 URI. This%0Apackage is located at %60%60https://pypi.python.or... | |
23bb5deda2f6217ceab6a6e60e26234919a1f24e | Add buildbot.py | buildbot.py | buildbot.py | Python | 0.000001 | @@ -0,0 +1,2714 @@
+%EF%BB%BF#!/usr/bin/env python%0A# encoding: utf-8%0A%0Aimport os%0Aimport sys%0Aimport json%0Aimport subprocess%0A%0Aproject_name = 'kw'%0A%0A%0Adef run_command(args):%0A print(%22Running: %7B%7D%22.format(args))%0A sys.stdout.flush()%0A subprocess.check_call(args)%0A%0A%0Adef get_tool_opt... | |
916c453d2ba939fb7eb15f4d87557c37bfc57a21 | Add test for shell command | tests/components/test_shell_command.py | tests/components/test_shell_command.py | Python | 0.000001 | @@ -0,0 +1,1067 @@
+%22%22%22%0Atests.test_shell_command%0A~~~~~~~~~~~~~~~~~~~~~~~~%0A%0ATests demo component.%0A%22%22%22%0Aimport os%0Aimport tempfile%0Aimport unittest%0A%0Afrom homeassistant import core%0Afrom homeassistant.components import shell_command%0A%0A%0Aclass TestShellCommand(unittest.TestCase):%0A %22... | |
029de4a3a10f31b2d300e100db7767722698f00a | Test for newly refactored literal rule | tests/core/parse/test_parse_literal.py | tests/core/parse/test_parse_literal.py | Python | 0 | @@ -0,0 +1,1608 @@
+import unittest%0A%0Afrom mygrations.core.parse.rule_literal import rule_literal%0A%0Aclass test_parse_regexp( unittest.TestCase ):%0A%0A def get_rule( self, name, literal ):%0A%0A return rule_literal( False, %7B 'name': name, 'value': literal %7D, %7B%7D )%0A%0A def test_name_not_requi... | |
d64ade91c9670e4d6e03732cc927cdfce35e1d73 | Implemented similarity task | similarity.py | similarity.py | Python | 0.99918 | @@ -0,0 +1,1869 @@
+__author__ = 'rwechsler'%0Aimport codecs%0Afrom collections import defaultdict%0Aimport gensim%0Aimport re%0A%0Adef load_word2vecmodel(file_name):%0A return gensim.models.Word2Vec.load_word2vec_format(file_name, binary=True)%0A%0Adef load_prototypes(file_name):%0A prototypes = dict()%0A inf... | |
c7a5a525ce92ddaf43919191ea2df83071793d64 | Fix DavStorage._requests | vdirsyncer/storage/dav/base.py | vdirsyncer/storage/dav/base.py | # -*- coding: utf-8 -*-
'''
vdirsyncer.storage.dav.base
~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2014 Markus Unterwaditzer, Christian Geier and contributors
:license: MIT, see LICENSE for more details.
'''
from ..base import Storage, Item
import vdirsyncer.exceptions as exceptions
import requests
imp... | Python | 0 | @@ -2997,24 +2997,68 @@
ders=None):%0A
+ path = path or self.parsed_url.path%0A
if s
|
9bcd540b4ba9e9e38f674b02b47e42eb29a1cf2f | add gender choices data migration | accelerator/migrations/0029_add_gender_choices_data.py | accelerator/migrations/0029_add_gender_choices_data.py | Python | 0.000013 | @@ -0,0 +1,838 @@
+# Generated by Django 2.2.10 on 2020-12-01 19:01%0A%0Afrom django.db import migrations%0Afrom accelerator_abstract.models.base_gender_choices import GENDER_CHOICES%0A%0A%0Adef add_gender_choices(apps, schema_editor):%0A GenderChoices = apps.get_model('accelerator', 'GenderChoices')%0A db_gender... | |
795bd9bca8779b32b1e48e420ab42fefbb73fdfc | add Driver migration | migrations/0001_initial.py | migrations/0001_initial.py | Python | 0 | @@ -0,0 +1,932 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.10.1 on 2016-09-23 15:48%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0Aimport django_countries.fields%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A initial = True%0A%0A dependencies = %5B%0A ... | |
82301349226ec43dcec53d5ceceaa952d8d4b9b5 | Test the use_plus_uconst optimizer | i8c/tests/test_opt_use_plus_uconst.py | i8c/tests/test_opt_use_plus_uconst.py | Python | 0.000035 | @@ -0,0 +1,1429 @@
+from i8c.tests import TestCase%0A%0ASOURCE = %22%22%22%5C%0Adefine test::optimize_use_plus_uconst returns int%0A argument int x%0A%0A load %25s%0A add%0A%22%22%22%0A%0Aclass TestOptimizeUsePlusUconst(TestCase):%0A def test_optimize_use_plus_uconst(self):%0A %22%22%22Check that DW_... | |
a72516f4faae6993d55b7a542ef9b686c6e659fb | Add NoCommandAction to only continue execution when a non-command text event is received | bot/action/core/command/no_command.py | bot/action/core/command/no_command.py | Python | 0 | @@ -0,0 +1,547 @@
+from bot.action.core.action import IntermediateAction%0Afrom bot.action.core.command import CommandAction%0A%0A%0Aclass NoCommandAction(IntermediateAction):%0A def process(self, event):%0A for entity in self.get_entities(event):%0A if self.is_valid_command(entity):%0A ... | |
c0fd273ff11f4953024e0a7b2fc8346b62ec8ac2 | Use Django's six instead of global six | src/oscar/__init__.py | src/oscar/__init__.py | import os
import six
# Use 'dev', 'beta', or 'final' as the 4th element to indicate release type.
VERSION = (1, 1, 0, 'dev')
def get_short_version():
return '%s.%s' % (VERSION[0], VERSION[1])
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
# Append 3rd digit if > 0
if VERSION[2]:
... | Python | 0.004818 | @@ -6,19 +6,8 @@
t os
-%0Aimport six
%0A%0A#
@@ -81,17 +81,16 @@
e type.%0A
-%0A
VERSION
@@ -2147,16 +2147,149 @@
E_APPS%0A%0A
+ # Conservative import to ensure that this file can be loaded%0A # without the presence Django.%0A from django.utils import six%0A
if i
|
9d07de510626a23ce14d8389200c8dc2628cc5ef | Check the path in the zip archive not the path to the file. | build/android/gyp/util/build_utils.py | build/android/gyp/util/build_utils.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import contextlib
import fnmatch
import json
import os
import pipes
import shlex
import shutil
import subprocess
import sys
import tempfile
import zipfile
C... | Python | 0.000008 | @@ -5388,17 +5388,44 @@
ZipPath(
-f
+os.path.relpath(f, base_dir)
)%0A
|
31717dc26912aedd42ca475b4e3d1a406523e44a | add to connect mysql with pymysql | base100/crawler/data_store.py | base100/crawler/data_store.py | Python | 0.000001 | @@ -0,0 +1,652 @@
+#!/usr/bin/python%0A# --*-- UTF8 --*--%0A%0A%0Aimport pymysql%0A%0A%0Adef db_connect():%0A '''%0A %E6%95%B0%E6%8D%AE%E5%BA%93%E9%85%8D%E7%BD%AE%0A :return: con%0A '''%0A%0A con = pymysql.connect(%0A host='172.16.223.10',%0A user='root',%0A passwd='123456',%0A ... | |
bc3ded5eda2cb31523dfaf9bf7eec4fbe1030a0b | add find_pcs.py, but only with some prep code and eline masking | find_pcs.py | find_pcs.py | Python | 0 | @@ -0,0 +1,1584 @@
+import numpy as np%0Afrom astropy import constants as c, units as u%0A%0Aclass StellarPop_PCA(object):%0A '''%0A class for determining PCs of a library of synthetic spectra%0A '''%0A def __init__(self, l, spectra, dlogl=None):%0A '''%0A params:%0A - l: length-n arra... | |
2e20d0bb09234f36b5d43fc1f4b99cdb1da0e7f8 | Add unsigned-workup utility script. | scripts/check_unsigned.py | scripts/check_unsigned.py | Python | 0 | @@ -0,0 +1,390 @@
+from datetime import date%0Afrom pttrack.models import Provider, Workup%0A%0Aunsigned_workups = Workup.objects.filter(signer=None)%0A%0Aprint unsigned_workups%0A%0Afor wu in unsigned_workups:%0A d = wu.clinic_day.clinic_date%0A providers = Provider.objects.filter(%0A signed_workups__in=W... | |
e41ce4338334794466ba6918fc3b8a1f118d6b41 | Add first example test of using h2o python API to gradle build regression suite. | py/testdir_multi_jvm/test_gbm_prostate.py | py/testdir_multi_jvm/test_gbm_prostate.py | Python | 0 | @@ -0,0 +1,1293 @@
+import sys%0Asys.path.insert(1, '../../h2o-py/src/main/py')%0A%0Afrom h2o import H2OConnection%0Afrom h2o import H2OFrame%0Afrom h2o import H2OGBM%0Afrom tabulate import tabulate%0A%0A######################################################%0A# Parse command-line args.%0A#%0A# usage: python test_name... | |
c27685da10c85cb9876b4c73012da3ebff1915dc | Add exercise horse racing duals | codingame/easy/horse-racing_duals.py | codingame/easy/horse-racing_duals.py | Python | 0.000001 | @@ -0,0 +1,214 @@
+N = int(raw_input())%0Alst = %5B%5D%0A# Read the list%0Afor i in xrange(N):%0A lst.append(int(raw_input()))%0A%0A# Sort the list, ascending order%0Aa = sorted(lst)%0A# Find the min difference%0Aprint min(y-x for x,y in zip(a, a%5B1:%5D))
| |
cf592b24b0cc8e8944f32e1389379d57c8b9d96a | add list of universities | scripts/make_unis_list.py | scripts/make_unis_list.py | Python | 0.000005 | @@ -0,0 +1,1450 @@
+import re%0Aimport json%0A%0Adef make_country_key_to_iso_code_dict(country_lines):%0A country_key_to_iso_code = %7B%7D%0A for line in country_lines:%0A m = re.match(%22%5C((%5Cd+),%22, line)%0A if m is not None:%0A country_key = int(m.group(1))%0A iso_code =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.