commit
stringlengths
40
40
subject
stringlengths
1
1.49k
old_file
stringlengths
4
311
new_file
stringlengths
4
311
new_contents
stringlengths
1
29.8k
old_contents
stringlengths
0
9.9k
lang
stringclasses
3 values
proba
float64
0
1
841fb156fff3d257d39afdc9d3d4e587427fe2cf
Add new file missed in earlier commit place holder for projects that do not load for some reason
Source/Scm/wb_scm_project_place_holder.py
Source/Scm/wb_scm_project_place_holder.py
''' ==================================================================== Copyright (c) 2016 Barry A Scott. All rights reserved. This software is licensed as described in the file LICENSE.txt, which you should have received as part of this distribution. ===========================================================...
Python
0
f1ba45809e6682235c07ab89e4bc32e56b2fa84f
Create i_love_lance_janice.py
i_love_lance_janice.py
i_love_lance_janice.py
""" I Love Lance & Janice ===================== You've caught two of your fellow minions passing coded notes back and forth - while they're on duty, no less! Worse, you're pretty sure it's not job-related - they're both huge fans of the space soap opera "Lance & Janice". You know how much Commander Lambda hates waste, ...
Python
0.000014
a08a7da41300721e07c1bff8e36e3c3d69af06fb
Add py-asdf package (#12817)
var/spack/repos/builtin/packages/py-asdf/package.py
var/spack/repos/builtin/packages/py-asdf/package.py
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyAsdf(PythonPackage): """The Advanced Scientific Data Format (ASDF) is a next-generation ...
Python
0
7f4642fc2e0edba668482f2ebbb64ab8870e709a
Initialize P01_basics
books/AutomateTheBoringStuffWithPython/Chapter01/P01_basics.py
books/AutomateTheBoringStuffWithPython/Chapter01/P01_basics.py
# This program performs basic Python instructions # Expressions print(2 + 2) print(2 + 3 * 6) print((2 + 3) * 6) print(48565878 * 578453) print(2 ** 8) print(23 / 7) print(23 // 7) print(23 % 7) print(2 + 2) print((5 - 1) * ((7 + 1) / (3 - 1))) # Uncomment to see what happens #print(5 + ) #print(42 + 5 +...
Python
0.000002
ea6d73ac2b9274eae0a866acd1e729854c59fb17
Add update.py to drive the update loop.
kettle/update.py
kettle/update.py
#!/usr/bin/env python # Copyright 2017 The Kubernetes Authors. # # 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 appli...
Python
0
5114f177741b105f33819b98415702e53b52eb01
Add script to update site setup which is used at places like password reset email [skip ci]
corehq/apps/hqadmin/management/commands/update_site_setup.py
corehq/apps/hqadmin/management/commands/update_site_setup.py
from django.core.management.base import BaseCommand, CommandError from django.contrib.sites.models import Site from django.conf import settings class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument( 'site_address', help="the new site address that should b...
Python
0
23747d8181e7b9c576d07c4b3d50a0ac8a60cd3e
Add wunderground module
i3pystatus/wunderground.py
i3pystatus/wunderground.py
from i3pystatus import IntervalModule from i3pystatus.core.util import user_open, internet, require from datetime import datetime from urllib.request import urlopen import json import re GEOLOOKUP_URL = 'http://api.wunderground.com/api/%s/geolookup%s/q/%s.json' STATION_LOOKUP_URL = 'http://api.wunderground.com/api/%s...
Python
0
6fd0cee9bca0449aa6aab6a62e470ba8ff909cbb
print all caesar rotations for some string
language/rotN.py
language/rotN.py
#! /usr/bin/env python import string ciphered = "LVFU XAN YIJ UVXRB RKOYOFB" def make_rot_n(n): # http://stackoverflow.com/questions/3269686/short-rot13-function lc = string.ascii_lowercase uc = string.ascii_uppercase trans = string.maketrans(lc + uc, lc[n:] + lc[:n] + uc[...
Python
0.031516
d3dbb797575221d574fdda9c3d087d8696f6091a
Add netstring lib
lib/netstring.py
lib/netstring.py
def encode_netstring(s): return str(len(s)).encode('ascii') + b':' + s + b',' def consume_netstring(s): """If s is a bytestring beginning with a netstring, returns (value, rest) where value is the contents of the netstring, and rest is the part of s after the netstring. Raises ValueError if s ...
Python
0.000002
9f5c3715f4b3cd5bf451bdc504cded6459e8ee79
add one test file and add content to it
test/unit_test/test_similarity2.py
test/unit_test/test_similarity2.py
from lexos.helpers.error_messages import MATRIX_DIMENSION_UNEQUAL_MESSAGE count_matrix = [['', 'The', 'all', 'bobcat', 'cat', 'caterpillar', 'day.', 'slept'], ['catBobcat', 9.0, 9.0, 5.0, 4.0, 0.0, 9.0, 9.0], ['catCaterpillar', 9.0, 9.0, 0.0, 4.0, 5.0, 9.0, 9.0], ...
Python
0
44863ff1f7064f1d9a9bb897822834eb6755ed59
Add SMTP auth server
authserver.py
authserver.py
import bcrypt import asyncore from secure_smtpd import SMTPServer, FakeCredentialValidator from srht.objects import User class UserValidator(object): def validate(self, username, password): user = User.query.filter(User.username == username).first() if not user: return False ret...
Python
0.000001
f56e390be0e2cea8e08080029aad756a6ab3c91f
Add lc0253_meeting_rooms_ii.py from Copenhagen :)
lc0253_meeting_rooms_ii.py
lc0253_meeting_rooms_ii.py
"""Leetcode 253. Meeting Rooms II (Premium) Medium URL: https://leetcode.com/problems/meeting-rooms-ii Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), find the minimum number of conference rooms required. """ class Solution2(object): # @param {Interval[...
Python
0
8b4c34e84d306b5f9021de47bc3ae9050e2fc2b3
Fix loading of ply files exported by meshlab
compare_clouds.py
compare_clouds.py
#!/usr/bin/env python3 from pathlib import Path """Code for comparing point clouds""" cloud1Path = Path("./data/reconstructions/2016_10_24__17_43_17/reference.ply") cloud2Path = Path("./data/reconstructions/2016_10_24__17_43_17/high_quality.ply") from load_ply import load_ply cloud1PointData = load_ply(cloud1Path)...
Python
0
4f70773bb9041c44b0f83ef61a46d5fa974b366e
Create conwaytesting.py
conwaytesting.py
conwaytesting.py
Python
0
73d753e315c7feb18af39360faf4d6fc6d10cedf
test to demonstrate bug 538
tests/text/ELEMENT_CHANGE_STYLE.py
tests/text/ELEMENT_CHANGE_STYLE.py
#!/usr/bin/env python '''Test that inline elements can have their style changed, even after text has been deleted before them. [This triggers bug 538 if it has not yet been fixed.] To run the test, delete the first line, one character at a time, verifying that the element remains visible and no tracebacks are printed...
Python
0
2e796f38dbdc1044c13a768c76fa733ad07b9829
Add astro/21cm/extract_slice.py
astro/21cm/extract_slice.py
astro/21cm/extract_slice.py
#!/usr/bin/env python3 # # Copyright (c) 2017 Weitian LI <weitian@aaronly.me> # MIT License # """ Extract a slice from the 21cm cube and save as FITS image. """ import os import sys import argparse import numpy as np import astropy.io.fits as fits def main(): outfile_default = "{prefix}_z{z:05.2f}_N{Nside}_L{L...
Python
0.000006
0bf7d9fb20a3d2588ffc0e8341ec2af3df5fe300
Add test for depot index page
depot/tests/test_depot_index.py
depot/tests/test_depot_index.py
from django.test import TestCase, Client from depot.models import Depot def create_depot(name, state): return Depot.objects.create(name=name, active=state) class DepotIndexTestCase(TestCase): def test_depot_index_template(self): response = self.client.get('/depots/') self.assertTemplateUsed...
Python
0
2a903d721c44f9c6b53c8516b28b9dd6c1faa5e0
Create crawler_utils.py
crawler_utils.py
crawler_utils.py
import json import os.path def comments_to_json(comments): result = [] for comment in comments: result.append({"score": comment.score, "url": comment.permalink, "body": comment.body, "id": comment.id, "replies"...
Python
0.000017
d81a1f3ef63aef7f003a018f26ea636cf47cfc5d
Add init file for installation
jswatchr/__init__.py
jswatchr/__init__.py
from jswatchr import *
Python
0
7850371982cc50dc2a5a59c7b01d5a1bec80cf3f
Add FairFuzz tool spec
benchexec/tools/fairfuzz.py
benchexec/tools/fairfuzz.py
""" BenchExec is a framework for reliable benchmarking. This file is part of BenchExec. Copyright (C) 2007-2015 Dirk Beyer 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 ht...
Python
0
a39fbd74eaf84c757f15d14bfc728bd1d0f63bd4
Create blockchain.py
blockchain.py/blockchain.py
blockchain.py/blockchain.py
########################### # build your own blockchain from scratch in python3! # # inspired by # Let's Build the Tiniest Blockchain In Less Than 50 Lines of Python by Gerald Nash # see https://medium.com/crypto-currently/lets-build-the-tiniest-blockchain-e70965a248b # # # to run use: # $ python ./block...
Python
0.999863
37db687b4167aee0e88036c5d85995de891453ed
Create cbalusek_01.py
Week01/Problem01/cbalusek_01.py
Week01/Problem01/cbalusek_01.py
#This project defines a function that takes any two numbers and sums their multiples to some cutoff value def sum(val1, val2, test): i = 1 j = 1 cum = 0 while i*val1 < test: cum += i*val1 i += 1 while j*val2 < test: if j*val2%val1 != 0: cum += j*val2 ...
Python
0.000048
089f93bcf7157ee3eaf83964294c5c2df19683f0
Create retweet.py
settings-search_query-yourHashtag-Leave-empty-for-all-languages-tweet_language-Create-your-app-on-http/retweet.py
settings-search_query-yourHashtag-Leave-empty-for-all-languages-tweet_language-Create-your-app-on-http/retweet.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import os, ConfigParser, tweepy, inspect, hashlib path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) # read config config = ConfigParser.SafeConfigParser() config.read(os.path.join(path, "config")) # your hashtag or search query and tweet l...
Python
0.000002
cc79ee252e09ade17961d03265c61a87e270bd88
Make color emoji use character sequences instead of PUA.
nototools/map_pua_emoji.py
nototools/map_pua_emoji.py
#!/usr/bin/python # # Copyright 2014 Google Inc. 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...
Python
0
2a5b7773af3e9516d8a4a3df25c0b829598ebb1c
Remove redundant str typecasting
nova/tests/uuidsentinel.py
nova/tests/uuidsentinel.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
Python
0.000009
ac673650673f7d6b9785d577499037bf9db4435a
refactor prompt abstraction
lib/smashlib/prompt.py
lib/smashlib/prompt.py
""" smash.prompt """ from smashlib.data import PROMPT_DEFAULT as DEFAULT class Prompt(dict): def __setitem__(self, k, v, update=True): if k in self: raise Exception,'prompt component is already present: ' + str(k) super(Prompt, self).__setitem__(k, v) if update: sel...
Python
0.000003
2c178c5ea05d2454ef6896aaf9c58b6536f5a15f
Create bubblesort.py
bubblesort.py
bubblesort.py
def bubblesort(lst): #from last index to second for passes in range(len(lst) - 1, 0, -1): #from [0,passes[ keep swapping to put the largest #number at index passes for i in range(passes): if lst[i] > lst[i+1]: swap(lst, i, i+1) return lst def ...
Python
0.000003
9e954d5181d36762a8c34e69516c7f5510bae5a7
add exception class to use for mtconvert errors
oldowan/mtconvert/error.py
oldowan/mtconvert/error.py
class MtconvertError(Exception): """Exception raised for errors in the mtconvert module. Attributes: expression -- input expression in which the error occurred message -- explanation of the error """ def __init__(self, expression, message): self.expression = expression ...
Python
0
3adcefcad4fc3ecb85aa4a22e8b3c4bf5ca4e6f5
Add tests for revision updates via import
test/integration/ggrc/converters/test_import_update.py
test/integration/ggrc/converters/test_import_update.py
# Copyright (C) 2016 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> """Tests for bulk updates with CSV import.""" from integration.ggrc.converters import TestCase from ggrc import models class TestImportUpdates(TestCase): """ Test importing of already existing objects...
# Copyright (C) 2016 Google Inc. # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file> from integration.ggrc.converters import TestCase from ggrc import models class TestImportUpdates(TestCase): """ Test importing of already existing objects """ def setUp(self): TestCase.setUp(sel...
Python
0
f79d10de2adb99e3a3d07caa2a00359208186c15
Add twext.python.datetime tests
twext/python/test/test_datetime.py
twext/python/test/test_datetime.py
## # Copyright (c) 2006-2010 Apple Inc. 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 applicable l...
Python
0.000006
157cb4518412a6e6de9c3d0d64c68ac0af276c6a
Access checking unit tests added for FormPage view.
tests/app/soc/modules/gsoc/views/test_student_forms.py
tests/app/soc/modules/gsoc/views/test_student_forms.py
# Copyright 2013 the Melange authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
Python
0
e48caa4bb61cce466ad5eb9bffbfba8e33312474
Add Python EC2 TerminateInstances example
python/example_code/ec2/terminate_instances.py
python/example_code/ec2/terminate_instances.py
# snippet-comment:[These are tags for the AWS doc team's sample catalog. Do not remove.] # snippet-sourcedescription:[terminate_instances.py demonstrates how to terminate an Amazon EC2 instance.] # snippet-service:[ec2] # snippet-keyword:[Amazon EC2] # snippet-keyword:[Python] # snippet-keyword:[AWS SDK for Python (Bot...
Python
0
34c0ca7ba0f8d2ac51583dfab4ea2f4cee7a62d5
add script to read csv files to list
python/read_formated_txt_file/read_csv2list.py
python/read_formated_txt_file/read_csv2list.py
import csv def csv_to_list(csv_file, delimiter=','): """ Reads in a CSV file and returns the contents as list, where every row is stored as a sublist, and each element in the sublist represents 1 cell in the table. """ with open(csv_file, 'r') as csv_con: reader = csv.reader(csv_c...
Python
0
d402c25a6b257778e08e6db2890ae575432daed0
Add new linkedlist file for intersection
linkedlist/intersection.py
linkedlist/intersection.py
def intersection(h1, h2): """ This function takes two lists and returns the node they have in common, if any. In this example: 1 -> 3 -> 5 \ 7 -> 9 -> 11 / 2 -> 4 -> 6 ...we would return 7. Note that the node itself is the unique identifier, n...
Python
0
8f1cf446a0b602e6e64ccebaa794e7ec6a2f840d
add support routines for oversampling
compressible_fv4/initialization_support.py
compressible_fv4/initialization_support.py
"""Routines to help initialize cell-average values by oversampling the initial conditions on a finer mesh and averaging down to the requested mesh""" import mesh.fv as fv def get_finer(myd): mgf = myd.grid.fine_like(4) fd = fv.FV2d(mgf) for v in myd.names: fd.register_var(v, myd.BCs[v]) fd....
Python
0
4227cef6567023717c8d66f99ce776d9d8aa0929
Add OS::Contrail::PhysicalRouter
contrail_heat/resources/physical_router.py
contrail_heat/resources/physical_router.py
from heat.engine import properties from vnc_api import vnc_api from contrail_heat.resources import contrail import uuid class HeatPhysicalRouter(contrail.ContrailResource): PROPERTIES = ( NAME, ) = ( 'name', ) properties_schema = { NAME: properties.Schema( properti...
Python
0.000001
5cebd0b56f81dfc02feb5511dade82ebf6db99ff
add presence.py
litecord/presence.py
litecord/presence.py
''' presence.py - presence management Sends PRESENCE_UPDATE to clients when needed ''' class PresenceManager: def __init__(self, server): self.server = server async def update_presence(self, user_id, status): ''' PresenceManager.update_presence(user_id, status) Updates the pr...
Python
0.000002
02c59aa1d2eec43442f4bcf1d6662535e094bffd
add move pics by modified date
media/pic_date_move.py
media/pic_date_move.py
''' File: pic_date_move.py Created: 2021-04-01 10:46:38 Modified: 2021-04-01 10:46:43 Author: mcxiaoke (github@mcxiaoke.com) License: Apache License 2.0 ''' import os import sys import shutil from datetime import date, datetime import pathlib def move_one_file(src_file): old_file = pathlib.Path(src_file) old...
Python
0
3ae5dc9a4325251033d3db9cae0d80eb4812815d
Add lazy iterator
minio/lazy_iterator.py
minio/lazy_iterator.py
# Minimal Object Storage Library, (C) 2015 Minio, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
Python
0.00005
860f93d2bb4c08b63c64fe9e5b7b620b824d8490
test ++/--/+
pychecker/pychecker2/utest/ops.py
pychecker/pychecker2/utest/ops.py
from pychecker2 import TestSupport from pychecker2 import OpChecks class OpTests(TestSupport.WarningTester): def testOperator(self): for op in ['--', '++']: self.warning('def f(x):\n' ' return %sx' % op, 2, OpChecks.OpCheck.operator, op) ...
Python
0.000069
cfb77bbe0c77a67c536614bf9fece1e9fcde4eb0
make find_configs filter name more descriptive
crosscat/utils/experiment_utils.py
crosscat/utils/experiment_utils.py
import os # import crosscat.utils.file_utils as file_utils import crosscat.utils.geweke_utils as geweke_utils import crosscat.utils.general_utils as general_utils result_filename = geweke_utils.summary_filename writer = geweke_utils.write_result reader = geweke_utils.read_result runner = geweke_utils.run_geweke def...
import os # import crosscat.utils.file_utils as file_utils import crosscat.utils.geweke_utils as geweke_utils import crosscat.utils.general_utils as general_utils result_filename = geweke_utils.summary_filename writer = geweke_utils.write_result reader = geweke_utils.read_result runner = geweke_utils.run_geweke def...
Python
0.000001
58fee826ab5298f7de036bf320bbc109b853eec8
Add null check for sds sync thread which can be optional
tendrl/commons/manager/__init__.py
tendrl/commons/manager/__init__.py
import abc import logging import six from tendrl.commons import jobs LOG = logging.getLogger(__name__) @six.add_metaclass(abc.ABCMeta) class Manager(object): def __init__( self, sds_sync_thread, central_store_thread, ): self._central_store_thread = central_store_...
import abc import logging import six from tendrl.commons import jobs LOG = logging.getLogger(__name__) @six.add_metaclass(abc.ABCMeta) class Manager(object): def __init__( self, sds_sync_thread, central_store_thread, ): self._central_store_thread = central_store_...
Python
0
4928fbe97dfa59b8a4c1e9726657df5269f2f900
Test variable records and JSON
tests/test_variable_data_record.py
tests/test_variable_data_record.py
import os import sys import json myPath = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, myPath + '/../') import unittest import meterbus from meterbus.exceptions import * from json import encoder class TestSequenceFunctions(unittest.TestCase): def setUp(self): self.frame = "\x68\x53\x53\...
Python
0
27cce3b6708a17f813f0a82871c988fec3a36517
Add quart to contrib (#300)
rollbar/contrib/quart/__init__.py
rollbar/contrib/quart/__init__.py
""" Integration with Quart """ from quart import request import rollbar def report_exception(app, exception): rollbar.report_exc_info(request=request) def _hook(request, data): data['framework'] = 'quart' if request: data['context'] = str(request.url_rule) rollbar.BASE_DATA_HOOK = _hook
Python
0
e5a39d4e17a0555cb242731b34f0ee480367b4fe
Add task that sends out notifications
foireminder/foireminder/reminders/tasks.py
foireminder/foireminder/reminders/tasks.py
from django.utils import timezone from .models import ReminderRequest, EmailReminder def send_todays_notifications(self): today = timezone.now() reminders = ReminderRequest.objects.filter( start__year=today.year, start__month=today.month, start__day=today.da ) for reminder in ...
Python
0.999047
9efda5a5a2b7aa16423e68fb10e1a0cb94c1f33e
Create rectangles_into_squares.py
rectangles_into_squares.py
rectangles_into_squares.py
#Kunal Gautam #Codewars : @Kunalpod #Problem name: Rectangles into Squares #Problem level: 6 kyu def sqInRect(lng, wdth): if lng==wdth: return None li=[] while lng and wdth: if lng>wdth: lng-=wdth li.append(wdth) else: wdth-=lng li.append(lng)...
Python
0.999056
c5fc38749dcf966787f6c6a201e23c310a22358c
Add script to update UniProt protein names
src/main/resources/org/clulab/reach/update_uniprot.py
src/main/resources/org/clulab/reach/update_uniprot.py
import os import re import csv import requests import itertools from gilda.generate_terms import parse_uniprot_synonyms # Base URL for UniProt uniprot_url = 'http://www.uniprot.org/uniprot' # Get protein names, gene names and the organism columns = ['id', 'protein%20names', 'genes', 'organism'] # Only get reviewed en...
Python
0
aeadfbd4ae1f915291328f040cda54f309743024
Add main application code
oline-gangnam-style.py
oline-gangnam-style.py
from jinja2 import Environment, FileSystemLoader import json import os import sys env = Environment(loader=FileSystemLoader(".")) template = env.get_template('ircd.conf.jinja') config = {} with open(sys.argv[1] if len(sys.argv) > 1 else "config.json", "r") as fin: config = json.loads(fin.read()) network = conf...
Python
0.000001
7a6b5396ce760eaa206bfb9b556a374c9c17f397
Add DecisionTree estimator.
bike-sharing/2-decision-tree.py
bike-sharing/2-decision-tree.py
import math import argparse from datetime import datetime import numpy as np from sklearn import cross_validation from sklearn import tree from sklearn import metrics def load_data(path, **kwargs): return np.loadtxt(path, **kwargs) def save_data(path, data, **kwargs): np.savetxt(path, data, **kwargs) def hou...
Python
0
c58c58d5bf1394e04e30f5eeb298818558be027f
Add directory for tests of rules removin
tests/rules_tests/clearAfterNonTermRemove/__init__.py
tests/rules_tests/clearAfterNonTermRemove/__init__.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 17.08.2017 22:06 :Licence GNUv3 Part of grammpy """
Python
0
9a7091c1502b9758c1492a1c99ace7d4ad74026c
move integer_divions to syntax
tests/pyccel/parser/scripts/syntax/integer_division.py
tests/pyccel/parser/scripts/syntax/integer_division.py
5 // 3 a // 3 5 // b a // b 5.// 3. a // 3. 5.// b a // b
Python
0.000022
17e0b81463e3c4c9b62f95f40912b270652a8e63
Create new package (#6376)
var/spack/repos/builtin/packages/r-ggridges/package.py
var/spack/repos/builtin/packages/r-ggridges/package.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
Python
0
1c2292dcd47865a3dbd3f7b9adf53433f6f34770
Create new package. (#6215)
var/spack/repos/builtin/packages/r-timedate/package.py
var/spack/repos/builtin/packages/r-timedate/package.py
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
Python
0.000002
5ba4fce42892634213bede09759bbca1cd56e346
add package py-brian2 (#3617)
var/spack/repos/builtin/packages/py-brian2/package.py
var/spack/repos/builtin/packages/py-brian2/package.py
############################################################################## # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
Python
0
26525354e7bf2465a561a5172a0d9fef4205e77d
move column defs to singleton object
chart06columns.py
chart06columns.py
'''define columns in all reports produced by chart06''' import numpy as np # all possible column definition _defs = { 'median_absolute_error': [6, '%6d', (' ', 'MAE'), 'median absolute error'], 'model': [5, '%5s', (' ', 'model'), 'model name (en = elastic net, gd = gradient boosting, rf = random...
Python
0.000048
32740172d4258a95145a5bb68be315fe1640db23
Add alpha version of bootstraps script
bootstraps.py
bootstraps.py
''' Does N times random stacks of X maps of large L in pixels. At each stacks it gets the central temperature, makes a histogram for all stacks, then fits a normal distribution for the histogram. ''' N = 100000 X = 10 L = 16 import stacklib as sl import numpy as np from scipy.stats import norm import matplotlib.p...
Python
0
a3bfe6b91cbd87cb4292e92d7bf1ac4a44afd462
Add struct.py mirroring C struct declarations.
tardis/montecarlo/struct.py
tardis/montecarlo/struct.py
from ctypes import Structure, POINTER, c_int, c_int64, c_double, c_ulong class RPacket(Structure): _fields_ = [ ('nu', c_double), ('mu', c_double), ('energy', c_double), ('r', c_double), ('tau_event', c_double), ('nu_line', c_double), ('current_shell_id', c_...
Python
0
3f67c8bfa0f78fbd7832d130d550f2a4d9ded327
Add an s3_utils acceptance test.
src/encoded/tests/acceptance/test_dcicutils.py
src/encoded/tests/acceptance/test_dcicutils.py
import json import os import pytest import requests from dcicutils.env_utils import get_bucket_env, is_stg_or_prd_env, get_standard_mirror_env from dcicutils.misc_utils import find_association from dcicutils.s3_utils import s3Utils pytestmark = [pytest.mark.working, pytest.mark.unit] S3_UTILS_BUCKET_VAR_DATA = [ ...
Python
0
89b10996cfe6e60870e55b7c759aa73448bfa4d8
remove off curve pen
pens/removeOffcurvesPen.py
pens/removeOffcurvesPen.py
## use BasePen as base class from fontTools.pens.basePen import BasePen class RemoveOffcurvesPen(BasePen): """ A simple pen drawing a contour without any offcurves. """ def __init__(self, glyphSet): BasePen.__init__(self, glyphSet) self._contours = [] self._components =...
Python
0.000001
10952213496e8a1cbf80ba1eee7a0e968bdea14a
add missing test
corehq/ex-submodules/couchforms/tests/test_errors.py
corehq/ex-submodules/couchforms/tests/test_errors.py
from django.test import TestCase from casexml.apps.case.exceptions import IllegalCaseId from corehq.apps.receiverwrapper import submit_form_locally from couchforms.models import XFormError class CaseProcessingErrorsTest(TestCase): def test_no_case_id(self): """ submit form with a case block that h...
Python
0.000288
d4057367d8630df541b8869e33766ed298b9fa43
Add run state testbench
tests/test_execution.py
tests/test_execution.py
# Copyright 2020 ARM Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writin...
Python
0.004295
f120e2524f09ed462bca52dbc83863ba74291dd5
Fix backend import.
tests/test_extension.py
tests/test_extension.py
import unittest from mopidy_gmusic import GMusicExtension, actor as backend_lib class ExtensionTest(unittest.TestCase): def test_get_default_config(self): ext = GMusicExtension() config = ext.get_default_config() self.assertIn('[gmusic]', config) self.assertIn('enabled = true',...
import unittest from mopidy_gmusic import GMusicExtension, backend as backend_lib class ExtensionTest(unittest.TestCase): def test_get_default_config(self): ext = GMusicExtension() config = ext.get_default_config() self.assertIn('[gmusic]', config) self.assertIn('enabled = true...
Python
0
b705c79b911ae201e9a79786e61ec36bd4a9be0f
add tests for revisions api
tests/test_revisions.py
tests/test_revisions.py
import datetime import json from werkzeug.exceptions import BadRequest from server.models import db, Backup, Group, Message, Version, Score from tests import OkTestCase class TestRevision(OkTestCase): """Tests revision API submission and scoring.""" def setUp(self): """ Add submissions for 3 users. ...
Python
0
7e15f973f0ee898a0c06e50151ada675be46263d
add basic data, query method and method scaffolds
notifo/notifo.py
notifo/notifo.py
# encoding: utf-8 """ notifo.py - python wrapper for notifo.com """ import json import urllib import urllib2 class Notifo: """ Class for wrapping notifo.com """ def __init__(self, user, api_secret): self.user = user self.api_secret = api_secret self.root_url = "https://api.notifo.com/...
Python
0.000004
d40fb122d7083b9735728df15120ed682431be79
Create script for generating analysis seeds.
scripts/make_fhes_seeds.py
scripts/make_fhes_seeds.py
import yaml import sys import numpy as np from astropy.table import Table from astropy.coordinates import SkyCoord from fermipy.catalog import * from fermipy.utils import * def get_coord(name,tab): row = tab[tab['Source_Name'] == name] return SkyCoord(float(row['RAJ2000']), float(row['DEJ2000']),unit='deg') ...
Python
0
9696acf13a6b25b1935b7fcaae5763db8e16e83a
Create MyoRemote.py
home/Alessandruino/MyoRemote.py
home/Alessandruino/MyoRemote.py
from com.thalmic.myo.enums import PoseType remote = Runtime.start("remote","RemoteAdapter") remote.setDefaultPrefix("raspi") remote.connect("tcp://192.168.0.5:6767") roll = 0.0 sleep(2) python.send("raspiarduino", "connect","/dev/ttyUSB0") sleep(1) python.send("raspiarduino", "digitalWrite",2,1) python.send("raspi...
Python
0
6bd3869a2c2a6041e47da01ddaaa15b309bf90d7
Add example checkerscript
checker/examples/dummyrunner.py
checker/examples/dummyrunner.py
#!/usr/bin/python3 import sys import time import os import codecs def generate_flag(tick, payload=None): if payload is None: sys.stdout.write("FLAG %d\n" % (tick,)) else: sys.stdout.write("FLAG %d %s\n" % (tick, codecs.encode(os.urandom(8), 'hex').decode('latin-1'))) sys.stdout.flush() ...
Python
0
4a782b2930210053bcc2fc705d55e56af5900771
Create dispatch_curve_cooling_plant.py
cea/plots/supply_system/dispatch_curve_cooling_plant.py
cea/plots/supply_system/dispatch_curve_cooling_plant.py
""" Show a Pareto curve plot for individuals in a given generation. """ from __future__ import division from __future__ import print_function import plotly.graph_objs as go import cea.plots.supply_system from cea.plots.variable_naming import NAMING, COLOR __author__ = "Jimeno Fonseca" __copyright__ = "Copyright 2019...
Python
0.000001
3026c007a4f9cbb6befa1599c8a8390a96d8396b
test import checks
pychecker2/utest/import.py
pychecker2/utest/import.py
from pychecker2.TestSupport import WarningTester from pychecker2 import ImportChecks class ImportTestCase(WarningTester): def testImportChecks(self): self.silent('import sys; print sys.argv') self.silent('import pychecker2; print pychecker2') self.silent('import pychecker2.utest; print pych...
Python
0
5219e970f1b09d8f2d41bf61a3b9f9803a8aed1d
Add database.py with working db find function
python-backend/database.py
python-backend/database.py
from pymongo import MongoClient client = MongoClient() client = MongoClient('localhost', 27017) # `community` database db = client.community; # Database find wrapper def db_find( db_collection, db_query, find_one = False ): # Get collection collection = db[db_collection] if (find_one): result = collect...
Python
0.000001
ab5dede4b1fdd5e6256d8802034846eda7a66722
add orm.py
www/transwarp/orm.py
www/transwarp/orm.py
#!/usr/bin/env python # -*- coding:utf-8 -*- __author__ = 'zhu327' ''' ORM ϵӳ from transwarp.orm import Model, StringField, IntegerField class User(Mode): __table__ = 'user' id = IntegerField(primary_key=True) name = StringField() # ֱͨ෽ѯ user = User.get('123') # ʵ: user = User(id=123, name='Michael') ...
Python
0.000001
271dca123ff9bb3004cbd2cfa366f606dd250f94
Add test for configmap
tests/k8s/test_configmap.py
tests/k8s/test_configmap.py
#!/usr/bin/env python # -*- coding: utf-8 import mock import pytest from k8s.client import NotFound from k8s.models.common import ObjectMeta from k8s.models.configmap import ConfigMap NAME = "my-name" NAMESPACE = "my-namespace" @pytest.mark.usefixtures("k8s_config") class TestIngress(object): def test_created_i...
Python
0.000001
db912d4097da45c2b14cce4f8f852cbc1e720750
add test framework
tests/test_clientManager.py
tests/test_clientManager.py
from unittest import TestCase class TestClientManager(TestCase): def test_add_http_client(self): self.fail() def test_add_local_client(self): self.fail() def test_restrictClient(self): self.fail() def test_load_clients_from_config(self): self.fail() def test_fed...
Python
0.000001
401a1aabde600336bd129cce8fb3884ed8945272
Create HCS_interpreter.py
HCS_interpreter.py
HCS_interpreter.py
#!/usr/bin/env python3 from HCS import HCS def interpret_loop(): hcs = HCS() while True: print(">> ", end="") try: command = input() except EOFError as e: print() return if command in ['quit', 'exit']: return t...
Python
0.000001
d58d2c6bb2805c8ebc95fe3445dc973560de9c79
Create generate.py
Names/generate.py
Names/generate.py
import numpy as np from keras.models import Sequential from keras.layers import Dense, Activation from keras.layers import LSTM from keras.callbacks import ModelCheckpoint from keras.utils import np_utils from random import randint inp = 'name.txt' with open(inp) as f: content = f.readlines() content = [x.lower()...
Python
0.000002
d4a04d4a0fffd8dbb006d86504fc3593ae800cc6
add bitly shorten function in proper directory
will/plugins/productivity/bitly.py
will/plugins/productivity/bitly.py
# coding: utf-8 import bitly_api # pip install bitly_api from will.plugin import WillPlugin from will.decorators import (respond_to, periodic, hear, randomly, route, rendered_template, require_settings) from will import settings # BITLY_ACCESS_TOKEN = ' <get_access_token_from_bitly....
Python
0
6922ad3922d187a3e05d339a49449292a1d7efd6
add Prototype pattern
prototype/Prototype.py
prototype/Prototype.py
# # Python Design Patterns: Prototype # Author: Jakub Vojvoda [github.com/JakubVojvoda] # 2016 # # Source code is licensed under MIT License # (for more details see LICENSE) # import sys import copy # # Prototype # declares an interface for cloning itself # class Prototype: def clone(self): pass def getTy...
Python
0
841487ab4d0e05fa6f0780cf39973072417ec701
Complete cherry-pick of PR#95
service/management/commands/start_celery.py
service/management/commands/start_celery.py
import os from django.core.management.base import BaseCommand from subprocess import call class Command(BaseCommand): help = 'Custom manage.py command to start celery.' def handle(self, *args, **options): logfile = "celery_node.log" if not os.path.isfile(logfile): with open(logfile...
Python
0
d1ee86414d45c571571d75434b8c2256b0120732
Add py solution for 563. Binary Tree Tilt
py/binary-tree-tilt.py
py/binary-tree-tilt.py
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def findTilt(self, root): """ :type root: TreeNode :rtype: int """ return self.do...
Python
0.005643
34bfea59b600f9dac457e2a16a812ce2fb768d15
Add graph.py to collect runtime data on workers and tasks (#8)
chtc/graph.py
chtc/graph.py
#!/usr/bin/env python from __future__ import print_function import csv import itertools import time from distributed import Client START_TIMEOUT = 900 # 15 min MAX_COLLECT_TIME = 86400 # 1 day def running_task_list(cli): return list(itertools.chain.from_iterable(cli.processing().values())) cli = Client('1...
Python
0
925ff38344b5058ce196877e1fdcf79a1d1f6719
Add basic test for checking messages are received correctly
ue4/tests/test_messaging.py
ue4/tests/test_messaging.py
import pytest from m2u.ue4 import connection def test_send_message_size(): """Send a big message, larger than buffer size, so the server has to read multiple chunks. """ message = "TestMessageSize " + ("abcdefg" * 5000) connection.connect() result = connection.send_message(message) asser...
Python
0
ff700e5d6fc5e0c5062f687110563d7f0312a3f0
Set up test suite to ensure server admin routes are added.
server/tests/test_admin.py
server/tests/test_admin.py
"""General functional tests for the API endpoints.""" from django.test import TestCase, Client # from django.urls import reverse from rest_framework import status from server.models import ApiKey, User # from api.v2.tests.tools import SalAPITestCase class AdminTest(TestCase): """Test the admin site is configu...
Python
0
3be7efc31bcbdaac76f0c6761554ec6f84f3f840
add a class to convert short url to venue id
VenueIdCrawler.py
VenueIdCrawler.py
#! /usr/bin/python2 # vim: set fileencoding=utf-8 from timeit import default_timer as clock from itertools import izip_longest import pycurl POOL_SIZE = 30 def grouper(iterable, n, fillvalue=None): """ from http://docs.python.org/2/library/itertools.html#recipes Collect data into fixed-length chunks or bl...
Python
0.000001
5906f3744782ba98e4826b1023bae6075df91a01
Simple system for logging the outputs
waflib/extras/build_logs.py
waflib/extras/build_logs.py
#!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2013 (ita) """ A system for recording all outputs to a log file. Just add the following to your wscript file:: def init(ctx): ctx.load('build_logs') """ import atexit, sys, time, os, shutil, threading from waflib import Logs, Context # adding the logs und...
Python
0.999986
2913d840b63746669ac5695bd244abd6db24fe5a
Create script that prepares LaGeR strings for use with a machine learning training algorithms
lager_ml/lager_training_prep.py
lager_ml/lager_training_prep.py
#!/usr/bin/env python3 # This program prepares LaGeR strings for use with a machine learning training # algorithm. # # It expands the string or set of strings to specific length (number of # features), then generates variants for each of those. Finally, it converts # the variants into numbers and adds the result to a ...
Python
0
352379690275e970693a06ed6981f530b6704354
Add index to Task.status
migrations/versions/181adec926e2_add_status_index_to_task.py
migrations/versions/181adec926e2_add_status_index_to_task.py
"""Add status index to task Revision ID: 181adec926e2 Revises: 43397e521791 Create Date: 2016-10-03 17:41:44.038137 """ # revision identifiers, used by Alembic. revision = '181adec926e2' down_revision = '43397e521791' from alembic import op def upgrade(): op.create_index('idx_task_status', 'task', ['status'],...
Python
0.000003
6ccf99966461bd8545654084584d58093dac03d5
Add missing version file
pyrle/version.py
pyrle/version.py
__version__ = "0.0.17"
Python
0.000002
f4e08d41d53cf74f8a53efeb7e238de6a98946cc
add script to find allreferenced hashes
add-ons/tools/get_referenced_hashes.py
add-ons/tools/get_referenced_hashes.py
#!/usr/bin/env python import sys import cvmfs def usage(): print sys.argv[0] + " <local repo name | remote repo url> [root catalog]" print "This script walks the catalogs and generates a list of all referenced content hashes." # get referenced hashes from a single catalog (files, chunks, nested catalogs) def...
Python
0.000001
df852b2ee81756fa62a98e425e156530333bf5a1
add migration to change order of participation choices
meinberlin/apps/plans/migrations/0033_change_order_participation_choices.py
meinberlin/apps/plans/migrations/0033_change_order_participation_choices.py
# -*- coding: utf-8 -*- # Generated by Django 1.11.18 on 2019-01-28 13:27 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('meinberlin_plans', '0032_rename_topic_field'), ] operations = [ migrations...
Python
0
8b71de6988b65665d60c696daffb12ab78c35472
allow passing of 'profile' argument to constructor
crosscat/IPClusterEngine.py
crosscat/IPClusterEngine.py
# # Copyright (c) 2010-2013, MIT Probabilistic Computing Project # # Lead Developers: Dan Lovell and Jay Baxter # Authors: Dan Lovell, Baxter Eaves, Jay Baxter, Vikash Mansinghka # Research Leads: Vikash Mansinghka, Patrick Shafto # # Licensed under the Apache License, Version 2.0 (the "License"); # you may...
# # Copyright (c) 2010-2013, MIT Probabilistic Computing Project # # Lead Developers: Dan Lovell and Jay Baxter # Authors: Dan Lovell, Baxter Eaves, Jay Baxter, Vikash Mansinghka # Research Leads: Vikash Mansinghka, Patrick Shafto # # Licensed under the Apache License, Version 2.0 (the "License"); # you may...
Python
0.000001
92debba4bb0b0064b865a53b40476effa4d09c78
Undo Framework example
pyside/demos/framework/undo/document.py
pyside/demos/framework/undo/document.py
from collections import namedtuple from PySide.QtGui import QWidget, QPalette, QPainter from PySide.QtCore import Qt, QRect ShapeType = namedtuple('ShapeType', 'Rectangle Circle Triangle')(*range(3)) class Shape(object): def __init__(self, type=ShapeType.Rectangle, color=Qt.red, rect=QRect()): self._ty...
Python
0.000001
fe08242647962af0fdfab0ce34417b6a6079ed65
add another import now missing
sympy/strategies/tests/test_traverse.py
sympy/strategies/tests/test_traverse.py
from sympy.strategies.traverse import (top_down, bottom_up, sall, top_down_once, bottom_up_once, basic_fns) from sympy.strategies.util import expr_fns from sympy import Basic, symbols, Symbol, S zero_symbols = lambda x: S.Zero if isinstance(x, Symbol) else x x,y,z = symbols('x,y,z') def test_sall(): zero_...
from sympy.strategies.traverse import (top_down, bottom_up, sall, top_down_once, bottom_up_once, expr_fns, basic_fns) from sympy import Basic, symbols, Symbol, S zero_symbols = lambda x: S.Zero if isinstance(x, Symbol) else x x,y,z = symbols('x,y,z') def test_sall(): zero_onelevel = sall(zero_symbols) ...
Python
0
0c29b431a0f5ce9115d7acdcaaabbd27546949c6
Add test for contact success view.
chmvh_website/contact/tests/views/test_success_view.py
chmvh_website/contact/tests/views/test_success_view.py
from django.test import RequestFactory from django.urls import reverse from contact.views import SuccessView class TestSuccessView(object): """Test cases for the success view""" url = reverse('contact:success') def test_get(self, rf: RequestFactory): """Test sending a GET request to the view. ...
Python
0
f66a60411b4e1cb30ac1fde78735ba38e99289cf
Create cfprefs.py
cfprefs.py
cfprefs.py
#!/usr/bin/python import CoreFoundation domain = 'com.apple.appstore' key = 'restrict-store-require-admin-to-install' key_value = CoreFoundation.CFPreferencesCopyAppValue(key, domain) print 'Key Value = ', key_value key_forced = CoreFoundation.CFPreferencesAppValueIsForced(key, domain) print 'Key Forced = ', key_f...
Python
0
e5fecce2693056ac53f7d34d00801829ea1094c3
add JPEG decoder CPU perf bench
tools/jpegdec_perf/reader_perf_multi.py
tools/jpegdec_perf/reader_perf_multi.py
import cv2 import os from turbojpeg import TurboJPEG, TJPF_GRAY, TJSAMP_GRAY, TJFLAG_PROGRESSIVE import time import threading # specifying library path explicitly # jpeg = TurboJPEG(r'D:\turbojpeg.dll') # jpeg = TurboJPEG('/usr/lib64/libturbojpeg.so') # jpeg = TurboJPEG('/usr/local/lib/libturbojpeg.dylib') # using de...
Python
0
4e5c0ea499dd596d3719717166172113e7209d1e
check in script, authored by Joseph Bisch
src/github-api-releases.py
src/github-api-releases.py
# Homepage: https://github.com/josephbisch/test-releases-api/blob/master/github-api-releases.py # # Copyright # Copyright (C) 2016 Joseph Bisch <joseph.bisch AT gmail.com> # # License # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # L...
Python
0
e10f6ebf9eba5cf734bbeead68a3b36f9db8dae8
add ridesharing
source/jormungandr/jormungandr/street_network/ridesharing.py
source/jormungandr/jormungandr/street_network/ridesharing.py
# Copyright (c) 2001-2016, Canal TP and/or its affiliates. All rights reserved. # # This file is part of Navitia, # the software to build cool stuff with public transport. # # Hope you'll enjoy and contribute to this project, # powered by Canal TP (www.canaltp.fr). # Help us simplify mobility and open public t...
Python
0.00041
c650d64247d63d2af7a8168795e7edae5c9ef6ef
Add realtime chart plotting example
realtime-plot.py
realtime-plot.py
import time, random import math from collections import deque start = time.time() class RealtimePlot: def __init__(self, axes, max_entries = 100): self.axis_x = deque(maxlen=max_entries) self.axis_y = deque(maxlen=max_entries) self.axes = axes self.max_entries = max_entries ...
Python
0
8ae82037dde45019cae8912f45a36cf3a362c444
Revert "HAProxy uses milliseconds ..."
openstack/network/v2/health_monitor.py
openstack/network/v2/health_monitor.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
Python
0.000006
c3add04f098e81b20946abaa99e6f2d81055b168
Lie algebras: Type A
sympy/liealgebras/type_A.py
sympy/liealgebras/type_A.py
from sympy.core import(Set, Dict, Tuple) from cartan_type import CartanType_standard from sympy.matrices import eye class CartanType(Standard_Cartan): def __init__(self,n): assert n >= 1 Standard_Cartan.__init__(self, "A", n) def dimension(self, n): """ Return the dimension of...
Python
0.998793