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 |
|---|---|---|---|---|---|---|---|---|
38eb6221ca41446c0c4fb1510354bdc4f00ba5f1 | Remove children via uid rather than name | waltermoreira/serfnode,waltermoreira/serfnode,waltermoreira/serfnode | serfnode/build/handler/launcher.py | serfnode/build/handler/launcher.py | #!/usr/bin/env python
import functools
import os
import signal
import sys
import docker_utils
def handler(name, signum, frame):
print('Should kill', name)
try:
cid = open('/child_{}'.format(name)).read().strip()
docker_utils.client.remove_container(cid, force=True)
except Exception:
... | #!/usr/bin/env python
import functools
import os
import signal
import sys
import docker_utils
def handler(name, signum, frame):
print('Should kill', name)
try:
docker_utils.client.remove_container(name, force=True)
except Exception:
pass
sys.exit(0)
def launch(name, args):
try:... | mit | Python |
bd3d8738fc00b2d36aafe5749e88826845441541 | fix handling of pages (closes #685) | eirmag/weboob,frankrousseau/weboob,willprice/weboob,Boussadia/weboob,yannrouillard/weboob,nojhan/weboob-devel,willprice/weboob,franek/weboob,yannrouillard/weboob,sputnick-dev/weboob,sputnick-dev/weboob,laurent-george/weboob,frankrousseau/weboob,laurent-george/weboob,laurent-george/weboob,eirmag/weboob,franek/weboob,Bou... | weboob/backends/orange/browser.py | weboob/backends/orange/browser.py | # -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Nicolas Duhamel
#
# This file is part of weboob.
#
# weboob 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 yo... | # -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Nicolas Duhamel
#
# This file is part of weboob.
#
# weboob 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 yo... | agpl-3.0 | Python |
f631099894a02cb79b5be372894ed1f589849a8d | test for datetime.datetime type from dframe_dateconv | BMJHayward/infusionsoft_xpmt | test/pandaservtest.py | test/pandaservtest.py | import unittest, sys, os
from datetime import datetime
import pandas as pd
import src.pandaserv as pandaserv
import numpy as np
class Testpandaserv(unittest.TestCase):
def setUp(self):
self.dates = pd.date_range('20130101', periods=6)
self.df = pd.DataFrame(
np.random.randn(6,4... | import unittest, sys, os
from datetime import datetime
import pandas as pd
import src.pandaserv as pandaserv
import numpy as np
class Testpandaserv(unittest.TestCase):
def setUp(self):
self.dates = pd.date_range('20130101', periods=6)
self.df = pd.DataFrame(
np.random.randn(6,4... | mit | Python |
91238b6b0f0b14a6d0f7707aa0b388cedfd5894c | set default false allow_cnpj_multi_ie | akretion/l10n-brazil,OCA/l10n-brazil,OCA/l10n-brazil,OCA/l10n-brazil,akretion/l10n-brazil,akretion/l10n-brazil | l10n_br_base/models/res_config.py | l10n_br_base/models/res_config.py | # -*- coding: utf-8 -*-
from openerp import fields, models
from openerp.tools.safe_eval import safe_eval
class res_config(models.TransientModel):
_inherit = 'base.config.settings'
allow_cnpj_multi_ie = fields.Boolean(
string=u'Permitir o cadastro de Customers com CNPJs iguais',
default=False... | # -*- coding: utf-8 -*-
from openerp import fields, models
from openerp.tools.safe_eval import safe_eval
class res_config(models.TransientModel):
_inherit = 'base.config.settings'
allow_cnpj_multi_ie = fields.Boolean(
string=u'Permitir o cadastro de Customers com CNPJs iguais',
default=True,... | agpl-3.0 | Python |
bc9c782317eac99716bc961e42e6072f0e5616cf | Add dummy var in order to work around issue 1 https://github.com/LinuxTeam-teilar/cronos.teilar.gr/issues/1 | LinuxTeam-teilar/cronos.teilar.gr,LinuxTeam-teilar/cronos.teilar.gr,LinuxTeam-teilar/cronos.teilar.gr | apps/__init__.py | apps/__init__.py | # -*- coding: utf-8 -*-
from django.conf import settings
from django.core.mail import send_mail
'''
For unkown reason, the logger is NOT able to find a handler
unless a settings.VARIABLE is called!!
https://github.com/LinuxTeam-teilar/cronos.teilar.gr/issues/1
I leave that here till the bug is fixed
'''
settings.DEBU... | # -*- coding: utf-8 -*-
from django.conf import settings
from django.core.mail import send_mail
def mail_cronos_admin(title, message):
'''
Wrapper function of send_mail
'''
try:
send_mail(title, message, 'notification@cronos.teilar.gr', [settings.ADMIN[0][1]])
except:
pass
class C... | agpl-3.0 | Python |
d006711787d018ed401ba003d3472b8a0e843437 | Add documentation for ignoring empty strings | Sakartu/stringinfo | stringinfo.py | stringinfo.py | #!/usr/bin/env python3
# -*- coding: utf8 -*-
"""
Usage:
stringinfo [options] [--] [STRING]...
Options:
STRING The strings for which you want information. If none are given, read from stdin upto EOF. Empty strings are ignored.
--list List all plugins, with their descriptions and whether they're defau... | #!/usr/bin/env python3
# -*- coding: utf8 -*-
"""
Usage:
stringinfo [options] [--] [STRING]...
Options:
STRING The strings for which you want information. If none are given, read from stdin upto EOF.
--list List all plugins, with their descriptions and whether they're default or not
--all R... | mit | Python |
9e7cd9f13abb29ff8458407b905d522548eaf5c9 | Refactor check_executables_have_shebangs for git ls-files reuse | pre-commit/pre-commit-hooks | pre_commit_hooks/check_executables_have_shebangs.py | pre_commit_hooks/check_executables_have_shebangs.py | """Check that executable text files have a shebang."""
import argparse
import shlex
import sys
from typing import Generator
from typing import List
from typing import NamedTuple
from typing import Optional
from typing import Sequence
from typing import Set
from pre_commit_hooks.util import cmd_output
from pre_commit_h... | """Check that executable text files have a shebang."""
import argparse
import shlex
import sys
from typing import List
from typing import Optional
from typing import Sequence
from typing import Set
from pre_commit_hooks.util import cmd_output
from pre_commit_hooks.util import zsplit
EXECUTABLE_VALUES = frozenset(('1'... | mit | Python |
5eeab4e458e7af3895525dcc08017eb855308723 | remove extra s typo | appeltel/AutoCMS,appeltel/AutoCMS,appeltel/AutoCMS | autocms/stats.py | autocms/stats.py | """Harvesting of persistent statsitical records."""
import os
import time
import importlib
from .core import load_records
def harvest_default_stats(records, config):
"""Add a row to the long term statistics record for a given test."""
now = int(time.time())
harvest_time = now - int(config['AUTOCMS_STAT_... | """Harvesting of persistent statsitical records."""
import os
import time
import importlib
from .core import load_records
def harvest_default_stats(records, config):
"""Add a row to the long term statistics record for a given test."""
now = int(time.time())
harvest_time = now - int(config['AUTOCMS_STAT_... | mit | Python |
2d392d8c107c9055e6b62bb365158b1001872cde | Fix deprecation warnings. | zafarali/emdp | emdp/analytic.py | emdp/analytic.py | """
Tools to get analytic solutions from MDPs
"""
import numpy as np
def calculate_P_pi(P, pi):
r"""
calculates P_pi
P_pi(s,t) = \sum_a pi(s,a) p(s, a, t)
:param P: transition matrix of size |S|x|A|x|S|
:param pi: matrix of size |S| x |A| indicating the policy
:return: a matrix of size |S| x |... | """
Tools to get analytic solutions from MDPs
"""
import numpy as np
def calculate_P_pi(P, pi):
"""
calculates P_pi
P_pi(s,t) = \sum_a pi(s,a) p(s, a, t)
:param P: transition matrix of size |S|x|A|x|S|
:param pi: matrix of size |S| x |A| indicating the policy
:return: a matrix of size |S| x |S... | mit | Python |
c8f774ea3455af057736166757f831407711ae67 | Bump to 0.4. | gtaylor/EVE-Market-Data-Structures | emds/__init__.py | emds/__init__.py | __version__ = '0.4' | __version__ = '0.3' | mit | Python |
033ec1c5c7d44c54136541aa0e1bd8c73e3c1163 | update test_unitcell | dschick/udkm1Dsim,dschick/udkm1Dsim | test/test_unitCell.py | test/test_unitCell.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from udkm1Dsim.atoms import Atom
from udkm1Dsim.unitCell import UnitCell
from pint import UnitRegistry
u = UnitRegistry()
u.default_format = '~P'
from numpy import array
def test_unit_cell():
Fe = Atom('Fe')
uc = UnitCell('uc', 'Unit Cell', 2.86*u.angstrom, heat_... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from udkm1Dsim.atoms import Atom
from udkm1Dsim.unitCell import UnitCell
from pint import UnitRegistry
u = UnitRegistry()
u.default_format = '~P'
from numpy import array
def test_unit_cell():
Fe = Atom('Fe')
uc = UnitCell('uc', 'Unit Cell', 2.86*u.angstrom, heat_... | mit | Python |
b6d161e54e9b398f79f417ac14ec65e5fdb609d3 | remove pre tag in emit init | BrianHicks/emit,BrianHicks/emit,BrianHicks/emit | emit/__init__.py | emit/__init__.py | __version__ = '0.4.0'
from emit.router.core import Router
| __version__ = '0.4.0pre'
from emit.router.core import Router
| mit | Python |
19fa44530adf1fd5456a0be93ea0dddd7e43eb8c | Remove junk import. | sippy/rtp_cluster,sippy/rtp_cluster | Cli_server_tcp.py | Cli_server_tcp.py | # Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved.
# Copyright (c) 2006-2014 Sippy Software, Inc. All rights reserved.
#
# 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. Redistrib... | # Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved.
# Copyright (c) 2006-2014 Sippy Software, Inc. All rights reserved.
#
# 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. Redistrib... | bsd-2-clause | Python |
0070417e170ff67248918243d6aaea248a5d024c | Fix Q3 in exercise 6 checking code | Kaggle/learntools,Kaggle/learntools | learntools/computer_vision/ex6.py | learntools/computer_vision/ex6.py | from learntools.core import *
import tensorflow as tf
# Free
class Q1(CodingProblem):
_solution = ""
_hint = ""
def check(self):
pass
class Q2A(ThoughtExperiment):
_hint = "Remember that whatever transformation you apply needs at least to keep the classes distinct, but otherwise should more ... | from learntools.core import *
import tensorflow as tf
# Free
class Q1(CodingProblem):
_solution = ""
_hint = ""
def check(self):
pass
class Q2A(ThoughtExperiment):
_hint = "Remember that whatever transformation you apply needs at least to keep the classes distinct, but otherwise should more ... | apache-2.0 | Python |
f178b2378661a25cebe9753cf84d6ea9f3c081a8 | Improve doc for MultivalueEnum. | kissgyorgy/enum34-custom | enum34_custom.py | enum34_custom.py | from enum import Enum, EnumMeta
from functools import total_ordering
class _MultiValueMeta(EnumMeta):
def __init__(self, cls, bases, classdict):
# make sure we only have tuple values, not single values
for member in self.__members__.values():
if not isinstance(member.value, tuple):
... | from enum import Enum, EnumMeta
from functools import total_ordering
class _MultiValueMeta(EnumMeta):
def __init__(self, cls, bases, classdict):
# make sure we only have tuple values, not single values
for member in self.__members__.values():
if not isinstance(member.value, tuple):
... | mit | Python |
cf472cc43c4473ad7403bda64302d1170ee6874e | Save user timezone | argoroots/Entu,argoroots/Entu,argoroots/Entu | controllers/preferences.py | controllers/preferences.py | from pytz.gae import pytz
from bo import *
from database.person import *
class ShowPreferences(boRequestHandler):
def get(self):
self.view('preferences', 'preferences.html', {
'person': Person().current,
'preferences': UserPreferences().current,
'timezones': pytz.commo... | from bo import *
from database import *
class ShowPreferences(boRequestHandler):
def get(self):
self.view('preferences', 'preferences.html', {
'person': Person().current,
'preferences': UserPreferences().current,
})
def post(self):
UserPreferences().set_languag... | mit | Python |
ab4cc4fb85c8616de0be53d0a95ad8096ac0cc0c | set up the page and layout for Dashboard:Team Application Overview | SkillSmart/ConferenceManagementSystem,SkillSmart/ConferenceManagementSystem,SkillSmart/ConferenceManagementSystem,SkillSmart/ConferenceManagementSystem,SkillSmart/ConferenceManagementSystem | Dashboard/urls.py | Dashboard/urls.py | from django.conf.urls import url
# View Imports
from . import views
app_name = "dashboard"
urlpatterns = [
url(r'^$', views.DashboardIndex.as_view(), name='index'),
url(r'^experts/$', views.expert_management, name='manage_experts'),
url(r'^experts/(?P<username>.+)/$', views.expert_management, name="exper... | from django.conf.urls import url
# View Imports
from . import views
app_name = "dashboard"
urlpatterns = [
url(r'^$', views.DashboardIndex.as_view(), name='index'),
url(r'^experts/$', views.expert_management, name='manage_experts'),
url(r'^experts/(?P<username>.+)/$', views.expert_management, name="exper... | mit | Python |
f0bec02a6e2516ffd11d43b089576c0463d8d51f | Update denormalizer | barberscore/barberscore-api,barberscore/barberscore-api,barberscore/barberscore-api,dbinetti/barberscore-django,dbinetti/barberscore-django,dbinetti/barberscore,dbinetti/barberscore,barberscore/barberscore-api | project/apps/api/management/commands/denormalize.py | project/apps/api/management/commands/denormalize.py | from django.core.management.base import (
BaseCommand,
)
from apps.api.models import (
Convention,
Contest,
Contestant,
Appearance,
Performance,
Group,
Singer,
Director,
Judge,
)
class Command(BaseCommand):
help = "Command to denormailze data."
def handle(self, *args,... | from django.core.management.base import (
BaseCommand,
)
from apps.api.models import (
Convention,
Contest,
Contestant,
Performance,
Group,
Person,
Singer,
Director,
)
class Command(BaseCommand):
help = "Command to denormailze data."
def handle(self, *args, **options):
... | bsd-2-clause | Python |
60e2503bde822fdcea91c3d0a8e6ddb0f67d0d79 | update scripts | cmu-db/db-webcrawler,cmu-db/cmdbac,cmu-db/db-webcrawler,cmu-db/db-webcrawler,cmu-db/cmdbac,cmu-db/cmdbac,cmu-db/db-webcrawler,cmu-db/cmdbac,cmu-db/cmdbac,cmu-db/db-webcrawler | scripts/deploy_repos.py | scripts/deploy_repos.py | #!/usr/bin/env python
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, "core"))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cmudbac.settings")
import django
django.setup()
from django.db.models import Q
from libr... | #!/usr/bin/env python
import os, sys
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir))
sys.path.append(os.path.join(os.path.dirname(__file__), os.pardir, "core"))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cmudbac.settings")
import django
django.setup()
from django.db.models import Q
from libr... | apache-2.0 | Python |
bca6f6041e9f49d1d25d7a9c4cb88080d88c45b1 | Comment concerning differences in keys per path | saulshanabrook/django-dumper | dumper/invalidation.py | dumper/invalidation.py | import dumper.utils
def invalidate_paths(paths):
'''
Invalidate all pages for a certain path.
'''
for path in paths:
for key in all_cache_keys_from_path(path):
dumper.utils.cache.delete(key)
def all_cache_keys_from_path(path):
'''
Each path can actually have multiple cach... | import dumper.utils
def invalidate_paths(paths):
'''
Invalidate all pages for a certain path.
'''
for path in paths:
for key in all_cache_keys_from_path(path):
dumper.utils.cache.delete(key)
def all_cache_keys_from_path(path):
return [dumper.utils.cache_key(path, method) for ... | mit | Python |
2b7dbcd01a4d208f83204fc4323ddff055e4a87e | Move common tests to a base reusable class. | yasserglez/ngram_profile | test_ngram_profile.py | test_ngram_profile.py | # -*- coding: utf-8 -*-
import os
import json
import unittest
import ngram_profile
class CommonNGramProfileTests(object):
profileClass = None
def test_init(self):
profile = self.profileClass()
self.assertEqual(len(profile), 0)
def test_json_roundtrip(self):
json_profile = '{"a... | # -*- coding: utf-8 -*-
import os
import json
import unittest
from ngram_profile import NGramProfile, CharNGramProfile
class TestNGramProfile(unittest.TestCase):
def test_init(self):
profile = NGramProfile()
self.assertEqual(len(profile), 0)
def test_json_roundtrip(self):
json_prof... | apache-2.0 | Python |
d1232473ecb31eb2b85b67e54d5939093233f2bf | Print client pk in list_sessions command | nguyenduchien1994/django-ncharts,nguyenduchien1994/django-ncharts,nguyenduchien1994/django-ncharts,nguyenduchien1994/django-ncharts,nguyenduchien1994/django-ncharts | ncharts/management/commands/list_sessions.py | ncharts/management/commands/list_sessions.py | from django.core.management.base import NoArgsCommand
from ncharts.models import ClientState
from ncharts import views as nc_views
from django.contrib.sessions.models import Session
class Command(NoArgsCommand):
def handle_noargs(self, **options):
sessions = Session.objects.all()
print("#session... | from django.core.management.base import NoArgsCommand
from ncharts.models import ClientState
from ncharts import views as nc_views
from django.contrib.sessions.models import Session
class Command(NoArgsCommand):
def handle_noargs(self, **options):
sessions = Session.objects.all()
print("#session... | bsd-2-clause | Python |
e72da8231e7a5b05f098db1f78b66b8cb57f27ba | remove checking in autots import (#5489) | yangw1234/BigDL,intel-analytics/BigDL,intel-analytics/BigDL,yangw1234/BigDL,yangw1234/BigDL,yangw1234/BigDL,intel-analytics/BigDL,intel-analytics/BigDL | python/chronos/src/bigdl/chronos/autots/__init__.py | python/chronos/src/bigdl/chronos/autots/__init__.py | #
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | #
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | apache-2.0 | Python |
b52a937356f2112ecd5adcdf79ac6430169a735f | fix file close bug causing errors in pypy | Abhinav117/pymtl,Abhinav117/pymtl,Abhinav117/pymtl,Abhinav117/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 |
b0806c0b8b950a3007107cc58fb21e504cf09427 | Move serial device path to settings | ojarva/home-info-display,ojarva/home-info-display,ojarva/home-info-display,ojarva/home-info-display | homedisplay/control_milight/management/commands/listen_433.py | homedisplay/control_milight/management/commands/listen_433.py | from control_milight.utils import process_automatic_trigger
from django.conf import settings
from django.core.management.base import BaseCommand, CommandError
import serial
import time
class Command(BaseCommand):
args = ''
help = 'Listen for 433MHz radio messages'
ITEM_MAP = {
"5236713": "kitchen"... | from django.core.management.base import BaseCommand, CommandError
from control_milight.utils import process_automatic_trigger
import serial
import time
class Command(BaseCommand):
args = ''
help = 'Listen for 433MHz radio messages'
ITEM_MAP = {
"5236713": "kitchen",
"7697747": "hall",
... | bsd-3-clause | Python |
5d083a15a71aac24c3c4d29dd753067a93c62495 | Fix id builtin being overwritten | Encrylize/EasyEuler | EasyEuler/data.py | EasyEuler/data.py | import collections
import json
import os
from jinja2 import Environment, FileSystemLoader
from EasyEuler import paths
class ProblemList(collections.Sequence):
def __init__(self, problems):
self._problems = problems
def get(self, problem_id):
if problem_id < 1 or len(self) < problem_id:
... | import collections
import json
import os
from jinja2 import Environment, FileSystemLoader
from EasyEuler import paths
class ProblemList(collections.Sequence):
def __init__(self, problems):
self._problems = problems
def get(self, id):
if id < 1 or len(self) < id:
# We don't want ... | mit | Python |
444b9b9d134e55378dd780e0093a5c2a27a95a09 | Expand authors + manifest cleaning | OCA/bank-payment,OCA/bank-payment | account_payment_partner/__openerp__.py | account_payment_partner/__openerp__.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# Account Payment Partner module for OpenERP
# Copyright (C) 2014 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can... | # -*- encoding: utf-8 -*-
##############################################################################
#
# Account Payment Partner module for OpenERP
# Copyright (C) 2014 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: you can... | agpl-3.0 | Python |
483a66a693fd119192c12ee63c56a1da406fa3ca | fix templates path | arturtamborski/wypok,arturtamborski/wypok,arturtamborski/wypok,arturtamborski/wypok | accounts/views.py | accounts/views.py | from django.shortcuts import render
from django.urls import reverse
def profile(response, profile):
return render(response, 'account/profile.html')
| from django.shortcuts import render
from django.urls import reverse
def profile(response, profile):
return render(response, 'accounts/profile.html')
| mit | Python |
da9bab1d15d3f54d2ac65701e533b9bc34ebfea5 | remove test skip | cupy/cupy,cupy/cupy,cupy/cupy,cupy/cupy | tests/cupy_tests/array_api_tests/test_sorting_functions.py | tests/cupy_tests/array_api_tests/test_sorting_functions.py | import pytest
from cupy import array_api as xp
@pytest.mark.parametrize(
"obj, axis, expected",
[
([0, 0], -1, [0, 1]),
([0, 1, 0], -1, [1, 0, 2]),
([[0, 1], [1, 1]], 0, [[1, 0], [0, 1]]),
([[0, 1], [1, 1]], 1, [[1, 0], [0, 1]]),
],
)
def test_stable_desc_argsort(obj, axis... | import pytest
from cupy import array_api as xp
@pytest.mark.parametrize(
"obj, axis, expected",
[
([0, 0], -1, [0, 1]),
([0, 1, 0], -1, [1, 0, 2]),
([[0, 1], [1, 1]], 0, [[1, 0], [0, 1]]),
([[0, 1], [1, 1]], 1, [[1, 0], [0, 1]]),
],
)
@pytest.mark.skipif(
# https://git... | mit | Python |
6231afb51f5653e210f41d47c66797c4bd4d738d | Make it possible for the user to change username | christophmeissner/volunteer_planner,pitpalme/volunteer_planner,christophmeissner/volunteer_planner,coders4help/volunteer_planner,alper/volunteer_planner,alper/volunteer_planner,alper/volunteer_planner,coders4help/volunteer_planner,klinger/volunteer_planner,pitpalme/volunteer_planner,christophmeissner/volunteer_planner,... | accounts/views.py | accounts/views.py | # coding: utf-8
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.views.generic.edit import UpdateView
from django.core.urlresolvers import reverse_lazy
from volunteer_planner.utils import LoginRequiredMixin
@login_required()
def user_account_detail(request):
... | # coding: utf-8
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.views.generic.edit import UpdateView
from django.core.urlresolvers import reverse_lazy
from volunteer_planner.utils import LoginRequiredMixin
@login_required()
def user_account_detail(request):
... | agpl-3.0 | Python |
0bb558351a58caaca61eb381cc9a3a4ee4b881bb | format code | tomi77/bizzfuzz,tomi77/bizzfuzz | accounts/views.py | accounts/views.py | from django.shortcuts import render, redirect
from accounts.models import UserProfile
def index(request):
users = UserProfile.objects.all()
message = request.session.get('message', None)
info = request.session.get('info', None)
warning = request.session.get('warning', None)
alert = request.sessi... | from django.shortcuts import render, redirect
from accounts.models import UserProfile
def index(request):
users = UserProfile.objects.all()
message = request.session.get('message', None)
info = request.session.get('info', None)
warning = request.session.get('warning', None)
alert = request.sessio... | mit | Python |
7c75da48d6746fc148a79051338c3cd554d75615 | Change variable name to next for logout function | openstax/openstax-cms,Connexions/openstax-cms,openstax/openstax-cms,openstax/openstax-cms,Connexions/openstax-cms,openstax/openstax-cms | accounts/views.py | accounts/views.py | from django.shortcuts import redirect
from django.contrib.auth import logout as auth_logout
from django.conf import settings
def logout(request):
"""Logs out user redirects if in request"""
next = request.GET.get('next', '')
auth_logout(request)
if next:
return redirect('{}/?next={}'.format(s... | from django.shortcuts import redirect
from django.contrib.auth import logout as auth_logout
from django.conf import settings
def logout(request):
"""Logs out user redirects if in request"""
r = request.GET.get('r', '')
auth_logout(request)
if r:
return redirect('{}/?r={}'.format(settings.OPEN... | agpl-3.0 | Python |
f57326e5f5c7d64d6f7d5f204bcf388de897d5b0 | Revise palindrome function names | bowen0701/algorithms_data_structures | alg_palindrome.py | alg_palindrome.py | """Palindrome: a string that read the same forward and backward.
For example: radar, madam.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
def palindrome(a_str):
"""Check palindrom by front & rear match by Deque."""
from ds_deque import Deque... | """Palindrome: a string that read the same forward and backward.
For example: radar, madam.
"""
from __future__ import print_function
def match_palindrome(a_str):
"""Check palindrom by front & rear match by Deque."""
from ds_deque import Deque
str_deque = Deque()
for s in a_str:
str_deque.... | bsd-2-clause | Python |
4f2fb3ac84216096411a5b6583e4fbb22c8e5196 | bump dev version | cggh/scikit-allel | allel/__init__.py | allel/__init__.py | # -*- coding: utf-8 -*-
# flake8: noqa
from allel import model
from allel import stats
from allel import plot
from allel import io
from allel import chunked
from allel import constants
from allel import util
# convenient shortcuts
from allel.model.ndarray import *
from allel.model.chunked import *
# experimental
tr... | # -*- coding: utf-8 -*-
# flake8: noqa
from allel import model
from allel import stats
from allel import plot
from allel import io
from allel import chunked
from allel import constants
from allel import util
# convenient shortcuts
from allel.model.ndarray import *
from allel.model.chunked import *
# experimental
tr... | mit | Python |
709f807368ea7915bc5c2f7d6236b3a24df92c8c | Simplify script for recorded ctrl message injection | ynsta/steamcontroller,ynsta/steamcontroller,oneru/steamcontroller,oneru/steamcontroller | scripts/sc-test-cmsg.py | scripts/sc-test-cmsg.py | #!/usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) 2015 Stany MARCEL <stanypub@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including withou... | #!/usr/bin/env python
# The MIT License (MIT)
#
# Copyright (c) 2015 Stany MARCEL <stanypub@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including withou... | mit | Python |
6cbec939130ba8e17969e8d13b35765f9683b692 | add exception 2017/06/06 | maxis1314/pyutils,maxis1314/pyutils,maxis1314/pyutils | crawler/tools/MysqlBase.py | crawler/tools/MysqlBase.py | #-*- encoding:UTF-8 -*-
import urllib2
import re
import StringIO
import gzip
import logging
import sqlite3
import logutils
import urllib
import sys
import MySQLdb
reload(sys)
sys.setdefaultencoding('utf8')
class MysqlBase:
def __init__(self,dbname):
self.conn=None
self.reconn=False
self.d... | #-*- encoding:UTF-8 -*-
import urllib2
import re
import StringIO
import gzip
import logging
import sqlite3
import logutils
import urllib
import sys
import MySQLdb
reload(sys)
sys.setdefaultencoding('utf8')
class MysqlBase:
def __init__(self,dbname):
self.conn=None
self.reconn=False
self.d... | apache-2.0 | Python |
1ceef7205121141cf3c01826a1bb5d01013e74db | clean cruft | mattvonrocketstein/ymir,mattvonrocketstein/ymir,mattvonrocketstein/ymir,mattvonrocketstein/ymir | ymir/data.py | ymir/data.py | # -*- coding: utf-8 -*-
""" ymir.data
"""
from fabric.colors import green
STATUS_DEAD = ['terminated', 'shutting-down']
OK = green(' ok')
| # -*- coding: utf-8 -*-
""" ymir.data
"""
from fabric.colors import green
DEFAULT_SUPERVISOR_PORT = 9001 # supervisor WUI port
STATUS_DEAD = ['terminated', 'shutting-down']
OK = green(' ok')
| mit | Python |
20c61a39b0f2bc35eabc41f519732e2706c6f59c | test domain is uuid | dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq,dimagi/commcare-hq | corehq/apps/data_dictionary/tests/test_util.py | corehq/apps/data_dictionary/tests/test_util.py | import uuid
from django.test import TestCase
from mock import patch
from corehq.apps.data_dictionary.models import CaseType, CaseProperty
from corehq.apps.data_dictionary.util import generate_data_dictionary
class GenerateDictionaryTest(TestCase):
domain = uuid.uuid4()
def tearDown(self):
CaseType.... | from django.test import TestCase
from mock import patch
from corehq.apps.data_dictionary.models import CaseType, CaseProperty
from corehq.apps.data_dictionary.util import generate_data_dictionary
class GenerateDictionaryTest(TestCase):
domain = 'data-dictionary'
def tearDown(self):
CaseType.objects.... | bsd-3-clause | Python |
1ade506f5408cbbe099bb83bd701472137470618 | Add extra version of py-contextlib2 (#15322) | LLNL/spack,iulian787/spack,iulian787/spack,LLNL/spack,iulian787/spack,iulian787/spack,iulian787/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/py-contextlib2/package.py | var/spack/repos/builtin/packages/py-contextlib2/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)
from spack import *
class PyContextlib2(PythonPackage):
"""contextlib2 is a backport of the standard library's cont... | # 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 PyContextlib2(PythonPackage):
"""contextlib2 is a backport of the standard library's cont... | lgpl-2.1 | Python |
71615632defe37681d1257912ea03f6e1cdeffde | add v1.1-3 (#20923) | LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack,LLNL/spack | var/spack/repos/builtin/packages/r-fitdistrplus/package.py | var/spack/repos/builtin/packages/r-fitdistrplus/package.py | # Copyright 2013-2021 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 RFitdistrplus(RPackage):
"""Help to Fit of a Parametric Distribution to Non-Censored or Ce... | # Copyright 2013-2021 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 RFitdistrplus(RPackage):
"""Extends the fitdistr() function (of the MASS package) with sev... | lgpl-2.1 | Python |
7ac27aa4d365d02d998c3f4c82bc740791a1b515 | Update script.py | TingPing/plugins,TingPing/plugins | HexChat/script.py | HexChat/script.py | from __future__ import print_function
import os
import sys
if sys.version_info[0] < 3:
import urllib as request
else:
import urllib.request as request
import hexchat
__module_name__ = 'Script'
__module_author__ = 'TingPing'
__module_version__ = '3'
__module_description__ = 'Download scripts'
script_help = 'Script: ... | from __future__ import print_function
import os
import sys
if sys.version_info[0] < 3:
import urllib as request
else:
import urllib.request as request
import hexchat
__module_name__ = 'Script'
__module_author__ = 'TingPing'
__module_version__ = '3'
__module_description__ = 'Download scripts'
script_help = 'Script: ... | mit | Python |
6a899eeb5be7a8b49b45ff0fc0f490a5cad151bd | Add SourceGroup model | ambitioninc/django-entity-event,ambitioninc/django-entity-event | entity_event/models.py | entity_event/models.py | from django.db import models
class Medium(models.Model):
name = models.CharField(max_length=64, unique=True)
display_name = models.CharField(max_length=64)
description = models.TextField()
def __unicode__(self):
return self.display_name
class Source(models.Model):
name = models.CharFiel... | from django.db import models
class Medium(models.Model):
name = models.CharField(max_length=64, unique=True)
display_name = models.CharField(max_length=64)
description = models.TextField()
def __unicode__(self):
return self.display_name
class Source(models.Model):
name = models.CharFiel... | mit | Python |
fe4c426fe6384b570bcc2a105bdf04f2f412a31f | Use Query.executQuery for filterCasts.py | mgalbier/Envision,dimitar-asenov/Envision,dimitar-asenov/Envision,mgalbier/Envision,dimitar-asenov/Envision,lukedirtwalker/Envision,Vaishal-shah/Envision,mgalbier/Envision,Vaishal-shah/Envision,dimitar-asenov/Envision,Vaishal-shah/Envision,Vaishal-shah/Envision,lukedirtwalker/Envision,mgalbier/Envision,Vaishal-shah/Env... | InformationScripting/scripts/filterCasts.py | InformationScripting/scripts/filterCasts.py | # filterCasts
classUses = Query.executeQuery('ast -t=CastExpression|attribute -at=castType -input|uses -input -t=Class', [])
def hasTypeIdMethod( cl ):
for method in cl.methods:
if method.name == "typeIdStatic":
return True
return False
for tuple in classUses[0].tuples("uses"):
if has... | # filterCasts
casts = Query.ast(["-t=CastExpression"] + Query.args, [])
castTypeAttributes = Query.attribute(["-at=castType", "-s=of"], casts)
classUses = Query.uses(["-s=of", "-t=Class"], castTypeAttributes)
def hasTypeIdMethod( cl ):
for method in cl.methods:
if method.name == "typeIdStatic":
... | bsd-3-clause | Python |
f5c94105f6652186e05ebe201f127a1c8b7bd94c | add script to download and save articles | fhamborg/news-please,fhamborg/news-please | newsplease/tests/downloadarticles.py | newsplease/tests/downloadarticles.py | import json
import os
name = 'trump-in-saudi-arabia.txt'
basepath = '/Users/felix/Downloads/'
download_dir = basepath + 'dir' + name + '/'
os.makedirs(download_dir)
articles = NewsPlease.download_from_file(basepath + name)
for url in articles:
article = articles[url]
with open(download_dir + article['filena... | import json
import os
name = 'trump-in-saudi-arabia.txt'
basepath = '/Users/felix/Downloads/'
download_dir = basepath + 'dir' + name + '/'
os.makedirs(download_dir)
articles = NewsPlease.download_from_file(basepath + name)
for url in articles:
article = articles[url]
with open(download_dir + article['filena... | apache-2.0 | Python |
f6686169cf7344e0c75c6d060332d3692fc7df1c | Update curation table format | EBIvariation/eva-cttv-pipeline | bin/trait_mapping/create_table_for_manual_curation.py | bin/trait_mapping/create_table_for_manual_curation.py | #!/usr/bin/env python3
import argparse
from eva_cttv_pipeline.trait_mapping.ols import (
get_ontology_label_from_ols, is_current_and_in_efo, is_in_efo,
)
def find_previous_mapping(trait_name, previous_mappings):
if trait_name not in previous_mappings:
return ''
uri = previous_mappings[trait_name... | #!/usr/bin/env python3
import argparse
from eva_cttv_pipeline.trait_mapping.ols import (
get_ontology_label_from_ols, is_current_and_in_efo, is_in_efo,
)
def find_previous_mapping(trait_name, previous_mappings):
if trait_name not in previous_mappings:
return ''
uri = previous_mappings[trait_name... | apache-2.0 | Python |
c5902af643d639ecefa756a0caaeeb58a7c6d151 | Update P4_textToExcel working solution | JoseALermaIII/python-tutorials,JoseALermaIII/python-tutorials | books/AutomateTheBoringStuffWithPython/Chapter12/PracticeProjects/P4_textToExcel.py | books/AutomateTheBoringStuffWithPython/Chapter12/PracticeProjects/P4_textToExcel.py | # Write a program to read in the contents of several text files (you can make
# the text files yourself) and insert those contents into a spreadsheet, with
# one line of text per row. The lines of the first text file will be in the
# cells of column A, the lines of the second text file will be in the cells of
# column ... | # Write a program to read in the contents of several text files (you can make
# the text files yourself) and insert those contents into a spreadsheet, with
# one line of text per row. The lines of the first text file will be in the
# cells of column A, the lines of the second text file will be in the cells of
# column ... | mit | Python |
7597497017053356cdfbebc38aa1468240df2e45 | fix the install to ./install requirements | rajpushkar83/cloudmesh,rajpushkar83/cloudmesh,rajpushkar83/cloudmesh,rajpushkar83/cloudmesh,rajpushkar83/cloudmesh,rajpushkar83/cloudmesh,rajpushkar83/cloudmesh | fabfile/build.py | fabfile/build.py | from fabric.api import task, local, execute
import clean
__all__ = ['sdist', 'install', 'sphinx']
@task
def sdist():
"""create the sdist"""
execute(clean.all)
local("python setup.py sdist --format=bztar,zip")
@task
def install():
"""install cloudmesh"""
local("./install requirements.txt")
loc... | from fabric.api import task, local, execute
import clean
__all__ = ['req', 'sdist', 'install', 'sphinx']
@task
def req():
"""install the requirements"""
local("pip install -r requirements.txt")
@task
def sdist():
"""create the sdist"""
execute(clean.all)
local("python setup.py sdist --format=bzta... | apache-2.0 | Python |
9646fb2b7f7f441c6630e04fa1e1af358f9c7d10 | Set version to 0.20 final | emory-libraries/eulexistdb,emory-libraries/eulexistdb,emory-libraries/eulexistdb | eulexistdb/__init__.py | eulexistdb/__init__.py | # file eulexistdb/__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 eulexistdb/__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 |
f633df6bb8e0e84699db2f47178f4b402ccc07a8 | Fix `OverflowError`. | ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/icekit-events,ic-labs/django-icekit,ic-labs/django-icekit,ic-labs/icekit-events,ic-labs/icekit-events | eventkit/utils/time.py | eventkit/utils/time.py | from datetime import datetime, timedelta
from timezone import timezone
ROUND_DOWN = 'ROUND_DOWN'
ROUND_NEAREST = 'ROUND_NEAREST'
ROUND_UP = 'ROUND_UP'
WEEKDAYS = {
'MON': 0,
'TUE': 1,
'WED': 2,
'THU': 3,
'FRI': 4,
'SAT': 5,
'SUN': 6,
}
MON = 'MON'
TUE = 'TUE'
WED = 'WED'
THU = 'THU'
FRI ... | from datetime import timedelta
from timezone import timezone
ROUND_DOWN = 'ROUND_DOWN'
ROUND_NEAREST = 'ROUND_NEAREST'
ROUND_UP = 'ROUND_UP'
WEEKDAYS = {
'MON': 0,
'TUE': 1,
'WED': 2,
'THU': 3,
'FRI': 4,
'SAT': 5,
'SUN': 6,
}
MON = 'MON'
TUE = 'TUE'
WED = 'WED'
THU = 'THU'
FRI = 'FRI'
SA... | mit | Python |
3b4de1be81c7951ca064ff46e1f3e1ed95436ae3 | fix XSS vulnerability | Zopieux/bootstrap-breadcrumbs,prymitive/bootstrap-breadcrumbs,prymitive/bootstrap-breadcrumbs,Zopieux/bootstrap-breadcrumbs | django_bootstrap_breadcrumbs/templatetags/django_bootstrap_breadcrumbs.py | django_bootstrap_breadcrumbs/templatetags/django_bootstrap_breadcrumbs.py | # -*- coding: utf-8 -*-
"""
:copyright: Copyright 2013 by Łukasz Mierzwa
:contact: l.mierzwa@gmail.com
"""
from inspect import ismethod
from django.core.urlresolvers import reverse, NoReverseMatch
from django.utils.html import escape
from django.utils.safestring import mark_safe
from django.utils.translation... | # -*- coding: utf-8 -*-
"""
:copyright: Copyright 2013 by Łukasz Mierzwa
:contact: l.mierzwa@gmail.com
"""
from inspect import ismethod
from django.core.urlresolvers import reverse, NoReverseMatch
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
from django.db.... | mit | Python |
41ea0dd8c48ef8a336422482e9bbd1911bb7e168 | Make that it works in 90% of the cases. 3:30. | janraasch/sublimetext-commitment,janraasch/sublimetext-commitment | Commitment.py | Commitment.py | import sublime
import sublime_plugin
import HTMLParser
from commit import Commitment
whatthecommit = 'http://whatthecommit.com/'
randomMessages = Commitment()
class CommitmentToClipboardCommand(sublime_plugin.WindowCommand):
def run(self):
commit = randomMessages.get()
message = HTMLParser.HTMLParser()... | import sublime
import sublime_plugin
from commit import Commitment
whatthecommit = 'http://whatthecommit.com/'
randomMessages = Commitment()
class CommitmentToClipboardCommand(sublime_plugin.WindowCommand):
def run(self):
commit = randomMessages.get()
message = commit.get('message', '')
message_ha... | mit | Python |
81c32c9bc0868f7ccd764d8432fd46ccb7e6a8ef | Use get instead | andela-sjames/paystack-python | paystackapi/tests/test_transfer.py | paystackapi/tests/test_transfer.py | import httpretty
from paystackapi.tests.base_test_case import BaseTestCase
from paystackapi.transfer import Transfer
class TestTransfer(BaseTestCase):
@httpretty.activate
def test_initiate(self):
"""Method defined to test transfer initiation."""
httpretty.register_uri(
httpretty.... | import httpretty
from paystackapi.tests.base_test_case import BaseTestCase
from paystackapi.transfer import Transfer
class TestTransfer(BaseTestCase):
@httpretty.activate
def test_initiate(self):
"""Method defined to test transfer initiation."""
httpretty.register_uri(
httpretty.... | mit | Python |
8fd65190a2a68a7afeab91b0a02c83309f72ccd6 | Add tests to gen_test for generator, seems to work | virtuald/greenado,virtuald/greenado | tests/test_testing.py | tests/test_testing.py |
import greenado
from greenado.testing import gen_test
from tornado.testing import AsyncTestCase
from tornado import gen
@gen.coroutine
def coroutine():
raise gen.Return(1234)
class GreenadoTests(AsyncTestCase):
@gen_test
def test_without_timeout1(self):
assert greenado.gyield(coroutine())... |
import greenado
from greenado.testing import gen_test
from tornado.testing import AsyncTestCase
from tornado import gen
@gen.coroutine
def coroutine():
raise gen.Return(1234)
class GreenadoTests(AsyncTestCase):
@gen_test
def test_without_timeout(self):
assert greenado.gyield(coroutine()) ... | apache-2.0 | Python |
0d313502b8b5d850109b48cde8d3dea2dae0d802 | Clean up __init__.py . | graingert/vcrpy,poussik/vcrpy,gwillem/vcrpy,yarikoptic/vcrpy,ByteInternet/vcrpy,kevin1024/vcrpy,aclevy/vcrpy,IvanMalison/vcrpy,poussik/vcrpy,ByteInternet/vcrpy,mgeisler/vcrpy,kevin1024/vcrpy,bcen/vcrpy,agriffis/vcrpy,graingert/vcrpy | vcr/__init__.py | vcr/__init__.py | import logging
from .config import VCR
# Set default logging handler to avoid "No handler found" warnings.
try: # Python 2.7+
from logging import NullHandler
except ImportError:
class NullHandler(logging.Handler):
def emit(self, record):
pass
logging.getLogger(__name__).addHandler(NullHa... | import logging
from .config import VCR
# Set default logging handler to avoid "No handler found" warnings.
import logging
try: # Python 2.7+
from logging import NullHandler
except ImportError:
class NullHandler(logging.Handler):
def emit(self, record):
pass
logging.getLogger(__name__).add... | mit | Python |
e353bae122c6e55da022d73c42d7eee09a558b44 | clean code | VisualDL/VisualDL,VisualDL/VisualDL,VisualDL/VisualDL,VisualDL/VisualDL,VisualDL/VisualDL | bin/visual_dl.py | bin/visual_dl.py | """ entry point of visual_dl
"""
import json
import os
import sys
from optparse import OptionParser
from flask import Flask, redirect
from flask import send_from_directory
from visualdl.log import logger
app = Flask(__name__, static_url_path="")
def option_parser():
"""
:return:
"""
parser = Optio... | """ entry point of visual_dl
"""
import json
import os
import sys
from optparse import OptionParser
from flask import Flask, redirect
from flask import send_from_directory
from visualdl.log import logger
app = Flask(__name__, static_url_path="")
def option_parser():
"""
:return:
"""
parser = Optio... | apache-2.0 | Python |
3c72aa1266f1008552a3979ac057251bf2f93053 | Bump tensorflow in /training/xgboost/structured/base (#212) | GoogleCloudPlatform/ai-platform-samples,GoogleCloudPlatform/ai-platform-samples | training/xgboost/structured/base/setup.py | training/xgboost/structured/base/setup.py | #!/usr/bin/env python
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | #!/usr/bin/env python
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 | Python |
2b850c2f20208e3813a6e85ccafbedf221bdbcbd | Speed up a test by mocking Ticket refreshing. | peplin/astral | astral/api/tests/test_ticket.py | astral/api/tests/test_ticket.py | from nose.tools import eq_, ok_
from tornado.httpclient import HTTPRequest
import json
import mockito
from astral.api.client import TicketsAPI
from astral.api.tests import BaseTest
from astral.models import Ticket, Stream, Node
from astral.models.tests.factories import TicketFactory
class TicketHandlerTest(BaseTest):... | from nose.tools import eq_, ok_
from tornado.httpclient import HTTPRequest
import json
from astral.api.tests import BaseTest
from astral.models import Ticket, Stream, Node
from astral.models.tests.factories import TicketFactory
class TicketHandlerTest(BaseTest):
def test_delete(self):
node = Node.me()
... | mit | Python |
0ec3bfbd91e6e967bb2baae0307e76aafbb5aa91 | Simplify the base types | blackjax-devs/blackjax | blackjax/base.py | blackjax/base.py | from typing import NamedTuple, Tuple
from typing_extensions import Protocol
from .types import PRNGKey, PyTree
Position = PyTree
State = NamedTuple
Info = NamedTuple
class InitFn(Protocol):
"""A `Callable` used to initialize the kernel state.
Sampling algorithms often need to carry over some informations ... | from typing import Callable, NamedTuple, Tuple
from typing_extensions import Protocol
from .types import PRNGKey, PyTree
Position = PyTree
State = NamedTuple
Info = NamedTuple
class InitFn(Protocol):
"""A `Callable` used to initialize the kernel state.
Sampling algorithms often need to carry over some inf... | apache-2.0 | Python |
f1b22cfcca8470a59a7bab261bbd2a46a7c2a2ed | Fix unicode issues at url translation | socib/django-socib-cms,socib/django-socib-cms | socib_cms/cmsutils/utils.py | socib_cms/cmsutils/utils.py | # coding: utf-8
import re
from django.core.urlresolvers import reverse
from django.conf import settings
def reverse_no_i18n(viewname, *args, **kwargs):
result = reverse(viewname, *args, **kwargs)
m = re.match(r'(/[^/]*)(/.*$)', result)
return m.groups()[1]
def change_url_language(url, language):
if ... | # coding: utf-8
import re
from django.core.urlresolvers import reverse
from django.conf import settings
def reverse_no_i18n(viewname, *args, **kwargs):
result = reverse(viewname, *args, **kwargs)
m = re.match(r'(/[^/]*)(/.*$)', result)
return m.groups()[1]
def change_url_language(url, language):
if ... | mit | Python |
19b77442ee3cc80d8c7eaee6bde6c87d6a9e9277 | Test a fix for the wheel test | saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt,saltstack/salt | tests/integration/modules/saltutil.py | tests/integration/modules/saltutil.py | # -*- coding: utf-8 -*-
'''
Integration tests for the saltutil module.
'''
# Import Python libs
from __future__ import absolute_import
import time
# Import Salt Testing libs
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import Salt libs
import integration
class SaltUtilModuleTest... | # -*- coding: utf-8 -*-
'''
Integration tests for the saltutil module.
'''
# Import Python libs
from __future__ import absolute_import
# Import Salt Testing libs
from salttesting.helpers import ensure_in_syspath
ensure_in_syspath('../../')
# Import Salt libs
import integration
class SaltUtilModuleTest(integration... | apache-2.0 | Python |
4338b097f97bb03be27c81a810a5fc652f842c8a | change cnab processor selection to method" | OCA/l10n-brazil,OCA/l10n-brazil,OCA/l10n-brazil | l10n_br_account_payment_brcobranca/models/account_payment_mode.py | l10n_br_account_payment_brcobranca/models/account_payment_mode.py | # Copyright (C) 2012-Today - KMEE (<http://kmee.com.br>).
# @author Luis Felipe Miléo - mileo@kmee.com.br
# @author Renato Lima - renato.lima@akretion.com.br
# Copyright (C) 2021-Today - Akretion (<http://www.akretion.com>).
# @author Magno Costa <magno.costa@akretion.com.br>
# License AGPL-3.0 or later (http://www.g... | # Copyright (C) 2012-Today - KMEE (<http://kmee.com.br>).
# @author Luis Felipe Miléo - mileo@kmee.com.br
# @author Renato Lima - renato.lima@akretion.com.br
# Copyright (C) 2021-Today - Akretion (<http://www.akretion.com>).
# @author Magno Costa <magno.costa@akretion.com.br>
# License AGPL-3.0 or later (http://www.g... | agpl-3.0 | Python |
0bbd10058ff58ca5160e74374c0b34f99c429ad8 | Update docstrings | choderalab/openpathsampling,dwhswenson/openpathsampling,openpathsampling/openpathsampling,choderalab/openpathsampling,dwhswenson/openpathsampling,choderalab/openpathsampling,openpathsampling/openpathsampling,openpathsampling/openpathsampling,dwhswenson/openpathsampling,openpathsampling/openpathsampling,dwhswenson/openp... | openpathsampling/high_level/part_in_b_tps.py | openpathsampling/high_level/part_in_b_tps.py | from openpathsampling.high_level.network import FixedLengthTPSNetwork
from openpathsampling.high_level.transition import FixedLengthTPSTransition
import openpathsampling as paths
class PartInBFixedLengthTPSTransition(FixedLengthTPSTransition):
"""Fixed length TPS transition accepting any frame in the final state.
... | from openpathsampling.high_level.network import FixedLengthTPSNetwork
from openpathsampling.high_level.transition import FixedLengthTPSTransition
import openpathsampling as paths
class PartInBFixedLengthTPSTransition(FixedLengthTPSTransition):
"""Fixed length TPS transition accepting any frame in the final state.
... | mit | Python |
5c0a19386894e36898a48e7f10f01008e284e0c9 | Update dependency bazelbuild/bazel to latest version | google/copybara,google/copybara,google/copybara | third_party/bazel.bzl | third_party/bazel.bzl | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | apache-2.0 | Python |
24f5afff6b8e65c633521189f4ac6bf4fbacbdb7 | Fix datapusher.wsgi to work with ckan-service-provider 0.0.2 | ESRC-CDRC/ckan-datapusher-service,governmentbg/ckan-datapusher,datawagovau/datapusher,tanmaythakur/datapusher,ckan/datapusher,OCHA-DAP/hdx-datapusher | deployment/datapusher.wsgi | deployment/datapusher.wsgi | import os
import sys
import hashlib
activate_this = os.path.join('/usr/lib/ckan/datapusher/bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
import ckanserviceprovider.web as web
import datapusher.jobs as jobs
os.environ['JOB_CONFIG'] = '/etc/ckan/datapusher_settings.py'
web.init()
applica... | import os
import sys
import hashlib
activate_this = os.path.join('/usr/lib/ckan/datapusher/bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
import ckanserviceprovider.web as web
import datapusher.jobs as jobs
os.environ['JOB_CONFIG'] = '/etc/ckan/datapusher_settings.py'
web.configure()
ap... | agpl-3.0 | Python |
efb420ddc6aa0052ecea6da84613da6e4cf1afc8 | Update Bazel to latest version | google/copybara,google/copybara,google/copybara | third_party/bazel.bzl | third_party/bazel.bzl | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | apache-2.0 | Python |
8959d982ddc810f9c226ce36884521cf979a61f1 | add destroy cb | cr33dog/pyxfce,cr33dog/pyxfce,cr33dog/pyxfce | gui/tests/testicontheme.py | gui/tests/testicontheme.py | #!/usr/bin/env python
# doesnt work. segfault.
# TODO: other screens?
import pygtk
pygtk.require("2.0")
import gtk
import xfce4
widget = xfce4.gui.IconTheme(gtk.gdk.screen_get_default())
ic = widget.load("folder", 24)
print ic
icname = widget.lookup("folder", 24)
print icname
image = gtk.Image()
image.set_from_pixbuf... | #!/usr/bin/env python
# doesnt work. segfault.
# TODO: other screens?
import pygtk
pygtk.require("2.0")
import gtk
import xfce4
widget = xfce4.gui.IconTheme(gtk.gdk.screen_get_default())
ic = widget.load("folder", 24)
print ic
icname = widget.lookup("folder", 24)
print icname
image = gtk.Image()
image.set_from_pixbuf... | bsd-3-clause | Python |
23c8044b84557dea940d527213022bfa19d28293 | test that Human is in Ensembl species | Proteogenomics/trackhub-creator,Proteogenomics/trackhub-creator | tests/test_ensembl_species_service.py | tests/test_ensembl_species_service.py | #
# Author : Manuel Bernal Llinares
# Project : trackhub-creator
# Timestamp : 04-07-2017 09:14
# ---
# © 2017 Manuel Bernal Llinares <mbdebian@gmail.com>
# All rights reserved.
#
"""
Unit Tests for Ensembl Species Service
"""
import unittest
# App modules
import ensembl.service
class TestEnsemblSpeciesServi... | #
# Author : Manuel Bernal Llinares
# Project : trackhub-creator
# Timestamp : 04-07-2017 09:14
# ---
# © 2017 Manuel Bernal Llinares <mbdebian@gmail.com>
# All rights reserved.
#
"""
Unit Tests for Ensembl Species Service
"""
import unittest
# App modules
import ensembl.service
class TestEnsemblSpeciesServi... | apache-2.0 | Python |
d977a9ee9814264bd1d3080cadcd7e43b7c1d27e | Revert changes | Schevo/kiwi,Schevo/kiwi,Schevo/kiwi | examples/News/news2.py | examples/News/news2.py | #!/usr/bin/env python
from Kiwi2 import Delegates
from Kiwi2.Widgets.List import List, Column
from Kiwi2.initgtk import gtk
class NewsItem:
"""An instance that holds information about a news article."""
def __init__(self, title, author, url):
self.title, self.author, self.url = title, author, url
# As... | #!/usr/bin/env python
from Kiwi2 import Delegates
from Kiwi2.Widgets.List import List, Column
from Kiwi2.initgtk import gtk
class NewsItem:
"""An instance that holds information about a news article."""
def __init__(self, title, author, url):
self.title, self.author, self.url = title, author, url
# As... | lgpl-2.1 | Python |
7c91d556220088ea5286611f3674aaa88f3a6340 | Add failing test for "Crash if session was flushed before commit (with validity strategy)" | kvesteri/sqlalchemy-continuum,rmoorman/sqlalchemy-continuum,piotr-dobrogost/sqlalchemy-continuum,avilaton/sqlalchemy-continuum | tests/test_exotic_operation_combos.py | tests/test_exotic_operation_combos.py | from six import PY3
from tests import TestCase
class TestExoticOperationCombos(TestCase):
def test_insert_deleted_object(self):
article = self.Article()
article.name = u'Some article'
article.content = u'Some content'
self.session.add(article)
self.session.commit()
... | from six import PY3
from tests import TestCase
class TestExoticOperationCombos(TestCase):
def test_insert_deleted_object(self):
article = self.Article()
article.name = u'Some article'
article.content = u'Some content'
self.session.add(article)
self.session.commit()
... | bsd-3-clause | Python |
e816b1f63c299141c6ad907c860d2c5411829405 | Simplify aggregator code | alephdata/aleph,alephdata/aleph,pudo/aleph,pudo/aleph,pudo/aleph,alephdata/aleph,alephdata/aleph,alephdata/aleph | aleph/analysis/aggregate.py | aleph/analysis/aggregate.py | import logging
from collections import defaultdict
from followthemoney.types import registry
from aleph.analysis.util import tag_key
from aleph.analysis.util import TAG_COUNTRY, TAG_PHONE
from aleph.analysis.util import TAG_PERSON, TAG_COMPANY
log = logging.getLogger(__name__)
class TagAggregator(object):
MAX_T... | import logging
from Levenshtein import setmedian
from aleph.analysis.util import tag_key
from aleph.analysis.util import TAG_COUNTRY, TAG_LANGUAGE, TAG_PHONE
from aleph.analysis.util import TAG_PERSON, TAG_COMPANY
log = logging.getLogger(__name__)
class TagAggregator(object):
MAX_TAGS = 10000
CUTOFFS = {
... | mit | Python |
ca06a55d096eb4c67bf70c479107128b73087ab9 | integrate update | cyruscyliu/diffentropy | w1_integrate.py | w1_integrate.py | from sympy import integrate, symbols, log
# if 0 <= x < 0.25:
# return float(0)
# elif 0.25 <= x < 0.5:
# return 16.0 * (x - 0.25)
# elif 0.5 <= x < 0.75:
# return -16.0 * (x - 0.75)
# elif 0.75 < x <= 1:
# return float(0)
# h(f) = integrate(-f(x)lnf(x), (x, 0, 1))
x = symbols('x')
left =... | from sympy import integrate, symbols, log
# if 0 <= x < 0.25:
# return float(0)
# elif 0.25 <= x < 0.5:
# return 16.0 * (x - 0.25)
# elif 0.5 <= x < 0.75:
# return -16.0 * (x - 0.75)
# elif 0.75 < x <= 1:
# return float(0)
# h(f) = integrate(-f(x)lnf(x), (x, 0, 1))
x = symbols('x')
left = integrate(-1... | mit | Python |
f2bcbddab48eff06df78faff1ebb47c28adb4e0d | fix schema test | altair-viz/altair,jakevdp/altair,ellisonbg/altair | altair/tests/test_schema.py | altair/tests/test_schema.py | from altair.schema import load_schema
def test_schema():
schema = load_schema()
assert schema["$schema"]=="http://json-schema.org/draft-04/schema#"
| from altair.schema import SCHEMA
def test_schema():
assert SCHEMA["$schema"]=="http://json-schema.org/draft-04/schema#"
| bsd-3-clause | Python |
48f4c8dba40cb2fe03a74a7a4d7d979892601ddc | use __file__ to determine library path | avihoo/samplemod,azafred/skeletor,azafred/samplemod,Cyclid/example-python-project,introini/ourlist,introini/ourlist,johicks/twitterbias,introini/ourlist,introini/ourlist,tilt-silvie/samplemod,azafred/samplemod,azafred/skeletor,kennethreitz/samplemod | tests/context.py | tests/context.py | # -*- coding: utf-8 -*-
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import sample
| # -*- coding: utf-8 -*-
import sys
import os
sys.path.insert(0, os.path.abspath('..'))
import sample | bsd-2-clause | Python |
3c3013b8e7de5e1f8ae57e1d4a8b672cab8f6c47 | Test helpers : Message box, click yes vs enter | ucoin-io/cutecoin,ucoin-io/cutecoin,ucoin-io/cutecoin | tests/helpers.py | tests/helpers.py | from PyQt5.QtWidgets import QApplication, QMessageBox, QDialog, QFileDialog
from PyQt5.QtCore import Qt
from PyQt5.QtTest import QTest
def click_on_top_message_box():
topWidgets = QApplication.topLevelWidgets()
for w in topWidgets:
if isinstance(w, QMessageBox):
QTest.mouseClick(w.button(Q... | from PyQt5.QtWidgets import QApplication, QMessageBox, QDialog, QFileDialog
from PyQt5.QtCore import Qt
from PyQt5.QtTest import QTest
def click_on_top_message_box():
topWidgets = QApplication.topLevelWidgets()
for w in topWidgets:
if isinstance(w, QMessageBox):
QTest.keyClick(w, Qt.Key_En... | mit | Python |
1ab939ed7da45e7f6ff113b7e71017b28ee877a2 | Use 'with' keyword while opening file in tests/helpers.py | razorpay/razorpay-python | tests/helpers.py | tests/helpers.py | import razorpay
import os
import unittest
def mock_file(filename):
if not filename:
return ''
file_dir = os.path.dirname(__file__)
file_path = "{}/mocks/{}.json".format(file_dir, filename)
with open(file_path) as f:
mock_file_data = f.read()
return mock_file_data
class ClientTest... | import razorpay
import os
import unittest
def mock_file(filename):
if not filename:
return ''
file_dir = os.path.dirname(__file__)
file_path = "{}/mocks/{}.json".format(file_dir, filename)
return open(file_path).read()
class ClientTestCase(unittest.TestCase):
def setUp(self):
sel... | mit | Python |
9f069cf4fe634f34ccda29c18c03c63db04fe199 | Update Funcaptcha example | ad-m/python-anticaptcha | examples/funcaptcha.py | examples/funcaptcha.py | from urllib.parse import urlparse
import requests
from os import environ
import re
from random import choice
from python_anticaptcha import AnticaptchaClient, FunCaptchaTask
api_key = environ['KEY']
site_key_pattern = 'data-pkey="(.+?)"'
url = 'https://www.funcaptcha.com/demo/'
client = AnticaptchaClient(api_key)
se... | import requests
from os import environ
import re
from random import choice
from python_anticaptcha import AnticaptchaClient, FunCaptchaTask, Proxy
api_key = environ['KEY']
site_key_pattern = 'data-pkey="(.+?)"'
url = 'https://www.funcaptcha.com/demo/'
client = AnticaptchaClient(api_key)
session = requests.Session()
... | mit | Python |
d2fb1f22be6c6434873f2bcafb6b8a9b714acde9 | Use fail signal in fail_archive_on_error decorator | amyshi188/osf.io,caneruguz/osf.io,TomHeatwole/osf.io,SSJohns/osf.io,mluke93/osf.io,DanielSBrown/osf.io,Nesiehr/osf.io,jeffreyliu3230/osf.io,chrisseto/osf.io,acshi/osf.io,mattclark/osf.io,billyhunt/osf.io,caneruguz/osf.io,cosenal/osf.io,SSJohns/osf.io,njantrania/osf.io,mattclark/osf.io,alexschiller/osf.io,samchrisinger/... | website/archiver/decorators.py | website/archiver/decorators.py | import functools
from framework.exceptions import HTTPError
from website.project.decorators import _inject_nodes
from website.archiver import ARCHIVER_UNCAUGHT_ERROR
from website.archiver import signals
def fail_archive_on_error(func):
@functools.wraps(func)
def wrapped(*args, **kwargs):
try:
... | import functools
from framework.exceptions import HTTPError
from website.project.decorators import _inject_nodes
from website.archiver import ARCHIVER_UNCAUGHT_ERROR
from website.archiver import utils
def fail_archive_on_error(func):
@functools.wraps(func)
def wrapped(*args, **kwargs):
try:
... | apache-2.0 | Python |
3caa77b0f4b43e274eba21a8d759335f7833b99d | Change OSF_COOKIE_DOMAIN to None in local-dist.py | zachjanicki/osf.io,DanielSBrown/osf.io,DanielSBrown/osf.io,rdhyee/osf.io,TomBaxter/osf.io,adlius/osf.io,mfraezz/osf.io,danielneis/osf.io,cosenal/osf.io,jmcarp/osf.io,cwisecarver/osf.io,caseyrygt/osf.io,danielneis/osf.io,haoyuchen1992/osf.io,crcresearch/osf.io,brianjgeiger/osf.io,Johnetordoff/osf.io,icereval/osf.io,Nesi... | website/settings/local-dist.py | website/settings/local-dist.py | # -*- coding: utf-8 -*-
'''Example settings/local.py file.
These settings override what's in website/settings/defaults.py
NOTE: local.py will not be added to source control.
'''
from . import defaults
DEV_MODE = True
DEBUG_MODE = True # Sets app to debug mode, turns off template caching, etc.
SEARCH_ENGINE = 'elas... | # -*- coding: utf-8 -*-
'''Example settings/local.py file.
These settings override what's in website/settings/defaults.py
NOTE: local.py will not be added to source control.
'''
from . import defaults
DEV_MODE = True
DEBUG_MODE = True # Sets app to debug mode, turns off template caching, etc.
SEARCH_ENGINE = 'elas... | apache-2.0 | Python |
22ae3a2e9a236de61c078d234d920a3e6bc62d7b | Add a bit of docs | steffann/pylisp | pylisp/application/lispd/address_tree/ddt_container_node.py | pylisp/application/lispd/address_tree/ddt_container_node.py | '''
Created on 1 jun. 2013
@author: sander
'''
from .container_node import ContainerNode
class DDTContainerNode(ContainerNode):
'''
A ContainerNode that indicates that we are responsible for this part of
the DDT tree.
'''
| '''
Created on 1 jun. 2013
@author: sander
'''
from .container_node import ContainerNode
class DDTContainerNode(ContainerNode):
pass
| bsd-3-clause | Python |
8acaec546de0311f5f33c2e8fb9e1828a1cbc44b | Fix memory leak caused by using rabbit as the result backend for celery | felliott/scrapi,ostwald/scrapi,fabianvf/scrapi,mehanig/scrapi,erinspace/scrapi,mehanig/scrapi,jeffreyliu3230/scrapi,erinspace/scrapi,felliott/scrapi,CenterForOpenScience/scrapi,fabianvf/scrapi,icereval/scrapi,alexgarciac/scrapi,CenterForOpenScience/scrapi | worker_manager/celeryconfig.py | worker_manager/celeryconfig.py | """
Configuration file for celerybeat/worker.
Dynamically adds consumers from all manifest files in worker_manager/manifests/
to the celerybeat schedule. Also adds a heartbeat function to the schedule,
which adds every 30 seconds, and a monthly task to normalize all non-normalized
documents.
"""
f... | """
Configuration file for celerybeat/worker.
Dynamically adds consumers from all manifest files in worker_manager/manifests/
to the celerybeat schedule. Also adds a heartbeat function to the schedule,
which adds every 30 seconds, and a monthly task to normalize all non-normalized
documents.
"""
f... | apache-2.0 | Python |
16806f7a620ddaba727fc6c7d6387eaa1c17f103 | Update p4-test-tool.py | dbeyer/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,dbeyer/benchexec,dbeyer/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec,ultimate-pa/benchexec,dbeyer/benchexec,ultimate-pa/benchexec,sosy-lab/benchexec,ultimate-pa/benchexec | benchexec/tools/p4-test-tool.py | benchexec/tools/p4-test-tool.py | # This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0
import benchexec.util as util
import benchexec.tools.template
import benchexec.result as r... | # This file is part of BenchExec, a framework for reliable benchmarking:
# https://github.com/sosy-lab/benchexec
#
# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0
import benchexec.util as util
import benchexec.tools.template
import benchexec.result as r... | apache-2.0 | Python |
b9d30a39f31862af607af44e97878a287f9361c5 | bump to v0.5.3 | ValvePython/steam | steam/__init__.py | steam/__init__.py | __version__ = "0.5.3"
__author__ = "Rossen Georgiev"
from steam.steamid import SteamID
from steam.webapi import WebAPI
| __version__ = "0.5.2"
__author__ = "Rossen Georgiev"
from steam.steamid import SteamID
from steam.webapi import WebAPI
| mit | Python |
026ba5fa78cb9916bffc23cf7dda1d1deb81b24c | Bump version 1.0.3 | pyschool/story | story/__init__.py | story/__init__.py | """
Story - PySchool
"""
__author__ = 'PySchool'
__version__ = '1.0.3'
__licence__ = 'MIT'
| """
Story - PySchool
"""
__author__ = 'PySchool'
__version__ = '1.0.2'
__licence__ = 'MIT'
| mit | Python |
8d0e3ae1f80e8b19292b18a20a338cbfd00364c7 | Bump to version number 1.6.0 | cartoonist/pystream-protobuf | stream/release.py | stream/release.py | # coding=utf-8
"""
stream.release
~~~~~~~~~~~~~~
Include release information of the package.
:copyright: (c) 2016 by Ali Ghaffaari.
:license: MIT, see LICENSE for more details.
"""
# CONSTANTS ###################################################################
# Development statuses:
DS_PLANNING... | # coding=utf-8
"""
stream.release
~~~~~~~~~~~~~~
Include release information of the package.
:copyright: (c) 2016 by Ali Ghaffaari.
:license: MIT, see LICENSE for more details.
"""
# CONSTANTS ###################################################################
# Development statuses:
DS_PLANNING... | mit | Python |
c8069fff1941d0739bca8716a5e26f5c02ccffe3 | Add South field tuple. | playfire/django-enumfield | django_enumfield/fields.py | django_enumfield/fields.py | from django.db import models
class EnumField(models.Field):
__metaclass__ = models.SubfieldBase
def __init__(self, enumeration, *args, **kwargs):
self.enumeration = enumeration
kwargs.setdefault('choices', enumeration.get_choices())
super(EnumField, self).__init__(*args, **kwargs)
... | from django.db import models
class EnumField(models.Field):
__metaclass__ = models.SubfieldBase
def __init__(self, enumeration, *args, **kwargs):
self.enumeration = enumeration
kwargs.setdefault('choices', enumeration.get_choices())
super(EnumField, self).__init__(*args, **kwargs)
... | bsd-3-clause | Python |
2c73fee5b0a3a527d0ee3c51291c7b4c01c9f688 | Revert "Создание скрипта изменения группы" | HowAU/python-training | fixture/group.py | fixture/group.py | class GroupHelper:
def __init__(self, app):
self.app = app
def open_groups_page(self):
wd = self.app.wd
wd.find_element_by_link_text("groups").click()
def create(self, group):
wd = self.app.wd
self.open_groups_page()
# создание новой группы
wd.find_... | class GroupHelper:
def __init__(self, app):
self.app = app
def open_groups_page(self):
wd = self.app.wd
wd.find_element_by_link_text("groups").click()
def create(self, group):
wd = self.app.wd
self.open_groups_page()
# создание новой группы
wd.find_... | apache-2.0 | Python |
4e8177bca4335c34950adb54c0bca4bca59ef0c0 | fix error: has no attribute __subclass__ | zhoukaigo/Blog,zhoukaigo/Blog | app/auth/oauth.py | app/auth/oauth.py | from rauth import OAuth2Service
from flask import current_app, url_for, redirect, request, session
class OAuthSignIn(object):
providers = None
def __init__(self, provider_name):
self.provider_name = provider_name
credentials = current_app.config['OAUTH_CREDENTIALS'][provider_name]
self.consumer_id = credenti... | from rauth import OAuth2Service
from flask import current_app, url_for, redirect, request, session
class OAuthSignIn(object):
providers = None
def __init__(self, provider_name):
self.provider_name = provider_name
credentials = current_app.config['OAUTH_CREDENTIALS'][provider_name]
self.consumer_id = credenti... | mit | Python |
0781b47512cbab5fc1a090ff68b5f9d434a864af | Update examples/API_v2/lookup_users_using_user_ids.py | svven/tweepy,tweepy/tweepy | examples/API_v2/lookup_users_using_user_ids.py | examples/API_v2/lookup_users_using_user_ids.py | import tweepy
# Replace bearer token value with your own
bearer_token = ""
# Initializing the Tweepy client
client = tweepy.Client(bearer_token)
# Replace User IDs
ids = [2244994945, 6253282]
# By default the user ID, name and username are returned. user_fields can be
# used to specify the additional user data th... | import tweepy
# Replace bearer token value with your own
bearer_token = ""
# Initializing the Tweepy client
client = tweepy.Client(bearer_token)
# Replace User IDs
ids = [2244994945, 6253282]
# By default the user ID, name and username are returned. user_fields can be
# used to specify the additional user data th... | mit | Python |
54c81494cbbe9a20db50596e68c57e1caa624043 | Add a User post_save hook for creating user profiles | SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder,SanaMobile/sana.protocol_builder | src-django/authentication/signals/user_post_save.py | src-django/authentication/signals/user_post_save.py | from authentication.models import UserProfile
from django.contrib.auth.models import User, Group
from django.dispatch import receiver
from django.db.models.signals import post_save
from django.conf import settings
from rest_framework.authtoken.models import Token
@receiver(post_save, sender=User)
def on_user_post_sav... | from django.contrib.auth.models import User, Group
from django.dispatch import receiver
from django.db.models.signals import post_save
from django.conf import settings
from rest_framework.authtoken.models import Token
@receiver(post_save, sender=User)
def on_user_post_save(sender, instance=None, created=False, **kwar... | bsd-3-clause | Python |
9b678e184a568baea857ca68fcacb5070db6792d | update modulation.py | Koheron/lase | examples/modulation.py | examples/modulation.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import initExample
from lase.core import KClient
# Driver to use
from lase.drivers import Oscillo
# Modules to import
import numpy as np
import matplotlib.pyplot as plt
import time
# Connect to Lase
host = '192.168.1.4' # Lase IP address
client = KClient(host)
driver... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import initExample
from lase.core import KClient
# Driver to use
from lase.drivers import Oscillo
# Modules to import
import numpy as np
import matplotlib.pyplot as plt
import time
# Connect to Lase
host = '192.168.1.4' # Lase IP address
client = KClient(host)
drive... | mit | Python |
1014c809638157da85794223c4990b5ae20512fa | Add crawled_at field back | mdsrosa/hackernews_scrapy | hackernews_scrapy/items.py | hackernews_scrapy/items.py | # -*- coding: utf-8 -*-
import scrapy
class HackernewsScrapyItem(scrapy.Item):
title = scrapy.Field()
url = scrapy.Field()
crawled_at = scrapy.Field(serializer=str)
| # -*- coding: utf-8 -*-
import scrapy
class HackernewsScrapyItem(scrapy.Item):
title = scrapy.Field()
url = scrapy.Field()
| mit | Python |
d8cb4384f32f4d0e20f3212a36cc01915260f7a8 | Support custom actions in search router | genialis/resolwe-bio,genialis/resolwe-bio,genialis/resolwe-bio,genialis/resolwe-bio | tests/routers.py | tests/routers.py | """Search router."""
from rest_framework.routers import DefaultRouter, DynamicRoute, Route
class SearchRouter(DefaultRouter):
"""Custom router for search endpoints.
Search endpoints don't follow REST principles and thus don't need
routes that default router provides.
"""
routes = [
Route... | """Search router."""
from rest_framework.routers import DefaultRouter, Route
class SearchRouter(DefaultRouter):
"""Custom router for search endpoints.
Search endpoints don't follow REST principles and thus don't need
routes that default router provides.
"""
routes = [
Route(
... | apache-2.0 | Python |
43922bb7cf5015cbf3538195d3d4f93ff8c9ec18 | Bump version | TombProject/tomb_cli,tomborine/tomb_cli | tomb_cli/__about__.py | tomb_cli/__about__.py | __title__ = 'tomb_cli'
__summary__ = 'Top level CLI command for tomb'
__uri__ = 'http://github.com/tomborine/tomb_cli'
__version__ = '0.0.2'
__author__ = 'John Anderson'
__email__ = 'sontek@gmail.com'
__license__ = 'MIT'
__copyright__ = '2015 John Anderson (sontek)'
| __title__ = 'tomb_cli'
__summary__ = 'Top level CLI command for tomb'
__uri__ = 'http://github.com/tomborine/tomb_cli'
__version__ = '0.0.1'
__author__ = 'John Anderson'
__email__ = 'sontek@gmail.com'
__license__ = 'MIT'
__copyright__ = '2015 John Anderson (sontek)'
| mit | Python |
18f373ffc1e49b33708ae2303b61ccf76ffa686e | Use pylab.load to read in data. | matplotlib/basemap,guziy/basemap,matplotlib/basemap,guziy/basemap | examples/ortho_demo.py | examples/ortho_demo.py | from matplotlib.toolkits.basemap import Basemap
from pylab import *
# read in topo data from pickle (on a regular lat/lon grid)
etopo = array(load('etopo20data.gz'),'f')
lons = array(load('etopo20lons.gz'),'f')
lats = array(load('etopo20lats.gz'),'f')
# create Basemap instance for Orthographic (satellite view) projecti... | from matplotlib import rcParams, use
rcParams['numerix'] = 'Numeric' # make sure Numeric is used (to read pickle)
from matplotlib.toolkits.basemap import Basemap
import cPickle
from pylab import *
# read in topo data from pickle (on a regular lat/lon grid)
topodict = cPickle.load(open('etopo20.pickle','rb'))
etopo = t... | mit | Python |
2ab2927b2ee4f821fd75050da19a7f1f81aaeca8 | FIX divide mnist features by 255 in mlp example (#11961) | TomDLT/scikit-learn,scikit-learn/scikit-learn,vinayak-mehta/scikit-learn,xuewei4d/scikit-learn,chrsrds/scikit-learn,kevin-intel/scikit-learn,ivannz/scikit-learn,bnaul/scikit-learn,lesteve/scikit-learn,ogrisel/scikit-learn,chrsrds/scikit-learn,AlexandreAbraham/scikit-learn,sergeyf/scikit-learn,saiwing-yeung/scikit-learn... | examples/neural_networks/plot_mnist_filters.py | examples/neural_networks/plot_mnist_filters.py | """
=====================================
Visualization of MLP weights on MNIST
=====================================
Sometimes looking at the learned coefficients of a neural network can provide
insight into the learning behavior. For example if weights look unstructured,
maybe some were not used at all, or if very l... | """
=====================================
Visualization of MLP weights on MNIST
=====================================
Sometimes looking at the learned coefficients of a neural network can provide
insight into the learning behavior. For example if weights look unstructured,
maybe some were not used at all, or if very l... | bsd-3-clause | Python |
e41145a0812d43833d43abf335820c90628bbe62 | select all mail folder for crisping console | EthanBlackburn/sync-engine,EthanBlackburn/sync-engine,wakermahmud/sync-engine,jobscore/sync-engine,rmasters/inbox,PriviPK/privipk-sync-engine,jobscore/sync-engine,rmasters/inbox,gale320/sync-engine,nylas/sync-engine,EthanBlackburn/sync-engine,closeio/nylas,ErinCall/sync-engine,nylas/sync-engine,nylas/sync-engine,PriviP... | tools/crispinshell.py | tools/crispinshell.py | #!/usr/bin/env python
import sys, os; sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'server')))
import sessionmanager
import IPython
def start_console(user_email_address):
# You can also do this with
# $ python -m imapclient.interact -H <host> -u <user> ...
# but we want to... | #!/usr/bin/env python
import sys, os; sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'server')))
import sessionmanager
import IPython
def start_console(user_email_address):
# You can also do this with
# $ python -m imapclient.interact -H <host> -u <user> ...
# but we want to... | agpl-3.0 | Python |
45c67e0b9bc168549fdd1eb2cde3599aae921567 | Update base.py | raiderrobert/django-webhook | webhook/base.py | webhook/base.py | """
Base webhook implementation
"""
import json
from django.http import HttpResponse
from django.views.generic import View
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
class WebhookBase(View):
"""
Simple Webhook base class to handle the most stand... | """
Base webhook implementation
"""
import json
from django.http import HttpResponse
from django.views.generic import View
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
class WebhookBase(View):
"""
Simple Webhook base class to handle the most stand... | mit | Python |
a751e7f51412581e14cc822f1e443ed97746055a | Update structures example | stonebig/numba,seibert/numba,gmarkall/numba,jriehl/numba,ssarangi/numba,ssarangi/numba,pombredanne/numba,GaZ3ll3/numba,gdementen/numba,gmarkall/numba,pitrou/numba,gdementen/numba,stonebig/numba,sklam/numba,pitrou/numba,stuartarchibald/numba,jriehl/numba,IntelLabs/numba,pombredanne/numba,ssarangi/numba,cpcloud/numba,pom... | examples/structures.py | examples/structures.py | from numba import struct, jit, double
import numpy as np
record_type = struct([('x', double), ('y', double)])
record_dtype = record_type.get_dtype()
a = np.array([(1.0, 2.0), (3.0, 4.0)], dtype=record_dtype)
@jit(argtypes=[record_type[:]])
def hypot(data):
# return types of numpy functions are inferred
result... | from numba import struct, jit, double
import numpy as np
record_type = struct([('x', double), ('y', double)])
record_dtype = record_type.get_dtype()
a = np.array([(1.0, 2.0), (3.0, 4.0)], dtype=record_dtype)
@jit(argtypes=[record_type[:]])
def hypot(data):
# return types of numpy functions are inferred
result... | bsd-2-clause | Python |
f6045517b27bf6f878ab2906aa6b793cfd640786 | upgrade anymail | mcallistersean/b2-issue-tracker,mcallistersean/b2-issue-tracker,mcallistersean/b2-issue-tracker | toucan_conf/settings/prod/__init__.py | toucan_conf/settings/prod/__init__.py | import os
from .. import *
try:
from ..secrets import ALLOWED_HOSTS
except ImportError:
raise ImportError('Please set ALLOWED_HOSTS in the secrets file when using production config.')
try:
from ..secrets import ANYMAIL
except ImportError:
raise ImportError('Please set ANYMAIL settings in the secrets ... | import os
from .. import *
try:
from ..secrets import ALLOWED_HOSTS
except ImportError:
raise ImportError('Please set ALLOWED_HOSTS in the secrets file when using production config.')
try:
from ..secrets import ANYMAIL
except ImportError:
raise ImportError('Please set ANYMAIL settings in the secrets ... | mit | Python |
193d911536799751c9ec29571cb8091bcd187087 | fix uraseuranta py | CSCfi/antero,CSCfi/antero,CSCfi/antero,CSCfi/antero,CSCfi/antero,CSCfi/antero | pdi_integrations/arvo/python_scripts/get_arvo_uraseuranta.py | pdi_integrations/arvo/python_scripts/get_arvo_uraseuranta.py | #import json
import requests
#import os
from pandas.io.json import json_normalize
#import datetime
import base64
import os
try:
api_key = os.environ['AUTH_API_KEY']
except KeyError:
print("API-key is missing")
try:
api_user = os.environ['AUTH_API_USER']
except KeyError:
print("API-user is missing")
re... | #import json
import requests
#import os
from pandas.io.json import json_normalize
#import datetime
import os
try:
api_key = os.environ['AUTH_API_KEY']
except KeyError:
print("API-key missing")
result = []
good_result=[]
filtered_result=[]
urls = []
url = 'https://arvo.csc.fi/api/vipunen/uraseuranta'
reqhe... | mit | Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.