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 |
|---|---|---|---|---|---|---|---|---|
d83a344d7695dac59262716c54962c3f6c19c09b | Mark bfloat16 as trainable. | gunan/tensorflow,tensorflow/tensorflow,yongtang/tensorflow,frreiss/tensorflow-fred,freedomtan/tensorflow,tensorflow/tensorflow-pywrap_tf_optimizer,gautam1858/tensorflow,aam-at/tensorflow,karllessard/tensorflow,freedomtan/tensorflow,davidzchen/tensorflow,yongtang/tensorflow,yongtang/tensorflow,paolodedios/tensorflow,ten... | tensorflow/python/eager/backprop_util.py | tensorflow/python/eager/backprop_util.py | # Copyright 2015 The TensorFlow 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 required by applica... | # Copyright 2015 The TensorFlow 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 required by applica... | apache-2.0 | Python |
cdf5045a5d838cd22222ef12d8854a2dbdf6bf71 | Use feature detection instead of version detection (#69) | tensorflow/text,tensorflow/text,tensorflow/text | tensorflow_text/python/ops/string_ops.py | tensorflow_text/python/ops/string_ops.py | # coding=utf-8
# Copyright 2019 TF.Text Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | # coding=utf-8
# Copyright 2019 TF.Text Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | apache-2.0 | Python |
984b9661e0152a6631b209e80d3dc121dfa6400f | Add BlogPost creation test | andreagrandi/bloggato,andreagrandi/bloggato | blog/tests.py | blog/tests.py | from django.test import TestCase
from .models import BlogPost
from django.contrib.auth.models import User
class BlogTest(TestCase):
def setUp(self):
self.user = User.objects.create_user(username = "user001", email = "email@domain.com", password = "password123456")
def test_post_creation(self):
... | """
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 a... | mit | Python |
f4077404ab8e371f619d68bbeb0f53f90a613819 | Set timezone/language when creating user | indico/indico,OmeGak/indico,mvidalgarcia/indico,mic4ael/indico,pferreir/indico,mvidalgarcia/indico,mic4ael/indico,mic4ael/indico,ThiefMaster/indico,mvidalgarcia/indico,OmeGak/indico,pferreir/indico,pferreir/indico,DirkHoffmann/indico,DirkHoffmann/indico,pferreir/indico,ThiefMaster/indico,indico/indico,ThiefMaster/indic... | indico/modules/users/operations.py | indico/modules/users/operations.py | # This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | # This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | mit | Python |
9bffd9ae939c182e3e1ed9c5421043bd2f359e1b | Add exception logging for the file_logging plugin | securestate/king-phisher-plugins,wolfthefallen/king-phisher-plugins,zeroSteiner/king-phisher-plugins,zeroSteiner/king-phisher-plugins,wolfthefallen/king-phisher-plugins,securestate/king-phisher-plugins | client/file_logging.py | client/file_logging.py | import datetime
import logging
import os
import king_phisher.client.application as application
import king_phisher.client.dialogs.exception as exception
import king_phisher.client.gui_utilities as gui_utilities
import king_phisher.client.plugins as plugins
# logger name value
LOGGER_NAME = ''
# log file size, in MB
... | import logging
import os
import king_phisher.client.application as application
import king_phisher.client.gui_utilities as gui_utilities
import king_phisher.client.plugins as plugins
# logger name value
LOGGER_NAME = ''
# log file size, in MB
LOG_FILE_SIZE = 10
class Plugin(plugins.ClientPlugin):
authors = ['Zach ... | bsd-3-clause | Python |
72e97c6e1c873ac4115a96e853910f6b42de547e | Bump version to 1.3.1. | 1313e/CMasher | cmasher/__version__.py | cmasher/__version__.py | # -*- coding: utf-8 -*-
"""
CMasher Version
===============
Stores the different versions of the *CMasher* package.
"""
# %% VERSIONS
# Default/Latest/Current version
__version__ = '1.3.1'
| # -*- coding: utf-8 -*-
"""
CMasher Version
===============
Stores the different versions of the *CMasher* package.
"""
# %% VERSIONS
# Default/Latest/Current version
__version__ = '1.3.0'
| bsd-3-clause | Python |
f8d2163e5c1b28c9568dea9688264c993b299322 | Fix typo in SpawnCommand | jdswinbank/Comet,jdswinbank/Comet | comet/utility/spawn.py | comet/utility/spawn.py | # Comet VOEvent Broker.
# Event handler to send an event to an external tool.
# John Swinbank, <swinbank@transientskp.org>, 2012.
from subprocess import Popen, PIPE, CalledProcessError
from twisted.python import log
from twisted.internet.threads import deferToThread
from zope.interface import implements
from ..icome... | # Comet VOEvent Broker.
# Event handler to send an event to an external tool.
# John Swinbank, <swinbank@transientskp.org>, 2012.
from subprocess import Popen, PIPE, CalledProcessError
from twisted.python import log
from twisted.internet.threads import deferToThread
from zope.interface import implements
from ..icome... | bsd-2-clause | Python |
685cd4d1e19c1912d9e13ce925a7c2decfc8bb35 | Complete two stacks sol | bowen0701/algorithms_data_structures | lc0232_implement_queue_using_stacks.py | lc0232_implement_queue_using_stacks.py | """Leetcode 232. Implement Queue using Stacks
Easy
URL: https://leetcode.com/problems/implement-queue-using-stacks/
Implement the following operations of a queue using stacks.
- push(x) -- Push element x to the back of queue.
- pop() -- Removes the element from in front of queue.
- peek() -- Get the front element.
- ... | """Leetcode 232. Implement Queue using Stacks
Easy
URL: https://leetcode.com/problems/implement-queue-using-stacks/
Implement the following operations of a queue using stacks.
- push(x) -- Push element x to the back of queue.
- pop() -- Removes the element from in front of queue.
- peek() -- Get the front element.
- ... | bsd-2-clause | Python |
2e0d7d439f4ae91fd41f6e227b3a54340bbb2130 | Update test_vulnerabilities.py | nathanbjenx/cairis,nathanbjenx/cairis,failys/CAIRIS,failys/CAIRIS,nathanbjenx/cairis,nathanbjenx/cairis,failys/CAIRIS | cairis/cairis/test/test_vulnerabilities.py | cairis/cairis/test/test_vulnerabilities.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... | apache-2.0 | Python |
099711f564ad08056a59324b38f6c5ceab30ccec | Update version check to Ansible 2.4.1 | twiest/openshift-ansible,ewolinetz/openshift-ansible,nak3/openshift-ansible,jwhonce/openshift-ansible,akubicharm/openshift-ansible,akram/openshift-ansible,zhiwliu/openshift-ansible,abutcher/openshift-ansible,sdodson/openshift-ansible,sosiouxme/openshift-ansible,zhiwliu/openshift-ansible,liggitt/openshift-ansible,jwhonc... | callback_plugins/aa_version_requirement.py | callback_plugins/aa_version_requirement.py | #!/usr/bin/python
"""
This callback plugin verifies the required minimum version of Ansible
is installed for proper operation of the OpenShift Ansible Installer.
The plugin is named with leading `aa_` to ensure this plugin is loaded
first (alphanumerically) by Ansible.
"""
import sys
from ansible import __version__
i... | #!/usr/bin/python
"""
This callback plugin verifies the required minimum version of Ansible
is installed for proper operation of the OpenShift Ansible Installer.
The plugin is named with leading `aa_` to ensure this plugin is loaded
first (alphanumerically) by Ansible.
"""
import sys
from ansible import __version__
i... | apache-2.0 | Python |
f561f08950cf2374f3e81f77057aa7cf03d8c713 | Bump version: 0.0.2 -> 0.0.3 | polysquare/cmake-forward-arguments | conanfile.py | conanfile.py | from conans import ConanFile
from conans.tools import download, unzip
import os
VERSION = "0.0.3"
class CMakeForwardArguments(ConanFile):
name = "cmake-forward-arguments"
version = os.environ.get("CONAN_VERSION_OVERRIDE", VERSION)
requires = ("cmake-include-guard/master@smspillaz/cmake-include-guard",
... | from conans import ConanFile
from conans.tools import download, unzip
import os
VERSION = "0.0.2"
class CMakeForwardArguments(ConanFile):
name = "cmake-forward-arguments"
version = os.environ.get("CONAN_VERSION_OVERRIDE", VERSION)
requires = ("cmake-include-guard/master@smspillaz/cmake-include-guard",
... | mit | Python |
98a87eb9d19eb33e82062cb4b83da5d6db303226 | add basic query consts (#34) | avihad/twistes | twistes/consts.py | twistes/consts.py | class HttpMethod(object):
HEAD = 'HEAD'
GET = 'GET'
POST = 'POST'
PUT = 'PUT'
DELETE = 'DELETE'
class ResponseCodes(object):
OK = 200
CREATED = 201
ACCEPTED = 202
BAD_REQUEST = 400
NOT_FOUND = 404
class HostParsing(object):
HTTP = 'http'
HTTPS = 'https'
USE_SSL = ... | class HttpMethod(object):
HEAD = 'HEAD'
GET = 'GET'
POST = 'POST'
PUT = 'PUT'
DELETE = 'DELETE'
class ResponseCodes(object):
OK = 200
CREATED = 201
ACCEPTED = 202
BAD_REQUEST = 400
NOT_FOUND = 404
class HostParsing(object):
HTTP = 'http'
HTTPS = 'https'
USE_SSL = ... | apache-2.0 | Python |
038bbd3028901be59f92c60ec08057f4a84128fd | Bump to version 0.35.2 | reubano/meza,reubano/meza,reubano/meza,reubano/tabutils,reubano/tabutils,reubano/tabutils | meza/__init__.py | meza/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
meza
~~~~
Provides methods for reading and processing data from tabular formatted files
Attributes:
CURRENCIES [tuple(unicode)]: Currency symbols to remove from decimal
strings.
ENCODING (str): Default file encoding.
DEF... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
meza
~~~~
Provides methods for reading and processing data from tabular formatted files
Attributes:
CURRENCIES [tuple(unicode)]: Currency symbols to remove from decimal
strings.
ENCODING (str): Default file encoding.
DEF... | mit | Python |
381cf6c3ec8544a8bf2479441636fb84e1cf4a39 | Update __init__.py | mfem/PyMFEM,mfem/PyMFEM,mfem/PyMFEM | mfem/__init__.py | mfem/__init__.py | import os
path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
mfem_mode = None
pymfem_debug = -1
def debug_print(message):
if pymfem_debug < 0: # debug < 0
return
elif pymfem_debug == 0: # debug = 0
pass
elif pymfem_debug > 0: # debug = 1
pass
elif pymfem... | import os
path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
mfem_mode = None
pymfem_debug = -1
def debug_print(message):
if pymfem_debug < 0: # debug < 0
return
elif pymfem_debug == 0: # debug = 0
pass
elif pymfem_debug > 0: # debug = 1
pass
elif pymfem... | bsd-3-clause | Python |
dd71dd1bf35108ab400af291af5840101d6e7ff9 | Refactor code | moyamo/collabomo | collabomo.py | collabomo.py | #!/usr/bin/env python
# Copyright (c) 2014 Mohammed Yaseen Mowzer
#
# This Software is subject to the terms of the MIT License which can be found
# LICENSE file.
from flask import Flask, render_template, redirect, url_for, request, session
app = Flask(__name__)
def save_answers():
with open(ANSWERS_FILE, 'w') ... | #!/usr/bin/env python
# Copyright (c) 2014 Mohammed Yaseen Mowzer
#
# This Software is subject to the terms of the MIT License which can be found
# LICENSE file.
from flask import Flask, render_template, redirect, url_for, request, session
app = Flask(__name__)
@app.route('/collabomo', methods=["GET", "POST"])
def ... | mit | Python |
daa3cae22ea90ad756679a494391766c84a6f12b | Update verbose_name | publica-io/django-publica-modals,publica-io/django-publica-modals | modals/models.py | modals/models.py | from django.db import models
from django.db.models.loading import get_model
from django.contrib.contenttypes.models import ContentType
from polymorphic import PolymorphicModel
from entropy.mixins import (
TextMixin, EnabledMixin, SlugMixin, TitleMixin
)
from attrs.mixins import GenericAttrMixin
from templates.mixi... | from django.db import models
from django.db.models.loading import get_model
from django.contrib.contenttypes.models import ContentType
from polymorphic import PolymorphicModel
from entropy.mixins import (
TextMixin, EnabledMixin, SlugMixin, TitleMixin
)
from attrs.mixins import GenericAttrMixin
from templates.mixi... | bsd-3-clause | Python |
da950e2e10c79389e3493d7b298bdeaadb272f58 | Add Headers | iGene/igene_bot,aver803bath5/igene_bot | models/google.py | models/google.py | # -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import logging
import re
import requests
import urllib.parse
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
logger = logging.getLogger(__name__)
def google(bot, update):
search = update.message.text
s... | # -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import logging
import re
import requests
import urllib.parse
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
logger = logging.getLogger(__name__)
def google(bot, update):
search = update.message.text
s... | mit | Python |
4911f6bb9c0c3b3dc9eb150f83c50366940d368a | Clean up top-level namespace | mwaskom/moss,mwaskom/moss | moss/__init__.py | moss/__init__.py | from .statistical import *
from .misc import *
import design
import glm
__version__ = "0.3.dev"
| from .statistical import *
from .misc import *
from .design import *
from .glm import *
__version__ = "0.3.dev"
| bsd-3-clause | Python |
d7d9af433f937de12b7bca11a6ad0f227ddeedc1 | Correct code identation | lnls-fac/mathphys | constants.py | constants.py | import math as _math
import mathphys.base_units as _u
# temporary auxiliary derived units
_volt = (_u.kilogram * _u.meter**2) / (_u.ampere * _u.second**2)
_coulomb = _u.second * _u.ampere
_joule = _u.kilogram * _u.meter**2 / _u.second**2
# physical constants
# ==================
light_speed = 299792... | import math as _math
import mathphys.base_units as _u
# temporary auxiliary derived units
_volt = (_u.kilogram * _u.meter**2) / (_u.ampere * _u.second**2)
_coulomb = _u.second * _u.ampere
_joule = _u.kilogram * _u.meter**2 / _u.second**2
# physical constants
# ==================
light_speed = 299792... | mit | Python |
a06ca6899062bab407cb4c6884d0bf148a380b1f | Add a variable to hold reached points | hhucn/netsec-uebungssystem,hhucn/netsec-uebungssystem,hhucn/netsec-uebungssystem | netsecus/task.py | netsecus/task.py | from __future__ import unicode_literals
class Task(object):
def __init__(self, number, description, maxPoints, reachedPoints):
self.number = number
self.description = description
self.maxPoints = maxPoints
self.reachedPoints = reachedPoints
| from __future__ import unicode_literals
class Task(object):
def __init__(self, number, description, maxPoints):
self.number = number
self.description = description
self.maxPoints = maxPoints
| mit | Python |
9f648cd67c630fe3c9d7f7371d698a9e50e7f0ee | add seq init | CompBio-TDU-Japan/nsdm | nsdm/__init__.py | nsdm/__init__.py | # coding: utf-8
from . import fileparse
from . import shell
from . import seq
__author__ = 'Yuto Kimura'
__version__ = '0.0.2'
| # coding: utf-8
from . import fileparse
from . import shell
__author__ = 'Yuto Kimura'
__version__ = '0.0.2'
| mit | Python |
6915c00d54ac9dd6d59e544dbf5617739566a29c | Refactor to use one function per command | dnarvaez/broot | broot/main.py | broot/main.py | # Copyright 2013 Daniel Narvaez
#
# 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 writi... | # Copyright 2013 Daniel Narvaez
#
# 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 writi... | apache-2.0 | Python |
0799969063b7ba721cadd0a777518c870cf7a3bb | Update set_portal_settings.py | gsnbng/erpnext,gsnbng/erpnext,indictranstech/erpnext,indictranstech/erpnext,gsnbng/erpnext,geekroot/erpnext,njmube/erpnext,gsnbng/erpnext,njmube/erpnext,geekroot/erpnext,indictranstech/erpnext,njmube/erpnext,geekroot/erpnext,indictranstech/erpnext,njmube/erpnext,geekroot/erpnext,Aptitudetech/ERPNext | erpnext/patches/v7_0/set_portal_settings.py | erpnext/patches/v7_0/set_portal_settings.py | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from erpnext.setup.setup_wizard import domainify
def execute():
for dt in ("assessment", "announcement", "course", "fees"):
frappe.re... | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from erpnext.setup.setup_wizard import domainify
def execute():
for dt in ("assessment", "announcement", "course", "fees"):
frappe.re... | agpl-3.0 | Python |
d07eb37dc9e15359d6abc5e9203e3d7c7b7d52b0 | add new view for package version jobs | sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint | mint/django_rest/rbuilder/packages/views.py | mint/django_rest/rbuilder/packages/views.py | #
# Copyright (c) 2011 rPath, Inc.
#
# All Rights Reserved
#
from django.http import HttpResponse
from mint.django_rest.rbuilder import service
from mint.django_rest.deco import requires, return_xml #, access, ACCESS
class PackageService(service.BaseService):
"""docstring for PackageService"""
@return_x... | #
# Copyright (c) 2011 rPath, Inc.
#
# All Rights Reserved
#
from django.http import HttpResponse
from mint.django_rest.rbuilder import service
from mint.django_rest.deco import requires, return_xml #, access, ACCESS
class PackageService(service.BaseService):
"""docstring for PackageService"""
@return_x... | apache-2.0 | Python |
f5bbdea74c0f8a0cc8ac4331ea8adc45c3f266c8 | Read files defined as argument | hampustagerud/colorconverter | converter.py | converter.py | #
# MIT License
# Copyright (c) 2017 Hampus Tågerud
#
# 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, m... | #
# MIT License
# Copyright (c) 2017 Hampus Tågerud
#
# 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, m... | mit | Python |
d42914deeed7f7ee91c48d356891f5f088dc8577 | Refactor imports in root urls.py config | SarFootball/backend,SarFootball/backend,SarFootball/backend | untitled1/urls.py | untitled1/urls.py | from django.conf.urls import patterns, include, url, static
from django.contrib import admin
from django.contrib.auth.models import User
import admin_tools.urls
from django.conf import settings
from rest_framework import routers, serializers, viewsets
from carusele import urls as carusele_urls
from teamlogic import u... | from django.conf.urls import patterns, include, url, static
from django.contrib import admin
from django.contrib.auth.models import User
import admin_tools.urls
from django.conf import settings
from rest_framework import routers, serializers, viewsets
from carusele import urls as urls1
from teamlogic import urls as u... | apache-2.0 | Python |
50528d37410a043de277e91c0c0c3bdf21220269 | Add config as constructor param | doismellburning/doc8,stackforge/doc8,openstack/doc8,tschuy/doc8 | doc8/checks.py | doc8/checks.py | # -*- coding: utf-8 -*-
# Copyright (C) 2014 Ivan Melnikov <iv at altlinux dot org>
#
# Author: Joshua Harlow <harlowja@yahoo-inc.com>
#
# 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
#
# ... | # -*- coding: utf-8 -*-
# Copyright (C) 2014 Ivan Melnikov <iv at altlinux dot org>
#
# Author: Joshua Harlow <harlowja@yahoo-inc.com>
#
# 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 |
ff196967e79ec20e235f772fbbdeff8920d09662 | change time to datetime, keyword the args | golf1052/close-call,golf1052/close-call,golf1052/close-call | core/core.py | core/core.py | from redis import Redis
from rq import Queue
from rq_scheduler import Scheduler
from datetime import datetime
import pymongo
import config
import consequences.facebook as facebook
scheduler = Scheduler(connection=Redis())
def connect_to_mongo():
client = pymongo.MongoClient("mongodb://" + config.MONGO_USER + conf... | from redis import Redis
from rq import Queue
from rq_scheduler import Scheduler
from datetime import datetime
import pymongo
import config
import consequences.facebook as facebook
scheduler = Scheduler(connection=Redis())
def connect_to_mongo():
client = pymongo.MongoClient("mongodb://" + config.MONGO_USER + conf... | mit | Python |
b78652b7da4155f21b929090d0be1cfcd2b5af6b | bump version number for new release | scikit-hep/uproot,scikit-hep/uproot,scikit-hep/uproot,scikit-hep/uproot | uproot/version.py | uproot/version.py | #!/usr/bin/env python
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot/blob/master/LICENSE
from __future__ import absolute_import
import re
__version__ = "3.7.2"
version = __version__
version_info = tuple(re.split(r"[-\.]", __version__))
del re
| #!/usr/bin/env python
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot/blob/master/LICENSE
from __future__ import absolute_import
import re
__version__ = "3.7.1"
version = __version__
version_info = tuple(re.split(r"[-\.]", __version__))
del re
| bsd-3-clause | Python |
33d75989fc70e1c4f46a6a3fb7d675b5b5b178a9 | add base for register/login/logout views | samitnuk/urlsaver_django,samitnuk/urlsaver_django | urlsaver/views.py | urlsaver/views.py | from django.shortcuts import render
from django.http import HttpResponse
def main_view(request):
return HttpResponse("Hello, World! This is main page!")
def register_view(reguest):
return HttpResponse("Register View")
def login_view(reguest):
return HttpResponse("Login View")
def logout_view(reguest):
... | from django.shortcuts import render
from django.http import HttpResponse
def main_view(request):
return HttpResponse("Hello, World! This is main page!")
| mit | Python |
22f284452c678ce4e113dc606d761b27466fd6b9 | update to maker parsing | nextgenusfs/funannotate,nextgenusfs/funannotate,nextgenusfs/funannotate,nextgenusfs/funannotate | util/maker2evm.py | util/maker2evm.py | #!/usr/bin/env python
#script to tease apart maker gff into EVM input
import sys
tr = 'transcript_alignments.gff3'
pr = 'protein_alignments.gff3'
gr = 'gene_predictions.gff3'
with open(tr, 'w') as trout:
with open(pr, 'w') as prout:
with open(gr, 'w') as grout:
with open(sys.argv[1], 'rU') a... | #!/usr/bin/env python
#script to tease apart maker gff into EVM input
import sys
tr = 'transcript_alignments.gff3'
pr = 'protein_alignments.gff3'
gr = 'gene_predictions.gff3'
with open(tr, 'w') as trout:
with open(pr, 'w') as prout:
with open(gr, 'w') as grout:
with open(sys.argv[1], 'rU') a... | bsd-2-clause | Python |
5bc96f122a14b93107a1fd7f903701dc0c3e7261 | remove print | praekelt/hellomama-registration,praekelt/hellomama-registration | vas2nets/views.py | vas2nets/views.py | from datetime import timedelta
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
from hellomama_registration import utils
from .tasks import (
fetch_voice_data, fetch_voice_data_history, sync_welcome_audio)
class FetchVoic... | from datetime import timedelta
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
from hellomama_registration import utils
from .tasks import (
fetch_voice_data, fetch_voice_data_history, sync_welcome_audio)
class FetchVoic... | bsd-3-clause | Python |
c0b809734ab8fac329dabe251204f5651bf2f5f9 | fix tests for reduce view | qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,qedsoftware/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/performance_sms/dbaccessors.py | corehq/apps/performance_sms/dbaccessors.py | from corehq.apps.performance_sms.models import PerformanceConfiguration
def by_domain(domain):
return list(PerformanceConfiguration.view(
'performance_sms/by_domain',
key=domain,
reduce=False,
include_docs=True
))
def by_interval(interval_keys):
return list(PerformanceCon... | from corehq.apps.performance_sms.models import PerformanceConfiguration
def by_domain(domain):
return list(PerformanceConfiguration.view('performance_sms/by_domain', key=domain, include_docs=True))
def by_interval(interval_keys):
return list(PerformanceConfiguration.view('performance_sms/all_configs', key=i... | bsd-3-clause | Python |
15e8f998da207e22e2293e96ecabcb10006fc24d | Update get-relation-foreign-objects.py | agusmakmun/Some-Examples-of-Simple-Python-Script,agusmakmun/Some-Examples-of-Simple-Python-Script | Django/get-relation-foreign-objects.py | Django/get-relation-foreign-objects.py | #https://docs.djangoproject.com/en/dev/topics/db/queries/#caching-and-querysets
class Data_Toko(models.Model):
....
class Pengiriman(models.Model):
property = models.ForeignKey(Data_Toko, related_name='pengiriman')
metode_pengiriman = models.CharField(max_length=200, default='JNE', blank=True, null=True, help_tex... | class Data_Toko(models.Model):
....
class Pengiriman(models.Model):
property = models.ForeignKey(Data_Toko, related_name='pengiriman')
metode_pengiriman = models.CharField(max_length=200, default='JNE', blank=True, null=True, help_text='Isikan Pengiriman yang tersedia, contoh: JNE')
>>> a = Pengiriman.objects.al... | agpl-3.0 | Python |
34a3ce85281c0a0a46160f477e5ceb3298707359 | Add is_exe to commands.py | PythonSanSebastian/docstamp | docstamp/commands.py | docstamp/commands.py | # coding=utf-8
# -------------------------------------------------------------------------------
# Author: Alexandre Manhaes Savio <alexsavio@gmail.com>
# Grupo de Inteligencia Computational <www.ehu.es/ccwintco>
# Universidad del Pais Vasco UPV/EHU
#
# 2015, Alexandre Manhaes Savio
# Use this at your own risk!
# -----... | # coding=utf-8
# -------------------------------------------------------------------------------
# Author: Alexandre Manhaes Savio <alexsavio@gmail.com>
# Grupo de Inteligencia Computational <www.ehu.es/ccwintco>
# Universidad del Pais Vasco UPV/EHU
#
# 2015, Alexandre Manhaes Savio
# Use this at your own risk!
# -----... | apache-2.0 | Python |
7ecd6aaef882d4e8a29e3125a52977984055b8dd | Bump version | khchine5/opal,khchine5/opal,khchine5/opal | opal/_version.py | opal/_version.py | __version__ = '0.7.0'
| __version__ = '0.6.0'
| agpl-3.0 | Python |
b424a4ea3c458bc0dd089a67a9714b3fe201a644 | Add method 'get_absolute_url' to Order model. | giovannicode/djangoseller,giovannicode/djangoseller,giovannicode/djangoseller,giovannicode/djangoseller | orders/models.py | orders/models.py | from django.db import models
from django.conf import settings
from django.core.mail import send_mail
from products.models import Product
from payments.models import Payment
class Address(models.Model):
street = models.CharField(max_length=60)
city = models.CharField(max_length=60)
state = models.CharFiel... | from django.db import models
from django.conf import settings
from django.core.mail import send_mail
from products.models import Product
from payments.models import Payment
class Address(models.Model):
street = models.CharField(max_length=60)
city = models.CharField(max_length=60)
state = models.CharFiel... | bsd-3-clause | Python |
a822092211533ff17ff9b92dd86f6f868ed63e2e | remove redundant condition | StrellaGroup/frappe,yashodhank/frappe,yashodhank/frappe,frappe/frappe,yashodhank/frappe,frappe/frappe,frappe/frappe,StrellaGroup/frappe,yashodhank/frappe,StrellaGroup/frappe | frappe/patches/v13_0/encrypt_2fa_secrets.py | frappe/patches/v13_0/encrypt_2fa_secrets.py | import frappe
import frappe.defaults
from frappe.cache_manager import clear_defaults_cache
from frappe.twofactor import PARENT_FOR_DEFAULTS
from frappe.utils.password import encrypt
DOCTYPE = "DefaultValue"
OLD_PARENT = "__default"
def execute():
table = frappe.qb.DocType(DOCTYPE)
# set parent for `*_otplogin`
(... | import frappe
import frappe.defaults
from frappe.cache_manager import clear_defaults_cache
from frappe.twofactor import PARENT_FOR_DEFAULTS
from frappe.utils.password import encrypt
DOCTYPE = "DefaultValue"
OLD_PARENT = "__default"
def execute():
table = frappe.qb.DocType(DOCTYPE)
# set parent for `*_otplogin`
(... | mit | Python |
33e88c063fedb11211e3786a9d722a9d12f72ce8 | Add type hint for -DN42 | fritz0705/lglass | contrib/dn42_whoisd.py | contrib/dn42_whoisd.py | #!/bin/python
# coding: utf-8
import argparse
import asyncio
import lglass.dn42
import lglass.whois.engine
import lglass.whois.server
def create_database(db_path):
return lglass.dn42.DN42Database(db_path)
if __name__ == "__main__":
argparser = argparse.ArgumentParser(description="DN42 Whois server")
arg... | #!/bin/python
# coding: utf-8
import argparse
import asyncio
import lglass.dn42
import lglass.whois.engine
import lglass.whois.server
def create_database(db_path):
return lglass.dn42.DN42Database(db_path)
if __name__ == "__main__":
argparser = argparse.ArgumentParser(description="DN42 Whois server")
arg... | mit | Python |
61efe8c925fa6d243eda17ab21d6279485786608 | Remove debug print (#1478) | google/fuzzbench,google/fuzzbench,google/fuzzbench,google/fuzzbench,google/fuzzbench | fuzzers/centipede_function_filter/fuzzer.py | fuzzers/centipede_function_filter/fuzzer.py | # Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | # Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | apache-2.0 | Python |
fdb3801a513357c4f5ba655a6216ba59ee1e3df9 | Increase opacity on chart backgrounds | gizmo-cda/g2x,gizmo-cda/g2x,gizmo-cda/g2x,thelonious/g2x,thelonious/g2x,gizmo-cda/g2x | overlay/Chart.py | overlay/Chart.py | from SVGGenerator import SVGGenerator
from Label import Label
class Chart(SVGGenerator):
def __init__(self, name, title, data):
SVGGenerator.__init__(self, './chart.svg.mustache')
self.name = name
self.title = title
self.x = 10
self.y = 10
self.width = 110
s... | from SVGGenerator import SVGGenerator
from Label import Label
class Chart(SVGGenerator):
def __init__(self, name, title, data):
SVGGenerator.__init__(self, './chart.svg.mustache')
self.name = name
self.title = title
self.x = 10
self.y = 10
self.width = 110
s... | mit | Python |
392de77fdf0038620b189017068da4cd7a562288 | Delete unused function _add_type_to | yanqd0/csft | csft/csft.py | csft/csft.py | # -*- coding:utf-8 -*-
"""
The implementations of csft.
"""
import sys
from collections import OrderedDict
from os.path import split, splitext
from pandas import DataFrame, Series
from pathlib import Path
if sys.version < '3.5':
from scandir import walk
else:
from os import walk
class Column(object):
... | # -*- coding:utf-8 -*-
"""
The implementations of csft.
"""
import sys
from collections import OrderedDict
from os.path import split, splitext
from pandas import DataFrame, Series
from pathlib import Path
if sys.version < '3.5':
from scandir import walk
else:
from os import walk
class Column(object):
... | mit | Python |
3fb48e7b978f4df946f1c334321db79536a29579 | update type mapper | dragoon/kilogram,dragoon/kilogram,dragoon/kilogram | mapreduce/filter/mapper_dbpedia_types.py | mapreduce/filter/mapper_dbpedia_types.py | #!/usr/bin/env python
import sys
import shelve
# Open just for read
dbpediadb = shelve.open('dbpedia_types.dbm', flag='r')
for line in sys.stdin:
# remove leading and trailing whitespace
line = line.strip()
# split the line into words
ngram, num = line.split('\t')
words = ngram.split()
dbped... | #!/usr/bin/env python
import sys
import shelve
# Open just for read
dbpediadb = shelve.open('dbpedia_types.dbm', flag='r')
for line in sys.stdin:
# remove leading and trailing whitespace
line = line.strip()
# split the line into words
ngram, num = line.split('\t')
words = ngram.split()
dbped... | apache-2.0 | Python |
7394c42a2370b794d6b2ada6eb1a8d70ab42add4 | delete tasks import after flask extension flask-celery-py3 improve | taogeT/livetv_mining,taogeT/livetv_mining,taogeT/livetv_mining | celery_run.py | celery_run.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
from app import create_app, celery
import os
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
| #!/usr/bin/env python
# -*- coding: UTF-8 -*-
from app import create_app, celery
import os
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
app.app_context().push()
from app.tasks import *
| apache-2.0 | Python |
20b3ec71fc372ae72ce08314db04c7e6e99a4382 | fix secret key check, going ssj2 | dev-coop/meancoach,dev-coop/meancoach,dev-coop/meancoach,dev-coop/meancoach | meancoach_project/settings/production.py | meancoach_project/settings/production.py | import dj_database_url
from base import *
DATABASES = {
'default': dj_database_url.config()
}
DEBUG = False
ALLOWED_HOSTS = ['.herokuapp.com']
SECRET_KEY = os.environ.get("DJANGO_SECRET_KEY", None)
assert SECRET_KEY, "Set your DJANGO_SECRET_KEY env var"
# Use the cached template loader so template is compil... | import dj_database_url
from base import *
DATABASES = {
'default': dj_database_url.config()
}
DEBUG = False
ALLOWED_HOSTS = ['.herokuapp.com']
SECRET_KEY = os.environ.get("DJANGO_SECRET_KEY", 'a secret key')
assert SECRET_KEY == 'a secret key', "Set your DJANGO_SECRET_KEY env var"
# Use the cached template ... | mit | Python |
605763d911c834369fb8914f633e52a4ac24fd0c | Update poll.py | JeffreyPowell/pi-heating-hub,JeffreyPowell/pi-heating-hub,JeffreyPowell/pi-heating-hub | cron/poll.py | cron/poll.py | #!/usr/bin/env python
#import sys
#import os
#import logging
#import pif
import MySQLdb
import datetime
import urllib2
#import mysql.connector
# https://dev.mysql.com/doc/connector-python/en/connector-python-example-connecting.html
# GLOBALS
#MYSQL_USERNAME="pi"
#MYSQL_PASSWORD="PASSWORD"
#
# check locally if ... | #!/usr/bin/env python
#import sys
#import os
#import logging
#import pif
import MySQLdb
import datetime
import urllib2
#import mysql.connector
# https://dev.mysql.com/doc/connector-python/en/connector-python-example-connecting.html
# GLOBALS
#MYSQL_USERNAME="pi"
#MYSQL_PASSWORD="PASSWORD"
#
# check locally if ... | apache-2.0 | Python |
94408043df2bcc15e58eb6ca1a92da2c57cefa86 | make debounce at least do sth outside of ipython | maartenbreddels/vaex,maartenbreddels/vaex,maartenbreddels/vaex,maartenbreddels/vaex,maartenbreddels/vaex,maartenbreddels/vaex | packages/vaex-jupyter/vaex/jupyter/utils.py | packages/vaex-jupyter/vaex/jupyter/utils.py | import collections
import time
import functools
import ipywidgets as widgets
from IPython.display import display, clear_output
def get_ioloop():
import IPython
import zmq
ipython = IPython.get_ipython()
if ipython and hasattr(ipython, 'kernel'):
return zmq.eventloop.ioloop.IOLoop.instance()
... | import collections
import time
import functools
import ipywidgets as widgets
from IPython.display import display, clear_output
def get_ioloop():
import IPython
import zmq
ipython = IPython.get_ipython()
if ipython and hasattr(ipython, 'kernel'):
return zmq.eventloop.ioloop.IOLoop.instance()
... | mit | Python |
56327baa67d5f05551bc52a1c0466e8d8b905797 | Add the missing 'np.' before 'array' | ceshine/isml15-wed | metrics.py | metrics.py | """The metrics module implements functions assessing prediction error for specific purposes."""
import numpy as np
def trapz(x, y):
"""Trapezoidal rule for integrating
the curve defined by x-y pairs.
Assume x and y are in the range [0,1]
"""
assert len(x) == len(y), 'x and y need to be of same le... | """The metrics module implements functions assessing prediction error for specific purposes."""
import numpy as np
def trapz(x, y):
"""Trapezoidal rule for integrating
the curve defined by x-y pairs.
Assume x and y are in the range [0,1]
"""
assert len(x) == len(y), 'x and y need to be of same len... | mit | Python |
0350220f8e13d8ac99288d9f2bebb51b0810b157 | Make with statement easier | djangokillen/minion-hate-bot | minions.py | minions.py | import tweepy, time, random
def main():
while True:
CONSUMER_KEY = 'your_consumer_key'
CONSUMER_SECRET = 'your_consumer_secret'
ACCESS_KEY = 'your_access_key'
ACCESS_SECRET = 'your_access_secret'
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_acc... | import tweepy, time, random
def main():
quit = False
while not quit:
CONSUMER_KEY = 'your_consumer_key'
CONSUMER_SECRET = 'your_consumer_secret'
ACCESS_KEY = 'your_access_key'
ACCESS_SECRET = 'your_access_secret'
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET... | mit | Python |
222628c6747bdc3574bcb7cf6257c785ffa6451d | Add product_number and serial_number identifiers | worldcomputerxchange/inventory-control,codeforsanjose/inventory-control | inventory_control/database/sql.py | inventory_control/database/sql.py | """
So this is where all the SQL commands live
"""
CREATE_SQL = """
CREATE TABLE component_type (
id INT PRIMARY KEY AUTO_INCREMENT,
type VARCHAR(255) UNIQUE
);
CREATE TABLE components (
id INT PRIMARY KEY AUTO_INCREMENT,
serial_number VARCHAR(255),
sku TEXT,
type INT,
status INT,
FOR... | """
So this is where all the SQL commands live
"""
CREATE_SQL = """
CREATE TABLE component_type (
id INT PRIMARY KEY AUTO_INCREMENT,
type VARCHAR(255) UNIQUE
);
CREATE TABLE components (
id INT PRIMARY KEY AUTO_INCREMENT,
sku TEXT,
type INT,
status INT,
FOREIGN KEY (type) REFERENCES compo... | mit | Python |
31c70d956262dab46ad263d42581c04e69fd85c4 | Hide panel if 'baremetal' service not present | openstack/ironic-ui,openstack/ironic-ui,openstack/ironic-ui,openstack/ironic-ui | ironic_ui/content/ironic/panel.py | ironic_ui/content/ironic/panel.py | # Copyright 2016 Cisco Systems, Inc.
# Copyright (c) 2016 Hewlett Packard Enterprise Development Company LP
#
# 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.apa... | # Copyright 2016 Cisco Systems, Inc.
# Copyright (c) 2016 Hewlett Packard Enterprise Development Company LP
#
# 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.apa... | apache-2.0 | Python |
b12a25a816c8832506a87f7812713b75a8105fc8 | Make DummyProtocol inherit from Protocol because it now needs a 'iter_routes' function | stackforge/wsme | wsme/tests/test_protocols.py | wsme/tests/test_protocols.py | # encoding=utf8
import unittest
from wsme import WSRoot
from wsme.protocols import getprotocol, CallContext, Protocol
import wsme.protocols
class DummyProtocol(Protocol):
name = 'dummy'
content_types = ['', None]
def __init__(self):
self.hits = 0
def accept(self, req):
return True
... | # encoding=utf8
import unittest
from wsme import WSRoot
from wsme.protocols import getprotocol, CallContext
import wsme.protocols
class DummyProtocol(object):
name = 'dummy'
content_types = ['', None]
def __init__(self):
self.hits = 0
def accept(self, req):
return True
def ite... | mit | Python |
4331b32413ef3df3293093fc6e24ebd28d5f856f | Use Python naming convention in PatientState | JMathiszig-Lee/Propofol | patient_state.py | patient_state.py | class PatientState:
# age: years
# weight: kilos
# height: cm
# sex: 'm' or 'f'
def __init__(self, age, weight, height, sex):
is_male = sex == "m"
# TODO: Use better equation to calculate lean body mass
if (is_male):
lbm = 1.1 * weight - 128 * ((weight/height) * ... | class PatientState:
# age: years
# weight: kilos
# height: cm
# sex: 'm' or 'f'
def __init__(self, age, weight, height, sex):
is_male = sex == "m"
# TODO: Use better equation to calculate lean body mass
if (is_male):
lbm = 1.1 * weight - 128 * ((weight/height) * ... | mit | Python |
ed4d9b134828547292ac198b60cea0731beb2124 | update test_changes, it does not use another module anymore | sdpython/pyquickhelper,sdpython/pyquickhelper,sdpython/pyquickhelper,sdpython/pyquickhelper | _unittests/ut_helpgen/test_changes.py | _unittests/ut_helpgen/test_changes.py | """
@brief test log(time=8s)
@author Xavier Dupre
"""
import sys
import os
import unittest
try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..")))
if ... | """
@brief test log(time=8s)
@author Xavier Dupre
"""
import sys
import os
import unittest
try:
import src
except ImportError:
path = os.path.normpath(
os.path.abspath(
os.path.join(
os.path.split(__file__)[0],
"..",
"..")))
if ... | mit | Python |
ced2f43b643abd300c4d886bd461392eb86d898a | add AsyncioConnection to pika package | pika/pika,vitaly-krugl/pika | pika/__init__.py | pika/__init__.py | __version__ = '1.0.0b1'
import logging
from logging import NullHandler
# Add NullHandler to prevent logging warnings
logging.getLogger(__name__).addHandler(NullHandler())
from pika.connection import ConnectionParameters
from pika.connection import URLParameters
from pika.connection import SSLOptions
from pika.creden... | __version__ = '1.0.0b1'
import logging
from logging import NullHandler
# Add NullHandler to prevent logging warnings
logging.getLogger(__name__).addHandler(NullHandler())
from pika.connection import ConnectionParameters
from pika.connection import URLParameters
from pika.connection import SSLOptions
from pika.creden... | bsd-3-clause | Python |
8185b68cb9d187bebecc65e7dcc336832dae1d62 | Bump release to 1.3.0 | yloiseau/Watson,TailorDev/Watson,TailorDev/Watson | watson/version.py | watson/version.py | # -*- coding: utf-8 -*-
version = "1.3.0"
| # -*- coding: utf-8 -*-
version = "1.2.0"
| mit | Python |
7cfd02638d825fb9d0de4da631a45a0932bc8fc8 | Add default values to lambda functions | Icenium/appbuilder-sublime-package,dimitardanailov/appbuilder-sublime-package,dimitardanailov/appbuilder-sublime-package,Icenium/appbuilder-sublime-package | app_builder/feature_usage_tracking.py | app_builder/feature_usage_tracking.py | import sublime
import json
from .command_executor import run_command
from .notifier import log_info
_track_feature_usage_enabled = None
def ensure_feature_usage_tracking_is_set(callback=None):
if _track_feature_usage_enabled != None:
return
def on_data(data):
global _track_feature_usage_enab... | import sublime
import json
from .command_executor import run_command
from .notifier import log_info
_track_feature_usage_enabled = None
def ensure_feature_usage_tracking_is_set(callback=None):
if _track_feature_usage_enabled != None:
return
def on_data(data):
global _track_feature_usage_enab... | apache-2.0 | Python |
4499480526537b3d9e5c5a19389c11d462c38bd9 | Update module docstring, add csv import | qba73/nc | csv_to_nc.py | csv_to_nc.py | #!/usr/bin/env python
"""
File format converter.
The script converts csv file to netcdf format.
Limitations:
1) only for small csv files
2) csv files without header - csv module is not used!
"""
import sys
import os.path
import csv
import pupynere
def update_name(old_name):
new = old_name.split('.')
new[-1... | #!/usr/bin/env python
"""
File format converter.
The script converts csv file to netcdf format.
Limitations:
1) only for small csv files
2) csv files without header - csv module is not used!
The script is based on code from the following blog post:
http://www.j-raedler.de/2010/12/how-to-convert-a-csv-file-\
to-netcdf... | mit | Python |
7034ca18ed182d5f2bc508344ce293060ff74ef2 | add support for additional filter types | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/userreports/reports/builder/filter_formats.py | corehq/apps/userreports/reports/builder/filter_formats.py | from corehq.apps.userreports.reports.builder import const
def get_pre_filter_format(pre_filter_dict):
"""
See the `to_report_filter` function of DataSourceProperty in forms.py for this logic.
This is basically the opposite.
"""
if pre_filter_dict['pre_operator'] == '' and pre_filter_dict['pre_valu... | from corehq.apps.userreports.reports.builder import const
def get_pre_filter_format(pre_filter_dict):
"""
See the `to_report_filter` function of DataSourceProperty in forms.py for this logic.
This is basically the opposite.
"""
return 'Value' if pre_filter_dict['pre_value'] else 'Date'
| bsd-3-clause | Python |
703df4780cc3f1557cb438a620c636ebabe4a576 | update data.py | berkeley-stat159/project-theta | data/data.py | data/data.py | from __future__ import print_function, division
import hashlib
import os
import json
d = json.load(open("data/hashList.txt"))
def generate_file_md5(filename, blocksize=2**20):
m = hashlib.md5()
with open(filename, "rb") as f:
while True:
buf = f.read(blocksize)
if not buf:
... | from __future__ import print_function, division
import hashlib
import os
d = json.load(open("data/hashList.txt"))
def generate_file_md5(filename, blocksize=2**20):
m = hashlib.md5()
with open(filename, "rb") as f:
while True:
buf = f.read(blocksize)
if not buf:
... | bsd-3-clause | Python |
dac796463bc34691c91fcc6f6618f8a7c4c8851d | Add missing fields in event schema. | predicthq/sdk-py | predicthq/endpoints/v1/events/schemas.py | predicthq/endpoints/v1/events/schemas.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, print_function
from predicthq.endpoints.schemas import PaginatedMixin, SortableMixin, Model, ResultSet, \
ListType, StringType, GeoJSONPointType, StringListType, StringModelType, Area, \
ModelType, IntRange, IntType, DateTimeRang... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, print_function
from predicthq.endpoints.schemas import PaginatedMixin, SortableMixin, Model, ResultSet, \
ListType, StringType, GeoJSONPointType, StringListType, StringModelType, Area, \
ModelType, IntRange, IntType, DateTimeRang... | mit | Python |
adfa98f9417c6d9e4078e54b8e6e54a6f0c8b475 | update ceiling to reference spawn points and mask lamps | ajtag/TrinRoofPlayer | Constants.py | Constants.py | __author__ = 'ajtag'
from pygame import Rect
import collections
import csv
import os.path
MADRIX_X = 132
MADRIX_Y = 70
MADRIX_SIZE = (MADRIX_X, MADRIX_Y)
white = 255, 255, 255, 0xff
black = 0, 0, 0, 0xff
red = 255, 0, 0, 0xff
green = 0, 255, 0, 0xff
blue = 0, 0, 255, 0xff
dark_grey = 0x30, 0x30, 0x30, 0xff
transpar... | __author__ = 'ajtag'
from pygame import Rect
import collections
import csv
import os.path
MADRIX_X = 132
MADRIX_Y = 70
MADRIX_SIZE = (MADRIX_X, MADRIX_Y)
white = 255, 255, 255, 0xff
black = 0, 0, 0, 0xff
red = 255, 0, 0, 0xff
green = 0, 255, 0, 0xff
blue = 0, 0, 255, 0xff
dark_grey = 0x30, 0x30, 0x30, 0xff
transpar... | mit | Python |
52d890e51dce97145112da367bc2ef2c6cf729be | fix py3 test case | saurabh6790/frappe,tundebabzy/frappe,tundebabzy/frappe,almeidapaulopt/frappe,ESS-LLP/frappe,StrellaGroup/frappe,almeidapaulopt/frappe,frappe/frappe,neilLasrado/frappe,manassolanki/frappe,manassolanki/frappe,tundebabzy/frappe,vjFaLk/frappe,mhbu50/frappe,adityahase/frappe,adityahase/frappe,yashodhank/frappe,yashodhank/fr... | frappe/core/doctype/transaction_log/test_transaction_log.py | frappe/core/doctype/transaction_log/test_transaction_log.py | # -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
import hashlib
test_records = []
class TestTransactionLog(unittest.TestCase):
def test_validate_chaining(self):
frappe.get_doc({
"doctype": ... | # -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
import hashlib
test_records = []
class TestTransactionLog(unittest.TestCase):
def test_validate_chaining(self):
frappe.get_doc({
"doctype": ... | mit | Python |
66d3e321951e81f69ca1bceaf72abfbf2d8063fb | Update analogInOut.py | KrempelEv/krempelair,KrempelEv/krempelair,bittracker/krempelair,bittracker/krempelair,bittracker/krempelair,KrempelEv/krempelair | krempelair/lib/bus/analogInOut.py | krempelair/lib/bus/analogInOut.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import smbus
import logging as log
class analogInOut():
def __init__(self):
self._bus = smbus.SMBus(1)
def getValue(self, address, chanel):
var = self._bus.read_i2c_block_data(address,chanel,11) #Werte von Board in 11 stelliges Array schreib... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import smbus
import logging as log
class analogInOut():
def __init__(self):
self._bus = smbus.SMBus(1)
def getValue(self, address, chanel):
var = self._bus.read_i2c_block_data(address,chanel,11) #Werte von Board in 11 stelliges Array schreib... | agpl-3.0 | Python |
40ce4e3440180446764fc1190b1cc1f7f50dede6 | modify to maintain a list of optional package names, and make the HAS_ names separately | aleksandr-bakanov/astropy,larrybradley/astropy,astropy/astropy,larrybradley/astropy,aleksandr-bakanov/astropy,saimn/astropy,pllim/astropy,mhvk/astropy,pllim/astropy,lpsinger/astropy,pllim/astropy,StuartLittlefair/astropy,larrybradley/astropy,saimn/astropy,StuartLittlefair/astropy,StuartLittlefair/astropy,pllim/astropy,... | astropy/utils/compat/optional_deps.py | astropy/utils/compat/optional_deps.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Checks for optional dependencies using lazy import from
`PEP 562 <https://www.python.org/dev/peps/pep-0562/>`_.
"""
import importlib
# TODO: This is a duplicate of the dependencies in setup.cfg "all", but some of
# the package names are different from ... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""Checks for optional dependencies using lazy import from
`PEP 562 <https://www.python.org/dev/peps/pep-0562/>`_.
"""
import importlib
__all__ = [ # noqa
'HAS_bleach', 'HAS_bottleneck', 'HAS_bs4', 'HAS_bz2', 'HAS_h5py',
'HAS_html5lib', 'HAS_IPy... | bsd-3-clause | Python |
1e996e98f29308aabc2273aa10a7afb605589d40 | Fix example input file | mpatacchiola/deepgaze | examples/ex_haar_face_detection/ex_haar_face_detection.py | examples/ex_haar_face_detection/ex_haar_face_detection.py | #!/usr/bin/env python
#The MIT License (MIT)
#Copyright (c) 2016 Massimiliano Patacchiola, 2017 Luca Surace
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
#MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN N... | #!/usr/bin/env python
#The MIT License (MIT)
#Copyright (c) 2016 Massimiliano Patacchiola, 2017 Luca Surace
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
#MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN N... | mit | Python |
f4b87fc593b8ae445924dfb5e6beaa1cd7085f78 | make normalize_dict a classmethod | bwesterb/sarah | src/dictlike.py | src/dictlike.py | import weakref
class Self(object):
def __init__(self, wrapped):
object.__setattr__(self, '_wrapped', weakref.ref(wrapped))
def __getattribute__(self, name):
object.__getattribute__(object.__getattribute__(
self, '_wrapped')(), name)
def __setattr__(self, name, value):
object.__setattr__(object.__getattribu... | import weakref
class Self(object):
def __init__(self, wrapped):
object.__setattr__(self, '_wrapped', weakref.ref(wrapped))
def __getattribute__(self, name):
object.__getattribute__(object.__getattribute__(
self, '_wrapped')(), name)
def __setattr__(self, name, value):
object.__setattr__(object.__getattribu... | agpl-3.0 | Python |
406ec27152e863ca0f232655560f30a5f0219081 | Fix tests | JamesRamm/longclaw,JamesRamm/longclaw,JamesRamm/longclaw,JamesRamm/longclaw | longclaw/longclawcheckout/forms.py | longclaw/longclawcheckout/forms.py | from django import forms
from longclaw.longclawshipping.models import ShippingRate
class CheckoutForm(forms.Form):
'''
Captures extra info required for checkout
'''
email = forms.EmailField()
shipping_option = forms.CharField(widget=forms.Select, required=False)
different_billing_address = form... | from django import forms
from longclaw.longclawshipping.models import ShippingRate
class CheckoutForm(forms.Form):
'''
Captures extra info required for checkout
'''
email = forms.EmailField()
shipping_option = forms.CharField(widget=forms.Select)
different_billing_address = forms.BooleanField(r... | mit | Python |
eb13ca2cb271e4d5261048928806cc30c154552c | bump version | frol/django-thumbnail-works,frol/django-thumbnail-works | src/thumbnail_works/__init__.py | src/thumbnail_works/__init__.py | # -*- coding: utf-8 -*-
#
# This file is part of django-thumbnail-works.
#
# django-thumbnail-works adds thumbnail support to the default ImageField.
#
# Development Web Site:
# - http://www.codetrax.org/projects/django-thumbnail-works
# Public Source Code Repository:
# - https://source.codetrax.org/hgroot/dj... | # -*- coding: utf-8 -*-
#
# This file is part of django-thumbnail-works.
#
# django-thumbnail-works adds thumbnail support to the default ImageField.
#
# Development Web Site:
# - http://www.codetrax.org/projects/django-thumbnail-works
# Public Source Code Repository:
# - https://source.codetrax.org/hgroot/dj... | apache-2.0 | Python |
6a2f0d67f6ecb9083248cf47c7d5de15b596661b | Increase timeout for installing connext from web binaries (#78) | ros2/ci,ros2/ci,ros2/ci | linux_docker_resources/rti_web_binaries_install_script.py | linux_docker_resources/rti_web_binaries_install_script.py | # Copyright 2016 Open Source Robotics Foundation, 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... | # Copyright 2016 Open Source Robotics Foundation, 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 |
e868078cfd13bd4b95f6b21e0106ccfe35ee7694 | create new language variable | praekelt/molo,praekelt/molo,praekelt/molo,praekelt/molo | molo/core/management/commands/switch_main_language.py | molo/core/management/commands/switch_main_language.py | from __future__ import absolute_import, unicode_literals
from django.core.management.base import BaseCommand
from molo.core.models import (
Languages, Main, SiteLanguage, SiteLanguageRelation, LanguageRelation)
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('new_lang... | from __future__ import absolute_import, unicode_literals
from django.core.management.base import BaseCommand
from molo.core.models import (
Languages, Main, SiteLanguage, SiteLanguageRelation, LanguageRelation)
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('new_lang... | bsd-2-clause | Python |
57c32498b5320de22c29f0181caf3e1232faa580 | move import (#26096) | Azure/azure-sdk-for-python,Azure/azure-sdk-for-python,Azure/azure-sdk-for-python,Azure/azure-sdk-for-python | sdk/identity/azure-identity/azure/identity/_internal/pipeline.py | sdk/identity/azure-identity/azure/identity/_internal/pipeline.py | # ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from azure.core.configuration import Configuration
from azure.core.pipeline import Pipeline
from azure.core.pipeline.policies import (
ContentDecodePolicy,
Custo... | # ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from azure.core.configuration import Configuration
from azure.core.pipeline import Pipeline
from azure.core.pipeline.policies import (
ContentDecodePolicy,
Custo... | mit | Python |
5fd2c5892caa9c915b8d1ff7acb9b244e378289c | Add separate | mph-/lcapy | lcapy/diffeq.py | lcapy/diffeq.py | from .expr import equation
from .nexpr import DiscreteTimeDomainExpression, nexpr
class DifferenceEquation(DiscreteTimeDomainExpression):
def __init__(self, lhs, rhs, inputsym='x', outputsym='y', **assumptions):
lhs = nexpr(lhs, **assumptions)
rhs = nexpr(rhs, **assumptions)
... | from .expr import equation
from .nexpr import DiscreteTimeDomainExpression, nexpr
class DifferenceEquation(DiscreteTimeDomainExpression):
def __init__(self, lhs, rhs, inputsym='x', outputsym='y', **assumptions):
lhs = nexpr(lhs, **assumptions)
rhs = nexpr(rhs, **assumptions)
... | lgpl-2.1 | Python |
6e268c738fef53f22cd6192ca310d33dbb9acb80 | Update Exercise2.py | arleighdickerson/HomeworkODE | Exercise2.py | Exercise2.py | '''
@author: Arleigh Dickerson
'''
import numpy as np
from matplotlib import pyplot as pl
ks = [0.01, 0.0125, 0.02, 0.025]
y0 = 0
def f(t, y):return - 100 * (y - np.cos(t)) - np.sin(t)
def forward(k): #explicit
ti = 0
yi = 0
while ti <= 1:
yield (ti, yi)
yi += k * f(ti, yi)
ti += k ... | '''
@author: Arleigh Dickerson
'''
import numpy as np
from matplotlib import pyplot as pl
ks = [0.01, 0.0125, 0.02, 0.025]
y0 = 0
h = 0.019
def F(t, y):return - 100 * (y - np.cos(t)) - np.sin(t)
def explicit(k):
ti = 0
yi = 0
while ti <= 1:
yield (ti, yi)
yi += k * F(ti, yi)
ti += k... | unlicense | Python |
e88b2a30cf49a93bfbd5307817c0a60545e168e4 | put several Chinese into serveral lines | largelymfs/word_reviewer | word_previewer.py | word_previewer.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
class WordPreviewer:
def __init__(self):
self.word={}
def load(self, filename):
self.file = filename
try:
f = open(filename,"r")
except:
print "opening "+filename+" error..."
return
content = f.read().split("\n")
nownum = ""
fo... | import sys
import os
class WordPreviewer:
def __init__(self):
self.word={}
def load(self, filename):
self.file = filename
try:
f = open(filename,"r")
except:
print "opening "+filename+" error..."
return
content = f.read().split("\n")
nownum = ""
for line in content:
if (line==""):
contin... | mit | Python |
8f61103066d81e565f42ca2540045724ce762cb5 | undo previous | luoq/pyspider,wangjun/pyspider,binux/pyspider,binux/pyspider,binux/pyspider,luoq/pyspider,wangjun/pyspider,luoq/pyspider,wangjun/pyspider | pyspider/database/mongodb/mongodbbase.py | pyspider/database/mongodb/mongodbbase.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<roy@binux.me>
# http://binux.me
# Created on 2014-11-22 20:42:01
import time
class SplitTableMixin(object):
UPDATE_PROJECTS_TIME = 10 * 60
def _collection_name(self, project):
if ... | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<roy@binux.me>
# http://binux.me
# Created on 2014-11-22 20:42:01
import time
class SplitTableMixin(object):
UPDATE_PROJECTS_TIME = 10 * 60
def _collection_name(self, project):
if ... | apache-2.0 | Python |
8d94fb1aae27e6aea444c5df7c57022147ecdcd0 | update mordor | salomanders/lf,salomanders/lf | lf/mordor.py | lf/mordor.py | import pynbody
import matplotlib.pyplot as p
import numpy as np
import customCmap as cc
import pdb
#color palette 1
color1 = (5, 16, 20)
color2 = (20, 33, 35)
color3 = (69, 88, 89)
color4 = (115, 57, 57)
color5 = (219, 134, 145)
color6 = (253, 233, 205)
cp1 = [color1, color2, color3, color4, color5, color6]
#color p... | f=pynbody.load(...)
f.physical_units()
p.gray()
#maybe
h = f.halos()
pynbody.angmom.sideon(h[1])
f.gas['smooth'] = (f.gas['mass']/f.gas['rho'])**(1,3)
my_slice = f.gas[pynbody.filt.BandPass('z',-1000,1000)]
pynbody.plot.sph.image(my_slice, width=1000, qty='temp', av_z=True)
im = pynbody.plot.sph.image(my_slice, r... | mit | Python |
c19deab3ecd6025094b203adc197916f6861edb5 | Update config checks | pratikmallya/hue,mapr/hue,todaychi/hue,dulems/hue,dulems/hue,rahul67/hue,yongshengwang/hue,pwong-mapr/private-hue,jjmleiro/hue,MobinRanjbar/hue,MobinRanjbar/hue,xiangel/hue,todaychi/hue,todaychi/hue,vmax-feihu/hue,MobinRanjbar/hue,cloudera/hue,sanjeevtripurari/hue,vmax-feihu/hue,vitan/hue,ChenJunor/hue,jayceyxc/hue,xia... | desktop/libs/liboozie/src/liboozie/conf.py | desktop/libs/liboozie/src/liboozie/conf.py | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | apache-2.0 | Python |
e770f3ab961ee974da6ef23956297272462dba11 | Add UDF rules for phillytreemap | clever-crow-consulting/otm-core,maurizi/otm-core,maurizi/otm-core,recklessromeo/otm-core,clever-crow-consulting/otm-core,clever-crow-consulting/otm-core,RickMohr/otm-core,maurizi/otm-core,recklessromeo/otm-core,recklessromeo/otm-core,maurizi/otm-core,RickMohr/otm-core,recklessromeo/otm-core,RickMohr/otm-core,RickMohr/o... | opentreemap/otm1_migrator/migration_rules/philadelphia.py | opentreemap/otm1_migrator/migration_rules/philadelphia.py | from otm1_migrator.migration_rules.standard_otm1 import MIGRATION_RULES
UDFS = {
'plot': {
'owner_additional_id': {
'udf.name': 'Owner Additional Id'
},
'owner_additional_properties': {
'udf.name': 'Owner Additional Properties'
},
'type': {
... | from otm1_migrator.migration_rules.standard_otm1 import MIGRATION_RULES
SORT_ORDER_INDEX = {
'Bucks': 3,
'Burlington': 4,
'Camden': 5,
'Chester': 6,
'Delaware': 7,
'Gloucester': 8,
'Kent': 9,
'Mercer': 10,
'Montgomery': 11,
'New Castle': 12,
'Salem': 13,
'Sussex': 14,
}
... | agpl-3.0 | Python |
ea1a6eee21370e991ca0b5027f2e3fb944b1689a | change code to count parens and increment a counter check states. | constanthatz/data-structures | proper_parens.py | proper_parens.py | #!/usr/bin/env python
from __future__ import print_function
from __future__ import unicode_literals
def safe_input(prompt):
"""Return user input after catching KeyboardInterrupt and EOFError"""
try:
reply = raw_input(prompt)
except (EOFError, KeyboardInterrupt):
quit()
else:
re... | #!/usr/bin/env python
from __future__ import print_function
from __future__ import unicode_literals
def safe_input(prompt):
"""Return user input after catching KeyboardInterrupt and EOFError"""
try:
reply = raw_input(prompt)
except (EOFError, KeyboardInterrupt):
quit()
else:
re... | mit | Python |
9504407ec30b2eb6f4550ece8bce347ceb7fb94f | Remove hardcoded references to number of bookmark fixtures | annapowellsmith/openpresc,ebmdatalab/openprescribing,annapowellsmith/openpresc,annapowellsmith/openpresc,ebmdatalab/openprescribing,annapowellsmith/openpresc,ebmdatalab/openprescribing,ebmdatalab/openprescribing | openprescribing/frontend/tests/test_bookmark_views.py | openprescribing/frontend/tests/test_bookmark_views.py | from django.test import TransactionTestCase
from django.core.urlresolvers import reverse
from frontend.models import OrgBookmark
from frontend.models import User
class TestBookmarkViews(TransactionTestCase):
fixtures = ['bookmark_alerts']
def _get_bookmark_url_for_user(self):
key = User.objects.get(... | from django.test import TransactionTestCase
from django.core.urlresolvers import reverse
from frontend.models import OrgBookmark
from frontend.models import User
class TestBookmarkViews(TransactionTestCase):
fixtures = ['bookmark_alerts']
def _get_bookmark_url_for_user(self):
key = User.objects.get(... | mit | Python |
34c0eda7aa4e99a6219f22cacbc208774e2f214d | Update clase-2.py | AnhellO/DAS_Sistemas,AnhellO/DAS_Sistemas,AnhellO/DAS_Sistemas | Ene-Jun-2019/Ejemplos/clase-2.py | Ene-Jun-2019/Ejemplos/clase-2.py | # Comentarios con hashtag :D print('Hi segunda clase!')
def ingresa_valores():
variable1 = float(input('Ingresa variable1: '))
variable2 = float(input('Ingresa variable2: '))
return [variable1, variable2]
variable1, variable2 = ingresa_valores()
while not variable2:
print('variable2 necesita ser dif... | # Comentarios con hashtag :D print('Hi segunda clase!')
def ingresa_valores():
variable1 = float(input('Ingresa variable1: '))
variable2 = float(input('Ingresa variable2: '))
return [variable1, variable2]
variable1, variable2 = ingresa_valores()
while not variable2:
print('variable2 necesita ser dif... | mit | Python |
52d8fd6b2f2d7e0d2919342382b7b84326b57dc8 | add example sketches to test sketch list | PunchThrough/PunchThrough-BEAN-Arduino-Firmware,PunchThrough/PunchThrough-BEAN-Arduino-Firmware,PunchThrough/PunchThrough-BEAN-Arduino-Firmware | tests/compile_all.py | tests/compile_all.py | #!/usr/bin/env python
"""Run all combinations of boards and test sketches."""
from glob import glob
from sys import exit
from os import environ
import subprocess
compiler_configs = [
# Adding more boards? Add them to this array:
# ['platformio', 'ci', '--board=your-board-here'],
['platformio', 'ci', '--boa... | #!/usr/bin/env python
"""Run all combinations of boards and test sketches."""
from glob import glob
from sys import exit
from os import environ
import subprocess
compiler_configs = [
# Adding more boards? Add them to this array:
# ['platformio', 'ci', '--board=your-board-here'],
['platformio', 'ci', '--boa... | lgpl-2.1 | Python |
c03e21db0611a4c9462e4229fe8568ec57b08905 | Add chebi.obo to blocklist | althonos/pronto | tests/foundrytest.py | tests/foundrytest.py | # coding: utf-8
"""
Test lots of ontologies from the OBO Foundry.
"""
OBO_CATALOG = 'http://www.obofoundry.org/registry/ontologies.jsonld'
BLOCKLIST = ('chebi.owl', 'chebi.obo', 'pr.owl')
#BLOCKLIST=[]
import json
import signal
import time
import multiprocessing
import multiprocessing.pool
import sys
import os
sys.... | # coding: utf-8
"""
Test lots of ontologies from the OBO Foundry.
"""
OBO_CATALOG = 'http://www.obofoundry.org/registry/ontologies.jsonld'
BLOCKLIST = ('chebi.owl', 'pr.owl')
#BLOCKLIST=[]
import json
import signal
import time
import multiprocessing
import multiprocessing.pool
import sys
import os
sys.path.append(o... | mit | Python |
7d147927e62b7e9f34ff4eba033a7771fa7aaa33 | Change to only create a directory if it doesn't exist already | samcheck/Scripts,samcheck/Scripts | py3/paper_dir.py | py3/paper_dir.py | #!/usr/bin/python3
# paper_dir.py - walk a given directory and 'clone' it to a new location with
# empty files
import sys
import os
import shutil
import logging
import errno
import argparse
def clone(in_path, new_path):
names = os.listdir(in_path)
if not os.path.exists(new_path): #create the path if it does... | #!/usr/bin/python3
# paper_dir.py - walk a given directory and 'clone' it to a new location with
# empty files
import sys
import os
import shutil
import logging
import errno
import argparse
def clone(in_path, new_path):
names = os.listdir(in_path)
os.makedirs(new_path)
for name in names:
in_path... | mit | Python |
e99acfd0c9c19c818f162483e11996f2d5133bcf | Bump version in devel | rackerlabs/rax-autoscaler,eljrax/rax-autoscaler | raxas/version.py | raxas/version.py | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# this file is part of 'RAX-AutoScaler'
#
# Copyright 2014 Rackspace US, 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 Licen... | # -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# this file is part of 'RAX-AutoScaler'
#
# Copyright 2014 Rackspace US, 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 Licen... | apache-2.0 | Python |
c0b09ea75f3fc491ce434e58ee5d3c06072ad288 | add warp_all example | jakevdp/spheredb | examples/warp_all.py | examples/warp_all.py | """
Warp all the LSST example exposures, saving them as warped FITS files.
This requires the LSST stack to be installed and setup: see
https://dev.lsstcorp.org/trac/wiki/Installing
After install, run the following (adapting for your install path):
source ~/LSST_STACK/loadLSST.sh
setup python
setup afw
"""
import os,... | """
Warp all the LSST example exposures, saving them as warped FITS files.
This requires the LSST stack to be installed and setup: see
https://dev.lsstcorp.org/trac/wiki/Installing
After install, run the following (adapting for your install path):
source ~/LSST_STACK/loadLSST.sh
setup python
setup afw
"""
import os,... | bsd-3-clause | Python |
6fa37effa68b3e391fe5365fc5b079cff76271ca | Update models.py | AProjectAMonth/NBLadakh,AProjectAMonth/NBLadakh | src/NBLadakh/web/models.py | src/NBLadakh/web/models.py | from django.db import models
# Create your models here.
class Image(models.Model):
code = models.CharField(max_length=50)
low_res_url = models.URLField()
embed_code = models.TextField()
@classmethod
def create(cls, code, low_res_url, embed_code):
img = cls(code=code, low_res_url=low_res_ur... | from django.db import models
# Create your models here.
class Image(models.Model):
code = models.CharField(max_length=50)
low_res_url = models.URLField()
embed_code = models.TextField()
@classmethod
def create(cls, code, low_res_url, embed_code):
img = cls(code=code, low_res_url=low_res_ur... | mit | Python |
8ced1bea7478a88b5619b774fdc52cb40e7d5883 | Update utils.py | google/vulncode-db,google/vulncode-db,google/vulncode-db,google/vulncode-db | lib/utils.py | lib/utils.py | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 | Python |
a3a3e6a27cb7973dda48e2f155971540d98a321f | simplify neighbor sum function, allow sending in max rows and columns | jeremy-miller/life-python | life/main.py | life/main.py | import logging
import numpy
from sys import exit
from life.logger import LoggerClass
class LifeClass(object):
def __init__(self, rows, columns):
self._max_rows = rows
self._max_columns = columns
self._grid = numpy.zeros((self._max_rows, self._max_columns), dtype=numpy.int)
def main(self):
self.bl... | import logging
import numpy
from sys import exit
from life.logger import LoggerClass
class LifeClass(object):
def __init__(self, size):
self._size = size
self._grid = numpy.zeros((self._size, self._size), dtype=numpy.int)
def main(self):
self.blinker()
self.run()
def blinker(self):
self._g... | mit | Python |
4e674f75e36070d4c3e75f6d36cf69f018ce7703 | test change | ak212/python-hockey-rss | pens_rss_gen.py | pens_rss_gen.py | '''
Created on Sep 24, 2014
@author: Aaron Koeppel
'''
import urllib2
from bs4 import BeautifulSoup
import sys
import re
reload(sys)
sys.setdefaultencoding("utf-8")
class GameData(object):
def __init__(self, link, headline):
self.link = link
self.headline = headline
def char_convert_link(se... | '''
Created on Sep 24, 2014
@author: Aaron Koeppel
'''
import urllib2
from bs4 import BeautifulSoup
import sys
import re
reload(sys)
sys.setdefaultencoding("utf-8")
class GameData(object):
def __init__(self, link, headline):
self.link = link
self.headline = headline
def char_convert_link(se... | mit | Python |
e087e6833b14c9cb3cc470f77d412dd414e5b9e2 | update Edinburgh import script to use morph/API data | chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations,chris48s/UK-Polling-Stations,chris48s/UK-Polling-Stations,DemocracyClub/UK-Polling-Stations | polling_stations/apps/data_collection/management/commands/import_edinburgh.py | polling_stations/apps/data_collection/management/commands/import_edinburgh.py | from data_collection.morph_importer import BaseMorphApiImporter
class Command(BaseMorphApiImporter):
srid = 4326
districts_srid = 4326
council_id = 'S12000036'
elections = ['local.city-of-edinburgh.2017-05-04']
scraper_name = 'wdiv-scrapers/DC-PollingStations-Edinburgh'
geom_type = 'geojson'
... | """
Import Edinburgh (revision 02)
"""
import shapefile, sys
from django.contrib.gis.geos import Point
from data_collection.management.commands import BaseShpStationsShpDistrictsImporter
class Command(BaseShpStationsShpDistrictsImporter):
"""
Imports the Polling Station data from Edinburgh
"""
council_... | bsd-3-clause | Python |
c54ee3e477a8974ea38de5071846f9c65e35e7de | Test that we make the right number of callback calls | dstufft/http11,dstufft/http11 | tests/test_http11.py | tests/test_http11.py | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | apache-2.0 | Python |
6280ad618a7c9b6e3863a0ec547d98df78a9c99d | check Gdk install | ponty/pyscreenshot,ponty/pyscreenshot,ponty/pyscreenshot | tests/test_pygdk3.py | tests/test_pygdk3.py | from bt import backend_to_check, check_import
from pyscreenshot.util import use_x_display
ok = False
if check_import("gi"):
if use_x_display():
import gi
# Arch: AttributeError: module 'gi' has no attribute 'require_version'
try:
gi.require_version("Gdk", "3.0")
ok ... | from bt import backend_to_check, check_import
from pyscreenshot.util import use_x_display
ok = False
if check_import("gi"):
if use_x_display():
import gi
# Arch: AttributeError: module 'gi' has no attribute 'require_version'
try:
gi.require_version
ok = True
... | bsd-2-clause | Python |
4a4a3eed7b959e342e3ff00dfc28f116158839d6 | Split up tests for Result and File | BakeCode/performance-testing,BakeCode/performance-testing | tests/test_result.py | tests/test_result.py | import unittest
from performance_testing.result import Result, File
import os
import shutil
class ResultTestCase(unittest.TestCase):
def setUp(self):
self.current_directory = os.path.dirname(os.path.abspath(__file__))
self.result_directory = os.path.join(self.current_directory, 'assets/test_result... | import unittest
from performance_testing.result import Result, File
import os
import shutil
class ResultTestCase(unittest.TestCase):
def setUp(self):
self.current_directory = os.path.dirname(os.path.abspath(__file__))
self.result_directory = os.path.join(self.current_directory, 'assets/test_result... | mit | Python |
08eca31eda0b8b801d5c02533a4ef261aaa14283 | Fix tests | flyte/pi-mqtt-gpio | tests/test_server.py | tests/test_server.py | import uuid
import mock
import pytest
from pi_mqtt_gpio import server
@mock.patch("pkg_resources.WorkingSet")
def test_imr_no_attribute(mock_ws):
"""
Should not bother looking up what's installed when there's no requirements.
"""
module = object()
server.install_missing_requirements(module)
... | import uuid
import mock
import pytest
from pip.status_codes import SUCCESS
from pi_mqtt_gpio import server
@mock.patch("pkg_resources.WorkingSet")
def test_imr_no_attribute(mock_ws):
"""
Should not bother looking up what's installed when there's no requirements.
"""
module = object()
server.inst... | mit | Python |
36c852b7bbe8ff8d46128dccd9c8f058e42aa922 | add meta.timestamp | freifunkhamburg/ffmap-backend,ffac/ffmap-backend,freifunk-fulda/ffmap-backend,FreifunkMD/ffmap-backend,ffnord/ffmap-backend,FreifunkBremen/ffmap-backend,kpcyrd/ffmap-backend,FreifunkJena/ffmap-backend,FreiFunkMuenster/ffmap-backend,FreifunkMD/ffmap-backend,rubo77/ffmap-backend,freifunk-kiel/ffmap-backend,ff-kbu/ffmap-b... | d3mapbuilder.py | d3mapbuilder.py | import json
import datetime
class D3MapBuilder:
def __init__(self, db):
self._db = db
def build(self):
output = dict()
nodes = self._db.get_nodes()
output['nodes'] = [{'name': x.name, 'id': x.id,
'macs': ', '.join(x.macs),
'geo': [float(x) for x in... | import json
class D3MapBuilder:
def __init__(self, db):
self._db = db
def build(self):
output = dict()
nodes = self._db.get_nodes()
output['nodes'] = [{'name': x.name, 'id': x.id,
'macs': ', '.join(x.macs),
'geo': [float(x) for x in x.gps.split(" "... | bsd-3-clause | Python |
d57906dfe255441461b5b6736a8e0dfc5bd027c8 | Add pop operation | nitsas/py3datastructs | dict_heap.py | dict_heap.py | """
A pseudo-heap implemented using a dictionary.
Operations:
- __len__
- insert
- pop / pop_min
- peek / find_min
- decrease_key
I use this until I find the time to implement a Fibonacci heap.
Author:
Christos Nitsas
(nitsas)
(chrisnitsas)
Language:
Python 3(.4)
Date:
August, 2014
"""
__all__ ... | """
A pseudo-heap implemented using a dictionary.
Operations:
- __len__
- insert
- pop / pop_min
- peek / find_min
- decrease_key
I use this until I find the time to implement a Fibonacci heap.
Author:
Christos Nitsas
(nitsas)
(chrisnitsas)
Language:
Python 3(.4)
Date:
August, 2014
"""
__all__ ... | mit | Python |
63ffc22836ff2c75df6c6d21acf73b69b795001e | Reduce universe size for faster transmission. | lordjabez/light-maestro,lordjabez/light-maestro,lordjabez/light-maestro,lordjabez/light-maestro | dmxusbpro.py | dmxusbpro.py | """
@copyright: 2013 Single D Software - All Rights Reserved
@summary: DMX USB Pro interface for Light Maestro.
"""
# Standard library imports
import logging
# Additional library imports
import serial
# Application imports
import console
# Named logger for this module
_logger = logging.getLogger(__name__)
_dmxhe... | """
@copyright: 2013 Single D Software - All Rights Reserved
@summary: DMX USB Pro interface for Light Maestro.
"""
# Standard library imports
import logging
# Additional library imports
import serial
# Application imports
import console
# Named logger for this module
_logger = logging.getLogger(__name__)
_dmxhe... | apache-2.0 | Python |
15e6fc7b4cdab42374e3e9173c48583d28ea9c2b | Work on actual api models | pombredanne/discern,pombredanne/discern,pombredanne/discern,pombredanne/discern | freeform_data/api.py | freeform_data/api.py | from tastypie.resources import ModelResource
from freeform_data.models import Organization, UserProfile, Course, Problem, Essay, EssayGrade
from django.contrib.auth import User
class OrganizationResource(ModelResource):
class Meta:
queryset = Organization.objects.all()
resource_name = 'organizatio... | __author__ = 'vik'
| agpl-3.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.