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 |
|---|---|---|---|---|---|---|---|---|
3da1e7058195ec266c0ae0ffab37fa7e46930086 | Load JSON configuration parameters | lorenghoh/loh_tracker | cloudtracker/load_config.py | cloudtracker/load_config.py | import json
class attrdict(dict):
def __init__(self, *args, **kwargs):
dict.__init__(self, *args, **kwargs)
self.__dict__ = self
with open('model_config.json', 'r') as file:
try:
config = attrdict(json.load(file))
except:
raise("JSON config dictionary error.")
case_nam... | bsd-2-clause | Python | |
d2f0576a598620727daaf4d10830ae722b76e636 | Add skeleton ovh-dynhost.py | janhenke/ovh-dynhost | ovh-dynhost.py | ovh-dynhost.py | #! /usr/bin/env python3
"""
A simple script to update the OVH DynHost entry with the current external IP of this machine.
"""
import argparse
import ipgetter
def main():
pass
if __name__ == '__main__':
main()
| mit | Python | |
c31aa6ca625ac5e4be1e67679216336cd80c0de9 | test getting dialects, including redshift | machow/siuba | siuba/tests/test_sql_utils.py | siuba/tests/test_sql_utils.py | from siuba.sql.utils import get_dialect_funcs
import pytest
@pytest.mark.parametrize('name', [
'redshift',
'postgresql',
'sqlite'
])
def test_get_dialect_funcs(name):
get_dialect_funcs(name)
| mit | Python | |
74b31ba7fec330ec167c2e001f60695272da71b8 | Fix numbers in LO list. | batisteo/pasportaservo,tejo-esperanto/pasportaservo,tejo-esperanto/pasportaservo,tejo-esperanto/pasportaservo,tejo-esperanto/pasportaservo,batisteo/pasportaservo,batisteo/pasportaservo,batisteo/pasportaservo | pages/views.py | pages/views.py | from django.views import generic
from django.contrib.auth.models import Group
from hosting.models import Place
from hosting.utils import sort_by_name
class AboutView(generic.TemplateView):
template_name = 'pages/about.html'
about = AboutView.as_view()
class TermsAndConditionsView(generic.TemplateView):
tem... | from django.views import generic
from django.contrib.auth.models import Group
from django_countries.fields import Country
from hosting.models import Profile, Place
from hosting.utils import sort_by_name
class AboutView(generic.TemplateView):
template_name = 'pages/about.html'
about = AboutView.as_view()
class ... | agpl-3.0 | Python |
a6edd48db1d5019411464b18c382afaaaa74ec2f | move utils out | cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack | packages/cardpay-reward-programs/cardpay_reward_programs/utils.py | packages/cardpay-reward-programs/cardpay_reward_programs/utils.py | from os import stat
from pathlib import PosixPath
from time import time
from typing import Any
import duckdb
import yaml
from boto3.session import Session
from cloudpathlib import AnyPath, CloudPath, S3Client
cached_client = S3Client(local_cache_dir="mycache", boto3_session=Session())
cached_client.set_as_default_cli... | mit | Python | |
6c9cd073b4df6832b813ee6aa2e555a54fa1c088 | ADD new alembic commit | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | packages/grid/backend/alembic/versions/2021-10-06_100642749d64.py | packages/grid/backend/alembic/versions/2021-10-06_100642749d64.py | """Update requests table
Revision ID: 100642749d64
Revises: 1bdbdf7f26ce
Create Date: 2021-10-06 09:22:40.298132
"""
# third party
from alembic import op # typ: ignore
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "100642749d64"
down_revision = "1bdbdf7f26ce"
branch_labels = None
depen... | apache-2.0 | Python | |
35f99f9c75f9c10cda458a7a32c720ca08fa542d | Integrate Global Data Parsing with CrossReference | josephsnyder/VistA,OSEHRA-Sandbox/VistA,OSEHRA/VistA,OSEHRA/VistA,shabiel/VistA,OSEHRA-Sandbox/VistA,OSEHRA/VistA,OSEHRA-Sandbox/VistA,josephsnyder/VistA,josephsnyder/VistA,OSEHRA/VistA,OSEHRA-Sandbox/VistA,shabiel/VistA,OSEHRA/VistA,shabiel/VistA,shabiel/VistA,OSEHRA-Sandbox/VistA,shabiel/VistA,josephsnyder/VistA,OSEH... | Utilities/Dox/PythonScripts/FileManGlobalDataParser.py | Utilities/Dox/PythonScripts/FileManGlobalDataParser.py | #---------------------------------------------------------------------------
# Copyright 2014 The Open Source Electronic Health Record Agent
#
# 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
#
... | apache-2.0 | Python | |
62b876dc4762b979c4f02fd6538350a7d9ec2552 | move Dict, load_module in utils | michaelliao/transwarp,michaelliao/transwarp | transwarp/utils.py | transwarp/utils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Michael Liao'
'''
Utils
'''
class Dict(dict):
'''
Simple dict but support access as x.y style.
>>> d1 = Dict()
>>> d1['x'] = 100
>>> d1.x
100
>>> d1.y = 200
>>> d1['y']
200
>>> d2 = Dict(a=1, b=2, c='3')
>>> d2.c... | apache-2.0 | Python | |
c7c34622b09776b1f75f0accd139ac098ea157f6 | Create tweeter_scraper.py | 0xhughes/dumpmon_tweeter_scraper | tweeter_scraper.py | tweeter_scraper.py | import urllib2
import time
import os
import datetime
import sys
from random import randint
def menu():
sane = 1
while sane == 1:
print "[ - ] Please enter absolute path to output directory: "
in_path = raw_input()+"\\tweeter_scraper_out"
if os.path.exists(in_path):
pass
sane = 0
else:
try:
os.mk... | mit | Python | |
5c8c8585b19a9031cacad6a21fa4990560933e02 | Add example of usage of the simulation of 802.11 | veeresht/CommPy | commpy/examples/wifi80211_conv_encode_decode.py | commpy/examples/wifi80211_conv_encode_decode.py | # Authors: CommPy contributors
# License: BSD 3-Clause
import math
import matplotlib.pyplot as plt
import numpy as np
import commpy.channels as chan
# ==================================================================================================
# Complete example using Commpy Wifi 802.11 physical parameters
# =... | bsd-3-clause | Python | |
4f56bcc790cbf8260ed7255a2a596209c4c3b22d | Add py-brotlipy package (#13270) | iulian787/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/py-brotlipy/package.py | var/spack/repos/builtin/packages/py-brotlipy/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyBrotlipy(PythonPackage):
"""Python binding to the Brotli library."""
homepage = "ht... | lgpl-2.1 | Python | |
9841d1f571849e6c1c0f58ec97c9aba0b822794a | add new package (#25748) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-cryolobm/package.py | var/spack/repos/builtin/packages/py-cryolobm/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 PyCryolobm(PythonPackage):
"""The crYOLO boxmanger was written to produce annotation data ... | lgpl-2.1 | Python | |
f520c0dd8d6d75da6e800695acf80b5c2f01da2c | Add vampirtrace (#3911) | lgarren/spack,mfherbst/spack,tmerrick1/spack,skosukhin/spack,iulian787/spack,tmerrick1/spack,EmreAtes/spack,krafczyk/spack,EmreAtes/spack,krafczyk/spack,TheTimmy/spack,lgarren/spack,lgarren/spack,LLNL/spack,krafczyk/spack,mfherbst/spack,matthiasdiener/spack,matthiasdiener/spack,EmreAtes/spack,TheTimmy/spack,skosukhin/s... | var/spack/repos/builtin/packages/vampirtrace/package.py | var/spack/repos/builtin/packages/vampirtrace/package.py | ##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
9f5bfe28d15d6167964c69f9efde239b88ff3915 | Add initial benchmark framework (#7827) | PetePriority/home-assistant,nugget/home-assistant,stefan-jonasson/home-assistant,lukas-hetzenecker/home-assistant,LinuxChristian/home-assistant,mKeRix/home-assistant,aronsky/home-assistant,jabesq/home-assistant,tchellomello/home-assistant,HydrelioxGitHub/home-assistant,ct-23/home-assistant,MungoRae/home-assistant,sande... | homeassistant/scripts/benchmark/__init__.py | homeassistant/scripts/benchmark/__init__.py | """Script to run benchmarks."""
import asyncio
import argparse
from contextlib import suppress
import logging
from timeit import default_timer as timer
from homeassistant import core
BENCHMARKS = {}
def run(args):
"""Handle ensure config commandline script."""
# Disable logging
logging.getLogger('homeas... | mit | Python | |
d42fa463e897e3feff48d98e282ccbd04375d2fa | create images forms, ImageModelForm, add method more_image | opps/opps,williamroot/opps,jeanmask/opps,williamroot/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,jeanmask/opps,opps/opps,opps/opps,YACOWS/opps,jeanmask/opps,YACOWS/opps,williamroot/opps,opps/opps,YACOWS/opps | opps/images/forms.py | opps/images/forms.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django import forms
from .models import Image
from .widgets import MultipleUpload
class ImageModelForm(forms.ModelForm):
image = forms.FileField(required=False, widget=MultipleUpload())
class Meta:
model = Image
def more_image(self):
mo... | mit | Python | |
967a86d211979677380d090e0c67f614cf6a9df4 | Add alphabet cake | laichunpongben/CodeJam | 2017/round_1a/alphabet_cake.py | 2017/round_1a/alphabet_cake.py | #!/usr/bin/env python
# Google Code Jam
# Google Code Jam 2017
# Round 1A 2017
# Problem A. Alphabet Cake
# Solve all test sets
from __future__ import print_function
def make_cake(r, c, cake):
assert isinstance(cake, list)
filled_cake = []
for row in cake:
first_cell = '?'
last_cell = '... | apache-2.0 | Python | |
a75effa9489e41915b624084c61fba144003b448 | Add a simple test of one's h5py installation. | RaoUmer/distarray,enthought/distarray,RaoUmer/distarray,enthought/distarray | utils/test_h5py.py | utils/test_h5py.py | """
Simple test of a parallel build of h5py (from h5py's documentation).
http://h5py.readthedocs.org/en/latest/mpi.html#using-parallel-hdf5-from-h5py
If you've built h5py properly against a parallel build of hdf5, you should be
able to run this code with::
$ mpiexec -n 4 python test_h5py.py
and then check the o... | bsd-3-clause | Python | |
1a79e5b10240fbb0f10a5bc846c025aef25ac7e5 | add vtn REST endpoint | cboling/xos,cboling/xos,cboling/xos,cboling/xos,cboling/xos | xos/api/service/vtn.py | xos/api/service/vtn.py | from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework import serializers
from rest_framework import generics
from rest_framework import viewsets
from rest_framework.decorators import detail_route, list_route
from rest_f... | apache-2.0 | Python | |
762f29b9aa2fd2c9e8bb284f89a571473c71e59a | add samples | mitou/meikan,mitou/meikan | converter/convert_sample.py | converter/convert_sample.py | # -*- coding: utf-8 -*-
"""
updater.py の中で使われたconvertの例
使い捨てで書き換えて使ってきたので、古いものはサンプル代わりにここに残す。
再利用するものは別途わかりやすい名前を付けて切り出し、--converter=...オプションで指定して使う。
"""
def convert(xs):
"""
行頭にタグをつけ忘れた問題の修正
"""
for x in xs:
x.tags = '\n'.join(u"#未踏採択" + line for line in x.tags.strip('\n').split('\n'))
... | mit | Python | |
c8eec574ad41af6da7c441df50544c962a9510a6 | Create 7kyu_difference_between_two_collections.py | Orange9000/Codewars,Orange9000/Codewars | Solutions/7kyu/7kyu_difference_between_two_collections.py | Solutions/7kyu/7kyu_difference_between_two_collections.py | def diff(a, b):
return sorted(set(a).symmetric_difference(b))
| mit | Python | |
43541161ff87eb0f07b5af9ed2c05f40edad5f79 | Add bare navigation node | atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot,atkvo/masters-bot | src/autobot/src/navigator.py | src/autobot/src/navigator.py | #!/usr/bin/env python
import rospy
from autobot.msg import drive_param
from autobot.msg import wall_dist
from autobot.msg import pathFinderState
from autobot.msg import detected_object
from autobot.srv import *
from pathFinder import PathConfig
"""
This node is responsible for configuring the pathFinder node
when an ... | mit | Python | |
f2a18c3049528a8d388402fc90877071d3aa29dd | Add missing args.py used by draft-3 tests. | stain/common-workflow-language,hmenager/common-workflow-language,StarvingMarvin/common-workflow-language,SciDAP/cwltool,mr-c/common-workflow-language,jeremiahsavage/cwltool,chapmanb/cwltool,SciDAP/cwltool,chapmanb/cwltool,dleehr/cwltool,StarvingMarvin/common-workflow-language,common-workflow-language/cwltool,StarvingMa... | draft-3/draft-3/args.py | draft-3/draft-3/args.py | #!/usr/bin/env python
import sys
import json
import os
args = [os.path.basename(a) for a in sys.argv[1:]]
with open("cwl.output.json", "w") as f:
json.dump({"args": args}, f)
| apache-2.0 | Python | |
328a78e604e267ded569d71724534128d1dd32ff | Add in shell command | VikParuchuri/percept,VikParuchuri/percept | percept/workflows/commands/shell.py | percept/workflows/commands/shell.py | from percept.management.commands import BaseCommand
class Command(BaseCommand):
help = "Runs a Python interactive interpreter."
def command(self, **options):
from IPython.frontend.terminal.ipapp import TerminalIPythonApp
app = TerminalIPythonApp.instance()
app.initialize(argv=[])
... | apache-2.0 | Python | |
b06375552a27616ce2362148c565857c2bd2a546 | Create colored_labyrinth.py | Zprogrammer/pymove3D_comments | colored_labyrinth.py | colored_labyrinth.py | #! bpy
"""
Name: 'colored_labyrinth.py'
Blender: 269
Group: 'Materials'
Tooltip: 'Generates colorful objects by materials'
"""
import bpy
level_00 = ["###################",
"#. #",
"# $ #",
"# #",
"# #",
... | cc0-1.0 | Python | |
6aecccddd76013655a2c4df9ea80462e3511f473 | Remove references to new-run-webkit-tests | TheTypoMaster/chromium-crosswalk,anirudhSK/chromium,mohamed--abdel-maksoud/chromium.src,mogoweb/chromium-crosswalk,hgl888/chromium-crosswalk,mogoweb/chromium-crosswalk,hgl888/chromium-crosswalk-efl,littlstar/chromium.src,crosswalk-project/chromium-crosswalk-efl,ChromiumWebApps/chromium,crosswalk-project/chromium-crossw... | webkit/tools/layout_tests/run_webkit_tests.py | webkit/tools/layout_tests/run_webkit_tests.py | #!/usr/bin/env python
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Wrapper around
third_party/WebKit/Tools/Scripts/run-webkit-tests"""
import os
import subprocess
import sys
def main():
c... | #!/usr/bin/env python
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Wrapper around
third_party/WebKit/Tools/Scripts/new-run-webkit-tests"""
import os
import subprocess
import sys
def main():
... | bsd-3-clause | Python |
dd1645b9b4ba162ab6f51d9ff367ba732ce6003f | add missing _dt_generics file | machow/siuba | siuba/sql/dialects/_dt_generics.py | siuba/sql/dialects/_dt_generics.py | from siuba.siu import symbolic_dispatch
from siuba.sql.translate import SqlColumn, SqlColumnAgg
from sqlalchemy.sql import func as fn
from sqlalchemy import types as sa_types
from sqlalchemy import sql
@symbolic_dispatch(cls = SqlColumn)
def date_trunc(_, col, period):
return fn.date_trunc(period, col)
# TODO: M... | mit | Python | |
3996a3687a5a615bcc5240b30406da5ec9fed0db | Add file controller | samueldmq/infosystem | infosystem/subsystem/file/controller.py | infosystem/subsystem/file/controller.py | import flask
from infosystem.common import exception
from infosystem.common.subsystem import controller
# TODO(samueldmq): take a better look at this, it is completely different as it
# is not dealing with JSON content
class Controller(controller.Controller):
def create(self):
# TODO(samueldmq): the file... | apache-2.0 | Python | |
d9d80474cafa170257c4d25cf523dc3980c8b421 | define xml log class (CNY-2487) | fedora-conary/conary,fedora-conary/conary,fedora-conary/conary,fedora-conary/conary,fedora-conary/conary | conary/lib/xmllog.py | conary/lib/xmllog.py | #!/usr/bin/python
import logging
from conary.lib import logger
class XmlHandler(logging.StreamHandler):
"""Xml logging class compatible with python's built in logging structures.
This class defines an interface to logger.XmlWriter that's compatible
with python's logging module. Note that logger.XmlWrite... | apache-2.0 | Python | |
d6acbed86e46af40c75ef98a5e04dfb83ea22d31 | Add binary_search.py | dpazel/tryinggithub | binary_search.py | binary_search.py | from collections import OrderedDict
from fractions import Fraction
def find_lower1(alist, item):
first = 0;
last = len(alist) - 1
found = -1
if item >= alist[last]:
return last
if item < alist[first]:
return -1
while first <= last and found == -1:
midpoint = (first + ... | mit | Python | |
5f28097c1cb7b58f153d1268c93fdf0a34850a42 | Add basic logging | micbou/JediHTTP,vheon/JediHTTP,micbou/JediHTTP,vheon/JediHTTP | jedihttp/handlers.py | jedihttp/handlers.py | import bottle
from bottle import response, request
import json
import jedi
import logging
app = bottle.Bottle( __name__ )
logger = logging.getLogger( __name__ )
@app.get( '/healthy' )
def healthy():
return _Json({})
@app.get( '/ready' )
def ready():
return _Json({})
@app.post( '/completions' )
def completio... | import bottle
from bottle import response, request
import json
import jedi
app = bottle.Bottle( __name__ )
@app.get( '/healthy' )
def healthy():
return _Json({})
@app.get( '/ready' )
def ready():
return _Json({})
@app.post( '/completions' )
def completion():
script = _GetJediScript( request.json )
retur... | apache-2.0 | Python |
10b4099ea6df487427d9492e4986d7561468f9ae | add simple module resolution to Context class in craftr/main.py | creator-build/craftr | craftr/main.py | craftr/main.py |
import argparse
import os
import sys
from . import dsl
class Context(dsl.Context):
def __init__(self):
self.path = ['.', os.path.join(os.path.dirname(__file__), 'lib')]
self.options = {}
self.modules = {}
def get_option(self, module_name, option_name):
return self.options[module_name + '.' + o... |
import argparse
import os
import sys
from . import dsl
class Context(dsl.Context):
def __init__(self):
self.options = {}
def get_option(self, module_name, option_name):
return self.options[module_name + '.' + option_name]
def get_argument_parser():
parser = argparse.ArgumentParser(prog='craftr')
... | mit | Python |
c6bfd1aa88e9703805af8ad18f13485576b876f3 | Add change_password command. | hackerkid/zulip,eeshangarg/zulip,kou/zulip,rht/zulip,zulip/zulip,eeshangarg/zulip,kou/zulip,kou/zulip,hackerkid/zulip,punchagan/zulip,rht/zulip,kou/zulip,hackerkid/zulip,rht/zulip,hackerkid/zulip,andersk/zulip,hackerkid/zulip,kou/zulip,rht/zulip,zulip/zulip,punchagan/zulip,hackerkid/zulip,eeshangarg/zulip,rht/zulip,pun... | zerver/management/commands/change_password.py | zerver/management/commands/change_password.py | import getpass
from argparse import ArgumentParser
from typing import Any
from django.contrib.auth.password_validation import validate_password
from django.core.exceptions import ValidationError
from django.core.management.base import CommandError
from zerver.lib.management import ZulipBaseCommand
class Command(Zul... | apache-2.0 | Python | |
2081595503c006e7252e22b382d7a2dd1ded4996 | create temporal brainscore plots | emdupre/PFOCv2 | create_bs_plots.py | create_bs_plots.py | import os
import glob
import numpy as np
import h5py
import matplotlib.pyplot as plt
if __name__ == '__main__':
files = glob.glob('PFOC_3dQwarpYO_LV*bs_plot.mat')
for f in files:
fname = os.path.splitext(f)[0]
data_array = h5py.File(f,'r')
bsmean = np.array(data_array.get('bs_data_mean... | mit | Python | |
837693d7e0e19ce8df0be9526d080a427819a35b | Add mint mapping | reubano/csv2ofx,reubano/csv2ofx | csv2ofx/mappings/mintapi.py | csv2ofx/mappings/mintapi.py | # -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
# pylint: disable=invalid-name
"""
csv2ofx.mappings.mintapi
~~~~~~~~~~~~~~~~~~~~~~~~
Provides a mapping for transactions obtained via the mintapi python script
"""
from __future__ import absolute_import
from operator import itemgetter
mapping = {
'is_split': Fal... | mit | Python | |
226429d82de77637ad4d648e5e6bbe6487d4b11e | Add boostrap.py template | larry-dean/on-http,RackHD/on-http,RackHD/on-http,larry-dean/on-http,lanchongyizu/on-http,keedya/on-http,RackHD/on-http,keedya/on-http,keedya/on-http,keedya/on-http,lanchongyizu/on-http,larry-dean/on-http,lanchongyizu/on-http,lanchongyizu/on-http,larry-dean/on-http,RackHD/on-http | data/templates/bootstrap.py | data/templates/bootstrap.py | # Copyright 2016, EMC, Inc.
"""
Download and execute python scripts from the RackHD tasks api in a loop
"""
import urllib2
import json
from time import sleep
TASK_REQUEST_PERIOD = 5
TASKS_URI = 'http://<%=server%>:<%=port%>/api/common/tasks/<%=identifier%>'
json_content_type = {"Content-Type": "application/json"}
... | apache-2.0 | Python | |
26143b238d5036d19730660bb15e14a1ed3f0ff6 | add youtube | parrt/msan692,parrt/msan692,parrt/msan692 | notes/code/youtube/search.py | notes/code/youtube/search.py | # get API keys: https://support.google.com/cloud/answer/6158862
# getting started: https://developers.google.com/api-client-library/python/start/get_started
# I then enabled "YouTube Data API v3"
# API doc: https://developers.google.com/youtube/v3/
# Install library: pip install --upgrade google-api-python-client
impo... | mit | Python | |
736b1453087ebf3f813fcb499ba0fd5ccaad965d | Add oep user for wiki auth | openego/oeplatform,openego/oeplatform,tom-heimbrodt/oeplatform,openego/oeplatform,openego/oeplatform,tom-heimbrodt/oeplatform,tom-heimbrodt/oeplatform | login/migrations/0003_auto_20160805_1311.py | login/migrations/0003_auto_20160805_1311.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-08-05 11:11
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('login', '0002_auto_20160228_1805'),
]
operations = [
migrations.RenameModel(
... | agpl-3.0 | Python | |
732bd8ef641addfa5143bfcaae570361cd5165af | Migrate PasswordType to be in line with https://github.com/kvesteri/sqlalchemy-utils/pull/254 | frol/flask-restplus-server-example,millen1m/flask-restplus-server-example,millen1m/flask-restplus-server-example,millen1m/flask-restplus-server-example,frol/flask-restplus-server-example | migrations/versions/beb065460c24_fixed-password-type.py | migrations/versions/beb065460c24_fixed-password-type.py | """Upgraded to the correct PasswordType implementation
https://github.com/kvesteri/sqlalchemy-utils/pull/254
Revision ID: beb065460c24
Revises: 8c8b2d23a5
Create Date: 2016-11-09 09:10:40.630496
"""
# revision identifiers, used by Alembic.
revision = 'beb065460c24'
down_revision = '8c8b2d23a5'
from alembic import o... | mit | Python | |
33be4c17d04c91df9aec0d43ff7dcc39688421db | Create View.py | MariusWirtz/TM1py,OLAPLINE/TM1py | Tests/View.py | Tests/View.py | from TM1py import TM1Queries, NativeView, MDXView
import uuid
import unittest
class TestViewMethods(unittest.TestCase):
q = TM1Queries(ip='', port=8008, user='admin', password='apple', ssl=True)
random_string = str(uuid.uuid4())
def test1_create_view(self):
# create instance of native View
... | mit | Python | |
e5e7f8cbbc0eb95af55136c0c3b2ef85821ca86c | add the priors class | sbailey/redrock,sbailey/redrock | py/redrock/priors.py | py/redrock/priors.py | """
Classes and functions for priors.
"""
from astropy.io import fits
import os
class Priors():
"""Class to store all different redshift priors.
Args:
filename (str): the path to the redshift prior file
"""
def __init__(self, filename):
print('DEBUG: Using priors')
print('D... | bsd-3-clause | Python | |
adfac71e8e080aa74ea4ea66a17557ebac703354 | Create task_2_24.py | Mariaanisimova/pythonintask | IVTp/2014/SOBOLEV_M_V/task_2_24.py | IVTp/2014/SOBOLEV_M_V/task_2_24.py | print('Великое благо, что святые отцы оставили нам своим опытом испытанные советы. Чаще заглядывай в книги. \n\t\t\t Иоанн (Алексеев).')
| apache-2.0 | Python | |
254e8359cabdada005f5be67671c5a1489524131 | add a new file example_load_result.py | alphatwirl/alphatwirl,alphatwirl/alphatwirl,alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl,alphatwirl/alphatwirl,TaiSakuma/AlphaTwirl | AlphaTwirl/Concurrently/example_load_result.py | AlphaTwirl/Concurrently/example_load_result.py | #!/usr/bin/env python
# Tai Sakuma <sakuma@fnal.gov>
import os, sys
import argparse
import pickle
import tarfile
##__________________________________________________________________||
parser = argparse.ArgumentParser()
parser.add_argument('pickle', help = 'path to a pickle file')
args = parser.parse_args()
##_______... | bsd-3-clause | Python | |
395cc8f1dd349a960f294e417711bb3c3daea53f | Add manage.py to manage MySQL backend | benozol/codemapper,benozol/codemapper,benozol/codemapper,benozol/codemapper,benozol/codemapper | src/main/resources/manage.py | src/main/resources/manage.py | #!/usr/bin/env python2
from __future__ import print_function
import MySQLdb
from sql import *
import hashlib
import argparse
import sys
from itertools import groupby
db = MySQLdb.connect("mi-bios1","root","","code-mapper")
cur = db.cursor(MySQLdb.cursors.DictCursor)
def sha256(password):
return hashlib.sha256(pa... | agpl-3.0 | Python | |
b4d26a0beefbfb57c2a54f7baa8f1929935d62fc | update sidebar | UCBerkeleySETI/blimpy,UCBerkeleySETI/blimpy | docs/conf.py | docs/conf.py | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or module... | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or module... | bsd-3-clause | Python |
257cc81d23c74f211a5f8b0478178864345c725e | Add base client class | paluh/wrestler | wrestler/client.py | wrestler/client.py | import requests
import simplejson
import urllib
import urlparse
class ApiException(Exception):
pass
class Client(object):
def __init__(self, url_map, hostname, port, schema):
self.url_map = url_map
self.hostname = hostname
self.port = port
self.host = '%s:%s' % (self.hostna... | bsd-3-clause | Python | |
0e12c97e4001bfb6ffeefa7b7912f944a51950da | Add config file | tforrest/soda-automation,tforrest/soda-automation | app/config.py | app/config.py | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
import os
# set up basic app
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['FLASKDB']
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
| mit | Python | |
3351f4813758b4d3e39f2ce919fc5b10f9bad730 | add migration | hackupc/backend,hackupc/backend,hackupc/backend,hackupc/backend | register/migrations/0011_add_date_comment.py | register/migrations/0011_add_date_comment.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-08-07 18:11
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('register', '0010_application_comment'),
]
operations =... | mit | Python | |
fc22fb925261b13dfa593861e318472a9ca6c7a4 | Add functions for filtering / making test bams | jvivian/rnaseq-lib,jvivian/rnaseq-lib | src/rnaseq_lib/utils/bam.py | src/rnaseq_lib/utils/bam.py | import os
from subprocess import call
import logging
logging.basicConfig(level=logging.INFO)
def filter_aligned_reads(bam_path, output_name=None, paired=True):
"""
Filters bams for aligned reads
:param str bam_path: Path to bam file
:param str output_name: Defaults to input bam with '.filtered' inse... | mit | Python | |
adb2461a55f8fd852dd16d653fbd4f2f7bf10592 | Fix migration | Phoenix1369/site,Minkov/site,DMOJ/site,Phoenix1369/site,monouno/site,Minkov/site,DMOJ/site,Minkov/site,DMOJ/site,DMOJ/site,Minkov/site,monouno/site,Phoenix1369/site,monouno/site,monouno/site,Phoenix1369/site,monouno/site | judge/migrations/0055_add_performance_points.py | judge/migrations/0055_add_performance_points.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2016-12-22 18:30
from __future__ import unicode_literals
from operator import mul, itemgetter
from django.db import migrations, models
from django.conf import settings
from django.db.models import Max
def gen_pp(apps, schema_editor):
Profile = apps.get_mode... | # -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2016-12-22 18:30
from __future__ import unicode_literals
from operator import mul, itemgetter
from django.db import migrations, models
from django.conf import settings
from django.db.models import Max
def gen_pp(apps, schema_editor):
Profile = apps.get_mode... | agpl-3.0 | Python |
ec742a7572f94d8864444379ce91a4de32c45715 | Add functions to read in message data and parse targets. | chiubaka/actionizer | actionizer.py | actionizer.py | #! /usr/bin/python
import numpy as np
import os
from sklearn import datasets
MESSAGES_DIR = "data/messages/"
JUDGMENTS_PATH = "data/judgments/judgments.txt"
def load_messages():
messages = []
for filename in os.listdir(MESSAGES_DIR):
with open(MESSAGES_DIR + filename) as message_file:
mes... | mit | Python | |
e268b3efb998ac11d042c62edd497e00d35d2a7b | Create anti_vowel.py | akshaynagpal/python_snippets,akshaynagpal/python_web_crawler | anti_vowel.py | anti_vowel.py | def anti_vowel(text):
vowel_list = ['a','e','i','o','u','A','E','I','O','U']
x = ""
for i in text:
if(i not in vowel_list):
x += i
return x
| mit | Python | |
295a0e9225180f8435eae6c690433ad2cc2a9c4d | Create document fragment for enos modules (#31512) | thaim/ansible,thaim/ansible | lib/ansible/utils/module_docs_fragments/enos.py | lib/ansible/utils/module_docs_fragments/enos.py | # Copyright (C) 2017 Lenovo, Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansi... | mit | Python | |
564613521716161ca09ed127acfec984ca1ab48a | Add a start for an ABC for the API | ocefpaf/APIRUS,ioos/APIRUS | apirus_abc.py | apirus_abc.py | #!/usr/bin/env python
"""
The APIRUS API as an Abstract Base Class
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from abc import ABCMeta, abstractmethod
class APIRUS:
"""
ABC for the API for Regular,... | cc0-1.0 | Python | |
61ec740bdbaf665534abd7577a8c56ef3f9fae16 | Add prototype fading script | ayoy/ledctl | ledctl/fade.py | ledctl/fade.py | from time import sleep # Allows us to call the sleep function to slow down our loop
import helpers
import pigpio
from colorsys import rgb_to_hls, hls_to_rgb
pi = pigpio.pi()
oldinput = 0
r = pi.get_PWM_dutycycle(22)
g = pi.get_PWM_dutycycle(27)
b = pi.get_PWM_dutycycle(17)
print((r, g, b))
pi.set_PWM_dutyc... | mit | Python | |
ff48fad6e24bd239c2635a2305786cbafca89562 | support for email-attachments | qedsoftware/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq | dimagi/utils/django/email.py | dimagi/utils/django/email.py | from django.conf import settings
from django.core.mail import get_connection
from django.core.mail.message import EmailMultiAlternatives
NO_HTML_EMAIL_MESSAGE = """
Your email client is trying to display the plaintext version of an email that
is only supported in HTML. Please set your email client to display this mess... | from django.conf import settings
from django.core.mail import get_connection
from django.core.mail.message import EmailMultiAlternatives
NO_HTML_EMAIL_MESSAGE = """
Your email client is trying to display the plaintext version of an email that
is only supported in HTML. Please set your email client to display this mess... | bsd-3-clause | Python |
9237a9f2449d6f14390f8f5c5661d58444ba66b0 | add new package (#25008) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-python-xmp-toolkit/package.py | var/spack/repos/builtin/packages/py-python-xmp-toolkit/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 PyPythonXmpToolkit(PythonPackage):
"""Python XMP Toolkit for working with metadata."""
... | lgpl-2.1 | Python | |
1f947d6cfe05f32ffa6566714e5aeeb74543a932 | Fix loading root_target in migration | caseyrollins/osf.io,pattisdr/osf.io,HalcyonChimera/osf.io,erinspace/osf.io,mfraezz/osf.io,mfraezz/osf.io,felliott/osf.io,sloria/osf.io,aaxelb/osf.io,icereval/osf.io,felliott/osf.io,mattclark/osf.io,baylee-d/osf.io,Johnetordoff/osf.io,erinspace/osf.io,pattisdr/osf.io,sloria/osf.io,Johnetordoff/osf.io,mfraezz/osf.io,icer... | osf/migrations/0095_migration_comments.py | osf/migrations/0095_migration_comments.py | from __future__ import unicode_literals
import logging
from django.db import migrations
from django_bulk_update.helper import bulk_update
logger = logging.getLogger(__file__)
def update_comment_root_target(state, *args, **kwargs):
Comment = state.get_model('osf', 'comment')
comments = Comment.objects.exclud... | from __future__ import unicode_literals
from django.db import migrations
import logging
logger = logging.getLogger(__file__)
def update_comment_root_target(state, *args, **kwargs):
Comment = state.get_model('osf', 'comment')
comments = Comment.objects.filter(is_deleted=False)
count = 0
for comment i... | apache-2.0 | Python |
d7acb573acc5996ba67339c6a023eb7ce1d405a0 | Create format_function.py | joshavenue/python_notebook | format_function.py | format_function.py | // to add a value/string within a variable, use {} and .format(x) //
foo = '{} bar'
x = 10 // any value //
print(foo.format(x))
the result will be '10 bar'
| unlicense | Python | |
f3605ff16541126bfca96a7b1ef45bd1ade4f9fd | include an example plotting the 3D cyl mesh | simpeg/discretize,simpeg/discretize,simpeg/discretize | plot_3D_cyl.py | plot_3D_cyl.py | """
Cyl: Plot Grid
================
You can use :code:`mesh.plotGrid()` to plot a z and theta slice through a
3D cyl mesh.
If you wish to plot only one slice, you can use
:code:`mesh.plotGrid(slice='z')` or :code:`mesh.plotGrid(slice='theta')
"""
import discretize
import matplotlib.pyplot as plt
def run(plotIt=Tru... | mit | Python | |
bdf40e28126e9e18ac9ea069659686e37e70f34d | Add test case to cover multiple future statements on separate lines of a module. | sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator | Lib/test/test_future3.py | Lib/test/test_future3.py | from __future__ import nested_scopes
from __future__ import division
from __future__ import nested_scopes
def f(x):
def g(y):
return y // x
return g
print f(2)(5)
| mit | Python | |
cc53f5b03b08fbace30a486d305983379d57e9cb | disable all active sessions | looker/sdk-examples,looker/sdk-examples,looker-open-source/sdk-examples,looker-open-source/sdk-examples,looker-open-source/sdk-examples,looker/sdk-examples,looker-open-source/sdk-examples,looker-open-source/sdk-examples,looker-open-source/sdk-examples,looker/sdk-examples,looker/sdk-examples,looker/sdk-examples | python/logout_all_users.py | python/logout_all_users.py | from typing import cast, MutableSequence, Optional, Sequence
from looker_sdk import client, methods, models
def main():
api_client = client.setup("looker.ini")
users = get_all_users(api_client)
terminations_count = 0
for user in users:
if user.sessions:
terminate_sessions(api_cl... | mit | Python | |
b36a2c78ce3eb0338ef7f83832104348a74e6e48 | Create reformat_mags_v2.py | DESatAPSU/DAWDs,DESatAPSU/DAWDs | python/reformat_mags_v2.py | python/reformat_mags_v2.py | #!/usr/bin/env python
# This script takes the calcphot results (fits files) from the WD models and organizes the data in a CSV file.
# Run this from the directory containing the .fits files of interest.
#!/usr/bin/env python
import numpy as np
import pandas as pd
import pyfits
import glob
import os
import glob
... | mit | Python | |
bce70ccd20bbefc3ef057cfb771b52c1878f0cb4 | Add gym experimeny experimentally (now work well) | ugo-nama-kun/nonpara_discrete_rl | example/model_based_gym.py | example/model_based_gym.py | # -*- coding: utf-8 -*-
from nprl import ModelBased
import gym
import numpy as np
import math
import matplotlib.pylab as plt
# Create Environment
env = gym.make('CartPole-v0')
# observation_encoder
n_tick = np.array([1, 1, 6, 3], dtype=np.float32)
tick = env.observation_space.high - env.observation_space.low
tick[1... | mit | Python | |
00fc071687661a0f27e61cef74a3d6af0dadf38b | Add initial code for starting Tor | neelchauhan/OnionLauncher | OnionLauncher/torctl.py | OnionLauncher/torctl.py | import stem.process
def startTor(config):
process = stem.process.launch_tor_with_config(config, take_ownership = True)
return process
def stopTor(process):
if "kil" in dir(process):
process.kill()
| bsd-2-clause | Python | |
9b18a3b78ad46cc3b54b35dad4fe3cb909667e4a | fix some settings | yanadsl/ML-Autocar | test.py | test.py | import sys
import pigpio
import time
from colorama import Fore, Back, Style
def set_speed(lspeed, rspeed):
pi.hardware_PWM(left_servo_pin, 800, int(lspeed)*10000)
pi.hardware_PWM(right_servo_pin, 800, int(rspeed)*10000)
pi = pigpio.pi()
left_servo_pin = 13
right_servo_pin = 12
dead_pin = 17
rs = 100
ts = 10... | mit | Python | |
4c85aa8270347682fde486eb2071bc5535f97e75 | add digits | feigaochn/leetcode | add_digits.py | add_digits.py | # coding: utf-8
# author: Fei Gao <leetcode.com@feigao.xyz>
# Problem: add digits
#
# Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.
#
# For example:
#
# Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it.
#
# Fol... | mit | Python | |
9abb264c3132549ca640c1123e0b3940fcd66c90 | fix already created pages using Drzewianin suggestions | magul/magulbot | projects/spain/municipio/fixesdrzewianin.py | projects/spain/municipio/fixesdrzewianin.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# apply fixes pioted out by Drzewianin
#
# system imports
from wikipedia import *
import catlib
import sqlite3 as lite
# bot imports
from fixies import *
# configure plwiki
pllang = 'pl'
plfamily = 'wikipedia'
plwiki = getSite(pllang, plfamily)
# get data from sqlite
con... | mit | Python | |
e3b0cf77362fa140160d02c793abc56558f33054 | add problem 26 | smrmkt/project_euler | problem_026.py | problem_026.py | #!/usr/bin/env python
#-*-coding:utf-8-*-
'''
A unit fraction contains 1 in the numerator.
The decimal representation of the unit fractions with denominators 2 to 10 are given:
1/2 = 0.5
1/3 = 0.(3)
1/4 = 0.25
1/5 = 0.2
1/6 = 0.1(6)
1/7 = 0.(142857)
1/8 = 0.125
1/9 = 0.(1)
1/10 = 0.1
Where 0.1(6) means 0.16... | mit | Python | |
0755d77b8583a791e452cbef906c8de0d60a06a6 | Create league_analysis.py | Statistica/Fantasy-Football-Draft-Position | league_analysis.py | league_analysis.py | # Written by Jonathan Saewitz, released August 17th, 2016 for Statisti.ca
# Released under the MIT License (https://opensource.org/licenses/MIT)
import csv, plotly.plotly as plotly, plotly.graph_objs as go
from collections import Counter
LEAGUE_SIZE_TO_ANALYZE=10 #the size of the league (number of teams) to analyze (... | mit | Python | |
85736989c7f3049d9d6c107e9dac385a751d0ba4 | Change folder structure. Add Python folder | ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs... | image_processing/steganography/python/steganography.py | image_processing/steganography/python/steganography.py | from __future__ import print_function
from PIL import Image
def encode(image, string_to_encode):
image_data = list(image.getdata())
bin_string = "".join(["{0:08b}".format(ord(c)) for c in string_to_encode])
print("Initial pixel values: ")
print(image_data[:25], end=" ")
print(",....")
j = 0
... | cc0-1.0 | Python | |
4e145506e11420394e19bcd8dc28b8287c26d49a | Create quick_sort.py | WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,WebClub-NITK/Hacktoberfest-2k17,... | Quick_Sort/quick_sort.py | Quick_Sort/quick_sort.py | from random import randrange
def partition(lst, start, end, pivot):
lst[pivot], lst[end] = lst[end], lst[pivot]
store_index = start
for i in xrange(start, end):
if lst[i] < lst[end]:
lst[i], lst[store_index] = lst[store_index], lst[i]
store_index += 1
lst[store_index], ... | mit | Python | |
de09b74afa0c0560d8674db4a796419370a96a04 | Add empty analyzer file | PsyBorgs/redditanalyser,PsyBorgs/redditanalyser | redditanalysis/analyzer.py | redditanalysis/analyzer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
| mit | Python | |
e81f63798b84d26a29db79603efb0458ac25d374 | Add auto-link between User and Account models in migration | Atilla106/members.atilla.org,Atilla106/members.atilla.org,Atilla106/members.atilla.org,Atilla106/members.atilla.org,Atilla106/members.atilla.org | accounts/migrations/0006_auto_20170325_1024.py | accounts/migrations/0006_auto_20170325_1024.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-25 10:24
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.db import migrations
from accounts.models import Account
def link_user_accounts(apps, schema_editor):
'''
Link every Django user objects to... | mit | Python | |
cdf80ee7a41a7f18506f51579f34ca3c89617e9b | Create markdown_with_frontmatter.py | rchrd2/markdown_with_frontmatter | markdown_with_frontmatter.py | markdown_with_frontmatter.py | """
Helper for YAML frontmatter in Markdown files
@author Richard Caceres, @rchrd2
"""
import markdown
import yaml
import re
# Setup Markdown
md = markdown.Markdown(extensions=['meta', 'sane_lists', 'smarty'])
frontmatter_regex = re.compile(r'^\s*---(.*)---\s*(.*)$', re.DOTALL|re.MULTILINE)
def get_html_and_meta(m... | apache-2.0 | Python | |
d8e370117008e017848ae68c0240518cc80f8c7b | add reprrequests | minrk/ipython_extensions,minrk/ipython_extensions,minrk/ipython_extensions | extensions/reprrequests.py | extensions/reprrequests.py | def repr_request(r, p, cycle):
p.text('{} {}\n'.format(r.status_code, r.url))
p.text('headers: ')
for name in sorted(r.headers):
p.text(' {}: {}\n'.format(name, r.headers[name]))
p.text('\nbody ({}):\n'.format(r.headers.get('content-type', 'unknown')))
try:
p.pretty(r.json())
ex... | bsd-3-clause | Python | |
3c49ca199fe41f0ca434b0fdc00ab76e7b134289 | Fix error message when expanding data asset | selahssea/ggrc-core,NejcZupec/ggrc-core,edofic/ggrc-core,j0gurt/ggrc-core,kr41/ggrc-core,kr41/ggrc-core,AleksNeStu/ggrc-core,plamut/ggrc-core,andrei-karalionak/ggrc-core,edofic/ggrc-core,josthkko/ggrc-core,AleksNeStu/ggrc-core,selahssea/ggrc-core,selahssea/ggrc-core,VinnieJohns/ggrc-core,andrei-karalionak/ggrc-core,and... | src/ggrc/migrations/versions/20160510122526_44ebc240800b_remove_response_relationships.py | src/ggrc/migrations/versions/20160510122526_44ebc240800b_remove_response_relationships.py | # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: peter@reciprocitylabs.com
"""
Remove relationships related to deleted response objects
Create Date: 2016-... | apache-2.0 | Python | |
c844f5382fe2c1fbe4011b461f18b051f1b808ba | Add script to generate flow models | github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql | java/ql/src/utils/model-generator/GenerateFlowModel.py | java/ql/src/utils/model-generator/GenerateFlowModel.py | #!/usr/bin/python3
import errno
import json
import os
import os.path
import re
import shlex
import shutil
import subprocess
import sys
import tempfile
def printHelp():
print("""Usage:
GenerateFlowModel.py <library-database> "simpleName"
This generates summary, source and sink models for the code in the database... | mit | Python | |
929c90460f341c17adfc1c45b371d5e15c5556d4 | Add the rohrpost registry | axsemantics/rohrpost,axsemantics/rohrpost | rohrpost/registry.py | rohrpost/registry.py | HANDLERS = dict()
def _rohrpost_handler(func, name):
def ret_func(*args, **kwargs):
return func(*args, **kwargs)
def update_registry(key, value):
if key in HANDLERS:
raise Exception('Handler for "{}" is already defined.'.format(key))
HANDLERS[key] = value
name = name ... | mit | Python | |
02ebf4fa82cd4daa7cc26046c81df4a1a1366596 | Add a Contrib package. | davidmiller/ffs,davidmiller/ffs | ffs/contrib/__init__.py | ffs/contrib/__init__.py | """
ffs.contrib
Make it a package.
"""
| apache-2.0 | Python | |
e7aa94722c3657fb4b0dfacb4c1e432438e4670a | Add very basic move plugin test | crawln45/Flexget,ianstalk/Flexget,ianstalk/Flexget,crawln45/Flexget,Flexget/Flexget,malkavi/Flexget,Flexget/Flexget,malkavi/Flexget,ianstalk/Flexget,crawln45/Flexget,malkavi/Flexget,Flexget/Flexget,malkavi/Flexget,crawln45/Flexget,Flexget/Flexget | flexget/tests/test_move.py | flexget/tests/test_move.py | import pytest
@pytest.mark.usefixtures('tmpdir')
class TestMove:
config = """
tasks:
test_move:
mock:
- title: a movie
location: __tmp__/movie.mkv
accept_all: yes
move:
# Take advantage that path validation allows non-ex... | mit | Python | |
1ed69df084e3857977a1fd18b0f1a0e8a56b5df3 | add User object | lbsb/wybo-working-hours-tracker,lbsb/wybo-working-hours-tracker,lbsb/wybo-working-hours-tracker | user.py | user.py | class User(object):
_id = None
_first_name = None
_last_name = None
_email = None
def __init__(self, id = "", first_name = "", last_name = "", email = ""):
self._id = id
self._first_name = first_name
self._last_name = last_name
self._email = email
| mit | Python | |
f7f8d7c6a92aa5d2d491674df14df46768f8b037 | Add helper tool to help with examining entries in a feed. | freiheit/discord_feedbot,freiheit/discord_rss_bot,freiheit/discord_feedbot,freiheit/discord_rss_bot | show_sample_entry.py | show_sample_entry.py | #!/usr/bin/python3
# Copyright (c) 2016 Eric Eisenhart
# This software is released under an MIT-style license.
# See LICENSE.md for full details.
import sys
import pprint
import feedparser
import argparse
feedparser.PREFERRED_XML_PARSERS.remove('drv_libxml2')
# 0 is command itself:
if len(sys.argv) == 2:
feed_url =... | mit | Python | |
f059fcbf68905f1325b6c9d99b20f64826d6a257 | Create w3_1.py | s40523206/2016fallcp_hw,s40523206/2016fallcp_hw,s40523206/2016fallcp_hw | w3_1.py | w3_1.py | print("test")
| agpl-3.0 | Python | |
d19e3e7de159026993d81ae68320ea1e2956f9ad | Create w3_1.py | s40523208/2016fallcp_hw,s40523208/2016fallcp_hw,s40523208/2016fallcp_hw | w3_1.py | w3_1.py | agpl-3.0 | Python | ||
7004700167a8550450fee200bdb9c773ad600861 | add solution for trapping rain water problems in python | ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovski/al-go-rithms,ZoranPandovs... | puzzles/trapping_rain_water_problem/trapping_rain_water.py | puzzles/trapping_rain_water_problem/trapping_rain_water.py | def get_water(arr: list[int]) -> int:
size = len(arr)
res: int = 0
lmax: list[int] = arr[:]
rmax: list[int] = arr[:]
for i in range(1, size, 1):
lmax[i] = max(arr[i], lmax[i-1])
for i in range(size-2, -1, -1):
rmax[i] = max(arr[i], rmax[i+1])
for i in range(size):
... | cc0-1.0 | Python | |
eb601c05792ded667e398903c714dd414aac153b | add stoke | stefanheule/putil | putil/stoke.py | putil/stoke.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Code to interact with STOKE (http://stoke.stanford.edu)
#
# Author: Stefan Heule <stefanheule@gmail.com>
#
# ------------------------------------------------------------------------------
... | apache-2.0 | Python | |
ed0fbd262fd45b26cde3b84f754e3f815407498d | Add one example. [ci skip] | GillesArcas/cws,GillesArcas/numsed | examples/ProjectEuler024.py | examples/ProjectEuler024.py | # Project Euler #24: Lexicographic permutations
# https://www.quora.com/How-would-you-explain-an-algorithm-that-generates-permutations-using-lexicographic-ordering
# https://www.geeksforgeeks.org/lexicographic-permutations-of-string/
def reverse(n, i):
# Reverse digits in n from index i to index 0 (least signif... | mit | Python | |
31e1b7837f101ead043b1d85eaa281d32c00c13b | Add migration which no longer allows blank user representation fields | Dreamsolution/django-auth-policy,mcella/django-auth-policy,Dreamsolution/django-auth-policy,mcella/django-auth-policy | django_auth_policy/migrations/0003_auto_20150410_0408.py | django_auth_policy/migrations/0003_auto_20150410_0408.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('django_auth_policy', '0002_users_nullable'),
]
operations = [
migrations.AlterField(
model_name='passwordchange'... | bsd-3-clause | Python | |
15013cde32597c6414ba731461d881080083bf24 | Add OpenStack Server facts module | thaim/ansible,thaim/ansible | lib/ansible/modules/cloud/openstack/os_server_facts.py | lib/ansible/modules/cloud/openstack/os_server_facts.py | #!/usr/bin/python
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# This module is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any late... | mit | Python | |
c11b0f905ad844ef95bd779d3277318e357fdef0 | Add management command for forking Oscar's statics | jlmadurga/django-oscar,spartonia/django-oscar,WadeYuChen/django-oscar,makielab/django-oscar,josesanch/django-oscar,taedori81/django-oscar,faratro/django-oscar,vovanbo/django-oscar,DrOctogon/unwash_ecom,anentropic/django-oscar,mexeniz/django-oscar,kapt/django-oscar,WillisXChen/django-oscar,jinnykoo/wuyisj.com,sasha0/dja... | oscar/management/commands/oscar_fork_statics.py | oscar/management/commands/oscar_fork_statics.py | import logging
import os
import shutil
from django.db.models import get_model
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
ProductAlert = get_model('customer', 'ProductAlert')
logger = logging.getLogger(__name__)
class Command(BaseCommand):
"""
Copy Osc... | bsd-3-clause | Python | |
16242222d2bb7be2335b809922a97854af58834c | add python class for composite potential | adrn/gala,adrn/gary,adrn/gary,adrn/gala,adrn/gala,adrn/gary | streamteam/potential/pal5.py | streamteam/potential/pal5.py | # coding: utf-8
""" Potential used for Pal 5 Challenge at the Gaia Challenge 2 """
from __future__ import division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Third-party
from astropy.constants import G
import numpy as np
# Project
# from .core import CartesianCompositePotential
from .cpotentia... | mit | Python | |
766910009b105fd6b95a78247368ade6f412bccc | Create task_handler source file | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | apps/domain/src/main/core/task_handler.py | apps/domain/src/main/core/task_handler.py | from .codes import RESPONSE_MSG
from json.decoder import JSONDecodeError
from .exceptions import (
PyGridError,
UserNotFoundError,
RoleNotFoundError,
GroupNotFoundError,
AuthorizationError,
MissingRequestKeyError,
InvalidCredentialsError,
)
def task_handler(route_function, data, mandatory... | apache-2.0 | Python | |
9c141d7aab8dcf08dfeccb550c9e13ad19917c05 | Add new template tag: generate_modified_query_string | pculture/mirocommunity,pculture/mirocommunity,pculture/mirocommunity,pculture/mirocommunity | localtv/templatetags/generate_modified_query_string.py | localtv/templatetags/generate_modified_query_string.py | # Copyright 2009 - Participatory Culture Foundation
#
# This file is part of Miro Community.
#
# Miro Community 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 ... | agpl-3.0 | Python | |
90ed0914b4bb0d9c5ad0cfac34f5ca5dda225332 | Create JAVAC.py | chashmeetsingh/SPOJ-SOLUTIONS,chashmeetsingh/SPOJ-SOLUTIONS | JAVAC.py | JAVAC.py | def jtoc(st):
if st[0].isupper():
return 'Error!'
ans = ''
for i in st:
if i.isupper():
ans += '_'+i.lower()
else:
ans += i
return ans
def ctoj(st):
tmpLst = st.split('_')
ans = tmpLst[0]
for i in ans:
if i.isupper():
retu... | mit | Python | |
fa9b8b6bdd5ae950aa2b8eaae557171ce0d4e2f9 | complete server | SteveMacenski/Command-Texting-QuadCopter,SteveMacenski/Command-Texting-QuadCopter,SteveMacenski/Command-Texting-QuadCopter,SteveMacenski/Command-Texting-QuadCopter | quad_server.py | quad_server.py | from flask import Flask, request, redirect
from flask import *
import twilio.twiml
import serial
import string
from time import sleep as sleep
from threading import Thread
import json
import os
app = Flask(__name__)
#@app.route("/", methods=['GET', 'POST'])
#def hello_monkey():
... | mit | Python | |
ba6e69415bb6f8222f7fbffadff8d2a77c761938 | Add grains_list state module | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | salt/states/grains_list.py | salt/states/grains_list.py | # -*- coding: utf-8 -*-
'''
Manage list type grains on the minion
=======================================
This state allows for list type grains to be set.
Grains set or altered this way are stored in the 'grains'
file on the minions, by default at: /etc/salt/grains
Note: This does NOT override any grains set in the... | apache-2.0 | Python | |
a4eb88bcd351c65aee85a2586b1c2eeb52dcd0e4 | Add tests for Terminal when grammar is different so terminals should not be equal | PatrikValkovic/grammpy | tests/terminal_tests/DifferentGrammarsTest.py | tests/terminal_tests/DifferentGrammarsTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
"""
from unittest import TestCase
from grammpy import Terminal
class TempClass:
pass
class TerminalCreationTest(TestCase):
def test_noneClass(self):
ter1 = Terminal(0, None)
ter2 = Ter... | mit | Python | |
101cdcaf3fff6c10e5c519f1ed409feefeff313a | Add first test for committee question uploads | Code4SA/pmg-cms-2,Code4SA/pmg-cms-2,Code4SA/pmg-cms-2 | tests/views/test_admin_committee_questions.py | tests/views/test_admin_committee_questions.py | import os
from builtins import str
from tests import PMGLiveServerTestCase
from pmg.models import db, Committee
from tests.fixtures import dbfixture, UserData, CommitteeData, MembershipData
from werkzeug.datastructures import FileStorage
from io import BytesIO
class TestAdminCommitteeQuestions(PMGLiveServerTestCase):... | apache-2.0 | Python | |
c330f37b4632a817744774c5b47d14f8dd3a9ec5 | Create nmap_doc_generator.py | funkandwagnalls/xml-parsers | nmap_doc_generator.py | nmap_doc_generator.py | #!/usr/bin/env python
# Author: Chris Duffy
# Date: May 2015
# Name: nmap_doc_generator.py
# Purpose: A script that takes data from parsed nmap XML files and writes it into XLSX files
try:
import docx
from docx.shared import Inches
except:
sys.exit("[!] Install the docx writer library as root or through sud... | bsd-3-clause | Python | |
afa9da56c737dc15cb9730d746f8eeee6d26a9bc | Add MS interflow collector bot | aaronkaplan/intelmq,aaronkaplan/intelmq,aaronkaplan/intelmq,certtools/intelmq,certtools/intelmq,certtools/intelmq | intelmq/bots/collectors/microsoft/collector_interflow.py | intelmq/bots/collectors/microsoft/collector_interflow.py | # -*- coding: utf-8 -*-
"""
https://interflow.portal.azure-api.net/
Example:
[{
"indicatorthreattype": "Botnet",
"description": "B106-Dynamer",
"indicatorexpirationdatetime": "2017-04- 05T20:21:09.0000000Z",
"tlplevel": "Green",
"severity": 60,
"firstreporteddatetime": 131356377289905913,
"version": 1.5,
"tags": [“cc... | agpl-3.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.