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 |
|---|---|---|---|---|---|---|---|---|
64b14b64c00bc6885acc1ff4d9b76898f66a8a86 | add new package (#15737) | iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack | var/spack/repos/builtin/packages/opendx/package.py | var/spack/repos/builtin/packages/opendx/package.py | # Copyright 2013-2020 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)
class Opendx(AutotoolsPackage):
"""Open Visualization Data Explorer."""
homepage = "https://github.com/Mwoolsey/... | lgpl-2.1 | Python | |
7c56318cb545011e64e3a491058054ad3d7cd9c0 | Create new package. (#5987) | tmerrick1/spack,iulian787/spack,mfherbst/spack,iulian787/spack,EmreAtes/spack,LLNL/spack,skosukhin/spack,matthiasdiener/spack,krafczyk/spack,mfherbst/spack,iulian787/spack,skosukhin/spack,tmerrick1/spack,lgarren/spack,krafczyk/spack,lgarren/spack,mfherbst/spack,tmerrick1/spack,LLNL/spack,LLNL/spack,matthiasdiener/spack... | var/spack/repos/builtin/packages/r-aims/package.py | var/spack/repos/builtin/packages/r-aims/package.py | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 | Python | |
eb429be1fdc7335bec5ba036fcece309778b23f0 | Add an example that uses filterReactions AND pdep at the same time | pierrelb/RMG-Py,nyee/RMG-Py,nickvandewiele/RMG-Py,nyee/RMG-Py,chatelak/RMG-Py,chatelak/RMG-Py,pierrelb/RMG-Py,nickvandewiele/RMG-Py | examples/rmg/heptane-filterReactions/input.py | examples/rmg/heptane-filterReactions/input.py | # Data sources
database(
thermoLibraries = ['primaryThermoLibrary'],
reactionLibraries = [],
seedMechanisms = [],
kineticsDepositories = ['training'],
kineticsFamilies = 'default',
kineticsEstimator = 'rate rules',
)
# Constraints on generated species
generatedSpeciesConstraints(
maximumCa... | mit | Python | |
e5a14054e1e9e95b04baf5ec7c92a2fdde51703b | Update __openerp__.py | ingadhoc/odoo-personalizations,adhoc-dev/odoo-personalizations | scanterra_modifcations/__openerp__.py | scanterra_modifcations/__openerp__.py | # -*- coding: utf-8 -*-
{
'name': 'Scanterra Modifications',
'version': '8.0.1.1.0',
'category': 'Sales Management',
'sequence': 14,
'summary': 'Sales, Product, Category, Clasification',
'description': """
Scanterra Modifications
=======================
* Restringir que las tareas creadas por un... | # -*- coding: utf-8 -*-
{
'name': 'Scanterra Modifications',
'version': '8.0.1.0.0',
'category': 'Sales Management',
'sequence': 14,
'summary': 'Sales, Product, Category, Clasification',
'description': """
Scanterra Modifications
=======================
* Restringir que las tareas creadas por un... | agpl-3.0 | Python |
559ba309a72d277c3b5a78614889d19b8866b7ea | add parallel by Alexandre Gramford (mne-python) | bert9bert/statsmodels,kiyoto/statsmodels,astocko/statsmodels,bert9bert/statsmodels,rgommers/statsmodels,statsmodels/statsmodels,astocko/statsmodels,jstoxrocky/statsmodels,Averroes/statsmodels,YihaoLu/statsmodels,adammenges/statsmodels,detrout/debian-statsmodels,wkfwkf/statsmodels,wdurhamh/statsmodels,detrout/debian-sta... | scikits/statsmodels/tools/parallel.py | scikits/statsmodels/tools/parallel.py | """Parralle util function
"""
# Author: Alexandre Gramfort <gramfort@nmr.mgh.harvard.edu>
#
# License: Simplified BSD
def parallel_func(func, n_jobs, verbose=5):
"""Return parallel instance with delayed function
Util function to use joblib only if available
Parameters
----------
func: callable
... | bsd-3-clause | Python | |
2c6be657e0024a1a2e162a6a508d2d5716736121 | add wrapper class for adiabatic approximation | jobovy/galpy,followthesheep/galpy,followthesheep/galpy,followthesheep/galpy,jobovy/galpy,jobovy/galpy,jobovy/galpy,followthesheep/galpy | galpy/actionAngle_src/actionAngleAdiabatic.py | galpy/actionAngle_src/actionAngleAdiabatic.py | ###############################################################################
# actionAngle: a Python module to calculate actions, angles, and frequencies
#
# class: actionAngleAdiabatic
#
# wrapper around actionAngleAxi (adiabatic approximation) to do
# this for any (x,v)
#
# met... | bsd-3-clause | Python | |
3a240005142da25aa49938a15d39ddf68dd7cead | Add functional test to verify presence of policy | mahak/nova,rahulunair/nova,klmitch/nova,openstack/nova,mikalstill/nova,rahulunair/nova,gooddata/openstack-nova,mikalstill/nova,gooddata/openstack-nova,rahulunair/nova,klmitch/nova,mikalstill/nova,klmitch/nova,mahak/nova,openstack/nova,klmitch/nova,openstack/nova,mahak/nova,gooddata/openstack-nova,gooddata/openstack-nov... | nova/tests/functional/api/openstack/placement/test_verify_policy.py | nova/tests/functional/api/openstack/placement/test_verify_policy.py | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | apache-2.0 | Python | |
b416de22866f6ebc05fcb256d5ab97f391481ddc | Create CSVStreamReader.py | chriswebb/CSVStreamReader,chriswebb/CSVStreamReader | CSVStreamReader.py | CSVStreamReader.py |
# The MIT License (MIT)
# Copyright (c) 2016 Chris Webb
# 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, m... | mit | Python | |
da09de30b376f1ab9e687e8064423499b4cf8d50 | Add missing file | michaelaye/vispy,michaelaye/vispy,ghisvail/vispy,dchilds7/Deysha-Star-Formation,sbtlaarzc/vispy,QuLogic/vispy,inclement/vispy,Eric89GXL/vispy,jdreaver/vispy,sh4wn/vispy,bollu/vispy,sh4wn/vispy,sbtlaarzc/vispy,jay3sh/vispy,jdreaver/vispy,srinathv/vispy,srinathv/vispy,RebeccaWPerry/vispy,kkuunnddaannkk/vispy,dchilds7/Dey... | vispy/util/context.py | vispy/util/context.py | # -*- coding: utf-8 -*-
# Copyright (c) 2014, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
Functionality to deal with GL Contexts in vispy. This module is not in
app, because we want to make it possible to use parts of vispy without
relying on app.
The GLContex... | bsd-3-clause | Python | |
7c623e1368f92155edafdbf822b8c1512aebbfaa | Create conf.py | JohnGriffiths/ConWhAt,JohnGriffiths/ConWhAt | docs/conf.py | docs/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Use sphinx-quickstart to create your own conf.py file!
# After that, you have to edit a few things. See below.
# Select nbsphinx and, if needed, add a math extension (mathjax or pngmath):
extensions = [
'nbsphinx',
'sphinx.ext.mathjax',
'jupyter_alabaster_... | bsd-3-clause | Python | |
783e7f644e2fc659d432d447bbbe6a01f2ac74c1 | Fix #390 #450 | kappataumu/cookiecutter-django,ingenioustechie/cookiecutter-django-openshift,calculuscowboy/cookiecutter-django,drxos/cookiecutter-django-dokku,bopo/cookiecutter-django,drxos/cookiecutter-django-dokku,ingenioustechie/cookiecutter-django-openshift,drxos/cookiecutter-django-dokku,hairychris/cookiecutter-django,ddiazpinto... | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py | {{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/admin.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django import forms
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as AuthUserAdmin
from django.contrib.auth.forms import UserChangeForm, UserCreationForm
from .models import User
class MyUserChang... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django import forms
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as AuthUserAdmin
from django.contrib.auth.forms import UserChangeForm, UserCreationForm
from .models import User
class MyUserChan... | bsd-3-clause | Python |
207f8ffaffa1eb6c7ed8a5f4c884f91ec3e971f3 | Format : Add compatibility conversion for old serialised Formats with (0,0) min values. | boberfly/gaffer,GafferHQ/gaffer,chippey/gaffer,andrewkaufman/gaffer,johnhaddon/gaffer,lucienfostier/gaffer,chippey/gaffer,appleseedhq/gaffer,johnhaddon/gaffer,lucienfostier/gaffer,hradec/gaffer,andrewkaufman/gaffer,ImageEngine/gaffer,johnhaddon/gaffer,GafferHQ/gaffer,johnhaddon/gaffer,chippey/gaffer,GafferHQ/gaffer,luc... | startup/GafferImage/formatCompatibility.py | startup/GafferImage/formatCompatibility.py | ##########################################################################
#
# Copyright (c) 2015, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | bsd-3-clause | Python | |
9d51e2ef626ce61dd3ae563681477b12a2352881 | Add test_sprint | mslw/sprinttesting,mslw/sprinttesting | test_sprint.py | test_sprint.py | def inc(val):
return val - 1
def test_inc():
assert inc(5) == 6
| mit | Python | |
8f6db5945348879a7340f8a4c7da6111a06cd062 | Add new module to statically host an arbitrary directory | Purg/SMQTK,Purg/SMQTK,Purg/SMQTK,kfieldho/SMQTK,kfieldho/SMQTK,kfieldho/SMQTK,Purg/SMQTK,Purg/SMQTK,kfieldho/SMQTK,kfieldho/SMQTK,Purg/SMQTK,Purg/SMQTK,Purg/SMQTK,Purg/SMQTK,kfieldho/SMQTK,kfieldho/SMQTK,kfieldho/SMQTK,kfieldho/SMQTK | python/smqtk/web/search_app/modules/static_host.py | python/smqtk/web/search_app/modules/static_host.py | import flask
__author__ = 'paul.tunison@kitware.com'
class StaticDirectoryHost (flask.Blueprint):
"""
Module that will host a given directory to the given URL prefix (relative to
the parent module's prefix).
Instances of this class will have nothing set to their static URL path, as a
blank stri... | bsd-3-clause | Python | |
fdb8f36fd4eed11d5d757d8477b3c2b8619aae8a | Add management command to populate last_modified fields | qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,SEL-Columbia/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,puttara... | corehq/apps/commtrack/management/commands/product_program_last_modified.py | corehq/apps/commtrack/management/commands/product_program_last_modified.py | from django.core.management.base import BaseCommand
from corehq.apps.commtrack.models import Product, Program
from dimagi.utils.couch.database import iter_docs
from datetime import datetime
import json
class Command(BaseCommand):
help = 'Populate last_modified field for products and programs'
def handle(self,... | bsd-3-clause | Python | |
cf6d2e732ab4b7131312323632761561f2aa3a86 | add field user_email to DynamicSaveInputs | zrisher/webapp-public,OpenSourcePolicyCenter/webapp-public,OpenSourcePolicyCenter/PolicyBrain,OpenSourcePolicyCenter/webapp-public,zrisher/webapp-public,OpenSourcePolicyCenter/webapp-public,OpenSourcePolicyCenter/PolicyBrain,zrisher/webapp-public,OpenSourcePolicyCenter/webapp-public,OpenSourcePolicyCenter/PolicyBrain,z... | webapp/apps/dynamic/migrations/0002_dynamicsaveinputs_user_email.py | webapp/apps/dynamic/migrations/0002_dynamicsaveinputs_user_email.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('dynamic', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='dynamicsaveinputs',
nam... | mit | Python | |
6118b05f0efd1c2839eb8bc4de36723af1fcc364 | Convert snake_case to camelCase or PascalCase (#7028) (#7034) | TheAlgorithms/Python | strings/snake_case_to_camel_pascal_case.py | strings/snake_case_to_camel_pascal_case.py | def snake_to_camel_case(input: str, use_pascal: bool = False) -> str:
"""
Transforms a snake_case given string to camelCase (or PascalCase if indicated)
(defaults to not use Pascal)
>>> snake_to_camel_case("some_random_string")
'someRandomString'
>>> snake_to_camel_case("some_random_string", u... | mit | Python | |
4a71e883a469f22995775cbc1eeb6489a2dd71d1 | add integration test | uber/ludwig,uber/ludwig,uber/ludwig | tests/integration_tests/test_contrib_wandb.py | tests/integration_tests/test_contrib_wandb.py | import logging
import os
import shutil
import sys
import ludwig.contrib
from tests.integration_tests.test_experiment import run_experiment
from tests.integration_tests.utils import image_feature
from tests.integration_tests.utils import category_feature
from tests.integration_tests.utils import generate_data
import w... | apache-2.0 | Python | |
da5afa7e96bfa72d6fd0906ed1a42c5f230112f5 | Add tests for update_taxon_assignments method | kbaseapps/GenomeFileUtil,kbaseapps/GenomeFileUtil,kbaseapps/GenomeFileUtil,kbaseapps/GenomeFileUtil | test/core/update_taxon_assignments_test.py | test/core/update_taxon_assignments_test.py | import os
import time
import unittest
from configparser import ConfigParser
from uuid import uuid4
from GenomeFileUtil.GenomeFileUtilImpl import GenomeFileUtil
from GenomeFileUtil.GenomeFileUtilServer import MethodContext
from installed_clients.WorkspaceClient import Workspace as workspaceService
# NOTE: These tests ... | mit | Python | |
bbc4351a5611a035bbee1f18cb55b74d9583cdcd | Create a state for add an object | WalkingMachine/sara_behaviors,WalkingMachine/sara_behaviors | sara_flexbe_states/src/sara_flexbe_states/Wonderland_Add_Object.py | sara_flexbe_states/src/sara_flexbe_states/Wonderland_Add_Object.py | #!/usr/bin/env python
# encoding=utf8
import json
import requests
from flexbe_core import EventState, Logger
class Wonderland_Add_Object(EventState):
'''
Add an object to Wonderland.
For the room, enter only ID or Name, not both.
Return the ID of the added human.
># name string name of the human
... | bsd-3-clause | Python | |
3ce9dcb1ae21ac35ddd97d648ae3ff4b5877adc5 | add script for downloading and conversion of bhuman dataset after conversion the dataset is in the same format as the berlin-united one | BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH,BerlinUnited/NaoTH | Utils/py/BallDetection/RegressionNetwork/generate_image_db_bhuman.py | Utils/py/BallDetection/RegressionNetwork/generate_image_db_bhuman.py | """
Converts the b-human 2019 dataset to the naoth format so we can run performance comparisons
"""
import pickle
import numpy as np
import h5py
from pathlib import Path
from urllib.request import urlretrieve
from urllib.error import HTTPError, URLError
from utility_functions.loader import calculate_mean, subtract_mean... | apache-2.0 | Python | |
78bc96307fb52d95e36eab1da6fa57a66af736e8 | Add script to delete couch phone numbers | qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/sms/management/commands/delete_messaging_couch_phone_numbers.py | corehq/apps/sms/management/commands/delete_messaging_couch_phone_numbers.py | from corehq.apps.sms.mixin import VerifiedNumber
from corehq.apps.sms.models import PhoneNumber
from dimagi.utils.couch.database import iter_docs_with_retry, iter_bulk_delete_with_doc_type_verification
from django.core.management.base import BaseCommand
from optparse import make_option
class Command(BaseCommand):
... | bsd-3-clause | Python | |
678ef4a2ccd9bbfc12ed9a6077d666c4daebf243 | remove like indexes from phonelog | qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,puttarajubr/commcare-hq,puttarajubr/commcare-hq,dimagi/commcare-hq | corehq/ex-submodules/phonelog/migrations/0008_remove_like_indexes.py | corehq/ex-submodules/phonelog/migrations/0008_remove_like_indexes.py | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
db.execute("DROP INDEX IF EXISTS phonelog_devicereportentry_device_id_like")
db.execute("DROP INDEX IF EXISTS phone... | bsd-3-clause | Python | |
20c6f14d4cc76771290f7ce6fc4f3dd5abed07b4 | write symbol calculus with sympy. | DO-CV/sara,DO-CV/sara,DO-CV/sara,DO-CV/sara,DO-CV/sara,DO-CV/sara | cpp/src/DO/Sara/MultiViewGeometry/Estimators/five_point_algorithm.py | cpp/src/DO/Sara/MultiViewGeometry/Estimators/five_point_algorithm.py | from sympy import *
X = Matrix(symbols(' '.join(['X{}'.format(i) for i in range(9)]))).reshape(3, 3)
Y = Matrix(symbols(' '.join(['Y{}'.format(i) for i in range(9)]))).reshape(3, 3)
Z = Matrix(symbols(' '.join(['Z{}'.format(i) for i in range(9)]))).reshape(3, 3)
W = Matrix(symbols(' '.join(['W{}'.format(i) for i in ra... | mpl-2.0 | Python | |
25b0544c2f2c78dbc3bf971d955fda651d7ed5e9 | fix is_open_for_signup missing param | hairychris/cookiecutter-django,hackebrot/cookiecutter-django,jondelmil/cookiecutter-django,topwebmaster/cookiecutter-django,schacki/cookiecutter-django,jondelmil/cookiecutter-django,aleprovencio/cookiecutter-django,hackebrot/cookiecutter-django,Parbhat/cookiecutter-django-foundation,drxos/cookiecutter-django-dokku,ryan... | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/users/adapter.py | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/users/adapter.py | # -*- coding: utf-8 -*-
from django.conf import settings
from allauth.account.adapter import DefaultAccountAdapter
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
class AccountAdapter(DefaultAccountAdapter):
def is_open_for_signup(self, request):
return getattr(settings, 'ACCOUNT_ALL... | # -*- coding: utf-8 -*-
from django.conf import settings
from allauth.account.adapter import DefaultAccountAdapter
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
class AccountAdapter(DefaultAccountAdapter):
def is_open_for_signup(self, request):
return getattr(settings, 'ACCOUNT_ALL... | bsd-3-clause | Python |
c8143c9f3eca422e48625700aeef11e528131caf | add zeroOutDisk.py | marshki/pyWipe,marshki/pyWipe | zeroOutDisk.py | zeroOutDisk.py | #!/usr/bin/env python
def zeroOutDisk():
"""Fill selected device (/dev/) with zeros."""
pass=1
for int in range(wipe):
print 'Wiping drives pass %s of $s")%(pass, count))
os.system(("dd if=/dev/zero of=%s")%(device))
pass+=1
| mit | Python | |
8b26888dea4e825d06b6ebfed628a1762f6a5455 | Solve 48. | klen/euler | 048/solution.py | 048/solution.py | # coding: utf-8
""" Project Euler problem #48. """
def problem():
u""" Solve the problem.
The series, 11 + 22 + 33 + ... + 1010 = 10405071317.
Find the last ten digits of the series, 11 + 22 + 33 + ... + 10001000.
Answer: 9110846700
"""
result = long(0)
for num in range(1, 1001):
... | mit | Python | |
e0770c4a671c650f4569036350b4047fcf925506 | Add a demo app to illustrate the result | plumer/codana,plumer/codana | AnalysisDemo.py | AnalysisDemo.py | import wx
#import matplotlib
class AnalysisDemo(wx.Frame):
def __init__(self, *args, **kw):
super(AnalysisDemo, self).__init__(*args, **kw)
self.initMain()
def initMain(self):
pn = wx.Panel(self)
self.showPackage = wx.RadioButton(pn, label='Organize in package')
self.s... | mit | Python | |
b19d6a63d80919b3e7a2f3c40cd026085a526614 | Create Rehash.py | UmassJin/Leetcode | LintCode/Rehash.py | LintCode/Rehash.py | '''
Medium Rehashing Show result
25% Accepted
The size of the hash table is not determinate at the very beginning. If the total size of keys is too large (e.g. size >= capacity / 10), we should double the size of the hash table and rehash every keys. Say you have a hash table looks like below:
size=3, capacity=4
[n... | mit | Python | |
af4a5e92dc7ef8bffa96c6e556671e1c49116a70 | Test commit | kmuehlbauer/wradlib,kmuehlbauer/wradlib,heistermann/wradlib,wradlib/wradlib,heistermann/wradlib,wradlib/wradlib | radproc.py | radproc.py | #-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: heistermann
#
# Created: 26.10.2011
# Copyright: (c) heistermann 2011
# Licence: <your licence>
#------------------------------------------------------------------------... | mit | Python | |
217b95f7ecb42dd4a9a671703c86a2b83838bb28 | rename to .py | joelstanner/codeeval,joelstanner/codeeval | python_solutions/PENULTIMATE_WORD/PENULTIMATE_WORD.py | python_solutions/PENULTIMATE_WORD/PENULTIMATE_WORD.py | """
Write a program which finds the next-to-last word in a string.
INPUT SAMPLE:
Your program should accept as its first argument a path to a filename. Input
example is the following:
some line with text
another line
Each line has more than one word.
OUTPUT SAMPLE:
Print the next-to-last word in the following way... | mit | Python | |
bc10094ef6250558d713f3636dbd01f295503f15 | Create NovelAPI.py | GetRektByMe/NovelAPI,rachmadaniHaryono/Raitonoberu,GetRektByMe/Raitonoberu | NovelAPI.py | NovelAPI.py | import aiohttp
from bs4 import BeautifulSoup
onlysession = aiohttp.ClientSession()
class NovelUpdatesAPI:
def __init__(self):
self.baseurl = 'http://www.novelupdates.com/'
async def search_novel_updates(self, term: str):
term = term.replace(' ', '+')
params = {'s': term, 'post_type': '... | mit | Python | |
ea3f995775b42784d99ebc19effce949a700eb28 | Update blocks.py | adityaatluri/Urutu,urutu/Urutu | Urutu/cl/blocks.py | Urutu/cl/blocks.py | ## OpenCL blocks are initialized here!
## Created by: Aditya Atluri
## Date: Mar 03 2014
def bx(blocks_dec, kernel):
if blocks_dec == False:
string = "int bx = (get_global_id(0) - get_local_id(0)) / get_local_size(0);\n"
kernel = kernel + string
blocks_dec = True
return kernel, blocks_dec
def by(blocks_dec, k... | ## OpenCL blocks are initialized here!
## Created by: Aditya Atluri
## Date: Mar 03 2014
def bx(blocks_dec, kernel):
if blocks_dec == False:
string = "int bx = get_group_id(0);\n"
kernel = kernel + string
blocks_dec = True
return kernel, blocks_dec
def by(blocks_dec, kernel):
if blocks_dec == False:
string... | apache-2.0 | Python |
f9bad030fffbf6b50ec5833c4024656c725c7679 | Rename and add item3. | Vayne-Lover/Effective | Python/item3.py | Python/item3.py | #!/usr/local/bin/python
# -*- coding:utf-8 -*-
import sys
def to_unicode(unicode_or_str):
if isinstance(unicode_or_str,str):
v=unicode_or_str.decode('utf-8')
else:
v=unicode_or_str
return v
def to_str(unicode_or_str):
if isinstance(unicode_or_str,unicode):
v=unicode_or_str.encode('utf-8')
else:
... | mit | Python | |
09f8a25a80924a5f0b29969ffe3f89ad798ec1b4 | Create default.py | BorgesGabo/gaia,BorgesGabo/gaia | default.py | default.py | # -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations
# -------------------------------------------------------------------------
# This is a sample controller
# - index is the default action of any application
# - user is required for authentication and authorization
... | unlicense | Python | |
2caf6ab1e43ad29864e4dc652a60e445adfa31bb | Add session merger tool | DynamoDS/Coulomb,DynamoDS/Coulomb,DynamoDS/Coulomb | SessionTools/session_merger.py | SessionTools/session_merger.py | import gzip
import os
import random
import time
import sys
VERBOSE = True
def log(s):
if VERBOSE:
print (time.strftime("%Y-%m-%d %H:%M:%S") + " " + str(s))
if len(sys.argv) != 3:
print ("Usage: python session_merger.py PathToInSessions PathToTargetSessions")
exit(1)
inSessionsPath = sys.argv[1]
print(inSe... | mit | Python | |
b6531b3712a5c6e42f4cd1241e740f46fd448696 | add send_setpoint | AlexisTM/Indoor_Position_lasers,AlexisTM/Indoor_Position_lasers,AlexisTM/Indoor_Position_lasers,AlexisTM/Indoor_Position_lasers,AlexisTM/Indoor_Position_lasers | laserpack/bin/send_setpoint.py | laserpack/bin/send_setpoint.py | #!/usr/bin/env python
# vim:set ts=4 sw=4 et:
import rospy
import mavros
import time
import tf
import numpy as np
from laserpack.getch import *
from threading import Thread
from geometry_msgs.msg import PoseStamped
from sensor_msgs.msg import Imu
from mavros_msgs.srv import SetMode
from mavros_msgs.msg import State
... | mit | Python | |
e9861532a3aa420b68bc797ee54f7429ea73c0e7 | fix #1 | Wen777/justKode,Wen777/justKode,Wen777/justKode | rest.py | rest.py | from flask import Flask
app = Flask(__name__)
@app.route("/")
def ping():
return "python server received 'ping' request!"
if __name__ == "__main__":
app.run(debug=True)
| mit | Python | |
e40091a2105fc4e04bcce9b2c6ebcc7cf28f22ca | add module uwsgi | dozymoe/fireh_runner | modules/uwsgi.py | modules/uwsgi.py | """uwsgi-for-Django module.
Website: https://uwsgi-docs.readthedocs.io/en/latest/
"""
import os
def uwsgi(loader, *args):
loader.setup_virtualenv()
venv_dir = loader.get_virtualenv_dir()
binargs = [os.path.join(venv_dir, 'bin', 'uwsgi')] + list(args)
os.execvp(binargs[0], binargs)
def uwsgi_run(load... | mit | Python | |
a1d523c2daf563444761cb7315e18e1e0ee1b506 | Add ARM program (forgot to add) | windelbouwman/ppci-mirror,windelbouwman/ppci-mirror,windelbouwman/ppci-mirror,windelbouwman/ppci-mirror,windelbouwman/ppci-mirror,windelbouwman/ppci-mirror | ppci/arch/arm/program.py | ppci/arch/arm/program.py | from ppci.programs import MachineProgram
class ArmProgram(MachineProgram):
""" Machine code for most mobile devices and e.g. the Raspberry Pi.
"""
def _check_items(self, items):
return items
def _copy(self):
raise NotImplementedError()
def _get_report(self, html):
... | bsd-2-clause | Python | |
10af3d7ee13afda37e8ecf76927bc2fedfe22b6f | add expand module | biothings/biothings_explorer,biothings/biothings_explorer | biothings_explorer/expand/__init__.py | biothings_explorer/expand/__init__.py | from collections import defaultdict
from ..smartapi_kg import MetaKG
from ..call_apis import APIQueryDispatcher
from ..query.utils import annotateEdgesWithInput
class Expander:
def __init__(self):
self.kg = MetaKG()
self.kg.constructMetaKG(source="local")
def __getEdges(self, semanticType):
... | apache-2.0 | Python | |
b55e27e7420443b4d9a48da7c4e5501e1de66f44 | Add some code | quantbucket/quantbucket-repo | modules/descriptive_statistics/app.py | modules/descriptive_statistics/app.py | class DescriptiveStatistics():
def __init__(self,data):
return self.main()
def main(self):
return True | mit | Python | |
c505b95c3affe3805bd9274c3aedd1c6640c5ff5 | Create solution.py | lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges,lilsweetcaligula/Online-Judges | leetcode/medium/linked_list_cycle_ii/py/solution.py | leetcode/medium/linked_list_cycle_ii/py/solution.py | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def detectCycle(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
if head == None:
retur... | mit | Python | |
ebd410b5f7afe4c38977ecf24735a8803e8bb3fb | Advance Version of : Example->Basic->Objects->MultipleCons | jdf/processing.py,mashrin/processing.py,jdf/processing.py,mashrin/processing.py,jdf/processing.py,tildebyte/processing.py,tildebyte/processing.py,tildebyte/processing.py,mashrin/processing.py | mode/examples/Basics/Objects/MultipleConstructors/MultipleConstructors.pyde | mode/examples/Basics/Objects/MultipleConstructors/MultipleConstructors.pyde | '''
Multiple Constructors
A class can have multiple constructors that assign the fields in different ways.
Sometimes it's beneficial to specify every aspect of an object's data by assigning
parameters to the fields, but other times it might be appropriate to define only
one or a few.
Advanced example written... | '''
Multiple constructors
A class can have multiple constructors that assign the fields in different ways.
Sometimes it's beneficial to specify every aspect of an object's data by assigning
parameters to the fields, but other times it might be appropriate to define only
one or a few.
Example written in Pyth... | apache-2.0 | Python |
2b7fffd3f6f358df5613b9aa304f9a70f9b04bc2 | add bloom filter script | kgrodzicki/cloud-computing-specialization,kgrodzicki/cloud-computing-specialization,kgrodzicki/cloud-computing-specialization | cloud-computing-concepts-part1/scripts/bloom-filter.py | cloud-computing-concepts-part1/scripts/bloom-filter.py | __author__ = 'grokrz'
m = 32
def hash_function(x, i, m):
return ((pow(x, 2) * pow(x, 3)) * i) % m
def show_bits_set_to_1(val):
for i in range(1, 4):
print "Bit set to 1: " + str(hash_function(val, i, m))
show_bits_set_to_1(2013) | mit | Python | |
c3a83ed6158fcd9335f9253417ca4b24e9ab7934 | Add test for fqdn thread leak | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/pytests/unit/modules/test_network.py | tests/pytests/unit/modules/test_network.py | import threading
import pytest
import salt.modules.network as networkmod
from tests.support.mock import patch
@pytest.fixture
def configure_loader_modules():
return {networkmod: {}}
@pytest.fixture
def socket_errors():
# Not sure what kind of errors could be returned by getfqdn or
# gethostbyaddr, but ... | apache-2.0 | Python | |
f58589f4bcb2aa233ebbd71831e31b1b9505e2c4 | Create wiki_img_extractor.py | xadahiya/wiki_img_extractor | wiki_img_extractor.py | wiki_img_extractor.py | ##/**
## * xa2.js
## * @author Akshay Dahiya - @xadahiya
## * @description Typingeek's tutor script
## */
import wikipedia, requests, lxml.html
###images and caption from wikipedia
##
##main image from table@class="infobox"
## img/@src,img/@alt
##
##wikipedia images from div@class="thumb tright"
## img@clas... | mit | Python | |
f7328b96275bad6c3d8d9a4f844d47a65fe2bf4b | Create test_wrap.py | humbhenri/katas,humbhenri/katas,humbhenri/katas | wordwrap/test_wrap.py | wordwrap/test_wrap.py | import unittest
from wrap import wrap
class TestWW(unittest.TestCase):
def test_empty_string(self):
self.assertEqual('', wrap('', 1))
def test_string_smaller_than_col(self):
self.assertEqual('ab', wrap('ab', 3))
def test_string_without_spaces(self):
self.assertEqual('ab\ncd', wra... | unlicense | Python | |
7922f168c1f844d7f1b69dfb383918d051cc312f | test when no server is present on the connection | jku/telepathy-gabble,jku/telepathy-gabble,Ziemin/telepathy-gabble,Ziemin/telepathy-gabble,Ziemin/telepathy-gabble,mlundblad/telepathy-gabble,jku/telepathy-gabble,Ziemin/telepathy-gabble,mlundblad/telepathy-gabble,mlundblad/telepathy-gabble | tests/twisted/search/no-server-property.py | tests/twisted/search/no-server-property.py | """
Tests Contact Search channels to a simulated XEP-0055 service, without
passing the Server property
"""
import dbus
from twisted.words.xish import xpath
from gabbletest import exec_test, sync_stream, make_result_iq, acknowledge_iq, elem_iq, elem
from servicetest import EventPattern
from search_helper import call_... | """
Tests Contact Search channels to a simulated XEP-0055 service, without
passing the Server property
"""
import dbus
from twisted.words.xish import xpath
from gabbletest import exec_test, sync_stream, make_result_iq, acknowledge_iq, elem_iq, elem
from servicetest import EventPattern
from search_helper import call_... | lgpl-2.1 | Python |
0a02faf18fd3f05156df1b59dce83cee49a149f5 | set version in finstance | awemulya/fieldsight-kobocat,awemulya/fieldsight-kobocat,awemulya/fieldsight-kobocat,awemulya/fieldsight-kobocat | onadata/apps/fsforms/management/commands/save_version_in_finstance.py | onadata/apps/fsforms/management/commands/save_version_in_finstance.py | from django.core.management.base import BaseCommand
from onadata.apps.fsforms.models import FInstance
class Command(BaseCommand):
help = 'Set version in FInstance for given user'
def add_arguments(self, parser):
parser.add_argument('username', type=str)
def handle(self, *args, **options):
... | bsd-2-clause | Python | |
0e51e1b32fd51ea2f55ee64c762dcbc87159caa0 | Add test_visibility_uvfits | SKA-ScienceDataProcessor/algorithm-reference-library,SKA-ScienceDataProcessor/algorithm-reference-library,SKA-ScienceDataProcessor/algorithm-reference-library,SKA-ScienceDataProcessor/algorithm-reference-library,SKA-ScienceDataProcessor/algorithm-reference-library | tests/processing_components/test_visibility_uvfits.py | tests/processing_components/test_visibility_uvfits.py | """ Unit tests for visibility operations
"""
import sys
import unittest
import logging
import numpy
from data_models.parameters import arl_path
from data_models.polarisation import PolarisationFrame
from processing_components.visibility.base import create_blockvisibility_from_uvfits, create_visibility_f... | apache-2.0 | Python | |
b7f9bbd7afd64c702a2ea296b9e47cb5f563a4a2 | Create valid-square.py | yiwen-luo/LeetCode,yiwen-luo/LeetCode,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,kamyu104/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,jaredkoontz/leetcode,tudennis/LeetCode---kamyu104-11-24-2015,yiwen-luo/LeetCode,tudennis/LeetCode---kamyu104-11-24-2015,jaredkoontz/leetcode,yiwen-luo/LeetCode,jar... | Python/valid-square.py | Python/valid-square.py | # Time: O(1)
# Space: O(1)
# Given the coordinates of four points in 2D space,
# return whether the four points could construct a square.
#
# The coordinate (x,y) of a point is represented by an integer array with two integers.
#
# Example:
# Input: p1 = [0,0], p2 = [1,1], p3 = [1,0], p4 = [0,1]
# Output: True
# Note... | mit | Python | |
9925f3a677b7a855a2242176139bde4ab9d62ba0 | Add script which will compute the number of 'bonnes boites' per rome | StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite,StartupsPoleEmploi/labonneboite | labonneboite/scripts/nb_hirings/rome_nb_bonne_boite.py | labonneboite/scripts/nb_hirings/rome_nb_bonne_boite.py | import pandas as pd
if __name__ == '__main__':
df = pd.read_csv('prediction_per_company_per_rome2019-11-08.csv')
df_rome_nb_bonne_boite = df.groupby(['rome'])['is a bonne boite ?'].sum()
df_rome_nb_bonne_boite.to_csv('nb_bonne_boite_per_rome2019-11-089.csv')
| agpl-3.0 | Python | |
8f488365c9a4f14bf96eab089d6ac869b675c1b4 | Add system.version functional test | photo/openphoto-python,photo/openphoto-python | tests/functional/test_system.py | tests/functional/test_system.py | import logging
import unittest
import trovebox
from tests.functional import test_base
class TestSystem(test_base.TestBase):
testcase_name = "system"
def setUp(self):
"""
Override the default setUp, since we don't need a populated database
"""
logging.info("\nRunning %s...", se... | apache-2.0 | Python | |
234d53ed185976a65042c136426d7f05022a698d | add memnn test | EderSantana/seya | tests/test_memnn.py | tests/test_memnn.py | from __future__ import print_function
import unittest
from seya.layers.memnn2 import MemN2N
from keras.models import Sequential
from keras.layers.core import Lambda
from keras import backend as K
import numpy as np
class TestMemNN(unittest.TestCase):
"""Test seya.layers.memnn layer"""
def test_memnn(self):... | bsd-3-clause | Python | |
b15bf5758539c0682ba607e74e34ef8869431a49 | add tests for TETRA calculations | widdowquinn/pyani | tests/test_tetra.py | tests/test_tetra.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""test_tetra.py
Test tetra.py module.
These tests are intended to be run from the repository root using:
nosetests -v
print() statements will be caught by nosetests unless there is an
error. They can also be recovered with the -s option.
(c) The James Hutton Institut... | mit | Python | |
737ac4ddbc3d047fbf41e3d9f7cde20a53d8974a | add management command to decrypt eval data | project-callisto/callisto-core,SexualHealthInnovations/callisto-core,project-callisto/callisto-core,SexualHealthInnovations/callisto-core | evaluation/management/commands/decrypt_eval_data.py | evaluation/management/commands/decrypt_eval_data.py | from django.core.management.base import BaseCommand
import gnupg
import json
from django.conf import settings
import environ
env = environ.Env()
from evaluation.models import EvalRow
class Command(BaseCommand):
help='decrypts eval data. can only be run in local environments (import data from prod)'
def handl... | agpl-3.0 | Python | |
b977b1e6732255732843aaaad3e5c1f8e2b4d0e0 | add unit tests for openquake/utils/general.py | gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine | tests/utils_general_unittest.py | tests/utils_general_unittest.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010-2011, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# only, as published by the Free Software Foundation.
#
# OpenQuak... | agpl-3.0 | Python | |
e4e4a52318b857ce315a6f673e72b018e6501a83 | Add a plotting example. | lesserwhirls/scipy-cwt,jasonmccampbell/scipy-refactor,scipy/scipy-svn,scipy/scipy-svn,lesserwhirls/scipy-cwt,scipy/scipy-svn,jasonmccampbell/scipy-refactor,scipy/scipy-svn,jasonmccampbell/scipy-refactor,lesserwhirls/scipy-cwt,jasonmccampbell/scipy-refactor,lesserwhirls/scipy-cwt | Lib/sandbox/pyem/examples/plotexamples.py | Lib/sandbox/pyem/examples/plotexamples.py | #! /usr/bin/env python
# Last Change: Mon Jun 11 03:00 PM 2007 J
# This is a simple test to check whether plotting ellipsoides of confidence and
# isodensity contours match
import numpy as N
from numpy.testing import set_package_path, restore_path
import pylab as P
set_package_path()
import pyem
restore_path()
# Ge... | bsd-3-clause | Python | |
0caef8ed3bcf369ffd61f83b06f971b31ae0fb70 | test unittest | ojab/bnw,un-def/bnw,un-def/bnw,ojab/bnw,un-def/bnw,ojab/bnw,un-def/bnw,stiletto/bnw,stiletto/bnw,ojab/bnw,stiletto/bnw,stiletto/bnw | bnw_core/test_delayed_global.py | bnw_core/test_delayed_global.py | # coding: utf-8
from delayed_global import DelayedGlobal
def test_delayed_global():
a = DelayedGlobal()
b = dict({100:200})
try:
c = a.get(100)
except AttributeError:
pass
else:
assert 0, "Got result from empty DelayedGlobal"
a.register(b)
assert a.get(100) == ... | bsd-2-clause | Python | |
ae6f5556cc37d72fff49c76932b94ac8a65bcfbf | make an example python' | Alonreznik/dynamodb-json | example.py | example.py | import time
import uuid
from datetime import datetime
from decimal import Decimal
from json_util import dumps, loads
json_ = {"MyString": "a",
"num": 4,
"MyBool": False,
"my_dict": {"my_date": datetime.utcnow()},
"MyNone": None,
"MyZero": 0,
"myDecimal": Decimal("... | mpl-2.0 | Python | |
405d33789a70a04ebdcca491ca2a749e9e48ddfd | Add example | ABorgna/BluePoV-PC,ABorgna/BluePoV-PC,ABorgna/BluePoV-PC | example.py | example.py | import pygame
import bluePoV
# Varia el color regularmente
x,y = (480,64)
pendiente = 4
# Pygame inits & variables
pygame.init()
pygame.display.set_mode((x,y))
disp = pygame.display.get_surface()
clock = pygame.time.Clock()
# BluePoV init & variables
print ("Port? (default /dev/ttyUSB0)")
port = input()
if not port... | mit | Python | |
3a200bbc447ee05c650bbd592a331b2817c9a498 | Update create_address_doc_from_address_field_in_company.py | indictranstech/erpnext,indictranstech/erpnext,geekroot/erpnext,indictranstech/erpnext,indictranstech/erpnext,Aptitudetech/ERPNext,geekroot/erpnext,gsnbng/erpnext,gsnbng/erpnext,geekroot/erpnext,gsnbng/erpnext,geekroot/erpnext,gsnbng/erpnext | erpnext/patches/v8_0/create_address_doc_from_address_field_in_company.py | erpnext/patches/v8_0/create_address_doc_from_address_field_in_company.py | # Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
# new field address_html is created in place of address field for the company's address in PR #8754 (without patch)
# so here is the patch for ... | # Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
# new field address_html is created in place of address field for the company's address in PR #8754 (without patch)
# so here is the patch for ... | agpl-3.0 | Python |
a6c8176e3f4602e846888293093fc64b7b20233b | Add cmd to force send of cancelled repeat records | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/motech/repeaters/management/commands/send_cancelled_records.py | corehq/motech/repeaters/management/commands/send_cancelled_records.py | import csv
import datetime
import re
import time
from django.core.management.base import BaseCommand
from corehq.motech.repeaters.const import RECORD_CANCELLED_STATE
from corehq.motech.repeaters.dbaccessors import iter_repeat_records_by_domain
class Command(BaseCommand):
help = """
Send cancelled repeat rec... | bsd-3-clause | Python | |
bf66372b2b5b49ba4a93d8ac4f573ceb7857f5b8 | Fix attach in case of multiple threads. | kool79/intellij-community,da1z/intellij-community,retomerz/intellij-community,blademainer/intellij-community,SerCeMan/intellij-community,retomerz/intellij-community,ol-loginov/intellij-community,holmes/intellij-community,kool79/intellij-community,lucafavatella/intellij-community,xfournet/intellij-community,adedayo/inte... | python/helpers/pydev/pydevd_attach_to_process/linux/lldb_threads_settrace.py | python/helpers/pydev/pydevd_attach_to_process/linux/lldb_threads_settrace.py | # This file is meant to be run inside lldb as a command after
# the attach_linux.dylib dll has already been loaded to settrace for all threads.
def __lldb_init_module(debugger, internal_dict):
# Command Initialization code goes here
print('Startup LLDB in Python!')
import lldb
try:
show_debug_i... | # This file is meant to be run inside lldb as a command after
# the attach_linux.dylib dll has already been loaded to settrace for all threads.
def __lldb_init_module(debugger, internal_dict):
# Command Initialization code goes here
print('Startup LLDB in Python!')
try:
show_debug_info = 0
... | apache-2.0 | Python |
1f6595acc01c6dfda899886388b4309f3d8c855b | add index to fixed_ips | phenoxim/nova,cloudbau/nova,leilihh/nova,yrobla/nova,hanlind/nova,zzicewind/nova,maoy/zknova,rajalokan/nova,shail2810/nova,redhat-openstack/nova,sridevikoushik31/openstack,takeshineshiro/nova,Tehsmash/nova,blueboxgroup/nova,bclau/nova,berrange/nova,plumgrid/plumgrid-nova,badock/nova,SUSE-Cloud/nova,jeffrey4l/nova,bigsw... | nova/db/sqlalchemy/migrate_repo/versions/139_add_indexes_to_fixed_ips.py | nova/db/sqlalchemy/migrate_repo/versions/139_add_indexes_to_fixed_ips.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/... | apache-2.0 | Python | |
5e8ce7c9fb31d76ec5f372bb0b62e7b846304966 | Create exerc-4.py | rafa-impacta/Exercicio | exerc-4.py | exerc-4.py | arquivo = open("arquivo.txt","w")
for i in range(1):
arquivo.write("Atividade 4 ")
arquivo.close()
arquivo = open("arquivo.txt","r")
for linha in arquivo:
print("Texto: ",linha)
arquivo.close()
arquivo = open("arquivo.txt", "r")
copia = open("copia.txt", "w")
while 1:
texto = arquivo.read(50)
if t... | apache-2.0 | Python | |
a18ef3eb9128ee27d4f14e7952ba8545b510c4ac | add e2e test file | sup/fill,sup/fill,sup/fill | e2e_test.py | e2e_test.py | # Copyright 2015, Google, Inc.
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy of the
# License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable
# law or agreed to in writing, software d... | mit | Python | |
5695a468f8619ea6bb7c9a01857a375f827de6a1 | Add parser for 0.4.6 XML report. | owtf/ptp,DoomTaper/ptp | libptp/tools/arachni/parser.py | libptp/tools/arachni/parser.py | from libptp.exceptions import NotSupportedVersionError
from libptp.info import Info
from libptp.parser import AbstractParser
class ArachniXMLParser(AbstractParser):
__tool__ = 'arachni'
__format__ = 'xml'
__version__ = ['0.4.6']
def __init__(self, *args, **kwargs):
AbstractParser.__init__(se... | bsd-3-clause | Python | |
ddad199df01cf41dda188d501ddb74e17c38d94f | add symbiotic3 tool | ultimate-pa/benchexec,IljaZakharov/benchexec,IljaZakharov/benchexec,martin-neuhaeusser/benchexec,IljaZakharov/benchexec,sosy-lab/benchexec,dbeyer/benchexec,dbeyer/benchexec,sosy-lab/benchexec,martin-neuhaeusser/benchexec,sosy-lab/benchexec,martin-neuhaeusser/benchexec,IljaZakharov/benchexec,dbeyer/benchexec,sosy-lab/be... | benchexec/tools/symbiotic3.py | benchexec/tools/symbiotic3.py | """
BenchExec is a framework for reliable benchmarking.
This file is part of BenchExec.
Copyright (C) 2007-2015 Dirk Beyer
All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
... | apache-2.0 | Python | |
8e9c2a3c31184e789bf2788f5fa0ab06e0db988f | Add utilities module | inodb/sufam | sufam/utils.py | sufam/utils.py | import errno
import os
import shutil
import sys
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc:
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else:
raise
def rm_rf(path):
if os.path.isdir(path):
shutil.rmtree(path)
... | mit | Python | |
efb6072e097a816bb46fdd83541c763e222816c9 | Add initial tests for the concordance view | CentreForResearchInAppliedLinguistics/clic,CentreForResearchInAppliedLinguistics/clic,CentreForCorpusResearch/clic,CentreForCorpusResearch/clic,CentreForResearchInAppliedLinguistics/clic,CentreForCorpusResearch/clic | clic/dickens/test_concordance.py | clic/dickens/test_concordance.py | import unittest
from concordance_new import Concordancer_New
class TestConcordancerNewChapterIndex(unittest.TestCase):
def test_create_concordance(self):
"""
This is a very naive test to run whilst reviewing the create
concordance code. It's goal is simply to evaluate whether that
... | mit | Python | |
915f94433171c9ee73fa5cf5941c695590e6ee16 | add fabric config file | ianzhengnan/blog-python3,ianzhengnan/blog-python3,ianzhengnan/blog-python3 | fabfile.py | fabfile.py | import os, re
from datetime import datetime
from fabric.api import *
#server user name
env.user = 'zhengnan'
# sudo user
env.sudo_user = 'root'
# server address
env.hosts = ['192.168.56.103']
db_user = 'www-data'
db_password = 'www-data'
_TAR_FILE = 'dist-awesome.tar.gz'
def build():
includes = ['static', '... | apache-2.0 | Python | |
7e8d1220ef0032c505d7d66838fc9fc9999da810 | add some python test code | natemara/CSE-278,natemara/CSE-278 | project_02/tests.py | project_02/tests.py | from unittest import TestCase, main
import subprocess
import re
NUM_PATTERN = re.compile(r'\w+\s*=\s*(?P<num>[10]+)')
def run(num1, num2, operation):
p = subprocess.Popen(
'./proj2.out',
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
stdin=subprocess.PIPE,
bufsize=0
)
p.stdin.write('{}\n{}\n{}\n'.fo... | mit | Python | |
9f5bc55f7cfc5b6d0ee3ee9d6ad8a5317e1fa62b | Move all constants here | hackoregon/urbandev-backend,hackoregon/urbandev-backend | consts.py | consts.py | ## Constants
# Lat / long bounding box of City of Portland
# (-123.0, 44.0, -122.0, 45.0) ??
PDX_BOUNDING_BOX = (-122.9, 45.35, -122.4, 45.7)
| mit | Python | |
7185136cf4322397803eabe805ab4e818197edf8 | Add wsgi startup script | 18F/regulations-core,ascott1/regulations-core,EricSchles/regulations-core,adderall/regulations-core,willbarton/regulations-core,cmc333333/regulations-core,grapesmoker/regulations-core,eregs/regulations-core | core.wsgi | core.wsgi | import os
import sys
root = os.path.dirname(__file__)
sys.path.insert(0, root)
from core import app as application
from core import index
from core.handlers.search import *
from core.handlers.regulation import *
index.init_schema()
| cc0-1.0 | Python | |
a76f2bfea735f6b452785185ebc257d1da179ec4 | Add tests (#5451) | souravbadami/oppia,kevinlee12/oppia,brianrodri/oppia,prasanna08/oppia,kevinlee12/oppia,brianrodri/oppia,oppia/oppia,souravbadami/oppia,brianrodri/oppia,souravbadami/oppia,kevinlee12/oppia,prasanna08/oppia,kevinlee12/oppia,prasanna08/oppia,oppia/oppia,oppia/oppia,brianrodri/oppia,souravbadami/oppia,oppia/oppia,oppia/opp... | core/platform/taskqueue/gae_taskqueue_services_test.py | core/platform/taskqueue/gae_taskqueue_services_test.py | # coding: utf-8
#
# Copyright 2018 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | apache-2.0 | Python | |
caa29a940673d42d23d70b31eddd2ec61fc3fb73 | Add a simple script which monitors the paused domains on a host, checks them against the xapi database, logs anomalies, and optionally destroys the domain if it has been in an error state for longer than a threshold (currently 60s) | johnelse/xcp-rrdd,koushikcgit/xcp-rrdd,koushikcgit/xcp-networkd,simonjbeaumont/xcp-rrdd,sharady/xcp-networkd,djs55/xcp-networkd,koushikcgit/xcp-rrdd,koushikcgit/xcp-rrdd,djs55/xcp-rrdd,djs55/xcp-networkd,simonjbeaumont/xcp-rrdd,djs55/squeezed,djs55/xcp-rrdd,robhoes/squeezed,johnelse/xcp-rrdd,koushikcgit/xcp-networkd,sh... | scripts/examples/python/monitor-unwanted-domains.py | scripts/examples/python/monitor-unwanted-domains.py | #!/usr/bin/env python
import subprocess, XenAPI, inventory, time, sys
# Script which monitors the domains running on a host, looks for
# paused domains which don't correspond to VMs which are running here
# or are about to run here, logs them and optionally destroys them.
# Return a list of (domid, uuid) tuples, one... | lgpl-2.1 | Python | |
ab0868b777101a8442cec80009b84b40e79a3a08 | add a sample script | beetbox/audioread | decode.py | decode.py | """Command-line tool to decode audio files to raw PCM."""
import audioread
import sys
import os
def decode(filename):
filename = os.path.abspath(os.path.expanduser(filename))
with audioread.audio_open(filename) as f:
print 'Input file: %i channels at %i Hz; %.1f seconds.' % \
(f.channels,... | mit | Python | |
b5b22086efe745f5d14207c1103483189e0387ef | Add game_state.py | lipk/pyzertz | pyzertz/game_state.py | pyzertz/game_state.py | import table
import os
class Player:
def __init__(self, name):
self.marbles = [0,0,0] #white, gray, black
self.name = name
def __str__(self):
return self.name
pl1 = Player("Odon")
pl2 = Player("Bela")
winner = None
act = pl1
t=table.Table(3)
t.get(0,0).type=1
t.get(-3,0).... | apache-2.0 | Python | |
51055b6fbd81ffc88215b88f9a63d702535bdd93 | Add missing file | sassoftware/jobslave,sassoftware/jobslave,sassoftware/jobslave | jobslave/job_data.py | jobslave/job_data.py | #
# Copyright (c) 2011 rPath, Inc.
#
BUILD_DEFAULTS = {
'autoResolve': False,
'maxIsoSize': '681574400',
'bugsUrl': 'http://issues.rpath.com/',
'natNetworking': False,
'vhdDiskType': 'dynamic',
'anacondaCustomTrove': '',
'stringArg': '',
'mediaTemplateTr... | apache-2.0 | Python | |
41cc4d54d5eddcf30e2c9a98179ff1e745a12f90 | Add missing migration | springload/madewithwagtail,springload/madewithwagtail,springload/madewithwagtail,springload/madewithwagtail | core/migrations/0009_wagtail112upgrade.py | core/migrations/0009_wagtail112upgrade.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-21 23:14
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0008_wagtailcompanypage_sites_ordering'),
]
operations = [
migratio... | mit | Python | |
9bc05db6bc3b6b2570c8e37d528639c310a6f162 | Add login required decorator | LibCrowds/libcrowds-analyst,alexandermendes/pybossa-analyst,alexandermendes/pybossa-analyst,alexandermendes/pybossa-analyst | pybossa_analyst/login.py | pybossa_analyst/login.py | # -*- coding: utf8 -*-
from functools import wraps
from flask import session, request, redirect, url_for
def login_required(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if session.get('api_key') is None:
return redirect(url_for('home.login', next=request.url))
return f(*... | unknown | Python | |
24bdb8217a921f3f1833a8e9c1bcd7cc1615ea9b | add mgmt command to migrate testruns between projects | terceiro/squad,terceiro/squad,terceiro/squad,terceiro/squad | squad/core/management/commands/migrate_test_runs.py | squad/core/management/commands/migrate_test_runs.py | import sys
from django.core.exceptions import ObjectDoesNotExist
from django.core.management.base import BaseCommand
from squad.core.models import Project, Build, Environment
from squad.core.tasks import UpdateProjectStatus
class Command(BaseCommand):
help = """Move test runs identified by environment slug
... | agpl-3.0 | Python | |
0b09eeede5f8a1533c166fe97844834ceb2ee178 | remove some hard-coded paths | pgdouyon/vim-nim,zah/nim.vim | autoload/nimrod_vim.py | autoload/nimrod_vim.py | import threading, Queue, subprocess, signal, os
try:
import vim
except ImportError:
class Vim:
def command(self, x):
print("Executing vim command: " + x)
vim = Vim()
def disable_sigint():
# Ignore the SIGINT signal by setting the handler to the standard
# signal handler SIG_IGN.
signal.signal... | import threading, Queue, subprocess, signal, os
try:
import vim
except ImportError:
class Vim:
def command(self, x):
print("Executing vim command: " + x)
vim = Vim()
def disable_sigint():
# Ignore the SIGINT signal by setting the handler to the standard
# signal handler SIG_IGN.
signal.signal... | mit | Python |
0ba2b5f63aeb39a1d1faf6d0f9eb2626bcc86d3e | Create urls.py | minigun/likes,minigun/likes | urls.py | urls.py | from django.conf.urls import url
from django.contrib import admin
from django.conf.urls.static import static
from django.conf import settings
from likes import *
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^$', index),
url(r'^like', uri_manager, name='likes'),
url(r'^auth', authorize, name=... | mit | Python | |
5f7dfe4b83f318cc712bc1a7ed955d6c6374f7f5 | Create es4_windows.py | tjmaher/elemental-selenium-tips,tourdedave/elemental-selenium-tips,tjmaher/elemental-selenium-tips,tjmaher/elemental-selenium-tips,tjmaher/elemental-selenium-tips,tjmaher/elemental-selenium-tips,tourdedave/elemental-selenium-tips,tourdedave/elemental-selenium-tips,tourdedave/elemental-selenium-tips,tourdedave/elemental... | 04-work-with-multiple-windows/python/es4_windows.py | 04-work-with-multiple-windows/python/es4_windows.py | # http://elementalselenium.com/tips/4-work-with-multiple-windows
import os
import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys # for send_keys
class ES4_Windows(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Firefox()
def test_example_1(sel... | mit | Python | |
8c0612232a79c55b3c58a6230f590e5d6d4e36f9 | Implement taking info parser | skystar-p/graduate-adventure,Jhuni0123/graduate-adventure,Jhuni0123/graduate-adventure,dnsdhrj/graduate-adventure,skystar-p/graduate-adventure,MKRoughDiamond/graduate-adventure,MKRoughDiamond/graduate-adventure,LastOne817/graduate-adventure,LastOne817/graduate-adventure,skystar-p/graduate-adventure,dnsdhrj/graduate-adv... | backend/core/parser.py | backend/core/parser.py | def parse_credit(text):
semester_name = {
'U000200001U000300001': '1',
'U000200001U000300002': 'S',
'U000200002U000300001': '2',
'U000200002U000300002': 'W',
}
lines = text.split('\n')[:-1]
columns = []
infos = []
for line in lines:
line = line.split('\t')... | mit | Python | |
e895050634f5161d93520aaea7c7e54e329fadbe | add oncotator | raonyguimaraes/ngs_metrics,raonyguimaraes/ngs_metrics | bam/exome_oncotator.py | bam/exome_oncotator.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from multiprocessing import Pool
import subprocess
import shlex
import logging
import argparse
import datetime
import os
from subprocess import call
parser = argparse.ArgumentParser()
parser.add_argument("-i", "--input", help="VCF file")
parser.add_argument("-t", "--tar... | mit | Python | |
8e16ac329d459d11b971216b0eab032e81b5557e | Add flowline benchmarks (#489) | TimoRoth/oggm,OGGM/oggm,bearecinos/oggm,TimoRoth/oggm,anoukvlug/oggm,juliaeis/oggm,bearecinos/oggm,OGGM/oggm,juliaeis/oggm,anoukvlug/oggm | benchmarks/flowline.py | benchmarks/flowline.py | # Write the benchmarking functions here.
# See "Writing benchmarks" in the asv docs for more information.
import os
import shutil
import numpy as np
import oggm
from oggm.tests.funcs import init_hef, get_test_dir
from oggm import utils, tasks
from oggm.core import massbalance, flowline
testdir = os.path.join(get_test... | bsd-3-clause | Python | |
59c173bf4179fc77eacf97f3f08359498d35a635 | Add switch class for good utility | stvreumi/electronic-blackboard,SWLBot/electronic-blackboard,chenyang14/electronic-blackboard,SWLBot/electronic-blackboard,Billy4195/electronic-blackboard,stvreumi/electronic-blackboard,Billy4195/electronic-blackboard,stvreumi/electronic-blackboard,chenyang14/electronic-blackboard,stvreumi/electronic-blackboard,Billy419... | util.py | util.py | # coding=utf-8
"""
The switch class refers to PEP 275 (Marc-André Lemburg <mal at lemburg.com>)
(https://www.python.org/dev/peps/pep-0275/)
"""
class switch(object):
def __init__(self,value):
self.value = value
self.fall = False
def __iter__(self):
"""Return the match method once, then... | apache-2.0 | Python | |
3cb47114dc40ebbbcc946c79946ec59813a7af7f | add email module | texastribune/salesforce-stripe,texastribune/salesforce-stripe,MinnPost/salesforce-stripe,MinnPost/salesforce-stripe,MinnPost/salesforce-stripe,texastribune/salesforce-stripe | emails.py | emails.py | import smtplib
from config import MAIL_SERVER
from config import MAIL_PORT
from config import MAIL_USERNAME
from config import MAIL_PASSWORD
from config import DEFAULT_MAIL_SENDER
def send_email(recipient, subject, body, sender=None):
if sender is None:
FROM = DEFAULT_MAIL_SENDER
else:
FROM ... | mit | Python | |
b3959854da150cf734cda3521efd14ee0565d352 | Create Rotor.py | pkeating/Enigma-Machine | EnigmaMachine/Rotor.py | EnigmaMachine/Rotor.py | class Rotor(object):
def __init__(self, rotor_config, starting_position, config_file):
# If starting_position is not between 0 and 25, a ValueError is raised.
if starting_position < 0 or starting_position > 25:
raise ValueError(
"starting_position in Rotor must be between 0 and 25"
)
# If rotor_conf... | mit | Python | |
f301aa5ecdc3f9d821a72bb6a03d9857c43e72fc | add missing file | lxc-webpanel/lxc-rest | app/fields/auth.py | app/fields/auth.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask_restplus import fields
from app import api
auth_fields_get = api.model('AuthGet', { 'access_token': fields.String })
auth_fields_post = api.model('AuthPost', {
'username': fields.String(required=True),
'password': fields.String(required=True)
}
)
| mit | Python | |
2785b8d5b1338126b6887b23fefec106ed877601 | Add first 16 hexagrams | urschrei/hexagrams,urschrei/hexagrams | hexagrams.py | hexagrams.py | # -*- coding: utf-8 -*-
hexagrams = {
"Ch'ien": (1, 1, 1, 1, 1, 1),
"K'un": (0, 0, 0, 0, 0, 0),
"Chun": (0, 1, 0, 0, 0, 1),
"Mêng": (1, 0, 0, 0, 1, 0),
"Hsü": (0, 1, 0, 1, 1, 1 ),
"Sung": (1, 1, 1, 0, 1, 0),
"Shih": (0, 0, 0, 0, 1, 0),
"Pi": (0, 1, 0, 0, 0, 0),
"Hsiao Ch'u": (1, 1, ... | mit | Python | |
11cc94f4a6545b49317042df4edf1804ccc3bdd8 | add a python script to export the links | mhansen/nzwirelessmap,mhansen/nzwirelessmap,mhansen/nzwirelessmap | export.py | export.py | #!/usr/bin/env python
"""
A quick script to turn the database into KML showing pairs of point-to-point links
"""
import sys
import sqlite3
from xml.sax.saxutils import escape
conn = sqlite3.connect("prism.sqlite3")
c = conn.cursor()
sql = open("getpairs.sql").read()
c.execute(sql)
print """<?xml version="1.0" encodin... | mit | Python | |
2d7d4b533999c029a33d7802d7ddfba631e07604 | Add Django 1.4 style wsgi app settings file | rinfo/fst,kamidev/autobuild_fst,rinfo/fst,kamidev/autobuild_fst,kamidev/autobuild_fst,rinfo/fst,kamidev/autobuild_fst,rinfo/fst | wsgi.py | wsgi.py | """ WSGI application settings for FST instance
The default setup at Domstolsverket assumes every instance of FST is
running under it's own virtualenv.
"""
import os
import sys
import site
#VIRTUALENV_PATH = '/path/of/your/virtualenv'
PYTHON_SITE_PACKAGES = 'lib/python2.6/site-packages'
# Specify the site-packages... | bsd-3-clause | Python | |
c131e6108a72c57af4d3bdbe67d182d6c0ddb1eb | Add migration to modify on_delete | GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin,makinacorpus/Geotrek,GeotrekCE/Geotrek-admin | geotrek/feedback/migrations/0008_auto_20200326_1252.py | geotrek/feedback/migrations/0008_auto_20200326_1252.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.27 on 2020-03-26 12:52
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('feedback', '0007_auto_20200324_1412'),
]
operatio... | bsd-2-clause | Python | |
a8f3cb864b39ef3178af652bfee4dcb6775baa71 | Make sure tags/attributes are converted correctly | feend78/evennia,jamesbeebop/evennia,feend78/evennia,feend78/evennia,jamesbeebop/evennia,feend78/evennia,jamesbeebop/evennia | evennia/typeclasses/migrations/0009_rename_player_cmdsets_typeclasses.py | evennia/typeclasses/migrations/0009_rename_player_cmdsets_typeclasses.py | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-09 21:33
from __future__ import unicode_literals
import re
from django.db import migrations
CASE_WORD_EXCEPTIONS = []
def _case_sensitive_replace(string, old, new):
"""
Replace text, retaining exact case.
Args:
string (str): String... | bsd-3-clause | Python | |
b42c13de01a49e7fe3fb7caa22089ea1cd87f7bf | Add sanity tests for baremetal power state commands | openstack/python-ironicclient,openstack/python-ironicclient | ironicclient/tests/functional/osc/v1/test_baremetal_node_power_states.py | ironicclient/tests/functional/osc/v1/test_baremetal_node_power_states.py | # Copyright (c) 2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | apache-2.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.