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 |
|---|---|---|---|---|---|---|---|---|
d6041cd673f2a5a2f62b4c9a1223dbfbd1091845 | Update main.py | 0x424D/crappy,0x424D/crappy | msort/src/main.py | msort/src/main.py | # merge sort in python 3.x.
# copyright (C) 2019 0x424D (www.github.com/0x424D)
import random
def merge(L1, L2):
ret = []
while L1 and L2:
if L1[0] <= L2[0]:
ret.append(L1[0])
L1 = L1[1:]
else:
ret.append(L2[0])
L2 = L2[1:]
while L1:
ret.append(L1[0])
L1 = L1[1:]
while L2:
ret.append(L2[... | # merge sort in python 3.x.
# copyight (C) 0x424D 2019
import random
def merge(L1, L2):
ret = []
while L1 and L2:
if L1[0] <= L2[0]:
ret.append(L1[0])
L1 = L1[1:]
else:
ret.append(L2[0])
L2 = L2[1:]
while L1:
ret.append(L1[0])
L1 = L1[1:]
while L2:
ret.append(L2[0])
L2 = L2[1:]
retu... | agpl-3.0 | Python |
b5430337a0ec4df987c7a0992dbc5a9927ed401d | update : added udp | rgombash/munin2graphite | munin2graphite.py | munin2graphite.py | #!/usr/bin/env python
from os import listdir
from os.path import isfile, join
import subprocess, re
import socket
import time
startTime = time.time()
### config
HOSTNAME = socket.gethostname()
MUNIN_RUN_PATH = "/usr/sbin/munin-run" # path to muni-run executable
MUNIN_PLUGINS_PATH = "/etc/munin/plugins" # path to ... | #!/usr/bin/env python
from datetime import datetime, time
from os import listdir
from os.path import isfile, join
import subprocess, glob, re
import socket
import time
startTime = time.time()
### config
HOSTNAME = socket.gethostname()
MUNIN_RUN_PATH = "/usr/sbin/munin-run" # path to muni-run executable
MUNIN_PLU... | apache-2.0 | Python |
45afe2b68b37db594c553f052fccf22accde0362 | support multiple domains | btmorex/fabric_ubuntu | fabric_ubuntu/letsencrypt.py | fabric_ubuntu/letsencrypt.py | from fabric.api import run, settings, task
from fabric.contrib.files import sed
from . import apt
@task
def ensure():
with settings(user='root'):
apt.add_repository('ppa:certbot/certbot')
apt.ensure('certbot')
sed('/etc/cron.d/certbot',
'certbot -q renew',
'certbot ... | from fabric.api import run, settings, task
from fabric.contrib.files import sed
from . import apt
@task
def ensure():
with settings(user='root'):
apt.add_repository('ppa:certbot/certbot')
apt.ensure('certbot')
sed('/etc/cron.d/certbot',
'certbot -q renew',
'certbot ... | mit | Python |
4a49f07ec79396dbfa709fd8fe4e689474a57f2e | Modify the service class | KostasMp/PortScanner | source/netstructs.py | source/netstructs.py | import socket
class Port:
"""Represents a port by storing its number and its type"""
def __init__(self, port_num, port_type): # The constructor of the class
self.num = port_num
self.protocol = port_type
class Service:
"""Represents a network service associated with a port"""
def __init__(self, port): ... | import socket
class Port:
"""Represents a port by storing its number and its type"""
def __init__(self, port_num, port_type): # The constructor of the class
self.num = port_num
self.protocol = port_type
class Service:
"""Represents a network service associated with a port"""
def __init__(self, port): ... | mit | Python |
89ca98523c81787d42c059d7dab2d282a7b3d887 | remove unused exception variable | disqus/nexus,disqus/nexus,blueprinthealth/nexus,roverdotcom/nexus,YPlan/nexus,disqus/nexus,roverdotcom/nexus,blueprinthealth/nexus,blueprinthealth/nexus,brilliant-org/nexus,brilliant-org/nexus,roverdotcom/nexus,YPlan/nexus,YPlan/nexus,graingert/nexus,brilliant-org/nexus,graingert/nexus,graingert/nexus | nexus/__init__.py | nexus/__init__.py | """
Nexus
~~~~~
"""
try:
VERSION = __import__('pkg_resources') \
.get_distribution('nexus').version
except Exception:
VERSION = 'unknown'
# XXX: code based on django.contrib.admin auto discovery
from nexus.sites import NexusSite, site
from nexus.modules import NexusModule
__all__ = ('autodiscover', ... | """
Nexus
~~~~~
"""
try:
VERSION = __import__('pkg_resources') \
.get_distribution('nexus').version
except Exception as e:
VERSION = 'unknown'
# XXX: code based on django.contrib.admin auto discovery
from nexus.sites import NexusSite, site
from nexus.modules import NexusModule
__all__ = ('autodiscov... | apache-2.0 | Python |
6959a32a8dd6dd0397e8fd0d37509c4089de07b9 | use full cid_url to display | materialsproject/MPContribs,materialsproject/MPContribs,materialsproject/MPContribs,materialsproject/MPContribs | dtu/rest/rester.py | dtu/rest/rester.py | from __future__ import division, unicode_literals
from mpcontribs.rest.rester import MPContribsRester
from mpcontribs.io.archieml.mpfile import MPFile
from pandas import DataFrame
class DtuRester(MPContribsRester):
"""DTU-specific convenience functions to interact with MPContribs REST interface"""
dtu_query = ... | from __future__ import division, unicode_literals
from mpcontribs.rest.rester import MPContribsRester
from mpcontribs.io.archieml.mpfile import MPFile
from pandas import DataFrame
class DtuRester(MPContribsRester):
"""DTU-specific convenience functions to interact with MPContribs REST interface"""
dtu_query = ... | mit | Python |
f512ad4a36b3b6b9352c453a434cb2e02108af51 | Use home folder | nikolas-hermanns/flash-test | flash_test/utils/ssh_util.py | flash_test/utils/ssh_util.py | '''
Created on Mar 14, 2016
@author: enikher
'''
TMP_SSH_CONFIG = "/tmp/flash_test_ssh_config"
import os
class SshUtil(object):
@staticmethod
def gen_ssh_config(node_list):
config = ["UserKnownHostsFile=/dev/null",
"StrictHostKeyChecking=no",
"ForwardAgent yes",
... | '''
Created on Mar 14, 2016
@author: enikher
'''
TMP_SSH_CONFIG = "/tmp/flash_test_ssh_config"
class SshUtil(object):
@staticmethod
def gen_ssh_config(node_list):
config = ["UserKnownHostsFile=/dev/null",
"StrictHostKeyChecking=no",
"ForwardAgent yes",
... | apache-2.0 | Python |
31971075135e348145142d0093c06e425366b2e8 | Remove erroneous bracket from audit log message | matthew-shaw/thing-api | flask_skeleton_api/config.py | flask_skeleton_api/config.py | import os
# RULES OF CONFIG:
# 1. No region specific code. Regions are defined by setting the OS environment variables appropriately to build up the
# desired behaviour.
# 2. No use of defaults when getting OS environment variables. They must all be set to the required values prior to the
# app starting.
# 3. This is t... | import os
# RULES OF CONFIG:
# 1. No region specific code. Regions are defined by setting the OS environment variables appropriately to build up the
# desired behaviour.
# 2. No use of defaults when getting OS environment variables. They must all be set to the required values prior to the
# app starting.
# 3. This is t... | mit | Python |
dc268b6f1c1b69bb9c851b533661579852299e69 | Fix terminator plugin | python-visualization/folium,python-visualization/folium,ocefpaf/folium,ocefpaf/folium | folium/plugins/terminator.py | folium/plugins/terminator.py | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
from branca.element import Figure, JavascriptLink, MacroElement
from jinja2 import Template
class Terminator(MacroElement):
"""
Leaflet.Terminator is a simple plug-in to the Leaflet library to
overlay day and nig... | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
from branca.element import Figure, JavascriptLink, MacroElement
from jinja2 import Template
class Terminator(MacroElement):
"""
Leaflet.Terminator is a simple plug-in to the Leaflet library to
overlay day and nig... | mit | Python |
a89ebe212ca313faf1e3dba5275b8eaba89c0206 | refactor sensor | stephen-allison/pibot | distance_sensor.py | distance_sensor.py | # CamJam EduKit 3 - Robotics
# Worksheet 6 – Measuring Distance
import RPi.GPIO as GPIO # Import the GPIO Library
import time # Import the Time library
# Set the GPIO modes
def measureDistance():
# Set trigger to False (Low)
GPIO.output(pinTrigger, False)
# Allow module to settle
time.sleep(0.5)
#... | # CamJam EduKit 3 - Robotics
# Worksheet 6 – Measuring Distance
import RPi.GPIO as GPIO # Import the GPIO Library
import time # Import the Time library
# Set the GPIO modes
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
# Define GPIO pins to use on the Pi
pinTrigger = 17
pinEcho = 18
print("Ultrasonic Measurement")
#... | cc0-1.0 | Python |
1e3c3934bda6625d381599d2d373087733235c91 | Bump version number for Django 1.0 release | bfirsh/django-old,bfirsh/django-old,django-nonrel/django-nonrel,alex/django-old,sam-tsai/django-old,t11e/django,mitsuhiko/django,disqus/django-old,dcramer/django-compositepks,Instagram/django,mitsuhiko/django,sam-tsai/django-old,Smarsh/django,skevy/django,django-nonrel/django-nonrel,jamespacileo/django-france,dcramer/d... | django/__init__.py | django/__init__.py | VERSION = (1, 0, 'final')
def get_version():
"Returns the version as a human-format string."
v = '.'.join([str(i) for i in VERSION[:-1]])
if VERSION[-1]:
from django.utils.version import get_svn_revision
v = '%s-%s-%s' % (v, VERSION[-1], get_svn_revision())
return v
| VERSION = (1, 0, 'rc_1')
def get_version():
"Returns the version as a human-format string."
v = '.'.join([str(i) for i in VERSION[:-1]])
if VERSION[-1]:
from django.utils.version import get_svn_revision
v = '%s-%s-%s' % (v, VERSION[-1], get_svn_revision())
return v
| bsd-3-clause | Python |
a1168069f9fc94d1819486149417e13f251d13a5 | Rename check_path_exists() signature | lozadaOmr/ansible-admin,lozadaOmr/ansible-admin,lozadaOmr/ansible-admin | src/ansible/forms.py | src/ansible/forms.py | from django.conf import settings
from django.core.validators import ValidationError
from django.forms import ModelForm
from ansible.models import Playbook
import os
def check_path_exists(path, host_inventory=None):
if host_inventory:
print '*'
print host_inventory
print '*'
os.chdi... | from django.conf import settings
from django.core.validators import ValidationError
from django.forms import ModelForm
from ansible.models import Playbook
import os
def check_path_exists(path, file=None):
if file:
os.chdir(settings.PLAYBOOK_DIR + path)
current_dir = os.getcwd()
return os.p... | bsd-3-clause | Python |
2d001c7cc6637c8b47ad45cac8630459b3d40b05 | Save Form Wizard data | lozadaOmr/ansible-admin,lozadaOmr/ansible-admin,lozadaOmr/ansible-admin | src/ansible/views.py | src/ansible/views.py | from django.shortcuts import get_object_or_404, render
from django.http import HttpResponseRedirect, HttpResponse
from formtools.wizard.views import SessionWizardView
from ansible.models import Github
def index(request):
return HttpResponse("200")
class PlaybookWizard(SessionWizardView):
def get_form_initial(... | from django.shortcuts import get_object_or_404, render
from django.http import HttpResponseRedirect, HttpResponse
from formtools.wizard.views import SessionWizardView
from ansible.models import Github
def index(request):
return HttpResponse("200")
class PlaybookWizard(SessionWizardView):
instance = None
... | bsd-3-clause | Python |
c60097d0b7d6ce7a0954cd9557c5a74b8a2c9869 | remove BeautifulSoup import | Heufneutje/PyMoronBot,MatthewCox/PyMoronBot,DesertBot/DesertBot | Functions/Gif.py | Functions/Gif.py | '''
Created on Dec 05, 2013
@author: Tyranic-Moron
'''
from IRCMessage import IRCMessage
from IRCResponse import IRCResponse, ResponseType
from Function import Function
import GlobalVars
import re
import WebUtils
class Instantiate(Function):
Help = 'gif - fetches a random gif posted during Desert Bus'
... | '''
Created on Dec 05, 2013
@author: Tyranic-Moron
'''
from IRCMessage import IRCMessage
from IRCResponse import IRCResponse, ResponseType
from Function import Function
import GlobalVars
import re
import WebUtils
from bs4 import BeautifulSoup
class Instantiate(Function):
Help = 'gif - fetches a random gif po... | mit | Python |
c157ddeae7131e4141bca43857730103617b42c4 | Make guid required in upload API | stefanw/froide,fin/froide,fin/froide,stefanw/froide,stefanw/froide,fin/froide,stefanw/froide,fin/froide,stefanw/froide | froide/upload/serializers.py | froide/upload/serializers.py | from rest_framework import serializers
from .models import Upload
class UploadSerializer(serializers.ModelSerializer):
class Meta:
model = Upload
fields = '__all__'
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['guid'].required = True
| from rest_framework import serializers
from .models import Upload
class UploadSerializer(serializers.ModelSerializer):
class Meta:
model = Upload
fields = '__all__'
| mit | Python |
1d32debc1ea2ce8d11c8bc1abad048d6e4937520 | Fix non-iobj campaign request connection | okfde/froide-campaign,okfde/froide-campaign,okfde/froide-campaign | froide_campaign/listeners.py | froide_campaign/listeners.py | from asgiref.sync import async_to_sync
from channels.layers import get_channel_layer
from .consumers import PRESENCE_ROOM
from .models import Campaign
def connect_info_object(sender, **kwargs):
reference = kwargs.get('reference')
if not reference:
return
if not reference.startswith('campaign:'):
... | from asgiref.sync import async_to_sync
from channels.layers import get_channel_layer
from .consumers import PRESENCE_ROOM
from .models import Campaign
def connect_info_object(sender, **kwargs):
reference = kwargs.get('reference')
if not reference:
return
if not reference.startswith('campaign:'):
... | mit | Python |
80cf47e229cae248ee9b8cdb8d28d6206f8db3b0 | Remove unused imports | JioCloud/python-glanceclient,alexpilotti/python-glanceclient,klmitch/python-glanceclient,mmasaki/python-glanceclient,mmasaki/python-glanceclient,varunarya10/python-glanceclient,openstack/python-glanceclient,JioCloud/python-glanceclient,alexpilotti/python-glanceclient,varunarya10/python-glanceclient,openstack/python-gla... | doc/source/conf.py | doc/source/conf.py | # -*- coding: utf-8 -*-
#
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__),
'..', '..')))
# -- General configuration ----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions ... | # -*- coding: utf-8 -*-
#
import os
import sys
import pbr.version
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__),
'..', '..')))
# -- General configuration ----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They c... | apache-2.0 | Python |
0f1e02a6796da83a3b3bf4185bf067d3fa31113d | fix style error | ChuyuHsu/ScalaFunctional,EntilZha/ScalaFunctional,EntilZha/PyFunctional,EntilZha/ScalaFunctional,ChuyuHsu/ScalaFunctional,EntilZha/PyFunctional,lucidfrontier45/ScalaFunctional,lucidfrontier45/ScalaFunctional | functional/test/test_util.py | functional/test/test_util.py | import unittest
from ..util import LazyFile
class TestUtil(unittest.TestCase):
def test_lazy_file(self):
license_file = LazyFile('LICENSE.txt')
self.assertTrue(license_file.file is None)
iter(license_file)
handle_0 = license_file.file
iter(license_file)
handle_1 = l... | import unittest
from ..util import LazyFile
class TestUtil(unittest.TestCase):
def test_lazy_file(self):
file = LazyFile('LICENSE.txt')
self.assertTrue(file.file is None)
iter(file)
handle_0 = file.file
iter(file)
handle_1 = file.file
self.assertTrue(handle_... | mit | Python |
1d883bb450e8d784d89a6bdb4c65d0cc2a72614b | Update version | Yubico/yubikey-manager,Yubico/yubikey-manager | ykman/__init__.py | ykman/__init__.py | # Copyright (c) 2015 Yubico AB
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditi... | # Copyright (c) 2015 Yubico AB
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditi... | bsd-2-clause | Python |
83bc5fbaff357b43c49f948ec685e7ab067b8f78 | Change URL pattern for airport list. | stephenmcd/ratemyflight,stephenmcd/ratemyflight | core/urls.py | core/urls.py |
from django.conf.urls.defaults import *
urlpatterns = patterns("core.views",
url("^airport/list/(?P<south>.*)/(?P<west>.*)/(?P<north>.*)/(?P<east>.*)/",
"airports_for_boundary", name="airports_for_boundary"),
)
|
from django.conf.urls.defaults import *
urlpatterns = patterns("core.views",
url("^airport_list/(?P<south>.*)/(?P<west>.*)/(?P<north>.*)/(?P<east>.*)/",
"airports_for_boundary", name="airports_for_boundary"),
)
| bsd-2-clause | Python |
9b159f078475b1a091aef3527619698231694e6d | update admin | Krozark/Kraggne,Krozark/Kraggne,Krozark/Kraggne | Kraggne/admin.py | Kraggne/admin.py | # -*- coding: utf-8 -*-
from django.contrib import admin
from Kraggne.forms import MenuItemForm
from Kraggne.models import MenuItem, PageBlock
from django.conf import settings
if 'grappellifit' in settings.INSTALLED_APPS and 'modeltranslation' in settings.INSTALLED_APPS:
from grappellifit.admin import Translation... | # -*- coding: utf-8 -*-
from django.contrib import admin
from Kraggne.forms import MenuItemForm
from Kraggne.models import MenuItem, PageBlock
from django.conf import settings
if 'grappellifit' in settings.INSTALLED_APPS and 'modeltranslation' in settings.INSTALLED_APPS:
from grappellifit.admin import Translation... | bsd-2-clause | Python |
4c4a31b0a03649dd0ed7dfed63a4af9a75cfb000 | Update admin to use apiary as the root url | UrbanCCD-UChicago/plenario,UrbanCCD-UChicago/plenario,UrbanCCD-UChicago/plenario | plenario/admin/admin.py | plenario/admin/admin.py | from flask_admin import Admin
admin = Admin(
name='Plenario',
template_mode='bootstrap3',
url='/apiary'
) | from flask import request, url_for, redirect
from flask_admin import Admin, helpers as admin_helpers, AdminIndexView
from flask_admin.contrib.sqla import ModelView
from flask_security import current_user
from flask_security import UserMixin, RoleMixin, login_required
from flask_security.utils import encrypt_password
... | mit | Python |
4fc59b92dd937ed32f5a6eb6a083a8aa7ba841b2 | install from project.pbt dependencies into deps | pebete/pbt,pebete/pbt | plugins/install/main.py | plugins/install/main.py | import pbt
import sys
import os
@pbt.command(name="install")
def install(ctx, args, project):
"""
Works as a wrapper for pip, with some sugar
"""
try:
import pip
except ImportError:
print("You need pip in order to use install, please see "
"http://www.pip-installer.o... | import pbt
import sys
import os
@pbt.command(name="install")
def install(ctx, args, project):
"""
Works as a wrapper for pip, with some sugar
"""
try:
import pip
except ImportError:
print("You need pip in order to use install, please see "
"http://www.pip-installer.o... | apache-2.0 | Python |
5f8dea0ae81cff1f79b8bda6f5d360c5f5b73ed3 | Include metatests from scripted.py. | dimagi/rapidsms,lsgunth/rapidsms,ehealthafrica-ci/rapidsms,unicefuganda/edtrac,lsgunth/rapidsms,ehealthafrica-ci/rapidsms,lsgunth/rapidsms,peterayeni/rapidsms,ken-muturi/rapidsms,catalpainternational/rapidsms,caktus/rapidsms,peterayeni/rapidsms,eHealthAfrica/rapidsms,ehealthafrica-ci/rapidsms,eHealthAfrica/rapidsms,dim... | lib/rapidsms/tests/runtests.py | lib/rapidsms/tests/runtests.py | #!/usr/bin/python
from test_component import *
from test_config import*
from test_log import *
from test_message import *
from test_app import *
from test_backend import *
from test_backend_irc import *
from test_backend_spomc import *
from test_router import *
from scripted import MockTestScript
if __name__ == "__m... | #!/usr/bin/python
from test_component import *
from test_config import*
from test_log import *
from test_message import *
from test_app import *
from test_backend import *
from test_backend_irc import *
from test_backend_spomc import *
from test_router import *
if __name__ == "__main__":
print "(some tests may p... | bsd-3-clause | Python |
f6207959ee8beb07aafaab8b1eb93bd4def9bde8 | fix wolframalpha scraping | rmmh/skybot,TeamPeggle/ppp-helpdesk,Jeebeevee/DouweBot_JJ15,SophosBlitz/glacon,Jeebeevee/DouweBot,elitan/mybot,cmarguel/skybot,callumhogsden/ausbot,craisins/nascarbot,Teino1978-Corp/Teino1978-Corp-skybot,ddwo/nhl-bot,jmgao/skybot,isislab/botbot,craisins/wh2kbot,crisisking/skybot,andyeff/skybot,olslash/skybot,df-5/skybo... | plugins/wolframalpha.py | plugins/wolframalpha.py | import re
from util import hook, http
@hook.command('wa')
@hook.command
def wolframalpha(inp):
".wa/.wolframalpha <query> -- scrapes Wolfram Alpha's" \
"results for <query>"
url = "http://www.wolframalpha.com/input/?asynchronous=false"
h = http.get_html(url, i=inp)
pods = h.xpath("//di... | import re
from util import hook, http
@hook.command('wa')
@hook.command
def wolframalpha(inp):
".wa/.wolframalpha <query> -- scrapes Wolfram Alpha's" \
"results for <query>"
url = "http://www.wolframalpha.com/input/?asynchronous=false"
h = http.get_html(url, i=inp)
pods = h.xpath("//di... | unlicense | Python |
3b6ae5d49aa179ccba0b3b6d47ec3fa5bd5835a2 | Fix raw snippet conversion | SublimeText/AAAPackageDev,SublimeText/AAAPackageDev,SublimeText/PackageDev | plugins_/snippet_dev.py | plugins_/snippet_dev.py | from xml.etree import ElementTree as ET
import sublime_plugin
from .lib.sublime_lib.view import has_file_ext, get_text, clear
from .lib import syntax_paths
__all__ = (
'PackagedevSnippetFromRawSnippetCommand',
'PackagedevRawSnippetFromSnippetCommand',
)
PACKAGE_NAME = __package__.split(".")[0]
SNIPPET_PATH ... | from xml.etree import ElementTree as ET
import sublime_plugin
from .lib.sublime_lib.view import has_file_ext, get_text, clear
from .lib import syntax_paths
__all__ = (
'PackagedevSnippetFromRawSnippetCommand',
'PackagedevRawSnippetFromSnippetCommand',
)
PACKAGE_NAME = __package__.split(".")[0]
SNIPPET_PATH ... | mit | Python |
6ceafca9067e449f4f909784df6e05cdbc211dda | Add check that latex is installed and findable. If not skip the test. | timj/scons,timj/scons,timj/scons,timj/scons,timj/scons,timj/scons,timj/scons,timj/scons,timj/scons | test/TEX/subdir-as-include.py | test/TEX/subdir-as-include.py | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | mit | Python |
de1ff8a480cc6d6e86bb179e6820ab9f21145679 | Allow to provide a custom `occurred_at` value when building a user event | homeworkprod/byceps,m-ober/byceps,m-ober/byceps,m-ober/byceps,homeworkprod/byceps,homeworkprod/byceps | byceps/services/user/event_service.py | byceps/services/user/event_service.py | """
byceps.services.user.event_service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2018 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from datetime import datetime
from typing import Optional, Sequence
from ...database import db
from ...typing import UserID
from .models.event imp... | """
byceps.services.user.event_service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2018 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from datetime import datetime
from typing import Sequence
from ...database import db
from ...typing import UserID
from .models.event import UserEv... | bsd-3-clause | Python |
d5ebc54d2a012dddb5be0a7370fc38eb8446b306 | Update Tagbar git repository URL | vimwiki/utils,vimwiki/utils | vwtags.py | vwtags.py | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import print_function
help_text = """
Extracts tags from Vimwiki files. Useful for the Tagbar plugin.
Usage:
Install Tagbar (https://github.com/preservim/tagbar/). Then, put this file
anywhere and add the following to your .vimrc:
let g:tagbar_type_vim... | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import print_function
help_text = """
Extracts tags from Vimwiki files. Useful for the Tagbar plugin.
Usage:
Install Tagbar (http://majutsushi.github.io/tagbar/). Then, put this file
anywhere and add the following to your .vimrc:
let g:tagbar_type_vimw... | mit | Python |
65d69dc92f6485dcd293462d3face00b934fb829 | Update webapp.py | sky-adams/Practice-for-DSW,sky-adams/Practice-for-DSW,sky-adams/Practice-for-DSW | webapp.py | webapp.py | from flask import Flask, url_for, render_template
app = Flask(__name__) #__name__ = "__main__" if this is the file that was run. Otherwise, it is the name of the file (ex. webapp)
@app.route("/")
def render_main():
return render_template('home.html')
@app.route("/page1")
def render_page1():
return render_te... | from flask import Flask, url_for, render_template
app = Flask(__name__) #__name__ = "__main__" if this is the file that was run. Otherwise, it is the name of the file (ex. webapp)
@app.route("/")
def render_main():
return render_template('home.html')
@app.route("/page1")
def render_main():
return render_tem... | mit | Python |
c2c1e4f7a716d888af2305ecde51b67c06737348 | Remove default setting redefinition. | ryankask/django-discoverage,ryankask/django-discoverage | test_project/todo/settings.py | test_project/todo/settings.py | import os
import sys
DEBUG = True
TEMPLATE_DEBUG = DEBUG
PROJECT_ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__),
os.pardir))
sys.path.insert(0, os.path.realpath(os.path.join(PROJECT_ROOT, 'apps')))
DATABASES = {
'default': {
'ENGINE': 'django.d... | import os
import sys
DEBUG = True
TEMPLATE_DEBUG = DEBUG
PROJECT_ROOT = os.path.realpath(os.path.join(os.path.dirname(__file__),
os.pardir))
sys.path.insert(0, os.path.realpath(os.path.join(PROJECT_ROOT, 'apps')))
DATABASES = {
'default': {
'ENGINE': 'django.d... | bsd-2-clause | Python |
2c37848083016893adda5a8dd2775d0a3e8f6022 | Fix a typo | raviqqe/tensorflow-extenteten,raviqqe/tensorflow-extenteten | nn/linear.py | nn/linear.py | import tensorflow as tf
def linear(x, output_layer_size, regularizer_scale=1e-8):
return tf.contrib.layers.fully_connected(
x,
output_layer_size,
activation_fn=tf.nn.elu,
weight_regularizer=tf.contrib.layers.l2_regularizer(regularizer_scale),
)
| import tensorflow as tf
def linear(x, output_layer_size, regularizer_scale=1e-8):
return tf.contrib.layers.fully_connected(
x,
output_layer_size,
activation_fn=tf.elu,
weight_regularizer=tf.contrib.layers.l2_regularizer(regularizer_scale),
)
| unlicense | Python |
e4b2d60af93fd84407eb7107497b2b500d79f9d7 | Add a passing test for equality. | jwg4/qual,jwg4/calexicon | calexicon/dates/tests/test_distant.py | calexicon/dates/tests/test_distant.py | import unittest
from datetime import date as vanilla_date, timedelta
from calexicon.calendars import ProlepticJulianCalendar
from calexicon.dates import DateWithCalendar, DistantDate
class TestDistantDate(unittest.TestCase):
def test_subtraction(self):
dd = DistantDate(10000, 1, 1)
self.assertIs... | import unittest
from datetime import date as vanilla_date, timedelta
from calexicon.dates import DistantDate
class TestDistantDate(unittest.TestCase):
def test_subtraction(self):
dd = DistantDate(10000, 1, 1)
self.assertIsInstance(dd - vanilla_date(9999, 1, 1), timedelta)
self.assertIsIn... | apache-2.0 | Python |
9d3d835a64407f60a1c5f3fb2c7e1390513a6841 | Bump Version 0.5.1 | douban/libmc,douban/libmc,mckelvin/libmc,lihuanshuai/libmc,mckelvin/libmc,douban/libmc,douban/libmc,mckelvin/libmc,douban/libmc,lihuanshuai/libmc,lihuanshuai/libmc,mckelvin/libmc,mckelvin/libmc | libmc/__init__.py | libmc/__init__.py | from ._client import (
PyClient, ThreadUnsafe,
encode_value,
MC_DEFAULT_EXPTIME,
MC_POLL_TIMEOUT,
MC_CONNECT_TIMEOUT,
MC_RETRY_TIMEOUT,
MC_HASH_MD5,
MC_HASH_FNV1_32,
MC_HASH_FNV1A_32,
MC_HASH_CRC_32,
MC_RETURN_SEND_ERR,
MC_RETURN_RECV_ERR,
MC_RETURN_CONN_POLL_ERR,
... | from ._client import (
PyClient, ThreadUnsafe,
encode_value,
MC_DEFAULT_EXPTIME,
MC_POLL_TIMEOUT,
MC_CONNECT_TIMEOUT,
MC_RETRY_TIMEOUT,
MC_HASH_MD5,
MC_HASH_FNV1_32,
MC_HASH_FNV1A_32,
MC_HASH_CRC_32,
MC_RETURN_SEND_ERR,
MC_RETURN_RECV_ERR,
MC_RETURN_CONN_POLL_ERR,
... | bsd-3-clause | Python |
ad5643dfcf67811576ba565225e81d4e95adbfc5 | add SVM | frankdede/CMPUT466Project,frankdede/CMPUT466Project | SVM/SVM.py | SVM/SVM.py | from sklearn import svm
import numpy as nu
class SVM:
x=[]
y=[]
clf = None
def __init__(self,filename):
with open(filename) as f:
for line in f:
if(line[0]>='0' and line[0]<='9'):
#print(line)
tmp = line.strip('\n').split(',')
tmp = map(lambda x:float(x),tmp)
self.x.append(tmp[:-1])
... | from sklearn import svm
x= [[0,0],[1,2]]
y = [0,1]
clf = svm.SVC()
clf.fit(x,y)
clf.predict([[2,2]]) | apache-2.0 | Python |
cde7ae43e31b1eaa3f5ee41defa51bae5a55f5d8 | Update execute.py | bimgissql/Python | Redis/execute.py | Redis/execute.py | import redis
import yaml
# Get database connection information from YML file
with open("redis.yml", 'r') as stream:
config = yaml.load(stream)
# Parse connection data
redishost = config[':host']
redisport = config[':port']
redisdb = config[':db']
# Redis connection pool
pool = redis.ConnectionPool(... | import redis
# Redis host server address
redishost = '192.168.55.181'
# Redis port number on host server
redisport = 6379
# Number of database on Redis server
redisdb = 0
# Redis connection pool
pool = redis.ConnectionPool(host=redishost, port=redisport, db=redisdb)
# Redis database
db = redis.Redis... | mit | Python |
e764c097ada66908806f33cb1e9005bbc6b87f0b | print function now works. | jvasilakes/txtsh | command_subshell.py | command_subshell.py | import subprocess
import pager
from header import *
from dict_methods import getMaxKey
def _drop(*args):
return STOP
def _print(*args):
text_object = args[0]
if len(sorted(text_object.words.keys())) > 300:
pager.page(text_object.contents)
else:
print text_object.contents
re... | import subprocess
import pager
from header import *
from dict_methods import getMaxKey
def _drop(*args):
return STOP
def _print(*args):
text_object = args[0]
pager.page(text_object.contents)
return GO
def _words(*args):
text_object = args[0]
if not text_object.words:
print "T... | mit | Python |
2116090c10138c7b1a597918762263078778c168 | Test insertion with custom key | lonewolf07/coala,Tanmay28/coala,aptrishu/coala,MattAllmendinger/coala,saurabhiiit/coala,SambitAcharya/coala,rimacone/testing2,aptrishu/coala,Asnelchristian/coala,ManjiriBirajdar/coala,ayushin78/coala,Asalle/coala,yashtrivedi96/coala,coala/coala,yashLadha/coala,Nosferatul/coala,JohnS-01/coala,MariosPanag/coala,NalinG/co... | coalib/tests/settings/SettingsTest.py | coalib/tests/settings/SettingsTest.py | """
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT... | """
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT... | agpl-3.0 | Python |
8f3b4a1b03f2171e04f9cfb87405c474ae379b81 | Create 2017-06-05_sudokus_correctos.py | israelem/aceptaelreto,israelem/aceptaelreto | codes/2017-06-05_sudokus_correctos.py | codes/2017-06-05_sudokus_correctos.py | # Comprobar sudoku leído desde teclado
def f_leer_sudoku():
r_sudoku = []
for iteracion in range(9):
l_str = str(input()).split(' ')
r_sudoku.append([int(x) for x in l_str])
return r_sudoku
def f_comprobar_linea(p_linea):
return list(range(1, 10)) == sorted(p_linea)
if __n... | # Comprobar sudoku leído desde teclado
def f_leer_sudoku():
r_sudoku = []
# f = open("sudoku.txt", "r")
for iteracion in range(9):
# l_str = f.readline().split(' ')
l_str = str(input()).split(' ')
r_sudoku.append([int(x) for x in l_str])
# f.close()
return r_sudoku
... | mit | Python |
6ff6a3147ae672bb341f240622c9f4a948d32930 | remove use of assert | stackforge/ooi,openstack/ooi | ooi/utils.py | ooi/utils.py | # -*- coding: utf-8 -*-
# Copyright 2015 Spanish National Research Council
# Copyright 2015 LIP - INDIGO-DataCloud
#
# 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.... | # -*- coding: utf-8 -*-
# Copyright 2015 Spanish National Research Council
# Copyright 2015 LIP - INDIGO-DataCloud
#
# 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.... | apache-2.0 | Python |
54ac0f053174d2aa49c92c0f34a48c0769c48a82 | bump version | looker-open-source/looker_deployer | looker_deployer/__version__.py | looker_deployer/__version__.py | __version__ = "0.2.1"
| __version__ = "0.2.0"
| apache-2.0 | Python |
02c49d323bc43ae625b1498e285c74bc7f29bed4 | fix pep8 | akretion/connector-magento,akretion/connector-magento | magentoerpconnect/exception.py | magentoerpconnect/exception.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | agpl-3.0 | Python |
82abce5651866eed2eb4fee8a15a6d2470b1c89c | Install adal on Ubuntu | Azure/azure-linux-extensions,andyliuliming/azure-linux-extensions,bpramod/azure-linux-extensions,jasonzio/azure-linux-extensions,bpramod/azure-linux-extensions,bpramod/azure-linux-extensions,andyliuliming/azure-linux-extensions,bpramod/azure-linux-extensions,varunkumta/azure-linux-extensions,Azure/azure-linux-extension... | VMEncryption/main/patch/UbuntuPatching.py | VMEncryption/main/patch/UbuntuPatching.py | #!/usr/bin/python
#
# Copyright 2015 Microsoft Corporation
#
# 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... | #!/usr/bin/python
#
# Copyright 2015 Microsoft Corporation
#
# 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... | apache-2.0 | Python |
1f2d8fadd114106cefbc23060f742163be415376 | Use __all__ to avoid linter errors | Safihre/cherrypy,Safihre/cherrypy,cherrypy/cherrypy,cherrypy/cherrypy | cherrypy/process/__init__.py | cherrypy/process/__init__.py | """Site container for an HTTP server.
A Web Site Process Bus object is used to connect applications, servers,
and frameworks with site-wide services such as daemonization, process
reload, signal handling, drop privileges, PID file management, logging
for all of these, and many more.
The 'plugins' module defines a few... | """Site container for an HTTP server.
A Web Site Process Bus object is used to connect applications, servers,
and frameworks with site-wide services such as daemonization, process
reload, signal handling, drop privileges, PID file management, logging
for all of these, and many more.
The 'plugins' module defines a few... | bsd-3-clause | Python |
a849d4edcd6584b78a5caa2362a6c7e97acbbb43 | test hadoop.install | kjtanaka/fabric_hadoop | fabfile/hadoop.py | fabfile/hadoop.py | #!/usr/bin/env python
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
import yaml
from fabric.api import task, run, sudo, put, task, \
parallel, execute, env
from cuisine import file_exists
@task
def install():
yml_path = __file__.replace('fabfile','ymlfile').rstrip(r'\py|\pyc') + 'yml'
f = o... | #!/usr/bin/env python
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
import yaml
from fabric.api import task, run, sudo, put, task, \
parallel, execute, env
from cuisine import file_exists
@task
def install():
yml_path = __file__.replace('fabfile','ymlfile').rstrip(r'\py|\pyc') + 'yml'
f = o... | mit | Python |
9deef39639bd42d6a6c91f6aafdf8e92a73a605d | Fix super() call (properly) for py2.7 | ZedThree/fort_depend.py,ZedThree/fort_depend.py | fortdepend/preprocessor.py | fortdepend/preprocessor.py | import io
import pcpp
class FortranPreprocessor(pcpp.Preprocessor):
def __init__(self):
super(FortranPreprocessor, self).__init__()
def parse_to_string_lines(self, text):
with io.StringIO() as f:
self.parse(text)
self.write(f)
f.seek(0)
result =... | import io
import pcpp
class FortranPreprocessor(pcpp.Preprocessor):
def __init__(self):
super(pcpp.Preprocessor, self).__init__()
def parse_to_string_lines(self, text):
with io.StringIO() as f:
self.parse(text)
self.write(f)
f.seek(0)
result = f... | mit | Python |
2b280c027e5fc3f41dabcb10496719281c7f6726 | bump to 0.9.2 | tsuru/varnishapi,tsuru/varnishapi | feaas/__init__.py | feaas/__init__.py | # Copyright 2014 varnishapi authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
__version__ = "0.9.2"
| # Copyright 2014 varnishapi authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
__version__ = "0.9.1"
| bsd-3-clause | Python |
0a234829ecdde1483273d0f6fb249cc9fc0425d5 | Implement pause property more accurately | dkrikun/ffmpeg-rcd | ffmpeg_process.py | ffmpeg_process.py | # coding: utf-8
import logging
import psutil
from subprocess import PIPE
class FfmpegProcess(object):
def __init__(self):
self._cmdline = None
self._process = None
self._paused = False
def run(self):
if self._cmdline is None:
logging.debug('cmdline is not yet defin... | # coding: utf-8
import logging
import psutil
from subprocess import PIPE
class FfmpegProcess(object):
def __init__(self):
self._cmdline = None
self._process = None
self._paused = False
def run(self):
if self._cmdline is None:
logging.debug('cmdline is not yet defin... | mit | Python |
efd4a511fb3d644f45aec013837de50d1b6987ed | Update prtimer cron | ryandub/helpbot,martinb3/helpbot,martinb3/helpbot,ryandub/helpbot | plugins/prtimer.py | plugins/prtimer.py | from lib import helps
from lib import utils
outputs = []
crontable = []
crontable.append([300, "prtimer"])
def prtimer():
prs = helps.Helps(config['redis'])
all_prs = prs.get_all()
text = utils.format_prs(all_prs)
if text:
admin_channel, botname, icon_emoji = utils.setup_bot(config)
... | from lib import helps
from lib import utils
outputs = []
crontable = []
crontable.append([30, "prtimer"])
def prtimer():
prs = helps.Helps(config['redis'])
all_prs = prs.get_all()
text = utils.format_prs(all_prs)
if text:
admin_channel, botname, icon_emoji = utils.setup_bot(config)
m... | mit | Python |
9941f1ac3a4eb646f94d84e51f2993ffc3a94ca1 | allow for locations with more than two words | rascul/botwot | plugins/weather.py | plugins/weather.py | import json
import requests
from pyaib.plugins import keyword, plugin_class
from pyaib.db import db_driver
@plugin_class
class Weather(object):
def __init__(self, context, config):
self.context = context
self.config = context.config
@keyword("weather")
def keyword_weather(self, context, msg, trigger, args... | import json
import requests
from pyaib.plugins import keyword, plugin_class
from pyaib.db import db_driver
@plugin_class
class Weather(object):
def __init__(self, context, config):
self.context = context
self.config = context.config
@keyword("weather")
def keyword_weather(self, context, msg, trigger, args... | apache-2.0 | Python |
78ccf7cb6b01a7f1e83a0864b4386edaf4759de3 | Update msg_pyversion.py | ggreco77/GWsky | GWsky/msg_pyversion.py | GWsky/msg_pyversion.py | # -*- coding: utf-8 -*-
import os
import sys
from tkinter import *
from tkinter import font, messagebox
class MSG(object):
"""Message according with the python version: tkMessageBox/messagebox in localize module."""
@classmethod
def split_entries_3(cls, msg_err):
"""Error message for __split_ent... | # -*- coding: utf-8 -*-
import os
import sys
# py2 and py3 compatibility
try:
from Tkinter import *
import tkMessageBox
import tkFont
except ImportError:
from tkinter import *
from tkinter import font, messagebox
class MSG(object):
"""Message according with the python version: tkMessageBox/me... | bsd-2-clause | Python |
761378436749986f806ec1547a9a90c3fd380413 | Extend Overkiz diagnostics and implement device diagnostics (#68859) | toddeye/home-assistant,nkgilley/home-assistant,toddeye/home-assistant,w1ll1am23/home-assistant,mezz64/home-assistant,w1ll1am23/home-assistant,mezz64/home-assistant,nkgilley/home-assistant | homeassistant/components/overkiz/diagnostics.py | homeassistant/components/overkiz/diagnostics.py | """Provides diagnostics for Overkiz."""
from __future__ import annotations
from typing import Any
from pyoverkiz.obfuscate import obfuscate_id
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.device_registry import DeviceEntry
from . import... | """Provides diagnostics for Overkiz."""
from __future__ import annotations
from typing import Any, cast
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from . import HomeAssistantOverkizData
from .const import DOMAIN
async def async_get_config_entry_diagnostics(
... | apache-2.0 | Python |
de661c6b8a7bc8544b180cb50c990472d1e92a33 | Add function docstring | rbuffat/Fiona,Toblerity/Fiona,Toblerity/Fiona,rbuffat/Fiona | fiona/fio/insp.py | fiona/fio/insp.py | """$ fio insp"""
import code
import logging
import sys
import click
import fiona
from fiona.fio import with_context_env
@click.command(short_help="Open a dataset and start an interpreter.")
@click.argument('src_path', required=True)
@click.option('--ipython', 'interpreter', flag_value='ipython',
hel... | """$ fio insp"""
import code
import logging
import sys
import click
import fiona
from fiona.fio import with_context_env
@click.command(short_help="Open a dataset and start an interpreter.")
@click.argument('src_path', required=True)
@click.option('--ipython', 'interpreter', flag_value='ipython',
hel... | bsd-3-clause | Python |
c8aead2fc8226b106321542f9bf961ee1ccbf872 | Fix migration that introduces instance states. | open-craft/opencraft,open-craft/opencraft,open-craft/opencraft,open-craft/opencraft,open-craft/opencraft | instance/migrations/0042_add_instance_status.py | instance/migrations/0042_add_instance_status.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from instance.models.instance import Status as InstanceStatus
def get_current_server(instance):
return instance.server_set.order_by("id").last()
def get_instance_state(server_status, server_progress):
i... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from instance.models.instance import Status as InstanceStatus
def set_instance_states(apps, schema_editor):
SingleVMOpenEdXInstance = apps.get_model("instance", "SingleVMOpenEdXInstance")
SingleVMOpenEdX... | agpl-3.0 | Python |
67e508c726502391bb54abfb64c325d87a93de03 | Exclude quartet roles | barberscore/barberscore-api,dbinetti/barberscore,dbinetti/barberscore-django,barberscore/barberscore-api,dbinetti/barberscore,barberscore/barberscore-api,dbinetti/barberscore-django,barberscore/barberscore-api | project/api/management/commands/sync_officers_roles.py | project/api/management/commands/sync_officers_roles.py | import logging
import django_rq
from datetime import date
# Django
from django.core.management.base import BaseCommand
from django.db.models import Q
# First-Party
from api.models import Officer
from bhs.models import Role
log = logging.getLogger('updater')
class Command(BaseCommand):
help = "Command to sync qua... | import logging
import django_rq
from datetime import date
# Django
from django.core.management.base import BaseCommand
from django.db.models import Q
# First-Party
from api.models import Officer
from bhs.models import Role
log = logging.getLogger('updater')
class Command(BaseCommand):
help = "Command to sync qua... | bsd-2-clause | Python |
998c89d38b22725ca494952cd2342c12cb3b63ab | fix unit tests | isaac-s/cloudify-plugins-common,codilime/cloudify-plugins-common,codilime/cloudify-plugins-common,cloudify-cosmo/cloudify-plugins-common,isaac-s/cloudify-plugins-common,cloudify-cosmo/cloudify-plugins-common,isaac-s/cloudify-plugins-common,cloudify-cosmo/cloudify-plugins-common,geokala/cloudify-plugins-common,codilime/... | cloudify/tests/test_state.py | cloudify/tests/test_state.py |
import threading
import unittest
from Queue import Queue
from cloudify.state import ctx, current_ctx
from cloudify.mocks import MockCloudifyContext
class TestCurrentContextAndCtxLocalProxy(unittest.TestCase):
def test_basic(self):
self.assertRaises(RuntimeError, current_ctx.get_ctx)
self.asse... |
import threading
import unittest
from Queue import Queue
from cloudify.state import ctx, current_ctx
from cloudify.mocks import MockCloudifyContext
class TestCurrentContextAndCtxLocalProxy(unittest.TestCase):
def test_basic(self):
self.assertRaises(RuntimeError, current_ctx.get)
self.assertRa... | apache-2.0 | Python |
e45c14025789f7901db5102135402f36e04bde65 | bump version | shmilee/gdpy3,shmilee/gdpy3,shmilee/gdpy3,shmilee/gdpy3 | gdpy3/__init__.py | gdpy3/__init__.py | __name__ = "gdpy3"
__doc__ = "Gyrokinetic Toroidal Code Data Processing tools written in python3"
__author__ = "shmilee"
__version__ = "0.1.6"
__status__ = "alpha"
__license__ = "MIT"
__email__ = "shmilee.zju@gmail.com"
__all__ = ['convert', 'ipynbtool', 'plot', 'read']
| __name__ = "gdpy3"
__doc__ = "Gyrokinetic Toroidal Code Data Processing tools written in python3"
__author__ = "shmilee"
__version__ = "0.1.4"
__status__ = "alpha"
__license__ = "MIT"
__email__ = "shmilee.zju@gmail.com"
__all__ = ['convert', 'ipynbtool', 'plot', 'read']
| mit | Python |
43028decb90a7040dabbf6c08e3e6620410481a1 | bump version | perrygeo/python-rasterstats,perrygeo/python-rasterstats | src/rasterstats/_version.py | src/rasterstats/_version.py | __version__ = "0.16.0"
| __version__ = "0.15.0"
| bsd-3-clause | Python |
5961407b27702f0426a52c7317da37548a86aab5 | Add modules to sample | nicholasserra/sentry,felixbuenemann/sentry,wong2/sentry,Kryz/sentry,wong2/sentry,mvaled/sentry,BayanGroup/sentry,jean/sentry,daevaorn/sentry,gencer/sentry,looker/sentry,songyi199111/sentry,daevaorn/sentry,kevinlondon/sentry,fuziontech/sentry,zenefits/sentry,ngonzalvez/sentry,wujuguang/sentry,looker/sentry,ifduyue/sentr... | src/sentry/utils/samples.py | src/sentry/utils/samples.py | """
sentry.utils.samples
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import os.path
from sentry.constants import DATA_ROOT, PLATFORM_ROOTS, PLATFORM_TITLES
from sentry.event_manager... | """
sentry.utils.samples
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2013 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import os.path
from sentry.constants import DATA_ROOT, PLATFORM_ROOTS, PLATFORM_TITLES
from sentry.event_manager... | bsd-3-clause | Python |
ef579f6823e3d235582c5205213f002e89266684 | Remove grapelli urls. | jeffdwyatt/taiga-back,crr0004/taiga-back,forging2012/taiga-back,19kestier/taiga-back,gam-phon/taiga-back,joshisa/taiga-back,taigaio/taiga-back,obimod/taiga-back,joshisa/taiga-back,obimod/taiga-back,bdang2012/taiga-back-casting,bdang2012/taiga-back-casting,Zaneh-/bearded-tribble-back,Zaneh-/bearded-tribble-back,Tigerwhi... | greenmine/urls.py | greenmine/urls.py | # -*- coding: utf-8 -*-
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.contrib import admin
from .routers import router
admin.autodiscover()
urlpatterns = patterns('',
url(r'^api/v1/', include(... | # -*- coding: utf-8 -*-
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.contrib import admin
from .routers import router
admin.autodiscover()
urlpatterns = patterns('',
url(r'^api/v1/', include(... | agpl-3.0 | Python |
ab9aa6628f02ac87c014cc7da6128e95a59bf823 | update version | albertfxwang/grizli | grizli/version.py | grizli/version.py | # git describe --tags
__version__ = "0.5.0-48-g28ef3e3"
| # git describe --tags
__version__ = "0.5.0-23-gf77c6b2"
| mit | Python |
84a20dde46aa243b25e6f18a369471e2fc01f6e5 | Allow to filter out locations without sizes. | opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/waldur-mastermind,opennode/nodeconductor-assembly-waldur,opennode/nodeconductor-assembly-waldur,opennode/waldur-mastermind | src/waldur_azure/filters.py | src/waldur_azure/filters.py | import django_filters
from django.db.models import Count
from django_filters.widgets import BooleanWidget
from waldur_core.core import filters as core_filters
from waldur_core.structure import filters as structure_filters
from . import models
class ImageFilter(structure_filters.ServicePropertySettingsFilter):
c... | import django_filters
from waldur_core.core import filters as core_filters
from waldur_core.structure import filters as structure_filters
from . import models
class ImageFilter(structure_filters.ServicePropertySettingsFilter):
class Meta(structure_filters.ServicePropertySettingsFilter.Meta):
model = mod... | mit | Python |
cf8124e172301fb6fca8082369da09905b7028bd | Make api_spec as unix executable | catarse/catarse-api-specs,catarse/catarse-api-specs | api_spec.py | api_spec.py | #! /usr/bin/env python
import subprocess
import click
@click.group()
def cli():
pass
@cli.command()
@click.argument('name', default='api_test')
def run_tests(name):
subprocess.call(['./run_tests.sh', name])
@cli.command()
@click.option('--name', help='database name')
def recreate_schema(name):
subproc... | import subprocess
import click
@click.group()
def cli():
pass
@cli.command()
@click.argument('name', default='api_test')
def run_tests(name):
subprocess.call(['./run_tests.sh', name])
@cli.command()
@click.option('--name', help='database name')
def recreate_schema(name):
subprocess.call(['./database/r... | mit | Python |
8126d15311978b1a01c4fbed1275fa900dca3bde | fix bug with es_data_mapping when mapping options do not contain exceptions to the rules | DOAJ/doaj,DOAJ/doaj,DOAJ/doaj,DOAJ/doaj | portality/lib/es_data_mapping.py | portality/lib/es_data_mapping.py | # -*- coding: UTF-8 -*-
""" Create mappings from models """
from portality.lib import plugin
def get_mappings(app):
"""Get the full set of mappings required for the app"""
# LEGACY DEFAULT MAPPINGS
mappings = app.config["MAPPINGS"]
# TYPE SPECIFIC MAPPINGS
# get the list of classes which carry ... | # -*- coding: UTF-8 -*-
""" Create mappings from models """
from portality.lib import plugin
def get_mappings(app):
"""Get the full set of mappings required for the app"""
# LEGACY DEFAULT MAPPINGS
mappings = app.config["MAPPINGS"]
# TYPE SPECIFIC MAPPINGS
# get the list of classes which carry ... | apache-2.0 | Python |
aace60a75e5afedadfc30d33e91ef7c6fa312405 | Remove print of newly-set time. | kerneltask/micropython,trezor/micropython,kerneltask/micropython,henriknelson/micropython,bvernoux/micropython,adafruit/micropython,pozetroninc/micropython,tobbad/micropython,pfalcon/micropython,pramasoul/micropython,trezor/micropython,tobbad/micropython,tobbad/micropython,tralamazza/micropython,pramasoul/micropython,b... | ports/esp8266/modules/ntptime.py | ports/esp8266/modules/ntptime.py | try:
import usocket as socket
except:
import socket
try:
import ustruct as struct
except:
import struct
# (date(2000, 1, 1) - date(1900, 1, 1)).days * 24*60*60
NTP_DELTA = 3155673600
host = "pool.ntp.org"
def time():
NTP_QUERY = bytearray(48)
NTP_QUERY[0] = 0x1b
addr = socket.getaddrinfo(... | try:
import usocket as socket
except:
import socket
try:
import ustruct as struct
except:
import struct
# (date(2000, 1, 1) - date(1900, 1, 1)).days * 24*60*60
NTP_DELTA = 3155673600
host = "pool.ntp.org"
def time():
NTP_QUERY = bytearray(48)
NTP_QUERY[0] = 0x1b
addr = socket.getaddrinfo(... | mit | Python |
2281f0d2445722296f2456b4b6449384d49faad2 | print latest texts first | alexshepard/aledison | print_all_texts.py | print_all_texts.py | #!/usr/bin/python
import yaml
config = yaml.safe_load(open("config.yml"))
twilio_account_sid = config["twilio"]["account_sid"]
twilio_auth_token = config["twilio"]["auth_token"]
from twilio.rest import TwilioRestClient
twilio_client = TwilioRestClient(twilio_account_sid, twilio_auth_token)
from contacts import Cont... | #!/usr/bin/python
import yaml
config = yaml.safe_load(open("config.yml"))
twilio_account_sid = config["twilio"]["account_sid"]
twilio_auth_token = config["twilio"]["auth_token"]
from twilio.rest import TwilioRestClient
twilio_client = TwilioRestClient(twilio_account_sid, twilio_auth_token)
from contacts import Cont... | mit | Python |
32ccb12d592eab3d15ad7accf4475f78df360641 | add test for find_model_metadata | csdms/pymt | tests/framework/test_setup.py | tests/framework/test_setup.py | import os
import pytest
from pymt.framework.bmi_setup import _parse_author_info
from pymt.framework.bmi_metadata import find_model_metadata
@pytest.mark.parametrize("key", ("author", "authors"))
def test_author(key):
assert _parse_author_info({key: "John Cleese"}) == ("John Cleese",)
def test_author_empty_list... | import pytest
from pymt.framework.bmi_setup import _parse_author_info
@pytest.mark.parametrize("key", ("author", "authors"))
def test_author(key):
assert _parse_author_info({key: "John Cleese"}) == ("John Cleese",)
def test_author_empty_list():
assert _parse_author_info({}) == ("",)
@pytest.mark.parametr... | mit | Python |
7a17e37c06d8e229a35874e29f1aa38c0b0666e4 | Update docstrings. | DaRasch/spiceminer,DaRasch/spiceminer | spiceminer/kernel/__init__.py | spiceminer/kernel/__init__.py | #!/usr/bin/env python
#-*- coding:utf-8 -*-
from .highlevel import Kernel
def load(path='.', recursive=True, followlinks=False, force_reload=False):
'''Load a kernel file or all kernel files in a directory tree.
Parameters
----------
path: str, optional
Relative or absolute path to the kerne... | #!/usr/bin/env python
#-*- coding:utf-8 -*-
from .highlevel import Kernel
def load(path='.', recursive=True, followlinks=False, force_reload=False):
'''Load a kernel file or all kernel files in a directory tree.
Parameters
----------
path: str, optional
Relative or absolute path to the kerne... | mit | Python |
2649e2e6a2d79febad14e0728c65b1429beb8858 | Reduce amounts of runs for fast test analysis | thouska/spotpy,bees4ever/spotpy,thouska/spotpy,bees4ever/spotpy,bees4ever/spotpy,thouska/spotpy | spotpy/unittests/test_fast.py | spotpy/unittests/test_fast.py | import unittest
try:
import spotpy
except ImportError:
import sys
sys.path.append(".")
import spotpy
from spotpy.examples.spot_setup_hymod_python import spot_setup
class TestFast(unittest.TestCase):
def setUp(self):
self.spot_setup = spot_setup()
self.rep = 200 # REP must be a... | import unittest
try:
import spotpy
except ImportError:
import sys
sys.path.append(".")
import spotpy
from spotpy.examples.spot_setup_hymod_python import spot_setup
class TestFast(unittest.TestCase):
def setUp(self):
self.spot_setup = spot_setup()
self.rep = 800 # REP must be a... | mit | Python |
9195523f1c6a3d9f08739ef4a991b5dbe97407c5 | Improve debug config switch | apache/cloudstack-gcestack | gcecloudstack/appserver.py | gcecloudstack/appserver.py | #!/usr/bin/env python
# encoding: utf-8
# 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, Vers... | #!/usr/bin/env python
# encoding: utf-8
# 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, Vers... | apache-2.0 | Python |
6dc4314f1c5510a6e5f857d739956654909d97b2 | Add `Description` to top-level imports | althonos/pronto | pronto/__init__.py | pronto/__init__.py | # coding: utf-8
"""a Python frontend to ontologies
"""
from __future__ import absolute_import
from __future__ import unicode_literals
__version__ = 'dev'
__author__ = 'Martin Larralde'
__author_email__ = 'martin.larralde@ens-paris-saclay.fr'
__license__ = "MIT"
from .ontology import Ontology
from .term import Term, T... | # coding: utf-8
"""a Python frontend to ontologies
"""
from __future__ import absolute_import
from __future__ import unicode_literals
__version__ = 'dev'
__author__ = 'Martin Larralde'
__author_email__ = 'martin.larralde@ens-paris-saclay.fr'
__license__ = "MIT"
from .ontology import Ontology
from .term import Term, T... | mit | Python |
4fcbda44f7db33b795821c589133427387d0525e | add notes to script, small pep8 correction | rvanharen/SitC | UHI_reference.py | UHI_reference.py | #!/usr/bin/env python2
'''
Description:
Author: Ronald van Haren, NLeSC (r.vanharen@esciencecenter.nl)
Created: -
Last Modified: -
License: Apache 2.0
Notes: -
'''
import zipfile
import csv
import StringIO
from combine_wunderground_data import fitem
from numpy import vstack
import os
... | #!/usr/bin/env python2
import zipfile
import csv
import StringIO
from combine_wunderground_data import fitem
from numpy import vstack
import os
class load_reference_data:
def __init__(self, filename):
self.filename = filename
self.load_file()
def load_file(self):
'''
function d... | apache-2.0 | Python |
babd72cf2fb30e8d2f982d475f537d04f426bc40 | update dump.json to support bools | zbraniecki/pyast | pyast/dump/json.py | pyast/dump/json.py | import json
import pyast
from collections import OrderedDict
def _dump_node_name(node):
return node.__class__.__name__.lower()
def _dump_node(node, name=None, indent=0):
if isinstance(node, str):
return node
elif isinstance(node, bool):
return node
struct = OrderedDict({'type': None})... | import json
import pyast
def _dump_node_name(node):
return node.__class__.__name__.lower()
def _dump_node(node, name=None, indent=0):
if isinstance(node, str):
return node
struct = {'type': None}
if isinstance(node, pyast.Node):
struct['type'] = _dump_node_name(node)
for field ... | bsd-3-clause | Python |
2345eb0705b1d3fa8587f9513717b57e24434806 | add proper __version__ | RhubarbSin/PyBIND | pybind/__init__.py | pybind/__init__.py | __version__ = '0.1.0'
from dnszone import ForwardZone, ReverseZone
from dnsrecord import SOA, NS, A, AAAA, CNAME, MX, TXT, PTR
from bindconf import BINDConf, ACL, View, Zone
| """
docstring
"""
__version__ = '$Revision$'
# $Source$
from dnszone import ForwardZone, ReverseZone
from dnsrecord import SOA, NS, A, AAAA, CNAME, MX, TXT, PTR
from bindconf import BINDConf, ACL, View, Zone
| mit | Python |
559e1e3a59c1722e8ebf29049cb6aa32e888aea7 | Fix whitespace issue | jrsmith3/ibei | src/ibei/__init__.py | src/ibei/__init__.py | # -*- coding: utf-8 -*-
"""
Base Library (:mod:`ibei`)
==========================
.. currentmodule:: ibei
"""
from . import models
try:
from ._version import __version__
except ModuleNotFoundError:
__version__ = ""
| # -*- coding: utf-8 -*-
"""
Base Library (:mod:`ibei`)
==========================
.. currentmodule:: ibei
"""
from . import models
try:
from ._version import __version__
except ModuleNotFoundError:
__version__ = ""
| mit | Python |
cc1e3b3bbf0f5d333138adbb87d63a2e8eb52161 | Fix auto init on Linux and MacOS. | mrh1997/pyclibrary,duguxy/pyclibrary,mrh1997/pyclibrary,mrh1997/pyclibrary,MatthieuDartiailh/pyclibrary,duguxy/pyclibrary,duguxy/pyclibrary,MatthieuDartiailh/pyclibrary | pyclibrary/init.py | pyclibrary/init.py | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2015 by PyCLibrary Authors, see AUTHORS for more details.
#
# Distributed under the terms of the MIT/X11 license.
#
# The full license is in the file LICENCE, distributed with this software.
# -----------... | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2015 by PyCLibrary Authors, see AUTHORS for more details.
#
# Distributed under the terms of the MIT/X11 license.
#
# The full license is in the file LICENCE, distributed with this software.
# -----------... | mit | Python |
62d380e9336fb92b96605a923a8065920d7d8fac | Update progbar.py | rasbt/pyprind,rasbt/pyprind | pyprind/progbar.py | pyprind/progbar.py | # Sebastian Raschka 2014
#
# Progress Bar class to instantiate a progress bar object
# that is printed to the standard output screen to visualize the
# progress in a iterative Python procedure
from math import floor
from pyprind.prog_class import Prog
class ProgBar(Prog):
"""Initializes a progress bar object tha... | # Sebastian Raschka 2014
#
# Progress Bar class to instantiate a progress bar object
# that is printed to the standard output screen to visualize the
# progress in a iterative Python procedure
from math import floor
from pyprind.prog_class import Prog
class ProgBar(Prog):
"""Initializes a progress bar object tha... | bsd-3-clause | Python |
23048f21af7523c67766f76c98768ed553cbd6cb | Bump version | iris-edu-int/pyweed | pyweed/__init__.py | pyweed/__init__.py | import os.path
__pkg_path___ = os.path.dirname(os.path.abspath(__file__))
# Use Python semantic versioning
# https://packaging.python.org/tutorials/distributing-packages/#semantic-versioning-preferred
__version__ = '1.0.0'
__app_name__ = "PyWEED"
| import os.path
__pkg_path___ = os.path.dirname(os.path.abspath(__file__))
__version__ = '1.0.0b2'
__app_name__ = "PyWEED"
| mit | Python |
8ec14b44eb61574c9cf2c0c339f587342f69f874 | Bump version to 2.0.6 | Gagi2k/qface,Pelagicore/qface | qface/__about__.py | qface/__about__.py | import os.path
try:
base_dir = os.path.dirname(os.path.abspath(__file__))
except NameError:
base_dir = None
__title__ = "qface"
__summary__ = "A generator framework based on a common modern IDL"
__url__ = "https://pelagicore.github.io/qface/"
__version__ = "2.0.6"
__author__ = "JRyannel"
__author_email__ = "... | import os.path
try:
base_dir = os.path.dirname(os.path.abspath(__file__))
except NameError:
base_dir = None
__title__ = "qface"
__summary__ = "A generator framework based on a common modern IDL"
__url__ = "https://pelagicore.github.io/qface/"
__version__ = "2.0.5"
__author__ = "JRyannel"
__author_email__ = "... | mit | Python |
85fa20c5aee1eae4b9480a1a47d586c8719d5a37 | Make the ending quick | cropleyb/pentai,cropleyb/pentai,cropleyb/pentai | ab_game.py | ab_game.py | #!/usr/bin/python
import board
import pente_exceptions
from ab_state import *
class ABGame():
""" This class acts as a bridge between the AlphaBeta code and my code """
def __init__(self, base_game, search_filter=None,
utility_calculator=None):
s = self.current_state = ABState(None, ... | #!/usr/bin/python
import board
import pente_exceptions
from ab_state import *
class ABGame():
""" This class acts as a bridge between the AlphaBeta code and my code """
def __init__(self, base_game, search_filter=None,
utility_calculator=None):
s = self.current_state = ABState(None, ... | mit | Python |
2524f23a46e2c4194fcb9619aa084f5c373ea003 | Add more test cases | github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql,github/codeql | python/ql/test/experimental/dataflow/ApiGraphs/test.py | python/ql/test/experimental/dataflow/ApiGraphs/test.py | import a1 #$ use=moduleImport("a1")
x = a1.blah1 #$ use=moduleImport("a1").getMember("blah1")
import a2 as m2 #$ use=moduleImport("a2")
x2 = m2.blah2 #$ use=moduleImport("a2").getMember("blah2")
import a3.b3 as m3 #$ use=moduleImport("a3").getMember("b3")
x3 = m3.blah3 #$ use=moduleImport("a3").getMember("b3").ge... | import a1 #$ use=moduleImport("a1")
x = a1.blah1 #$ use=moduleImport("a1").getMember("blah1")
import a2 as m2 #$ use=moduleImport("a2")
x2 = m2.blah2 #$ use=moduleImport("a2").getMember("blah2")
import a3.b3 as m3 #$ use=moduleImport("a3").getMember("b3")
x3 = m3.blah3 #$ use=moduleImport("a3").getMember("b3").ge... | mit | Python |
4bb91bdfbf6d037ff3ac9c84a28302f220133363 | update md.py: remove h1 in the result | masayuko/nikola,damianavila/nikola,lucacerone/nikola,okin/nikola,s2hc-johan/nikola,techdragon/nikola,okin/nikola,berezovskyi/nikola,getnikola/nikola,knowsuchagency/nikola,kotnik/nikola,s2hc-johan/nikola,xuhdev/nikola,berezovskyi/nikola,Proteus-tech/nikola,gwax/nikola,Proteus-tech/nikola,masayuko/nikola,JohnTroony/nikol... | nikola/md.py | nikola/md.py | """Implementation of compile_html based on markdown."""
__all__ = ['compile_html']
import codecs
import re
from markdown import markdown
def compile_html(source, dest):
with codecs.open(source, "r", "utf8") as in_file:
data = in_file.read()
output = markdown(data, ['fenced_code', 'codehilite'])
... | """Implementation of compile_html based on markdown."""
__all__ = ['compile_html']
import codecs
import re
from markdown import markdown
def compile_html(source, dest):
with codecs.open(source, "r", "utf8") as in_file:
data = in_file.read()
output = markdown(data, ['fenced_code', 'codehilite'])
... | mit | Python |
35aa1e4169c63c66ded9cce2e9012b13febe113c | add groups and users to GraphQL schema | ReelTalkers/reeltalk-backend,ReelTalkers/reeltalk-backend | reeltalk/schema.py | reeltalk/schema.py | import graphene
from graphene import resolve_only_args, relay
from graphene.contrib.django import DjangoNode, DjangoConnectionField
from .models import User, Show, Review, Group
schema = graphene.Schema(name='ReelTalk Relay Schema')
class Connection(relay.Connection):
total_count = graphene.IntField()
def... | import graphene
from graphene import resolve_only_args, relay
from graphene.contrib.django import DjangoNode, DjangoConnectionField
from .models import User, Show, Review
schema = graphene.Schema(name='ReelTalk Relay Schema')
class Connection(relay.Connection):
total_count = graphene.IntField()
def resolv... | apache-2.0 | Python |
d3cb7ebb3a254447f0e847cc348fb8249e32c23c | update test vm | HPCC-Cloud-Computing/press,HPCC-Cloud-Computing/press | prediction/anf_py/models_test.py | prediction/anf_py/models_test.py |
import numpy as np
import models
import pandas as pd
WINDOW_SIZE = 20
RULE_NUMBER = 100
ATTRIBUTE = 'meanCPUUsage'
p_para_shape = [WINDOW_SIZE, RULE_NUMBER]
TRAIN_PERCENTAGE = 0.8
fname = "google_trace_timeseries/data_resource_usage_10Minutes_6176858948.csv"
# Cac Header trong file
header = ["time_stamp", "numberOfTa... |
import numpy as np
import models
import pandas as pd
WINDOW_SIZE = 20
RULE_NUMBER = 50
ATTRIBUTE = 'meanCPUUsage'
p_para_shape = [WINDOW_SIZE, RULE_NUMBER]
TRAIN_PERCENTAGE = 0.8
fname = "google_trace_timeseries/data_resource_usage_10Minutes_6176858948.csv"
# Cac Header trong file
header = ["time_stamp", "numberOfTas... | mit | Python |
1e47f79647baffd62d2a434710fe98b3c2247f28 | Fix tests with last changes on api. | EnTeQuAk/django-orm,EnTeQuAk/django-orm | tests/pgcomplex_app/models.py | tests/pgcomplex_app/models.py | # -*- coding: utf-8 -*-
from django.db import models
from django_orm.postgresql.fields.arrays import ArrayField
from django_orm.postgresql.fields.interval import IntervalField
from django_orm.postgresql.fields.bytea import ByteaField
from django_orm.manager import Manager
class IntModel(models.Model):
lista = Arr... | # -*- coding: utf-8 -*-
from django.db import models
from django_orm.postgresql.fields.arrays import ArrayField
from django_orm.postgresql.fields.interval import IntervalField
from django_orm.postgresql.fields.bytea import ByteaField
from django_orm.postgresql.manager import PgManager
class IntModel(models.Model):
... | bsd-3-clause | Python |
befde766ede86e4e878f6a92a826abd56f1a6dd7 | Support empty out_SET | mindbender-studio/core,mindbender-studio/core,getavalon/core,MoonShineVFX/core,MoonShineVFX/core,getavalon/core | mindbender/maya/plugins/validate_rig_members.py | mindbender/maya/plugins/validate_rig_members.py | import pyblish.api
class ValidateMindbenderRigFormat(pyblish.api.InstancePlugin):
"""A rig must have a certain hierarchy and members
- Must reside within `rig_GRP` transform
- out_SET
- controls_SET
- in_SET (optional)
- resources_SET (optional)
"""
label = "Validate Rig Format"
... | import pyblish.api
class ValidateMindbenderRigFormat(pyblish.api.InstancePlugin):
"""A rig must have a certain hierarchy and members
- Must reside within `rig_GRP` transform
- out_SET
- controls_SET
- in_SET (optional)
- resources_SET (optional)
"""
label = "Validate Rig Format"
... | mit | Python |
d976b92e49184420114b3131223ea393fd5cdf68 | bump for 1.2.1 | alfredodeza/remoto | remoto/__init__.py | remoto/__init__.py | from .connection import Connection
from .file_sync import rsync
from . import process
from . import connection
__version__ = '1.2.1'
| from .connection import Connection
from .file_sync import rsync
from . import process
from . import connection
__version__ = '1.2.0'
| mit | Python |
1a049f9d256d715db4ccd3e927eada1ccec69153 | Update hibp.py | noahpowers/nlzr,noahpowers/nlzr | reconnaissance/hibp.py | reconnaissance/hibp.py | from hibpAPI import *
begin = time.time()
## hard-coded email address for testing purposes
#email = "person@somedomain.com"
auth = AuthToken()
prop = ID()
### [resource = ] Sets API URI
emailCount = 0
breachList = []
methods = Methods()
with open(sys.argv[1]) as f:
for line in f:
line = line.strip()
... | from hibpAPI import *
begin = time.time()
## hard-coded email address for testing purposes
#email = "person@somedomain.com"
auth = AuthToken()
prop = ID()
### [resource = ] Sets API URI
emailCount = 0
breachList = []
methods = Methods()
with open(sys.argv[1]) as f:
for line in f:
line = line.strip()
... | mit | Python |
3535674318080d7f97fc1d965cd92bd62d44d111 | Update jupyter_notebook_config.py | mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext,mwouts/jupytext | .jupyter/jupyter_notebook_config.py | .jupyter/jupyter_notebook_config.py | c.NotebookApp.contents_manager_class = 'jupytext.TextFileContentsManager' # noqa
| c.NotebookApp.contents_manager_class = 'jupytext.TextFileContentsManager'
| mit | Python |
b4ffaabf75d9ae287213c531377d6b04e349c005 | fix for #13 on windows | pichillilorenzo/JavaScriptEnhancements,pichillilorenzo/JavaScriptEnhancements,pichillilorenzo/JavaScript-Completions,pichillilorenzo/JavaScriptEnhancements | node/main.py | node/main.py | import subprocess
import sys, imp, codecs
import node_variables
class NodeJS(object):
def eval(self, js, eval_type="eval", strict_mode=False):
js = ("'use strict'; " if strict_mode else "") + js
eval_type = "--eval" if eval_type == "eval" else "--print"
p = subprocess.Popen([node_variables.NODE_JS_PATH... | import subprocess
import sys, imp, codecs, shlex
import node_variables
class NodeJS(object):
def eval(self, js, eval_type="eval", strict_mode=False):
js = ("'use strict'; " if strict_mode else "") + js
eval_type = "--eval" if eval_type == "eval" else "--print"
p = subprocess.Popen(shlex.quote(node_vari... | mit | Python |
61ef4b1bea532c0289e6dd09f68e4c62a5f037b1 | Fix python script | apanda/modeling | tests/single_fw_test_slice.py | tests/single_fw_test_slice.py | from examples import RonoDMZTest, RonoQuarantineTest, RonoHostTest
import z3
import time
import random
import sys
def ResetZ3 ():
z3._main_ctx = None
z3.main_ctx()
z3.set_param('smt.random_seed', random.SystemRandom().randint(0, sys.maxint))
iters = 10
min_hosts = 5
max_hosts = 1000
print "host dmz_time q... | from examples import RonoDMZTest, RonoQuarantineTest, RonoHostTest
import z3
import time
import random
import sys
def ResetZ3 ():
z3._main_ctx = None
z3.main_ctx()
z3.set_param('smt.random_seed', random.SystemRandom().randint(0, sys.maxint))
iters = 10
min_hosts = 5
max_hosts = 1000
print "host dmz_time q... | bsd-3-clause | Python |
035d871399a5e9a60786332b2a8c42fbea98397f | Revert "Increase rest client pool size to 100" | uw-it-aca/canvas-analytics,uw-it-aca/canvas-analytics,uw-it-aca/canvas-analytics,uw-it-aca/canvas-analytics | docker/settings.py | docker/settings.py | from .base_settings import *
import os
INSTALLED_APPS += [
'data_aggregator.apps.DataAggregatorConfig',
'webpack_loader',
]
if os.getenv('ENV') == 'localdev':
DEBUG = True
DATA_AGGREGATOR_ACCESS_GROUP = 'u_test_group'
DATA_AGGREGATOR_THREADING_ENABLED = False
RESTCLIENTS_DAO_CACHE_CLASS = None... | from .base_settings import *
import os
INSTALLED_APPS += [
'data_aggregator.apps.DataAggregatorConfig',
'webpack_loader',
]
if os.getenv('ENV') == 'localdev':
DEBUG = True
DATA_AGGREGATOR_ACCESS_GROUP = 'u_test_group'
DATA_AGGREGATOR_THREADING_ENABLED = False
RESTCLIENTS_DAO_CACHE_CLASS = None... | apache-2.0 | Python |
af98f25b2bc91d838bf3c9fb817f24c41e2d0216 | Fix typo. | harej/wikiproject_scripts,harej/reports_bot | reportsbot/user.py | reportsbot/user.py | # -*- coding: utf-8 -*-
from .util import to_wiki_format
__all__ = ["User"]
class User:
"""Represents a user on a particular site.
Users can be part of multiple WikiProjects.
"""
def __init__(self, bot, name):
self._bot = bot
self._name = to_wiki_format(bot.site, name)
@propert... | # -*- coding: utf-8 -*-
from .util import to_wiki_format
__all__ = ["User"]
class User:
"""Represents a user on a particular site.
Users can be part of multiple WikiProjects.
"""
def __init__(self, bot, name):
self._bot = bot
self._name = to_wiki_format(bot.site, name)
@propert... | mit | Python |
382c47ccbfea3c57df22c0484eea76393201c7e1 | Make ntpclient output microseconds. | rsmith-nl/scripts,rsmith-nl/scripts | ntpclient.py | ntpclient.py | #!/usr/bin/env python3
# file: ntpclient.py
# vim:fileencoding=utf-8:fdm=marker:ft=python
#
# Author: R.F. Smith <rsmith@xs4all.nl>
# Created: 2017-11-16 19:33:50 +0100
# Last modified: 2018-05-13T12:15:28+0200
"""Simple NTP query program."""
from contextlib import closing
from datetime import datetime
from socket imp... | #!/usr/bin/env python3
# file: ntpclient.py
# vim:fileencoding=utf-8:fdm=marker:ft=python
#
# Author: R.F. Smith <rsmith@xs4all.nl>
# Created: 2017-11-16 19:33:50 +0100
# Last modified: 2017-11-16 22:11:49 +0100
#
from contextlib import closing
from socket import socket, AF_INET, SOCK_DGRAM
import os
import struct
imp... | mit | Python |
901934421864ac0a75b246931bcf1dd518da0e5e | Fix on closing tag | areski/django-lets-go | common/custom_xml_emitter.py | common/custom_xml_emitter.py | try:
import cStringIO as StringIO
except ImportError:
import StringIO
from django.utils.encoding import smart_unicode
from django.utils.xmlutils import SimplerXMLGenerator
from piston.emitters import Emitter
from piston.utils import Mimer
from django.contrib.auth import authenticate
from django.http import Http... | try:
import cStringIO as StringIO
except ImportError:
import StringIO
from django.utils.encoding import smart_unicode
from django.utils.xmlutils import SimplerXMLGenerator
from piston.emitters import Emitter
from piston.utils import Mimer
from django.contrib.auth import authenticate
from django.http import Http... | mit | Python |
7665e2b0af042948dfc7a1814275cd3309f5f6cf | Remove the dependency to django-unittest-depth | remik/django-page-cms,oliciv/django-page-cms,remik/django-page-cms,remik/django-page-cms,pombredanne/django-page-cms-1,batiste/django-page-cms,batiste/django-page-cms,akaihola/django-page-cms,oliciv/django-page-cms,remik/django-page-cms,pombredanne/django-page-cms-1,akaihola/django-page-cms,akaihola/django-page-cms,bat... | pages/tests/__init__.py | pages/tests/__init__.py | """Django page CMS test suite module"""
import unittest
def suite():
suite = unittest.TestSuite()
from pages.tests.test_functionnal import FunctionnalTestCase
from pages.tests.test_unit import UnitTestCase
from pages.tests.test_regression import RegressionTestCase
from pages.tests.test_pages_link i... | """Django page CMS test suite module"""
from djangox.test.depth import alltests
def suite():
return alltests(__file__, __name__)
| bsd-3-clause | Python |
4cc0108cbbfc200b54d1930f07f3b0593ec9da10 | Use absolute import. | fhirschmann/penchy,fhirschmann/penchy | penchy/jobs/__init__.py | penchy/jobs/__init__.py | from penchy.jobs import jvms, tools, filters, workloads
from penchy.jobs.job import Job, makeJVMNodeConfiguration
from penchy.jobs.dependency import Edge
JVM = jvms.JVM
# all job elements that are interesting for the user have to be enumerated here
__all__ = [
# job
'Job',
'makeJVMNodeConfiguration',
... | from job import *
import jvms
import tools
import filters
import workloads
from dependency import Edge
JVM = jvms.JVM
# all job elements that are interesting for the user have to be enumerated here
__all__ = [
# job
'Job',
'JVMNodeConfiguration',
# dependencies
'Edge',
# jvms
'JVM',
#... | mit | Python |
05cc18faaa4482e24e82e493817f3b281806eb6c | Test import PyPath | johnbachman/belpy,johnbachman/indra,bgyori/indra,sorgerlab/indra,sorgerlab/belpy,bgyori/indra,johnbachman/belpy,bgyori/indra,sorgerlab/belpy,sorgerlab/indra,johnbachman/indra,sorgerlab/belpy,johnbachman/belpy,johnbachman/indra,sorgerlab/indra | indra/tests/test_omnipath.py | indra/tests/test_omnipath.py | import requests
from indra.sources.omnipath import OmniPathModificationProcessor,\
OmniPathLiganReceptorProcessor
from indra.sources.omnipath.api import op_url
from indra.statements import Agent, Phosphorylation
from indra.preassembler.grounding_mapper import GroundingMapper
BRAF_UPID = 'P15056'
JAK2_UPID = 'O6067... | import requests
from indra.sources.omnipath import OmniPathModificationProcessor,\
OmniPathLiganReceptorProcessor
from indra.sources.omnipath.api import op_url
from indra.statements import Agent, Phosphorylation
from indra.preassembler.grounding_mapper import GroundingMapper
BRAF_UPID = 'P15056'
JAK2_UPID = 'O6067... | bsd-2-clause | Python |
361464963cd80909cd6c02e905858c55ca031d22 | Split contact base and contact model | stefanklug/plata,allink/plata,armicron/plata,armicron/plata,armicron/plata | plata/contact/models.py | plata/contact/models.py | from datetime import datetime
from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import ugettext_lazy as _, ugettext
class ContactBase(models.Model):
ADDRESS_FIELDS = ['company', 'first_name', 'last_name', 'address',
'zip_code', 'city', 'country']
... | from datetime import datetime
from django.contrib.auth.models import User
from django.db import models
from django.utils.translation import ugettext_lazy as _, ugettext
class Contact(models.Model):
user = models.ForeignKey(User, verbose_name=_('user'), blank=True, null=True)
email = models.EmailField(_('e-ma... | bsd-3-clause | Python |
aa90031dc5f309ed15ec69479e17258e1bb7b6ab | use the ip address | MrCreosote/jgi_kbase_integration_tests,MrCreosote/jgi_kbase_integration_tests,MrCreosote/jgi_kbase_integration_tests,MrCreosote/jgi_kbase_integration_tests,MrCreosote/jgi_kbase_integration_tests | scripts/translate_jgi_project_id_to_portal_org_name.py | scripts/translate_jgi_project_id_to_portal_org_name.py | #! /usr/bin/env python
'''
Created on Jan 21, 2015
@author: gaprice@lbl.gov
'''
from __future__ import print_function
import fileinput
import urllib2
import sys
# JGI_URL = 'http://genome.jgi.doe.gov/ext-api/genome-admin/' +\
# 'getPortalIdByParameter?parameterName=jgiProjectId¶meterValue='
JGI_URL = 'http:/... | #! /usr/bin/env python
'''
Created on Jan 21, 2015
@author: gaprice@lbl.gov
'''
from __future__ import print_function
import fileinput
import urllib2
import sys
JGI_URL = 'http://genome.jgi.doe.gov/ext-api/genome-admin/' +\
'getPortalIdByParameter?parameterName=jgiProjectId¶meterValue='
def main():
for ... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.