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 |
|---|---|---|---|---|---|---|---|---|
e581eb8af860456b0ff46e99398002b3df0f0677 | add Julia magic for IPython | JuliaLang/pyjulia,PallHaraldsson/pyjulia,JuliaPy/pyjulia,JuliaPy/pyjulia | julia/magic.py | julia/magic.py | """
==========================
Julia magics for IPython
==========================
{JULIAMAGICS_DOC}
Usage
=====
``%%julia``
{JULIA_DOC}
"""
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
from... | mit | Python | |
e830ce7115ea417feb00c62bf68a7d1829815630 | Create UAV_State class | ProgrammingRobotsStudyGroup/robo_magellan,ProgrammingRobotsStudyGroup/robo_magellan,ProgrammingRobotsStudyGroup/robo_magellan,ProgrammingRobotsStudyGroup/robo_magellan | scripts/uav_state.py | scripts/uav_state.py | #!/usr/bin/env python
#
# UAV State Model:
# Encapsulates UAV state and abstracts communication
# States:
# - Setpoint pose
# - local_position
# - MAV mode
# - arm
# import ROS libraries
import rospy
import mavros
from mavros.utils import *
from mavros import setpoint as SP
import mavros_msgs.msg
import mavros_msgs.sr... | apache-2.0 | Python | |
12691d47c4dbbaac42d2c9a8fe04e70cb5a94e98 | add Yaspin.write usage example | pavdmyt/yaspin | examples/write_method.py | examples/write_method.py | # -*- coding: utf-8 -*-
"""
examples.write_method
~~~~~~~~~~~~~~~~~~~~~
Basic usage of ``write`` method.
"""
import time
from yaspin import yaspin
def main():
with yaspin(text='Downloading images') as sp:
# task 1
time.sleep(1)
sp.write('> image 1 download complete')
# task 2
... | mit | Python | |
324bc6f72deef0349f0da48366ab11b749a231b5 | Make AzureKeyVaultBackend backwards-compatible (#12626) | sekikn/incubator-airflow,mistercrunch/airflow,Acehaidrey/incubator-airflow,sekikn/incubator-airflow,bolkedebruin/airflow,Acehaidrey/incubator-airflow,airbnb/airflow,Acehaidrey/incubator-airflow,apache/airflow,danielvdende/incubator-airflow,mistercrunch/airflow,DinoCow/airflow,bolkedebruin/airflow,lyft/incubator-airflow... | airflow/contrib/secrets/azure_key_vault.py | airflow/contrib/secrets/azure_key_vault.py | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | apache-2.0 | Python | |
165d6795c2e3b173282736127c092ede57ae8f55 | Create create_recurring_for_failed.py | ShashaQin/erpnext,ShashaQin/erpnext,ShashaQin/erpnext,ShashaQin/erpnext | erpnext/patches/v6_27/create_recurring_for_failed.py | erpnext/patches/v6_27/create_recurring_for_failed.py | import frappe
from erpnext.controllers.recurring_document import manage_recurring_documents
def execute():
frappe.db.sql("""update `tabSales Invoice`
set is_recurring=1 where (docstatus=1 or docstatus=0) and next_date='2016-06-26' and is_recurring=0""")
manage_recurring_documents("Sales Invoice", "2016-06-26... | agpl-3.0 | Python | |
93d1d4cc446cd13affaf1b467e39845c5dc437a5 | Add missing migration | kooditiimi/linkedevents,kooditiimi/linkedevents,tuomas777/linkedevents,kooditiimi/linkedevents,tuomas777/linkedevents,kooditiimi/linkedevents,aapris/linkedevents,aapris/linkedevents,tuomas777/linkedevents,City-of-Helsinki/linkedevents,City-of-Helsinki/linkedevents,aapris/linkedevents,City-of-Helsinki/linkedevents | events/migrations/0002_auto_20150119_2138.py | events/migrations/0002_auto_20150119_2138.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('events', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='offer',
name='price',
... | mit | Python | |
a8b46224dfda38173ea130d820411aad6a47acfc | Add Commander.py | molly/GorillaBot,quanticle/GorillaBot,molly/GorillaBot,quanticle/GorillaBot | src/Commander.py | src/Commander.py | # Copyright (c) 2013 Molly White
#
# 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 rights
# to use, copy, modify, merge, publish, distrib... | mit | Python | |
52c9a8ab10934c7acf8bcc404dccd2524199acb7 | support for qualifying keys with dot('.') in JSON reference | ujjawalmisra/json-ws-test | src/DictUtils.py | src/DictUtils.py | import collections
class DictUtils:
@staticmethod
def __retrieveFromDict(t, key):
if None != t:
found = True
if str == type(key):
keys = key.split('.')
else:
keys = key
for k in keys:
if k in t:
... | import collections
class DictUtils:
@staticmethod
def __retrieveFromDict(t, key):
if None != t:
found = True
if str == type(key):
keys = [key]
else:
keys = key
for k in keys:
if k in t:
... | mit | Python |
fe36fd79c1981c489fd1db548c7468acbf98fff5 | add test for s3 filename unquote | bcgov/gwells,bcgov/gwells,bcgov/gwells,bcgov/gwells | app/backend/gwells/tests/test_documents.py | app/backend/gwells/tests/test_documents.py | from django.test import TestCase
from gwells.documents import MinioClient
class DocumentsTestCase(TestCase):
def test_document_url_with_space(self):
minio_client = MinioClient(disable_private=True)
test_document = {
"bucket_name": "test_bucket",
"object_name": "test key"
... | apache-2.0 | Python | |
4b06b5ec929af3466bfe9f03892b6c68259a2e3e | add gunicorn app | Answeror/aip,Answeror/aip | gunicorn_app.py | gunicorn_app.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
DATA_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), 'data'))
from logbook.compat import redirect_logging
redirect_logging()
from aip import make
from aip.log import RedisPub
with RedisPub():
app = make(
instance_path=DATA_PATH,
... | mit | Python | |
52236b1ad285683d828b248e462a7b984d31e636 | Add example of connecting OGR to matplotlib through shapely and numpy | jdmcbr/Shapely,mindw/shapely,jdmcbr/Shapely,mouadino/Shapely,abali96/Shapely,abali96/Shapely,mouadino/Shapely,mindw/shapely | examples/world.py | examples/world.py | import ogr
import pylab
from numpy import asarray
from shapely.wkb import loads
source = ogr.Open("/var/gis/data/world/world_borders.shp")
borders = source.GetLayerByName("world_borders")
fig = pylab.figure(1, figsize=(4,2), dpi=300)
while 1:
feature = borders.GetNextFeature()
if not feature:
break
... | bsd-3-clause | Python | |
bc871956d492a3bc34e28847de136e1b4ad82035 | Create codechallenge.py | jve2kor/MSD_Hackathon | codechallenge.py | codechallenge.py | mit | Python | ||
2044e3b018595e45cc2969d0675d5006ea02ccf5 | update to use new struct data of g_project | develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms,develersrl/rooms | trunk/editor/savefilerooms.py | trunk/editor/savefilerooms.py | #!/usr/bin/env python
from xml.dom import minidom
from xml.etree import ElementTree
#to use OrderedDict in python < 2.7
try:
from collections import OrderedDict
except ImportError:
from misc.dict import OrderedDict
from structdata.project import g_project
def prettify(content):
"""
Return a pretty-p... | #!/usr/bin/env python
from xml.dom import minidom
from xml.etree import ElementTree
#to use OrderedDict in python < 2.7
try:
from collections import OrderedDict
except ImportError:
from misc.dict import OrderedDict
from structdata.world import g_world
def prettify(content):
"""
Return a pretty-print... | mit | Python |
93d91ba059a7037281f6a5e4d6afd5e071668d81 | Create freebook.py | hkamran80/python-projects | freebook/reddit/freebook.py | freebook/reddit/freebook.py | # Get free ebooks from Reddit
from bs4 import BeautifulSoup
import feedparser
import requests
url = "https://www.reddit.com/r/freebooks.rss"
headers = {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:59.0) Gecko/20100101 Firefox/59.0"}
urls = []
books = []
book_data_all = []
d = feedparser.parse(req... | unlicense | Python | |
6edadeb278be9b776845a12954871386ead270d4 | add tests for log rotation | evernym/plenum,evernym/zeno | plenum/test/test_log_rotation.py | plenum/test/test_log_rotation.py | import pytest
import os
import logging
import shutil
import time
from plenum.common.logging.TimeAndSizeRotatingFileHandler \
import TimeAndSizeRotatingFileHandler
def cleanFolder(path):
if os.path.exists(path):
shutil.rmtree(path)
os.makedirs(path, exist_ok=True)
return path
def test_time_lo... | apache-2.0 | Python | |
fd75ee4a96eddc1e71eb85dd36a2c8f5b13807ca | Create RemoveLinkedListElement.py | lingcheng99/LeetCode | RemoveLinkedListElement.py | RemoveLinkedListElement.py | """Remove Linked List Elements
Remove all elements from a linked list of integers that have value val.
Example
Given: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6
Return: 1 --> 2 --> 3 --> 4 --> 5
"""
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution... | mit | Python | |
fd33fadc260cda2bd2395f027457f990ab05480b | Add migration for Registration changed | pythonkr/pyconapac-2016,pythonkr/pyconapac-2016,pythonkr/pyconapac-2016 | registration/migrations/0008_auto_20160418_2250.py | registration/migrations/0008_auto_20160418_2250.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-18 13:50
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('registration', '0007_auto_20160416_1217'),
]
operations = [
migrations.Alter... | mit | Python | |
3c1be9f8fb362699737b6dd867398e734057c300 | Add main entry point. | rave-engine/rave | rave/__main__.py | rave/__main__.py | import argparse
import sys
from os import path
def parse_arguments():
parser = argparse.ArgumentParser(description='A modular and extensible visual novel engine.', prog='rave')
parser.add_argument('-b', '--bootstrapper', help='Select bootstrapper to bootstrap the engine with. (default: autoselect)')
parse... | bsd-2-clause | Python | |
592b3dda603dec0765825fc8dc03fb623906cb63 | Add migration | Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data,Code4SA/municipal-data | infrastructure/migrations/0018_auto_20210928_1642.py | infrastructure/migrations/0018_auto_20210928_1642.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-09-28 14:42
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('infrastructure', '0017_auto_20210928_1329'),
]
op... | mit | Python | |
05659cd132a5dfb54b50ec38ff1d405697de251a | Add crawler for superpoop | klette/comics,klette/comics,datagutten/comics,jodal/comics,datagutten/comics,jodal/comics,datagutten/comics,jodal/comics,jodal/comics,klette/comics,datagutten/comics | comics/crawler/crawlers/superpoop.py | comics/crawler/crawlers/superpoop.py | from comics.crawler.base import BaseComicCrawler
from comics.crawler.meta import BaseComicMeta
class ComicMeta(BaseComicMeta):
name = 'Superpoop'
language = 'en'
url = 'http://www.superpoop.com/'
start_date = '2008-01-01'
history_capable_days = 30
schedule = 'Mo,Tu,We,Th'
time_zone = -5
... | agpl-3.0 | Python | |
6da1f28296a8db0c18c0726dcfdc0067bebd9114 | add a script to test learned DQN | Xaxetrov/OSCAR,Xaxetrov/OSCAR | learning_tools/keras-rl/dqn/dqn_tester.py | learning_tools/keras-rl/dqn/dqn_tester.py | import numpy as np
import gym
import os
import pickle
import argparse
import pandas as pd
from keras.models import Sequential
from keras.layers import Dense, Activation, Flatten
from keras.optimizers import Adam
from rl.agents.dqn import DQNAgent
from rl.policy import BoltzmannQPolicy, LinearAnnealedPolicy
from rl.me... | apache-2.0 | Python | |
9f6f6b727458eb331d370443074a58d1efa6d755 | Add migration for blank true. | mrpau/kolibri,benjaoming/kolibri,indirectlylit/kolibri,benjaoming/kolibri,christianmemije/kolibri,lyw07/kolibri,benjaoming/kolibri,learningequality/kolibri,rtibbles/kolibri,indirectlylit/kolibri,indirectlylit/kolibri,jonboiser/kolibri,MingDai/kolibri,DXCanas/kolibri,rtibbles/kolibri,benjaoming/kolibri,rtibbles/kolibri,... | kolibri/logger/migrations/0003_auto_20170531_1140.py | kolibri/logger/migrations/0003_auto_20170531_1140.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2017-05-31 18:40
from __future__ import unicode_literals
import kolibri.core.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('logger', '0002_auto_20170518_1031'),
]
operations = [
mig... | mit | Python | |
d68a89b73e6ff47a2ebd169c06070815d9fd859c | Add example tests for REST API | mikebryant/rapid-router,mikebryant/rapid-router,mikebryant/rapid-router,CelineBoudier/rapid-router,CelineBoudier/rapid-router,CelineBoudier/rapid-router,mikebryant/rapid-router,CelineBoudier/rapid-router | game/tests/test_api.py | game/tests/test_api.py | # -*- coding: utf-8 -*-
# Code for Life
#
# Copyright (C) 2015, Ocado Limited
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any ... | agpl-3.0 | Python | |
b04e3787de29d4bee68854e15a7e783cbe3c3bd0 | Add test for microstructure generator | awhite40/pymks,davidbrough1/pymks,davidbrough1/pymks | pymks/tests/test_microstructure_generator.py | pymks/tests/test_microstructure_generator.py | import pytest
import numpy as np
from pymks.datasets import make_microstructure
@pytest.mark.xfail
def test_size_and_grain_size_failure():
make_microstructure(n_samples=1, size=(7, 7), grain_size=(8, 1))
@pytest.mark.xfail
def test_volume_fraction_failure():
make_microstructure(n_samples=1, volume_fraction=... | mit | Python | |
74ede836ad6572c9e6c7865e5d29671a994629af | Create ManifoldWR.py | AlexHung780312/SmilNN | SmilNN/ManifoldWR.py | SmilNN/ManifoldWR.py | # -*- coding: utf-8 -*-
import numpy as np
import keras.backend as K
from keras.callbacks import ModelCheckpoint
from keras.layers import Dense
from keras.layers.noise import GaussianDropout
from keras.models import Sequential
from keras.optimizers import SGD
from sklearn.datasets import load_svmlight_file
from keras.r... | mit | Python | |
04dcdadf4f8b18405754683af0138ddc8363580e | Create followExpression.py | momotarou-zamurai/kibidango | maya/python/animation/followExpression.py | maya/python/animation/followExpression.py | ctrlShape = cmds.createNode('locator')
ctrlTransform = cmds.listRelatives(ctrlShape,p=True,f=True)
if isinstance(ctrlTransform,list):
ctrlTransform = ctrlTransform[0]
jt = cmds.createNode('joint',n='followJoint')
attrName = 'follow'
if not cmds.attributeQuery(attrName,n=ctrlTransform,ex=True):
cmds.addAttr(ctr... | mit | Python | |
58c62061c0c02682f96d6793b0570b455887d392 | Add pytest tools | matthew-brett/delocate,matthew-brett/delocate,matthew-brett/delocate | delocate/tests/pytest_tools.py | delocate/tests/pytest_tools.py | import pytest
def assert_true(condition):
__tracebackhide__ = True
assert condition
def assert_false(condition):
__tracebackhide__ = True
assert not condition
def assert_raises(expected_exception, *args, **kwargs):
__tracebackhide__ = True
return pytest.raises(expected_exception, *args, **... | bsd-2-clause | Python | |
dd93995a119323d9b67dce1f8797eb72788a044a | solve 12704 | arash16/prays,arash16/prays,arash16/prays,arash16/prays,arash16/prays,arash16/prays | UVA/vol-127/12704.py | UVA/vol-127/12704.py | from sys import stdin, stdout
I = list(map(int, stdin.read().split()))
for i in range(0, I[0]):
[x, y, r] = I[3*i + 1: 3*i + 4]
cd = (x*x + y*y) ** 0.5
stdout.write('{:.2f} {:.2f}\n'.format(r-cd, r+cd))
| mit | Python | |
3ad0f9ee142e3a08e82749f47003870f14029bff | Fix urls.py to point to web version of view | nirmeshk/oh-mainline,onceuponatimeforever/oh-mainline,eeshangarg/oh-mainline,ehashman/oh-mainline,vipul-sharma20/oh-mainline,campbe13/openhatch,mzdaniel/oh-mainline,moijes12/oh-mainline,moijes12/oh-mainline,campbe13/openhatch,mzdaniel/oh-mainline,ehashman/oh-mainline,SnappleCap/oh-mainline,SnappleCap/oh-mainline,openha... | mysite/urls.py | mysite/urls.py | from django.conf.urls.defaults import *
import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^$', 'mysite.search.views.fetch_bugs'),
(r'^search/$', 'mysite.search.views.fetch_bugs'),
(r'^admin/(.*)', admin.site.root),
(r'^static/(?P<path>... | from django.conf.urls.defaults import *
import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^$', 'mysite.search.views.fetch_bugs'),
(r'^search/$', 'mysite.search.views.fetch_bugs'),
(r'^admin/(.*)', admin.site.root),
(r'^static/(?P<path>... | agpl-3.0 | Python |
9d058f4b324dabf4f2cdd2ea88f40c9aabe2d622 | Add test for the Py binding of Hash. | rectang/lucy-clownfish,nwellnhof/lucy-clownfish,apache/lucy-clownfish,apache/lucy-clownfish,rectang/lucy-clownfish,rectang/lucy-clownfish,rectang/lucy-clownfish,apache/lucy-clownfish,rectang/lucy-clownfish,rectang/lucy-clownfish,nwellnhof/lucy-clownfish,nwellnhof/lucy-clownfish,apache/lucy-clownfish,nwellnhof/lucy-clow... | runtime/python/test/test_hash.py | runtime/python/test/test_hash.py | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | apache-2.0 | Python | |
8706ec4678bc4740b64265ced63fb12d837e0297 | Add Basic Histogram Example | altair-viz/altair,ellisonbg/altair,jakevdp/altair | altair/vegalite/v2/examples/histogram.py | altair/vegalite/v2/examples/histogram.py | """
Histogram
-----------------
This example shows how to make a basic histogram, based on the vega-lite docs
https://vega.github.io/vega-lite/examples/histogram.html
"""
import altair as alt
movies = alt.load_dataset('movies')
chart = alt.Chart(movies).mark_bar().encode(
x=alt.X("IMDB_Rating",
type='... | bsd-3-clause | Python | |
0dc2417894ef1b6bd3f5386f7dfa0bb3d34a594c | Add contest calendar generation code & styles; #55 | Minkov/site,Phoenix1369/site,monouno/site,Phoenix1369/site,monouno/site,DMOJ/site,DMOJ/site,monouno/site,monouno/site,Phoenix1369/site,Minkov/site,DMOJ/site,Minkov/site,Minkov/site,Phoenix1369/site,DMOJ/site,monouno/site | judge/contest_calendar.py | judge/contest_calendar.py | import calendar, datetime
from judge.models import Contest, ContestParticipation, ContestProblem, Profile
class MyCal(calendar.HTMLCalendar):
def __init__(self, x):
super(MyCal, self).__init__(x)
self.today = datetime.datetime.date(datetime.datetime.now())
def formatweekday(self, day):
... | agpl-3.0 | Python | |
4f1ddebb0fc185dfe4cd5167c67be8f6cea78273 | Create listenCmd.py | stephaneAG/Python_tests,stephaneAG/Python_tests,stephaneAG/Python_tests,stephaneAG/Python_tests | listenCmd.py | listenCmd.py | #!/usr/bin/python
#impoer the necessary modules
import re # the regexp module
# listen command test python file
# // THE FCNS //
# the fcn that iterate through the recognized command list to find a match with the received pseech command
def listenForCommand( theCommand ):
#for s in range( len( cmdsList ) ):
for ... | mit | Python | |
fd1b2885057512d6b91a2b2ed4df183e66093e61 | Create extended_iter_with_peek.py | AdityaSoni19031997/Machine-Learning,AdityaSoni19031997/Machine-Learning | lld_practice/extended_iter_with_peek.py | lld_practice/extended_iter_with_peek.py |
class ExtendedIter:
"""An extended iterator that wraps around an existing iterators.
It provides extra methods:
- `has_next()`: checks if we can still yield items.
- `peek()`: returns the next element of our iterator, but doesn't pass by it.
If there's nothing more to return, raises `StopIteration`... | mit | Python | |
77e980157f51af421eceb7c7b7a84945d8d33a91 | Convert caffemodel of FCN8s to chainer model | wkentaro/fcn | scripts/caffe_to_chainermodel.py | scripts/caffe_to_chainermodel.py | #!/usr/bin/env python
from __future__ import print_function
import argparse
import os.path as osp
import caffe
import chainer.functions as F
import chainer.serializers as S
import fcn
from fcn.models import FCN8s
data_dir = fcn.get_data_dir()
caffemodel = osp.join(data_dir, 'voc-fcn8s/fcn8s-heavy-pascal.caffemodel... | mit | Python | |
a8423d5759a951b7f8d765203e3a02a6d3211f35 | add body task generator | stephenplaza/NeuTu,stephenplaza/NeuTu,stephenplaza/NeuTu,stephenplaza/NeuTu,stephenplaza/NeuTu,stephenplaza/NeuTu,stephenplaza/NeuTu,stephenplaza/NeuTu | neurolabi/python/flyem/BodyTaskManager.py | neurolabi/python/flyem/BodyTaskManager.py | '''
Created on Sep 18, 2013
@author: zhaot
'''
import os;
class ExtractBodyTaskManager:
'''
classdocs
'''
def __init__(self):
'''
Constructor
'''
self.commandPath = '';
self.minSize = 0;
self.maxSize = -1;
self.overwriteLevel = 1
self.zO... | bsd-3-clause | Python | |
18935881745b7bc65741837d63ec60e9d62583f1 | Split the big file into smaller pieces | opencog/ros-behavior-scripting,opencog/ros-behavior-scripting | face_track/sound_track.py | face_track/sound_track.py | #
# sound_track.py - Tracking of sound sources
# Copyright (C) 2014,2015,2016 Hanson Robotics
# Copyright (C) 2015,2016 Linas Vepstas
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; e... | agpl-3.0 | Python | |
b41444b5f7c48c4bc46a49405f7b053dcb8ea66c | rename resource function | ywang007/odo,alexmojaki/odo,Dannnno/odo,cpcloud/odo,cowlicks/odo,mrocklin/into,blaze/odo,quantopian/odo,cpcloud/odo,ywang007/odo,quantopian/odo,alexmojaki/odo,blaze/odo,mrocklin/into,ContinuumIO/odo,Dannnno/odo,cowlicks/odo,ContinuumIO/odo | into/backends/sas.py | into/backends/sas.py | from __future__ import absolute_import, division, print_function
import sas7bdat
from sas7bdat import SAS7BDAT
import datashape
from datashape import discover, dshape
from collections import Iterator
import pandas as pd
import sqlalchemy as sa
from .sql import dshape_to_alchemy, dshape_to_table
from ..append import ... | from __future__ import absolute_import, division, print_function
import sas7bdat
from sas7bdat import SAS7BDAT
import datashape
from datashape import discover, dshape
from collections import Iterator
import pandas as pd
import sqlalchemy as sa
from .sql import dshape_to_alchemy, dshape_to_table
from ..append import ... | bsd-3-clause | Python |
4e1d611a06874d478e91185a0349cfc3747e36ab | Create __init__.py | suzannerohrback/somaticCNVpipeline,suzannerohrback/somaticCNVpipeline | bin/map/__init__.py | bin/map/__init__.py | mit | Python | ||
7f4079c30bf5a693f1ccad38109bbfc83a076f22 | Add palette utilities | axt/bingraphvis | bingraphvis/util.py | bingraphvis/util.py | #generated using palettable
PALETTES = {
'grays' : ['#FFFFFD', '#D6D6D4', '#B1B1B0', '#908F8F', '#727171', '#545453', '#373737', '#1A1919', '#000000'],
'greens' : ['#F7FCF5', '#E5F5E0', '#C7E9C0', '#A1D99B', '#74C476', '#41AB5D', '#238B45', '#006D2C', '#00441B'],
'purples': ['#FCFBFD', '#EFEDF5', '#DADAEB', '#BCB... | bsd-2-clause | Python | |
aed1f0e4e33dd956f4499ecffd6bf50bb58e7df4 | Add fermi.py | rartino/ENVISIoN,rartino/ENVISIoN,rartino/ENVISIoN,rartino/ENVISIoN,rartino/ENVISIoN,rartino/ENVISIoN | scripts/fermi.py | scripts/fermi.py | # This example file is part of the ENVISIoN Electronic structure visualization studio
#
# Load this file into the Inviwo Python Editor (which you can access under the menu Python,
# which is available if Inviwo has been compiled with the Python module on)
#
# For Copyright and License information see the file LICENSE ... | bsd-2-clause | Python | |
b4fd94008fa5b1dcdb6dd61651d8776dfb41f2d6 | Make sure we return a list. | WadeYuChen/django-oscar,vovanbo/django-oscar,jinnykoo/wuyisj.com,ka7eh/django-oscar,ahmetdaglarbas/e-commerce,jmt4/django-oscar,thechampanurag/django-oscar,jmt4/django-oscar,faratro/django-oscar,thechampanurag/django-oscar,kapari/django-oscar,adamend/django-oscar,rocopartners/django-oscar,DrOctogon/unwash_ecom,bnprk/dj... | oscar/apps/dashboard/catalogue/widgets.py | oscar/apps/dashboard/catalogue/widgets.py | import six
from django.forms.util import flatatt
from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe
from django import forms
class ProductSelect(forms.Widget):
is_multiple = False
css = 'select2 input-xlarge'
def format_value(self, value):
return six.text_t... | import six
from django.forms.util import flatatt
from django.core.urlresolvers import reverse
from django.utils.safestring import mark_safe
from django import forms
class ProductSelect(forms.Widget):
is_multiple = False
css = 'select2 input-xlarge'
def format_value(self, value):
return six.text_t... | bsd-3-clause | Python |
7e449b0267f47ee08327d9d76976c5e1b197501b | Add missing migration (#9504) | Johnetordoff/osf.io,brianjgeiger/osf.io,mfraezz/osf.io,adlius/osf.io,brianjgeiger/osf.io,felliott/osf.io,brianjgeiger/osf.io,Johnetordoff/osf.io,adlius/osf.io,cslzchen/osf.io,aaxelb/osf.io,cslzchen/osf.io,felliott/osf.io,aaxelb/osf.io,CenterForOpenScience/osf.io,baylee-d/osf.io,mfraezz/osf.io,Johnetordoff/osf.io,cslzch... | osf/migrations/0219_auto_20201020_1836.py | osf/migrations/0219_auto_20201020_1836.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.28 on 2020-10-20 18:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('osf', '0218_auto_20200929_1850'),
]
operations = [
migrations.AlterField(
... | apache-2.0 | Python | |
c137028a98cd762a4e93950fbde085969500999e | Build tagger | mbits-os/JiraDesktop,mbits-os/JiraDesktop,mbits-os/JiraDesktop | installer/build_tag.py | installer/build_tag.py | #!/usr/python
import os
from subprocess import call, check_output
ver = check_output([ "python", "version.py", "../apps/Tasks/src/version.h",
"PROGRAM_VERSION_MAJOR,PROGRAM_VERSION_MINOR,PROGRAM_VERSION_PATCH,PROGRAM_VERSION_BUILD",
"PROGRAM_VERSION_BUILD"])
VERSION = ver.strip()
call(["git","add","../apps... | mit | Python | |
866b1c634c4fc6dc27ad953ccde6b6dcd11dcc91 | Add mood light script | etic/MayaMoodLight | moodlight.py | moodlight.py | from maya.utils import executeDeferred
import pymel.core as pm
import threading
import time
_active_mood_light = None
_running = False
class MoodLightThread(threading.Thread):
def __init__(self, speed):
self.speed = speed
super(MoodLightThread, self).__init__()
def run(self):
while _running:
time.sleep... | mit | Python | |
b0d699066799d0309e7af3f8892f56a6feaac778 | Write tests for new functionality; several destinations | JakobGM/robotarm-optimization | new_tests.py | new_tests.py | from numpy import testing
import unittest
import numpy as np
from numpy import pi
from robot_arm import RobotArm
class TestRobotArm(unittest.TestCase):
def setUp(self):
self.lengths = (3, 2, 2,)
self.destinations = (
(5, 0,),
(4, 2,),
(6, 0.5),
... | mit | Python | |
50f698c2fdd90bc4b3e60a583c196381fc23e099 | Implement a rudimentary API for LLTK | lltk/lltk-restful | lltk-restful/base.py | lltk-restful/base.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import lltk
import lltk.generic
import lltk.caching
import lltk.exceptions
from flask import Flask
from flask import jsonify, request
__author__ = 'Markus Beuckelmann'
__author_email__ = 'email@markus-beuckelmann.de'
__version__ = '0.1.0'
DEBUG = True
CACHING = True
NAME = ... | agpl-3.0 | Python | |
aef4998354ee5872557392be4bc635e015e5d76d | add serial decoder | zpiman/golemScripts | serialDecoder.py | serialDecoder.py | #!/usr/bin/python2.7
import signal
import sys
import time
import serial
import io
import getopt
interval = '0.1'
device = '/dev/cu.usbserial'
try:
port=serial.Serial(port=device,
baudrate=2400,
bytesize=serial.EIGHTBITS,
stopbits=serial.STOPBITS_ONE,... | mit | Python | |
04f19b29c79e1ab624d7ce596730ad9b4fd500fd | add lcdb.helpers.py | lcdb/lcdb-workflows,lcdb/lcdb-workflows,lcdb/lcdb-workflows | lcdb/helpers.py | lcdb/helpers.py | import yaml
from jsonschema import validate, ValidationError
def validate_config(config, schema):
schema = yaml.load(open(schema))
cfg = yaml.load(open(config))
try:
validate(cfg, schema)
except ValidationError as e:
msg = '\nPlease fix %s: %s\n' % (config, e.message)
raise Val... | mit | Python | |
f4944256092b085b1546eaec114e0987da6697bc | add simple cli client | mrtazz/InstapaperLibrary | instapaper_cli.py | instapaper_cli.py | #!/opt/local/bin/python2.6
from instapaper import Instapaper
from optparse import OptionParser
from getpass import getpass
def usage():
print "Usage: instapaper.py [-h] username password url"
print "Options:"
print "-h Print this help"
def main():
# initialize parser
usage = "usage: %prog -u U... | mit | Python | |
77886d170cba5c2427982992f3ff54f6357e3a07 | add basic inverted index tool | jasonwbw/NLPbasic | inverted_index.py | inverted_index.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# @author: Jason Wu (bowenwu@sohu-inc.com)
# This is a simple Inverted Index library to pretreatment for PMI compute or similar way
import math
import re
from operator import itemgetter
class InvertedIndex:
'''
Inverted Index class for docs
The libra... | mit | Python | |
4d740138dc7101e2816837c070d3051835977d75 | Add lc0621_task_scheduler.py | bowen0701/algorithms_data_structures | lc0621_task_scheduler.py | lc0621_task_scheduler.py | """Leetcode 621. Task Scheduler
Medium
URL: https://leetcode.com/problems/task-scheduler/
Given a char array representing tasks CPU need to do. It contains capital letters
A to Z where different letters represent differenttasks. Tasks could be done
without original order. Each task could be done in one interval. For ... | bsd-2-clause | Python | |
af8f7a09c6cf8a96b716d016fc3a983340760869 | Create problem10.py | ptwales/Project-Euler,ptwales/Project-Euler | python/problem10.py | python/problem10.py | import primes
def problem10(limit):
ps = itertools.takewhile(lambda x: x < limit, primes.Eppstein_Sieve())
# ps = primes.Eratosthenes(limit) # memory error
return sum(ps)
| mit | Python | |
5b276622f570adac64eda9932c7da47bf4bcd25c | Add PPM sample | ymyzk/ex4cg,ymyzk/ex4cg,ymyzk/ex4cg | ppm_practice.py | ppm_practice.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
class PpmImage(object):
"""PPM 画像を表すクラス"""
def __init__(self, name, width, height, image, depth=8):
"""
:param name:
:param width:
:param height:
:param image:
:param depth depth: 各色の階調数 (bit)
:return:
... | mit | Python | |
4f404a71cb7ee912bca8184fe94c97d6cfba1186 | Add script to rotate a solid angle in the xz plane | barbagroup/pygbe,barbagroup/pygbe,barbagroup/pygbe | preprocessing_tools/solid_rotation_y.py | preprocessing_tools/solid_rotation_y.py | '''
Rotates the protein by a solid angle on the plane xz
'''
import numpy
import os
from argparse import ArgumentParser
from move_prot_helper import (read_vertex, read_pqr, rotate_y,
modify_pqr)
def read_inputs():
"""
Parse command-line arguments to run move_protein.
User s... | bsd-3-clause | Python | |
daf23cbb6d6015a2819de5d089a35903cbce9441 | Create katakan.py | agusmakmun/Some-Examples-of-Simple-Python-Script,agusmakmun/Some-Examples-of-Simple-Python-Script | list/katakan.py | list/katakan.py | """
4
2 belas
seratus 4 puluh 0
9 ribu seratus 2 puluh 1
2 puluh 1 ribu 3 puluh 0
9 ratus 5 ribu 0
8 puluh 2 juta 8 ratus 8 belas ribu seratus 8 puluh 8
3 ratus 1 juta 4 puluh 8 ribu 5 ratus 8 puluh 8
"""
def kata(n):
angka = range(11)
temp = ""
if n < 12:
temp += str(angka[n])
elif n < 20:
... | agpl-3.0 | Python | |
1555164ff275436de580a33735a2d8c6e6893b42 | Create lab4.py | JOSUEXLION/prog3-uip,JOSUEXLION/prog3-uip | laboratorios/lab4.py | laboratorios/lab4.py | #lab 4
#josue dde leon
for i in range (1, 4):
nombre = input("\n\nintroduce nombre: ")
n1 = input ("Introduce nota 1: ")
n2 = input ("Introduce nota 2: ")
n3 = input ("Introduce nota 3: ")
n4 = input ("Introduce nota 4: ")
n5 = input ("Introduce nota 5: ")
prom=(float(n1)+float(n2)+float(n3)+float(n4)+float(n5... | mit | Python | |
7b06edf37a630d4582fc84832cd1d40b790e4aa3 | Add server | openlawlibrary/pygls,openlawlibrary/pygls,openlawlibrary/pygls | pygls/server.py | pygls/server.py | import asyncio
import logging
from .protocol import LanguageServerProtocol
logger = logging.getLogger(__name__)
class Server:
def __init__(self, protocol_cls):
assert issubclass(protocol_cls, asyncio.Protocol)
self.loop = asyncio.get_event_loop()
self.lsp = protocol_cls(self)
se... | apache-2.0 | Python | |
357ce31d1f28fbc5d12a23dfd3bb2aa40a4e27a3 | Add serialdumpbytexor.py | jj1bdx/avrhwrng,jj1bdx/avrhwrng,jj1bdx/avrhwrng | serialdumpbytexor.py | serialdumpbytexor.py | #!/usr/bin/env python
import sys, serial
if __name__ == '__main__':
ser = serial.Serial('/dev/cu.usbserial-A8004ISG', 115200, timeout=10, xonxoff=0, rtscts=0)
# ser.open()
bb = bytearray(512)
while 1:
ba = bytearray(ser.read(1024))
for i in range(512):
j = i * 2
... | mit | Python | |
ca99e80e04a1d7fb3ff3698f23cdc19c8ec16113 | add refresh test | scylladb/scylla-longevity-tests,amoskong/scylla-cluster-tests,scylladb/scylla-cluster-tests,scylladb/scylla-longevity-tests,amoskong/scylla-cluster-tests,amoskong/scylla-cluster-tests,scylladb/scylla-cluster-tests,amoskong/scylla-cluster-tests,scylladb/scylla-cluster-tests,scylladb/scylla-longevity-tests,scylladb/scyll... | refresh_test.py | refresh_test.py | #!/usr/bin/env python
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hop... | agpl-3.0 | Python | |
b440872f71d37cc5bf110eb0c7c13a4a2dcb7f6c | create utils package, field_template_read update var name to template render | YACOWS/opps,jeanmask/opps,opps/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,opps/opps,YACOWS/opps,YACOWS/opps,williamroot/opps,jeanmask/opps,opps/opps,jeanmask/opps,opps/opps,williamroot/opps,williamroot/opps | opps/fields/utils.py | opps/fields/utils.py | # -*- coding: utf-8 -*-
def field_template_read(obj):
"""Use replace because the django template can't read variable with "-"
"""
fields = {}
for o in obj:
fields[o.replace("-", "_")] = obj[o]
return fields
| mit | Python | |
2804024fbee6b825dec512ff13d7b28a1fee5b25 | Add root Api object. | pozytywnie/RouterOS-api,socialwifi/RouterOS-api,kramarz/RouterOS-api | routeros_api/api.py | routeros_api/api.py | import hashlib
import binascii
from routeros_api import api_communicator
from routeros_api import api_socket
from routeros_api import base_api
def connect(host, username='admin', password='', port=8728):
socket = api_socket.get_socket(host, port)
base = base_api.Connection(socket)
communicator = api_commu... | mit | Python | |
52f715af4b1cf6dd964e71cafdf807d1133fe717 | add a basic script that tests nvlist_in and nvlist_out functionality | ClusterHQ/pyzfs | tests/test_nvlist.py | tests/test_nvlist.py | import json
import math
from libzfs_core.nvlist import *
from libzfs_core.nvlist import _lib
props_in = {
"key1": "str",
"key2": 10,
"key3": {
"skey1": True,
"skey2": None,
"skey3": [
True,
False,
True
]
},
"key4": [
"ab",
"bc"
],
"key5": [
int(math.pow(2, 62)),
1,
2,
3
],
"key6":... | apache-2.0 | Python | |
5348379759caa9576c3194ae0795e2fcc6ed3308 | add unit tests | mirnylab/cooler | tests/test_region.py | tests/test_region.py | # -*- coding: utf-8 -*-
from cooler.region import *
import nose
def test_bool_ops():
a, b = parse_region(('chr1', 5, 10)), parse_region(('chr1', 15, 20))
assert comes_before(a, b) == True
assert comes_after(a, b) == False
assert contains(a, b) == False
assert overlaps(a, b) == False
a, b = pa... | bsd-3-clause | Python | |
c9fc6d4f98ba102d94fa54eedae6a50d38459d71 | add test_invalid_files to test_schema | NREL/hescore-hpxml | tests/test_schema.py | tests/test_schema.py | import os
import jsonschema
import json
import pathlib
import copy
def get_example_json(filebase):
rootdir = pathlib.Path(__file__).resolve().parent.parent
jsonfilepath = str(rootdir / 'examples' / f'{filebase}.json')
with open(jsonfilepath) as f:
js = json.load(f)
return js
def get_json_sch... | bsd-2-clause | Python | |
5e4fd7fb37f9e16d27a7751221f6e3725509f2fc | Prepare to use unittests | thomnico/fortiosapi,thomnico/fortigateconf,thomnico/fortiosapi | tests/testapi.py | tests/testapi.py | #!/usr/bin/python
from fortigateconf import FortiOSConf
import sys
import json
import pprint
import json
from argparse import Namespace
import logging
formatter = logging.Formatter(
'%(asctime)s %(name)-12s %(levelname)-8s %(message)s')
logger = logging.getLogger('fortinetconflib')
hdlr = logging.FileHandler('... | apache-2.0 | Python | |
cd653c3657aa14d3845a253d916e9f0d336910ce | add logger convenience class | AlekSi/loggerglue | loggerglue/logger.py | loggerglue/logger.py | # -*- coding: utf-8 -*-
"""
An rfc5424/rfc5425 syslog server implementation
Copyright © 2011 Evax Software <contact@evax.fr>
"""
import socket,os,sys
from datetime import datetime
from loggerglue.rfc5424 import DEFAULT_PRIVAL,SyslogEntry
from loggerglue.emitter import UNIXSyslogEmitter
class Logger(object):
"""
... | mit | Python | |
1ac75fafc9c67e0fc1f898f4653593730ed66326 | Create uber.py | jasuka/pyBot,jasuka/pyBot | modules/uber.py | modules/uber.py | def uber(self):
self.send_chan("Prkl, toimii!")
| mit | Python | |
7b8d7bf81b094f554f3d820b1e0df5d54917f4c0 | Create getCITask.py | xebialabs-community/xlr-xldeploy-plugin,xebialabs-community/xlr-xldeploy-plugin,xebialabs-community/xlr-xldeploy-plugin,xebialabs-community/xlr-xldeploy-plugin | src/main/resources/xlr_xldeploy/getCITask.py | src/main/resources/xlr_xldeploy/getCITask.py | #
# Copyright 2017 XEBIALABS
#
# 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 rights to use, copy, modify, merge, publish, distribute, subli... | mit | Python | |
116babc38e2e4023eb0b45eabc02050ed433e240 | Include a helpful MOD analyser script | keirf/Amiga-Stuff,keirf/Amiga-Stuff | scripts/mod_info.py | scripts/mod_info.py | # mod_info.py
#
# Display information about a Protracker module.
#
# Written & released by Keir Fraser <keir.xen@gmail.com>
#
# This is free and unencumbered software released into the public domain.
# See the file COPYING for more details, or visit <http://unlicense.org>.
import struct, sys
with open(sys.argv[1],... | unlicense | Python | |
9e7acd4e7d80cffb0274e3a01aee517fb63d3db9 | Create Josuel_Concordance.py | Joshlix95/Juntos | Josuel_Concordance.py | Josuel_Concordance.py | # Author: Josuel Musambaghani
# library that breaks text into parts
import nltk
import string
with open('c:/Python27/fileIn.txt', 'r') as in_file:
text = in_file.read()
f = nltk.sent_tokenize(text)
# This code deals with the proble of parenthesis
for item in range(len(f)-1):
if '(' in f[item] and ')' in f[... | mit | Python | |
2032a823b2dad6f7cebb63ee276bcfb6ea02b7a0 | improve notes | parrt/msan692,parrt/msan692,parrt/msan692 | notes/code/lolviz.py | notes/code/lolviz.py | import graphviz
def lolviz(table):
"""
Given a list of lists such as:
[ [('a','3')], [], [('b',230), ('c',21)] ]
return the dot/graphviz to display as a two-dimensional
structure.
"""
s = """
digraph G {
nodesep=.05;
rankdir=LR;
node [shape=record,width=.1,he... | mit | Python | |
70b6fde787018daf5b87f485e60c9a26fa542f2e | add basic affine 3D transforms | FeodorM/Computer-Graphics | lab_3/affine_transform.py | lab_3/affine_transform.py | from util.matrix import Matrix
from math import cos, sin
def translation(x, y, z):
return Matrix([
[1, 0, 0, x],
[0, 1, 0, y],
[0, 0, 1, z],
[0, 0, 0, 1]
])
# den = (phi ** 2 + psi ** 2) ** .5
# phi /= den
# psi /= den
# return Matrix([
# ... | mit | Python | |
786f75be946427024fa96ae8dcd06d8d1ecd49cc | Add the init method to the node model. | yiyangyi/cc98-tornado | model/node.py | model/node.py | class NodeModel(Query):
def __init__(self, db):
self.db = db
self.table_name = "node"
super(NodeModel, self).__init__() | mit | Python | |
ebc6368c11048a9182d848cff7f47e3dd8532933 | Add files via upload | huntercbx/games-with-python | my_game_04.py | my_game_04.py | import pygame
import os
# ширина и высота игрового экрана
WIDTH = 640
HEIGHT = 480
# частота кадров
FPS = 60
# путь к изображениям
game_folder = os.path.dirname(__file__)
img_folder = os.path.join(game_folder, "images");
# класс для корабля игрока
class PlayerShip(pygame.sprite.Sprite):
def __init... | mit | Python | |
07467664b699612e10b51bbeafdce79a9d1e0127 | Write unit test for utility functions | unnonouno/cudnnenv | test/test_util.py | test/test_util.py | from __future__ import unicode_literals
try:
import io
StringIO = io.StringIO
except ImportError:
import StringIO
StringIO = StringIO.StringIO
import os
import shutil
import sys
import tempfile
import unittest
import cudnnenv
class TestSafeTempDir(unittest.TestCase):
def test_safe_temp_dir(self... | mit | Python | |
448f18769d7c701d9dd03ff65489656380513d07 | Add test init. | FelixLoether/flask-image-upload-thing,FelixLoether/flask-uploads | tests/__init__.py | tests/__init__.py | from flexmock import flexmock
from flask.ext.storage import MockStorage
from flask_uploads import init
created_objects = []
added_objects = []
deleted_objects = []
committed_objects = []
class MockModel(object):
def __init__(self, **kw):
created_objects.append(self)
for key, val in kw.iteritems()... | mit | Python | |
256648ad4effd9811d7c35ed6ef45de67f108926 | Add pytest option for specifying the typing module to use | bintoro/overloading.py | tests/conftest.py | tests/conftest.py | import sys
def pytest_addoption(parser):
parser.addoption('--typing', action='store', default='typing')
def pytest_configure(config):
if config.option.typing == 'no':
sys.modules['typing'] = None
elif config.option.typing != 'typing':
sys.modules['typing'] = __import__(config.option.typi... | mit | Python | |
08f6d31feb493b24792eaabfa11d08faea68c62b | add textample plug | Rouji/Yui,Rj48/ircbot | plugins/textample/textample.py | plugins/textample/textample.py | # coding=utf-8
import gzip
import os
import random
import re
def search(regex, base_dir, file_contains=''):
reg = re.compile(regex, re.IGNORECASE)
for root, _, files in os.walk(base_dir):
for file in files:
if file.endswith('.gz'):
file_path = os.path.join(root, file)
... | mit | Python | |
da3248f782d83c46b698c31736b29a42d380511c | Add the playground | thewizardplusplus/micro,thewizardplusplus/micro,thewizardplusplus/micro | micro/_playground.py | micro/_playground.py | CODE = '''
out str + 2 3
'''
if __name__ == '__main__':
import lexer
import preparser
import parser
import builtin_functions
import sys
import evaluate
specific_lexer = lexer.Lexer()
specific_preparser = preparser.Preparser(specific_lexer)
preast = specific_preparser.preparse(CODE)... | mit | Python | |
686c0d0c8f2e520375315c84e2320b087b9a3831 | add scan dir test | hirokihamasaki/irma,quarkslab/irma,deloittem/irma-frontend,quarkslab/irma,deloittem/irma-frontend,quarkslab/irma,deloittem/irma-frontend,hirokihamasaki/irma,hirokihamasaki/irma,hirokihamasaki/irma,quarkslab/irma,hirokihamasaki/irma,deloittem/irma-frontend | tests/scan_dir.py | tests/scan_dir.py | import os
import json
import datetime
import random
import hashlib
import signal
import sys
from frontend.cli.irma import _scan_new, _scan_add, _scan_launch, \
_scan_progress, _scan_cancel, IrmaScanStatus, _scan_result
import time
RES_PATH = "."
SRC_PATH = "."
DEBUG = True
SCAN_TIMEOUT_SEC = 300
BEFORE_NEXT_PROGR... | apache-2.0 | Python | |
682b064f29c7a6cfea0c9866da03703822e70cb3 | Add machinery to slurp dhcpd.leases journal into usable format. | ceph/propernoun,ceph/propernoun | propernoun/leases.py | propernoun/leases.py | from . import parser
from . import watch
def gen_leases(path):
"""
Keep track of currently valid leases for ISC dhcpd.
Yields dictionaries that map ``ip`` to information about the
lease. Will block until new information is available.
"""
g = watch.watch_dhcp_leases(path)
for _ in g:
... | mit | Python | |
ba6c50d0b2fd973c34f2df3779d78df11f671598 | Create mongo_import_keywords.py | ecohealthalliance/EpiTator | mongo_import_keywords.py | mongo_import_keywords.py | """
Load mongo database with keywords for annie annotation.
The keyword_array pickle is packaged with the GRITS classifier.
"""
import sys
import re
import pickle
from pymongo import MongoClient
def load_keyword_array(file_path):
with open(file_path) as f:
keyword_array = pickle.load(f)
return keyword_... | apache-2.0 | Python | |
a21ed2d12b763d93722b6c8e9f6d6ff39d15938c | add utility to fetch satellites and corresponding TLEs | valpo-sats/scheduling-bazaar,valpo-sats/scheduling-bazaar | python-files/get-satellites.py | python-files/get-satellites.py | #!/usr/bin/env python3
"""
Utility to get the station information from a SatNOGS Network server.
Collects the paginated objects into a single JSON list and stores in a file.
"""
import json
import sqlite3
import requests
import orbit
# default expire time is 24 hours
orbit.tle.requests_cache.configure(expire_afte... | agpl-3.0 | Python | |
550873226ec0879a86fea2527b56535a329981b1 | Add upcoming_match.py | the-blue-alliance/the-blue-alliance-android,the-blue-alliance/the-blue-alliance-android,Adam8234/the-blue-alliance-android,nwalters512/the-blue-alliance-android,1fish2/the-blue-alliance-android,nwalters512/the-blue-alliance-android,1fish2/the-blue-alliance-android,phil-lopreiato/the-blue-alliance-android,nwalters512/th... | upcoming_match.py | upcoming_match.py | #! /usr/bin/env python
#
# Tests sending an upcoming_match notification via adb to The Blue Alliance
# Android app.
import test_notification
json_data = {"match_key": "2007cmp_sf1m3",
"event_name": "Championship - Einstein Field",
"team_keys": ["frc173","frc1319","frc1902","frc177","frc987","frc190"],
"s... | mit | Python | |
1d8cbf94f127571358aee97677a09f7cea3bf3a7 | Add helper functions for to/from bytes/unicode | rh314/p23serialize | p23serialize/util.py | p23serialize/util.py | from . import str_mode
if str_mode == 'bytes':
unicode_type = unicode
else: # str_mode == 'unicode'
unicode_type = str
def recursive_unicode(obj):
if isinstance(obj, bytes):
return obj.decode('latin1')
elif isinstance(obj, list):
return [recursive_unicode(_) for _ in obj]
else:
... | mit | Python | |
01f21a16e4bcecccf51a565b51222ab18b79adb4 | Add tests for shell utils. | tonybaloney/st2,pixelrebel/st2,Plexxi/st2,emedvedev/st2,pixelrebel/st2,grengojbo/st2,armab/st2,StackStorm/st2,StackStorm/st2,lakshmi-kannan/st2,Itxaka/st2,emedvedev/st2,punalpatel/st2,alfasin/st2,punalpatel/st2,dennybaa/st2,pinterb/st2,dennybaa/st2,StackStorm/st2,peak6/st2,armab/st2,tonybaloney/st2,Plexxi/st2,Plexxi/st... | st2common/tests/unit/test_util_shell.py | st2common/tests/unit/test_util_shell.py | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | apache-2.0 | Python | |
f56a902f2e7ca45bb4bf1dfa7dacefd3fefff524 | Create config.sample | Xi-Plus/Xiplus-Wikipedia-Bot,Xi-Plus/Xiplus-Wikipedia-Bot | zhwikt-broken-file-links/config.sample.py | zhwikt-broken-file-links/config.sample.py | # -*- coding: utf-8 -*-
cfg = {
"category": "Category:含有受损文件链接的页面"
}
| mit | Python | |
076f65b4d67cb44cd48ee5eedc134a83ab01ca4a | Add unit test for md.pair.lj1208 (duplicated from test_pair_lj.py) | joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue,joaander/hoomd-blue | hoomd/md/test-py/test_pair_lj1208.py | hoomd/md/test-py/test_pair_lj1208.py | # -*- coding: iso-8859-1 -*-
# Maintainer: unassigned
from hoomd import *
from hoomd import deprecated
from hoomd import md;
context.initialize()
import unittest
import os
# md.pair.lj1208
class pair_lj1208_tests (unittest.TestCase):
def setUp(self):
print
self.s = deprecated.init.create_random(N=... | bsd-3-clause | Python | |
18d129613c5a576b770a812f18ff05873925fb2c | refactor to a shorter version. | UWIT-IAM/uw-restclients,uw-it-aca/uw-restclients,UWIT-IAM/uw-restclients,jeffFranklin/uw-restclients,jeffFranklin/uw-restclients,uw-it-cte/uw-restclients,jeffFranklin/uw-restclients,uw-it-aca/uw-restclients,uw-it-cte/uw-restclients,uw-it-cte/uw-restclients,UWIT-IAM/uw-restclients | restclients/digitlib/curric.py | restclients/digitlib/curric.py | """
This is the interface for interacting with the UW Libraries Web Service.
"""
import logging
from restclients.digitlib import get_resource
url_prefix = "/php/currics/service.php?code="
sln_prefix = "&sln="
quarter_prefix = "&quarter="
year_prefix = "&year="
logger = logging.getLogger(__name__)
def get_subject_g... | """
This is the interface for interacting with the UW Libraries Web Service.
"""
import logging
from restclients.digitlib import get_resource
url_prefix = "/php/currics/service.php?code="
sln_prefix = "&sln="
quarter_prefix = "&quarter="
year_prefix = "&year="
logger = logging.getLogger(__name__)
def get_subject_g... | apache-2.0 | Python |
f22f833efb45bdfe0458d045cfd300721185dc84 | Revert "bug fix" | phtagn/sickbeard_mp4_automator,phtagn/sickbeard_mp4_automator,Filechaser/sickbeard_mp4_automator,Filechaser/sickbeard_mp4_automator,Collisionc/sickbeard_mp4_automator,Collisionc/sickbeard_mp4_automator | sabToSickBeardwithConverter.py | sabToSickBeardwithConverter.py | import os
import sys
import autoProcessTV
from readSettings import ReadSettings
from mkvtomp4 import MkvtoMp4
from extensions import valid_input_extensions
settings = ReadSettings(os.path.dirname(sys.argv[0]), "autoProcess.ini")
path = str(sys.argv[1])
for r, d, f in os.walk(path):
for files in f:
if os.p... | import os
import sys
import autoProcessTV
from readSettings import ReadSettings
from mkvtomp4 import MkvtoMp4
from extensions import valid_input_extensions
settings = ReadSettings(os.path.dirname(sys.argv[0]), "autoProcess.ini")
path = str(sys.argv[1])
for r, d, f in os.walk(path):
for files in f:
if os.p... | mit | Python |
d3a9824ea2f7675e9e0008b5d914f02e63e19d85 | Add new package. (#22639) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/liblbfgs/package.py | var/spack/repos/builtin/packages/liblbfgs/package.py | # Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Liblbfgs(AutotoolsPackage):
"""libLBFGS is a C port of the implementation of Limited-memor... | lgpl-2.1 | Python | |
a568663ebcf8b45a801df2cf2185dd3e7c969a79 | Fix fragile command description | RianFuro/vint,Kuniwak/vint,Kuniwak/vint,RianFuro/vint | vint/linting/policy/prohibit_command_rely_on_user.py | vint/linting/policy/prohibit_command_rely_on_user.py | import re
from vint.ast.node_type import NodeType
from vint.linting.level import Level
from vint.linting.policy.abstract_policy import AbstractPolicy
from vint.linting.policy.reference.googlevimscriptstyleguide import get_reference_source
from vint.linting.policy_loader import register_policy
PROHIBITED_COMMAND_PATTE... | import re
from vint.ast.node_type import NodeType
from vint.linting.level import Level
from vint.linting.policy.abstract_policy import AbstractPolicy
from vint.linting.policy.reference.googlevimscriptstyleguide import get_reference_source
from vint.linting.policy_loader import register_policy
PROHIBITED_COMMAND_PATTE... | mit | Python |
b55277497559fad19f790ba8821f02ff2ce20c91 | add a minimal smoke test of multi-run | ericdill/bluesky,ericdill/bluesky | bluesky/tests/test_multi_runs.py | bluesky/tests/test_multi_runs.py | from bluesky import preprocessors as bpp
from bluesky import plans as bp
from bluesky import plan_stubs as bps
from bluesky.preprocessors import define_run_wrapper as drw
from ophyd.sim import motor, det
from bluesky.tests.utils import DocCollector
def test_multirun_smoke(RE, hw):
dc = DocCollector()
RE.subsc... | bsd-3-clause | Python | |
f31b11b2cf1f6924c4373fbfaf4b911102272876 | add base serializer | ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend,ministryofjustice/cla_backend | cla_backend/apps/complaints/serializers.py | cla_backend/apps/complaints/serializers.py | # -*- coding: utf-8 -*-
from rest_framework import serializers
from .models import Category, Complaint
class CategorySerializerBase(serializers.ModelSerializer):
class Meta:
model = Category
fields = ('id', 'name')
class ComplaintSerializerBase(serializers.ModelSerializer):
category = Categ... | mit | Python | |
9d348cba1c800a4de9a0078ded1e03540256f8a6 | Add backwards-compatible registration.urls, but have it warn pending deprecation. | awakeup/django-registration,hacklabr/django-registration,austinhappel/django-registration,jnns/django-registration,tdruez/django-registration,Troyhy/django-registration,sandipagr/django-registration,spurfly/django-registration,hacklabr/django-registration,euanlau/django-registration,artursmet/django-registration,myimag... | registration/urls.py | registration/urls.py | import warnings
warnings.warn("Using include('registration.urls') is deprecated; use include('registration.backends.default.urls') instead",
PendingDeprecationWarning)
from registration.backends.default.urls import *
| bsd-3-clause | Python | |
d028db776b92c4d968434a64b2c5d7e02867b32e | Create db_init.py | leokhachatorians/Password-Manager | db_init.py | db_init.py | from sqlalchemy import create_engine, Column, Integer, String, Sequence, update
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
engine = create_engine('sqlite:///passwords.db')
Base = declarative_base()
Session = sessionmaker(bind=engine)
session = Session()
class Locke... | mit | Python | |
b40512e834e88f24c20885cddb220188fce11339 | Add verbose names to UserProfile fields. | ugoertz/django-familio,ugoertz/django-familio,ugoertz/django-familio,ugoertz/django-familio | accounts/migrations/0004_auto_20150227_2347.py | accounts/migrations/0004_auto_20150227_2347.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0003_auto_20150227_2158'),
]
operations = [
migrations.AlterField(
model_name='userprofile',
... | bsd-3-clause | Python | |
18baab37c3f1924b104f4ef86224c1b197ef1dad | add problem 054 | smrmkt/project_euler | problem_054.py | problem_054.py | #!/usr/bin/env python
#-*-coding:utf-8-*-
'''
'''
import timeit
class Poker:
def __init__(self, cards):
self.numbers = {}
self.suits = {}
for card in cards:
n = self._to_number(card[0])
s = card[1]
self.numbers[n] = self.numbers.get(n, 0)+1
... | mit | Python | |
e21d6d88f49dbdeb2dfb96e68f174ba587eaa27a | Add pre-deploy version match | urschrei/pyzotero | pre-deploy.py | pre-deploy.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
pre-deploy.py
Created by Stephan Hügel on 2017-06-06
A simple check to ensure that the tag version and the library version coincide
Intended to be called before a Wheel is written using "upload"
"""
import os
import sys
import subprocess
import re
import io
def read... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.