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
50a7b9bc262c98f4e387746f67a638f50f94ba38
Add migration merge
portal/migrations/versions/e396fb1974ef_.py
portal/migrations/versions/e396fb1974ef_.py
from alembic import op import sqlalchemy as sa """empty message Revision ID: e396fb1974ef Revises: ('773b1de060dd', '3271a78bbc8b') Create Date: 2018-04-24 12:19:56.689921 """ # revision identifiers, used by Alembic. revision = 'e396fb1974ef' down_revision = ('773b1de060dd', '3271a78bbc8b') def upgrade(): pa...
Python
0.000001
85c67110db1fbb5a25faef36bdfe282952f5a034
Create __init__.py
src/__init__.py
src/__init__.py
Python
0.000429
d686f54aff87d4dea1266ee1fec8c1c320dee5b9
add tests for fizz_buzz.
test_fizz_buzz.py
test_fizz_buzz.py
from cStringIO import StringIO import sys import fizz_buzz class Capture(list): """Context manager for capturing stdout.""" def __enter__(self): self._stdout = sys.stdout sys.stdout = self._stringio = StringIO() return self def __exit__(self, *args): self.extend(self._stri...
Python
0
cab46eb2323a062bff8bedbf1cc8dd036cd52044
Solve Code Fights frequency analysis problem
CodeFights/frequencyAnalysis.py
CodeFights/frequencyAnalysis.py
#!/usr/local/bin/python # Code Fights Frequency Analysis Problem from collections import Counter def frequencyAnalysis(encryptedText): return Counter(encryptedText).most_common(1)[0][0] def main(): tests = [ ["$~NmiNmim$/NVeirp@dlzrCCCCfFfQQQ", "C"], ["Agoodglassinthebishop'shostelinthedevi...
Python
0.000077
4fa2ca578b7015bee68f9f2f7bc26df2f7ab01b4
add test_cli.py module and initial test
tests/test_cli.py
tests/test_cli.py
#!/usr/bin/env python # coding: utf8 """ Unit tests for cli functionality """ # --- Imports import subprocess import geocoder # --- Constants _CLI_EX = './geocoder/cli.py' # CLI executable path us_address = '595 Market St' us_city = 'San Francisco' us_state = 'CA' us_zipcode = '94105' location = ' '.join([us_a...
Python
0
8f4ac0b12c0f83ff892e16e312cc5edbfb089850
add tests for no config startup
tests/test_cli.py
tests/test_cli.py
from click.testing import CliRunner from vaping import cli import pytest def test_start_no_home(): runner = CliRunner() with pytest.raises(ValueError) as excinfo: runner.invoke(cli.cli, ['start'], catch_exceptions=False) assert str(excinfo.value).startswith('no config specified')
Python
0
1f2f4837e823ff6cc5c9cb961f4852753926f0d7
Create __init__.py
tumor/__init__.py
tumor/__init__.py
Python
0.000429
2939b4507b8cbacb3ab2e92e81efc81e5d7b9111
Create Scraper_OOped.py
Scraper_OOped.py
Scraper_OOped.py
import requests from bs4 import BeautifulSoup from time import sleep import datetime import random class CraigslistCity: def __init__(self, Name, URL): self.name = Name self.url = URL class CraigslistListing: def __init__(self, TimePosted, ID, Title, Link): self.TimePosted = TimePosted self.Title = Title ...
Python
0
f146583961733feb90567fdf03a6a5ee122c550f
Create r34.py
r34.py
r34.py
# Aradiabot function for searching rule34.xxx # As they don't have an API, this was easier to put in it's own file so I could organize everything. import requests from html.parser import HTMLParser import random import sys counter = [10,9,8,7,6,5,4,3,2,1] images = [] class booruparser(HTMLParser): def handle_startta...
Python
0.000001
d0287d9deaa3eb03076cdd199414b772a291e2c5
Add command for moving zips
calaccess_website/management/commands/mvzips.py
calaccess_website/management/commands/mvzips.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Move downloaded and cleaned zips to their proper place in the raw data archived dir. """ import boto3 from django.conf import settings from calaccess_raw.management.commands import CalAccessCommand from calaccess_raw.models.tracking import RawDataVersion import logging ...
Python
0.000001
cdd1f3410b8ae304485f7992ac6048e1277cffe1
Add local locale from file
parsedatetime/pdt_locales/__init__.py
parsedatetime/pdt_locales/__init__.py
# -*- encoding: utf-8 -*- """ pdt_locales All of the included locale classes shipped with pdt. """ import os try: import PyICU as pyicu except: pyicu = None import yaml def lcase(x): return x.lower() from .base import pdtLocale_base, pdtLocale_icu from .de_DE import * from .en_AU import * from .en_...
# -*- encoding: utf-8 -*- """ pdt_locales All of the included locale classes shipped with pdt. """ try: import PyICU as pyicu except: pyicu = None def lcase(x): return x.lower() from .base import pdtLocale_base, pdtLocale_icu from .de_DE import * from .en_AU import * from .en_US import * from .es im...
Python
0.000001
c98039a25638db0c124efeaa394f89f2a84a2ede
Create aekjdfh.py
aekjdfh.py
aekjdfh.py
sdl;jfhlkjsdhfhdf
Python
0.000037
7e754367f44d8a6764ec9062fce027520702b376
move archive.py to top directory
archive.py
archive.py
#!/usr/bin/env python # Copyright (c) 2010, Aaron DeVore # Released under the Don't Be A Douchbag License. # Use responsibly. Contribute changes if you feel like it. No CP! import urllib2 import os import posixpath import json import time from optparse import OptionParser from BeautifulSoup import BeautifulSoup, Tag i...
Python
0
c51651dba8ccd14be9e6fb9ee028d1d2940b3202
Add parity test for simple RNN (#1351)
benchmarks/test_rnn_parity.py
benchmarks/test_rnn_parity.py
import time import numpy as np import pytest import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import Dataset, DataLoader from pytorch_lightning import Trainer, LightningModule class AverageDataset(Dataset): def __init__(self, dataset_len=300, sequence_len=100): se...
Python
0
8a1dff9437a4f013a96369a1fe174c505e8636cb
Add missing migration (fix #130)
puput/migrations/0004_auto_20170912_0928.py
puput/migrations/0004_auto_20170912_0928.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-09-12 09:28 from __future__ import unicode_literals from django.db import migrations import django.db.models.manager class Migration(migrations.Migration): dependencies = [ ('puput', '0003_add_short_feed_description_to_blog_page'), ] ...
Python
0
8a3d757be17d395ba14ae7458036a78d10e3e212
Test to find out how to remove a file a git repo.
holamundo.py
holamundo.py
#!/usr/bin/env python def main(): print("Hola mundo!!") if __name__ == "__main__": main()
Python
0
17aefac614890b1fe7079a76b803707ae3fbb832
Add perihelion
Project3/analysis/perihelion.py
Project3/analysis/perihelion.py
#!/bin/python3 # -*- coding: utf-8 -*- from runner import Runner import numpy as np import matplotlib.pyplot as plt class Perihelion(Runner): def setup(self): self['number of years'] = 100 self['do save results'] = True self['do save any results'] = False self['use all planets'] = ...
Python
0.999979
41f68e14fe890cac3de391f7bc4cdd5c2e5b9d75
test B07
spec/Order_B07_spec.py
spec/Order_B07_spec.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from primestg.order.orders import Order from expects import expect, equal with description('Order B07 Generation'): with it('generates expected B07 xml'): expected_result = '<Order IdPet="1234" IdReq="B07" Version="3.1.c">\n ' \ '<Cn...
Python
0.000001
1163b56cf3f7e6a651f239a45300604c2847d201
Add a script to train TD3
examples/mujoco/td3/train_td3.py
examples/mujoco/td3/train_td3.py
"""A training script of DDPG on OpenAI Gym Mujoco environments. This script follows the settings of http://arxiv.org/abs/1802.09477 as much as possible. """ from __future__ import print_function from __future__ import unicode_literals from __future__ import division from __future__ import absolute_import from future i...
Python
0.000001
e6f9f12d1c9faae8f718306bcd2862278a083351
Test gnssUblox message processing (#24404)
selfdrive/locationd/test/test_ublox_processing.py
selfdrive/locationd/test/test_ublox_processing.py
import unittest import numpy as np from laika import AstroDog from laika.helpers import UbloxGnssId from laika.raw_gnss import calc_pos_fix, correct_measurements, process_measurements, read_raw_ublox from selfdrive.test.openpilotci import get_url from tools.lib.logreader import LogReader def get_gnss_measurements(l...
Python
0
45a91a5c32227aabf17b52960d98851cd7608dd1
add qha plot tool (function version)
workflows/tools/plot_quasiparticle_scan.py
workflows/tools/plot_quasiparticle_scan.py
from aiida import load_dbenv load_dbenv() from aiida.orm import load_node, load_workflow from aiida.orm import Code, DataFactory import matplotlib.pyplot as plt StructureData = DataFactory('structure') ParameterData = DataFactory('parameter') ArrayData = DataFactory('array') KpointsData = DataFactory('array.kpoints'...
Python
0
082e7d63192c2e7eaa4210e0c559b145313ecc3a
Add files via upload
server/src/datasource/parse_indepexpends.py
server/src/datasource/parse_indepexpends.py
from datasource import fec from datasource import propublica import os FEC_APIKEY = os.getenv('FEC_API_KEY', '') ProPublica_APIKEY = os.getenv('PP_API_KEY', '') FecApiObj = fec.FECAPI(FEC_APIKEY) committees = FecApiObj.get_committees() PPCampFinObj = propublica.CampaignFinanceAPI(ProPublica_APIKEY) datafi...
Python
0
d8ba95ddb1e469600c735316a1aeafa115399b3c
Add an execution module called key to return minion public key finger
salt/modules/key.py
salt/modules/key.py
''' Functions to view the minion's public key information ''' # Import python libs import os # Import Salt libs import salt.utils def finger(): ''' Return the minion's public key fingerprint CLI Example:: salt '*' key.finger ''' return salt.utils.pem_finger( os.path.join(__o...
Python
0.000001
ce8465e5f0f085bedcd1a84220316c8eab29a493
Add Tensor Flow
python/src/algorithm/coding/setupdate.py
python/src/algorithm/coding/setupdate.py
n = int(input()) s = set(map(int, input().split())) N = int(input()) for i in range(N): cmd = input() B = set(map(int, input().split())) if "symmetric_difference_update" in cmd: s.symmetric_difference_update(B) elif "intersection_update" in cmd: s.intersection_update(B) elif "diffe...
Python
0.000019
b3889f8ff6d66963d4253d6796c3bb20dc9adbb7
Add external driver and parameter file
scripts/my_Param.py
scripts/my_Param.py
#================================================= # Observation #------------------------------------------------- sstObsPath = '/clim_obs/obs/ocn/mo/tos/UKMETOFFICE-HadISST-v1-1/130122_HadISST_sst.nc' tauxObsPath = '/clim_obs/obs/atm/mo/tauu/ERAINT/tauu_ERAINT_198901-200911.nc' sstNameObs = 'sst' tauxNameObs = 'tauu...
Python
0
771fc766446e1610a0599102720dc7e0f358e0e6
Add wsgi file
app.wsgi
app.wsgi
from app import app as application
Python
0.000001
fc636dbaacb5d2d1ebba1ba7f577ee4ec4deb958
Add synthtool scripts (#3765)
google-cloud-containeranalysis/synth.py
google-cloud-containeranalysis/synth.py
# Copyright 2018 Google LLC # # 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, s...
Python
0.000001
faf9e73f44cfee0c637c006ad6c37e8dcef0d1df
Create arcEC.py
arcEC.py
arcEC.py
import arcpy import sys ## Version 1.8 (8 functions) '130213/MaHvi def SetMsg(msg, severity=0): # 0:Message, 1:Warning, 2:Error #print msg try: for string in msg.split('\n'): string = ":) "+string if severity == 0: arcpy.AddMessage(string) elif sever...
Python
0
3aed2efd64d38a78682d7ae4c55400763af22c63
add avoid.py
avoid.py
avoid.py
#!/usr/bin/env python import unicornhat as unicorn import getch, random, time, colorsys import numpy as np unicorn.rotation(90) unicorn.brightness(0.4) screen = [[0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0], [0,0,0,0,0...
Python
0.000001
7f7effb6ec47c3714df5d6d9dbb403c6fda9cd89
Add test to create repository on GitHub
selenium_github.py
selenium_github.py
import requests from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import Select from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoAlertPresentException import ...
Python
0.000001
1fe3fd59e4000216c4d6694690dc0ba866a66ecb
add bloom_count_intersection.py
scripts/bloom_count_intersection.py
scripts/bloom_count_intersection.py
## using bloom filter to count intersection import khmer import sys import screed from screed.fasta import fasta_iter filename = sys.argv[1] K = int(sys.argv[2]) # size of kmer HT_SIZE= int(sys.argv[3])# size of hashtable N_HT = int(sys.argv[4]) # number of hashtables ht = khmer.new_hashbits(K, HT_SIZE, N_HT) n_u...
Python
0.000019
4722c73643cbf9cbd63f05736a8469afc4c03443
test project: convert IPAddressField fields to GenericIPAddressField
test_django_admin_bootstrapped/test_django_admin_bootstrapped/models.py
test_django_admin_bootstrapped/test_django_admin_bootstrapped/models.py
from django.db import models class TestMe(models.Model): test_m2m = models.ManyToManyField('self', blank=True, help_text="Lorem dolor") test_ip = models.GenericIPAddressField(help_text="Lorem dolor") test_url = models.URLField(help_text="Lorem dolor") test_int = models.IntegerField(help_text="Lorem do...
from django.db import models class TestMe(models.Model): test_m2m = models.ManyToManyField('self', blank=True, help_text="Lorem dolor") test_ip = models.IPAddressField(help_text="Lorem dolor") test_url = models.URLField(help_text="Lorem dolor") test_int = models.IntegerField(help_text="Lorem dolor") ...
Python
0.000003
63f91c2459cb98cf0cfb1e60d298944212d9d639
add missing file in symm
symm/addons.py
symm/addons.py
# # Author: Qiming Sun <osirpt.sun@gmail.com> # import numpy import pyscf.lib.logger def label_orb_symm(mol, irrep_name, symm_orb, mo): nmo = mo.shape[1] s = mol.intor_symmetric('cint1e_ovlp_sph') mo_s = numpy.dot(mo.T, s) orbsym = [None] * nmo for i,ir in enumerate(irrep_name): moso = num...
Python
0.000001
c1f2b25638f0653f6ad70271e7bcb3351d06162a
allow to pass input and output vector sizes
brain.py
brain.py
#!/usr/bin/env python2 # -*- coding : utf-8 -*- import logging import math import random __author__ = "Julien Rialland" __copyright__ = "Copyright 2015, J.Rialland" __license__ = "Apache License 2.0" __version__ = "0.1" __maintainer__ = __author__ __email__ = "julien.rialland@gmail.com" __status__ = "Production" de...
Python
0.000001
005872ea37dfdd4b8ab8b16e3c5b0083fb86cdb9
Add settings file
scripts/settings.py
scripts/settings.py
#!/usr/bin/env python #=============================================================================== # GLOBAL CONSTANTS #=============================================================================== # --- Set up GPIO referencing---- broadcom_ref = True if broadcom_ref: PIN_11 = 17 PIN_12 = 18 PI...
Python
0.000001
746dd90a17d756f5601ddcbbd6c2de6fed9c75d5
add splitter script
scripts/splitter.py
scripts/splitter.py
import sys import os import json import pdb content = "" for line in sys.stdin: content += line data = json.loads(content) print('ok') for item in data: filename = "items_data/{0}.json".format(item['_key']) print("creating ".format(filename)) if not os.path.exists(os.path.dirname(filename)): ...
Python
0.000001
7a49dfb41888b6afed4ff3dca3987f641e497056
Add PageHandler
handler/page.py
handler/page.py
#!/usr/bin/python # -*- coding:utf-8 -*- # Powered By KK Studio from BaseHandler import BaseHandler # 404 Page class Page404Handler(BaseHandler): def get(self): self.render('page/404.html', title="404") # 500 Page class Page500Handler(BaseHandler): def get(self): self.render('page/500.html', ...
Python
0
d488ba2daf3fe2530dd5e67394328cc904c3889d
add expect_column_values_bitcoin_tx_is_confirmed (#4778)
contrib/experimental/great_expectations_experimental/expectations/expect_column_values_bitcoin_tx_is_confirmed.py
contrib/experimental/great_expectations_experimental/expectations/expect_column_values_bitcoin_tx_is_confirmed.py
""" This is a template for creating custom ColumnMapExpectations. For detailed instructions on how to use it, please see: https://docs.greatexpectations.io/docs/guides/expectations/creating_custom_expectations/how_to_create_custom_column_map_expectations """ import json from typing import Optional import blockcyph...
Python
0.000001
d3248cebcb1ef161dfc706d99b4d361205fc9fbe
Add wsgi file
t10server.wsgi
t10server.wsgi
from teeminus10_api import app as application
Python
0.000001
be249ac1ce39977e4448e320f80d3b642f2c9193
Add original code
gitcontrib.py
gitcontrib.py
#!/usr/bin/env python3 # TODO # Multiple source extensions # Handle different name same email as one contributor # Handle different email same name as one contributor # Handle github-side edits being double-counted import subprocess as sp from sys import argv, exit from os import chdir, devnull def usage(): prin...
Python
0.000222
2866c8fbb3549ffd2405c5b13338a3fdf87a6c5d
add checks
dog/checks.py
dog/checks.py
from discord.ext import commands owner_id = '97104885337575424' def is_owner(): return commands.check(lambda ctx: ctx.message.author.id == owner_id)
Python
0.000001
daa846ba7db9fe7ff080dd1b38f4cdde97b9c426
Create นาดี.py
ai/นาดี.py
ai/นาดี.py
# Bot นาดี AI ผู้ช่วยต้นแบบ # make2 #License: BSD # เขียนโดย นาย วรรณพงษ์ ภัททิยไพบูลย์ # https://python3.wannaphong.com/2015/03/สั่งงานด้วยเสียงใน-python.html __author__ = 'วรรณพงษ์' #License: BSD import PyICU #ใช้ในการตัดคำ import re import webbrowser #ใช้ในการค้นหาโดยเปิด web browser แล้วค้นผ่านกูเกิล from gtts imp...
Python
0
482859488865fe9b1e05a923e7aafeb7e090f049
Create volumeBars.py
python/volumeBars.py
python/volumeBars.py
#!/usr/bin/env python from rgbmatrix import RGBMatrix from random import randint import time rows = 16 chains = 1 parallel = 1 ledMatrix = RGBMatrix(rows, chains, parallel) height = ledMatrix.height width = ledMatrix.width nextFrame = ledMatrix.CreateFrameCanvas() while True: nextFrame.SetPixel(randint(0, width), ra...
Python
0.000001
15839dd4b37761e49599f6b278f6bd6e6d18b1e5
Add initial rpc implementation example
examples/mailbox/rpc.py
examples/mailbox/rpc.py
import sys sys.path.append('.') # NOQA from xwing.mailbox import spawn, run, stop class Server(object): def hello_world(self): return 'Hello World!' def run(self): async def rpc_server(mailbox, server): while True: function, pid = await mailbox.recv() ...
Python
0
f09bddb89681fdd03ac190a1caa4847b3da7a61f
add script for reinserting unparsed sentences into the parser output
src/corex/save_unparsables.py
src/corex/save_unparsables.py
#!/usr/bin/python # This script takes the input file (one-sentence-per-line) for the # the Berkeleyparser (topological fields model) and compares it to the # parser's output file. Sentences missing in the parser output (unparsables) # in the output are inserted from the parsers input file, one-sentence-per-line) # ...
Python
0.000003
7d52d1efaf5bb07bfbb66e78f7c51e92b6c531dd
Use BytesIO. Closes #17
ajaximage/image.py
ajaximage/image.py
import os from PIL import Image, ImageOps try: from StringIO import StringIO as IO except ImportError: from io import BytesIO as IO from django.core.files.base import ContentFile from django.core.files.uploadedfile import SimpleUploadedFile def resize(file_, max_width=0, max_height=0, crop=0): max_width ...
import os from PIL import Image, ImageOps try: from StringIO import StringIO except ImportError: from io import StringIO from django.core.files.base import ContentFile from django.core.files.uploadedfile import SimpleUploadedFile def resize(file_, max_width=0, max_height=0, crop=0): max_width = int(max_w...
Python
0
5f9c6e49597abe07a74cd2e7370216bd0fc57cd4
add topology
scripts/topology.py
scripts/topology.py
#!/usr/bin/python from mininet.net import Mininet from mininet.node import Controller, OVSSwitch from mininet.cli import CLI from mininet.log import setLogLevel import sys def multiControllerNet( number ): "Create a network from semi-scratch with multiple controllers." net = Mininet( controller=Controller, s...
Python
0.000018
4ff6b846311a0f7bd6cfcf2e661a7c53061406fe
Add command to print vault info
glaciercmd/command_vault_info.py
glaciercmd/command_vault_info.py
import boto class CommandVaultInfo(object): def execute(self, args, config): glacier_connection = boto.connect_glacier(aws_access_key_id=config.get('configuration', 'aws_key'), aws_secret_access_key=config.get('configuration', 'aws_secret')) try: vault = glacier_connection.get_vault(args[2]) pr...
Python
0.000001
adcbdc06f0c476bc4c24e8c69d06cffbb6726a9f
Add migration
ovp_organizations/migrations/0023_auto_20170712_1704.py
ovp_organizations/migrations/0023_auto_20170712_1704.py
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-07-12 17:04 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('ovp_organizations', '0022_auto_20170613_1424'), ] ...
Python
0.000002
582ebd448508625ed2c9f362aaafc3fc46e60df0
Add unit tests for security_scan
functest/tests/unit/features/test_security_scan.py
functest/tests/unit/features/test_security_scan.py
#!/usr/bin/env python # Copyright (c) 2017 Orange and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 # pylint: d...
Python
0
25f5ff62e1652e3293d12e3e73e44e7d7c21463c
upgrade incs
bin/upgrade_fortran_inc.py
bin/upgrade_fortran_inc.py
#!/usr/bin/env python3 # -*- coding: utf8 -*- # py f:\dev\progs\bin\clean_fortran.py ricks.f90 # f:\f90ppr\moware\f90ppr.exe < tmp.f90 > out.txt import sys, os, subprocess, shutil sys.path.append(r'C:\msys64\mingw64\bin') f90ppr_exe = r"F:\f90ppr\moware\f90ppr" def main(fname): # tmpname = 'tmp.f90' if no...
Python
0.000001
0fe4a3c3a1d31230c9b5c931ff1e33584f1ccd4e
Create maximum-length-of-pair-chain.py
Python/maximum-length-of-pair-chain.py
Python/maximum-length-of-pair-chain.py
# Time: O(nlogn) # Space: O(1) # You are given n pairs of numbers. # In every pair, the first number is always smaller than the second number. # # Now, we define a pair (c, d) can follow another pair (a, b) # if and only if b < c. Chain of pairs can be formed in this fashion. # # Given a set of pairs, find the length...
Python
0.998344
0a0f17044b90b6897cd931a2e9d002b764b27b00
Add pytorch-lightning bf16 training example (#5526)
python/nano/tutorial/training/pytorch-lightning/lightning_train_bf16.py
python/nano/tutorial/training/pytorch-lightning/lightning_train_bf16.py
# # Copyright 2016 The BigDL 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 ...
Python
0
08a6963b1e7b93929b2fcb6bf27e10e2c9d2e7c5
Add server stats
server_stats.py
server_stats.py
#*-* coding: utf-8 *-* from flask import Flask from flask import jsonify from flask import request import requests import json app = Flask(__name__) CHARTS_DIR = "static" def get_chart_URL(filename="myChart.jpeg"): """Download chart and save the image. ref: https://core.telegram.org/blackberry...
Python
0.000001
4f586f16eaf3e06d347bf9976a02005c70cd7e13
Create installTests.py
installTests.py
installTests.py
import unittest import install class TestOperationWrapperMethods(unittest.TestCase): def setUp(self): # TODO: Write Tests self.test_dataset = ""
Python
0.000001
95182581beebbd181b20b23ee02657cb18347dd6
update spec: update read_spectrum.py: add read_spectrum for elodie
bopy/spec/read_spectrum.py
bopy/spec/read_spectrum.py
# -*- coding: utf-8 -*- """ Author ------ Bo Zhang Email ----- bozhang@nao.cas.cn Created on ---------- - Tue Mar 8 15:26:00 2016 read_spectrum Modifications ------------- - Aims ---- - read various kinds of spectra """ import os import numpy as np from astropy.io import fits from .spec import Spec def rec...
Python
0
39bb6cd51ce5351bfd93adac7b083a52b25590f8
Create 6kyu_vending_machine.py
Solutions/6kyu/6kyu_vending_machine.py
Solutions/6kyu/6kyu_vending_machine.py
class VendingMachine(): def __init__(self, items, money): self.items = dict(enumerate(items)) self.money = money def vend(self, selection, item_money): try: n,v = [(n,self.items[n]) for n in self.items if (self.items[n]['code']).lower() == selection.l...
Python
0.000057
5e96dd2846660f14e1d7b691ba928da63b699f19
Add support for Spotify
services/spotify.py
services/spotify.py
from oauthlib.common import add_params_to_uri import foauth.providers class Spotify(foauth.providers.OAuth2): # General info about the provider provider_url = 'https://spotify.com/' docs_url = 'https://developer.spotify.com/web-api/endpoint-reference/' category = 'Music' # URLs to interact with t...
Python
0
062c4bc134f77f9279d18774b954a06566f99c5a
Add logger
src/acquisition/covidcast/logger.py
src/acquisition/covidcast/logger.py
"""Structured logger utility for creating JSON logs in Delphi pipelines.""" import logging import sys import threading import structlog def handle_exceptions(logger): """Handle exceptions using the provided logger.""" def exception_handler(etype, value, traceback): logger.exception("Top-level exceptio...
Python
0.00002
934f4ccfc4e34c5486c3d5a57b429742eb9b5915
add algorithms.ml to make format for machine learning
algorithms/ml.py
algorithms/ml.py
#!/usr/bin/env python # -*- coding: UTF-8 -*- """ Machine learning algorithms. """ import sys from optparse import OptionParser from jcvi.apps.base import ActionDispatcher, debug debug() def main(): actions = ( ('libsvm', 'convert csv file to LIBSVM format'), ) p = ActionDispatcher(ac...
Python
0.000004
2ca07d4a8893196bbf304bcdac16688505e6123a
Add a management command to register webhooks
shopify/webhooks/management/commands/webhookregister.py
shopify/webhooks/management/commands/webhookregister.py
from django.core.management.base import NoArgsCommand from webhooks.models import Webhook class Command(NoArgsCommand): help = 'Register all created Shopify webhooks' def handle_noargs(self, **options): Webhook.objects.register()
Python
0.000001
dbde6b78e0abc47473246abe0a11e2dd445134a6
Implement WSGI loader.
helper-scripts/wsgi-loader.py
helper-scripts/wsgi-loader.py
#!/usr/bin/env python # Phusion Passenger - http://www.modrails.com/ # Copyright (c) 2010, 2011, 2012 Phusion # # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the ...
Python
0
4aafeac9c238ffb8dc448c87f18abfd7f1f0c9d7
store data dir info
gemini/anno_info.py
gemini/anno_info.py
#!/usr/bin/env python """ Store the path for GEMINI data-dir """ from gemini.config import read_gemini_config config = read_gemini_config() anno_dirname = config["annotation_dir"] print anno_dirname
Python
0
9d6a053441505fae600915e24a263de798843fbb
Add test_weapon class
test_weapon.py
test_weapon.py
import unittest import weapon class TestWeapon(unittest.TestCase): def setUp(self): self.w = weapon.Weapon('bow', 30, 1.0, 1) self.w2 = weapon.Weapon('bow', 30, 2.0, 1) def test_weapon_init(self): self.assertEqual('bow', self.w.type) self.assertEqual(30, self.w.damage) ...
Python
0.000001
7a4b4a116a10f389f6d14321547fa1966b262c0d
Add Hacker News
sources/misc.py
sources/misc.py
# -*- coding: utf-8 -*- # Copyright (c) 2020 Clarence Ho (clarenceho at gmail dot com) # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the...
Python
0
cd48829eb08df62d8222128b33a7c00b9ca2ed8a
Add files via upload
interpro_go_extraction_direct.py
interpro_go_extraction_direct.py
#!/usr/bin/env python2 # Daniel Elsner # 26.09.2016 # ake the GO ID directly from Interproscan, without the need of previous cutting and grepping. # Input: The interproscan-output.tsv file import sys with open(sys.argv[1], 'r') as readfile: id_list_content = list(readfile) outdict={} # make a dict, this...
Python
0
ed578177781ff1d4aeb0b7abb7d5f11fc5a7c626
Create copy of WeakList and set it to raise exception instead of removing item from list
grammpy/WeakList.py
grammpy/WeakList.py
#!/usr/bin/env python """ :Author Patrik Valkovic :Created 31.08.2017 12:11 :Licence GNUv3 Part of grammpy Original implementation: https://github.com/apieum/weakreflist """ import weakref from .exceptions import TreeDeletedException __all__ = ["WeakList"] def is_slice(index): return isinstance(index, slice) ...
Python
0
ee859881af0633d4d2d88015c907cfa856516dbe
Create TwoSum II for Lint
lintcode/000-000-Two-Sum-II/TwoSumII.py
lintcode/000-000-Two-Sum-II/TwoSumII.py
class Solution: # @param nums, an array of integer # @param target, an integer # @return an integer def twoSum2(self, nums, target): # Write your code here nums.sort() i, j = 0, len(nums) - 1 res = 0 while i < j: if nums[i] + nums[j] <= target: ...
Python
0
52e8a378d8a31989c9d93ef83eabbe6df339f915
Add data migration to add category components for VPC.
src/waldur_mastermind/marketplace/migrations/0083_offering_component.py
src/waldur_mastermind/marketplace/migrations/0083_offering_component.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations from waldur_mastermind.marketplace_openstack import STORAGE_TYPE, RAM_TYPE, CORES_TYPE, PACKAGE_TYPE def create_category_components(apps, schema_editor): CATEGORY_TITLE = 'Private clouds' Category = apps.get_mo...
Python
0
df0772b3ae02ff0180f18410cf4350b493db9cb4
Create fold_stereonet_fisher_mean.py
fold_stereonet_fisher_mean.py
fold_stereonet_fisher_mean.py
#Definition of inputs and outputs #================================== ##[Mes scripts GEOL]=group ##entree=vector ##dip_dir=field entree ##dip=field entree #Algorithm body #================================== from qgis.core import * from apsg import * layer = processing.getObject(entree) dipdir = layer.fieldNameIndex(...
Python
0.003638
8ce4b91c9f1eca911809bc2e8c315ea24eac10ae
Add scheduler example
schedule.py
schedule.py
import schedule import time def job(): print("I'm working...") schedule.every(10).minutes.do(job) schedule.every().hour.do(job) schedule.every().day.at("10:30").do(job) schedule.every(5).to(10).minutes.do(job) schedule.every().monday.do(job) schedule.every().wednesday.at("13:15").do(job) while True: schedule...
Python
0.000001
9ab752bc96c1ad8d6e718cbf87f247aba4ab76a9
Create MiddleCharacter.py
Edabit/MiddleCharacter.py
Edabit/MiddleCharacter.py
#!/usr/bin/env python3 ''' Create a function that takes a string and returns the middle character(s). With conditions. ''' def get_middle(word): if len(word) <= 2: return word elif len(word) % 2 == 0: return word[(len(word) // 2) - 1] + word[(len(word) // 2)] else: return word[(len(word) // 2)] #Alterna...
Python
0.000001
4e7a074fdfb0b5df300c2b4f1c2109ffb47e89cc
Create t3_muptiplot.py
t3_muptiplot.py
t3_muptiplot.py
''' Created on 2017年8月20日 @author: rob ''' # Learn about API authentication here: https://plot.ly/python/getting-started # Find your api_key here: https://plot.ly/settings/api import plotly.plotly as py import plotly.graph_objs as go import plotly import numpy as np import pandas as pd #py.sign_in('matterphiz', '3eu3...
Python
0.000005
2e7058a9b48154ad205b6f53e07a224574a2e125
add command-line script to fix missing exposure times in MMIRS data
scripts/fix_mmirs_exposure_time.py
scripts/fix_mmirs_exposure_time.py
#!/usr/bin/env python import sys import math import argparse from datetime import datetime from pathlib import Path from astropy.io import fits import logging log = logging.getLogger('Fix MMIRS') log.setLevel(logging.INFO) ch = logging.StreamHandler(sys.stdout) ch.setLevel(logging.INFO) formatter = logging.Forma...
Python
0
0cff0d69f0d2f52f950be37f95c8f261a9741ae7
Create KAKAO_DATA_PREPARE_NEW.py
KAKAO_DATA_PREPARE_NEW.py
KAKAO_DATA_PREPARE_NEW.py
import h5py from scipy.spatial import distance import scipy.misc import numpy as np path = './Desktop/COVER_SONG/chroma_data_training/CP_1000ms_training_s2113_d2113_170106223452.h5' f1 = h5py.File(path) datasetNames=[n for n in f1.keys()] X = f1['X'] idxDis_train = f1['idxDis_train'] idxDis_validate = f1['idxDis_va...
Python
0
3de9ab07b67bd37e418cba16318aa813326793bb
Create createREFgenomesForPhasing.py
createREFgenomesForPhasing.py
createREFgenomesForPhasing.py
Python
0
c87779ed6e0163503c01efd3a3913b547954d73d
Create convcsv.py
convcsv.py
convcsv.py
#!/usr/bin/python # # convert spreadsheet data, removing multiple spaces # import os, sys, getopt, shutil, glob, re, traceback, json, csv def handle_exception(): traceback.print_exc() os._exit(1) def addRow(lst,row): key = row[9] if key in lst: setlst = lst[key] setlst.append(row) else: ...
Python
0.000412
1c81643eaed91b4171a4e68699d930e5ef3688db
Add negative API tests for policy validation
senlin/tests/tempest/api/policies/test_policy_validate_negative.py
senlin/tests/tempest/api/policies/test_policy_validate_negative.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...
Python
0.000005
f040351dd3397ba7297b69b2468b2b37589c0d8f
Add task to get stats about files
games/management/commands/get_installer_urls.py
games/management/commands/get_installer_urls.py
import json from collections import defaultdict from django.core.management.base import BaseCommand from common.util import load_yaml from games import models class Command(BaseCommand): def handle(self, *args, **kwargs): self.stdout.write("Installer stats\n") installers = models.Installer.object...
Python
0.000001
cff5035ad469adc46ed9cf446bb95d9a1e07bd77
Fix inline template
judge/templatetags/smart_math.py
judge/templatetags/smart_math.py
from HTMLParser import HTMLParser from django.template import Library from django.conf import settings import re register = Library() MATHTEX_CGI = 'http://www.forkosh.com/mathtex.cgi'#settings.get('MATHTEX_CGI', 'http://www.forkosh.com/mathtex.cgi') inlinemath = re.compile(r'~(.*?)~|\\\((.*?)\\\)') def inline_temp...
from HTMLParser import HTMLParser from django.template import Library from django.conf import settings import re register = Library() MATHTEX_CGI = 'http://www.forkosh.com/mathtex.cgi'#settings.get('MATHTEX_CGI', 'http://www.forkosh.com/mathtex.cgi') inlinemath = re.compile(r'~(.*?)~|\\\((.*?)\\\)') def inline_temp...
Python
0.000001
12445164d5a7651ddcc381f5e602577d8372fe6a
Add is_eq_size script
is_eq_size.py
is_eq_size.py
#!/usr/bin/env python # -*- coding: utf-8 -*- import click from PIL import Image from utils import get_file_list @click.command() @click.argument('path', type=click.Path(exists=True)) def is_eq_size(path): """ Test all pictures in folder (recursive) for size equality. """ files = get_file_list(path) ...
Python
0.000077
ad052e71145296897c1510752c0f3403b9cb45a4
add 1st py file
hello.py
hello.py
print('Hello, Python!'); name = input(); print(name);
Python
0
73f2260e0e5ae3534f13664063808abbe73b1d72
add a new extractor, from json files
bin/extract_json.py
bin/extract_json.py
#!/usr/bin/env python # -*- coding:utf-8 -*- # Copyright 2015 Pablo Santiago Blum de Aguiar <scorphus@gmail.com>. All rights # reserved. Use of this source code is governed by Apache License, Version 2.0, # that can be found on https://opensource.org/licenses/Apache-2.0 import json import sys def main(argv): ''...
Python
0
81a38564379af16f4ea2d64572e517a6657f4450
add first test for NormalIndPower and normal_power
statsmodels/stats/tests/test_power.py
statsmodels/stats/tests/test_power.py
# -*- coding: utf-8 -*- """Tests for statistical power calculations Note: test for ttest power are in test_weightstats.py tests for chisquare power are in test_gof.py Created on Sat Mar 09 08:44:49 2013 Author: Josef Perktold """ import numpy as np from numpy.testing import assert_almost_equal import stats...
Python
0
f24c8376847b0226f3d3f674af2f568367f15234
add data structure for parens problem
src/linked_list.py
src/linked_list.py
"""Singly-Linked List in Python.""" class Node(object): """docstring for LinkedList.""" def __init__(self, data, next_item=None): """Init for instance of a node.""" self.data = data self.next_item = next_item class LinkedList(object): """Class for head of Linked List.""" de...
Python
0.000002
9992a4ff90156a1c5678303530c2feeaecf700d6
Create a_deco.py
src/misc/a_deco.py
src/misc/a_deco.py
import os import sys import linecache def trace(func): """ A trace decorator from: https://zhuanlan.zhihu.com/p/20175869 :param func: :return: """ def globaltrace(frame, why, arg): if why == "call": return localtrace return None def localtrace(frame, why, ...
Python
0.00033
463502a251111199da130e508929a35b2f126f4e
Add columns to User model
bookmarks/models.py
bookmarks/models.py
from sqlalchemy import Column, Integer, String from bookmarks.database import Base class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) username = Column(String(50), unique=True, nullable=False) name = Column(String(120)) email = Column(String(256), unique=True, nullabl...
Python
0.000001
0c77666c259ba78899863bbbe482a857102c19be
add settings module
hackerearth/settings.py
hackerearth/settings.py
# v3 API endpoints of HackerEarth Code Checker API COMPILE_API_ENDPOINT = 'https://api.hackerearth.com/v3/code/compile' RUN_API_ENDPOINT = 'https://api.hackerearth.com/v3/code/run' # Max run time of a program in seconds RUN_TIME_UPPER_LIMIT = 5 # Max memory consumption allowed for a program MEMORY_UPPER_LIMIT = 1...
Python
0.000034
36af113eb363ddf25f96ab53e41db0ea7f3bb481
add a python scripts to generate user weibo file from weibo.txt
src/main/python/data_aggregation.py
src/main/python/data_aggregation.py
import sys, os def generateData(inputData, outputDir, userLimit): print "Generate person weibo to folder: " + outputDir if not os.path.isdir(outputDir): os.mkdir(outputDir) print 'Directory created at: ' + outputDir currentID = "" userNum = 0 outputFile = None l = inputData.readline() wh...
Python
0
8c78679bc9875c698f639a0c45a5208b43162f4e
comment obsolete ff prefs script.
setup/nodes/review/set_ff_prefs.py
setup/nodes/review/set_ff_prefs.py
#!/usr/bin/python """ Allow a web page to access local files. This makes it easier to preview title screens and video files. FF stores profiles in ~/.mozilla/firefox/profiles.ini FF settings are set by creating a .js file that sets things on startup 1. count number of FF profiles. If more than 1, give up. 2. ge...
#!/usr/bin/python import os import ConfigParser home_dir = os.path.expanduser('~') print "home dir:", home_dir profiles_path= os.path.join(home_dir, ".mozilla","firefox","profiles.ini") print "profiles_path:", profiles_path # read ini file config = ConfigParser.RawConfigParser() config.read([profiles_path]) profile...
Python
0
bb11ab050fe9a7bb0ffe83419eb0e87390f7deac
Add registration method for TB
hopsutil/tensorboard.py
hopsutil/tensorboard.py
""" Utility functions to retrieve information about available services and setting up security for the Hops platform. These utils facilitates development by hiding complexity for programs interacting with Hops services. """ import socket import subprocess import os import hdfs def register(logdir): #find free p...
Python
0
b22cfb4c6b8c0c0c3751078b720313d0e2baff1d
Test API call
src/filmyBot.py
src/filmyBot.py
import time,json,requests import os from slackclient import SlackClient # get the Slack API token as an environment variable SLACK_BOT_TOKEN = os.environ["SLACK_BOT_TOKEN"] CHANNEL_NAME = "test2" BOT_ID = "U53TE8XSS" SLACK_BOT_NAME = "<@" + BOT_ID + ">" def main(): print(SLACK_BOT_NAME) # Create the slackcli...
Python
0.000001
6f2ab55d0b83c33fad322101e7214425efd10829
add colors to module
comoving_rv/plot.py
comoving_rv/plot.py
colors = dict() colors['line_marker'] = '#3182bd' colors['gp_model'] = '#ff7f0e' colors['not_black'] = '#333333' colors['fit'] = '#2ca25f'
Python
0
963b1ab24767acb5253b9fe2f29749d8656b2918
index file added
index.py
index.py
#!/usr/bin/env python import web import page import upload import utils #from google.appengine.ext import db import logging from Cheetah.Template import Template import os urls = ( '/page', page.app_page, '/upload', upload.app_upload, '/login', "login", '/(\d+)-(?:[\w|-]+)\.html', "index", "/(.*)",...
Python
0.000001
93c1bf2808087d1fd6e082e55d74180a445ebf91
Add migrations for names
pyBuchaktion/migrations/0002_auto_20170404_1716.py
pyBuchaktion/migrations/0002_auto_20170404_1716.py
# -*- coding: utf-8 -*- # Generated by Django 1.9.12 on 2017-04-04 15:16 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('pyBuchaktion', '0001_initial'), ] operations = [ ...
Python
0.000001
71f717b2e65228633f35acd5addab9464c2d6f6d
Add test_add_model
tests/test_add_model.py
tests/test_add_model.py
import datetime from unittest.mock import patch import pytest from flask import Flask, redirect from flask_restful import Api, Resource, abort, fields, marshal_with, reqparse from flask_restful_swagger import registry, swagger class MockBasicObject: pass class TodoItem: """This is an example of a model cl...
Python
0.000494
b91eb0b8b5bd66ea0bf090e6c6e71232c81d6e7a
Add mount.py
kiwi/mount.py
kiwi/mount.py
def mountpoint(path): try: subprocess.check_call(['mountpoint', path], stdout=subprocess.PIPE, stderr=subprocess.PIPE) except subprocess.CalledProcessError: return False return True def unmount(path): subprocess.check_call(['umount', path]) def mount(src, dst, mkdir=False,...
Python
0.000002
cc1a799da671fbbbdd0406eeebc8c5a801a099d5
Add extension test
tests/test_extension.py
tests/test_extension.py
""" tests.test_extension ==================== Tests for extension """ import json from flask import Flask from flask_swag import Swag def test_extension(): """Basic test for flask extension.""" app = Flask(__name__) app.config['SWAG_TITLE'] = "Test application." app.config['SWAG_API_VERSION'] = '1....
Python
0.000001
4181f69bda52c4cbec7ac1d7529d44e26ede61d1
create object base classes.
pygeobase/object_base.py
pygeobase/object_base.py
# Copyright (c) 2015, Vienna University of Technology, Department of Geodesy # and Geoinformation. All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the...
Python
0
f1a56c1f5a043703f3dc049ebb363e3faf85f3aa
Add PARSEC tests
tests/gem5/parsec-benchmarks/test_parsec.py
tests/gem5/parsec-benchmarks/test_parsec.py
# Copyright (c) 2021 The Regents of the University of California # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: redistributions of source code must retain the above copyright # notice, this lis...
Python
0