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 |
|---|---|---|---|---|---|---|---|---|
3984ae57c98bd72d0b8ccd8036df2e028bcfe4e3 | Use the right things for statement management command tests | praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go,praekelt/vumi-go | go/billing/management/commands/tests/test_go_gen_statement.py | go/billing/management/commands/tests/test_go_gen_statement.py | # -*- coding: utf-8 -*-
from iso8601 import parse_date
from StringIO import StringIO
from django.core.management import call_command
from go.base.tests.helpers import (
GoDjangoTestCase, DjangoVumiApiHelper, CommandIO)
from go.billing.models import Account, Statement
class TestGenStatement(GoDjangoTestCase):
... | # -*- coding: utf-8 -*-
from iso8601 import parse_date
from StringIO import StringIO
from go.base.tests.helpers import GoDjangoTestCase, DjangoVumiApiHelper
from go.billing.models import Account, Statement
from go.billing.management.commands.go_gen_statement import Command
class TestGenStatement(GoDjangoTestCase):
... | bsd-3-clause | Python |
921ce44cd766540d74b8496029e871d5aceb5cbb | Remove last bits of file browser stuff | uq-eresearch/uqam,uq-eresearch/uqam,uq-eresearch/uqam,uq-eresearch/uqam | urls.py | urls.py | from django.conf.urls.defaults import patterns, include, url
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url('', include('uqam.cat.urls')),
# Uncomment the admin/doc line below to enable ... | from django.conf.urls.defaults import patterns, include, url
from django.conf import settings
from filebrowser.sites import site
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url('', include('uqam.cat.urls')),
url(r'^admin... | bsd-3-clause | Python |
3226dce27d4104cb2f10efe9c6ab26e65f6330f1 | fix py-netaddr mac listing for new version | opnsense/core,opnsense/core,opnsense/core,opnsense/core,opnsense/core,opnsense/core | src/opnsense/scripts/interfaces/list_macdb.py | src/opnsense/scripts/interfaces/list_macdb.py | #!/usr/local/bin/python2.7
"""
Copyright (c) 2016 Ad Schellevis
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 not... | #!/usr/local/bin/python2.7
"""
Copyright (c) 2016 Ad Schellevis
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 not... | bsd-2-clause | Python |
9c0c91777c29a75517fbaa30d65253b1a558c511 | Reset packet data dict on decode | guineawheek/spock,txomon/SpockBot,gamingrobot/SpockBot,OvercastNetwork/spock,nickelpro/SpockBot,Gjum/SpockBot,MrSwiss/SpockBot,SpockBotMC/SpockBot,luken/SpockBot | spock/mcp/mcpacket.py | spock/mcp/mcpacket.py | import copy
from time import gmtime, strftime
from spock import utils
from spock.mcp import datautils, mcdata
from spock.mcp.mcpacket_extensions import hashed_extensions
#TODO: Wow this class ended up a bit of a mess, cleanup and refactor soon^TM
class Packet(object):
def __init__(self,
ident = [mcdata.HANDSHAKE_ST... | import copy
from time import gmtime, strftime
from spock import utils
from spock.mcp import datautils, mcdata
from spock.mcp.mcpacket_extensions import hashed_extensions
#TODO: Wow this class ended up a bit of a mess, cleanup and refactor soon^TM
class Packet(object):
def __init__(self,
ident = [mcdata.HANDSHAKE_ST... | mit | Python |
7a1d7877a723c3c85ba3bd55f54f243b61f9062c | Remove compat import. | ulule/django-linguist | linguist/models/base.py | linguist/models/base.py | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible
from ..utils import get_model_string
@python_2_unicode_compatible
class Translation(models.Model):
"""
A Translation.
"""
identifi... | # -*- coding: utf-8 -*-
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible
from .. import compat
from ..utils import get_model_string
@python_2_unicode_compatible
class Translation(models.Model):
"""
A Translation... | mit | Python |
d032f6654d0ad84ee9395ff75249058c026a6489 | Update ipc_lista2.06.py | any1m1c/ipc20161 | lista2/ipc_lista2.06.py | lista2/ipc_lista2.06.py | #ipc_lista2.06
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa que leia três números e mostre o maior deles.
number1 = int(input("
number2 = int(input("
number3 = int(input("
| #ipc_lista2.06
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa que leia três números e mostre o maior deles.
number1 = int(input(
number2 = int(input(
number3 = int(input(
| apache-2.0 | Python |
44e409ad4c96b095aa524bb9fcbe9f8056f77262 | Clean up old code in fc_widget | eyurtsev/FlowCytometryTools,eyurtsev/FlowCytometryTools | FlowCytometryTools/GUI/fc_widget.py | FlowCytometryTools/GUI/fc_widget.py | #!/usr/bin/env python
import matplotlib
matplotlib.use('WXAgg')
import matplotlib.pylab as pl
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
from matplotlib.figure import Figure
import wx
from gate_manager import GateManager
class FCWidget(FigureCanvas):
def __init__(self, paren... | #!/usr/bin/env python
import matplotlib
matplotlib.use('WXAgg')
import matplotlib.pylab as pl
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
#from matplotlib.backends.backend_wx import NavigationToolbar2Wx
from matplotlib.figure import Figure
import wx
from gate_manager import GateM... | mit | Python |
ee06eebea3d7e218783385424a6f575e8bb7e5b3 | Fix lookup() plugin | thaim/ansible,thaim/ansible | lib/ansible/plugins/lookup/file.py | lib/ansible/plugins/lookup/file.py | # (c) 2012, Daniel Hokka Zakrisson <daniel@hozac.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any lat... | # (c) 2012, Daniel Hokka Zakrisson <daniel@hozac.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any lat... | mit | Python |
338b33110f3113e338caf9808dd3c4363472d071 | Add modifications | the-raspberry-pi-guy/bike_dashcam,the-raspberry-pi-guy/bike_dashcam | dashcam.py | dashcam.py | # dashcam.py
# A Raspberry Pi powered, GPS enabled, 3D printed bicycle dashcam
# By Matthew Timmons-Brown, The Raspberry Pi Guy
import pygame
import picamera
import os
os.putenv('SDL_VIDEODRIVER', 'fbcon')
os.putenv('SDL_FBDEV' , '/dev/fb1')
os.putenv('SDL_MOUSEDRV' , 'TSLIB')
os.putenv('SDL_MOUSEDEV' , '/de... | # dashcam.py
# A Raspberry Pi powered, GPS enabled, 3D printed bicycle dashcam
# By Matthew Timmons-Brown, The Raspberry Pi Guy
import pygame
import picamera
| mit | Python |
b58dc256dc04b10fa5cf4158094017659ffc556a | Fix bug when no datadog tags specified | Multifarious/fabulous | datadog.py | datadog.py | from dogapi import dog_http_api as api
from fabric.api import env
from fabric.contrib.files import sed
from fabric.operations import sudo
from fabulous import debug, error, git, info, retry
from fabulous.config import verify_env_contains_keys
from fabulous.cloud import pretty_instance
import re
def is_datadog_enabled(... | from dogapi import dog_http_api as api
from fabric.api import env
from fabric.contrib.files import sed
from fabric.operations import sudo
from fabulous import debug, error, git, info, retry
from fabulous.config import verify_env_contains_keys
from fabulous.cloud import pretty_instance
import re
@retry(SystemExit)
def ... | bsd-2-clause | Python |
25688b5a472885d0b1c938c67b3654a2d06e566a | Rearrange menu | rmrector/script.artwork.beef | default.py | default.py | import sys
import xbmcgui
from devhelper import pykodi
addon = pykodi.Addon()
sys.path.append(addon.resourcelibs)
from artworkprocessor import ArtworkProcessor
def main():
# TODO: Start from program pops up a select list with some options.
# Like scan -> new / all, settings -> select series for auto grabbin... | import sys
import xbmcgui
from devhelper import pykodi
addon = pykodi.Addon()
sys.path.append(addon.resourcelibs)
from artworkprocessor import ArtworkProcessor
def main():
# TODO: Start from program pops up a select list with some options.
# Like scan -> new / all, settings -> select series for auto grabbin... | mit | Python |
86a5fff9add5980892c90a3e34476802dec7a6dc | Improve the internal skipped-test helper messages. | python-jsonschema/jsonschema | jsonschema/tests/_helpers.py | jsonschema/tests/_helpers.py | from urllib.parse import urljoin
def issues_url(organization, repository):
return urljoin(
urljoin(
urljoin("https://github.com", organization),
repository,
),
"issues",
)
ISSUES_URL = issues_url("python-jsonschema", "jsonschema")
TEST_SUITE_ISSUES_URL = issue... | def bug(issue=None):
message = "A known bug."
if issue is not None:
message += " See issue #{issue}.".format(issue=issue)
return message
| mit | Python |
1f180e11749c7494b86b3ddce69709129442cf1f | switch to using coinformation for I | chebee7i/dit,dit/dit,dit/dit,chebee7i/dit,Autoplectic/dit,Autoplectic/dit,dit/dit,dit/dit,Autoplectic/dit,chebee7i/dit,Autoplectic/dit,chebee7i/dit,Autoplectic/dit,dit/dit | dit/abc.py | dit/abc.py | """
Import several functions as shorthand.
"""
from dit import Distribution as D
from dit.algorithms import (entropy as H,
coinformation as I,
total_correlation as T,
jensen_shannon_divergence as JSD
)
| """
Import several functions as shorthand.
"""
from dit import Distribution as D
from dit.algorithms import (entropy as H,
mutual information as I,
total_correlation as T,
jensen_shannon_divergence as JSD
)
| bsd-3-clause | Python |
2132f4fb87c19de3d9c5322dc6a073a86a1d2502 | add pandas | GoogleCloudPlatform/jupyter-extensions,GoogleCloudPlatform/jupyter-extensions,GoogleCloudPlatform/jupyter-extensions,GoogleCloudPlatform/jupyter-extensions | jupyterlab_bigquery/setup.py | jupyterlab_bigquery/setup.py | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 | Python |
41398779abbcb1ec2d7491e141469a752fc706ff | Print path of the Python module used during tests. | gpg/gpgme,gpg/gpgme,gpg/gpgme,gpg/gpgme,gpg/gpgme,gpg/gpgme,gpg/gpgme | lang/python/tests/initial.py | lang/python/tests/initial.py | #!/usr/bin/env python
# Copyright (C) 2016 g10 Code GmbH
#
# This file is part of GPGME.
#
# GPGME 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 2 of the License, or
# (at your option) any la... | #!/usr/bin/env python
# Copyright (C) 2016 g10 Code GmbH
#
# This file is part of GPGME.
#
# GPGME 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 2 of the License, or
# (at your option) any la... | lgpl-2.1 | Python |
bf6b4d45dbfa8224ce3418365cddaaeb6e1abac0 | add labels to the dendrogram model | WheatonCS/Lexos,WheatonCS/Lexos,WheatonCS/Lexos | lexos/models/dendro_model.py | lexos/models/dendro_model.py | from typing import Optional
import pandas as pd
import plotly.figure_factory as ff
from plotly.graph_objs.graph_objs import Figure
from plotly.offline import plot
from scipy.cluster.hierarchy import linkage
from scipy.spatial.distance import pdist
from lexos.models.base_model import BaseModel
from lexos.models.matrix... | from typing import Optional
import pandas as pd
import plotly.figure_factory as ff
from plotly.graph_objs.graph_objs import Figure
from plotly.offline import plot
from scipy.cluster.hierarchy import linkage
from scipy.spatial.distance import pdist
from lexos.models.base_model import BaseModel
from lexos.models.matrix... | mit | Python |
90f5a273a308689fb29aa633b69ceb6711b86622 | remove tornado from the fabfile | Lancey6/woodwind,Lancey6/woodwind | fabfile.py | fabfile.py | from fabric.api import local, prefix, cd, run, env, lcd, sudo
env.hosts = ['orin.kylewm.com']
REMOTE_PATH = '/srv/www/kylewm.com/woodwind'
def commit():
local("git add -p")
local("git diff-index --quiet HEAD || git commit")
def push():
local("git push origin master")
def pull():
with cd(REMOTE_P... | from fabric.api import local, prefix, cd, run, env, lcd, sudo
env.hosts = ['orin.kylewm.com']
REMOTE_PATH = '/srv/www/kylewm.com/woodwind'
def commit():
local("git add -p")
local("git diff-index --quiet HEAD || git commit")
def push():
local("git push origin master")
def pull():
with cd(REMOTE_P... | bsd-2-clause | Python |
a65ceecb4872972f2621d31f3135c8fa7da0f983 | Fix fabfile | nicksergeant/snipt,nicksergeant/snipt,nicksergeant/snipt | fabfile.py | fabfile.py | from fabric.api import cd, local, env, run, sudo
import datetime
env.hosts = ['nick@snipt.net:39039']
env.site_path = '/var/www/snipt'
env.venv_path = '/home/nick/.virtualenvs/snipt'
def _python(cmd):
return env.venv_path.rstrip('/') + '/bin/python ' + cmd
def dep():
local('python manage.py collectstatic -... | from fabric.api import cd, local, env, run, sudo
import datetime
env.hosts = ['nick@snipt.net:39039']
env.site_path = '/var/www/snipt'
env.venv_path = '/home/nick/.virtualenvs/snipt'
def _python(cmd):
return env.venv_path.rstrip('/') + '/bin/python ' + cmd
def dep():
local('python manage.py collectstatic -... | mit | Python |
7de787dc1b1e1170cf0d996b6dc6a635d58c87f3 | update fabfile | alexpap/tpch-kit,alexpap/tpch-kit,alexpap/tpch-kit,alexpap/tpch-kit | fabfile.py | fabfile.py | from fabric.api import env, run, cd
tables_options = {
'lineitem' : 'L',
'customers' : 'c',
'nation' : 'n',
'orders' : 'O',
'parts' : 'P',
'region' : 'r',
'suppliers' : 's',
'partsupp' : 'S'
}
def dbgen(sf=1, table=" "):
if not table:
table = "-T {tbl_opt}".format(tbl_opt=ta... | from fabric.api import env, run, cd
tables_options = {
'lineitem' : 'L',
'customers' : 'c',
'nation' : 'n',
'orders' : 'O',
'parts' : 'P',
'region' : 'r',
'suppliers' : 's',
'partsupp' : 'S'
}
def dbgen(sf=1, table=" "):
if not table:
table = "-T {tbl_opt}".format(tbl_opt=ta... | mit | Python |
096864e0315f9970663d2bc3fe553e86808058b0 | Add missing import to fabfile. | openxc/openxc-python,openxc/openxc-python,openxc/openxc-python | fabfile.py | fabfile.py | from __future__ import with_statement
import os
from fabric.api import abort, local, task, lcd, puts
@task(default=True)
def docs(clean='no', browse_='no'):
with lcd('docs'):
local('make clean html')
temp_path = "/tmp/openxc-python-docs"
docs_path = "%s/docs/_build/html" % local("pwd", capture=Tr... | from __future__ import with_statement
import os
from fabric.api import abort, local, task, lcd
@task(default=True)
def docs(clean='no', browse_='no'):
with lcd('docs'):
local('make clean html')
temp_path = "/tmp/openxc-python-docs"
docs_path = "%s/docs/_build/html" % local("pwd", capture=True)
... | bsd-3-clause | Python |
365cc01abadfa7e0d506a55f302110837d97741c | Make git work on travis. | mythmon/mythmon.com,mythmon/mythmon.com | fabfile.py | fabfile.py | import os
from contextlib import contextmanager
from datetime import datetime
from fabric.api import local
from fabric.context_managers import hide
GH_REF = 'github.com/mythmon/mythmon.com.git'
GH_TOKEN = os.environ.get('GH_TOKEN')
@contextmanager
def cd(newdir):
print 'Entering {}/'.format(newdir)
prevdir... | import os
from contextlib import contextmanager
from datetime import datetime
from fabric.api import local
from fabric.context_managers import hide
GH_REF = 'github.com/mythmon/mythmon.com.git'
GH_TOKEN = os.environ.get('GH_TOKEN')
@contextmanager
def cd(newdir):
print 'Entering {}/'.format(newdir)
prevdir... | mit | Python |
9fb5e447171f6abdf67845629b0521743c657b53 | fix import | lebek/reversible-raytracer,lebek/reversible-raytracer | examples/optimize_brightness.py | examples/optimize_brightness.py | import os
import numpy as np
from optimize import GDOptimizer
import theano
from util import *
### Hyper-parameters ###
OptmizeFlag=False
#-----------------------
if not os.path.exists('output'):
os.makedirs('output')
center1 = theano.shared(np.asarray([-.5, -.5, 4], dtype=theano.config.floatX),
... | import os
import numpy as np
from optimize import GDOptimizer
import theano
from util import *
from scene_setup import *
### Hyper-parameters ###
OptmizeFlag=True
#-----------------------
if not os.path.exists('output'):
os.makedirs('output')
center1 = theano.shared(np.asarray([-.5, -.5, 4], dtype=theano.config... | mit | Python |
fd176f0bd16e6d85cd555590b390ecc90bdb57e7 | Fix migration | ljean/coop_cms,ljean/coop_cms,ljean/coop_cms | coop_cms/migrations/0004_auto_20160620_1310.py | coop_cms/migrations/0004_auto_20160620_1310.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.core.urlresolvers import reverse
def set_homepage(apps, schema_editor):
# Move from homepage_for_site to SiteSettings
site_class = apps.get_model("sites", "Site")
for site in site_class.ob... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.core.urlresolvers import reverse
def set_homepage(apps, schema_editor):
# Move from homepage_for_site to SiteSettings
site_class = apps.get_model("sites", "Site")
for site in site_class.obj... | bsd-3-clause | Python |
f056aa323061232e80992c22ff8f5e5c4a3b06b4 | Remove blank line | peer23peer/plugin.video.quasar,johnnyslt/plugin.video.quasar,likeitneverwentaway/plugin.video.quasar,likeitneverwentaway/plugin.video.quasar,johnnyslt/plugin.video.quasar,peer23peer/plugin.video.quasar | resources/site-packages/quasar/dialog.py | resources/site-packages/quasar/dialog.py | import xbmcgui
ACTION_LEFT = 1
ACTION_RIGHT = 2
ACTION_UP = 3
ACTION_DOWN = 4
ACTION_PAGE_UP = 5
ACTION_PAGE_DOWN = 6
ACTION_SELECT_ITEM = 7
ACTION_PARENT_DIR = 9
ACTION_PREVIOUS_MENU = 10
ACTION_SHOW_INFO = 11
ACTION_NEXT_ITEM = 14
ACTION_PREV_ITEM = 15
ACTION_MOUSE_WHEEL_UP = 104
ACTION_MOUSE_WHEEL_DOWN = 105
ACTIO... | import xbmcgui
ACTION_LEFT = 1
ACTION_RIGHT = 2
ACTION_UP = 3
ACTION_DOWN = 4
ACTION_PAGE_UP = 5
ACTION_PAGE_DOWN = 6
ACTION_SELECT_ITEM = 7
ACTION_PARENT_DIR = 9
ACTION_PREVIOUS_MENU = 10
ACTION_SHOW_INFO = 11
ACTION_NEXT_ITEM = 14
ACTION_PREV_ITEM = 15
ACTION_MOUSE_WHEEL_UP = 104
ACTION_MOUSE_WHEEL_DOWN = 105
ACTIO... | bsd-3-clause | Python |
2f77c7f1f14ec4dd4d2c1433c91753830e42d31a | Update submission_examples.py | leifdreizler/bugcrowd | examples/submission_examples.py | examples/submission_examples.py | import os
import bugcrowd
uname = os.environ.get('BCUSER')
pw = os.environ.get('BCPW')
test = bugcrowd.Client(uname, pw)
# Get a single submission
s = test.get_submission("b337bee1-1643-4ef8-af33-fde80cb4d987")
# Print single submission
print(s)
# Print uuid of submission
print(s.uuid)
# Get all submissions for a bo... | import os
import bugcrowd
uname = os.environ.get('BCUSER')
pw = os.environ.get('BCPW')
test = bugcrowd.Client(uname, pw)
# Get a single submission
s = test.get_submission("b337bee1-1643-4ef8-af33-fde80cb4d987")
print(s)
# Get all submissions for a bounty
s = test.get_submissions_for_bounty("84b71b04-a363-441f-91e0-8... | mit | Python |
49fac241aa5e3086162569c9c6ad51a9fe71892d | Update rest_api_server.py | alessiodm/cloudbrain,realitygaps/cloudbrain,andyh616/cloudbrain,singlerider/cloudbrain,lambdaloop/cloudbrain,prescottprue/cloudbrain,octopicorn/cloudbrain,alessiodm/cloudbrain,lambdaloop/cloudbrain,realitygaps/cloudbrain,alessiodm/cloudbrain,marionleborgne/cloudbrain,prescottprue/cloudbrain,marionleborgne/cloudbrain,oc... | cloudbrain/datastore/rest_api_server.py | cloudbrain/datastore/rest_api_server.py | import time
import json
import random
from flask import Flask, request, current_app
from functools import wraps
from cloudbrain.utils.metadata_info import map_metric_name_to_num_channels, get_supported_devices
from cloudbrain.datastore.CassandraDAL import CassandraDAL
from cloudbrain.settings import WEBSERVER_PORT
_MO... | import time
import json
import random
from flask import Flask, request, current_app
from functools import wraps
from cloudbrain.utils.metadata_info import map_metric_name_to_num_channels, get_supported_devices
from cloudbrain.datastore.CassandraDAL import CassandraDAL
from cloudbrain.settings import WEBSERVER_PORT
_MO... | agpl-3.0 | Python |
bc0d197ef84303620f6e9f687404090aff4239b1 | fix breakage | haarcuba/testix,haarcuba/testix,haarcuba/testix | examples/tests/test_daylight.py | examples/tests/test_daylight.py | import pytest
from testix.frequentlyused import *
from testix import patch_module
from examples import daylight
class FakeDay( object ):
def __add__( self, other ):
return other
class Test_Daylight:
@pytest.fixture
def module_patch( self, patch_module ):
patch_module( daylight,... | import pytest
from testix.frequentlyused import *
from testix import patch_module
from examples import daylight
class FakeDay( object ):
def __add__( self, other ):
return other
class Test_Daylight:
@pytest.fixture
def module_patch( self, patch_module ):
patch_module( daylight,... | mit | Python |
db4c471f5a46bbac3ad55410c558747b2ea49269 | Add args parameters to main (I forgot why) | brodul/dontpanic | dontpanic/cli.py | dontpanic/cli.py | #! /usr/bin/env python
"""
Script lists all uncommented domains/subdomains in a nginx or apache config directory.
Domains/subdomains can be checked for current status.
The domain is checked if the there is a DNS record for the domain and
(if possible) for the HTTP return code.
Optionaly you can provide the ip of you... | #! /usr/bin/env python
"""
Script lists all uncommented domains/subdomains in a nginx or apache config directory.
Domains/subdomains can be checked for current status.
The domain is checked if the there is a DNS record for the domain and
(if possible) for the HTTP return code.
Optionaly you can provide the ip of you... | mit | Python |
ef7b8379b4d6cd1bec5abdaf1bd24f90a6ff58d0 | Change exclamation mark to dot | ZDroid/XDroid | XDroid.py | XDroid.py | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# The most stupid IRC bot
#
import socket
from time import ctime
import feedparser
# Configuration
# -------------
server = "irc.freenode.net"
channel = "#zdroid"
nick = "XDroid"
# Connect to server
# -----------------
irc = socket.socket(socket.AF_INET, socket.SOCK_... | #!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# The most stupid IRC bot
#
import socket
from time import ctime
import feedparser
# Configuration
# -------------
server = "irc.freenode.net"
channel = "#zdroid"
nick = "XDroid"
# Connect to server
# -----------------
irc = socket.socket(socket.AF_INET, socket.SOCK_... | mit | Python |
606af411d2c4b77bdcfe2285c9ef1dd1764f5176 | remove x,yDESI just use x,yDECam | aaronroodman/Donut,aaronroodman/Donut,aaronroodman/Donut | donutlib/test.py | donutlib/test.py | ###
### Script for very basic testing of donutengine and donutfit
###
from donutlib.makedonut import makedonut
from donutlib.donutfit import donutfit
# make donuts
z4 = 10.
z5 = 0.2
z6 = 0.2
z7 = -0.15
z8 = .05
z9 = 0.3
z10 = -.05
z11 = .2
inputDict = {'writeToFits':True,'outputPrefix':'unittest.0001','iTelescope':5... | ###
### Script for very basic testing of donutengine and donutfit
###
from donutlib.makedonut import makedonut
from donutlib.donutfit import donutfit
# make donuts
z4 = 10.
z5 = 0.2
z6 = 0.2
z7 = -0.15
z8 = .05
z9 = 0.3
z10 = -.05
z11 = .2
inputDict = {'writeToFits':True,'outputPrefix':'unittest.0001','iTelescope':0... | mit | Python |
c2ec8b27ca070a3f8cb1e80b1e3c860d75be1422 | fix bug where repro with run-cached stages may fail (#4911) | efiop/dvc,dmpetrov/dataversioncontrol,efiop/dvc,dmpetrov/dataversioncontrol | dvc/repo/experiments/run.py | dvc/repo/experiments/run.py | import logging
from typing import Iterable, Optional
from dvc.exceptions import InvalidArgumentError
from dvc.repo import locked
from dvc.repo.experiments import UnchangedExperimentError
logger = logging.getLogger(__name__)
def _parse_params(path_params: Iterable):
from ruamel.yaml import YAMLError
from dv... | import logging
from typing import Iterable, Optional
from dvc.exceptions import InvalidArgumentError
from dvc.repo import locked
from dvc.repo.experiments import UnchangedExperimentError
logger = logging.getLogger(__name__)
def _parse_params(path_params: Iterable):
from ruamel.yaml import YAMLError
from dv... | apache-2.0 | Python |
10f7f277bec199aa8269e27fab5f5af592e94ee9 | Use the icons original size. | chadmv/plow,Br3nda/plow,Br3nda/plow,Br3nda/plow,chadmv/plow,Br3nda/plow,Br3nda/plow,chadmv/plow,chadmv/plow,chadmv/plow,chadmv/plow,chadmv/plow | lib/python/plow/gui/panels/base.py | lib/python/plow/gui/panels/base.py |
from plow.gui.manifest import QtCore, QtGui
class PanelManager(QtCore.QObject):
def __init__(self, parent):
QtCore.QObject.__init__(self, parent)
class Panel(QtGui.QDockWidget):
"""
The base class for all panels.
"""
def __init__(self, name, parent=None):
QtGui.QDockWidget.__init_... |
from plow.gui.manifest import QtCore, QtGui
class PanelManager(QtCore.QObject):
def __init__(self, parent):
QtCore.QObject.__init__(self, parent)
class Panel(QtGui.QDockWidget):
"""
The base class for all panels.
"""
def __init__(self, name, parent=None):
QtGui.QDockWidget.__init_... | apache-2.0 | Python |
95eca0a177a017a2a6a84d5f777696b43e24fecc | Fix config.py | steinwurf/meta,steinwurf/meta | config.py | config.py | #!/usr/bin/env python
# encoding: utf-8
import traceback
import sys
try:
input = raw_input
except NameError:
pass
project_name = 'meta'
project_dependencies = \
[
'waf-tools',
'gtest',
]
def importCode(code, name, add_to_sys_modules=0):
"""
Import dynamically generated code ... | #!/usr/bin/env python
# encoding: utf-8
import traceback
import sys
try:
input = raw_input
except NameError:
pass
project_name = 'recycle'
project_dependencies = \
[
'waf-tools',
'gtest',
]
def importCode(code, name, add_to_sys_modules=0):
"""
Import dynamically generated co... | bsd-3-clause | Python |
1ebec12dc0f5b2a431a52b89909a949529e0b6ad | use currency_id as default value | ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo,ygol/odoo | addons/lunch/models/lunch_cashmove.py | addons/lunch/models/lunch_cashmove.py | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
from odoo.tools import float_round
class LunchCashMove(models.Model):
""" Two types of cashmoves: payment (credit) or order (debit) """
_name = 'lunch.cashmove'
_desc... | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
from odoo.tools import float_round
class LunchCashMove(models.Model):
""" Two types of cashmoves: payment (credit) or order (debit) """
_name = 'lunch.cashmove'
_desc... | agpl-3.0 | Python |
4c17838cd051f57c20beb99c1b80ccd5dedda6f5 | Use the correct depends | Vauxoo/e-commerce,Vauxoo/e-commerce,Vauxoo/e-commerce | website_sale_attribute_filter_price/__manifest__.py | website_sale_attribute_filter_price/__manifest__.py | # Copyright 2020 Tecnativa - Alexandre Díaz
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
{
"name": "Wesbite Sale Attribute Filter Price",
"category": "Website",
"summary": "A price filter for website sale",
"version": "12.0.1.0.0",
"license": "LGPL-3",
"depends": ["website_sal... | # Copyright 2020 Tecnativa - Alexandre Díaz
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
{
"name": "Wesbite Sale Attribute Filter Price",
"category": "Website",
"summary": "A price filter for website sale",
"version": "12.0.1.0.0",
"license": "LGPL-3",
"depends": ["website"],
... | agpl-3.0 | Python |
a2b7526eebd132cccbecb57001be2edc7e6ed9c4 | add search to pillow checkpoints | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/ex-submodules/pillowtop/admin.py | corehq/ex-submodules/pillowtop/admin.py | from __future__ import absolute_import
from __future__ import unicode_literals
from django.contrib import admin
from .models import DjangoPillowCheckpoint, KafkaCheckpoint
@admin.register(DjangoPillowCheckpoint)
class PillowCheckpointAdmin(admin.ModelAdmin):
model = DjangoPillowCheckpoint
list_display = [
... | from __future__ import absolute_import
from __future__ import unicode_literals
from django.contrib import admin
from .models import DjangoPillowCheckpoint, KafkaCheckpoint
class PillowCheckpointAdmin(admin.ModelAdmin):
model = DjangoPillowCheckpoint
list_display = [
'checkpoint_id',
'timestam... | bsd-3-clause | Python |
368aac0237c3b09c5097e6f3eaa6c623db191d0c | fix migration dependency, re #2337 | archesproject/arches,archesproject/arches,archesproject/arches,archesproject/arches | arches/app/models/migrations/2337_fuzzy_dates.py | arches/app/models/migrations/2337_fuzzy_dates.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('models', '0010_4_1_0'),
]
operations = [
migrations.RunSQL("""
INSERT INTO widgets(widgetid, name, component, datatype, d... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('models', '2532_boolean_datatype_display_value'),
]
operations = [
migrations.RunSQL("""
INSERT INTO widgets(widgetid, nam... | agpl-3.0 | Python |
bf96bf9d71f432f2db75b0c62b49098235d75661 | Move these to macros, the exact type of these functions changes by deifne | Lukasa/cryptography,kimvais/cryptography,skeuomorf/cryptography,sholsapp/cryptography,dstufft/cryptography,bwhmather/cryptography,glyph/cryptography,dstufft/cryptography,bwhmather/cryptography,kimvais/cryptography,dstufft/cryptography,Ayrx/cryptography,Lukasa/cryptography,skeuomorf/cryptography,sholsapp/cryptography,Ha... | cryptography/bindings/openssl/pkcs12.py | cryptography/bindings/openssl/pkcs12.py | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | bsd-3-clause | Python |
f09b0078eb1be3a9d0c0d3af2a3df09b90bf453a | Remove unused import | Alignak-monitoring-contrib/alignak-app,Alignak-monitoring-contrib/alignak-app | alignak_app/threads/thread_manager.py | alignak_app/threads/thread_manager.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2017:
# Matthieu Estrada, ttamalfor@gmail.com
#
# This file is part of (AlignakApp).
#
# (AlignakApp) is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Sof... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2017:
# Matthieu Estrada, ttamalfor@gmail.com
#
# This file is part of (AlignakApp).
#
# (AlignakApp) is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Sof... | agpl-3.0 | Python |
0f7c79c10a3d54d5d0a356e3848add3aa817502c | Fix import statement for LoadBalancerStatus | froch/kubernetes-py,mnubo/kubernetes-py,sebastienc/kubernetes-py,mnubo/kubernetes-py,sebastienc/kubernetes-py,froch/kubernetes-py | kubernetes/models/v1/LoadBalancerStatus.py | kubernetes/models/v1/LoadBalancerStatus.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is subject to the terms and conditions defined in
# file 'LICENSE.md', which is part of this source code package.
#
from kubernetes.models.v1.LoadBalancerIngress import LoadBalancerIngress
from kubernetes.utils import is_valid_list
class LoadBalancerStatus... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is subject to the terms and conditions defined in
# file 'LICENSE.md', which is part of this source code package.
#
from kubernetes.models.v1 import (
LoadBalancerIngress
)
from kubernetes.utils import is_valid_list
class LoadBalancerStatus(object):
... | apache-2.0 | Python |
9109d69e5a73d0e04d01c44b034e01c359aec7f2 | teste herança | kmee/l10n-brazil,kmee/l10n-brazil | l10n_br_zip/models/format_address_mixin.py | l10n_br_zip/models/format_address_mixin.py | # Copyright (C) 2010-2012 Renato Lima (Akretion)
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import models
class FormatAddressMixin(models.AbstractModel):
_inherit = "format.address.mixin"
def zip_search(self):
self.ensure_one()
return self.env["l10n_br.zip"].... | # Copyright (C) 2010-2012 Renato Lima (Akretion)
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import models
class FormatAddressMixin(models.AbstractModel):
_inherit = "format.address.mixin"
def zip_search(self):
self.ensure_one()
return self.env["l10n_br.zip"].... | agpl-3.0 | Python |
986ce3f1bb939f41dc36f6ad643e7e63d23de798 | update the old fbcode_builder spec for fbzmq | facebook/folly,facebook/folly,facebook/folly,facebook/folly,facebook/folly | build/fbcode_builder/specs/fbzmq.py | build/fbcode_builder/specs/fbzmq.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import specs.fbthrift as fbthrift
import specs.folly as folly
import specs.gmock as gmock
import ... | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import specs.fbthrift as fbthrift
import specs.folly as folly
import specs.gmock as gmock
import ... | apache-2.0 | Python |
8558f50b0a50a3c575bd61efaac4617908f70854 | Bump to 0.1.1 | 596acres/django-livinglots-usercontent,596acres/django-livinglots-usercontent | livinglots_usercontent/__init__.py | livinglots_usercontent/__init__.py | # -*- coding: utf-8 -*-
__version__ = '0.1.1'
| # -*- coding: utf-8 -*-
__version__ = '0.1'
| agpl-3.0 | Python |
bb1c4b1efb03ce5d59b4e207bbb1402d152f0e6b | test make_iso() | alfredodeza/merfi | merfi/tests/test_iso.py | merfi/tests/test_iso.py | import os
import pytest
import subprocess
from merfi.iso import Iso
from merfi.util import which
class TestIso(object):
def create_fake_iso(self, output_dir):
""" Create a fake ISO file, without genisoimage """
iso = Iso([])
f = output_dir.join('test.iso')
f.write('ISOCONTENTS')
... | import os
import pytest
import subprocess
from merfi.iso import Iso
from merfi.util import which
class TestIso(object):
def create_fake_iso(self, output_dir):
""" Create a fake ISO file, without genisoimage """
iso = Iso([])
f = output_dir.join('test.iso')
f.write('ISOCONTENTS')
... | mit | Python |
eee03f884f3051e7f69bd1ddffad7c6be4a7a540 | Bump @graknlabs_verification and test ThingType inheritance of RoleTypes | lolski/grakn,graknlabs/grakn,lolski/grakn,graknlabs/grakn,graknlabs/grakn,lolski/grakn,graknlabs/grakn,lolski/grakn | dependencies/graknlabs/dependencies.bzl | dependencies/graknlabs/dependencies.bzl | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | agpl-3.0 | Python |
bcaf887ccad40adf2cb09627c12f2a3e1b4b006d | Disable Sentinel client with redis-py < 2.9 | zl352773277/django-redis,smahs/django-redis,yanheng/django-redis,lucius-feng/django-redis,GetAmbassador/django-redis | redis_cache/client/__init__.py | redis_cache/client/__init__.py | # -*- coding: utf-8 -*-
import warnings
from .default import DefaultClient
from .sharded import ShardClient
from .herd import HerdClient
from .experimental import SimpleFailoverClient
__all__ = ['DefaultClient', 'ShardClient',
'HerdClient', 'SimpleFailoverClient',]
try:
from .sentinel import Sentine... | # -*- coding: utf-8 -*-
from .default import DefaultClient
from .sharded import ShardClient
from .herd import HerdClient
from .experimental import SimpleFailoverClient
from .sentinel import SentinelClient
__all__ = ['DefaultClient', 'ShardClient',
'HerdClient', 'SimpleFailoverClient',
'SentinelC... | bsd-3-clause | Python |
28ab78360ebe825a39116d8161603b17d0983c09 | Correct name of FetchTask | RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline,RNAcentral/rnacentral-import-pipeline | luigi/tasks/gtrnadb/json_to_csv.py | luigi/tasks/gtrnadb/json_to_csv.py | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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... | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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... | apache-2.0 | Python |
9e35b8bf901059f330c90c2b549d9f8a63c26a46 | fix slice | chainer/chainercv,pfnet/chainercv,yuyu2172/chainercv,chainer/chainercv,yuyu2172/chainercv | tests/links_tests/model_tests/ssd_tests/test_random_crop_with_bbox.py | tests/links_tests/model_tests/ssd_tests/test_random_crop_with_bbox.py | import numpy as np
import unittest
from chainer import testing
from chainercv.links.model.ssd import random_crop_with_bbox_constraints
from chainercv.utils import bbox_iou
from chainercv.utils import generate_random_bbox
class TestRandomCropWithBboxConstraints(unittest.TestCase):
def test_random_crop_with_bbox... | import numpy as np
import unittest
from chainer import testing
from chainercv.links.model.ssd import random_crop_with_bbox_constraints
from chainercv.utils import bbox_iou
from chainercv.utils import generate_random_bbox
class TestRandomCropWithBboxConstraints(unittest.TestCase):
def test_random_crop_with_bbox... | mit | Python |
8b85c32684f322428085eabb54606fea912f7349 | Order imports | agdsn/hades,agdsn/hades,agdsn/hades,agdsn/hades,agdsn/hades | src/hades/bin/su.py | src/hades/bin/su.py | import grp
import logging
import os
import pwd
import sys
logger = logging.getLogger(__name__)
def drop_privileges(passwd, group):
if os.geteuid() != 0:
logger.error("Can't drop privileges (EUID != 0)")
return
os.setgid(group.gr_gid)
os.initgroups(passwd.pw_name, group.gr_gid)
os.setu... | import logging
import os
import sys
import pwd
import grp
logger = logging.getLogger(__name__)
def drop_privileges(passwd, group):
if os.geteuid() != 0:
logger.error("Can't drop privileges (EUID != 0)")
return
os.setgid(group.gr_gid)
os.initgroups(passwd.pw_name, group.gr_gid)
os.setu... | mit | Python |
d6e134690a6d18fe8d749961d1e6b42cd7135559 | Update 06_Potentiometer_Controlled_Servo.py | userdw/RaspberryPi_3_Starter_Kit | 06_Potentiometer_Controlled_Servo/06_Potentiometer_Controlled_Servo.py | 06_Potentiometer_Controlled_Servo/06_Potentiometer_Controlled_Servo.py | import MCP3202, wiringpi, os
from time import sleep
wiringpi.wiringPiSetup()
wiringpi.softPwmCreate(1, 0, 200)
def translate(value,leftMin,leftMax,rightMin,rightMax):
# Figure out how 'wide' each range is
leftSpan = leftMax - leftMin
rightSpan = rightMax - rightMin
# Convert the left range into a 0-1 ... | import MCP3202, wiringpi, os
from time import sleep
wiringpi.wiringPiSetup() # Must be called before using I/O function
wiringpi.softPwmCreate(1, 0, 100)
def translate(value,leftMin,leftMax,rightMin,rightMax):
# Figure out how 'wide' each range is
leftSpan = leftMax - leftMin
rightSpan = rightMax - right... | mit | Python |
a99dd63f357548cc4eef5121e3a2da9dfd6b7a01 | Put dates in the past so that we have no chance of having them spontaneously fail. | unicefuganda/edtrac,unicefuganda/edtrac,unicefuganda/edtrac | education/test/test_absenteeism_form.py | education/test/test_absenteeism_form.py | # vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
from unittest import TestCase
from education.views import AbsenteeismForm
from datetime import datetime
class TestAbsenteeismForm(TestCase):
def test_should_invalidate_empty_form(self):
absenteeism_form = AbsenteeismForm(data={})
self.assertFalse(absentee... | # vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
from unittest import TestCase
from education.views import AbsenteeismForm
from datetime import datetime
class TestAbsenteeismForm(TestCase):
def test_should_invalidate_empty_form(self):
absenteeism_form = AbsenteeismForm(data={})
self.assertFalse(absentee... | bsd-3-clause | Python |
4d2ae84f061754cdc5a0d6121129cfa21efba88a | Add more tests | voidpp/vcp,voidpp/vcp | tests/test_system_package_manager_handlers.py | tests/test_system_package_manager_handlers.py |
import unittest
from vcp.system_package_manager_handlers import SystemPackageManagerHandlerFactory
from voidpp_tools.mocks.file_system import mockfs
OS_RELEASE = dict(
ubuntu = u"""
NAME="Ubuntu"
VERSION="14.04.1 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.1 LTS"
VERSION_ID="14.04"
HOME... |
import unittest
from vcp.system_package_manager_handlers import SystemPackageManagerHandlerFactory
from voidpp_tools.mocks.file_system import mockfs
OS_RELEASE = dict(
ubuntu = u"""
NAME="Ubuntu"
VERSION="14.04.1 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.1 LTS"
VERSION_ID="14.04"
HOME... | mit | Python |
08dc7ec0654da895a2ddf79a7ce72eb7b027a8f5 | test the new API | jku/telepathy-gabble,mlundblad/telepathy-gabble,mlundblad/telepathy-gabble,jku/telepathy-gabble,Ziemin/telepathy-gabble,mlundblad/telepathy-gabble,Ziemin/telepathy-gabble,Ziemin/telepathy-gabble,Ziemin/telepathy-gabble,jku/telepathy-gabble | tests/twisted/roster/test-roster-subscribe.py | tests/twisted/roster/test-roster-subscribe.py |
"""
Test subscribing to a contact's presence.
"""
import dbus
from twisted.words.xish import domish
from servicetest import (EventPattern, assertLength, assertEquals,
call_async, wrap_channel)
from gabbletest import acknowledge_iq, exec_test
import constants as cs
import ns
def test_ancient(q, bus, conn, s... |
"""
Test subscribing to a contact's presence.
"""
import dbus
from twisted.words.xish import domish
from servicetest import EventPattern, wrap_channel, assertLength, assertEquals
from gabbletest import acknowledge_iq, exec_test
import constants as cs
import ns
def test(q, bus, conn, stream):
conn.Connect()
... | lgpl-2.1 | Python |
e2e4759016129e3bc6523f70d5418ea1ec78d242 | fix license header | tensorflow/tfx,tensorflow/tfx | tfx/v1/orchestration/experimental/__init__.py | tfx/v1/orchestration/experimental/__init__.py | # Copyright 2021 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | # You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the Li... | apache-2.0 | Python |
684ac5e6e6011581d5abcb42a7c0e54742f20606 | Add computations of great roll, pitch and small yaw angle (kite angles) | baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite,baptistelabat/robokite | Arduino/IMUstream_WifiUDP_iot33/read_UDP_JSON_IMU.py | Arduino/IMUstream_WifiUDP_iot33/read_UDP_JSON_IMU.py | # -------------------------------------------------------
import socket, traceback
import time
import json
import numpy as np
from scipy.spatial.transform import Rotation as R
host = ''
port = 2390
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.setsocko... | # -------------------------------------------------------
import socket, traceback
import time
import json
host = ''
port = 2390
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
s.bind((host, port))
fi... | mit | Python |
1c0fa1f29706ff165ee59ad1eba4417f8f429aac | fix random character error, set default coding to utf-8 | legoktm/legobot-old,legoktm/legobot-old | trunk/toolserver/public_html/cgi-bin/index.py | trunk/toolserver/public_html/cgi-bin/index.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# (C) Legoktm 2008-2011, MIT License
#
import cgitb; cgitb.enable()
import monobook2
content = """\
<h1>Bots running here</h1>
<ul>
<li><a href="http://en.wikipedia.org/wiki/User:Legobot">Legobot</a></li>
<li><a href="http://en.wikipedia.org/wiki/User:Legobot II">Legobo... | #!/usr/bin/env python
#
# (C) Legoktm 2008-2011, MIT License
#
import cgitb; cgitb.enable()
import monobook2
content = """\
<h1>Bots running here</h1>
<ul>
<li><a href="http://en.wikipedia.org/wiki/User:Legobot">Legobot</a></li>
<li><a href="http://en.wikipedia.org/wiki/User:Legobot II">Legobot II</a></li>
<li><a href... | mit | Python |
e1c66d24c9ffb845ebc621e239d8ee184a7cce6c | Remove an useless import from the verifyuser command | rdsathene/SchoolIdolAPI,SchoolIdolTomodachi/SchoolIdolAPI,SchoolIdolTomodachi/SchoolIdolAPI,laurenor/SchoolIdolAPI,dburr/SchoolIdolAPI,dburr/SchoolIdolAPI,SchoolIdolTomodachi/SchoolIdolAPI,rdsathene/SchoolIdolAPI,rdsathene/SchoolIdolAPI,laurenor/SchoolIdolAPI,dburr/SchoolIdolAPI,laurenor/SchoolIdolAPI | api/management/commands/verifyuser.py | api/management/commands/verifyuser.py | from django.core.management.base import BaseCommand, CommandError
from api.models import Account
import sys
class Command(BaseCommand):
can_import_settings = True
def handle(self, *args, **options):
if len(args) < 1:
print 'Specify account'
return
account_id = int(args[... | from django.core.management.base import BaseCommand, CommandError
from api.models import Account
import fileinput
import sys
class Command(BaseCommand):
can_import_settings = True
def handle(self, *args, **options):
if len(args) < 1:
print 'Specify account'
return
accou... | apache-2.0 | Python |
e1671e0ed9f49a3861d78069bc264767f1c0731c | Remove Unnecessary Variable | googleinterns/audio_synthesis | setup/preprocess_speech_mnist_dataset.py | setup/preprocess_speech_mnist_dataset.py | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | # Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | apache-2.0 | Python |
0254ad22680d32a451d1faf4b21809394a399311 | Add noqa comment so unused import does not get removed by code lint steps | pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus,pegasus-isi/pegasus | packages/pegasus-python/src/Pegasus/cli/startup-validation.py | packages/pegasus-python/src/Pegasus/cli/startup-validation.py | #!/usr/bin/python3
import sys
if not sys.version_info >= (3, 5):
sys.stderr.write("Pegasus requires Python 3.5 or above\n")
sys.exit(1)
try:
import yaml # noqa
except:
sys.stderr.write("Pegasus requires the Python3 YAML module to be installed\n")
sys.exit(1)
| #!/usr/bin/python3
import sys
if not sys.version_info >= (3, 5):
sys.stderr.write("Pegasus requires Python 3.5 or above\n")
sys.exit(1)
try:
pass
except:
sys.stderr.write("Pegasus requires the Python3 YAML module to be installed\n")
sys.exit(1)
| apache-2.0 | Python |
08aeb66bf5f5e91dff7f76768c70d591b17a4117 | add random_crop | yuyu2172/chainercv,yuyu2172/chainercv,chainer/chainercv,pfnet/chainercv,chainer/chainercv | chainercv/links/model/ssd/train_transformer.py | chainercv/links/model/ssd/train_transformer.py | import cv2
import numpy as np
import random
from chainercv.links.model.ssd import encode_with_default_bbox
from chainercv import transforms
from chainercv import utils
def _random_crop(img, bbox, label):
if len(bbox) == 0:
return img, bbox, label
constraints = (
(0.1, None),
(0.3, No... | import numpy as np
from chainercv.links.model.ssd import encode_with_default_bbox
from chainercv import transforms
class TrainTransformer(object):
def __init__(self, insize, mean, default_bbox, variance):
self.insize = insize
self.mean = mean
self.default_bbox = default_bbox
self... | mit | Python |
66ce5798d615ecde090939409369ccc52e885140 | Update refresh_objects to not error on a bad index | jefftriplett/djangome,djangome/djangome,jefftriplett/djangome,djangome/djangome | djangome/management/commands/refresh_objects.py | djangome/management/commands/refresh_objects.py | from __future__ import print_function
import redis
import urllib
import operator
import requests
from django.conf import settings
from django.core.management.base import NoArgsCommand
from sphinx.ext import intersphinx
r = redis.StrictRedis.from_url(settings.REDIS_URL)
class Command(NoArgsCommand):
def handle... | from __future__ import print_function
import redis
import urllib
import operator
from django.conf import settings
from django.core.management.base import NoArgsCommand
from sphinx.ext import intersphinx
r = redis.StrictRedis.from_url(settings.REDIS_URL)
class Command(NoArgsCommand):
def handle_noargs(self, **opt... | bsd-3-clause | Python |
644456a655e1982356f24755d1546f2fbd741f47 | Update with new API | participedia/pontoon,Jobava/mirror-pontoon,mathjazz/pontoon,sudheesh001/pontoon,vivekanand1101/pontoon,mozilla/pontoon,mozilla/pontoon,mathjazz/pontoon,Jobava/mirror-pontoon,mathjazz/pontoon,Osmose/pontoon,mozilla/pontoon,Osmose/pontoon,m8ttyB/pontoon,yfdyh000/pontoon,mastizada/pontoon,mastizada/pontoon,jotes/pontoon,y... | pontoon/administration/management/commands/update_projects.py | pontoon/administration/management/commands/update_projects.py |
import datetime
from django.core.management.base import BaseCommand, CommandError
from pontoon.administration.utils.files import (
update_from_repository,
extract_to_database,
)
from pontoon.base.models import Project
class Command(BaseCommand):
help = 'Update all projects from their repositories and ... |
import os
import datetime
from django.core.management.base import BaseCommand, CommandError
from pontoon.administration.views import (
update_files_from_repository,
extract_files,
)
from pontoon.base.models import Project
class Command(BaseCommand):
help = 'Update all projects from their repositories ... | bsd-3-clause | Python |
cdc6f30f816727b0d67b0e8dea0365f92ecdb7ce | Fix silly logical unicat.py error. | cdleary/cdlre | unicat.py | unicat.py | #!/usr/bin/env python3
"""Convert the union of several unicode categories to a single JS string."""
import collections
from subprocess import Popen
TARGET_CATEGORIES = ['Mn', 'Mc', 'Nd', 'Pc', 'Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl']
# Each index in the bitmap corresponds to a uint16,
# because that's the best we can en... | #!/usr/bin/env python3
"""Convert the union of several unicode categories to a single JS string."""
import collections
from subprocess import Popen
TARGET_CATEGORIES = ['Mn', 'Mc', 'Nd', 'Pc', 'Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl']
# Each index in the bitmap corresponds to a uint16,
# because that's the best we can en... | bsd-3-clause | Python |
097068441ac27d5821d520a2eb0fd7d5ff76f43a | Set DJANGO_SETTINGS_MODULE in manage.py | i3thuan5/gi2_liau7_khoo3,i3thuan5/gi2_liau7_khoo3 | manage.py | manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
# default setting from local
os.environ.setdefault(
"DJANGO_SETTINGS_MODULE", "gi2_liau7_khoo3.settings.local")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The abov... | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other... | mit | Python |
633f5f2950f205f2a2bdf5db9108830b40a7a4cf | add optional phrase type parameter | RaymondKlass/entity-extract | entity_extract/extractor/parsers/base_parser.py | entity_extract/extractor/parsers/base_parser.py | """
Base Class for Parsers - ensures that make shift parsers implement the
same standard methods as NLTK parsers.
"""
class BaseParser(object):
def __init__(self):
pass
def parse(self, sentence):
"""Method to parse a sentence - required to be implemented """
raise NotImplement... | """
Base Class for Parsers - ensures that make shift parsers implement the
same standard methods as NLTK parsers.
"""
class BaseParser(object):
def __init__(self):
pass
def parse(self, sentence):
"""Method to parse a sentence - required to be implemented """
raise NotImplement... | mit | Python |
44ac3580d9e696dcd3d5037180248bbc135b0645 | Fix breaking patch on develop branch | gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext,gsnbng/erpnext | erpnext/patches/v11_0/update_total_qty_field.py | erpnext/patches/v11_0/update_total_qty_field.py | from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc('buying', 'doctype', 'purchase_order')
frappe.reload_doc('buying', 'doctype', 'supplier_quotation')
frappe.reload_doc('selling', 'doctype', 'sales_order')
frappe.reload_doc('selling', 'doctype', 'quotation')
frappe.reload_doc('... | from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc('buying', 'doctype', 'purchase_order')
frappe.reload_doc('buying', 'doctype', 'supplier_quotation')
frappe.reload_doc('selling', 'doctype', 'sales_order')
frappe.reload_doc('selling', 'doctype', 'quotation')
frappe.reload_doc('... | agpl-3.0 | Python |
6cb4e7f2728a7d37ef5851c6ac63896d09052885 | remove semicolon in data_catalog views | MidAtlanticPortal/marco-portal2,Ecotrust/marineplanner-core,Ecotrust/marineplanner-core,MidAtlanticPortal/marco-portal2,MidAtlanticPortal/marco-portal2,MidAtlanticPortal/marco-portal2,Ecotrust/marineplanner-core,Ecotrust/marineplanner-core,Ecotrust/marineplanner-core | marco/portal/data_catalog/views.py | marco/portal/data_catalog/views.py | from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from data_manager.models import *
from portal.base.models import PortalImage
# hack for POR-224, until POR-206
def wagtail_feature_image(self):
image = PortalImage.objects.filter(tags__name__in=["th... | from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from data_manager.models import *
from portal.base.models import PortalImage
# hack for POR-224, until POR-206
def wagtail_feature_image(self):
image = PortalImage.objects.filter(tags__name__in=["th... | isc | Python |
165c3bda7fe825a143d052157952088e55cdd96b | Fix variablename | Yelp/paasta,somic/paasta,Yelp/paasta,gstarnberger/paasta,somic/paasta,gstarnberger/paasta | tests/paasta_cli/test_cmds_mark_for_deployment.py | tests/paasta_cli/test_cmds_mark_for_deployment.py | from mock import patch
from paasta_tools.paasta_cli.cmds.mark_for_deployment import paasta_mark_for_deployment
class fake_args:
clusterinstance = 'cluster.instance'
service = 'test_service'
git_url = 'git://false.repo/services/test_services'
commit = 'fake-hash'
@patch('paasta_tools.paasta_cli.cmds... | from mock import patch
from paasta_tools.paasta_cli.cmds.mark_for_deployment import paasta_mark_for_deployment
class args:
clusterinstance = 'cluster.instance'
service = 'test_service'
git_url = 'git://false.repo/services/test_services'
commit = 'fake-hash'
@patch('paasta_tools.paasta_cli.cmds.mark... | apache-2.0 | Python |
6d18ff715a5fa3059ddb609c1abdbbb06b15ad63 | Update download links for CelebA files | mila-udem/fuel,dmitriy-serdyuk/fuel,dmitriy-serdyuk/fuel,mila-udem/fuel,vdumoulin/fuel,vdumoulin/fuel | fuel/downloaders/celeba.py | fuel/downloaders/celeba.py | from fuel.downloaders.base import default_downloader
def fill_subparser(subparser):
"""Sets up a subparser to download the CelebA dataset file.
Parameters
----------
subparser : :class:`argparse.ArgumentParser`
Subparser handling the `celeba` command.
"""
urls = ['https://www.dropbox... | from fuel.downloaders.base import default_downloader
def fill_subparser(subparser):
"""Sets up a subparser to download the CelebA dataset file.
Parameters
----------
subparser : :class:`argparse.ArgumentParser`
Subparser handling the `celeba` command.
"""
urls = ['https://www.dropbox... | mit | Python |
e66fe8e6c79f7b29e2f334b481904f7d838a2655 | Fix up nits on profileMiddleware as noticed in bugzilla-813182 | mozilla/gameon,mozilla/gameon,mozilla/gameon,mozilla/gameon | gameon/users/middleware.py | gameon/users/middleware.py | from django.core.urlresolvers import reverse, resolve
from django.http import HttpResponseRedirect
from django.conf import settings
from gameon.users.models import get_profile_safely
class ProfileMiddleware(object):
"""
This middleware will redirect a user, once signed into the site via Persona
to comple... | from django.core.urlresolvers import reverse, resolve
from django.http import HttpResponseRedirect
from gameon.users.models import get_profile_safely
class ProfileMiddleware(object):
@classmethod
def safe_paths(cls):
return ('users_edit', 'django.views.static.serve', 'users_signout')
def is_saf... | bsd-3-clause | Python |
448487d8c0d4b2a3cb7407c49c3e67b62c862981 | fix example | alerta/python-alerta-client,alerta/python-alerta,alerta/python-alerta-client | examples/send.py | examples/send.py | #!/usr/bin/env python
from alerta.api import ApiClient
from alerta.alert import Alert
api = ApiClient(endpoint='http://localhost:8080', key='tUA6oBX6E5hUUQZ+dyze6vZbOMmiZWA7ke88Nvio')
alert = Alert(
resource='web-server-01',
event='HttpError',
correlate=['HttpOK'],
group='Web',
environment='Produ... | #!/usr/bin/env python
from alerta.api import ApiClient
from alerta.alert import Alert
api = ApiClient(endpoint='http://localhost:8080', key='tUA6oBX6E5hUUQZ+dyze6vZbOMmiZWA7ke88Nvio')
alert = Alert(
resource='web-server-01',
event='HttpError',
group='Web',
environment='Production',
service='thegu... | apache-2.0 | Python |
212ca557dc898f89a99552f524dd66a8d783b38f | Make the client a bit more dynamic | keybar/keybar | extras/client.py | extras/client.py | import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'keybar.settings')
# import os
# from cryptography.hazmat.primitives import hashes
# from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
# from cryptography.hazmat.backends import default_backend
# backend = default_backend()
# salt = os.urandom(1... | import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'keybar.settings')
# import os
# from cryptography.hazmat.primitives import hashes
# from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
# from cryptography.hazmat.backends import default_backend
# backend = default_backend()
# salt = os.urandom(1... | bsd-3-clause | Python |
0ce66cce88f46cfb0ad1394b33f0bf9318606a61 | Fix call to createnewaccount | Heufneutje/txircd | txircd/modules/extra/services/account_register.py | txircd/modules/extra/services/account_register.py | from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.module_interface import Command, ICommand, IModuleData, ModuleData
from zope.interface import implements
from validate_email import validate_email as validateEmail
irc.ERR_SERVICES = "955" # Custom numeric; 955 <TYPE> <SUBTYPE> <ERR... | from twisted.plugin import IPlugin
from twisted.words.protocols import irc
from txircd.module_interface import Command, ICommand, IModuleData, ModuleData
from zope.interface import implements
from validate_email import validate_email as validateEmail
irc.ERR_SERVICES = "955" # Custom numeric; 955 <TYPE> <SUBTYPE> <ERR... | bsd-3-clause | Python |
6a2237060f5b188cbd869a960ba3c1a85680a87d | bump version number to 1.0.1 | scott-maddox/fdint | fdint/version.py | fdint/version.py | __version__ = '1.0.1'
| __version__ = '1.0'
| bsd-3-clause | Python |
345d3323ed4a8c862f6a85cf25835554a4fb71db | Use --benchmark argument for performance_webview_test_suite. | catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult,catapult-project/catapult | dashboard/dashboard/pinpoint/models/quest/run_telemetry_test.py | dashboard/dashboard/pinpoint/models/quest/run_telemetry_test.py | # Copyright 2018 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.
"""Quest for running a Telemetry benchmark in Swarming."""
import copy
from dashboard.pinpoint.models.quest import run_test
_DEFAULT_EXTRA_ARGS = [
'... | # Copyright 2018 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.
"""Quest for running a Telemetry benchmark in Swarming."""
import copy
from dashboard.pinpoint.models.quest import run_test
_DEFAULT_EXTRA_ARGS = [
'... | bsd-3-clause | Python |
521d60789859f0130b35736dab6301ed5734e5c4 | Bump version | tk0miya/flake8-coding | flake8_coding.py | flake8_coding.py | # -*- coding: utf-8 -*-
import re
__version__ = '1.0.1'
class CodingChecker(object):
name = 'flake8_coding'
version = __version__
def __init__(self, tree, filename):
self.filename = filename
@classmethod
def add_options(cls, parser):
parser.add_option(
'--accept-enc... | # -*- coding: utf-8 -*-
import re
__version__ = '1.0.0'
class CodingChecker(object):
name = 'flake8_coding'
version = __version__
def __init__(self, tree, filename):
self.filename = filename
@classmethod
def add_options(cls, parser):
parser.add_option(
'--accept-enc... | apache-2.0 | Python |
63b450ed2d4885ba52a84421493633663831a04a | add Feed.lookup() | podhub-io/follower | follower/feed.py | follower/feed.py | import feedparser
import re
class Feed(object):
_PARAMS = frozenset([
'author', 'author_detail', 'authors', 'generator', 'generator_detail',
'image', 'itunes_explicit', 'language', 'link', 'links', 'publisher',
'publisher_detail', 'rawvoice_frequency', 'rawvoice_rating', 'rights',
... | import feedparser
import re
class Feed(object):
_PARAMS = frozenset([
'author', 'author_detail', 'authors', 'generator', 'generator_detail',
'image', 'itunes_explicit', 'language', 'link', 'links', 'publisher',
'publisher_detail', 'rawvoice_frequency', 'rawvoice_rating', 'rights',
... | bsd-3-clause | Python |
c22fb41f291f79bbdd6efaff6496e6e518dafd1f | update init | poldracklab/niworkflows,oesteban/niworkflows,poldracklab/niworkflows,oesteban/niworkflows,oesteban/niworkflows | niworkflows/interfaces/__init__.py | niworkflows/interfaces/__init__.py | # -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from __future__ import absolute_import, division, print_function, unicode_literals
from .masks import BETRPT as BET
from .segmentation import (FASTRPT as FAST)
from .registration im... | # -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from __future__ import absolute_import, division, print_function, unicode_literals
from .masks import BETRPT as BET
from .segmentation import (FASTRPT as FAST)
from .registration im... | apache-2.0 | Python |
333e525c84c37ca909ac3a77252274498ec973cd | Use a text field for the ref page data | vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium | ocradmin/reference_pages/models.py | ocradmin/reference_pages/models.py | """
A Reference Page is an OCR object that consists of a source
image, a binarized image, and a transcript of lines relating
to the latter.
"""
import os
import datetime
from django.db import models
from django.contrib.auth.models import User
from ocradmin.projects.models import Project
from ocradmin.core import utils... | """
A Reference Page is an OCR object that consists of a source
image, a binarized image, and a transcript of lines relating
to the latter.
"""
import os
import datetime
from picklefield import fields
from django.db import models
from django.contrib.auth.models import User
from ocradmin.projects.models import Project
... | apache-2.0 | Python |
c13eaf8a056df054cb05df4e70759d839ba62a73 | Fix variable typings | openfisca/openfisca-core,openfisca/openfisca-core | openfisca_core/variables/config.py | openfisca_core/variables/config.py | import datetime
import numpy
from openfisca_core import indexed_enums
from openfisca_core.indexed_enums import Enum
VALUE_TYPES = {
bool: {
'dtype': numpy.bool_,
'default': False,
'json_type': 'boolean',
'formatted_value_type': 'Boolean',
'is_period_size_independent': Tru... | import datetime
import numpy
from openfisca_core import indexed_enums
from openfisca_core.indexed_enums import Enum
VALUE_TYPES = {
bool: {
'dtype': numpy.bool,
'default': False,
'json_type': 'boolean',
'formatted_value_type': 'Boolean',
'is_period_size_independent': True... | agpl-3.0 | Python |
e74805b666bda7661caa07b61799edc02374f8ff | change version 0.6.2beta6 | imaginal/openprocurement.search,openprocurement/openprocurement.search | openprocurement/search/__init__.py | openprocurement/search/__init__.py | # -*- coding: utf-8 -*-
__version__ = "0.6.2beta6"
| # -*- coding: utf-8 -*-
__version__ = "0.6.2b5"
| apache-2.0 | Python |
ec1f0d2fe48b45855df1fbd722949c2f564ca601 | Remove useless pass | myint/git-sweep | gitsweep/base.py | gitsweep/base.py | class MissingRemote(Exception):
"""
Raise when a remote by name is not found.
"""
class MissingMasterBranch(Exception):
"""
Raise when the "master" branch cannot be located.
"""
class BaseOperation(object):
"""
Base class for all Git-related operations.
"""
def __init__... | class MissingRemote(Exception):
"""
Raise when a remote by name is not found.
"""
pass
class MissingMasterBranch(Exception):
"""
Raise when the "master" branch cannot be located.
"""
pass
class BaseOperation(object):
"""
Base class for all Git-related operations.
""... | mit | Python |
564996fa825efaf043fe35aa89b53785b097a3a8 | Add error message when input file not found | simphony/simphony-lammps-md,simphony/simphony-lammps-md | examples/dem_billiards/dem_billiards.py | examples/dem_billiards/dem_billiards.py | from __future__ import print_function
import click
from simphony.engine import lammps
from simlammps import EngineType
from simphony.core.cuba import CUBA
@click.command()
@click.option('--show/--no-show', default=False)
def billiards_example(show):
input_file = "billiards_init.data"
try:
particles... | from __future__ import print_function
import click
from simphony.engine import lammps
from simlammps import EngineType
from simphony.core.cuba import CUBA
@click.command()
@click.option('--show/--no-show', default=False)
def billiards_example(show):
particles, state_data = lammps.read_data_file("billiards_init... | bsd-2-clause | Python |
5802b08591db5510b9e7d5655399466d2b33c8d8 | fix parentConstraint on twist | Aiacos/DevPyLib | mayaLib/rigLib/twistJoint.py | mayaLib/rigLib/twistJoint.py | __author__ = 'Lorenzo Argentieri'
import pymel.core as pm
import mayaLib.rigLib.utils.util
def make_twist_joints(joint_selection=pm.ls(sl=True, type='joint', dag=True), n_twist_joint=3):
"""
Add Twist Joint for selected Joint
:param joint_selection:
:param n_twist_joint:
:return:
"""
# P... | __author__ = 'Lorenzo Argentieri'
import pymel.core as pm
import mayaLib.rigLib.utils.util
def make_twist_joints(joint_selection=pm.ls(sl=True, type='joint', dag=True), n_twist_joint=3):
"""
Add Twist Joint for selected Joint
:param joint_selection:
:param n_twist_joint:
:return:
"""
# P... | agpl-3.0 | Python |
a7e54053c40566f1885c79d05c5639792e57a1e2 | Add message with host for interactive login. | genestack/python-client | genestack/settings/User.py | genestack/settings/User.py | #
# Copyright (c) 2011-2015 Genestack Limited
# All Rights Reserved
# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF GENESTACK LIMITED
# The copyright notice above does not evidence any
# actual or intended publication of such source code.
#
from getpass import getpass
from genestack import GenestackException, Connect... | #
# Copyright (c) 2011-2015 Genestack Limited
# All Rights Reserved
# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF GENESTACK LIMITED
# The copyright notice above does not evidence any
# actual or intended publication of such source code.
#
from getpass import getpass
from genestack import GenestackException, Connect... | mit | Python |
18cf751d1313967cace6a79aad6b69a605ffb65b | fix url (#13749) | iulian787/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/ocaml/package.py | var/spack/repos/builtin/packages/ocaml/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Ocaml(Package):
"""OCaml is an industrial strength programming language supporting
... | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Ocaml(Package):
"""OCaml is an industrial strength programming language supporting
... | lgpl-2.1 | Python |
db794ea2016b831c49cde00c66863ddb0eba7e14 | fix build on macOS | iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,LLNL/spack | var/spack/repos/builtin/packages/p7zip/package.py | var/spack/repos/builtin/packages/p7zip/package.py | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
class P7zip(MakefilePackage):
"""A Unix port of the 7z file archiver"""
homepage = "http://p7zip.sourceforge.net... | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class P7zip(MakefilePackage):
"""A Unix port of the 7z file archiver"""
homepage = "http://... | lgpl-2.1 | Python |
19968a00350202e0008d77724de2db311f8c29d9 | add version 3.1.0 (#12084) | LLNL/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack | var/spack/repos/builtin/packages/scons/package.py | var/spack/repos/builtin/packages/scons/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Scons(PythonPackage):
"""SCons is a software construction tool"""
homepage = "http://... | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Scons(PythonPackage):
"""SCons is a software construction tool"""
homepage = "http://... | lgpl-2.1 | Python |
21319fb1526d691b95574624107245eb297cdbed | Add implementaion of BFS, DFS and Topological Sort. | ankeshanand/interview-prep,ankeshanand/interview-prep | graphs/graphs.py | graphs/graphs.py | class Graph(object):
def __init__(self, weighted=False):
self.adj_list = {}
self.vertices = set()
self.weighted = weighted
def add_edge(self, u, v, weight=None):
if not self.weighted:
self.adj_list[u] = self.adj_list.get(u, [])
self.adj_list[u].append(v)
... | class Graph(object):
def __init__(self, n_vertices=0):
self.n_vertices = n_vertices
self.adj_list = {}
def add_edge(self, u, v, weight):
if u not in self.adj_list:
self.adj_list[u] = {v: weight}
else:
self.adj_list[u][v] = weight
def dfs(g, vertex):
... | mit | Python |
611e98c6e12398e1c04ca6ba0f345ed3b1856aef | Update get_repo_desc to get text with special chars also | staranjeet/github-trending-cli | githubtrending/trending.py | githubtrending/trending.py | import requests
from lxml import etree
import click
from .helpers import base_data
requests.packages.urllib3.disable_warnings()
def read_page(url, timeout=5):
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:11.0) Gecko/20100101 Firefox/11.0'}
try:
response = requests.get(... | import requests
from lxml import etree
import click
from .helpers import base_data
requests.packages.urllib3.disable_warnings()
def read_page(url, timeout=5):
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:11.0) Gecko/20100101 Firefox/11.0'}
try:
response = requests.get(... | mit | Python |
3b3ec0c5a6cc49aa3802488dc18823975e37f1bc | add msgpack and json round-trip tests | ericdill/databroker,ericdill/databroker | databroker/tests/test_document.py | databroker/tests/test_document.py | import copy
import pickle
import pytest
import json
from ..core import Document, NotMutable
def test_immutable():
d = Document({'a': 1})
with pytest.raises(NotMutable):
# Update existing key
d['a'] = 2
with pytest.raises(NotMutable):
# Add new key
d['b'] = 2
with pyte... | import copy
import pickle
import pytest
from ..core import Document, NotMutable
def test_immutable():
d = Document({'a': 1})
with pytest.raises(NotMutable):
# Update existing key
d['a'] = 2
with pytest.raises(NotMutable):
# Add new key
d['b'] = 2
with pytest.raises(No... | bsd-3-clause | Python |
80ec5f48bb723103a0788cb77c864125c6c28e81 | Bump version | nolze/msoffcrypto-tool,nolze/msoffcrypto-tool,nolze/ms-offcrypto-tool,nolze/ms-offcrypto-tool | msoffcrypto/__init__.py | msoffcrypto/__init__.py | import olefile
import zipfile
__version__ = "4.10.0"
def OfficeFile(file):
'''Return an office file object based on the format of given file.
Args:
file (:obj:`_io.BufferedReader`): Input file.
Returns:
BaseOfficeFile object.
Examples:
>>> f = open("tests/inputs/example_pa... | import olefile
import zipfile
__version__ = "4.9.0"
def OfficeFile(file):
'''Return an office file object based on the format of given file.
Args:
file (:obj:`_io.BufferedReader`): Input file.
Returns:
BaseOfficeFile object.
Examples:
>>> f = open("tests/inputs/example_pas... | mit | Python |
00575fb419664721b42d406c6bf609f4fb5bccb5 | Update doctests | nolze/ms-offcrypto-tool,nolze/ms-offcrypto-tool,nolze/msoffcrypto-tool,nolze/msoffcrypto-tool | msoffcrypto/__init__.py | msoffcrypto/__init__.py | import olefile
import zipfile
__version__ = "4.10.0"
def OfficeFile(file):
'''Return an office file object based on the format of given file.
Args:
file (:obj:`_io.BufferedReader`): Input file.
Returns:
BaseOfficeFile object.
Examples:
>>> with open("tests/inputs/example_p... | import olefile
import zipfile
__version__ = "4.10.0"
def OfficeFile(file):
'''Return an office file object based on the format of given file.
Args:
file (:obj:`_io.BufferedReader`): Input file.
Returns:
BaseOfficeFile object.
Examples:
>>> # would be better but doctest can... | mit | Python |
40518940e20a4d695c9ec5fd4d53294cbbace696 | fix test_wheel_python_3_only() | BoboTiG/python-mss | mss/tests/test_setup.py | mss/tests/test_setup.py | """
This is part of the MSS Python's module.
Source: https://github.com/BoboTiG/python-mss
"""
import platform
from subprocess import STDOUT, check_call, check_output
import pytest
from mss import __version__
if platform.system().lower() != "linux":
pytestmark = pytest.mark.skip
# Note: using `--no-isolation` b... | """
This is part of the MSS Python's module.
Source: https://github.com/BoboTiG/python-mss
"""
from subprocess import STDOUT, check_call, check_output
from mss import __version__
INSTALL = "python -m build --sdist --wheel".split()
CHECK = "twine check dist/*".split()
def test_wheel_python_3_only():
"""Ensure th... | mit | Python |
643d1804e2653c117cdc35f1598c8a204d790b7d | Make getattribute traverse nested items | vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium,vitorio/ocropodium | ocradmin/core/templatetags/getattribute.py | ocradmin/core/templatetags/getattribute.py | import re
from django.template import Library
from django.conf import settings
numeric_test = re.compile("^\d+$")
register = Library()
@register.filter
def getattribute(value, argstr):
"""Gets an attribute of an object dynamically from a string name"""
args = argstr.split(".")
leads = args[:-1]
arg = ... | import re
from django.template import Library
from django.conf import settings
numeric_test = re.compile("^\d+$")
register = Library()
@register.filter
def getattribute(value, arg):
"""Gets an attribute of an object dynamically from a string name"""
if hasattr(value, str(arg)):
return getattr(value, a... | apache-2.0 | Python |
89ed3c2de0280280948dbefd23248e4801e5df83 | Set version to 0.1.0b2 | gnotaras/django-taggit-autocomplete-modified,onepercentclub/django-taggit-autocomplete-modified,gnotaras/django-taggit-autocomplete-modified | src/taggit_autocomplete_modified/__init__.py | src/taggit_autocomplete_modified/__init__.py | # -*- coding: utf-8 -*-
#
# This file is part of django-taggit-autocomplete-modified.
#
# django-taggit-autocomplete-modified provides autocomplete functionality
# to the tags form field of django-taggit.
#
# Development Web Site:
# - http://www.codetrax.org/projects/django-taggit-autocomplete-modified
# Public... | # -*- coding: utf-8 -*-
#
# This file is part of django-taggit-autocomplete-modified.
#
# django-taggit-autocomplete-modified provides autocomplete functionality
# to the tags form field of django-taggit.
#
# Development Web Site:
# - http://www.codetrax.org/projects/django-taggit-autocomplete-modified
# Public... | apache-2.0 | Python |
e818860af87cad796699e27f8dfb4ff6fc9354e8 | Add extra argument to get per-feature reconstruction error for anomaly detection from Python. | kyoren/https-github.com-h2oai-h2o-3,h2oai/h2o-3,mathemage/h2o-3,h2oai/h2o-dev,mathemage/h2o-3,datachand/h2o-3,YzPaul3/h2o-3,h2oai/h2o-3,brightchen/h2o-3,mathemage/h2o-3,YzPaul3/h2o-3,h2oai/h2o-dev,datachand/h2o-3,kyoren/https-github.com-h2oai-h2o-3,printedheart/h2o-3,pchmieli/h2o-3,madmax983/h2o-3,YzPaul3/h2o-3,datacha... | h2o-py/h2o/model/autoencoder.py | h2o-py/h2o/model/autoencoder.py | """
AutoEncoder Models
"""
from model_base import *
from metrics_base import *
class H2OAutoEncoderModel(ModelBase):
"""
Class for AutoEncoder models.
"""
def __init__(self, dest_key, model_json):
super(H2OAutoEncoderModel, self).__init__(dest_key, model_json,H2OAutoEncoderModelMetrics)
def anomaly(se... | """
AutoEncoder Models
"""
from model_base import *
from metrics_base import *
class H2OAutoEncoderModel(ModelBase):
"""
Class for AutoEncoder models.
"""
def __init__(self, dest_key, model_json):
super(H2OAutoEncoderModel, self).__init__(dest_key, model_json,H2OAutoEncoderModelMetrics)
def anomaly(se... | apache-2.0 | Python |
39659c752884ae31ccc14bbe247f3918f97bab9c | Make mypy succeed with imports on master.py | mhils/mitmproxy,mhils/mitmproxy,Kriechi/mitmproxy,StevenVanAcker/mitmproxy,MatthewShao/mitmproxy,mitmproxy/mitmproxy,xaxa89/mitmproxy,ddworken/mitmproxy,mhils/mitmproxy,mitmproxy/mitmproxy,cortesi/mitmproxy,ddworken/mitmproxy,MatthewShao/mitmproxy,ddworken/mitmproxy,mitmproxy/mitmproxy,mhils/mitmproxy,vhaupert/mitmprox... | mitmproxy/utils/typecheck.py | mitmproxy/utils/typecheck.py | import typing
def check_type(name: str, value: typing.Any, typeinfo: typing.Any) -> None:
"""
This function checks if the provided value is an instance of typeinfo
and raises a TypeError otherwise.
The following types from the typing package have specialized support:
- Union
- Tuple
- IO... | import typing
def check_type(name: str, value: typing.Any, typeinfo: type) -> None:
"""
This function checks if the provided value is an instance of typeinfo
and raises a TypeError otherwise.
The following types from the typing package have specialized support:
- Union
- Tuple
- IO
"... | mit | Python |
5ab35652c6c850db9486403c815110c2c7ccdc4a | Order events by start date | ox-it/talks.ox,ox-it/talks.ox,ox-it/talks.ox | talks/events/views.py | talks/events/views.py | from datetime import date
from django.http.response import Http404
from django.shortcuts import render
from talks.api_ox.query import get_info, get_oxford_date
from talks.api_ox.api import ApiException
from .models import Event
def homepage(request):
# TODO needs to clarify the difference
# between homepage... | from datetime import date
from django.http.response import Http404
from django.shortcuts import render
from talks.api_ox.query import get_info, get_oxford_date
from talks.api_ox.api import ApiException
from .models import Event
def homepage(request):
# TODO needs to clarify the difference
# between homepage... | apache-2.0 | Python |
659abb04afa76022cdd32e503e68f52535c21631 | Add some comments to the apartments migration | openmotics/gateway,openmotics/gateway | src/gateway/migrations/orm/025_apartment_rebus_id_nullable.py | src/gateway/migrations/orm/025_apartment_rebus_id_nullable.py | # Copyright (C) 2021 OpenMotics BV
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribu... | # Copyright (C) 2021 OpenMotics BV
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribu... | agpl-3.0 | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.