commit stringlengths 40 40 | subject stringlengths 1 1.49k | old_file stringlengths 4 311 | new_file stringlengths 4 311 | new_contents stringlengths 1 29.8k | old_contents stringlengths 0 9.9k | lang stringclasses 3
values | proba float64 0 1 |
|---|---|---|---|---|---|---|---|
f56dd27d3e94d15af6ca82e3e5a5c4fbaf34771d | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/d543fafbb8dfa546945c5eced829accec1b70b46. | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "d543fafbb8dfa546945c5eced829accec1b70b46"
TFRT_SHA256 = "370f57dc668b4a44b7a0caa6a078... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "8678704dfcf48b2a7039e56fde0e9bd58bce7828"
TFRT_SHA256 = "46cd465aab34eec5f21f1ff74607... | Python | 0.000001 |
4e0e42544237ce612d5ec3e4dc6a6a8ab8e58df2 | Update TFRT dependency to use revision http://github.com/tensorflow/runtime/commit/06855ca4832377a2bdc8fdb3200415a219906c02. | third_party/tf_runtime/workspace.bzl | third_party/tf_runtime/workspace.bzl | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "06855ca4832377a2bdc8fdb3200415a219906c02"
TFRT_SHA256 = "e0ca743f255e4f24e1a84b0fe60f... | """Provides the repository macro to import TFRT."""
load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls")
def repo():
"""Imports TFRT."""
# Attention: tools parse and update these lines.
TFRT_COMMIT = "f66f87bad3576356f286662b0f4a742ffed33c0d"
TFRT_SHA256 = "b35a52bcd37a7aca08b0446b96eb... | Python | 0 |
1143b5cf44ac9314cc160ea55e56a6d04dad8691 | Set daemon attribute instead of using setDaemon method that was deprecated in Python 3.10 | tests/test_threading.py | tests/test_threading.py | """Test that mq sends don't wedge their threads.
Starts a number of sender threads, and runs for a set amount of
time. Each thread sends messages as fast as it can, and after each
send, pops from a Queue. Meanwhile, the Queue is filled with one
marker per second. If the Queue fills, the test fails, as that
indicates t... | """Test that mq sends don't wedge their threads.
Starts a number of sender threads, and runs for a set amount of
time. Each thread sends messages as fast as it can, and after each
send, pops from a Queue. Meanwhile, the Queue is filled with one
marker per second. If the Queue fills, the test fails, as that
indicates t... | Python | 0 |
12e41349ceedfccc2dd1255bdd47208a07d6a7f6 | Refactor tests | tests/test_tictactoe.py | tests/test_tictactoe.py | import unittest
from games import TicTacToe
class TestTicTacToe(unittest.TestCase):
def setUp(self):
self.game = TicTacToe()
def test_copy(self):
self.game.make_moves([1, 3, 2])
clone = self.game.copy()
self.assertItemsEqual(self.game.legal_moves(), clone.legal_moves())
... | import unittest
from games import TicTacToe
class TestTicTacToe(unittest.TestCase):
def setUp(self):
self.game = TicTacToe()
def test_copy(self):
self.game.make_moves([1, 3, 2])
clone = self.game.copy()
self.assertItemsEqual(self.game.legal_moves(), clone.legal_moves())
... | Python | 0.000001 |
6fa685b1d2f93511aa76a2ff017636c271d91b01 | Add some more files to the exempt ones | tests/unit/perm_test.py | tests/unit/perm_test.py | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Mike Place <mp@saltstack.com`
Tests to ensure that the file permissions are set correctly when
importing from the git repo.
'''
# Import python libs
import os
import stat
import pprint
# Import salt testing libs
from salttesting import TestCase
from saltt... | # -*- coding: utf-8 -*-
'''
:codeauthor: :email:`Mike Place <mp@saltstack.com`
Tests to ensure that the file permissions are set correctly when
importing from the git repo.
'''
# Import python libs
import os
import stat
import pprint
# Import salt testing libs
from salttesting import TestCase
from saltt... | Python | 0 |
190b9ac1aa92c172b102ae7b0d6ff06b823c5a78 | add missing imports | FontNote.glyphsPalette/Contents/Resources/plugin.py | FontNote.glyphsPalette/Contents/Resources/plugin.py | # encoding: utf-8
#######################################################################################
#
# Palette Plugin
#
# Read the docs:
# https://github.com/schriftgestalt/GlyphsSDK/tree/master/Python%20Templates/Palette
#
#######################################################################################
... | # encoding: utf-8
#######################################################################################
#
# Palette Plugin
#
# Read the docs:
# https://github.com/schriftgestalt/GlyphsSDK/tree/master/Python%20Templates/Palette
#
#######################################################################################
... | Python | 0.000275 |
1759e2bec03935e33fe15950e0b5457a0001aaa5 | fix conflict | school/migrations/0005_studentapplication.py | school/migrations/0005_studentapplication.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import sortedm2m.fields
class Migration(migrations.Migration):
dependencies = [
('assets', '0001_initial'),
('people', '0002_updatefresnoyprofile'),
('school', '0004_rename_newstudent... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import sortedm2m.fields
class Migration(migrations.Migration):
dependencies = [
('assets', '0001_initial'),
('people', '0002_updatefresnoyprofile'),
('people', '0001_initial'),
... | Python | 0.031708 |
fbdaeff6f01ffaf0ac4f9a0d0d962a19c2865b32 | Add docstring documenting the intended use of LabHubApp. | jupyterlab/labhubapp.py | jupyterlab/labhubapp.py | import os
from traitlets import default
from .labapp import LabApp
try:
from jupyterhub.singleuser import SingleUserNotebookApp
except ImportError:
SingleUserLabApp = None
raise ImportError('You must have jupyterhub installed for this to work.')
else:
class SingleUserLabApp(SingleUserNotebookApp, Lab... | import os
import warnings
from traitlets import default
from .labapp import LabApp
try:
from jupyterhub.singleuser import SingleUserNotebookApp
except ImportError:
SingleUserLabApp = None
raise ImportError('You must have jupyterhub installed for this to work.')
else:
class SingleUserLabApp(SingleUser... | Python | 0 |
8cf24b479ca3602ac4471d29f90821c4edc56ad7 | Update CondenseLabel.py | histomicstk/segmentation/label/CondenseLabel.py | histomicstk/segmentation/label/CondenseLabel.py | import numpy as np
import scipy.ndimage.measurements as ms
def CondenseLabel(Label):
"""
Shifts labels in a label image to fill in gaps corresponding to missing
values.
Parameters
----------
Label : array_like
A label image generated by segmentation methods.
Returns
-------
... | import numpy as np
from skimage import measure as ms
def CondenseLabel(Label):
"""
Shifts labels in a label image to fill in gaps corresponding to missing
values.
Parameters
----------
Label : array_like
A label image generated by segmentation methods.
Returns
-------
Con... | Python | 0 |
ea08e0d62d6d652a53d39ca6b4d771edf5e3b719 | Set event data as dict in foursquare.checkin event (#63982) | homeassistant/components/foursquare/__init__.py | homeassistant/components/foursquare/__init__.py | """Support for the Foursquare (Swarm) API."""
from http import HTTPStatus
import logging
import requests
import voluptuous as vol
from homeassistant.components.http import HomeAssistantView
from homeassistant.const import CONF_ACCESS_TOKEN
from homeassistant.core import HomeAssistant, ServiceCall
import homeassistant... | """Support for the Foursquare (Swarm) API."""
from http import HTTPStatus
import logging
import requests
import voluptuous as vol
from homeassistant.components.http import HomeAssistantView
from homeassistant.const import CONF_ACCESS_TOKEN
from homeassistant.core import ServiceCall
import homeassistant.helpers.config... | Python | 0.000002 |
5e07bc38c1385e3dc8b02ff1da85831a73a1d287 | Use native date value in Twente Milieu sensors (#59897) | homeassistant/components/twentemilieu/sensor.py | homeassistant/components/twentemilieu/sensor.py | """Support for Twente Milieu sensors."""
from __future__ import annotations
from dataclasses import dataclass
from datetime import date
from twentemilieu import WasteType
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
from homeassistant.config_entries import ConfigEntry
from homeas... | """Support for Twente Milieu sensors."""
from __future__ import annotations
from dataclasses import dataclass
from datetime import date
from twentemilieu import WasteType
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
from homeassistant.config_entries import ConfigEntry
from homeas... | Python | 0 |
87f1f5c5198ae8511c7936130f27b0361c5b3187 | Update logging.py | src/logging.py | src/logging.py | import logging
class logger(object):
def info(self, message):
logging.info("[INFO] "+message)
def warning(self, message):
logging.warning("[WARNING] "+message)
def error(self, message):
logging.error("[ERROR] "+message)
def debug(self, message):
logging.debug("[DEBUG] "+message)
def critical(self,... | import logging
class logger:
def info(message):
logging.info("[INFO] "+message)
def warning(message):
logging.warning("[WARNING] "+message)
def error(message):
logging.error("[ERROR] "+message)
def debug(message):
logging.debug("[DEBUG] "+message)
def critical(message)
logging.critical("[CRITICA... | Python | 0.000001 |
de9f9c07c6f1dde8d7ad314b6a6fb58a963e1558 | Return as many results as possible | geodj/youtube.py | geodj/youtube.py | from gdata.youtube.service import YouTubeService, YouTubeVideoQuery
from django.utils.encoding import smart_str
import re
class YoutubeMusic:
def __init__(self):
self.service = YouTubeService()
def search(self, artist):
query = YouTubeVideoQuery()
query.vq = artist
query.orderb... | from gdata.youtube.service import YouTubeService, YouTubeVideoQuery
from django.utils.encoding import smart_str
import re
class YoutubeMusic:
def __init__(self):
self.service = YouTubeService()
def search(self, artist):
query = YouTubeVideoQuery()
query.vq = artist
query.orderb... | Python | 0.006012 |
3eb9891b4671900b90a400c0b18513c2964d22fe | Add check to detect if a buildbot slave is running. | scripts/tools/swarm_bootstrap/start_slave.py | scripts/tools/swarm_bootstrap/start_slave.py | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Returns a swarming bot dimensions and setups automatic startup if needed.
This file is uploaded the swarming server so the swarming bots can declare thei... | # Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Returns a swarming bot dimensions and setups automatic startup if needed.
This file is uploaded the swarming server so the swarming bots can declare thei... | Python | 0.000119 |
498be7a6d3700322aa470a00791a8b0be849cf0c | Fix shebang declaration. | getMesosStats.py | getMesosStats.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
import json
import argparse
def get_metric(host, port, metric):
response = urllib2.urlopen(
'http://' + host + ':' + port + '/metrics/snapshot')
data = json.load(response)
# print json.dumps(data, indent=4, sort_keys=Tru... | #!/usr/bin/python
# -*- coding: utf-8 -*-
import urllib2
import json
import argparse
def get_metric(host, port, metric):
response = urllib2.urlopen(
'http://' + host + ':' + port + '/metrics/snapshot')
data = json.load(response)
# print json.dumps(data, indent=4, sort_keys=True)
... | Python | 0.000002 |
c49cf131ddb16157ea1a1663eef63133efe0068d | Implement read operations for queue.file | tilequeue/queue/file.py | tilequeue/queue/file.py | from tilequeue.tile import serialize_coord
class OutputFileQueue(object):
def __init__(self, fp):
self.fp = fp
def enqueue(self, coord):
payload = serialize_coord(coord)
self.fp.write(payload + '\n')
def enqueue_batch(self, coords):
n = 0
for coord in coords:
... | from tilequeue.tile import serialize_coord
class OutputFileQueue(object):
def __init__(self, fp):
self.fp = fp
def enqueue(self, coord):
payload = serialize_coord(coord)
self.fp.write(payload + '\n')
def enqueue_batch(self, coords):
n = 0
for coord in coords:
... | Python | 0 |
5418907b13d6a00190cd85c5b9b73d4053be34ed | Add licence | src/compose.py | src/compose.py | #!/usr/bin/env python
# encoding: utf-8
#
# Copyright © 2013 deanishe@deanishe.net.
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2013-11-01
#
"""
Compose new email to specified recipients (if any) in selected client.
Client is selected using mailto.py
"""
from __future__ import print_functi... | #!/usr/bin/env python
# encoding: utf-8
"""
Compose new email to specified recipients (if any) in selected client.
Client is selected using mailto.py
"""
from __future__ import print_function
import sys
import os
from subprocess import check_call
import alfred
from mailto import MailApps
from contacts import get_c... | Python | 0.000001 |
d8b163a58941b130ba9903ab26463716d52eeaa0 | Fix running on patchlevel versions below the highest of that minor version | java/kotlin-extractor/kotlin_plugin_versions.py | java/kotlin-extractor/kotlin_plugin_versions.py | import platform
import re
import subprocess
import sys
def is_windows():
'''Whether we appear to be running on Windows'''
if platform.system() == 'Windows':
return True
if platform.system().startswith('CYGWIN'):
return True
return False
many_versions = [ '1.4.32', '1.5.31', '1.6.10', '... | import platform
import re
import subprocess
import sys
def is_windows():
'''Whether we appear to be running on Windows'''
if platform.system() == 'Windows':
return True
if platform.system().startswith('CYGWIN'):
return True
return False
many_versions = [ '1.4.32', '1.5.31', '1.6.10', '... | Python | 0 |
39a9131a0d0ce1d59c970b089acc1da4af006b2b | bump version number | taggy/__init__.py | taggy/__init__.py | __version__ = "0.2.1"
| __version__ = "0.2.0"
| Python | 0.000004 |
1aae9ef692f5b2808b02a628c02ff21ba89cc8ab | fix playing track without id3 tags | src/player.py | src/player.py | import vlc
class Track():
def __init__(self, logger, instance, mediapath):
self.path = mediapath
self.fullpath = str(mediapath.resolve())
self.instance = instance
self.logger = logger
self.logger.debug("self.fullpath: " + self.fullpath)
self.media = self.instance.... | import vlc
class Track():
logger = None
path = None
instance = None
media = None
fullpath = ""
artist = ""
album = ""
title = ""
track_nb = ""
def __init__(self, logger, instance, mediapath):
self.path = mediapath
self.fullpath = str(mediapath.resolve())
... | Python | 0.000001 |
57462d979e1572fbc1491249ce3117f5dc4fa144 | Refactor image mirroring code | toolbox/docker/utils.py | toolbox/docker/utils.py | import os
from glob import glob
from typing import Any, Dict, Iterable, List, Tuple
from toolbox.config.docker import DOCKER_REGISTRY, DOCKER_REGISTRY_MIRRORS
from toolbox.utils import run_cmd, fatal_error
def get_image_url(repo_name: str, repo_branch: str, short_name: str, crp_config_item: Dict[str, Any]) -> str:
... | import re
import os
from glob import glob
from typing import Any, Dict, Iterable, List, Tuple
from toolbox.config.docker import DOCKER_REGISTRY, DOCKER_REGISTRY_MIRRORS
from toolbox.utils import run_cmd
IMAGE_RE = re.compile(rf'^(?:{re.escape(DOCKER_REGISTRY)}/)?(.+)$')
def get_image_url(repo_name: str, repo_branch... | Python | 0.000002 |
dfec00fb9d14ec0689dd0378793c4dcaac071c6e | Optimize imports | src/control.py | src/control.py | #!/usr/bin/env python
import rospy
from gazebo_msgs.msg import ModelStates
from geometry_msgs.msg import Twist
from constants import DELTA_T, STEPS
from controller import create_controller
from plotter import Plotter
def get_pose(message):
global current_pose
current_pose = message.pose[2]
def compute_cont... | #!/usr/bin/env python
import rospy
from gazebo_msgs.msg import ModelStates
from geometry_msgs.msg import Twist, Pose
from constants import DELTA_T, STEPS
from controller import EulerMethodController, create_controller
from plotter import Plotter
def get_pose(message):
global current_pose
current_pose = messa... | Python | 0.000002 |
e097479d084819d89757c786dd4078523e692bf7 | replace sort with config setting | kral/services/reddit.py | kral/services/reddit.py | from eventlet.greenthread import sleep
from eventlet.green import urllib2
import simplejson as json
from collections import defaultdict
import urllib
def stream(queries, queue, settings):
api_url = "http://www.reddit.com/search.json?"
prev_items = defaultdict(list)
while True:
for query in quer... | from eventlet.greenthread import sleep
from eventlet.green import urllib2
import simplejson as json
from collections import defaultdict
import urllib
def stream(queries, queue, settings):
api_url = "http://www.reddit.com/search.json?"
prev_items = defaultdict(list)
while True:
for query in quer... | Python | 0.000002 |
bec7885f9ab3314e8627f6b3c384a9dc457fca0f | Update markdown to fix /r/RivenMains | cmcb/static_data.py | cmcb/static_data.py | SECOND = 1
MINUTE = 60*SECOND
HOUR = 60*MINUTE
DAY = 24*HOUR
WEEK = 7*DAY
REDDIT_UPDATE_TIMEOUT = MINUTE
LEAGUE_UPDATE_TIMEOUT = HOUR
TEXT_HEAD = '''
Hello, /r/{subreddit}! This post updates automatically to help you find
desired club or fill your club with some folks! You can find additional info
at the end of the p... | SECOND = 1
MINUTE = 60*SECOND
HOUR = 60*MINUTE
DAY = 24*HOUR
WEEK = 7*DAY
REDDIT_UPDATE_TIMEOUT = MINUTE
LEAGUE_UPDATE_TIMEOUT = HOUR
TEXT_HEAD = '''
Hello, /r/{subreddit}! This post updates automatically to help you find
desired club or fill your club with some folks! You can find additional info
at the end of the p... | Python | 0 |
c753bb258e8e46d5a95b3ec396ec09349052fae6 | update to use SignatureError | conda_build/main_sign.py | conda_build/main_sign.py | # (c) Continuum Analytics, Inc. / http://continuum.io
# All Rights Reserved
#
# conda is distributed under the terms of the BSD 3-clause license.
# Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause.
import os
import sys
from os.path import isdir, join
try:
from Crypto.PublicKey import RSA
fro... | # (c) Continuum Analytics, Inc. / http://continuum.io
# All Rights Reserved
#
# conda is distributed under the terms of the BSD 3-clause license.
# Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause.
import os
import sys
from os.path import isdir, join
try:
from Crypto.PublicKey import RSA
fro... | Python | 0 |
b4b5f7d30442ca04f53b036b12990be52e03e3c0 | fix bug 1267197 - Add a check for /docs/<zone> to DocumentZoneMiddleware | kuma/wiki/middleware.py | kuma/wiki/middleware.py | from django.http import HttpResponseRedirect, HttpResponsePermanentRedirect
from django.shortcuts import render
from kuma.core.utils import urlparams
from .exceptions import ReadOnlyException
from .jobs import DocumentZoneURLRemapsJob
class ReadOnlyMiddleware(object):
"""
Renders a 403.html page with a flag... | from django.http import HttpResponseRedirect
from django.shortcuts import render
from kuma.core.utils import urlparams
from .exceptions import ReadOnlyException
from .jobs import DocumentZoneURLRemapsJob
class ReadOnlyMiddleware(object):
"""
Renders a 403.html page with a flag for a specific message.
""... | Python | 0 |
b4e765a674b5ecaa10d233cd7dca8696bc381589 | Add default tensorboard docker image | polyaxon/polyaxon/config_settings/spawner.py | polyaxon/polyaxon/config_settings/spawner.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from polyaxon.utils import config
# Roles
ROLE_LABELS_WORKER = config.get_string('POLYAXON_ROLE_LABELS_WORKER')
ROLE_LABELS_DASHBOARD = config.get_string('POLYAXON_ROLE_LABELS_DASHBOARD')
ROLE_LABELS_LOG = config.get_string('POLY... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from polyaxon.utils import config
# Roles
ROLE_LABELS_WORKER = config.get_string('POLYAXON_ROLE_LABELS_WORKER')
ROLE_LABELS_DASHBOARD = config.get_string('POLYAXON_ROLE_LABELS_DASHBOARD')
ROLE_LABELS_LOG = config.get_string('POLY... | Python | 0 |
f7d987ad6c06831097118549708818cfaaa510b2 | Rework libxslt recipe and update version | pythonforandroid/recipes/libxslt/__init__.py | pythonforandroid/recipes/libxslt/__init__.py | from pythonforandroid.recipe import Recipe
from pythonforandroid.toolchain import shprint, shutil, current_directory
from os.path import exists, join
import sh
class LibxsltRecipe(Recipe):
version = '1.1.32'
url = 'http://xmlsoft.org/sources/libxslt-{version}.tar.gz'
depends = ['libxml2']
patches = ['... | from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory
from os.path import exists, join
import sh
class LibxsltRecipe(Recipe):
version = "1.1.28"
url = "http://xmlsoft.org/sources/libxslt-{version}.tar.gz"
depends = ["libxml2"]
patches = ["fix-dlopen.patch"]
call_hostpy... | Python | 0.000002 |
fa808bc78e050ba180ca9feb35051d94fdee9612 | print times and make fewer simulations | Utils/py/ActionSelection/compare_decision_schemes.py | Utils/py/ActionSelection/compare_decision_schemes.py | import os
import pickle
from tools import field_info as field
from compare_decision_schemes.current_impl_goaltime import main as current_impl
from compare_decision_schemes.particle_filter_goaltime import main as particle_filter
from state import State
import timeit
"""
For every position(x, y) and a fixed rotation the ... | import os
import pickle
from tools import field_info as field
from compare_decision_schemes.current_impl_goaltime import main as current_impl
from compare_decision_schemes.particle_filter_goaltime import main as particle_filter
from state import State
"""
For every position(x, y) and a fixed rotation the time and the ... | Python | 0.000001 |
db1653c551f71092a7eca96e6a4d1c96ef17e06a | Remove unused attributes; also, empty responses after it's flushed. | lib/rapidsms/message.py | lib/rapidsms/message.py | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import copy
class Message(object):
def __init__(self, backend, caller=None, text=None):
self._backend = backend
self.caller = caller
self.text = text
self.responses = []
def __unicode__(self):
return self.text
... | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import copy
class Message(object):
def __init__(self, backend, caller=None, text=None):
self._backend = backend
self.caller = caller
self.text = text
# initialize some empty attributes
self.received = None
... | Python | 0 |
2b8e97acf9b9a61b4ea56d4e55d7bb69e4768475 | Clean up TestBashExamples output a bit | service/integration/test/TestBashExamples.py | service/integration/test/TestBashExamples.py | #!/usr/bin/env python3
# Copyright (c) 2015 - 2021, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, thi... | #!/usr/bin/env python3
# Copyright (c) 2015 - 2021, Intel Corporation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, thi... | Python | 0.000411 |
980889c542a1b91f883fb25462c5cbe1997776be | Use the new, safer style of flag declarations in examples | launchpad/examples/consumer_producers/launch.py | launchpad/examples/consumer_producers/launch.py | # Copyright 2020 DeepMind Technologies Limited. 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 ... | # Copyright 2020 DeepMind Technologies Limited. 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 ... | Python | 0.000001 |
2b299ea1a62c61dbabbe7e27e75d7a566c138e9e | remove onchange and set compute right. (#1327) | product_vat_price/models/product_template.py | product_vat_price/models/product_template.py | # Copyright 2021 Berezi - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api
class ProductTemplate(models.Model):
_inherit = 'product.template'
vat_price = fields.Float(string='VAT price', compute='_compute_vat_price')
@api.depends("list_p... | # Copyright 2021 Berezi - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api
class ProductTemplate(models.Model):
_inherit = 'product.template'
vat_price = fields.Float(string='VAT price', compute='_compute_vat_price')
@api.depends("list_p... | Python | 0.000004 |
8fe0ec8f85e933d9aa64ff619937aba52945ea6e | add LOGGING_LEVEL settings | torext/base_settings.py | torext/base_settings.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# variables in this module are essential basements of settings,
# the priority sequence of base_settings.py, settings.py(in project), and cmd options is::
# 1. commandline arguments
# 2. settings.py
# 3. base_settings.py
#############
# essential #
#############
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# variables in this module are essential basements of settings,
# the priority sequence of base_settings.py, settings.py(in project), and cmd options is::
# 1. commandline arguments
# 2. settings.py
# 3. base_settings.py
#############
# essential #
#############
... | Python | 0 |
388653366ee4db58ed8ce8a9c8ab071593b9fc53 | Use correct default SSH port | lancet/contrib/dploi.py | lancet/contrib/dploi.py | from shlex import quote
import click
@click.command()
@click.option('-p', '--print/--exec', 'print_cmd', default=False,
help='Print the command instead of executing it.')
@click.argument('environment')
@click.pass_obj
def ssh(lancet, print_cmd, environment):
"""
SSH into the given environment, ... | from shlex import quote
import click
@click.command()
@click.option('-p', '--print/--exec', 'print_cmd', default=False,
help='Print the command instead of executing it.')
@click.argument('environment')
@click.pass_obj
def ssh(lancet, print_cmd, environment):
"""
SSH into the given environment, ... | Python | 0.000001 |
22bc969b0c468c678dc053740de3d2d9ff4d13ff | Fix pymongo2.7 issue in dbdocument. | src/compdb/core/mongodbdict.py | src/compdb/core/mongodbdict.py | import logging
logger = logging.getLogger('mongodbdict')
import pymongo
PYMONGO_3 = pymongo.version_tuple[0] == 3
class ReadOnlyMongoDBDict(object):
def __init__(self, host, db_name, collection_name, _id, connect_timeout_ms = None):
self._host = host
self._db_name = db_name
self._collecti... | import logging
logger = logging.getLogger('mongodbdict')
import pymongo
PYMONGO_3 = pymongo.version_tuple[0] == 3
class ReadOnlyMongoDBDict(object):
def __init__(self, host, db_name, collection_name, _id, connect_timeout_ms = None):
self._host = host
self._db_name = db_name
self._collecti... | Python | 0 |
ad6d1ce9b1d53bc15023771e9db401206b4b2654 | Comment out failing test until it is decided where the problem lies. | numpy/lib/tests/test_financial.py | numpy/lib/tests/test_financial.py | from numpy.testing import *
import numpy as np
class TestFinancial(TestCase):
def test_rate(self):
assert_almost_equal(np.rate(10,0,-3500,10000),
0.1107, 4)
def test_irr(self):
v = [-150000, 15000, 25000, 35000, 45000, 60000]
assert_almost_equal(np.irr(v),
... | from numpy.testing import *
import numpy as np
class TestFinancial(TestCase):
def test_rate(self):
assert_almost_equal(np.rate(10,0,-3500,10000),
0.1107, 4)
def test_irr(self):
v = [-150000, 15000, 25000, 35000, 45000, 60000]
assert_almost_equal(np.irr(v),
... | Python | 0 |
d859bfde2fb6aca986857d4e0460a65e24ee6029 | fix remaining tests to reflect new behavior of sign(nan) | numpy/lib/tests/test_ufunclike.py | numpy/lib/tests/test_ufunclike.py | """
>>> import numpy.core as nx
>>> import numpy.lib.ufunclike as U
Test fix:
>>> a = nx.array([[1.0, 1.1, 1.5, 1.8], [-1.0, -1.1, -1.5, -1.8]])
>>> U.fix(a)
array([[ 1., 1., 1., 1.],
[-1., -1., -1., -1.]])
>>> y = nx.zeros(a.shape, float)
>>> U.fix(a, y)
array([[ 1., 1., 1., 1.],
[-1., -1., -1., -... | """
>>> import numpy.core as nx
>>> import numpy.lib.ufunclike as U
Test fix:
>>> a = nx.array([[1.0, 1.1, 1.5, 1.8], [-1.0, -1.1, -1.5, -1.8]])
>>> U.fix(a)
array([[ 1., 1., 1., 1.],
[-1., -1., -1., -1.]])
>>> y = nx.zeros(a.shape, float)
>>> U.fix(a, y)
array([[ 1., 1., 1., 1.],
[-1., -1., -1., -... | Python | 0.000001 |
6b662626333bfb32b7a815d5876bf172bd07353e | Fix bug in create fact response. | opencenter/webapp/facts_please.py | opencenter/webapp/facts_please.py | #!/usr/bin/env python
#
# Copyright 2012, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | #!/usr/bin/env python
#
# Copyright 2012, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | Python | 0 |
e72601362bc5c0b43f3f77e2a373979804cf4ca2 | I give up | cogs/linguistics.py | cogs/linguistics.py | import discord
from discord.ext import commands
import time
import datetime
import traceback
class Linguistics:
def __init__(self, bot):
self.bot = bot
@commands.command()
async def define(self, ctx, *, word: str):
"""Defines the specified word"""
url = f"https://od-api.oxforddict... | import discord
from discord.ext import commands
import time
import datetime
import traceback
class Linguistics:
def __init__(self, bot):
self.bot = bot
@commands.command()
async def define(self, ctx, *, word: str):
"""Defines the specified word"""
url = f"https://od-api.oxforddict... | Python | 0.999428 |
83e2d010ff2c05ddc172ccfa0caf1efe941f3184 | Update combine module namespace | combine/__init__.py | combine/__init__.py | # Copyright (c) 2010 John Reese
# Licensed under the MIT license
class CombineError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
from combine.formats import Archive, File
from combine.config import Config
from combine.package import Pack... | # Copyright (c) 2010 John Reese
# Licensed under the MIT license
class CombineError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
from combine.manifest import Manifest
from combine.diff import Diff
| Python | 0 |
9b603d07df9be3cbac32d08d0e17ae5c5f9c76ae | Update sphinx_runner to use Sphinx >= 2 | python/helpers/rest_runners/sphinx_runner.py | python/helpers/rest_runners/sphinx_runner.py |
if __name__ == "__main__":
import sys
try:
import sphinx
except ImportError:
raise NameError("Cannot find sphinx in selected interpreter.")
version = sphinx.version_info
if (version[0] >= 1 and version[1] >= 7) or version[0] >= 2:
from sphinx.cmd import build
build... |
if __name__ == "__main__":
import sys
try:
import sphinx
except ImportError:
raise NameError("Cannot find sphinx in selected interpreter.")
version = sphinx.version_info
if version[0] >= 1 and version[1] >= 7:
from sphinx.cmd import build
build.main(sys.argv[1:])
... | Python | 0.000001 |
bc837143d79faca5de0d1919dd63ceb3800c68e3 | Fix the memory function: remove 'X'. | Algol/memIO.py | Algol/memIO.py | #!/usr/bin/env python
# Copyright (c) 2015 Angel Terrones (<angelterrones@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 without limitation the r... | #!/usr/bin/env python
# Copyright (c) 2015 Angel Terrones (<angelterrones@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 without limitation the r... | Python | 0.999999 |
332e4a8a35e065fd5535cab716f4e9009ea0bcd1 | Set default filter backend for rest framework | trex/settings_global.py | trex/settings_global.py | # -*- coding: utf-8 -*-
#
# (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>
#
# See LICENSE comming with the source of 'trex' for details.
#
"""
Django settings for trex project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values... | # -*- coding: utf-8 -*-
#
# (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>
#
# See LICENSE comming with the source of 'trex' for details.
#
"""
Django settings for trex project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values... | Python | 0 |
e4cff9c25bb768f0068e9e007e919ba52d7efb6f | Fix name prefix for host builds (#8767) | scripts/build/builders/host.py | scripts/build/builders/host.py | # Copyright (c) 2021 Project CHIP 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 (c) 2021 Project CHIP 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 ... | Python | 0 |
e13be048b4a1582b3579a7d007f06c5c2b98a664 | Fix whitespace incoherence, causing pylint errors. | codereview/middleware.py | codereview/middleware.py | # Copyright 2008 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 2008 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, ... | Python | 0.999987 |
e9754ec682d62867103dba7481cdb8e6609769a5 | Remove print statements. | source/segue/backend/processor/background.py | source/segue/backend/processor/background.py | # :coding: utf-8
# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
# :license: See LICENSE.txt.
import subprocess
import pickle
import base64
import copy_reg
import types
try:
from shlex import quote
except ImportError:
from pipes import quote
from .base import Processor
# Support for instancemethod... | # :coding: utf-8
# :copyright: Copyright (c) 2013 Martin Pengelly-Phillips
# :license: See LICENSE.txt.
import subprocess
import pickle
import base64
import copy_reg
import types
try:
from shlex import quote
except ImportError:
from pipes import quote
from .base import Processor
# Support for instancemethod... | Python | 0.000021 |
ed38e4b98b3a5a06761aecb6a977958a2fdd892e | Increment version number. | coimbra_chamber/__version__.py | coimbra_chamber/__version__.py | VERSION = (0, 0, 4)
__version__ = '.'.join(map(str, VERSION))
| VERSION = (0, 0, 3)
__version__ = '.'.join(map(str, VERSION))
| Python | 0.000001 |
7d34b407a35fe917e919fc01b3a6c736a7bdc372 | Remove admin prefix from url | helpdesk/urls.py | helpdesk/urls.py | from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'helpdesk.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'', include(admin.site.urls)),
)
| from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'helpdesk.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
)
| Python | 0.000001 |
e2018c1c344e9482a99a3d187d740b32c0fdd7ec | Update server.py | src/server.py | src/server.py | #Import flask libraries
import json, re, os, datetime, logging;#Import general libraries
from flask import Flask, jsonify, request, render_template, send_from_directory, redirect;
from flask_socketio import SocketIO, send, emit, join_room, leave_room, close_room;
from flask_mail import Mail, Message;
from flask_socketi... | #Import flask libraries
import json, re, os, datetime, logging;#Import general libraries
from flask import Flask, jsonify, request, render_template, send_from_directory, redirect;
from flask_socketio import SocketIO, send, emit, join_room, leave_room, close_room;
from flask_mail import Mail, Message;
from flask_socketi... | Python | 0.000001 |
19b89bca29769bf500308593a49d87f877bc68c9 | test dict() method. | coil/test/test_struct.py | coil/test/test_struct.py | """Tests for coil.struct."""
import unittest
from coil import struct, errors
class BasicTestCase(unittest.TestCase):
def setUp(self):
# Use a tuple to preserve order
self.data = (('first', {
'string': "something",
'float': 2.5,
... | """Tests for coil.struct."""
import unittest
from coil import struct, errors
class BasicTestCase(unittest.TestCase):
def setUp(self):
# Use a tuple to preserve order
self.data = (('first', {
'string': "something",
'float': 2.5,
... | Python | 0 |
566f30b14f018b66fe800cdb56dfb3e52b7c15c9 | Update ipc_lista1.13.py | lista1/ipc_lista1.13.py | lista1/ipc_lista1.13.py | #ipc_lista1.13
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Tendo como dados de entrada a altura e o sexo de uma pessoa, constru um algoritmo que calcule seu peso ideal, utilizando as seguintes fórmulas:
#Para homens: (72.7*h) - 58
#Para mulheres: (62.1*h) - 44.7 (h = altura)
#Peça o peso da pe... | #ipc_lista1.13
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Tendo como dados de entrada a altura e o sexo de uma pessoa, constru um algoritmo que calcule seu peso ideal, utilizando as seguintes fórmulas:
#Para homens: (72.7*h) - 58
#Para mulheres: (62.1*h) - 44.7 (h = altura)
#Peça o peso da pe... | Python | 0 |
801d2847631daa21325cfbb49e5315e903fcbeb1 | Update ipc_lista1.14.py | lista1/ipc_lista1.14.py | lista1/ipc_lista1.14.py | #ipc_lista1.14
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#
#João Papo-de-Pescador, homem de bem, comprou um microcomputador para controlar o rendimento diário de seu trabalho. Toda vez que ele traz um peso de peixes maior que o estabelecido pelo regulamento de pesca do estado de São Paulo (50... | #ipc_lista1.14
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#
#João Papo-de-Pescador, homem de bem, comprou um microcomputador para controlar o rendimento diário de seu trabalho. Toda vez que ele traz um peso de peixes maior que o estabelecido pelo regulamento de pesca do estado de São Paulo (50... | Python | 0 |
cd2b1d7b062d292182df1dde57637878cc5b3cb6 | Update ipc_lista2.01.py | lista2/ipc_lista2.01.py | lista2/ipc_lista2.01.py | #ipc_lista2.1
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa que peça dois números e imprima o maior deles.
num1 = float(input("Informe um número: "
| #ipc_lista2.1
#Professor: Jucimar Junior
#Any Mendes Carvalho - 1615310044
#
#
#
#
#Faça um programa que peça dois números e imprima o maior deles.
num1 = float(input("Informe um número
| Python | 0 |
d7091b43fd483de9f6993a070698f24067bebbba | Update ipc_lista4.08.py | lista4/ipc_lista4.08.py | lista4/ipc_lista4.08.py | """
lista 4 questao 8:
Faça um Programa que peça a idade e a altura de 5 pessoas,
armazene cada informação no seu respectivo vetor.
Imprima a idade e a altura na ordem inversa a ordem lida.
"""
# EQUIPE 2
#ANA BEATRIZ FROTA - 1615310027
#
#
#
#
#
#Luiz Gustavo Rocha Melo - 1615310015
altura = [] #ve... | """
lista 4 questao 8:
Faça um Programa que peça a idade e a altura de 5 pessoas,
armazene cada informação no seu respectivo vetor.
Imprima a idade e a altura na ordem inversa a ordem lida.
"""
# EQUIPE 2
#ANA BEATRIZ FROTA - 1615310027
#
#
#Luiz Gustavo Rocha Melo - 1615310015
altura = [] #vetor para altu... | Python | 0 |
064dd5b681a0be4cb45f94fbc77f40586876f645 | empty key returns no code | analytical/tests/test_tag_uservoice.py | analytical/tests/test_tag_uservoice.py | """
Tests for the UserVoice tags and filters.
"""
from django.contrib.auth.models import User, AnonymousUser
from django.http import HttpRequest
from django.template import Context
from analytical.templatetags.uservoice import UserVoiceNode
from analytical.tests.utils import TagTestCase, override_settings, \
... | """
Tests for the UserVoice tags and filters.
"""
from django.contrib.auth.models import User, AnonymousUser
from django.http import HttpRequest
from django.template import Context
from analytical.templatetags.uservoice import UserVoiceNode
from analytical.tests.utils import TagTestCase, override_settings, \
... | Python | 0.99919 |
90a9cee8349ccc9ec024b25f17f7d29f75c70524 | Bump version number | src/shared.py | src/shared.py | # -*- coding: utf-8 -*-
import logging
import os
import queue
import threading
listening_port = 8444
send_outgoing_connections = True
data_directory = 'minode_data/'
source_directory = os.path.dirname(os.path.realpath(__file__))
log_level = logging.DEBUG
magic_bytes = b'\xe9\xbe\xb4\xd9'
protocol_version = 3
service... | # -*- coding: utf-8 -*-
import logging
import os
import queue
import threading
listening_port = 8444
send_outgoing_connections = True
data_directory = 'minode_data/'
source_directory = os.path.dirname(os.path.realpath(__file__))
log_level = logging.DEBUG
magic_bytes = b'\xe9\xbe\xb4\xd9'
protocol_version = 3
service... | Python | 0.000002 |
cb8cde80fcab8d7b0918f1d4b498c65af76351f9 | Return email_verified attribute | sentry_auth_google/provider.py | sentry_auth_google/provider.py | from __future__ import absolute_import, print_function
from sentry.auth.provider import MigratingIdentityId
from sentry.auth.providers.oauth2 import (
OAuth2Callback, OAuth2Provider, OAuth2Login
)
from .constants import (
AUTHORIZE_URL, ACCESS_TOKEN_URL, CLIENT_ID, CLIENT_SECRET, DATA_VERSION,
SCOPE
)
fro... | from __future__ import absolute_import, print_function
from sentry.auth.provider import MigratingIdentityId
from sentry.auth.providers.oauth2 import (
OAuth2Callback, OAuth2Provider, OAuth2Login
)
from .constants import (
AUTHORIZE_URL, ACCESS_TOKEN_URL, CLIENT_ID, CLIENT_SECRET, DATA_VERSION,
SCOPE
)
fro... | Python | 0.00002 |
d2ac7fdc28d3aeede4021fad6b9f51a8d79fe0a9 | add pre-save check | mongoext/models.py | mongoext/models.py | from __future__ import absolute_import
import mongoext.collection
import mongoext.fields
class MetaModel(type):
def __new__(cls, name, bases, attrs):
fields = {}
for base in bases:
for attr, obj in vars(base).iteritems():
if issubclass(type(obj), mongoext.fields.Field)... | from __future__ import absolute_import
import mongoext.collection
import mongoext.fields
class MetaModel(type):
def __new__(cls, name, bases, attrs):
fields = {}
for base in bases:
for attr, obj in vars(base).iteritems():
if issubclass(type(obj), mongoext.fields.Field)... | Python | 0 |
c97abd1aca254b1ede05ef33ecefa8402fdcb0ac | add message for notice types creation | apps/core/management/commands/create_notice_types.py | apps/core/management/commands/create_notice_types.py | from django.core.management.base import BaseCommand
from django.utils.translation import ugettext_noop as _
from django.db.models import signals
from notification import models as notification
class Command(BaseCommand):
def handle(self, *args, **options):
notification.create_notice_type("create_meeting_... | from django.core.management.base import BaseCommand
from django.utils.translation import ugettext_noop as _
from django.db.models import signals
from notification import models as notification
class Command(BaseCommand):
def handle(self, *args, **options):
notification.create_notice_type("create_meeting_... | Python | 0 |
9befb6021a55cdf584c39a3f5e9fa3191a415a50 | Fix code health issues reported by Landscape.io | compare_versions/core.py | compare_versions/core.py | from . import schemes
VALID_COMPARISONS=['eq','ne','gt','lt','ge','le']
def is_valid(version):
try:
schemes.schemes['semver'](version)
except schemes.InvalidVersionError:
return False
return True
def verify_list(versions, comparison='lt', scheme='semver'):
"""
Verify that a list o... | from . import schemes
VALID_COMPARISONS=['eq','ne','gt','lt','ge','le']
def is_valid(version):
try:
schemes.schemes['semver'](version)
except schemes.InvalidVersionError:
return False
return True
def verify_list(versions, comparison='lt', scheme='semver'):
"""
Verify that a list o... | Python | 0.000001 |
7568b5c4869a5ab4c5e483393f901b77b70ebced | Fix typo in word API test. | spec/data/word_api/wordnet/_word_api_spec.py | spec/data/word_api/wordnet/_word_api_spec.py | from data.word_api import word_api
from spec.mamba import *
_word_api = None
with _description('_word_api'):
with before.all:
global _word_api
_word_api = word_api.get_api('wordnet')
with description('base_form'):
with it('handles plurals'):
expect(_word_api.base_form('snails')).to(equal('snail... | from data.word_api import word_api
from spec.mamba import *
_word_api = None
with _description('_word_api'):
with before.all:
global _word_api
_word_api = word_api.get_api('wordnet')
with description('base_form'):
with it('handles plurals'):
expect(_word_api.base_form('snails')).to(equal('snail... | Python | 0.000019 |
e5c81f533099fc21d1da67ffdd91a2dafda08429 | fix for both envs? | ibcomics/wsgi.py | ibcomics/wsgi.py | """
WSGI config for ibcomics project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION``... | """
WSGI config for ibcomics project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION``... | Python | 0 |
4af2d1286a6a6b8d6bf91f0d5f707b3d999b53d7 | Set null in the "Elevation" field | csacompendium/locations/models.py | csacompendium/locations/models.py | from __future__ import unicode_literals
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
# from django.db.models.signals import pre_save
# from django.dispatch import receiver
# from... | from __future__ import unicode_literals
from django.conf import settings
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
# from django.db.models.signals import pre_save
# from django.dispatch import receiver
# from... | Python | 0.000001 |
0079d87a51267e73d1083c339f10df8f31712968 | Fix Python 2 | cscslackbot/logconfig/__init__.py | cscslackbot/logconfig/__init__.py | import logging
import logging.config
import logging.handlers
import six
import sys
from ..utils import from_human_readable
def configure(config):
format = config.get('format', None)
datefmt = config.get('datefmt', None)
fmtstyle = config.get('fmtstyle', '%')
if six.PY2:
formatter = logging.Fo... | import logging
import logging.config
import logging.handlers
import sys
from ..utils import from_human_readable
def configure(config):
format = config.get('format', None)
datefmt = config.get('datefmt', None)
fmtstyle = config.get('fmtstyle', '%')
formatter = logging.Formatter(format, datefmt, fmtsty... | Python | 0.999993 |
0275ababbed41a6c051938f8cf3a2defe1962fe1 | Fix wrong finally clause | idlk/__init__.py | idlk/__init__.py | from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import os
import sys
import idlk.base41
if sys.version_info[0] == 3:
_get_byte = lambda c: c
else:
_get_byte = ord
def hash_macroman(data):
h = 0
for c in data:
h = ((h << 8) + h) + ... | from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import os
import sys
import idlk.base41
if sys.version_info[0] == 3:
_get_byte = lambda c: c
else:
_get_byte = ord
def hash_macroman(data):
h = 0
for c in data:
h = ((h << 8) + h) + ... | Python | 0.000044 |
d6caf2f1eb407eb63e0e6dc7e1375a81fcd5ff81 | Implement data coordinator in CalFlora | scripts/observations/scrape/CalFloraScraper.py | scripts/observations/scrape/CalFloraScraper.py | from selenium import webdriver
import pandas as pd
import argparse
import PyFloraBook.web.communication as scraping
import PyFloraBook.input_output.data_coordinator as dc
# ---------------- INPUT ----------------
# Parse arguments
parser = argparse.ArgumentParser(
description='Scrape CalFlora for species counts... | from selenium import webdriver
import pandas as pd
import argparse
import PyFloraBook.web.communication as scraping
# ---------------- INPUT ----------------
# Parse arguments
parser = argparse.ArgumentParser(
description='Scrape CalFlora for species counts for given family')
parser.add_argument("-f", "--familie... | Python | 0 |
b1e35e8eea2e91013967b0544088036d56014c34 | fix style errors | contrib/statsd_perfomance_test.py | contrib/statsd_perfomance_test.py | #!/usr/bin/env python
import multiprocessing
import bucky.statsd
import time
import timeit
l10 = range(10)
l100 = range(100)
l1000 = range(1000)
# try:
# import queue
# except ImportError:
# import Queue as queue
queue = multiprocessing.Queue()
handler = bucky.statsd.StatsDHandler(queue, bucky.cfg)
def f... | #!/usr/bin/env python
import multiprocessing
import bucky.statsd
import time
import timeit
l10 = range(10)
l100 = range(100)
l1000 = range(1000)
# try:
# import queue
# except ImportError:
# import Queue as queue
queue = multiprocessing.Queue()
handler = bucky.statsd.StatsDHandler(queue, bucky.cfg)
def f... | Python | 0.000001 |
52d76647b1fa50a2649335b65f22f88d7877e9d3 | Return to old setting of repetitions for fast testing | spotpy/unittests/test_fast.py | spotpy/unittests/test_fast.py | import unittest
try:
import spotpy
except ImportError:
import sys
sys.path.append(".")
import spotpy
from spotpy.examples.spot_setup_hymod_python import spot_setup
class TestFast(unittest.TestCase):
def setUp(self):
self.spot_setup = spot_setup()
self.rep = 200 # REP must be a... | import unittest
try:
import spotpy
except ImportError:
import sys
sys.path.append(".")
import spotpy
from spotpy.examples.spot_setup_hymod_python import spot_setup
class TestFast(unittest.TestCase):
def setUp(self):
self.spot_setup = spot_setup()
self.rep = 200 # REP must be a... | Python | 0.000097 |
06ef27c5767947c324d787c23c0acb887ea7f914 | Remove an useless shebang form non-executable file (#1073) | httpie/__main__.py | httpie/__main__.py | """The main entry point. Invoke as `http' or `python -m httpie'.
"""
import sys
def main():
try:
from httpie.core import main
exit_status = main()
except KeyboardInterrupt:
from httpie.status import ExitStatus
exit_status = ExitStatus.ERROR_CTRL_C
sys.exit(exit_status.val... | #!/usr/bin/env python
"""The main entry point. Invoke as `http' or `python -m httpie'.
"""
import sys
def main():
try:
from httpie.core import main
exit_status = main()
except KeyboardInterrupt:
from httpie.status import ExitStatus
exit_status = ExitStatus.ERROR_CTRL_C
sy... | Python | 0 |
0afb9c02a63a4d96fa21f825a98139878df06dfc | add a-game-of-stones | contest/5-days-of-game-theory/a-game-of-stones/a-game-of-stones.py | contest/5-days-of-game-theory/a-game-of-stones/a-game-of-stones.py | # -*- coding: utf-8 -*-
# @Author: Zeyuan Shang
# @Date: 2016-05-13 13:42:03
# @Last Modified by: Zeyuan Shang
# @Last Modified time: 2016-05-13 13:42:08
T = input()
for _ in xrange(T):
n = input()
dp = [False] * (n + 1)
for i in xrange(n + 1):
res = False
for j in [2, 3, 5]:
... | Python | 0.998888 | |
5c91a2c8dda69d37fd3cd0989ff6c3883851eaef | Introduce templatetag for fetching image thumbnails | saleor/product/templatetags/product_images.py | saleor/product/templatetags/product_images.py | import logging
import warnings
from django.template.context_processors import static
from django import template
from django.conf import settings
logger = logging.getLogger(__name__)
register = template.Library()
# cache available sizes at module level
def get_available_sizes():
all_sizes = set()
keys = set... | Python | 0 | |
304e8d68e114eda8fe420e64f0255a816fbc5009 | Add a very basic test, #1 | test_pyspin.py | test_pyspin.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
from pyspin import spin
def test_spinner():
spinner = spin.Spinner(spin.Spin9)
assert spinner.length == 4
assert spinner.frames == spin.Spin9
assert spinner.current() == u'←'
assert spinner.next() == u'←'
assert spinner.next() == u'... | Python | 0.000202 | |
9c1ee652684fec9dc3b9ed487bfd980e886ec9fc | Add regression test for #1698 | spacy/tests/regression/test_issue1698.py | spacy/tests/regression/test_issue1698.py | # coding: utf8
from __future__ import unicode_literals
import pytest
@pytest.mark.parametrize('text', ['test@example.com', 'john.doe@example.co.uk'])
def test_issue1698(en_tokenizer, text):
doc = en_tokenizer(text)
assert len(doc) == 1
assert not doc[0].like_url
| Python | 0.000001 | |
42a18ef9030f883563c4459aec46563877274794 | Add test for #1868: Vocab.__contains__ with ints | spacy/tests/regression/test_issue1868.py | spacy/tests/regression/test_issue1868.py | '''Test Vocab.__contains__ works with int keys'''
from __future__ import unicode_literals
from ... vocab import Vocab
def test_issue1868():
vocab = Vocab()
lex = vocab['hello']
assert lex.orth in vocab
assert lex.orth_ in vocab
assert 'some string' not in vocab
int_id = vocab.strings.add('some... | Python | 0.000802 | |
ec6ee7638a6670257a10d74aeb2ee443623e6ece | add imgSmartCrop | python-pj/imgSmartCrop/main.py | python-pj/imgSmartCrop/main.py | import sys
import copy
import cv2
import getopt
import math
def detectEdges(image):
edges = cv2.Canny(image, 100, 100)
cv2.imwrite("edges.jpg", edges)
return edges
def isolateUnique(image, edges):
blocksize = 64
varianceThreshold = 95
cellPx = image.shape[1] // blocksize
rows = image.shape[0] // cellPx
cols =... | Python | 0.000001 | |
2a5b8283bf653e7691b91217c2fe225ab0699571 | update finalization rainfall | python/finalization_shp_dbf.py | python/finalization_shp_dbf.py | # sample input = python finalization_shp_dbf.py /var/lib/opengeo/geoserver/data/IDN_GIS/05_Analysis/03_Early_Warning/Rainfall_Anomaly_test/ 2016-07
import shapefile
import sys
import datetime
import dbf
location_geoserver = str(sys.argv[1])
filename = location_geoserver.split('/')[-2]
period = str(sys.argv[2])
period... | Python | 0.000001 | |
75f1a9cfd5645bab76b5bb665e94b0d21c26454e | Add module for generating Deep Zoom images | openslide/deepzoom.py | openslide/deepzoom.py | #
# openslide-python - Python bindings for the OpenSlide library
#
# Copyright (c) 2010-2011 Carnegie Mellon University
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of version 2.1 of the GNU Lesser General Public License
# as published by the Free Software Foundation.
#
... | Python | 0 | |
39e31d6dd129d4acd9adc95ce0bb7a5c9c45dd42 | Create Dictionary_example.py | Python3-5/Dictionary_example.py | Python3-5/Dictionary_example.py | #With a given integral number n, write a program to generate a dictionary that contains (i, i*i) such that is an integral number between 1 and n (both included). and then the program should print the dictionary.
n=int(input("Please enter a number")); # takes an integer from user
d=dict(); ... | Python | 0.00001 | |
cf8744e8f9d3f4d77093ecf1cce119161f395b78 | add tests | tests.py | tests.py | import unittest
import numpy as np
from numpy.testing import assert_array_equal as assertAE
from rdp import rdp
class RDPTest(unittest.TestCase):
def test_two(self):
assertAE(rdp(np.array([[0, 0], [4, 4]])),
np.array([[0, 0], [4, 4]]))
def test_hor(self):
assertAE(rdp(np.arr... | Python | 0 | |
a7bff3fdc7e328fb0c11fbf0450db78997d2e307 | Create contour.py | contour.py | contour.py | #!/usr/bin/python
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import geotiler
from scipy.stats import gaussian_kde
class Contour():
def __init__(self, in_f,pix_size=2000,inch_size=10,dpi=200,zoom=14):
#init varibles
self.in_f = in_f
self.np = np
self.plt... | Python | 0.000001 | |
bb197fcee1c809e377d235346fcb0a670f35d918 | Create counter.py | counter.py | counter.py | from collections import Counter
l=[12,3,4,2,4,2,4,23,4,1,2]
c=Counter(iterable=l)
print c.most_common(2)
print list(c.elements())
c.clear()
| Python | 0.000004 | |
cb85810364a235426147a440da797d35d114c5a6 | Test Commit | raspberry/asip/RelationSemanticTag.py | raspberry/asip/RelationSemanticTag.py | from SemanticTag import *
#Test | Python | 0.000001 | |
1d5ea05e42def0048c8ccd3e3d51b6511c190f57 | Update _test_utils.py | rhea/utils/test/_test_utils.py | rhea/utils/test/_test_utils.py |
import os
import shutil
from glob import glob
import argparse
from myhdl import traceSignals, Simulation
def run_testbench(bench, timescale='1ns', args=None):
""" run (simulate) a testbench
The args need to be retrieved outside the testbench
else the test will fail with the pytest runner, if
no arg... |
import os
import shutil
from glob import glob
import argparse
from myhdl import traceSignals, Simulation
def run_testbench(bench, timescale='1ns', args=None):
if args is None:
args = tb_argparser().parse_args()
vcd = tb_clean_vcd(bench.__name__)
if args.trace:
# @todo: the following (tim... | Python | 0.000005 |
ef335362b5f601da41377984b8d9cc675d9ed669 | Create ddns_sync.py | ddns_sync.py | ddns_sync.py | #!/usr/bin/env python3
import boto3
from get import getjson
query = "http://evolutiva.mx/getip/"
data = getjson(query)
if not data:
exit()
new_ip = dict(data)['ip']
old_ip = None
r53 = boto3.client('route53') #.connect_to_region('us-west-2')
try:
for res in r53.list_resource_record_sets(HostedZoneId='/hos... | Python | 0.000009 | |
5cf79e395802ae5db7d21d07cb6e8042793f5c26 | Add easycrud versions of generic views | easycrud/views.py | easycrud/views.py | from django.views.generic import (ListView as DjangoListView, DetailView as DjangoDetailView,
UpdateView as DjangoUpdateView, CreateView as DjangoCreateView,
DeleteView as DjangoDeleteView)
from django.contrib.auth.decorators import login_required
fro... | Python | 0 | |
bc68c04b9be33329e4c28689053300360b6393b4 | create Clusters class | clusters.py | clusters.py | import numpy as np
import pandas as pd
from astropy.cosmology import Planck13 as cosmo
from astropy import units
import sys
sys.path.insert(1,'/Users/jesford/astrophysics/cofm') #temporary path adjust
from cofm import c_DuttonMaccio
try:
from IPython.display import display
notebook_display = True
except:
... | Python | 0 | |
8821fd5e4678dd8a2baf78d3ed068b652a10d1cd | Add initial games unit | units/games.py | units/games.py |
import random
def eightball():
responses = ["It is certain", "It is decidedly so", "Without a doubt", "Yes, definitely", "You may rely on it", "As I see it, yes", "Most likely", "Outlook good", "Yes", "Signs point to yes", "Reply hazy try again", "Ask again later", "Better not tell you now", "Cannot predict now", "C... | Python | 0 | |
0420aa1bf7bb8027379de52de783da87ce253f62 | add batch upload script | uploadBatch.py | uploadBatch.py | # This is a python script for uploading batch data to Genotet server.
# The user may write a *.tsv file, with each line as:
# file_path data_name file_type description
# The command line would be:
# python uploadBatch.py username *.tsv
# And then enter your password for Genotet.
from requests_toolbelt impo... | Python | 0.000001 | |
22ae0ef7d2dfe793c9deb7b6c2027d5b5f69b3e0 | add lamper script to control colors | lamper.py | lamper.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import requests
import os
import sys
global url
#url = ''
url = os.environ['LAMPER_URL']
global universe
universe = '1'
def web_post(url, payload):
r = requests.post(
url,
data=payload,
headers={'Content-Type': 'application/x-www-form-urlen... | Python | 0 | |
da373b924cf4dffe639e29543b5fc0e728be1ed9 | Add orgviz.randomnodes | orgviz/randomnodes.py | orgviz/randomnodes.py | import random
import datetime
class RandomDatetime(object):
def __init__(self, datewidth=7):
self.datewidth = datewidth
self.now = datetime.datetime.now()
def datetime(self):
delta = datetime.timedelta(random.randrange(- self.datewidth,
... | Python | 0.001097 | |
a5bffdaa29d2f270a6f8781c34a2756a66a00a87 | Bump version | flexget/_version.py | flexget/_version.py | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | Python | 0 |
6b5c46238975eb63b36f43eb79002946a744fd68 | Prepare v2.10.47.dev | flexget/_version.py | flexget/_version.py | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | """
Current FlexGet version.
This is contained in a separate file so that it can be easily read by setup.py, and easily edited and committed by
release scripts in continuous integration. Should (almost) never be set manually.
The version should always be set to the <next release version>.dev
The jenkins release job wi... | Python | 0.000002 |
ea41e4cdc515ca8514c3613a1f474fb3627b7dda | Remove autosynth / tweaks for 'README.rst' / 'setup.py'. (#5957) | tasks/synth.py | tasks/synth.py | # Copyright 2018 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, s... | # Copyright 2018 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, s... | Python | 0 |
761ec2bd6492b041eb658ee836a63ffb877469d5 | Add management command to load all version fixtures | cbv/management/commands/load_all_django_versions.py | cbv/management/commands/load_all_django_versions.py | import os
import re
from django.conf import settings
from django.core.management import call_command, BaseCommand
class Command(BaseCommand):
"""Load the Django project fixtures and all version fixtures"""
def handle(self, **options):
fixtures_dir = os.path.join(settings.DIRNAME, 'cbv', 'fixtures')
... | Python | 0.000003 | |
9e2fe5de082c736ec44dbf150d8350a0e164d2ae | Create beta_which_operator.py | Solutions/beta/beta_which_operator.py | Solutions/beta/beta_which_operator.py | def whichOper(a, b, oper):
return {'a':lambda x,y: x+y,
's':lambda x,y: x-y,
'm':lambda x,y: x*y,
'd':lambda x,y: x/y}[oper[0]](a,b)
| Python | 0.000065 | |
e3dcc7ef44bbc8772fd5ad4f0941e5d98bf1ccdd | add migration | scholarly_citation_finder/apps/tasks/migrations/0003_auto_20160224_1349.py | scholarly_citation_finder/apps/tasks/migrations/0003_auto_20160224_1349.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tasks', '0002_task_starttime'),
]
operations = [
migrations.RemoveField(
model_name='task',
name='ta... | Python | 0.000001 | |
51ce05bfb9b95c2193f6d743c53975c51b2450d0 | Add Ironic Node module | lib/ansible/modules/cloud/openstack/os_ironic_node.py | lib/ansible/modules/cloud/openstack/os_ironic_node.py | #!/usr/bin/python
# coding: utf-8 -*-
# (c) 2014, Hewlett-Packard Development Company, L.P.
#
# This module 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 optio... | Python | 0.000001 | |
0711b2eee10e5e48186d78144697a35640a33cb1 | Add a passthrough manager | mysql_fuzzycount/managers.py | mysql_fuzzycount/managers.py | from model_utils.managers import PassThroughManager
from mysql_fuzzycount.queryset import FuzzyCountQuerySet
FuzzyCountManager = PassThroughManager.for_queryset_class(FuzzyCountQuerySet)
| Python | 0.000002 | |
56b2897655940962a8cfa06cc8a9fcfe22262412 | Create config_local.py | pgadmin4/config_local.py | pgadmin4/config_local.py | # -*- coding: utf-8 -*-
##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2016, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
# config_local.py - Core application configuration settings
#
######... | Python | 0.000003 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.