commit stringlengths 40 40 | subject stringlengths 4 1.73k | repos stringlengths 5 127k | old_file stringlengths 2 751 | new_file stringlengths 2 751 | new_contents stringlengths 1 8.98k | old_contents stringlengths 0 6.59k | license stringclasses 13
values | lang stringclasses 23
values |
|---|---|---|---|---|---|---|---|---|
ba50883881d3e652c1175489e16c3c5839807feb | add new: GWinstek GDS-840S, RS-232 connection. | imrehg/labhardware,imrehg/labhardware | serial/serialGDS840S.py | serial/serialGDS840S.py | #!/usr/bin/env python
# RS-232 serial support for GW Instek GDS-840S Digital Storage Oscilloscope
# http://www.gwinstek.com/html/en/DownloadFile.asp?sn=255&uid=&lv=
# Filename: 82DS-82000IA.pdf
import serial
# Values set on unit manually (but these are standard settings)
ser = serial.Serial('/dev/ttyUSB0',baudrate=3... | mit | Python | |
096087b4fddf9bc2644bcbb71834fcfc5985558c | add flash order | joequant/bitcoin-price-api | scripts/flash-order.py | scripts/flash-order.py | #!/usr/bin/python3
from pubnub.pnconfiguration import PNConfiguration
from pubnub.pubnub import PubNub
pnconfig = PNConfiguration()
pnconfig.subscribe_key = "my_subkey"
pnconfig.publish_key = "my_pubkey"
pnconfig.ssl = False
pubnub = PubNub(pnconfig)
from pubnub.callbacks import SubscribeCallback
from pubnub.enums ... | mit | Python | |
7dee9be2022bdf481bc5bc6766684058fd9d44e5 | add script for generating the manifest for a given package | sassoftware/mirrorball,sassoftware/mirrorball | scripts/genmanifest.py | scripts/genmanifest.py | #!/usr/bin/python
#
# Copyright (c) 2008 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.rp... | apache-2.0 | Python | |
0ca7d4a20c8a65e45ddb7c61ca72c0e6c464a80e | Create template_redacted entry for templates created by migration | alphagov/notifications-api,alphagov/notifications-api | migrations/versions/0296_template_redacted_fix.py | migrations/versions/0296_template_redacted_fix.py | """
Revision ID: 0296_template_redacted_fix
Revises: 0295_api_key_constraint
Create Date: 2019-06-07 17:02:14.350064
"""
from alembic import op
revision = '0296_template_redacted_fix'
down_revision = '0295_api_key_constraint'
def upgrade():
op.execute("""
INSERT INTO template_redacted (template_id, re... | mit | Python | |
a38f18b8c51ad83b5c4b92853fa5640137131ad9 | imprime sequencia de gtins, calculando dígito verificador | anselmobd/fo2,anselmobd/fo2,anselmobd/fo2,anselmobd/fo2 | script/gera_gtin.py | script/gera_gtin.py | from gtin import GTIN
country = 789
company = 96188
product = 7251
quant = 127
for incr in range(quant):
numero_gtin = '{}{}{}'.format(country, company, product+incr)
print(str(GTIN(raw=numero_gtin)))
| mit | Python | |
2611476df6f362cd59e4aad38a243fc8f6cbf8a8 | Purge da página de palestra quando salva palestrante | devincachu/devincachu-2013,devincachu/devincachu-2013,devincachu/devincachu-2014,devincachu/devincachu-2014,devincachu/devincachu-2014,devincachu/devincachu-2013,devincachu/devincachu-2013 | devincachu/purger.py | devincachu/purger.py | # -*- coding: utf-8 -*-
import roan
from django.contrib.flatpages import models
from palestras import models as pmodels
def connect():
flatpages = models.FlatPage.objects.all()
for f in flatpages:
roan.purge(f.url).on_save(models.FlatPage)
palestras = pmodels.Palestra.objects.all()
for p in... | # -*- coding: utf-8 -*-
import roan
from django.contrib.flatpages import models
from palestras import models as pmodels
def connect():
flatpages = models.FlatPage.objects.all()
for f in flatpages:
roan.purge(f.url).on_save(models.FlatPage)
palestras = pmodels.Palestra.objects.all()
for p in... | bsd-2-clause | Python |
b8cd3912bbe67381829f70ec0f1d94e590632387 | Create BLASTvouchers.py | DidemnumVex/IonTorrentVoucher | BLASTvouchers.py | BLASTvouchers.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 9 23:13:07 2017
BLASTvouchers.py
Will BLAST contigs made by MIRA against most recent Invertebrate db.
Modification: 11Apr17, now requires csv file list of fasta files to BLAST (because BLAST mod requires fasta input)
@author: tcampbell
"""
import... | mit | Python | |
4fe11f89c008909dd21451ac0e23dce86de7c849 | Add profiling dev script. | tallakahath/pymatgen,mbkumar/pymatgen,Bismarrck/pymatgen,xhqu1981/pymatgen,czhengsci/pymatgen,nisse3000/pymatgen,aykol/pymatgen,aykol/pymatgen,gmatteo/pymatgen,blondegeek/pymatgen,gpetretto/pymatgen,dongsenfo/pymatgen,tschaume/pymatgen,blondegeek/pymatgen,Bismarrck/pymatgen,montoyjh/pymatgen,matk86/pymatgen,tschaume/py... | dev_scripts/profile_structure.py | dev_scripts/profile_structure.py | #!/usr/bin/env python
from pymatgen.io.vaspio import Poscar
import cProfile
import pstats
import os
p = Poscar.from_file("../test_files/POSCAR.LiFePO4", check_for_POTCAR=False)
s = p.structure
def test():
nn = s.get_sites_in_sphere([0, 0, 0], 20)
print len(nn)
cProfile.run('test()', 'testprof')
p = pstats.S... | mit | Python | |
aa8a87eabd97406c91b0474dc6018b618101b503 | add the code | kbatten/python-socks5-socket | monkey_sockets_socks5.py | monkey_sockets_socks5.py | #!/usr/bin/env python
# monkey patch socks5 support into sockets
import os
import socket
import struct
def _split_proxy(uri, port):
split_auth = uri.split("@")
if uri == "":
split_uri = []
elif len(split_auth) == 2:
split_first = split_auth[0].split(":")
split_second = split_auth... | mit | Python | |
ea30b49012af2003049f4b1b7deeecb1232c7513 | Create permutations.py | Kunalpod/codewars,Kunalpod/codewars | permutations.py | permutations.py | #Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Permutations
#Problem level: 4 kyu
from itertools import groupby, permutations as perm
def permutations(string):
return [k for k,_ in groupby(sorted([''.join(comb) for comb in perm(string)]))]
| mit | Python | |
eb943bb45695472483352978060a94e0d48b5e4a | Add scatterplot | ronrest/convenience_py,ronrest/convenience_py | plot/scatter.py | plot/scatter.py | import matplotlib.pyplot as plt
def plot_scatter(x, y, ax=None, color=None, alpha=None, size=None, labels=None, title="Scatterplot", figsize=(10,6)):
# TODO: Add x, and y labels
# TODO: grid
if ax is None:
fig, ax = plt.subplots(figsize=figsize)
fig.suptitle(title, fontsize=15)
else:
... | apache-2.0 | Python | |
02f207269f7d2773919e520e04ab8f9261357d4b | Add isup plugin | tomleese/smartbot,Cyanogenoid/smartbot,Muzer/smartbot,thomasleese/smartbot-old | plugins/isup.py | plugins/isup.py | import requests
import urllib.parse
class Plugin:
def __call__(self, bot):
bot.on_respond(r"is (.*) (up|down)(\?)?", self.on_respond)
bot.on_respond(r"isup (.*)$", self.on_respond)
bot.on_help("isup", self.on_help)
def on_respond(self, bot, msg, reply):
url = "http://isitup.org... | mit | Python | |
8c6b412e01e81a7c062ba8234ebafc6fca61651c | Add shovel test.quick for sanity check before pushing | python-astrodynamics/astrodynamics,python-astrodynamics/astrodynamics | shovel/test.py | shovel/test.py | # coding: utf-8
from __future__ import absolute_import, division, print_function
import subprocess
from collections import OrderedDict
from shovel import task
@task
def quick():
failed = OrderedDict.fromkeys(
['test', 'docs', 'spelling', 'doc8', 'flake8'], False)
failed['tests'] = bool(subprocess.c... | mit | Python | |
cdcc45eb6982e68415632a8bcfbc5e7596e0a1cf | add resize_logos.py | EuroPython/ep-tools,PythonSanSebastian/ep-tools,EuroPython/ep-tools,EuroPython/ep-tools,PythonSanSebastian/ep-tools,PythonSanSebastian/ep-tools,EuroPython/ep-tools,PythonSanSebastian/ep-tools | scripts/resize_logos.py | scripts/resize_logos.py | #!/usr/bin/env python
import os
import os.path as op
from PIL import Image
dirPath = op.abspath('./logos')
out_dir = op.join(dirPath, 'resize')
if not op.exists(out_dir):
os.mkdir(out_dir)
supported_formats = ['png', 'gif', 'jpg']
for img_file in os.listdir(dirPath):
if img_file[-3:] not in supported_form... | mit | Python | |
ff994f8bfd7642fc95694d511a1cec81d0ba8f4d | fix bugs | cboling/xos,jermowery/xos,wathsalav/xos,cboling/xos,zdw/xos,xmaruto/mcord,jermowery/xos,open-cloud/xos,xmaruto/mcord,opencord/xos,xmaruto/mcord,open-cloud/xos,wathsalav/xos,opencord/xos,cboling/xos,jermowery/xos,zdw/xos,jermowery/xos,wathsalav/xos,zdw/xos,zdw/xos,xmaruto/mcord,open-cloud/xos,wathsalav/xos,cboling/xos,o... | plstackapi/planetstack/api/sites.py | plstackapi/planetstack/api/sites.py | from plstackapi.openstack.client import OpenStackClient
from plstackapi.openstack.driver import OpenStackDriver
from plstackapi.planetstack.api.auth import auth_check
from plstackapi.planetstack.models import Site
def add_site(auth, **fields):
driver = OpenStackDriver(client = auth_check(auth))
site = Site(*... | from plstackapi.openstack.client import OpenStackClient
from plstackapi.openstack.driver import OpenStackDriver
from plstackapi.planetstack.api.auth import auth_check
from plstackapi.planetstack.models import Site
def add_site(auth, **fields):
driver = OpenStackDriver(client = auth_check(auth))
site = Site(*... | apache-2.0 | Python |
1be4972ca39408b8d4770b5722642996908c9a70 | add 5-for.py | weizhenwei/tech-docs-2016,weizhenwei/tech-docs-2016,weizhenwei/tech-docs-2016,weizhenwei/tech-docs-2016,weizhenwei/tech-docs-2016,weizhenwei/tech-docs-2016 | python/5-for.py | python/5-for.py | #!/usr/bin/env python
for letter in 'python':
print "Current character is ", letter
fruits = ['banana', 'apple', 'mango']
for fruit in fruits:
print "Current fruit is ", fruit
for index in range(len(fruits)):
print "Current fruit is ", fruits[index]
print "Good bye!"
| bsd-2-clause | Python | |
4cef0dc3af25ec4c781ed04b28d425374f793702 | add socket comm class | codingfoo/overo_python_examples,codingfoo/overo_python_examples | socket_communication.py | socket_communication.py | #!/usr/bin/env python
import socket
class SocketCommunication:
def __init__(self):
self.RECEIVER_HOST = '192.168.1.4' # The remote host
self.PORT = 3000 # The same port as used by the server
def open(self):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.sock.connect((self.... | mit | Python | |
50a7b9bc262c98f4e387746f67a638f50f94ba38 | Add migration merge | uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal,uwcirg/true_nth_usa_portal | 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... | bsd-3-clause | Python | |
85c67110db1fbb5a25faef36bdfe282952f5a034 | Create __init__.py | shahryarabaki/ICE | src/__init__.py | src/__init__.py | apache-2.0 | Python | ||
d686f54aff87d4dea1266ee1fec8c1c320dee5b9 | add tests for fizz_buzz. | bm5w/codeeval | 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... | mit | Python | |
cab46eb2323a062bff8bedbf1cc8dd036cd52044 | Solve Code Fights frequency analysis problem | HKuz/Test_Code | 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... | mit | Python | |
4fa2ca578b7015bee68f9f2f7bc26df2f7ab01b4 | add test_cli.py module and initial test | akittas/geocoder,DenisCarriere/geocoder | 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... | mit | Python | |
8f4ac0b12c0f83ff892e16e312cc5edbfb089850 | add tests for no config startup | 20c/vaping,20c/vaping | 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')
| apache-2.0 | Python | |
1f2f4837e823ff6cc5c9cb961f4852753926f0d7 | Create __init__.py | petermchale/tumor | tumor/__init__.py | tumor/__init__.py | mit | Python | ||
f146583961733feb90567fdf03a6a5ee122c550f | Create r34.py | Loreleix64/aradiabot | 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... | mit | Python | |
d0287d9deaa3eb03076cdd199414b772a291e2c5 | Add command for moving zips | california-civic-data-coalition/django-calaccess-downloads-website,california-civic-data-coalition/django-calaccess-downloads-website,california-civic-data-coalition/django-calaccess-downloads-website | 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
... | mit | Python | |
cdd1f3410b8ae304485f7992ac6048e1277cffe1 | Add local locale from file | phoebebright/parsedatetime,bear/parsedatetime,idpaterson/parsedatetime | 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... | apache-2.0 | Python |
c98039a25638db0c124efeaa394f89f2a84a2ede | Create aekjdfh.py | sajjadelastica/3G45,sajjadelastica/3G45,sajjadelastica/3G45,sajjadelastica/3G45 | aekjdfh.py | aekjdfh.py | sdl;jfhlkjsdhfhdf
| apache-2.0 | Python | |
c51651dba8ccd14be9e6fb9ee028d1d2940b3202 | Add parity test for simple RNN (#1351) | williamFalcon/pytorch-lightning,williamFalcon/pytorch-lightning | 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... | apache-2.0 | Python | |
8a1dff9437a4f013a96369a1fe174c505e8636cb | Add missing migration (fix #130) | csalom/puput,APSL/puput,APSL/puput,APSL/puput,csalom/puput,csalom/puput | 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'),
]
... | mit | Python | |
8a3d757be17d395ba14ae7458036a78d10e3e212 | Test to find out how to remove a file a git repo. | alekscl/HelloWorld-Python | holamundo.py | holamundo.py | #!/usr/bin/env python
def main():
print("Hola mundo!!")
if __name__ == "__main__":
main()
| unlicense | Python | |
17aefac614890b1fe7079a76b803707ae3fbb832 | Add perihelion | Caronthir/FYS3150,Caronthir/FYS3150,Caronthir/FYS3150 | 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'] = ... | mit | Python | |
41f68e14fe890cac3de391f7bc4cdd5c2e5b9d75 | test B07 | gisce/primestg | 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... | agpl-3.0 | Python | |
e6f9f12d1c9faae8f718306bcd2862278a083351 | Test gnssUblox message processing (#24404) | commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot,commaai/openpilot | 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... | mit | Python | |
45a91a5c32227aabf17b52960d98851cd7608dd1 | add qha plot tool (function version) | abelcarreras/aiida_extensions,abelcarreras/aiida_extensions | 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'... | mit | Python | |
082e7d63192c2e7eaa4210e0c559b145313ecc3a | Add files via upload | SpencerNorris/SuperPACs,SpencerNorris/SuperPACs,SpencerNorris/SuperPACs,SpencerNorris/SuperPACs | 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... | apache-2.0 | Python | |
d8ba95ddb1e469600c735316a1aeafa115399b3c | Add an execution module called key to return minion public key finger | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | 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... | apache-2.0 | Python | |
ce8465e5f0f085bedcd1a84220316c8eab29a493 | Add Tensor Flow | kakaba2009/MachineLearning,kakaba2009/MachineLearning,kakaba2009/MachineLearning,kakaba2009/MachineLearning | 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... | apache-2.0 | Python | |
b3889f8ff6d66963d4253d6796c3bb20dc9adbb7 | Add external driver and parameter file | eguil/ENSO_metrics,eguil/ENSO_metrics | 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... | bsd-3-clause | Python | |
771fc766446e1610a0599102720dc7e0f358e0e6 | Add wsgi file | dlapiduz/govcode.org,dlapiduz/govcode.org,dlapiduz/govcode.org,HackAgenda/govcode,HackAgenda/govcode | app.wsgi | app.wsgi | from app import app as application
| mit | Python | |
fc636dbaacb5d2d1ebba1ba7f577ee4ec4deb958 | Add synthtool scripts (#3765) | googleapis/java-containeranalysis,googleapis/java-containeranalysis,googleapis/java-containeranalysis | 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... | apache-2.0 | Python | |
faf9e73f44cfee0c637c006ad6c37e8dcef0d1df | Create arcEC.py | MartinHvidberg/Esri_stuff | 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... | apache-2.0 | Python | |
3aed2efd64d38a78682d7ae4c55400763af22c63 | add avoid.py | ukscone/unicornhat,ukscone/unicornhat | 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... | unlicense | Python | |
7f7effb6ec47c3714df5d6d9dbb403c6fda9cd89 | Add test to create repository on GitHub | LouisBarranqueiro/selenium-docker-aws-deployer | 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 ... | mit | Python | |
1fe3fd59e4000216c4d6694690dc0ba866a66ecb | add bloom_count_intersection.py | kdmurray91/khmer,souravsingh/khmer,souravsingh/khmer,souravsingh/khmer,kdmurray91/khmer,F1000Research/khmer,ged-lab/khmer,jas14/khmer,kdmurray91/khmer,Winterflower/khmer,ged-lab/khmer,ged-lab/khmer,F1000Research/khmer,jas14/khmer,F1000Research/khmer,Winterflower/khmer,Winterflower/khmer,jas14/khmer | 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... | bsd-3-clause | Python | |
4722c73643cbf9cbd63f05736a8469afc4c03443 | test project: convert IPAddressField fields to GenericIPAddressField | IMAmuseum/django-admin-bootstrapped,pombredanne/django-admin-bootstrapped,sn0wolf/django-admin-bootstrapped,pombredanne/django-admin-bootstrapped,mynksngh/django-admin-bootstrapped,xrmx/django-admin-bootstrapped,kevingu1003/django-admin-bootstrapped,askinteractive/mezzanine-advanced-admin-new,bformet/django-admin-boots... | 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")
... | apache-2.0 | Python |
63f91c2459cb98cf0cfb1e60d298944212d9d639 | add missing file in symm | sunqm/pyscf,gkc1000/pyscf,sunqm/pyscf,sunqm/pyscf,gkc1000/pyscf,sunqm/pyscf,gkc1000/pyscf,gkc1000/pyscf,gkc1000/pyscf | 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... | apache-2.0 | Python | |
005872ea37dfdd4b8ab8b16e3c5b0083fb86cdb9 | Add settings file | ninjawil/garden-web-server,ninjawil/garden-web-server,ninjawil/garden-web-server,ninjawil/garden-web-server | 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... | mit | Python | |
746dd90a17d756f5601ddcbbd6c2de6fed9c75d5 | add splitter script | nogizhopaboroda/musfinder,nogizhopaboroda/musfinder,nogizhopaboroda/musfinder | 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)):
... | mit | Python | |
7a49dfb41888b6afed4ff3dca3987f641e497056 | Add PageHandler | kkstu/Torweb,kkstu/Torweb | 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', ... | mit | Python | |
d3248cebcb1ef161dfc706d99b4d361205fc9fbe | Add wsgi file | jpgneves/t-10_server,jpgneves/t-10_server | t10server.wsgi | t10server.wsgi | from teeminus10_api import app as application | mit | Python | |
be249ac1ce39977e4448e320f80d3b642f2c9193 | Add original code | nickfrostatx/gitcontrib | 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... | mit | Python | |
2866c8fbb3549ffd2405c5b13338a3fdf87a6c5d | add checks | sliceofcode/dogbot,slice/dogbot,slice/dogbot,slice/dogbot,sliceofcode/dogbot | 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)
| mit | Python | |
482859488865fe9b1e05a923e7aafeb7e090f049 | Create volumeBars.py | DarkAce65/rpi-led-matrix,DarkAce65/rpi-led-matrix | 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... | mit | Python | |
15839dd4b37761e49599f6b278f6bd6e6d18b1e5 | Add initial rpc implementation example | victorpoluceno/xwing | 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()
... | isc | Python | |
f09bddb89681fdd03ac190a1caa4847b3da7a61f | add script for reinserting unparsed sentences into the parser output | rsling/cow,rsling/cow,rsling/cow,rsling/cow | 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)
# ... | bsd-2-clause | Python | |
7d52d1efaf5bb07bfbb66e78f7c51e92b6c531dd | Use BytesIO. Closes #17 | bradleyg/django-ajaximage,bradleyg/django-ajaximage,subhaoi/kioskuser,bradleyg/django-ajaximage,subhaoi/kioskuser,subhaoi/kioskuser | 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... | mit | Python |
5f9c6e49597abe07a74cd2e7370216bd0fc57cd4 | add topology | YYMo/sdn_project,YYMo/sdn_project,YYMo/sdn_project,YYMo/sdn_project | 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... | apache-2.0 | Python | |
4ff6b846311a0f7bd6cfcf2e661a7c53061406fe | Add command to print vault info | carsonmcdonald/glacier-cmd | 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... | mit | Python | |
adcbdc06f0c476bc4c24e8c69d06cffbb6726a9f | Add migration | OpenVolunteeringPlatform/django-ovp-organizations,OpenVolunteeringPlatform/django-ovp-organizations | 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'),
]
... | agpl-3.0 | Python | |
582ebd448508625ed2c9f362aaafc3fc46e60df0 | Add unit tests for security_scan | opnfv/functest,opnfv/functest,mywulin/functest,mywulin/functest | 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... | apache-2.0 | Python | |
25f5ff62e1652e3293d12e3e73e44e7d7c21463c | upgrade incs | rboman/progs,rboman/progs,rboman/progs,rboman/progs,rboman/progs,rboman/progs,rboman/progs,rboman/progs,rboman/progs,rboman/progs | 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... | apache-2.0 | Python | |
0fe4a3c3a1d31230c9b5c931ff1e33584f1ccd4e | Create maximum-length-of-pair-chain.py | kamyu104/LeetCode,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,kamyu104/LeetCode,kamyu104/LeetCode,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/L... | 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... | mit | Python | |
0a0f17044b90b6897cd931a2e9d002b764b27b00 | Add pytorch-lightning bf16 training example (#5526) | intel-analytics/BigDL,yangw1234/BigDL,yangw1234/BigDL,yangw1234/BigDL,intel-analytics/BigDL,intel-analytics/BigDL,yangw1234/BigDL,intel-analytics/BigDL | 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 ... | apache-2.0 | Python | |
4f586f16eaf3e06d347bf9976a02005c70cd7e13 | Create installTests.py | jmategk0/UbuntuSetup,jmategk0/conductor | installTests.py | installTests.py | import unittest
import install
class TestOperationWrapperMethods(unittest.TestCase):
def setUp(self):
# TODO: Write Tests
self.test_dataset = ""
| mit | Python | |
95182581beebbd181b20b23ee02657cb18347dd6 | update spec: update read_spectrum.py: add read_spectrum for elodie | hypergravity/bopy,hypergravity/bopy | 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... | bsd-3-clause | Python | |
39bb6cd51ce5351bfd93adac7b083a52b25590f8 | Create 6kyu_vending_machine.py | Orange9000/Codewars,Orange9000/Codewars | 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... | mit | Python | |
5e96dd2846660f14e1d7b691ba928da63b699f19 | Add support for Spotify | foauth/foauth.org,foauth/foauth.org,foauth/foauth.org | 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... | bsd-3-clause | Python | |
062c4bc134f77f9279d18774b954a06566f99c5a | Add logger | cmu-delphi/delphi-epidata,cmu-delphi/delphi-epidata,cmu-delphi/delphi-epidata,cmu-delphi/delphi-epidata,cmu-delphi/delphi-epidata,cmu-delphi/delphi-epidata | 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... | mit | Python | |
934f4ccfc4e34c5486c3d5a57b429742eb9b5915 | add algorithms.ml to make format for machine learning | tanghaibao/jcvi,sgordon007/jcvi_062915 | 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... | bsd-2-clause | Python | |
2ca07d4a8893196bbf304bcdac16688505e6123a | Add a management command to register webhooks | CorbanU/corban-shopify,CorbanU/corban-shopify | 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()
| bsd-3-clause | Python | |
4aafeac9c238ffb8dc448c87f18abfd7f1f0c9d7 | store data dir info | bw2/gemini,heuermh/gemini,bgruening/gemini,heuermh/gemini,arq5x/gemini,bpow/gemini,brentp/gemini,xuzetan/gemini,xuzetan/gemini,bgruening/gemini,bw2/gemini,bpow/gemini,heuermh/gemini,bw2/gemini,udp3f/gemini,arq5x/gemini,udp3f/gemini,brentp/gemini,bgruening/gemini,arq5x/gemini,xuzetan/gemini,brentp/gemini,udp3f/gemini,bp... | 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
| mit | Python | |
9d6a053441505fae600915e24a263de798843fbb | Add test_weapon class | TsvetaKandilarova/Escape-The-Labyrinth | 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)
... | mit | Python | |
7a4b4a116a10f389f6d14321547fa1966b262c0d | Add Hacker News | kitsook/newssum,kitsook/newssum,kitsook/newssum | 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... | mit | Python | |
cd48829eb08df62d8222128b33a7c00b9ca2ed8a | Add files via upload | dewuem/python-bioinf | 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... | mit | Python | |
ed578177781ff1d4aeb0b7abb7d5f11fc5a7c626 | Create copy of WeakList and set it to raise exception instead of removing item from list | PatrikValkovic/grammpy | 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)
... | mit | Python | |
ee859881af0633d4d2d88015c907cfa856516dbe | Create TwoSum II for Lint | Chasego/codi,Chasego/codi,cc13ny/Allin,cc13ny/algo,Chasego/cod,cc13ny/algo,Chasego/codirit,Chasego/cod,cc13ny/Allin,Chasego/codirit,Chasego/codi,Chasego/codirit,cc13ny/Allin,Chasego/codi,Chasego/codi,Chasego/codirit,cc13ny/algo,Chasego/cod,cc13ny/Allin,cc13ny/algo,Chasego/codirit,cc13ny/algo,cc13ny/Allin,Chasego/cod,Ch... | 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:
... | mit | Python | |
52e8a378d8a31989c9d93ef83eabbe6df339f915 | Add data migration to add category components for VPC. | opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur | 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... | mit | Python | |
df0772b3ae02ff0180f18410cf4350b493db9cb4 | Create fold_stereonet_fisher_mean.py | mlaloux/QGIS_structural_geology | 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(... | apache-2.0 | Python | |
8ce4b91c9f1eca911809bc2e8c315ea24eac10ae | Add scheduler example | voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts,voidabhi/python-scripts | 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... | mit | Python | |
9ab752bc96c1ad8d6e718cbf87f247aba4ab76a9 | Create MiddleCharacter.py | JLJTECH/TutorialTesting | 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... | mit | Python | |
4e7a074fdfb0b5df300c2b4f1c2109ffb47e89cc | Create t3_muptiplot.py | jxjdzmyy/battery | 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... | epl-1.0 | Python | |
2e7058a9b48154ad205b6f53e07a224574a2e125 | add command-line script to fix missing exposure times in MMIRS data | MMTObservatory/mmtwfs | 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... | bsd-3-clause | Python | |
0cff0d69f0d2f52f950be37f95c8f261a9741ae7 | Create KAKAO_DATA_PREPARE_NEW.py | thkim107/sim | 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... | mit | Python | |
3de9ab07b67bd37e418cba16318aa813326793bb | Create createREFgenomesForPhasing.py | evodify/phasing-genomes | createREFgenomesForPhasing.py | createREFgenomesForPhasing.py | mit | Python | ||
c87779ed6e0163503c01efd3a3913b547954d73d | Create convcsv.py | pythonbag/scripts,pythonbag/scripts | 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:
... | apache-2.0 | Python | |
1c81643eaed91b4171a4e68699d930e5ef3688db | Add negative API tests for policy validation | openstack/senlin,openstack/senlin,stackforge/senlin,stackforge/senlin,openstack/senlin | 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... | apache-2.0 | Python | |
f040351dd3397ba7297b69b2468b2b37589c0d8f | Add task to get stats about files | lutris/website,lutris/website,lutris/website,lutris/website | 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... | agpl-3.0 | Python | |
cff5035ad469adc46ed9cf446bb95d9a1e07bd77 | Fix inline template | DMOJ/site,monouno/site,monouno/site,DMOJ/site,monouno/site,Phoenix1369/site,DMOJ/site,Phoenix1369/site,Minkov/site,DMOJ/site,Minkov/site,Minkov/site,Minkov/site,Phoenix1369/site,Phoenix1369/site,monouno/site,monouno/site | 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... | agpl-3.0 | Python |
12445164d5a7651ddcc381f5e602577d8372fe6a | Add is_eq_size script | vladimirgamalian/pictools | 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)
... | mit | Python | |
ad052e71145296897c1510752c0f3403b9cb45a4 | add 1st py file | wuchengang/PythonLearing,wuchengang/PythonLearing | hello.py | hello.py | print('Hello, Python!');
name = input();
print(name); | apache-2.0 | Python | |
73f2260e0e5ae3534f13664063808abbe73b1d72 | add a new extractor, from json files | scorphus/dotfilesetal,scorphus/dotfilesetal,scorphus/dotfilesetal,scorphus/dotfilesetal,scorphus/dotfilesetal,scorphus/dotfilesetal | 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):
''... | apache-2.0 | Python | |
81a38564379af16f4ea2d64572e517a6657f4450 | add first test for NormalIndPower and normal_power | Averroes/statsmodels,statsmodels/statsmodels,bavardage/statsmodels,jseabold/statsmodels,rgommers/statsmodels,huongttlan/statsmodels,edhuckle/statsmodels,rgommers/statsmodels,nguyentu1602/statsmodels,nvoron23/statsmodels,hlin117/statsmodels,astocko/statsmodels,huongttlan/statsmodels,DonBeo/statsmodels,yarikoptic/pystats... | 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... | bsd-3-clause | Python | |
f24c8376847b0226f3d3f674af2f568367f15234 | add data structure for parens problem | clair3st/code-katas | 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... | mit | Python | |
9992a4ff90156a1c5678303530c2feeaecf700d6 | Create a_deco.py | DaivdZhang/LittleProject | 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, ... | mit | Python | |
463502a251111199da130e508929a35b2f126f4e | Add columns to User model | byanofsky/bookmarks,byanofsky/bookmarks,byanofsky/bookmarks | 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... | apache-2.0 | Python | |
0c77666c259ba78899863bbbe482a857102c19be | add settings module | HackerEarth/he-sdk-python | 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... | mit | Python | |
36af113eb363ddf25f96ab53e41db0ea7f3bb481 | add a python scripts to generate user weibo file from weibo.txt | anphoenix/data_model,anphoenix/data_model | 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... | apache-2.0 | Python | |
8c78679bc9875c698f639a0c45a5208b43162f4e | comment obsolete ff prefs script. | CarlFK/veyepar,xfxf/veyepar,yoe/veyepar,yoe/veyepar,EricSchles/veyepar,yoe/veyepar,EricSchles/veyepar,CarlFK/veyepar,xfxf/veyepar,xfxf/veyepar,yoe/veyepar,CarlFK/veyepar,yoe/veyepar,EricSchles/veyepar,EricSchles/veyepar,xfxf/veyepar,xfxf/veyepar,CarlFK/veyepar,EricSchles/veyepar,CarlFK/veyepar | 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... | mit | Python |
bb11ab050fe9a7bb0ffe83419eb0e87390f7deac | Add registration method for TB | hopshadoop/hops-util-py,hopshadoop/hops-util-py | 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... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.