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 |
|---|---|---|---|---|---|---|---|---|
d4d448adff71b609d5efb269d1a9a2ea4aba3590 | Allow SiteOption to load into the JS | ScanOC/trunk-player,ScanOC/trunk-player,ScanOC/trunk-player,ScanOC/trunk-player | radio/templatetags/radio_js_config.py | radio/templatetags/radio_js_config.py | import random
import json
from django import template
from django.conf import settings
from radio.models import SiteOption
register = template.Library()
# Build json value to pass as js config
@register.simple_tag()
def trunkplayer_js_config(user):
js_settings = getattr(settings, 'JS_SETTINGS', None)
js_jso... | import random
import json
from django import template
from django.conf import settings
register = template.Library()
# Build json value to pass as js config
@register.simple_tag()
def trunkplayer_js_config(user):
js_settings = getattr(settings, 'JS_SETTINGS', None)
js_json = {}
if js_settings:
fo... | mit | Python |
db8732399566e6ef020d9a5efabfe4e28b654239 | Update lattice version in accelerator | lnls-fac/sirius | pymodels/SI_V24_04/accelerator.py | pymodels/SI_V24_04/accelerator.py | """Accelerator module."""
import numpy as _np
import pyaccel as _pyaccel
from . import lattice as _lattice
default_cavity_on = False
default_radiation_on = False
default_vchamber_on = False
def create_accelerator(optics_mode=_lattice.default_optics_mode,
simplified=False):
"""Create acce... | """Accelerator module."""
import numpy as _np
import pyaccel as _pyaccel
from . import lattice as _lattice
default_cavity_on = False
default_radiation_on = False
default_vchamber_on = False
def create_accelerator(optics_mode=_lattice.default_optics_mode,
simplified=False):
"""Create acce... | mit | Python |
7943fa2d0091a718b04ba17994eddeef8845a286 | Add function to calculate wait_time and run_time for each job | ajdecon/torque_qhistory,ajdecon/torque_qhistory | lib/torque_accounting.py | lib/torque_accounting.py | # torque_accounting.py
# Functions for working with Torque accounting files
from datetime import datetime
def parse_line(line):
event = line.split(';')
job_name = event[2]
event_type = event[1]
event_time = event[0]
properties={}
prop_strings = event[3].split(" ")
for p in prop_strin... | # torque_accounting.py
# Functions for working with Torque accounting files
def parse_line(line):
event = line.split(';')
job_name = event[2]
event_type = event[1]
event_time = event[0]
properties={}
prop_strings = event.split(" ")
for p in prop_strings:
prop=p.split("=")
... | mit | Python |
e4ca93291077a67b521fe49ac8970e0e68d9d7d3 | Add an admin list_filter for active models. | twaddington/pdxroasters,twaddington/pdxroasters,twaddington/pdxroasters,paulcpederson/pdxroasters,paulcpederson/pdxroasters | pdxroasters/roaster/admin.py | pdxroasters/roaster/admin.py | from django.contrib import admin
from roaster.models import Cafe, Roaster, Roast
class CafeAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug': ('name',)}
list_display = ('name', 'address', 'phone', 'show_url', 'created_at',
'modified_at', 'active',)
list_filter = ('active',)
search_fiel... | from django.contrib import admin
from roaster.models import Cafe, Roaster, Roast
class CafeAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug': ('name',)}
list_display = ('name', 'address', 'phone', 'show_url', 'created_at',
'modified_at', 'active',)
search_fields = ('name',)
def show_u... | bsd-2-clause | Python |
84ea5b7a6c256059544be4af015bdbe9f07575f4 | Remove excess creation of a data manager. | petrilli/pyramid_transactional_celery,petrilli/pyramid_transactional_celery | pyramid_transactional_celery/transactional_task.py | pyramid_transactional_celery/transactional_task.py | # -*- coding: utf-8 -*-
from functools import partial
import threading
import transaction
from zope.interface import implementer
from transaction.interfaces import IDataManager
from celery.app import app_or_default
__all__ = [
'CeleryDataManager',
'TransactionalTask',
'task_tm',
]
# New Celery structure... | # -*- coding: utf-8 -*-
from functools import partial
import threading
import transaction
from zope.interface import implementer
from transaction.interfaces import IDataManager
from celery.app import app_or_default
__all__ = [
'CeleryDataManager',
'TransactionalTask',
'task_tm',
]
# New Celery structure... | bsd-3-clause | Python |
a7447b02cf0f834d0094b7c6cd0bdbad876cb637 | Bump version to v0.16.0 | PythonCharmers/python-future,QuLogic/python-future,QuLogic/python-future,PythonCharmers/python-future | src/future/__init__.py | src/future/__init__.py | """
future: Easy, safe support for Python 2/3 compatibility
=======================================================
``future`` is the missing compatibility layer between Python 2 and Python
3. It allows you to use a single, clean Python 3.x-compatible codebase to
support both Python 2 and Python 3 with minimal overhea... | """
future: Easy, safe support for Python 2/3 compatibility
=======================================================
``future`` is the missing compatibility layer between Python 2 and Python
3. It allows you to use a single, clean Python 3.x-compatible codebase to
support both Python 2 and Python 3 with minimal overhea... | mit | Python |
36e6a6c8d56693c917872417596ea359360ea526 | add debug output | gdesmott/manger-veggie,gdesmott/manger-veggie,gdesmott/manger-veggie,gdesmott/manger-veggie | restaurant/management/commands/populate.py | restaurant/management/commands/populate.py | # -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
#from optparse import make_option
from restaurant.models import Restaurant
from geopy.geocoders import Nominatim
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
)
def create_restaurant(self, name, address, w... | # -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
#from optparse import make_option
from restaurant.models import Restaurant
from geopy.geocoders import Nominatim
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
)
def create_restaurant(self, name, address, w... | agpl-3.0 | Python |
0a13a9a8a779102dbcb2beead7d8aa9143f4c79b | Use commit suggestion to use types | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/pytests/unit/client/ssh/test_shell.py | tests/pytests/unit/client/ssh/test_shell.py | import subprocess
import types
import pytest
import salt.client.ssh.shell as shell
@pytest.fixture
def keys(tmp_path):
pub_key = tmp_path / "ssh" / "testkey.pub"
priv_key = tmp_path / "ssh" / "testkey"
return types.SimpleNamespace(pub_key=pub_key, priv_key=priv_key)
@pytest.mark.skip_on_windows(reason=... | import os
import subprocess
import pytest
import salt.client.ssh.shell as shell
@pytest.fixture
def keys(tmp_path):
pub_key = tmp_path / "ssh" / "testkey.pub"
priv_key = tmp_path / "ssh" / "testkey"
yield {"pub_key": str(pub_key), "priv_key": str(priv_key)}
@pytest.mark.skip_on_windows(reason="Windows ... | apache-2.0 | Python |
09d780474d00f3a8f4c2295154d74dae2023c1d3 | Drop the CLI from the sample storage client imports. | cherba/apitools,craigcitro/apitools,b-daniels/apitools,betamos/apitools,kevinli7/apitools,houglum/apitools,pcostell/apitools,thobrla/apitools,google/apitools | samples/storage_sample/storage/__init__.py | samples/storage_sample/storage/__init__.py | """Common imports for generated storage client library."""
# pylint:disable=wildcard-import
import pkgutil
from apitools.base.py import *
from storage_v1_client import *
from storage_v1_messages import *
__path__ = pkgutil.extend_path(__path__, __name__)
| """Common imports for generated storage client library."""
# pylint:disable=wildcard-import
import pkgutil
from apitools.base.py import *
from storage_v1 import *
from storage_v1_client import *
from storage_v1_messages import *
__path__ = pkgutil.extend_path(__path__, __name__)
| apache-2.0 | Python |
a8814e2ea847e81be130c7ded6fbb37896f6779c | Add example for field info | DOV-Vlaanderen/pydov | examples/gwfilter_search.py | examples/gwfilter_search.py | """Module giving some examples how to use PyDOV to query boreholes."""
def get_description():
"""The description gives information about the Boring type."""
from pydov.search.grondwaterfilter import GrondwaterFilterSearch
gwfilter = GrondwaterFilterSearch()
print(gwfilter.get_description())
def get... | """Module giving some examples how to use PyDOV to query boreholes."""
def get_description():
"""The description gives information about the Boring type."""
from pydov.search.grondwaterfilter import GrondwaterFilterSearch
gwfilter = GrondwaterFilterSearch()
print(gwfilter.get_description())
def get_... | mit | Python |
b0f6090477d295c4af1df8776d859c790bf6fdb3 | Load and Scrape all Federal URLs | khandelwal/fedtext | scraper/fedtext/spiders/tutorial_spider.py | scraper/fedtext/spiders/tutorial_spider.py | import scrapy
import csv
from bs4 import BeautifulSoup
from bs4.element import Comment
from scrapy.http.request import Request
from fedtext.items import FedtextItem
class TutorialSpider(scrapy.Spider):
name = "tutorialspider"
allowed_domains = ['*.gov']
start_urls = []
# Overrride this function in t... | import scrapy
from bs4 import BeautifulSoup
from bs4.element import Comment
from scrapy.http.request import Request
from fedtext.items import FedtextItem
class TutorialSpider(scrapy.Spider):
name = "tutorialspider"
allowed_domains = ['*.gov']
start_urls = []
# Overrride this function in the base cla... | cc0-1.0 | Python |
539e02739aa7e2b8c7b3544b787e0e6606c81456 | use a working default in unittest | infothrill/python-dyndnsc,infothrill/python-dyndnsc | dyndnsc/tests/test_conf.py | dyndnsc/tests/test_conf.py | # -*- coding: utf-8 -*-
import unittest
from dyndnsc.conf import getConfiguration
from dyndnsc.resources import getFilename, PROFILES_INI
class TestConfig(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
def tearDown(self):
unittest.TestCase.tearDown(self)
def testge... | # -*- coding: utf-8 -*-
import unittest
from dyndnsc.conf import getConfiguration
class TestConfig(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
def tearDown(self):
unittest.TestCase.tearDown(self)
def testgetConfiguration(self):
getConfiguration()
| mit | Python |
187730f85e9f8bb87cb5f8fc8d1c4615a6724061 | fix dev | ustream/openduty,ustream/openduty,ustream/openduty,ustream/openduty | openduty/settings_dev.py | openduty/settings_dev.py | from settings import *
DEBUG = True
TEMPLATE_DEBUG = True
# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'database.sql',
'USER': '',
'PASSWORD': '',
'HOST': '',
'P... | from settings import *
DEBUG = True
TEMPLATE_DEBUG = True
# Database
# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'database.sql',
'USER': '',
'PASSWORD': '',
'HOST': '',
'P... | mit | Python |
4cf27f4d001ec71d3af0663ad088d9f51e0017f8 | Update an example test | mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,mdmintz/SeleniumBase,seleniumbase/SeleniumBase,seleniumbase/SeleniumBase | examples/test_apple_site.py | examples/test_apple_site.py | # -*- coding: utf-8 -*-
from seleniumbase import BaseCase
class AppleTests(BaseCase):
def test_apple_developer_site_webdriver_instructions(self):
self.demo_mode = True
self.demo_sleep = 0.5
self.message_duration = 2.0
if self.headless and (
self.browser == "chrome" or s... | # -*- coding: utf-8 -*-
from seleniumbase import BaseCase
class AppleTests(BaseCase):
def test_apple_developer_site_webdriver_instructions(self):
self.demo_mode = True
self.demo_sleep = 0.5
self.message_duration = 2.0
if self.headless and (
self.browser == "chrome" or s... | mit | Python |
7e0bc14ef948d1769ef139f70ed30a9db9649a41 | Fix silly things | tnoff/OpenStack-Account-Setup | openstack_account/cli.py | openstack_account/cli.py | #!/usr/bin/env python
from openstack_account import AccountSetup
import argparse
import logging
import os
import sys
import yaml
log_format = '%(asctime)s-%(levelname)s-%(message)s'
log = logging.getLogger('openstack_account')
log.setLevel(logging.DEBUG)
handle = logging.StreamHandler()
handle.setLevel(logging.DEBUG)
... | #!/usr/bin/env python
from __init__ import AccountSetup
import argparse
import logging
import os
import sys
import yaml
log_format = '%(asctime)s-%(levelname)s-%(message)s'
log = logging.getLogger('openstack_account')
log.setLevel(logging.DEBUG)
handle = logging.StreamHandler()
handle.setLevel(logging.DEBUG)
form = lo... | bsd-2-clause | Python |
8dd8bd6c7d7e1176fafc6993243bca8529f03aa3 | set admin user level | chenyang14/electronic-blackboard,stvreumi/electronic-blackboard,SWLBot/electronic-blackboard,stvreumi/electronic-blackboard,Billy4195/electronic-blackboard,SWLBot/electronic-blackboard,stvreumi/electronic-blackboard,Billy4195/electronic-blackboard,SWLBot/electronic-blackboard,SWLBot/electronic-blackboard,Billy4195/elec... | env_init.sample.py | env_init.sample.py | import pymysql
import subprocess
import bcrypt
import os
try:
with open("mysql_auth.txt","r") as fp:
host = fp.readline().rstrip()
user = fp.readline().rstrip()
passwd = fp.readline().rstrip()
dbname = fp.readline().rstrip()
except:
print("Open authorization file failed")
ex... | import pymysql
import subprocess
import bcrypt
import os
try:
with open("mysql_auth.txt","r") as fp:
host = fp.readline().rstrip()
user = fp.readline().rstrip()
passwd = fp.readline().rstrip()
dbname = fp.readline().rstrip()
except:
print("Open authorization file failed")
ex... | apache-2.0 | Python |
3ddffc0fad6e60f5f24f6c81f6046824a8ac459c | Fix VisibleDeprecationWarning in numpy-dev | astropy/astropy,StuartLittlefair/astropy,dhomeier/astropy,astropy/astropy,lpsinger/astropy,saimn/astropy,StuartLittlefair/astropy,mhvk/astropy,larrybradley/astropy,lpsinger/astropy,aleksandr-bakanov/astropy,mhvk/astropy,mhvk/astropy,mhvk/astropy,astropy/astropy,lpsinger/astropy,astropy/astropy,lpsinger/astropy,StuartLi... | astropy/modeling/tests/test_units_mapping.py | astropy/modeling/tests/test_units_mapping.py | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from astropy import units as u
from astropy.modeling.core import Model, fix_inputs
from astropy.modeling.models import Polynomial1D
class _ExampleModel(Model):
n_inputs = 1
n_outputs = 1
def __init__(self):
... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import numpy as np
from astropy import units as u
from astropy.units import Quantity, UnitsError, equivalencies
from astropy.modeling.core import Model, fix_inputs
from astropy.modeling.models import Polynomial1D
class _ExampleModel(Model)... | bsd-3-clause | Python |
7e8a6d8849d5d4fe1bd5245c92c4911cde2f0be5 | Fix import path shorturl_generate | jeanmask/opps,opps/opps,opps/opps,opps/opps,williamroot/opps,opps/opps,jeanmask/opps,YACOWS/opps,williamroot/opps,YACOWS/opps,jeanmask/opps,williamroot/opps,YACOWS/opps,YACOWS/opps,jeanmask/opps,williamroot/opps | opps/flatpages/models.py | opps/flatpages/models.py | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from opps.core.models import BaseConfig
from opps.containers.signals import shorturl_generate
from opps.articles.models import Article
class FlatPage(Article):
show_in_menu = models.BooleanField(_(u"Show ... | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from opps.core.models import BaseConfig
from opps.articles.signals import shorturl_generate
from opps.articles.models import Article
class FlatPage(Article):
show_in_menu = models.BooleanField(_(u"Show in... | mit | Python |
d60344ccc5da9f66c130acd0175350a75d16de47 | fix file close bug causing errors in pypy | 12yujim/pymtl,tj93/pymtl,cornell-brg/pymtl,tj93/pymtl,Glyfina-Fernando/pymtl,jjffryan/pymtl,12yujim/pymtl,12yujim/pymtl,jjffryan/pymtl,cfelton/pymtl,Glyfina-Fernando/pymtl,cfelton/pymtl,jck/pymtl,cornell-brg/pymtl,jck/pymtl,jck/pymtl,tj93/pymtl,jjffryan/pymtl,Glyfina-Fernando/pymtl,cfelton/pymtl,cornell-brg/pymtl | new_pymtl/translation_tools/verilator_sim.py | new_pymtl/translation_tools/verilator_sim.py | #===============================================================================
# verilator_sim.py
#===============================================================================
#from verilator_cython import verilog_to_pymtl
from verilator_cffi import verilog_to_pymtl
import verilog
import os
import sys
import fil... | #===============================================================================
# verilator_sim.py
#===============================================================================
#from verilator_cython import verilog_to_pymtl
from verilator_cffi import verilog_to_pymtl
import verilog
import os
import sys
import fil... | bsd-3-clause | Python |
8001d748ea076f6cf7d0cde9b85c094f5fcb4088 | Remove session.flush() and session.query() monkey patching | dims/ironic,openstack/ironic,supermari0/ironic,citrix-openstack-build/ironic-lib,redhat-openstack/ironic,NaohiroTamura/ironic,SauloAislan/ironic,dims/ironic,openstack/ironic,froyobin/ironic,pshchelo/ironic,Tan0/ironic,naototty/vagrant-lxc-ironic,NaohiroTamura/ironic,openstack/ironic-lib,emonty/ironic,ramineni/myironic,... | nova/virt/baremetal/db/sqlalchemy/session.py | nova/virt/baremetal/db/sqlalchemy/session.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 NTT DOCOMO, INC.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
#... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 NTT DOCOMO, INC.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
#... | apache-2.0 | Python |
678e3a18e0b7e0b77319e0483dcb94c9aa5b594a | remove old comment | potash/drain,potash/drain | drake.py | drake.py | import itertools
import os
import inspect
from drain.util import StringIO
# returns set of target steps
# used below by get_input_targets and get_output_targets
def get_targets(step, ignore):
outputs = set()
if not ignore and step.is_target():
outputs.add(step)
else:
for i in step.inputs:
... | import itertools
import os
import inspect
from drain.util import StringIO
# returns set of target steps
# used below by get_input_targets and get_output_targets
def get_targets(step, ignore):
outputs = set()
if not ignore and step.is_target():
outputs.add(step)
else:
for i in step.inputs:
... | mit | Python |
aa2b6b15aec33b1962cd3ff37467fca8b9bad0c8 | Update projects.py | ShashaQin/erpnext,ShashaQin/erpnext,ShashaQin/erpnext,ShashaQin/erpnext | erpnext/config/projects.py | erpnext/config/projects.py | from __future__ import unicode_literals
from frappe import _
def get_data():
return [
{
"label": _("Projects"),
"icon": "icon-star",
"items": [
{
"type": "doctype",
"name": "Project",
"description": _("Project master."),
},
{
"type": "doctype",
"name": "Task",
"des... | from __future__ import unicode_literals
from frappe import _
def get_data():
return [
{
"label": _("Projects"),
"icon": "icon-star",
"items": [
{
"type": "doctype",
"name": "Project",
"description": _("Project master."),
},
{
"type": "doctype",
"name": "Task",
"des... | agpl-3.0 | Python |
85ce9394ee2b113d6be817b61b0593bc4004b678 | fix up URLs | lionleaf/dwitter,lionleaf/dwitter,lionleaf/dwitter | dwitter/user/urls.py | dwitter/user/urls.py | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^(?P<url_username>[\w.@+-]+)$',
views.user_feed, {'page_nr': '1', 'sort': 'new'}, name='user_feed'),
url(r'^(?P<url_username>[\w.@+-]+)/(?P<sort>hot|new|top)$',
views.user_feed, {'page_nr': '1'}, name='user_sort_feed'),
... | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^(?P<url_username>[\w.@+-]+)$',
views.user_feed, {'page_nr': '1', 'sort': 'new'}, name='user_feed'),
url(r'^(?P<url_username>[\w.@+-]]+)/(?P<sort>hot|new|top)$',
views.user_feed, {'page_nr': '1'}, name='user_sort_feed'),... | apache-2.0 | Python |
3138ad0884599db6e77611481b9415aceeef77db | Disable session_restore in smoke test. | hgl888/chromium-crosswalk-efl,ondra-novak/chromium.src,Jonekee/chromium.src,TheTypoMaster/chromium-crosswalk,dednal/chromium.src,Just-D/chromium-1,axinging/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,markYoungH/chromium.src,Jonekee/chromium.src,littlstar/chromium.src,dushu1203/chromium.src,krieger-od/nwjs_chrom... | tools/perf/benchmarks/benchmark_unittest.py | tools/perf/benchmarks/benchmark_unittest.py | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Run the first page of every benchmark that has a composable measurement.
Ideally this test would be comprehensive, but the above serves as a
kind of smok... | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Run the first page of every benchmark that has a composable measurement.
Ideally this test would be comprehensive, but the above serves as a
kind of smok... | bsd-3-clause | Python |
cdbf154092b382404908ad1dde600069b19a1046 | fix indent | cmu-db/db-webcrawler,cmu-db/cmdbac,cmu-db/cmdbac,cmu-db/db-webcrawler,cmu-db/db-webcrawler,cmu-db/cmdbac,cmu-db/db-webcrawler,cmu-db/db-webcrawler,cmu-db/cmdbac,cmu-db/cmdbac | core/drivers/submit/submit.py | core/drivers/submit/submit.py | import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
import mechanize
import cookielib
import string
import random
from patterns import patterns, match_any_pattern
import extract
def get_form_index(br, form):
index = 0
for f in br.forms():
if str(f.attrs.get('action', ''... | import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
import mechanize
import cookielib
import string
import random
from patterns import patterns, match_any_pattern
import extract
def get_form_index(br, form):
index = 0
for f in br.forms():
if str(f.attrs.get('action', '')) ... | apache-2.0 | Python |
e173647af5474e4cbda25234f61a2599032b6f5c | refactor example mtext.py | mozman/ezdxf,mozman/ezdxf,mozman/ezdxf,mozman/ezdxf,mozman/ezdxf | examples/entities/mtext.py | examples/entities/mtext.py | # Copyright (c) 2013-2022 Manfred Moitzi
# License: MIT License
import pathlib
import ezdxf
CWD = pathlib.Path("~/Desktop/Outbox").expanduser()
if not CWD.exists():
CWD = pathlib.Path(".")
# ------------------------------------------------------------------------------
# This example adds a MTEXT entity to the mo... | # Copyright (c) 2013-2021 Manfred Moitzi
# License: MIT License
from pathlib import Path
import ezdxf
OUTBOX = Path("~/Desktop/Outbox").expanduser()
doc = ezdxf.new("R2007", setup=True)
msp = doc.modelspace()
attribs = {
"char_height": 0.7,
"width": 5.0,
"style": "OpenSans",
}
msp.add_line((-10, -1), (10,... | mit | Python |
7408a7a4a09de5f2309376675168f6b24e35d398 | Fix ALLOWED_HOSTS for staging | uktrade/navigator,uktrade/navigator,uktrade/navigator,uktrade/navigator | app/navigator/settings/staging.py | app/navigator/settings/staging.py | from .base import *
DEBUG = False
ALLOWED_HOSTS = ['selling-online-overseas.export.staging.uktrade.io',
'dit-navigator-staging.herokuapp.com',
'navigator-staging.cloudapps.digital']
ADMINS = (('David Downes', 'david@downes.co.uk'),)
RESTRICT_IPS = True
ALLOW_AUTHENTICATED = True
ALL... | from .base import *
DEBUG = False
ALLOWED_HOSTS = ['selling-online-overseas.export.staging.uktrade.io', 'dit-navigator-staging.herokuapp.com', 'selling-online-overseas.export.staging.uktrade.io']
ADMINS = (('David Downes', 'david@downes.co.uk'),)
RESTRICT_IPS = True
ALLOW_AUTHENTICATED = True
ALLOW_ADMIN = True
SESS... | mit | Python |
85791adfd28f1b98a6b43700254dd9cfded54791 | Fix SupportedBy issue. | KarlGong/easyium,KarlGong/easyium-python | easyium/decorator.py | easyium/decorator.py | __author__ = 'karl.gong'
from .exceptions import UnsupportedOperationForWebDriver
def SupportedBy(*web_driver_types):
def handle_func(func):
def handle_args(*args, **kwargs):
wd_types = []
for wd_type in web_driver_types:
if isinstance(wd_type, list):
... | __author__ = 'karl.gong'
from .exceptions import UnsupportedOperationForWebDriver
def SupportedBy(*web_driver_types):
def handle_func(func):
def handle_args(*args, **kwargs):
wd_types = []
for wd_type in web_driver_types:
wd_types += wd_type
current_we... | apache-2.0 | Python |
706b640a31b08142562997b8d561ad2475b44cd4 | Add test for #280 | CybOXProject/python-cybox | cybox/test/core/event_test.py | cybox/test/core/event_test.py | # Copyright (c) 2015, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import unittest
from mixbox.vendor.six import u
from cybox.core import Event, Observable
from cybox.test import EntityTestCase
class TestEvent(EntityTestCase, unittest.TestCase):
klass = Event
_full_dic... | # Copyright (c) 2015, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
import unittest
from mixbox.vendor.six import u
from cybox.core import Event
from cybox.test import EntityTestCase
class TestEvent(EntityTestCase, unittest.TestCase):
klass = Event
_full_dict = {
... | bsd-3-clause | Python |
be25162f775b5a8af70b6b3a00876308f65b8481 | use the latest selenium version notice | appium/appium,appium/appium,appium/appium,appium/appium,Sw0rdstream/appium,appium/appium,appium/appium | sample-code/examples/python/simple.py | sample-code/examples/python/simple.py | """Be sure to use the latest selenium version
as there might be some problems with JSON serialization
"""
import unittest
from random import randint
from selenium import webdriver
class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
# set up appium
self.driver = webdriver.Remote(
... | # port of simple functional test to python
import unittest
from random import randint
from selenium import webdriver
class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
# set up appium
self.driver = webdriver.Remote(
command_executor='http://127.0.0.1:4723/wd/hub',
... | apache-2.0 | Python |
66fecba971989b41f7ffc1719cc5e75d0c127e2d | fix issue | pyprism/Hiren-Git-Commit-Reminder,pyprism/Hiren-Git-Commit-Reminder | github/tests.py | github/tests.py | from django.core.urlresolvers import resolve
from django.test import TestCase
from django.http import HttpRequest
from django.test import LiveServerTestCase
from django.contrib.auth.models import User
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from sele... | from django.core.urlresolvers import resolve
from django.test import TestCase
from django.http import HttpRequest
from django.test import LiveServerTestCase
from django.contrib.auth.models import User
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from github.views import *
import os
c... | mit | Python |
9181d97b7a0ec7720cdea6a266692713adc4089a | Fix production.py | Niharika29/bugtracker,Niharika29/bugtracker,Niharika29/bugtracker | bugtracker/bugtracker/settings/production.py | bugtracker/bugtracker/settings/production.py | """Production settings and globals."""
from __future__ import absolute_import
from os import environ
from os.path import join, normpath
from .base import *
# Normally you should not import ANYTHING from Django directly
# into your settings, but ImproperlyConfigured is an exception.
from django.core.exceptions import... | """Production settings and globals."""
from __future__ import absolute_import
from os import environ
from os.path import join, normpath
from .base import *
# Normally you should not import ANYTHING from Django directly
# into your settings, but ImproperlyConfigured is an exception.
from django.core.exceptions import... | mit | Python |
fdfc0dd47450a3909d0e7495f164ac969598253e | add missing oslo-incubator options | idegtiarov/gnocchi-rep,leandroreox/gnocchi,idegtiarov/gnocchi-rep,gnocchixyz/gnocchi,sileht/gnocchi,leandroreox/gnocchi,idegtiarov/gnocchi-rep,sileht/gnocchi,gnocchixyz/gnocchi | gnocchi/opts.py | gnocchi/opts.py | # -*- encoding: utf-8 -*-
#
# Copyright © 2014 eNovance
#
# Authors: Julien Danjou <julien@danjou.info>
#
# 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... | # -*- encoding: utf-8 -*-
#
# Copyright © 2014 eNovance
#
# Authors: Julien Danjou <julien@danjou.info>
#
# 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... | apache-2.0 | Python |
e06836ff485fa1ce2939d8ea446519917bfa24bd | fix import of deprecated http handler for S3 handler | huoxudong125/scrapy,cursesun/scrapy,WilliamKinaan/scrapy,starrify/scrapy,chekunkov/scrapy,umrashrf/scrapy,smaty1/scrapy,ssteo/scrapy,wujuguang/scrapy,finfish/scrapy,shaform/scrapy,yarikoptic/scrapy,kalessin/scrapy,bmess/scrapy,arush0311/scrapy,shaform/scrapy,darkrho/scrapy-scrapy,heamon7/scrapy,olafdietsche/scrapy,haii... | scrapy/core/downloader/handlers/s3.py | scrapy/core/downloader/handlers/s3.py | from scrapy import optional_features
from scrapy.exceptions import NotConfigured
from scrapy.utils.httpobj import urlparse_cached
from .http import HTTPDownloadHandler
try:
from boto.s3.connection import S3Connection
except ImportError:
S3Connection = object
class _v19_S3Connection(S3Connection):
"""A dum... | from scrapy import optional_features
from scrapy.exceptions import NotConfigured
from scrapy.utils.httpobj import urlparse_cached
from .http import HttpDownloadHandler
try:
from boto.s3.connection import S3Connection
except ImportError:
S3Connection = object
class _v19_S3Connection(S3Connection):
"""A dum... | bsd-3-clause | Python |
08d838e87bd92dacbbbfe31b19c628b9d3b271a8 | Set default values for fields | plone/plone.server,plone/plone.server | src/plone.example/plone/example/todo.py | src/plone.example/plone/example/todo.py | # -*- encoding: utf-8 -*-
from plone.dexterity.interfaces import IDexterityContent
from plone.dexterity.interfaces import IFormFieldProvider
from plone.server.api.service import Service
from plone.supermodel import model
from zope import schema
from zope.component import adapter
from zope.dublincore.annotatableadapter ... | # -*- encoding: utf-8 -*-
from plone.dexterity.interfaces import IDexterityContent
from plone.dexterity.interfaces import IFormFieldProvider
from plone.server.api.service import Service
from plone.supermodel import model
from zope import schema
from zope.component import adapter
from zope.dublincore.annotatableadapter ... | bsd-2-clause | Python |
2964aed37a7fdae17dff47762d19e9c1324d7e31 | improve fetch file method | PythonSanSebastian/ep-tools,PythonSanSebastian/ep-tools,EuroPython/ep-tools,PythonSanSebastian/ep-tools,EuroPython/ep-tools,EuroPython/ep-tools,EuroPython/ep-tools,PythonSanSebastian/ep-tools | eptools/server_utils.py | eptools/server_utils.py | # coding: utf-8
"""
Helper functions to run commands on the epcon server.
"""
import os
import io
import os.path as op
import subprocess
import logging as log
from invoke import task
from .config import docker_name, epcon_db_path
def epcon_exe_manage(cmd, user='root', host='europython.io',
doc... | # coding: utf-8
"""
Helper functions to run commands on the epcon server.
"""
import os
import os.path as op
import logging as log
from invoke import task
from .config import docker_name, epcon_db_path
def epcon_exe_manage(cmd, user='root', host='europython.io', docker_name=docker_name):
""" Run 'ssh `user`@`h... | mit | Python |
947c25dc9875e14e804484109573236e52864219 | Update csv export response | Connexions/openstax-cms,openstax/openstax-cms,openstax/openstax-cms,openstax/openstax-cms,openstax/openstax-cms,Connexions/openstax-cms | errata/admin_actions.py | errata/admin_actions.py | import unicodecsv
from django.http import HttpResponse
from django.utils.encoding import smart_str
def export_as_csv_action(description="Export selected objects as CSV file",
fields=None, exclude=None, header=True):
"""
This function returns an export csv action
'fields' and 'excl... | import unicodecsv
from django.http import HttpResponse
from django.utils.encoding import smart_str
def export_as_csv_action(description="Export selected objects as CSV file",
fields=None, exclude=None, header=True):
"""
This function returns an export csv action
'fields' and 'excl... | agpl-3.0 | Python |
a67b8a26860773b349a77c31661894cc1d3d0a32 | Handle no entries properly. | kgaughan/dbkit | examples/notary.py | examples/notary.py | #!/usr/bin/env python
"""
A simple microblog/changelog app intended to exercise dbkit's type 1
database driver support for connection pooling.
"""
import web
import sqlite3
import pystache
import dbkit
urls = (
'/', 'most_recent'
)
app = web.application(urls, globals())
pool = dbkit.create_pool(sqlite3, 10, "n... | #!/usr/bin/env python
"""
A simple microblog/changelog app intended to exercise dbkit's type 1
database driver support for connection pooling.
"""
import web
import sqlite3
import pystache
import dbkit
urls = (
'/', 'most_recent'
)
app = web.application(urls, globals())
pool = dbkit.create_pool(sqlite3, 10, "n... | mit | Python |
c07cac923ab29f48d6f809aa87afcef7f2d494ac | fix test | dials/dials,dials/dials,dials/dials,dials/dials,dials/dials | algorithms/symmetry/cosym/test_cosym_target.py | algorithms/symmetry/cosym/test_cosym_target.py | from __future__ import absolute_import, division, print_function
import pytest
from cctbx import sgtbx
from scitbx.array_family import flex
from dials.algorithms.symmetry.cosym.generate_test_data import generate_test_data
from dials.algorithms.symmetry.cosym import engine
from dials.algorithms.symmetry.cosym import ... | from __future__ import absolute_import, division, print_function
import pytest
from cctbx import sgtbx
from scitbx.array_family import flex
from dials.algorithms.symmetry.cosym.generate_test_data import generate_test_data
from dials.algorithms.symmetry.cosym import engine
from dials.algorithms.symmetry.cosym import ... | bsd-3-clause | Python |
6da4cbd0b5545e4ec6e3c7714c95aac7c6748a23 | Fix small typo | XeryusTC/search | astar.py | astar.py | # -*- coding: utf-8 -*-
import heapq
import draw
import grid
import util
def astar(g, start, goal):
closed = set()
open_list = []
heapq.heappush(open_list, (0, start))
g_scores = {start: 0}
came_from = {}
while open_list != []:
prio, current = heapq.heappop(open_list)
if curre... | # -*- coding: utf-8 -*-
import heapq
import draw
import grid
import util
def astar(g, start, goal):
closed = set()
open_list = []
heapq.heappush(open_list, (0, start))
g_scores = {start: 0}
came_from = {}
while open_list != []:
prio, current = heapq.heappop(open_list)
if curre... | mit | Python |
7392fd65db2f9430bf8b93920a885fb5735e31c7 | change rate field's max digits and decimal places | metglobal/django-exchange,metglobal/django-exchange | exchange/models.py | exchange/models.py | from django.db import models
from exchange.managers import ExchangeRateManager
from exchange.iso_4217 import code_list
class Currency(models.Model):
"""Model holds a currency information for a nationality"""
code = models.CharField(max_length=3, unique=True)
name = models.CharField(max_length=64)
cla... | from django.db import models
from exchange.managers import ExchangeRateManager
from exchange.iso_4217 import code_list
class Currency(models.Model):
"""Model holds a currency information for a nationality"""
code = models.CharField(max_length=3, unique=True)
name = models.CharField(max_length=64)
cla... | mit | Python |
8e83dc77360961d0969b2386f9018aec299d0a71 | Create Python virtualenvs quietly. | ronnix/fabtools,badele/fabtools,prologic/fabtools,wagigi/fabtools-python,n0n0x/fabtools-python,pahaz/fabtools,AMOSoft/fabtools,ahnjungho/fabtools,sociateru/fabtools,davidcaste/fabtools,pombredanne/fabtools,hagai26/fabtools,bitmonk/fabtools,fabtools/fabtools | fabtools/icanhaz/python.py | fabtools/icanhaz/python.py | """
Idempotent API for managing python packages
"""
import os.path
from fabtools.files import is_file
from fabtools.python import *
from fabtools.python_distribute import is_distribute_installed, install_distribute
from fabtools.icanhaz import deb
def distribute():
"""
I can haz distribute
"""
deb.pa... | """
Idempotent API for managing python packages
"""
import os.path
from fabtools.files import is_file
from fabtools.python import *
from fabtools.python_distribute import is_distribute_installed, install_distribute
from fabtools.icanhaz import deb
def distribute():
"""
I can haz distribute
"""
deb.pa... | bsd-2-clause | Python |
9b5542836c85ba6c17be907ff3cb011b3e98b63a | Increase logwait to 10 instead of 5 secs | RainCity471/lyCompiler | basic.py | basic.py | import os; # needed for opening/compiling file
import time; # needed for delay
def getPath(allowCancel = True):
"""Ask the user for lilypond file path and return it as string.
Takes one boolean argument as to whether message should say cancelling is allowed or not. Defaults to true, however this may not be suita... | import os; # needed for opening/compiling file
import time; # needed for delay
def getPath(allowCancel = True):
"""Ask the user for lilypond file path and return it as string.
Takes one boolean argument as to whether message should say cancelling is allowed or not. Defaults to true, however this may not be suita... | unlicense | Python |
1e7cbb497260b06ec97b5e103836267446a630b7 | Change Integer to PostiveInteger in Reaction model. | onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site,onepercentclub/onepercentclub-site | apps/reactions/models.py | apps/reactions/models.py | from django.contrib.auth.models import User
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.text import Truncator
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from django... | from django.contrib.auth.models import User
from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.utils.text import Truncator
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
from django... | bsd-3-clause | Python |
4d021d12426d272d0cf30c46f7807824e70ff729 | Improve create message. | andrewguy9/farmfs,andrewguy9/farmfs | farmfs/__init__.py | farmfs/__init__.py | from keydb import keydb
from volume import mkfs as make_volume
def mkfs(args):
make_volume(args.root)
print "FileSystem Created %s" % args.root
exit(0)
def writekey(args):
db = keydb(keys_path(args.root))
value = db.write(args.key, args.value)
exit(0)
def readkey(args):
db = keydb(keys_path(args.root))... | from keydb import keydb
from volume import mkfs as make_volume
def mkfs(args):
make_volume(args.root)
print "FileSystem Created!"
exit(0)
def writekey(args):
db = keydb(keys_path(args.root))
value = db.write(args.key, args.value)
exit(0)
def readkey(args):
db = keydb(keys_path(args.root))
value = db.... | mit | Python |
0bd306729730e21486aedc12f5a49c4945f46e67 | Bump version | thombashi/sqlitebiter,thombashi/sqlitebiter | sqlitebiter/__init__.py | sqlitebiter/__init__.py | VERSION = "0.2.1"
| VERSION = "0.2.0"
| mit | Python |
11318a01c3ac72cbda8352a9fcaab8c1958c94d4 | Add docstring for exists method of ms tools. | azatoth/scons,azatoth/scons,azatoth/scons,azatoth/scons,azatoth/scons | src/engine/SCons/Tool/MSVCCommon/version.py | src/engine/SCons/Tool/MSVCCommon/version.py | import SCons.Util
from SCons.Tool.MSVCCommon.common import SUPPORTED_VERSIONS
from SCons.Tool.MSVCCommon.findloc import find_bat
# Default value of VS to use
DEFVERSIONSTR = "9.0"
DEFVERSION = float(DEFVERSIONSTR)
def query_versions():
"""Query the system to get available versions of VS. A version is
... | import SCons.Util
from SCons.Tool.MSVCCommon.common import SUPPORTED_VERSIONS
from SCons.Tool.MSVCCommon.findloc import find_bat
# Default value of VS to use
DEFVERSIONSTR = "9.0"
DEFVERSION = float(DEFVERSIONSTR)
def query_versions():
"""Query the system to get available versions of VS. A version is
... | mit | Python |
e43a270f0b571661e2a6546a83785b8b97c95113 | Increment version | kyamagu/psd2svg | src/psd2svg/version.py | src/psd2svg/version.py | __version__ = '0.1.0a2'
| __version__ = '0.1.0a1'
| mit | Python |
bbcb357a7121c54c95e809ab5cd5d3809845068a | Add library dir on Linux for pyclblast | CNugteren/CLBlast,CNugteren/CLBlast,gpu/CLBlast,gpu/CLBlast,CNugteren/CLBlast,gpu/CLBlast | src/pyclblast/setup.py | src/pyclblast/setup.py |
# This file is part of the CLBlast project. The project is licensed under Apache Version 2.0.
# This file follows the PEP8 Python style guide and uses a max-width of 100 characters per line.
#
# Author(s):
# Cedric Nugteren <www.cedricnugteren.nl>
from setuptools import setup
from distutils.extension import Extens... |
# This file is part of the CLBlast project. The project is licensed under Apache Version 2.0.
# This file follows the PEP8 Python style guide and uses a max-width of 100 characters per line.
#
# Author(s):
# Cedric Nugteren <www.cedricnugteren.nl>
from setuptools import setup
from distutils.extension import Extens... | apache-2.0 | Python |
95706d22c02fd99fb075f2ea9f9f605b2509a199 | Make working board | jonbrohauge/pySudokuSolver | board.py | board.py | class Board(object):
"""This class defines the board"""
def __init__(self, board_size):
"""The initializer for the class"""
self.board_size = board_size
self.board = []
for index in range(0, self.board_size):
self.board.append(['0'] * self.board_size)
def is_on... | class Board(object):
"""This class defines the board"""
def __init__(self, board_size):
"""The initializer for the class"""
self.board_size = board_size
self.board = []
for index in range(0, self.board_size):
value = str(index)
self.board.append(['O'] * ... | mit | Python |
04b860ba99a9f363fbe8f374f27a96ca7bb7abf6 | reduce side bar cat size | Psycojoker/voltairine,Psycojoker/voltairine,Psycojoker/voltairine | sections/templatetags/section_tags.py | sections/templatetags/section_tags.py | from django import template
from sections.models import Permission
register = template.Library()
@register.simple_tag
def is_user_have_access(section, user):
if Permission.objects.filter(user=user, section=section).exists():
return "true"
return "false"
@register.simple_tag
def is_group_have_acce... | from django import template
from sections.models import Permission
register = template.Library()
@register.simple_tag
def is_user_have_access(section, user):
if Permission.objects.filter(user=user, section=section).exists():
return "true"
return "false"
@register.simple_tag
def is_group_have_acce... | agpl-3.0 | Python |
3cbd66a0386369fa0ccc031bee490325b397f8db | add url edit | xeroz/crud-django,xeroz/crud-django | posts/urls.py | posts/urls.py | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.posts_home),
url(r'^index/', views.post_list, name = 'index'),
url(r'^create/', views.post_create, name = 'create'),
url(r'^edit/(?P<id>\d+)/$', views.post_edit, name = 'edit'),
] | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.posts_home),
url(r'^create/', views.post_create),
url(r'^index/', views.post_list),
] | mit | Python |
56868bc431e577a3be83d0ca10d99c789f87f393 | print job process | jingxiang-li/kaggle-yelp,jingxiang-li/kaggle-yelp | preprocess.py | preprocess.py | from __future__ import division, absolute_import
from __future__ import print_function, unicode_literals
import pandas as pd
from transfer_features import *
# process training data
biz2label = pd.read_csv("rawdata/train.csv", index_col=0)
photo2biz = pd.read_csv("rawdata/train_photo_to_biz_ids.csv", index_col=0)
biz2... | from __future__ import division, absolute_import
from __future__ import print_function, unicode_literals
import pandas as pd
from transfer_features import *
# process training data
biz2label = pd.read_csv("rawdata/train.csv", index_col=0)
photo2biz = pd.read_csv("rawdata/train_photo_to_biz_ids.csv", index_col=0)
biz2... | mit | Python |
2f171cae0572b1fc8dbb2019248f201e4856a2ff | fix TimestampQueue | aamalev/aioworkers,aioworkers/aioworkers | aioworkers/queue/timeout.py | aioworkers/queue/timeout.py | import asyncio
import heapq
import time
from .base import AbstractQueue
class TimestampQueue(AbstractQueue):
async def init(self):
self._future = None
self._queue = []
self._waiters = []
def __len__(self):
return len(self._queue)
async def get(self):
if self._que... | import asyncio
import heapq
import time
from .base import AbstractQueue
class TimestampQueue(AbstractQueue):
async def init(self):
self._future = None
self._queue = []
self._waiters = []
def __len__(self):
return len(self._queue)
async def get(self):
timestamp, v... | apache-2.0 | Python |
ce2eb0753a312805b80f8d89ec96a328eff4f155 | add explicit parentheses in dictionary key | czpython/aldryn-newsblog,czpython/aldryn-newsblog,czpython/aldryn-newsblog,czpython/aldryn-newsblog,mkoistinen/aldryn-newsblog,mkoistinen/aldryn-newsblog,mkoistinen/aldryn-newsblog | aldryn_newsblog/managers.py | aldryn_newsblog/managers.py | try:
from collections import Counter
except ImportError:
from backport_collections import Counter
import datetime
from parler.managers import TranslatableManager
class RelatedManager(TranslatableManager):
def get_query_set(self):
qs = super(RelatedManager, self).get_query_set()
return q... | try:
from collections import Counter
except ImportError:
from backport_collections import Counter
import datetime
from parler.managers import TranslatableManager
class RelatedManager(TranslatableManager):
def get_query_set(self):
qs = super(RelatedManager, self).get_query_set()
return q... | bsd-3-clause | Python |
6aba68246125cee663f6b4225c08b6d3134c6a37 | Set version as 0.8.19 | Alignak-monitoring-contrib/alignak-backend,Alignak-monitoring-contrib/alignak-backend,Alignak-monitoring-contrib/alignak-backend,Alignak-monitoring-contrib/alignak-backend | alignak_backend/__init__.py | alignak_backend/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Alignak REST backend
This module is an Alignak REST backend
"""
# Application version and manifest
VERSION = (0, 8, 19)
__application__ = u"Alignak_Backend"
__short_version__ = '.'.join((str(each) for each in VERSION[:2]))
__version__ = '.'.join((str(each) f... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Alignak REST backend
This module is an Alignak REST backend
"""
# Application version and manifest
VERSION = (0, 8, 18)
__application__ = u"Alignak_Backend"
__short_version__ = '.'.join((str(each) for each in VERSION[:2]))
__version__ = '.'.join((str(each) f... | agpl-3.0 | Python |
a8c14ed6c357433d674d1d6dfaa211bb1b880d16 | Update zipslip_bad.py | 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/query-tests/Security/CWE-022/zipslip_bad.py | python/ql/test/experimental/query-tests/Security/CWE-022/zipslip_bad.py | import tarfile
import shutil
import bz2
import gzip
import zipfile
def unzip(filename):
with tarfile.open(filename) as zipf:
#BAD : This could write any file on the filesystem.
for entry in zipf:
shutil.move(entry, "/tmp/unpack/")
def unzip1(filename):
with gzip.open(filename) as zipf... | import tarfile
import shutil
import bz2
import gzip
import zipfile
def unzip(filename):
with tarfile.open(filename) as zipf:
#BAD : This could write any file on the filesystem.
for entry in zipf:
shutil.move(entry, "/tmp/unpack/")
def unzip1(filename):
with gzip.open(filenam... | mit | Python |
ae22058e209de2b8bbd693b4a31ad68947b5ba41 | Set version to 1.3.0 final | WSULib/eulfedora | eulfedora/__init__.py | eulfedora/__init__.py | # file eulfedora/__init__.py
#
# Copyright 2010,2011 Emory University Libraries
#
# 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
#
... | # file eulfedora/__init__.py
#
# Copyright 2010,2011 Emory University Libraries
#
# 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
#
... | apache-2.0 | Python |
9d2547e27e242fa8dabd7d28ff154c7826330867 | remove debug statement | bmihelac/django-mail-instances | mail_instances/models.py | mail_instances/models.py | from datetime import datetime
import logging
from django.utils.translation import ugettext_lazy as _
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.core.mail import EmailMultiAlternatives
from django.utils.html import ... | from datetime import datetime
import logging
from django.utils.translation import ugettext_lazy as _
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.core.mail import EmailMultiAlternatives
from django.utils.html import ... | bsd-2-clause | Python |
dcd22f08d546190bfb4b35e0181393c6f342ae7a | Add tests of adding only one rule | PatrikValkovic/grammpy | tests/rules_tests/grammarManipulation_tests/RuleAddingTest.py | tests/rules_tests/grammarManipulation_tests/RuleAddingTest.py | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
"""
from unittest import main, TestCase
from grammpy import Rule as _R, Grammar, Nonterminal as _N
class NFirst(_N):
pass
class NSecond(_N):
pass
class NThird(_N):
pass
class NFourth(_N):
... | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
"""
from unittest import main, TestCase
from grammpy import Rule, Grammar, Nonterminal as _N
class NFirst(_N):
pass
class NSecond(_N):
pass
class NThird(_N):
pass
class NFourth(_N):
pass
... | mit | Python |
e0cb4b8cc24528785fa6f0b2c2384fbaf7ce2d15 | Define interfaces of blocks of functionality. | ralphm/idavoll | idavoll/backend.py | idavoll/backend.py | from twisted.python import components
from twisted.application import service
from twisted.xish import utility
class Error(Exception):
msg = ''
def __str__(self):
return self.msg
class NodeNotFound(Error):
msg = 'Node not found'
class NotAuthorized(Error):
pass
class PayloadExpected(Err... | from twisted.python import components
class IService(components.Interface):
""" Interface to a backend service of a pubsub service """
def do_publish(self, node, publisher, item):
""" Returns a deferred that returns """
class Error(Exception):
msg = ''
def __str__(self):
return self.msg
class NodeNotFound... | mit | Python |
c9b8d6c76440b08502eccb283b4aa9d0cb63f38f | Add a useful tip when proper Python version not found | jtackaberry/stagehand,jtackaberry/stagehand | stagehand/bootstrap.py | stagehand/bootstrap.py | # Bootstrap entry into stagehand.main.
#
# Here we aim to be compatible with both Python 2 and Python 3 so that if the
# user's version isn't compatible, we can actually report that.
import sys
import os
if sys.platform == 'win32' and 'pythonw' in sys.executable.lower():
# If we are running under pythonw... | # Bootstrap entry into stagehand.main.
#
# Here we aim to be compatible with both Python 2 and Python 3 so that if the
# user's version isn't compatible, we can actually report that.
import sys
import os
if sys.platform == 'win32' and 'pythonw' in sys.executable.lower():
# If we are running under pythonw... | mit | Python |
a6ab478076fc1d8a28f131cf68ff8d1d084868cb | Use vendored api_client instead of dmapiclient in /suppliers/<code> | AusDTO/dto-digitalmarketplace-buyer-frontend,AusDTO/dto-digitalmarketplace-buyer-frontend,AusDTO/dto-digitalmarketplace-buyer-frontend,AusDTO/dto-digitalmarketplace-buyer-frontend | app/main/views/suppliers.py | app/main/views/suppliers.py | # coding=utf-8
import re
from flask import render_template
from app.main import main
from app.api_client.data import DataAPIClient
def process_prefix(prefix=None, format='view'):
if prefix == u"other": # special case
if format == 'api':
return u"other"
else:
return prefi... | # coding=utf-8
from string import ascii_uppercase
from app.main import main
from flask import render_template, request, abort
from app import data_api_client
from dmapiclient import APIError
from ...helpers.shared_helpers import parse_link
import re
try:
from urlparse import urlparse, parse_qs
except ImportError:
... | mit | Python |
e3ff4fedc321c6dccdd1e6169eee571adc44ced1 | fix bug with maintenance if object is not a file, fix #39 | fnkr/POSS,fnkr/POSS,fnkr/POSS,fnkr/POSS | app/maintenance/__init__.py | app/maintenance/__init__.py | # Utils
import os.path
import inspect
# POSS
from app import app
from app import db
# POSS Models
from app.objects.models import Object
from app.stats.models import View
from app.stats.models import Referrer
from app.stats.models import UserAgent
def maintenance():
maintenance_referrer_useragent()
maintenan... | # Utils
import os.path
import inspect
# POSS
from app import app
from app import db
# POSS Models
from app.objects.models import Object
from app.stats.models import View
from app.stats.models import Referrer
from app.stats.models import UserAgent
def maintenance():
maintenance_referrer_useragent()
maintenan... | mit | Python |
1280ea05119ab09daf90f7d14edc8e98b2b282a3 | write redirects file | dragoon/kilogram,dragoon/kilogram,dragoon/kilogram | mapreduce/dbpedia_dbm.py | mapreduce/dbpedia_dbm.py | """
Creates DBPedia labels-types file of the following format:
{ LABEL: [Type1, Type2, ...], ...}
For example:
Tramore: Town, Settlement, PopulatedPlace, Place
Tramore,_Ireland: Town, Settlement, PopulatedPlace, Place
"""
import codecs
import subprocess
import urllib
from collections import defaultdi... | """
Creates DBPedia labels-types file of the following format:
{ LABEL: [Type1, Type2, ...], ...}
For example:
Tramore: Town, Settlement, PopulatedPlace, Place
Tramore,_Ireland: Town, Settlement, PopulatedPlace, Place
"""
import codecs
import subprocess
import urllib
from collections import defaultdi... | apache-2.0 | Python |
952f0c05156b9e3fd993a4434252e6f8d45afb87 | Fix to make sure application works without make | Regaerd/PseudoBusy | pseudoBusy.py | pseudoBusy.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, platform, printer, randomPlusPlus
class PseudoBusy():
def __init__(self):
self.rand = randomPlusPlus.RandomPlutPlus()
self.printer = printer.Printer(self.rand)
self.compiled = True
def run(self):
# TODO search for files ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, platform, printer, randomPlusPlus
class PseudoBusy():
def __init__(self):
self.rand = randomPlusPlus.RandomPlutPlus()
self.printer = printer.Printer(self.rand)
def run(self):
# TODO search for files on users filesystem
#... | mit | Python |
23dc2a3c67671350ada11d6bd24e9ae00510e4ad | Fix search index | wetneb/dissemin,dissemin/dissemin,dissemin/dissemin,wetneb/dissemin,dissemin/dissemin,wetneb/dissemin,dissemin/dissemin,wetneb/dissemin,dissemin/dissemin | papers/search_indexes.py | papers/search_indexes.py | from haystack import indexes
from papers.utils import remove_diacritics
from .models import Paper
from .models import Researcher
class PaperIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, model_attr='title')
pubdate = indexes.DateField(model_attr='pubdate')
combined_... | from haystack import indexes
from papers.utils import remove_diacritics
from .models import Paper
from .models import Researcher
class PaperIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, model_attr='title')
pubdate = indexes.DateField(model_attr='pubdate')
combined_... | agpl-3.0 | Python |
7a77d4e88c1b5d9a73a4beebfcf82453e81e502b | Update edges.py to work with nested files. | pachyderm/pfs,pachyderm/pfs,pachyderm/pfs | examples/opencv/edges.py | examples/opencv/edges.py | import cv2
import numpy as np
from matplotlib import pyplot as plt
import os
# make_edges reads an image from /pfs/images and outputs the result of running
# edge detection on that image to /pfs/out. Note that /pfs/images and
# /pfs/out are special directories that Pachyderm injects into the container.
def make_edges... | import cv2
import numpy as np
from matplotlib import pyplot as plt
import os
# make_edges reads an image from /pfs/images and outputs the result of running
# edge detection on that image to /pfs/out. Note that /pfs/images and
# /pfs/out are special directories that Pachyderm injects into the container.
def make_edges... | apache-2.0 | Python |
4f7582569263f96655ae7bd7d36a65ddc1205a4c | Set echo=False in GetSvnRevision | Tiger66639/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,google/skia-buildbot,Tiger66639/skia-buildbot,google/skia-buildbot,Ti... | slave/skia_slave_scripts/run_bench.py | slave/skia_slave_scripts/run_bench.py | #!/usr/bin/env python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Run the Skia benchmarking executable. """
from build_step import BuildStep
from utils import shell_utils
import os
import re
i... | #!/usr/bin/env python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
""" Run the Skia benchmarking executable. """
from build_step import BuildStep
from utils import shell_utils
import os
import re
i... | bsd-3-clause | Python |
782a9219378278eea119adb61ec3bc97520a0336 | Change format of the send_msg profiling log | OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft,OpenMined/PySyft | syft/core/profiling.py | syft/core/profiling.py | from datetime import datetime
import cProfile
import pstats
from functools import wraps
PROFILE_MODE = True
SEND_MSG_STATS_LOG = 'send_msg_profiling.log'
LOGFILE_LINE_FORMAT = '''{}\tFrom: {}\tTo: {}\ttype: {}\t{:.2f} ms\ttotal calls: {}\n'''
# how many milliseconds there are in one second
MS_IN_S = 1000
def save_... | from datetime import datetime
import cProfile
import pstats
from functools import wraps
PROFILE_MODE = True
SEND_MSG_STATS_LOG = 'send_msg_profiling.log'
LOGFILE_LINE_FORMAT = '''{}\t{}->{}\t{}:{}\t{:.2f} ms\ttotal calls: {}\n'''
# how many milliseconds there are in one second
MS_IN_S = 1000
def save_send_msg_stat... | apache-2.0 | Python |
29a964a64230e26fca550e81a1ecba3dd782dfb1 | Refresh system instead of clobbering it | chiphogg/vim-vtd | python/vtd.py | python/vtd.py | import libvtd.trusted_system
def UpdateTrustedSystem(file_name):
"""Make sure the TrustedSystem object is up to date."""
global my_system
if 'my_system' not in globals():
my_system = libvtd.trusted_system.TrustedSystem()
my_system.AddFile(file_name)
my_system.Refresh()
| import libvtd.trusted_system
def UpdateTrustedSystem(file_name):
"""Make sure the TrustedSystem object is up to date."""
global my_system
my_system = libvtd.trusted_system.TrustedSystem()
my_system.AddFile(file_name)
| apache-2.0 | Python |
0d9f139d09e37fe2e4113ee25477b2b0ad77d5f8 | Bump version | genestack/python-client | genestack_client/version.py | genestack_client/version.py | __version__ = '0.22.0a1'
| __version__ = '0.21.0'
| mit | Python |
0d17b0bf2962e4b147d3dcde3d2bd13504e944fd | Allow non-debug mode. | ucarion/git-code-debt,Yelp/git-code-debt,Yelp/git-code-debt,Yelp/git-code-debt,ucarion/git-code-debt,ucarion/git-code-debt,Yelp/git-code-debt | git_code_debt/server/app.py | git_code_debt/server/app.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import flask
import os.path
import pkg_resources
import shutil
import sqlite3
import sys
from git_code_debt.server.servlets.changes import changes
from git_code_debt.server.servlets.com... | from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import flask
import os.path
import pkg_resources
import shutil
import sqlite3
import sys
from git_code_debt.server.servlets.changes import changes
from git_code_debt.server.servlets.com... | mit | Python |
62c814b6b60f5b5605e34c9806d874fe1088d416 | use 2to3 if building with Python 3 | destenson/git,destenson/git,destenson/git,destenson/git,destenson/git,destenson/git,destenson/git,destenson/git | git_remote_helpers/setup.py | git_remote_helpers/setup.py | #!/usr/bin/env python
"""Distutils build/install script for the git_remote_helpers package."""
from distutils.core import setup
# If building under Python3 we need to run 2to3 on the code, do this by
# trying to import distutils' 2to3 builder, which is only available in
# Python3.
try:
from distutils.command.bui... | #!/usr/bin/env python
"""Distutils build/install script for the git_remote_helpers package."""
from distutils.core import setup
setup(
name = 'git_remote_helpers',
version = '0.1.0',
description = 'Git remote helper program for non-git repositories',
license = 'GPLv2',
author = 'The Git Community... | mit | Python |
20f4febce7edbc87fdc82e2c135435bf186bcda4 | Make the source the default file output of go_source (#1201) | Xjs/rules_go,bazelbuild/rules_go,Xjs/rules_go,bazelbuild/rules_go,bazelbuild/rules_go,Xjs/rules_go,Xjs/rules_go,bazelbuild/rules_go,Xjs/rules_go,bazelbuild/rules_go | go/private/rules/source.bzl | go/private/rules/source.bzl | # Copyright 2017 The Bazel 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 applicable la... | # Copyright 2017 The Bazel 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 applicable la... | apache-2.0 | Python |
5a073c8729726bc2f5c6fbec71e18b00910a7fbc | Fix tests for PluginStats | VISTAS-IVES/pyvistas | source/tests/core/test_pluginstats.py | source/tests/core/test_pluginstats.py | import json
from io import StringIO
from unittest.mock import patch, mock_open, MagicMock
from vistas.core.plugins import stats
data_file_contents = b'I am a data file'
var_data = {
'min_value': 1.3362300395965576,
'max_value': 30.22311019897461,
'nodata_value': -9999.0,
'shape': [67, 86]
}
cache_da... | from pytest import fixture
from vistas.core.plugins.stats import PluginStats, VariableStats
data = {
'min_value': 1.3362300395965576,
'max_value': 30.22311019897461,
'nodata_value': -9999.0,
'shape': [67, 86]
}
@fixture(scope='session')
def stats_file(tmpdir_factory):
path = str(tmpdir_factory.m... | bsd-3-clause | Python |
3dc840fb434091bf2b11977e962568eb54534d15 | Fix minor bug for noop firewall engine. | Mirantis/vmware-dvs,Mirantis/vmware-dvs,ekosareva/vmware-dvs,VTabolin/vmware-dvs,ekosareva/vmware-dvs | vmware_dvs/agent/firewalls/noop_firewall.py | vmware_dvs/agent/firewalls/noop_firewall.py | # Copyright 2012, Nachi Ueno, NTT MCL, Inc., 2016 Mirantis, Inc.
# 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/LICENS... | # Copyright 2012, Nachi Ueno, NTT MCL, Inc., 2016 Mirantis, Inc.
# 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/LICENS... | apache-2.0 | Python |
6470d0cbdef573fc7705ac8eb9c2999da7c6617e | Fix typo | Microcore/KeyCounter,Microcore/KeyCounter | build.py | build.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import platform
import subprocess
import sys
import dmgbuild
PYTHON_SCRIPTS_DIR = os.path.join(os.path.dirname(sys.executable), 'Scripts')
DMGBUILD_SCRIPT = os.path.join(
os.path.dirname(dmgbuild.__file__), 'scripts', 'dmgbuild'
)
def execute(cmd):
'''... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import platform
import subprocess
import sys
import dmgbuild
PYTHON_SCRIPTS_DIR = os.path.join(os.path.dirname(sys.executable), 'Scripts')
DMGBUILD_SCRIPT = os.path.join(
os.path.dirname(dmgbuil.__file__), 'scripts', 'dmgbuild'
)
def execute(cmd):
'''E... | mit | Python |
2a253823630f639c99bc306955d52f97155e2b8f | convert pathlib.Path to str before passing to subprocess | googlefonts/ots-python,googlefonts/ots-python | build.py | build.py | #!/usr/bin/env python3
"""Run meson and ninja to build the ots-sanitize executable from source.
NOTE: This script requires Python 3.6 or above. However the generated binary
is independent from the python version used to run it.
"""
import sys
from pathlib import Path
import os
import subprocess
import shutil
import er... | #!/usr/bin/env python3
"""Run meson and ninja to build the ots-sanitize executable from source.
NOTE: This script requires Python 3.6 or above. However the generated binary
is independent from the python version used to run it.
"""
import sys
from pathlib import Path
import os
import subprocess
import shutil
import er... | bsd-3-clause | Python |
26e47d90dc7a6961429e39a8ccf5b10636a72986 | remove obsolete code | arnehilmann/sunstone-rest-client,arnehilmann/sunstone-rest-client | build.py | build.py | from pybuilder.core import use_plugin, init, Author, task
use_plugin("python.core")
use_plugin("python.unittest")
use_plugin("python.install_dependencies")
use_plugin("python.flake8")
use_plugin("python.coverage")
use_plugin("python.distutils")
use_plugin('copy_resources')
use_plugin('filter_resources')
name = "sunst... | from pybuilder.core import use_plugin, init, Author, task
use_plugin("python.core")
use_plugin("python.unittest")
use_plugin("python.install_dependencies")
use_plugin("python.flake8")
use_plugin("python.coverage")
use_plugin("python.distutils")
use_plugin('copy_resources')
use_plugin('filter_resources')
name = "sunst... | apache-2.0 | Python |
31bb45ff156f97daedfb9c4dffea2d61c6884eae | Fix proto import | mediachain/mediachain-client,mediachain/mediachain-client | mediachain/reader/api.py | mediachain/reader/api.py | import boto3
import cbor
from grpc.beta import implementations
from mediachain.proto import Transactor_pb2
from collections import namedtuple
Config = namedtuple('Config', ['host', 'port'])
def get_client(host, port):
channel = implementations.insecure_channel(host, port)
return Transactor_pb2.beta_create_Tra... | import boto3
import cbor
from grpc.beta import implementations
from mediachain import Transactor_pb2
from collections import namedtuple
Config = namedtuple('Config', ['host', 'port'])
def get_client(host, port):
channel = implementations.insecure_channel(host, port)
return Transactor_pb2.beta_create_Transacto... | mit | Python |
f7e67483542e6d828d7d4e0be1308b1818753386 | Add pep8 and encode | vic/typhon,vic/typhon | examples/builtins.py | examples/builtins.py | # -*- coding: utf-8 -*-
"""wat"""
print __name__
print __doc__
print object
| "wat"
print __name__
print __doc__
print object
| bsd-3-clause | Python |
b532ffff18e95b6014921d88b6df075e8ac2c4ec | Update mathdeck problib for new Answer refactoring | patrickspencer/mathdeck,patrickspencer/mathdeck | problib/example1/__init__.py | problib/example1/__init__.py | from sympy import symbols, cos, sin, latex
from mathdeck import rand, answer
metadata = {
'author': 'Bob Hope',
'institution': 'University of Missouri',
'subject': 'algebra',
'minor subject': 'polynomial equations',
'tags': ['simplify','roots','intervals']
}
r = rand.Random()
# choose three random integers... | from sympy import symbols, cos, sin, latex
from mathdeck import rand, answer
metadata = {
'author': 'Bob Hope',
'institution': 'University of Missouri',
'subject': 'algebra',
'minor subject': 'polynomial equations',
'tags': ['simplify','roots','intervals']
}
r = rand.Random()
# choose three random integers... | apache-2.0 | Python |
8616642aac317baeb7fcd2d4fad8d687b10cb759 | fix typos in docs | ferrine/gelato,ferrine/gelato | gelato/variational/elbo.py | gelato/variational/elbo.py | import theano.tensor as tt
import theano
from .utils import variational_replacements, flatten
from .math import log_normal3
def sample_elbo(model, population=None, samples=1, pi=1):
""" pi*KL[q(w|mu,rho)||p(w)] + E_q[log p(D|w)]
approximated by Monte Carlo sampling
Parameters
----------
model : p... | import theano.tensor as tt
import theano
from .utils import variational_replacements, flatten
from .math import log_normal3
def sample_elbo(model, population=None, samples=1, pi=1):
""" pi*KL[q(w|mu,rho)||p(w)] + E_q[log p(D|w)]
approximated by montecarlo sampling
Parameters
----------
model : pm... | mit | Python |
2c4d41a9eb44c0321196b5a3969fa0e843e1b581 | Clarify test | meshy/framewirc | asyncio_irc/tests/test_message.py | asyncio_irc/tests/test_message.py | from itertools import product
from unittest import TestCase
from ..message import Message
class TestMessage(TestCase):
"""Test the Message class."""
def build_message(self, prefix, params, trailing):
raw_message = b'COMMAND'
if prefix:
raw_message = b':prefixed-data ' + raw_messag... | from itertools import product
from unittest import TestCase
from ..message import Message
class TestMessage(TestCase):
"""Test the Message class."""
def test_possibilities(self):
"""
Make sure that Messages can be created.
Checks every combination of a prefix, params, and trailing da... | bsd-2-clause | Python |
a9ae5c42e50b1f13306c0104da29ae441003af24 | modify example for pyrolite. | kurniawano/pythymiodw | examples/testpyrolite.py | examples/testpyrolite.py | from pythymiodw.pyro import ThymioMR
import time
thymio = ThymioMR()
print('Changing wheel speed.')
thymio.wheels(100,101)
print('Now run C# project to change prox_horizontal and prox_ground.')
print('You have 15 sec before this code starts to read.')
time.sleep(15)
print(thymio.prox_horizontal)
pg = thymio.prox_groun... | from pythymiodw.pyro import ThymioMR
import time
thymio = ThymioMR()
print('Changing wheel speed.')
thymio.wheels(100,101)
time.sleep(10)
print(thymio.prox_horizontal)
pg = thymio.prox_ground
print(pg.delta, pg.ambiant, pg.reflected)
thymio.quit()
| mit | Python |
b0dc917e37d1d85b1e6d1162810684e63155a078 | Remove basic logging setup in config.py | Kotaimen/awscfncli,Kotaimen/awscfncli | awscfncli/config/config.py | awscfncli/config/config.py | # -*- encoding: utf-8 -*-
import logging
import yaml
from .schema import validate_config
def load_config(filename):
logging.debug('Loading config "%s"' % filename)
with open(filename) as fp:
config = yaml.safe_load(fp)
if config is None:
config = dict()
return CfnCliConfig(con... | # -*- encoding: utf-8 -*-
import logging
import yaml
from .schema import validate_config
logging.basicConfig(level=logging.DEBUG)
def load_config(filename):
logging.info('Loading config "%s"' % filename)
with open(filename) as fp:
config = yaml.safe_load(fp)
if config is None:
co... | mit | Python |
1ddd112a6ed36fb5fe3bb5081a0d160008e489dd | implement line wrapping | sammdot/circa | circa.py | circa.py | #!/usr/bin/env python3
import sdirc
import yaml
import threading
import importlib
import modules
class Circa(sdirc.Client):
def __init__(self, **conf):
conf["autoconn"] = False
sdirc.Client.__init__(self, **conf)
self.modules = {}
self.add_listener("registered", lambda m: self.send("UMODE2", "+B"))
for m... | #!/usr/bin/env python3
import sdirc
import yaml
import threading
import importlib
import modules
class Circa(sdirc.Client):
def __init__(self, **conf):
conf["autoconn"] = False
sdirc.Client.__init__(self, **conf)
self.modules = {}
self.add_listener("registered", lambda m: self.send("UMODE2", "+B"))
for m... | bsd-3-clause | Python |
e05337c3966331049f8d6399fd0bb3b988a47050 | change os.environ so it's used in nose.main | carlyeks/cassandra-dtest,snazy/cassandra-dtest,pcmanus/cassandra-dtest,pauloricardomg/cassandra-dtest,iamaleksey/cassandra-dtest,iamaleksey/cassandra-dtest,aweisberg/cassandra-dtest,blerer/cassandra-dtest,aweisberg/cassandra-dtest,blerer/cassandra-dtest,thobbs/cassandra-dtest,stef1927/cassandra-dtest,bdeggleston/cassan... | bin/collect_known_failures.py | bin/collect_known_failures.py | """
A script that runs the tests with --collect-only, but instead of just printing
the tests' names, prints the information added by the tools.known_failure
decorator.
This is basically a wrapper around the `nosetests` command, so it takes the
same arguments, though it appends some arguments to sys.argv. In particular... | """
A script that runs the tests with --collect-only, but instead of just printing
the tests' names, prints the information added by the tools.known_failure
decorator.
This is basically a wrapper around the `nosetests` command, so it takes the
same arguments, though it appends some arguments to sys.argv. In particular... | apache-2.0 | Python |
66ecf08cc9cede17374d21f59c11238cb517051c | Bump version to 0.1.5 | peter-wangxu/persist-queue,peter-wangxu/persist-queue | persistqueue/__init__.py | persistqueue/__init__.py | # coding=utf-8
__author__ = 'Peter Wang'
__license__ = 'Apache License Version 2.0'
__version__ = '0.1.5'
import sys # noqa
if sys.version_info < (3, 0):
from Queue import Empty, Full
else:
from queue import Empty, Full
from .queue import Queue # noqa
__all__ = ["Queue", "Empty", "Full", "__author__",
... | # coding=utf-8
__author__ = 'Peter Wang'
__license__ = 'Apache License Version 2.0'
__version__ = '0.1.4'
import sys # noqa
if sys.version_info < (3, 0):
from Queue import Empty, Full
else:
from queue import Empty, Full
from .queue import Queue # noqa
__all__ = ["Queue", "Empty", "Full", "__author__",
... | bsd-3-clause | Python |
26030da010f986fb6e29a0550d593a46a4dbcefe | Fix make-wsgi | statgen/pheweb,statgen/pheweb,statgen/pheweb,statgen/pheweb,statgen/pheweb | pheweb/load/make_wsgi.py | pheweb/load/make_wsgi.py |
from __future__ import print_function, division, absolute_import
from .. import utils
conf = utils.conf
import os
template1 = '''
import os.path
import sys
'''
template2 = '''
path = os.path.join('{venv_dir}/bin/activate_this.py')
with open(path) as f:
code = compile(f.read(), path, 'exec')
exec(code, dict... |
from __future__ import print_function, division, absolute_import
from .. import utils
conf = utils.conf
import os
template1 = '''
import os.path
import sys
'''
template2 = '''
path = os.path.join('{venv_dir}/bin/activate_this.py')
with open(path) as f:
code = compile(f.read(), path, 'exec')
exec(code, dict... | agpl-3.0 | Python |
e982e9707833ef1651b8ed79b87c06d622b59588 | Add dtype parameter to randn initializer | tum-pbs/PhiFlow,tum-pbs/PhiFlow | phi/math/initializers.py | phi/math/initializers.py | from . import struct
from .nd import upsample2x
from .base import backend as math
import numpy as np
from numbers import Number
def _is_python_shape(obj):
if not isinstance(obj, (tuple, list)): return False
for element in obj:
if not isinstance(element, Number) and element is not None: return False
... | from . import struct
from .nd import upsample2x
from .base import backend as math
import numpy as np
from numbers import Number
def _is_python_shape(obj):
if not isinstance(obj, (tuple, list)): return False
for element in obj:
if not isinstance(element, Number) and element is not None: return False
... | mit | Python |
e54a03dfa89800ea8ffc6eaebb03c5ba572bea07 | update usage | battlemidget/juju-layer-ruby | lib/charms/layer/ruby.py | lib/charms/layer/ruby.py | # pylint: disable=import-error
# pylint: disable=no-name-in-module
import os
from charmhelpers.core import hookenv
from charms.layer import snap
config = hookenv.config()
# HELPERS ---------------------------------------------------------------------
def ruby_install():
""" Downloads ruby-install, gpg verifies... | # pylint: disable=import-error
# pylint: disable=no-name-in-module
import os
from charmhelpers.core import hookenv
from charms.layer import snap
config = hookenv.config()
# HELPERS ---------------------------------------------------------------------
def ruby_install():
""" Downloads ruby-install, gpg verifies... | mit | Python |
e603738c9e4c92f448c1a93c45a481ce82a122ba | Update uniprot_taxid.py | malvikasharan/APRICOT,malvikasharan/APRICOT | apricotlib/uniprot_taxid.py | apricotlib/uniprot_taxid.py | #!/usr/bin/env python
# Description = Download the taxonomy ids related to user provided species
# author= "Malvika Sharan <malvika.sharan@uni-wuerzburg.de>"
# email = "malvika.sharan@uni-wuerzburg.de"
# 2016-05-20
def select_taxids(species, reference_taxonomy_file, selected_taxonomy_file):
'''Selects taxonomy ids... | #!/usr/bin/env python
def select_taxids(species, reference_taxonomy_file, selected_taxonomy_file):
'''Selects taxonomy ids for the query species'''
if not str(species) == 'None':
parse_uniprot_tax_file(
species, reference_taxonomy_file, selected_taxonomy_file)
else:
parse_unipr... | isc | Python |
3a9568b4d4de969b1e2031e8d2d3cdd7bd56824f | Fix zulipinternal migration corner case. | brainwane/zulip,andersk/zulip,hackerkid/zulip,synicalsyntax/zulip,andersk/zulip,hackerkid/zulip,punchagan/zulip,shubhamdhama/zulip,showell/zulip,zulip/zulip,synicalsyntax/zulip,kou/zulip,rht/zulip,showell/zulip,brainwane/zulip,punchagan/zulip,shubhamdhama/zulip,hackerkid/zulip,andersk/zulip,kou/zulip,brainwane/zulip,br... | zerver/migrations/0237_rename_zulip_realm_to_zulipinternal.py | zerver/migrations/0237_rename_zulip_realm_to_zulipinternal.py | # -*- coding: utf-8 -*-
from django.conf import settings
from django.db import migrations
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
def rename_zulip_realm_to_zulipinternal(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> Non... | # -*- coding: utf-8 -*-
from django.conf import settings
from django.db import migrations
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
def rename_zulip_realm_to_zulipinternal(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> Non... | apache-2.0 | Python |
fff9c1a2fb8f8f6136fac306a507f22d214a0477 | delete some comments | uclapi/uclapi,uclapi/uclapi,uclapi/uclapi,uclapi/uclapi | backend/uclapi/dashboard/tasks.py | backend/uclapi/dashboard/tasks.py | from __future__ import absolute_import
import keen
from celery import shared_task
@shared_task
def test_task(param):
return 'The test task executed with argument "%s" ' % param
@shared_task
def keen_add_event_task(title, data):
try:
keen.add_event(title, data)
except keen.exceptions.InvalidProje... | from __future__ import absolute_import
import keen
# im dumb
from celery import shared_task
@shared_task
def test_task(param):
return 'The test task executed with argument "%s" ' % param
@shared_task
def keen_add_event_task(title, data):
try:
keen.add_event(title, data)
except keen.exceptions.In... | mit | Python |
38345f98f70d2d8d58f7f7d2734e05bbeb1f6754 | Fix tracing example. | StanfordLegion/legion,StanfordLegion/legion,StanfordLegion/legion,StanfordLegion/legion,StanfordLegion/legion,StanfordLegion/legion,StanfordLegion/legion,StanfordLegion/legion | bindings/python/examples/trace.py | bindings/python/examples/trace.py | #!/usr/bin/env python
# Copyright 2019 Stanford University
#
# 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 applicabl... | #!/usr/bin/env python
# Copyright 2019 Stanford University
#
# 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 applicabl... | apache-2.0 | Python |
81d8aef706b2e3e940e4566d72c7658357550667 | Refactor LineByLineMerge.py | resolutedreamer/LineByLineMerge,resolutedreamer/LineByLineMerge | LineByLineMerge.py | LineByLineMerge.py | '''
LineByLineMerge.py
For the files passed in at the commandline, merge the text of the two files line by line, seperator by 'seperator'.
'''
import sys
seperator = ''
def main():
fileHandlers = []
if len(sys.argv) < 2:
print "Not enough args"
sys.exit(1)
else:
print str(len(sys.a... | '''
LineByLineMerge.py
For the files passed in at the commandline, merge the text of the two files line by line, seperator by 'seperator'.
'''
import sys
seperator = ''
def main():
fileHandlers = []
if len(sys.argv) < 2:
print "Not enough args"
sys.exit(1)
else:
print str(len(sys.a... | apache-2.0 | Python |
46ee8c9723fc7a13798d490190363380c361877d | remove utils.push_dir | facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift,facebook/fbthrift | build/fbcode_builder/utils.py | build/fbcode_builder/utils.py | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
'Miscellaneous utility functions.'
import itertools
import logging
import os
import shutil
import subprocess
import sys
from contextlib import cont... | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
'Miscellaneous utility functions.'
import itertools
import logging
import os
import shutil
import subprocess
import sys
from contextlib import cont... | apache-2.0 | Python |
cfa45ba7678483a7984642a74a4dd1ac011879c5 | Fix delete stack | vasiliykochergin/euca2ools,nagyistoce/euca2ools,nagyistoce/euca2ools,gholms/euca2ools,gholms/euca2ools,jhajek/euca2ools,vasiliykochergin/euca2ools,jhajek/euca2ools | euca2ools/commands/cloudformation/deletestack.py | euca2ools/commands/cloudformation/deletestack.py | # Copyright 2013 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | # Copyright 2013 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | bsd-2-clause | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.