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
e4942c16322829d37f780d539517fe10e50e0e39
Fix bad var
hubblestack/extmods/grains/splunkconfig.py
hubblestack/extmods/grains/splunkconfig.py
# -*- coding: utf-8 -*- ''' Attempt to load alternate splunk config from the hubble.d/ directory and store in grains for use by the splunk returners. This way splunk config changes don't require a hubble restart. ''' import os import yaml def splunkconfig(): ''' Walk the hubble.d/ directory and read in any .c...
# -*- coding: utf-8 -*- ''' Attempt to load alternate splunk config from the hubble.d/ directory and store in grains for use by the splunk returners. This way splunk config changes don't require a hubble restart. ''' import os import yaml def splunkconfig(): ''' Walk the hubble.d/ directory and read in any .c...
Python
0.000618
c9e8462dacfd511ca996cf73d7a08e1fdfeded01
fix file permission of stom collector
intelmq/bots/collectors/stomp/collector.py
intelmq/bots/collectors/stomp/collector.py
# -*- coding: utf-8 -*- import os.path from intelmq.lib.bot import CollectorBot try: import stomp class StompListener(stomp.listener.PrintingListener): """ the stomp listener gets called asynchronously for every STOMP message """ def __init__(self, n6stompcollector): ...
# -*- coding: utf-8 -*- import os.path from intelmq.lib.bot import CollectorBot try: import stomp class StompListener(stomp.listener.PrintingListener): """ the stomp listener gets called asynchronously for every STOMP message """ def __init__(self, n6stompcollector): ...
Python
0
e8e7d188b45b06967a6f7ec210f91b1bbe4e494c
use pathlib
abilian/web/admin/panels/sysinfo.py
abilian/web/admin/panels/sysinfo.py
# coding=utf-8 """ """ from __future__ import absolute_import, print_function, division import os import sys import pkg_resources from pip.vcs import vcs from pathlib import Path from flask import render_template from ..panel import AdminPanel class SysinfoPanel(AdminPanel): id = 'sysinfo' label = 'System info...
# coding=utf-8 """ """ from __future__ import absolute_import, print_function, division import os import sys import pkg_resources from pip.vcs import vcs from flask import render_template from ..panel import AdminPanel class SysinfoPanel(AdminPanel): id = 'sysinfo' label = 'System information' icon = 'hdd' ...
Python
0.000001
d971b8c7d0261ee0774ccecf41b0484cff1dd62c
Change url config for image to see if it loads in production this way instead
source/services/imdb_service.py
source/services/imdb_service.py
import requests import re from bs4 import BeautifulSoup from source.models.technical_specs import TechnicalSpecs class ImdbService: __URL = 'http://www.imdb.com/title/' __API_URL = 'http://www.imdb.com/xml/find?' __OMDB_URL = 'http://www.omdbapi.com/?' __SEPERATOR = '-' def __init__(self, title...
import requests import re from bs4 import BeautifulSoup from source.models.technical_specs import TechnicalSpecs class ImdbService: __URL = 'http://www.imdb.com/title/' __API_URL = 'http://www.imdb.com/xml/find?' __OMDB_URL = 'http://www.omdbapi.com/?' __SEPERATOR = '-' def __init__(self, title...
Python
0
d2ac9fd6e1bebd85b345df09e1717b65359c54bd
Correct Torfaen opening times
polling_stations/apps/data_importers/management/commands/import_torfaen.py
polling_stations/apps/data_importers/management/commands/import_torfaen.py
from addressbase.models import Address, UprnToCouncil from core.opening_times import OpeningTimes from data_importers.management.commands import BaseHalaroseCsvImporter from data_importers.mixins import AdvanceVotingMixin from pollingstations.models import AdvanceVotingStation class Command(BaseHalaroseCsvImporter, A...
from addressbase.models import Address, UprnToCouncil from core.opening_times import OpeningTimes from data_importers.management.commands import BaseHalaroseCsvImporter from data_importers.mixins import AdvanceVotingMixin from pollingstations.models import AdvanceVotingStation class Command(BaseHalaroseCsvImporter, A...
Python
0.000066
cb89d8f0dd5fad8b5fc935639fc59a7317679001
Update master.chromium.webkit to use a dedicated mac builder.
masters/master.chromium.webkit/master_mac_latest_cfg.py
masters/master.chromium.webkit/master_mac_latest_cfg.py
# Copyright (c) 2012 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. from master import master_config from master.factory import chromium_factory defaults = {} helper = master_config.Helper(defaults) B = helper.Builder F...
# Copyright (c) 2012 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. from master import master_config from master.factory import chromium_factory defaults = {} helper = master_config.Helper(defaults) B = helper.Builder F...
Python
0.000002
b195e909ce3d3903998a91de0b5763dd679b25e3
fix version
debile/slave/runners/findbugs.py
debile/slave/runners/findbugs.py
# Copyright (c) 2012-2013 Paul Tagliamonte <paultag@debian.org> # Copyright (c) 2013 Leo Cavaille <leo@cavaille.net> # Copyright (c) 2013 Sylvestre Ledru <sylvestre@debian.org> # Copyright (c) 2015 Lucas Kanashiro <kanashiro.duarte@gmail.com> # # Permission is hereby granted, free of charge, to any person obtaining a #...
# Copyright (c) 2012-2013 Paul Tagliamonte <paultag@debian.org> # Copyright (c) 2013 Leo Cavaille <leo@cavaille.net> # Copyright (c) 2013 Sylvestre Ledru <sylvestre@debian.org> # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "So...
Python
0.004257
4e3e8d49b06c03b1ab31357206fc6385256d8438
Switch to official python graphviz port
graph/gengraph.py
graph/gengraph.py
#!/usr/bin/python import sys import gv class Gengraph(object): def __init__(self): pass def getTrName(self, line): line = line.strip(' ') name = line.split(' ') name.remove('tr_t') for n in name: if len(n) > 0: x = n.find('[') ...
#!/usr/bin/python import sys from graphviz import Digraph class Gengraph(object): def __init__(self): pass def getTrName(self, line): line = line.strip(' ') name = line.split(' ') name.remove('tr_t') for n in name: if len(n) > 0: x = n.find('...
Python
0
43125b7ea61606d6d65d0c75168539cee8cdfcd2
support touch-tip for JSON protocols (#2000)
api/opentrons/protocols/__init__.py
api/opentrons/protocols/__init__.py
import time from itertools import chain from opentrons import instruments, labware, robot from opentrons.instruments import pipette_config def _sleep(seconds): if not robot.is_simulating(): time.sleep(seconds) def load_pipettes(protocol_data): pipettes = protocol_data.get('pipettes', {}) pipette...
import time from itertools import chain from opentrons import instruments, labware, robot from opentrons.instruments import pipette_config def _sleep(seconds): if not robot.is_simulating(): time.sleep(seconds) def load_pipettes(protocol_data): pipettes = protocol_data.get('pipettes', {}) pipette...
Python
0
2d3e2f796d6a839994c2708f31e60d52c6bf8c15
Simplify main()
sjp.py
sjp.py
#!/usr/bin/env python3 import urllib.request # to download HTML source import sys # to access CLI arguments and to use exit codes from bs4 import BeautifulSoup # to parse HTML source version = 0.01 def printUsageInfo(): helpMsg = """Usage: sjp.py <word> sjp.py (-h | --help | /?) sjp.py (-v | --ve...
#!/usr/bin/env python3 import urllib.request # to download HTML source import sys # to access CLI arguments and to use exit codes from bs4 import BeautifulSoup # to parse HTML source version = 0.01 def printUsageInfo(): helpMsg = """Usage: sjp.py <word> sjp.py (-h | --help | /?) sjp.py (-v | --ve...
Python
0.000042
a78d1bcfdc3d979cd7be1f82345c29047993953d
Add more init logic to handle AWS HTTP API
sqs.py
sqs.py
#!/usr/bin/env python from tornado.httpclient import AsyncHTTPClient, HTTPRequest, HTTPClient from tornado.httputil import url_concat import datetime import hashlib import hmac class SQSRequest(HTTPRequest): """SQS AWS Adapter for Tornado HTTP request""" def __init__(self, *args, **kwargs): t = datet...
#!/usr/bin/env python from tornado.httpclient import AsyncHTTPClient, HTTPRequest, HTTPClient from tornado.httputil import url_concat import datetime import hashlib import hmac class SQSRequest(HTTPRequest): """SQS AWS Adapter for Tornado HTTP request""" def __init__(self, *args, **kwargs): t = datet...
Python
0
2166f52ce5da81bf8f28a3dbbc92145b0913db07
Update usage of layouts.get_layout
examples/basics/visuals/graph.py
examples/basics/visuals/graph.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2015, Vispy Development Team. # Distributed under the (new) BSD License. See LICENSE.txt for more info. """ This example demonstrates how to visualise a NetworkX graph using the GraphVisual. """ import sys import numpy as np import networkx as nx from vi...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2015, Vispy Development Team. # Distributed under the (new) BSD License. See LICENSE.txt for more info. """ This example demonstrates how to visualise a NetworkX graph using the GraphVisual. """ import sys import networkx as nx from vispy import app, glo...
Python
0.000001
e43aa23b3d4b7d3319e4b2766cdb4a9b9382954b
Fix typo
django_tricks/models/abstract.py
django_tricks/models/abstract.py
from uuid import uuid4 from django.db import models from .mixins import MPAwareModel treebeard = True try: from treebeard.mp_tree import MP_Node except ImportError: treebeard = False class UniqueTokenModel(models.Model): token = models.CharField(max_length=32, unique=True, blank=True) class Meta:...
from uuid import uuid4 from django.db import models from .mixins import MPAwareModel treebeard = True try: from treebeard.mp_tree import MP_Node except ImportError: treebeard = False class UniqueTokenModel(models.Model): token = models.CharField(max_length=32, unique=True, blank=True) class Meta:...
Python
0.999999
0a70a700f450c3c22ee0e7a32ffb57c29b823fe1
Exclude test/assembly on Windows
test/assembly/gyptest-assembly.py
test/assembly/gyptest-assembly.py
#!/usr/bin/env python # Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ A basic test of compiling assembler files. """ import sys import TestGyp if sys.platform != 'win32': # TODO(bradnelson): get this wo...
#!/usr/bin/env python # Copyright (c) 2009 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Verifies that .hpp files are ignored when included in the source list on all platforms. """ import sys import TestGyp # TODO(bradnelso...
Python
0.001267
492f769dd9b40bcf2b13379bdc5618def53832e2
replace namedtuples by more obvious Points as pair of x,y
xoi.py
xoi.py
#! /usr/bin/env python import sys import curses from curses import KEY_ENTER import time from collections import namedtuple KEY = "KEY" K_A = ord("a") K_D = ord("d") class Point: def __init__(self, x, y): self._x = x self._y = y @property def x(self): return self._x @x.sett...
#! /usr/bin/env python import sys import curses from curses import KEY_ENTER import time from collections import namedtuple KEY = "KEY" K_A = ord("a") K_D = ord("d") class Point: def __init__(self, x, y): self._x = x self._y = y @property def x(self): return self._x @x.sett...
Python
0.000386
86c45216633a3a273d04a64bc54ca1026b3d5069
Fix comment middleware
debreach/middleware.py
debreach/middleware.py
# -*- coding: utf-8 -*- from __future__ import unicode_literals import base64 import logging import random from Crypto.Cipher import AES from django.core.exceptions import SuspiciousOperation from debreach.compat import \ force_bytes, get_random_string, string_types, force_text log = logging.getLogger(__name__...
# -*- coding: utf-8 -*- from __future__ import unicode_literals import base64 import logging import random from Crypto.Cipher import AES from django.core.exceptions import SuspiciousOperation from debreach.compat import \ force_bytes, get_random_string, string_types, force_text log = logging.getLogger(__name__...
Python
0.000002
1e7bbd7b59abbe0bcb01fd98079a362f4f874d3b
Fix long waiting version number up
dedupsqlfs/__init__.py
dedupsqlfs/__init__.py
# -*- coding: utf8 -*- # Documentation. {{{1 """ This Python library implements a file system in user space using FUSE. It's called DedupFS because the file system's primary feature is deduplication, which enables it to store virtually unlimited copies of files because data is only stored once. In addition to dedupli...
# -*- coding: utf8 -*- # Documentation. {{{1 """ This Python library implements a file system in user space using FUSE. It's called DedupFS because the file system's primary feature is deduplication, which enables it to store virtually unlimited copies of files because data is only stored once. In addition to dedupli...
Python
0.000075
30100751f64e20804dce332fa458a8490be62336
Add the "interval" option to the raw_parameter_script example
examples/raw_parameter_script.py
examples/raw_parameter_script.py
""" The main purpose of this file is to demonstrate running SeleniumBase scripts without the use of Pytest by calling the script directly with Python or from a Python interactive interpreter. Based on whether relative imports work or don't, the script can autodetect how this file was run. With pure Pyth...
""" The main purpose of this file is to demonstrate running SeleniumBase scripts without the use of Pytest by calling the script directly with Python or from a Python interactive interpreter. Based on whether relative imports work or don't, the script can autodetect how this file was run. With pure Pyth...
Python
0.001246
b8b630c0f1bd53960c1f6bb275f25fecbca520ba
tweak output format.
import_profiler.py
import_profiler.py
import collections import time __OLD_IMPORT = None class ImportInfo(object): def __init__(self, name, context_name, counter): self.name = name self.context_name = context_name self._counter = counter self._depth = 0 self._start = time.time() self.elapsed = None ...
import collections import time __OLD_IMPORT = None class ImportInfo(object): def __init__(self, name, context_name, counter): self.name = name self.context_name = context_name self._counter = counter self._depth = 0 self._start = time.time() self.elapsed = None ...
Python
0
dd7b10a89e3fd5e431b03e922fbbc0a49c3d8c5e
Fix failing wavelet example due to outdated code
examples/trafos/wavelet_trafo.py
examples/trafos/wavelet_trafo.py
# Copyright 2014-2016 The ODL development group # # This file is part of ODL. # # ODL is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. #...
# Copyright 2014-2016 The ODL development group # # This file is part of ODL. # # ODL is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. #...
Python
0
5e86582ebde98f14df796102062659f185c2bcca
update docs/extensions/fancy_include.py with git_cast_file2repos.py
docs/extensions/fancy_include.py
docs/extensions/fancy_include.py
"""Include single scripts with doc string, code, and image Use case -------- There is an "examples" directory in the root of a repository, e.g. 'include_doc_code_img_path = "../examples"' in conf.py (default). An example is a file ("an_example.py") that consists of a doc string at the beginning of the file, the exampl...
"""Include single scripts with doc string, code, and image Use case -------- There is an "examples" directory in the root of a repository, e.g. 'include_doc_code_img_path = "../examples"' in conf.py (default). An example is a file ("an_example.py") that consists of a doc string at the beginning of the file, the exampl...
Python
0.000001
0d38b9592fbb63e25b080d2f17b690c478042455
Add comments to Perfect Game solution
google-code-jam-2012/perfect-game/perfect-game.py
google-code-jam-2012/perfect-game/perfect-game.py
#!/usr/bin/env python # expected time per attempt is given by equation # time = L[0] + (1-P[0])*L[1] + (1-P[0])*(1-P[1])*L[2] + ... # where L is the expected time and P is the probability of failure, per level # swap two levels if L[i]*P[i+1] > L[i+1]*P[i] import sys if len(sys.argv) < 2: sys.exit('Usage: %s file....
#!/usr/bin/env python import sys if len(sys.argv) < 2: sys.exit('Usage: %s file.in' % sys.argv[0]) file = open(sys.argv[1], 'r') T = int(file.readline()) for i in xrange(1, T+1): N = int(file.readline()) L = map(int, file.readline().split(' ')) P = map(int, file.readline().split(' ')) assert N == len(L)...
Python
0
9f9e2db5105eab1f46590a6b8d6a5b5eff4ccb51
Use new BinarySensorDeviceClass enum in egardia (#61378)
homeassistant/components/egardia/binary_sensor.py
homeassistant/components/egardia/binary_sensor.py
"""Interfaces with Egardia/Woonveilig alarm control panel.""" from homeassistant.components.binary_sensor import ( BinarySensorDeviceClass, BinarySensorEntity, ) from homeassistant.const import STATE_OFF, STATE_ON from . import ATTR_DISCOVER_DEVICES, EGARDIA_DEVICE EGARDIA_TYPE_TO_DEVICE_CLASS = { "IR Sen...
"""Interfaces with Egardia/Woonveilig alarm control panel.""" from homeassistant.components.binary_sensor import ( DEVICE_CLASS_MOTION, DEVICE_CLASS_OPENING, BinarySensorEntity, ) from homeassistant.const import STATE_OFF, STATE_ON from . import ATTR_DISCOVER_DEVICES, EGARDIA_DEVICE EGARDIA_TYPE_TO_DEVICE...
Python
0
568828287f426bef598c11267b6ee351751671fe
add conf parameters to XPathFetchPage module
feedin/modules/xpathfetchpage.py
feedin/modules/xpathfetchpage.py
from module import Module import urllib2 import urlparse from StringIO import StringIO import gzip from lxml import html from lxml import etree from feedin import util from feedin.dotdict2 import DotDict2 from module import ModuleBuilder class XPathFetchPage(Module): EXTRACT_TYPE_DICT = 'dict' EXTRACT_TYPE_T...
from module import Module import urllib2 import urlparse from StringIO import StringIO import gzip from lxml import html from lxml import etree from feedin import util from feedin.dotdict2 import DotDict2 from module import ModuleBuilder class XPathFetchPage(Module): EXTRACT_TYPE_DICT = 'dict' EXTRACT_TYPE_T...
Python
0
a4ee7fa5b77b4513ceddcfb0e9be958442d3c792
Use lambdas for api commands
IKEA.py
IKEA.py
import json import uuid from pytradfri import Gateway from pytradfri.api.libcoap_api import APIFactory from time import sleep import numpy CONFIG_FILE = "tradfri_psk.conf" class RGB(numpy.ndarray): @classmethod def from_str(cls, hex): return numpy.array([int(hex[i:i+2], 16) for i in (0, 2, 4)]).view(cls) ...
import json import uuid from pytradfri import Gateway from pytradfri.api.libcoap_api import APIFactory from time import sleep import numpy CONFIG_FILE = "tradfri_psk.conf" class RGB(numpy.ndarray): @classmethod def from_str(cls, hex): return numpy.array([int(hex[i:i+2], 16) for i in (0, 2, 4)]).view(cls) ...
Python
0.000001
ead5daf0e631a3482a8510abc36f48b227e862ee
Delete unused variable assignations.
game.py
game.py
# -*- coding: utf-8 -*- import functions.commands as command import functions.database as db f = open('ASCII/otsikko_unicode.asc', 'r') print(f.read()) f.close() while True: ''' You can end loop by selecting 5 in main context or write "quit" in game context. ''' context = command.doMenu() ...
# -*- coding: utf-8 -*- import functions.commands as command import functions.database as db prompt = ">>> " view = { '0.0' : "Tutorial. You see a rat attacking you, fight!", '1.0' : "You stand in a start of dungeon. You see a torch." } position = '1.0' f = open('ASCII/otsikko_unicode.asc', 'r') print(f.rea...
Python
0
760bc99c22b6ac66cdd240b29720d0bbfccc4920
Define waf_tools for each class instance separately
glue.py
glue.py
""" Glue code between nsloaders and Mybuild bindings for py/my DSL files. """ __author__ = "Eldar Abusalimov" __date__ = "2013-08-07" from _compat import * from nsloader import myfile from nsloader import pyfile import mybuild from mybuild.binding import pydsl from util.operator import attr from util.namespace im...
""" Glue code between nsloaders and Mybuild bindings for py/my DSL files. """ __author__ = "Eldar Abusalimov" __date__ = "2013-08-07" from _compat import * from nsloader import myfile from nsloader import pyfile import mybuild from mybuild.binding import pydsl from util.operator import attr from util.namespace im...
Python
0
5830843f88fc87e8c31f2983413acc16aa0c0711
remove typo
dv_apps/dataverse_auth/models.py
dv_apps/dataverse_auth/models.py
from django.db import models from datetime import datetime from django.utils.encoding import python_2_unicode_compatible class AuthenticatedUser(models.Model): useridentifier = models.CharField(unique=True, max_length=255) affiliation = models.CharField(max_length=255, blank=True, null=True) email = models...
from django.db import models from datetime import datetime from django.utils.encoding import python_2_unicode_compatible class AuthenticatedUser(models.Model): useridentifier = models.CharField(unique=True, max_length=255) affiliation = models.CharField(max_length=255, blank=True, null=True) email = models...
Python
0.999999
2d26d92956282be3f08cc3dcdb5fa16433822a1b
Change retry_if_fails to _retry_on_fail
Nyaa.py
Nyaa.py
from bs4 import BeautifulSoup import re import requests import sys def _retry_on_fail(req, *args, **kwargs): try: r = req(*args, **kwargs) if r.status_code not in range(100, 399): print('Connection error, retrying... (HTTP {})'.format(r.status_code), file=sys.stderr) return _retry_on_fail(req, *args, **kwar...
from bs4 import BeautifulSoup import re import requests import sys def retry_if_fails(req, *args, **kwargs): try: r = req(*args, **kwargs) if r.status_code not in range(100, 399): print('Connection error, retrying... (HTTP {})'.format(r.status_code), file=sys.stderr) return retry_if_fails(req, *args, **kwar...
Python
0.00177
10ceb00e249635868fb55c1ae1668ddb35b03bc3
Update demo
demo.py
demo.py
# -*- coding: utf-8 -*- from taiga import TaigaAPI from taiga.exceptions import TaigaException api = TaigaAPI( host='http://127.0.0.1:8000' ) api.auth( username='admin', password='123123' ) print (api.me()) new_project = api.projects.create('TEST PROJECT', 'TESTING API') new_project.name = 'TEST PROJE...
# -*- coding: utf-8 -*- from taiga import TaigaAPI api = TaigaAPI( host='http://127.0.0.1:8000' ) api.auth( username='admin', password='123123' ) print (api.me()) new_project = api.projects.create('TEST PROJECT', 'TESTING API') new_project.name = 'TEST PROJECT 3' new_project.update() jan_feb_mileston...
Python
0.000001
fc187d9b8822fe446561dc4724c7f123da3d550f
Fix query for auto-adding to board by domain
hasjob/tagging.py
hasjob/tagging.py
# -*- coding: utf-8 -*- from collections import defaultdict from urlparse import urljoin import requests from flask.ext.rq import job from coaster.utils import text_blocks from coaster.nlp import extract_named_entities from . import app from .models import (db, JobPost, JobLocation, Board, BoardDomain, BoardLocation, ...
# -*- coding: utf-8 -*- from collections import defaultdict from urlparse import urljoin import requests from flask.ext.rq import job from coaster.utils import text_blocks from coaster.nlp import extract_named_entities from . import app from .models import (db, JobPost, JobLocation, Board, BoardDomain, BoardLocation, ...
Python
0.000031
7692c4210289af68ad7952ddca89f70d250a26ed
Change base_directory location
great_expectations/data_context/datasource/pandas_source.py
great_expectations/data_context/datasource/pandas_source.py
import pandas as pd import os from .datasource import Datasource from .filesystem_path_generator import FilesystemPathGenerator from ...dataset.pandas_dataset import PandasDataset class PandasCSVDatasource(Datasource): """ A PandasDataSource makes it easy to create, manage and validate expectations on Pan...
import pandas as pd import os from .datasource import Datasource from .filesystem_path_generator import FilesystemPathGenerator from ...dataset.pandas_dataset import PandasDataset class PandasCSVDatasource(Datasource): """ A PandasDataSource makes it easy to create, manage and validate expectations on Pan...
Python
0.000002
b69289c62a5be3a523b4d32aec2b6d790dc95f0d
Add compare functions
amit.py
amit.py
import hashlib, ssdeep def hash_ssdeep(inbytes): return ssdeep.hash(inbytes) def hash_md5(inbytes): m = hashlib.md5() m.update(inbytes) return m.hexdigest() def hash_sha1(inbytes): m = hashlib.sha1() m.update(inbytes) return m.hexdigest() def hash_sha256(inbytes): m = hashlib.sha256() m.update(inbytes) re...
import hashlib, ssdeep def hash_ssdeep(inbytes): return ssdeep.hash(inbytes) def hash_md5(inbytes): m = hashlib.md5() m.update(inbytes) return m.hexdigest() def hash_sha1(inbytes): m = hashlib.sha1() m.update(inbytes) return m.hexdigest() def hash_sha256(inbytes): m = hashlib.sha256() m.update(inbytes) re...
Python
0.000001
37c63790bd5fef64823ada0d40b6a1e18607c567
Task for finding ROI
dodo.py
dodo.py
"""PyDoIt file for automating tasks.""" import glob #from doit.tools import Interactive from doit.tools import create_folder #from doit.tools import result_dep DOIT_CONFIG = { 'default_tasks': [], 'verbosity': 2, } DWILIB = '~/src/dwilib' PMAP = DWILIB+'/pmap.py' ANON = DWILIB+'/anonymize_dicom.py' FIND...
"""PyDoIt file for automating tasks.""" import glob #from doit.tools import Interactive from doit.tools import create_folder #from doit.tools import result_dep DOIT_CONFIG = { 'default_tasks': [], 'verbosity': 2, } DWILIB = '~/src/dwilib' PMAP = DWILIB+'/pmap.py' ANON = DWILIB+'/anonymize_dicom.py' MODE...
Python
0.999833
d5e41dfaff393a0649336ef92d7b7917a7e0122d
fix allowed_hosts settings bug
hours/settings.py
hours/settings.py
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os BASE_DIR = os.path.dirname(os.path.dirname(__file__)) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ # SECRET_KEY will be automatically generated an...
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os BASE_DIR = os.path.dirname(os.path.dirname(__file__)) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/ # SECRET_KEY will be automatically generated an...
Python
0.000001
5a38e5924409e887430ee4366c81ebc2b94152a5
add trackers registration
plenum/server/database_manager.py
plenum/server/database_manager.py
from typing import Dict, Optional from common.exceptions import LogicError from plenum.common.constants import BLS_LABEL, TS_LABEL, IDR_CACHE_LABEL, ATTRIB_LABEL from plenum.common.ledger import Ledger from state.state import State class DatabaseManager(): def __init__(self): self.databases = {} # type:...
from typing import Dict, Optional from common.exceptions import LogicError from plenum.common.constants import BLS_LABEL, TS_LABEL, IDR_CACHE_LABEL, ATTRIB_LABEL from plenum.common.ledger import Ledger from state.state import State class DatabaseManager(): def __init__(self): self.databases = {} # type:...
Python
0
8c4590e19c7b39fe6562671f7d63651e736ffa49
debug print
controllers/admin/admin_migration_controller.py
controllers/admin/admin_migration_controller.py
import os from google.appengine.ext import ndb from google.appengine.ext import deferred from google.appengine.ext.webapp import template from controllers.base_controller import LoggedInHandler from models.event import Event from helpers.match_manipulator import MatchManipulator def add_year(event_key): logging.inf...
import os from google.appengine.ext import ndb from google.appengine.ext import deferred from google.appengine.ext.webapp import template from controllers.base_controller import LoggedInHandler from models.event import Event from helpers.match_manipulator import MatchManipulator def add_year(event_key): matches = e...
Python
0.000003
895dfda101665e0f70e96d549443f9fe777de1e7
Add support for multiple urls per method, auto create method routers
hug/decorators.py
hug/decorators.py
from functools import wraps, partial from collections import OrderedDict import sys from hug.run import server import hug.output_format from falcon import HTTP_METHODS, HTTP_BAD_REQUEST def call(urls, accept=HTTP_METHODS, output=hug.output_format.json, example=None): if isinstance(urls, str): urls = (url...
from functools import wraps from collections import OrderedDict import sys from hug.run import server import hug.output_format from falcon import HTTP_METHODS, HTTP_BAD_REQUEST def call(url, accept=HTTP_METHODS, output=hug.output_format.json): def decorator(api_function): module = sys.modules[api_functio...
Python
0
66dd418d481bfc5d3d910823856bdcea8d304a87
allow to pass a different root-path
hwaf-cmtcompat.py
hwaf-cmtcompat.py
# -*- python -*- # stdlib imports import os import os.path as osp import sys # waf imports --- import waflib.Options import waflib.Utils import waflib.Logs as msg from waflib.Configure import conf _heptooldir = osp.dirname(osp.abspath(__file__)) # add this directory to sys.path to ease the loading of other hepwaf to...
# -*- python -*- # stdlib imports import os import os.path as osp import sys # waf imports --- import waflib.Options import waflib.Utils import waflib.Logs as msg from waflib.Configure import conf _heptooldir = osp.dirname(osp.abspath(__file__)) # add this directory to sys.path to ease the loading of other hepwaf to...
Python
0.000002
70ea214d8e258e4e7c95b9ba7948dde13e28a878
Make screengrab_torture_test test more functions
desktopmagic/scripts/screengrab_torture_test.py
desktopmagic/scripts/screengrab_torture_test.py
from desktopmagic.screengrab_win32 import GrabFailed, getScreenAsImage, getDisplaysAsImages, getRectAsImage def main(): print """\ This program helps you test whether screengrab_win32 has memory leaks and other problems. It takes a screenshot repeatedly and discards it. Open Task Manager and make sure Physical Memo...
from desktopmagic.screengrab_win32 import GrabFailed, getScreenAsImage def main(): print """\ This program helps you test whether screengrab_win32 has memory leaks and other problems. It takes a screenshot repeatedly and discards it. Open Task Manager and make sure Physical Memory % is not ballooning. Memory leaks ...
Python
0.000007
9d1dc9c2c649bd117c2cd38cf664e34820f387ea
update docstring in fwhm.py
fwhm.py
fwhm.py
import numpy as np def fwhm(x,y, silence = False): maxVal = np.max(y) maxVal50 = 0.5*maxVal if not silence: print "Max: " + str(maxVal) #this is to detect if there are multiple values biggerCondition = [a > maxVal50 for a in y] changePoints = [] freqPoints = [] for k in ...
import numpy as np def fwhm(x,y, silence = False): maxVal = np.max(y) maxVal50 = 0.5*maxVal if not silence: print "Max: " + str(maxVal) #this is to detect if there are multiple values biggerCondition = [a > maxVal50 for a in y] changePoints = [] freqPoints = [] for k in ...
Python
0
161a1cdddd79df7126d6adf1117d51e679d1746c
Change --command option in "docker" to a positional argument
dodo_commands/extra/standard_commands/docker.py
dodo_commands/extra/standard_commands/docker.py
"""This command opens a bash shell in the docker container.""" from . import DodoCommand class Command(DodoCommand): # noqa decorators = ["docker", ] def add_arguments_imp(self, parser): # noqa parser.add_argument('command', nargs='?') def handle_imp(self, command, **kwargs): # noqa ...
"""This command opens a bash shell in the docker container.""" from . import DodoCommand class Command(DodoCommand): # noqa decorators = ["docker", ] def add_arguments_imp(self, parser): # noqa parser.add_argument('--command', default="") def handle_imp(self, command, **kwargs): # noqa ...
Python
0.000001
36063d227f7cd3ededdc99b23b0c7911f2233df2
Add available params in metering labels client's comment
tempest/lib/services/network/metering_labels_client.py
tempest/lib/services/network/metering_labels_client.py
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # d...
Python
0.000016
93870690f17a4baddeb33549a1f6c67eeee1abe0
Increase cache tile duration from 6 hours to 1 week
src/adhocracy/lib/tiles/util.py
src/adhocracy/lib/tiles/util.py
import logging from time import time from pylons import tmpl_context as c from adhocracy import config from adhocracy.lib.cache import memoize log = logging.getLogger(__name__) class BaseTile(object): ''' Base class for tiles ''' def render_tile(template_name, def_name, tile, cached=False, **kwargs):...
import logging from time import time from pylons import tmpl_context as c from adhocracy import config from adhocracy.lib.cache import memoize log = logging.getLogger(__name__) class BaseTile(object): ''' Base class for tiles ''' def render_tile(template_name, def_name, tile, cached=False, **kwargs):...
Python
0
d5691c8031a32e0cfadc74e9fffad8a9e04bc63c
enable search navbar entry in production
portal/base/context_processors.py
portal/base/context_processors.py
from django.conf import settings def search_disabled(request): """Facility for disabling search functionality. This may be used in the future to automatically disable search if the search backend goes down. """ return dict(SEARCH_DISABLED=False) # return dict(SEARCH_DISABLED=not settings.DEBUG...
from django.conf import settings def search_disabled(request): """Facility for disabling search functionality. This may be used in the future to automatically disable search if the search backend goes down. """ return dict(SEARCH_DISABLED=not settings.DEBUG)
Python
0
87b9910a30cb915f5b99a17b0b49570b0027e665
load help module
gbot.py
gbot.py
#!/usr/bin/env python # ============================================================================= # file = gbot.py # description = IRC bot # author = GR <https://github.com/shortdudey123> # create_date = 2014-07-09 # mod_date = 2014-07-09 # version = 0.1 # usage = called as a class # notes = # python_ver = 2.7.6 # ...
#!/usr/bin/env python # ============================================================================= # file = gbot.py # description = IRC bot # author = GR <https://github.com/shortdudey123> # create_date = 2014-07-09 # mod_date = 2014-07-09 # version = 0.1 # usage = called as a class # notes = # python_ver = 2.7.6 # ...
Python
0.000001
9f5afd72bf6dbb44ba764f6731c6313f0cb94bce
Use default outputs in shortcuts/utils.py
prompt_toolkit/shortcuts/utils.py
prompt_toolkit/shortcuts/utils.py
from __future__ import unicode_literals from prompt_toolkit.output.defaults import get_default_output from prompt_toolkit.renderer import print_formatted_text as renderer_print_formatted_text from prompt_toolkit.styles import default_style, BaseStyle import six __all__ = ( 'print_formatted_text', 'clear', ...
from __future__ import unicode_literals from prompt_toolkit.output.defaults import create_output from prompt_toolkit.renderer import print_formatted_text as renderer_print_formatted_text from prompt_toolkit.styles import default_style, BaseStyle import six __all__ = ( 'print_formatted_text', 'clear', 'set_...
Python
0.000001
2c350cbbd90afaab38223fdfe40737f72bf7974a
Set --device-type as required arg for harvest_tracking_email command.
tracking/management/commands/harvest_tracking_email.py
tracking/management/commands/harvest_tracking_email.py
from django.core.management.base import BaseCommand from tracking.harvest import harvest_tracking_email class Command(BaseCommand): help = "Runs harvest_tracking_email to harvest points from emails" def add_arguments(self, parser): parser.add_argument( '--device-type', action='store', des...
from django.core.management.base import BaseCommand from tracking.harvest import harvest_tracking_email class Command(BaseCommand): help = "Runs harvest_tracking_email to harvest points from emails" def add_arguments(self, parser): parser.add_argument( '--device-type', action='store', des...
Python
0
4b148d5b6fda0a8b44109e2024f61df30b981938
Add docstrings.
HARK/datasets/cpi/us/CPITools.py
HARK/datasets/cpi/us/CPITools.py
# -*- coding: utf-8 -*- """ Created on Wed Jan 20 18:07:41 2021 @author: Mateo """ import urllib.request import pandas as pd import warnings import numpy as np def download_cpi_series(): """ A method that downloads the cpi research series file directly from the bls site onto the working directory. This is...
# -*- coding: utf-8 -*- """ Created on Wed Jan 20 18:07:41 2021 @author: Mateo """ import urllib.request import pandas as pd import warnings import numpy as np def download_cpi_series(): urllib.request.urlretrieve("https://www.bls.gov/cpi/research-series/r-cpi-u-rs-allitems.xlsx", ...
Python
0
4d247da1ecd39bcd699a55b5387412a1ac9e1582
Split Energy and Environment, change Civil Liberties to Social Justice
txlege84/topics/management/commands/bootstraptopics.py
txlege84/topics/management/commands/bootstraptopics.py
from django.core.management.base import BaseCommand from topics.models import Topic class Command(BaseCommand): help = u'Bootstrap the topic lists in the database.' def handle(self, *args, **kwargs): self.load_topics() def load_topics(self): self.stdout.write(u'Loading hot list topics.....
from django.core.management.base import BaseCommand from topics.models import Topic class Command(BaseCommand): help = u'Bootstrap the topic lists in the database.' def handle(self, *args, **kwargs): self.load_topics() def load_topics(self): self.stdout.write(u'Loading hot list topics.....
Python
0
2bf756404700f4c38e2f3895dfa8aba2d8dc13be
Refactor and remove char2int
hash.py
hash.py
class HashTable(object): """docstring for HashTable""" table_size = 0 entries_count = 0 alphabet_size = 52 def __init__(self, size=1024): self.table_size = size self.hashtable = [[] for i in range(size)] def __repr__(self): return "<HashTable: {}>".format(self.hashtab...
class HashTable(object): """docstring for HashTable""" table_size = 0 entries_count = 0 alphabet_size = 52 def __init__(self, size=1024): self.table_size = size self.hashtable = [[] for i in range(size)] def __repr__(self): return "<HashTable: {}>".format(self.hashtab...
Python
0.000002
3af8cfa40a6770e6940ec7140c92ad51532a4e73
improve re usage
IPython/core/magics/packaging.py
IPython/core/magics/packaging.py
"""Implementation of packaging-related magic functions. """ #----------------------------------------------------------------------------- # Copyright (c) 2018 The IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with ...
"""Implementation of packaging-related magic functions. """ #----------------------------------------------------------------------------- # Copyright (c) 2018 The IPython Development Team. # # Distributed under the terms of the Modified BSD License. # # The full license is in the file COPYING.txt, distributed with ...
Python
0
3039149ca20e9c472340495e4130e331d9c546b3
Fix nums assignment properly
calc.py
calc.py
import sys def add_all(nums): return sum(nums) def multiply_all(nums): return reduce(lambda a, b: a*b, nums) if __name__ == '__main__': command =sys.argv[1] nums=map(float, sys.argv[2:]) if command=='add': print add_all(nums) if command=='multiply': print multiply_all(nums)
import sys def add_all(nums): return sum(nums) def multiply_all(nums): return reduce(lambda a, b: a*b, nums) if __name__ == '__main__': command =sys.argv[1] nums=map(float(sys.argv[2:])) if command=='add': print add_all(nums) if command=='multiply': print multiply_all(nums)
Python
0.000001
fd8caec8567178abe09abc810f1e96bfc4bb531b
Fix bug in 'multiply' support
calc.py
calc.py
import sys def add_all(nums): return sum(nums) def multiply_all(nums): return reduce(lambda a, b: a * b, nums) if __name__== '__main__': command = sys.argv[1] nums = map(float, sys.argv[2:]) if command == 'add': print(add_all(nums)) elif command == 'multiply': print(multiply_all(nums))
import sys def add_all(nums): return sum(nums) def multiply_all(nums): return reduce(lambda a, b: a * b, nums) if __name__== '__main__': command = sys.argv[1] nums = map(float, sys.argv[2:]) if command == 'add': print(add_all(nums)) elif command == 'multiply': print(multiply_all(sums))
Python
0.000001
c3ba924c5fe3fef3f2dd43a9f43eacdebb8d8c13
Make the new init script executable
init.py
init.py
#!/usr/bin/env python3 """Wurstminebot init script. Usage: init.py start | stop | restart | status init.py -h | --help init.py --version Options: -h, --help Print this message and exit. --version Print version info and exit. """ from docopt import docopt import os import os.path import signal import sub...
#!/usr/bin/env python3 """Wurstminebot init script. Usage: init.py start | stop | restart | status init.py -h | --help init.py --version Options: -h, --help Print this message and exit. --version Print version info and exit. """ from docopt import docopt import os import os.path import signal import sub...
Python
0.00001
183448b17cfd910444d3807da80ef8549622fce4
test the urltopath
init.py
init.py
import yumoter yumoter = yumoter.yumoter('config/repos.json', '/home/aarwine/git/yumoter/repos') yumoter.loadRepos("6.4", "wildwest") a = yumoter._returnNewestByNameArch(["openssl"]) a = a[0] print a print "name", a.name print "arch", a.arch print "epoch", a.epoch print "version", a.version print "release", a.release...
import yumoter yumoter = yumoter.yumoter('config/repos.json', '/home/aarwine/git/yumoter/repos') yumoter.loadRepos("6.4", "wildwest") a = yumoter._returnNewestByNameArch(["openssl"]) a = a[0] print a print "name", a.name print "arch", a.arch print "epoch", a.epoch print "version", a.version print "release", a.release...
Python
0.000018
27543f73244c7312ea511c7e00d9eecf7b7525e9
store model in self.model
cost.py
cost.py
""" Cost classes: classes that encapsulate the cost evaluation for the DAE training criterion. """ # Standard library imports from itertools import izip # Third-party imports from theano import tensor class SupervisedCost(object): """ A cost object is allocated in the same fashion as other objects in this...
""" Cost classes: classes that encapsulate the cost evaluation for the DAE training criterion. """ # Standard library imports from itertools import izip # Third-party imports from theano import tensor class SupervisedCost(object): """ A cost object is allocated in the same fashion as other objects in this...
Python
0.000001
a04b18b8fbc8626b5592593a2b6ce635921a1e34
Delete text after entered, but this time actually do it
data.py
data.py
from twitter import * from tkinter import * def showTweets(x, num): # display a number of new tweets and usernames for i in range(0, num): line1 = (x[i]['user']['screen_name']) line2 = (x[i]['text']) w = Label(master, text=line1 + "\n" + line2 + "\n\n") w.pack() def getTweets(...
from twitter import * from tkinter import * def showTweets(x, num): # display a number of new tweets and usernames for i in range(0, num): line1 = (x[i]['user']['screen_name']) line2 = (x[i]['text']) w = Label(master, text=line1 + "\n" + line2 + "\n\n") w.pack() def getTweets(...
Python
0.000002
2b12019b0e6b5881e38d48cc7981936fe5e7c81d
Fix a bug with info pages
shortener/links/views.py
shortener/links/views.py
from django.db.models import Q from django.http import Http404 from django.shortcuts import get_object_or_404 from django.utils.baseconv import base64 from django.utils import timezone from django.views.generic import RedirectView, ListView, DetailView from .models import Link from linkmetrics.models import LinkLog ...
from django.db.models import Q from django.http import Http404 from django.shortcuts import get_object_or_404 from django.utils.baseconv import base64 from django.utils import timezone from django.views.generic import RedirectView, ListView, DetailView from .models import Link from linkmetrics.models import LinkLog ...
Python
0.000002
2ecdd27d96da12bf44a5751b7d76cedf05c1e620
don't remove all whitespace
scripts/DYKChecker.py
scripts/DYKChecker.py
# -*- coding: utf-8 -*- """DYKChecker!""" __version__ = "1.0.1" __author__ = "Sorawee Porncharoenwase" import json import init import wp import pywikibot from wp import lre def glob(): pass def main(): page = wp.Page(wp.toutf(raw_input())) dic = {} while True: try: text = p...
# -*- coding: utf-8 -*- """DYKChecker!""" __version__ = "1.0.1" __author__ = "Sorawee Porncharoenwase" import json import init import wp import pywikibot from wp import lre def glob(): pass def main(): page = wp.Page(wp.toutf(raw_input())) dic = {} while True: try: text = p...
Python
0.689513
5c5de666e86d6f2627df79762b0e3b0f188861d4
Fix timestamp comparison on ciresources
scripts/claim_vlan.py
scripts/claim_vlan.py
import MySQLdb from datetime import datetime, timedelta db = MySQLdb.connect(host="10.0.196.2", user="ciuser", passwd="secret", db="ciresources") cur = db.cursor() f = '%Y-%m-%d %H:%M:%S' three_hours_ago_dt = datetime.utcnow() - timedelta(hours=3) three_...
import MySQLdb from datetime import datetime, timedelta db = MySQLdb.connect(host="10.0.196.2", user="ciuser", passwd="secret", db="ciresources") cur = db.cursor() f = '%Y-%m-%d %H:%M:%S' three_hours_ago_dt = datetime.utcnow() - timedelta(hours=3) three_...
Python
0.000049
efc3a2c31a00a2139f55ca5ce9f3cf4dac1dea1f
address comments
tests/debug_nans_test.py
tests/debug_nans_test.py
# 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
Python
0
eee6dd8f6d7555f97452fb5734e299203b337ace
Fix fast_classifier
tests/fast_classifier.py
tests/fast_classifier.py
import numpy as np class fast_classifier(object): def __init__(self): pass def train(self, features, labels): examples = {} for f,lab in zip(features, labels): if lab not in examples: examples[lab] = f return fast_model(examples) class fast_model(obj...
import numpy as np class fast_classifier(object): def __init__(self): pass def train(self, features, labels): examples = {} for f,lab in zip(features, labels): if lab not in examples: examples[lab] = f return fast_model(examples) class fast_model(obj...
Python
0
83a15b47ecac219c2fe4ca1e49cfa9055f9197d2
Add some tests
tests/test_features.py
tests/test_features.py
from unittest import mock, TestCase from unleash_client import features class TestFactory(TestCase): def test_simple_case(self): strategies = {'Foo': mock.Mock(return_value='R')} feature = {'strategies': [{'name': 'Foo', 'parameters': {'x': 0}}]} result = features.feature_gates(strategie...
Python
0.000008
2b8b32605c9d211154f47d228038464ff5df7b56
fix import
tests/test_kernel32.py
tests/test_kernel32.py
import os from pywincffi.core.ffi import ffi from pywincffi.core.testutil import TestCase from pywincffi.exceptions import WindowsAPIError from pywincffi.kernel32.process import ( PROCESS_QUERY_LIMITED_INFORMATION, OpenProcess) class TestOpenProcess(TestCase): """ Tests for :func:`pywincffi.kernel32.Open...
import os from pywincffi.core.ffi import ffi from pywincffi.core.testutil import TestCase from pywincffi.exceptions import WindowsAPIError from pywincffi.kernel32 import PROCESS_QUERY_LIMITED_INFORMATION, OpenProcess class TestOpenProcess(TestCase): """ Tests for :func:`pywincffi.kernel32.OpenProcess` ""...
Python
0.000001
b1edd17b647766091eab44d730b79ec52c8cb50d
Add tests for project points
tests/test_projects.py
tests/test_projects.py
from taiga.requestmaker import RequestMaker, RequestMakerException from taiga.models.base import InstanceResource, ListResource from taiga.models import User, Point, UserStoryStatus, Severity, Project, Projects from taiga import TaigaAPI import taiga.exceptions import json import requests import unittest from mock impo...
from taiga.requestmaker import RequestMaker, RequestMakerException from taiga.models.base import InstanceResource, ListResource from taiga.models import User, Point, UserStoryStatus, Severity, Project, Projects from taiga import TaigaAPI import taiga.exceptions import json import requests import unittest from mock impo...
Python
0
224abc99becc1683605a6dc5c3460510efef3efb
Comment out the pyserial TestIsCorrectVariant test.
tests/test_pyserial.py
tests/test_pyserial.py
from __future__ import (absolute_import, print_function, unicode_literals) import os import sys lib_path = os.path.abspath('../') sys.path.append(lib_path) import io import struct import unittest import threading import time import serial try: import unittest2 as unittest except ImportError: import unittest ...
from __future__ import (absolute_import, print_function, unicode_literals) import os import sys lib_path = os.path.abspath('../') sys.path.append(lib_path) import io import struct import unittest import threading import time import serial try: import unittest2 as unittest except ImportError: import unittest ...
Python
0
c9cb5955320a779a7128e082d7ebf347a8f3e5e4
Add missing import
tests/test_add_target.py
tests/test_add_target.py
""" Tests for helper function for adding a target to a Vuforia database. """ import io from typing import Optional import pytest from mock_vws import MockVWS from vws import VWS class TestAddTarget: """ Tests for adding a target. """ def test_add_target( self, client: VWS, ...
""" Tests for helper function for adding a target to a Vuforia database. """ import io import pytest from mock_vws import MockVWS from vws import VWS class TestAddTarget: """ Tests for adding a target. """ def test_add_target( self, client: VWS, high_quality_image: io.Bytes...
Python
0.000466
bb89223a7fcc1f2562c55ca432a3c52eec6efd8a
Put everything in one method like we discussed.
tests/test_background.py
tests/test_background.py
import unittest import numpy.testing as testing import numpy as np import fitsio from redmapper.background import Background class BackgroundTestCase(unittest.TestCase): def runTest(self): file_name, file_path = 'test_bkg.fit', 'data' # test that we fail if we try a non-existent file self...
import unittest import numpy.testing as testing import numpy as np import fitsio import redmapper class BackgroundTestCase(unittest.TestCase): def test_io(self): pass def test_sigma_g(self): inputs = [()] idl_outputs = [0.32197464, 6.4165196, 0.0032830855, 1.4605126, ...
Python
0
80c1275899045bfd50efa9b436ada7672c09e783
use md5 password hasher to speed up the tests
tests/test_settings.py
tests/test_settings.py
SECRET_KEY = 'fake-key' INSTALLED_APPS = [ 'tests', ] DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', } } PASSWORD_HASHERS = ( 'django.contrib.auth.hashers.MD5PasswordHasher', )
SECRET_KEY = 'fake-key' INSTALLED_APPS = [ 'tests', ] DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', } }
Python
0
0d825461c5c28ce451092783937fe95171c243bd
Add full deprecated test
tests/test_deprecated.py
tests/test_deprecated.py
""" SPDX-FileCopyrightText: 2019 oemof developer group <contact@oemof.org> SPDX-License-Identifier: MIT """ import warnings import pytest from windpowerlib.data import load_turbine_data_from_oedb from windpowerlib.wind_turbine import get_turbine_types def test_old_import(): msg = "Use >>from windpowerlib impor...
""" SPDX-FileCopyrightText: 2019 oemof developer group <contact@oemof.org> SPDX-License-Identifier: MIT """ import warnings import pytest from windpowerlib.data import load_turbine_data_from_oedb from windpowerlib.wind_turbine import get_turbine_types def test_old_import(): msg = "Use >>from windpowerlib impor...
Python
0.000001
ca40822d7898d02272cdf0a52fa5a8b75b983930
Fix syntax errors in addpost test
tests/tests/addpost.py
tests/tests/addpost.py
import binascii import os import sqlalchemy import selenium from selenium.webdriver.common import keys from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions from selenium.webdriver.common.by import By from timpani import database LOGIN_TITLE = "Login - Timpa...
import binascii import os import sqlalchemy import selenium from selenium.webdriver.common import keys from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions from selenium.webdriver.common.by import By from timpani import database LOGIN_TITLE = "Login - Timpa...
Python
0.000004
72351a1ebff21777f71d93a1f5647482b98d3448
Fix text.
tests/test_formatters.py
tests/test_formatters.py
import json import random import unittest from exporters.exceptions import ConfigurationError from exporters.export_formatter.base_export_formatter import BaseExportFormatter from exporters.export_formatter.csv_export_formatter import CSVExportFormatter from exporters.export_formatter.json_export_formatter import JsonE...
import json import random import unittest from exporters.exceptions import ConfigurationError from exporters.export_formatter.base_export_formatter import BaseExportFormatter from exporters.export_formatter.csv_export_formatter import CSVExportFormatter from exporters.export_formatter.json_export_formatter import JsonE...
Python
0.999999
8288619fcb4aa44cd5d293dd9421d190d6c57e98
Simplify pytest fixture [ci skip]
tests/test_formatting.py
tests/test_formatting.py
"""Test entry formatting and printing.""" import bibpy import pytest @pytest.fixture def test_entries(): return bibpy.read_file('tests/data/simple_1.bib', 'biblatex').entries @pytest.mark.skip def test_formatting(test_entries): print(test_entries[0].format()) assert test_entries[0].format(align=True, ...
"""Test entry formatting and printing.""" import bibpy import pytest @pytest.fixture def test_entries(): entries, _, _, _, _ = bibpy.read_file('tests/data/simple_1.bib', 'biblatex') return entries @pytest.mark.skip def test_formatting(test_entries): print(test_...
Python
0
a9f2ad660d0b1e4443785cc5fb0c9afd0b1ce660
Update test_ica_lingam.py
tests/test_ica_lingam.py
tests/test_ica_lingam.py
import numpy as np import pandas as pd from lingam.ica_lingam import ICALiNGAM def test_fit_success(): # causal direction: x0 --> x1 --> x3 x0 = np.random.uniform(size=1000) x1 = 2.0 * x0 + np.random.uniform(size=1000) x2 = np.random.uniform(size=1000) x3 = 4.0 * x1 + np.random.uniform(size=1000) ...
import numpy as np import pandas as pd from lingam.ica_lingam import ICALiNGAM def test_fit_success(): # causal direction: x0 --> x1 --> x3 x0 = np.random.uniform(size=1000) x1 = 2.0 * x0 + np.random.uniform(size=1000) x2 = np.random.uniform(size=1000) x3 = 4.0 * x1 + np.random.uniform(size=1000) ...
Python
0.000001
1be562eb115f302bd7fe47c2a90c5d4796a0eb98
make slider example more sophisticated
examples/plotting/file/slider.py
examples/plotting/file/slider.py
from bokeh.io import vform from bokeh.plotting import figure, hplot, output_file, show, vplot, ColumnDataSource from bokeh.models.actions import Callback from bokeh.models.widgets import Slider import numpy as np x = np.linspace(0, 10, 500) y = np.sin(x) source = ColumnDataSource(data=dict(x=x, y=y)) plot = figur...
from bokeh.plotting import figure, output_file, show, vplot, ColumnDataSource from bokeh.models.actions import Callback from bokeh.models.widgets import Slider import numpy as np x = np.linspace(0, 10, 100) y = np.sin(x) source = ColumnDataSource(data=dict(x=x, y=y, y_orig=y)) plot = figure(y_range=(-20, 20)) plot...
Python
0
feb095effbe4cd92f253e7d5b68baf5b215056ef
Update views.py
examples/quickhowto/app/views.py
examples/quickhowto/app/views.py
from flask.ext.appbuilder.menu import Menu from flask.ext.appbuilder.baseapp import BaseApp from flask.ext.appbuilder.models.datamodel import SQLAModel from flask.ext.appbuilder.views import GeneralView from flask.ext.appbuilder.charts.views import ChartView, TimeChartView from app import app, db from models import Gr...
from flask.ext.appbuilder.menu import Menu from flask.ext.appbuilder.baseapp import BaseApp from flask.ext.appbuilder.models.datamodel import SQLAModel from flask.ext.appbuilder.views import GeneralView from flask.ext.appbuilder.charts.views import ChartView, TimeChartView from app import app, db from models import Gr...
Python
0
f37846159a379922954b76736719c9683fed7541
add HTTPError __str__
framework/exceptions/__init__.py
framework/exceptions/__init__.py
# -*- coding: utf-8 -*- '''Custom exceptions for the framework.''' import copy import httplib as http from flask import request class FrameworkError(Exception): """Base class from which framework-related errors inherit.""" pass class HTTPError(FrameworkError): error_msgs = { http.BAD_REQUEST: { ...
# -*- coding: utf-8 -*- '''Custom exceptions for the framework.''' import copy import httplib as http from flask import request class FrameworkError(Exception): """Base class from which framework-related errors inherit.""" pass class HTTPError(FrameworkError): error_msgs = { http.BAD_REQUEST: { ...
Python
0.000124
08c29fcae3c622b0f47a0b73338b372ddcee42eb
support py2
utils/search.py
utils/search.py
#!/usr/bin/env python """ Filter tweet JSON based on a regular expression to apply to the text of the tweet. search.py <regex> file1 Or if you want a case insensitive match: search.py -i <regex> file1 """ from __future__ import print_function import re import sys import json import argparse import filei...
#!/usr/bin/env python """ Filter tweet JSON based on a regular expression to apply to the text of the tweet. search.py <regex> file1 Or if you want a case insensitive match: search.py -i <regex> file1 """ import re import sys import json import argparse import fileinput from twarc import json2csv if le...
Python
0
4dc1552bbbdbfb060eb4559c5cded6a5c8e8fd02
Migrate kythe for Bazel 0.27 (#3769)
kythe/cxx/tools/fyi/testdata/compile_commands.bzl
kythe/cxx/tools/fyi/testdata/compile_commands.bzl
"""Rule for generating compile_commands.json.in with appropriate inlcude directories.""" load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain") _TEMPLATE = """ {{ "directory": "OUT_DIR", "command": "clang++ -c {filename} -std=c++11 -Wall -Werror -I. -IBASE_DIR {system_includes}", "file...
"""Rule for generating compile_commands.json.in with appropriate inlcude directories.""" load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain") _TEMPLATE = """ {{ "directory": "OUT_DIR", "command": "clang++ -c {filename} -std=c++11 -Wall -Werror -I. -IBASE_DIR {system_includes}", "file...
Python
0
d003765047a8a6796e28531a28ba1364950ccd27
Remove request.POST save - incompatible with DRF v3.6.3.
lms/djangoapps/bulk_enroll/views.py
lms/djangoapps/bulk_enroll/views.py
""" API views for Bulk Enrollment """ import json from edx_rest_framework_extensions.authentication import JwtAuthentication from rest_framework import status from rest_framework.response import Response from rest_framework.views import APIView from bulk_enroll.serializers import BulkEnrollmentSerializer from enrollme...
""" API views for Bulk Enrollment """ import json from edx_rest_framework_extensions.authentication import JwtAuthentication from rest_framework import status from rest_framework.response import Response from rest_framework.views import APIView from bulk_enroll.serializers import BulkEnrollmentSerializer from enrollme...
Python
0
cabae8d7732cca922e3fb56db205e41a20186aa3
Remove markdown
DataCleaning/data_cleaning.py
DataCleaning/data_cleaning.py
# -*- coding: utf-8 -*- """ Script for Importing data from MySQL database and cleaning """ import os import pymysql import pandas as pd from bs4 import BeautifulSoup from ftfy import fix_text ## Getting Data # Changing directory os.chdir("") # Running the file containing MySQL information execfile("connection_config...
# -*- coding: utf-8 -*- """ Script for Importing data from MySQL database and cleaning """ import os import pymysql import pandas as pd from bs4 import BeautifulSoup from ftfy import fix_text ## Getting Data # Changing directory os.chdir("") # Running the file containing MySQL information execfile("connection_config...
Python
0.000033
abcae974229dc28a60f78b706f7cd4070bc530fa
update doc
lib/ansible/modules/windows/win_feature.py
lib/ansible/modules/windows/win_feature.py
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2014, Paul Durivage <paul.durivage@rackspace.com>, Trond Hindenes <trond@hindenes.com> and others # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by #...
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2014, Paul Durivage <paul.durivage@rackspace.com>, Trond Hindenes <trond@hindenes.com> and others # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by #...
Python
0
23b56303d3afa4764d7fa4f4d82eafbaf57d0341
Update the version number
ailib/__init__.py
ailib/__init__.py
# PyAI # The MIT License # # Copyright (c) 2014,2015,2016,2017 Jeremie DECOCK (http://www.jdhp.org) # # 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 l...
# PyAI # The MIT License # # Copyright (c) 2014,2015,2016,2017 Jeremie DECOCK (http://www.jdhp.org) # # 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 l...
Python
0.000045
4fb02e4bdf4af30826a00dadc4883cd2d9922541
Fix type errors, move from partial to explicit connector function
aiosqlite/core.py
aiosqlite/core.py
# Copyright 2017 John Reese # Licensed under the MIT license import asyncio import logging import sqlite3 from concurrent.futures import ThreadPoolExecutor from functools import partial from typing import Any, Callable, Iterable __all__ = [ 'connect', 'Connection', 'Cursor', ] Log = logging.getLogger('a...
# Copyright 2017 John Reese # Licensed under the MIT license import asyncio import logging import sqlite3 from concurrent.futures import ThreadPoolExecutor from functools import partial from typing import Any, Callable, Iterable __all__ = [ 'connect', 'Connection', 'Cursor', ] Log = logging.getLogger('a...
Python
0
d2cfc7f2fefcb9a317ab3cd18ebc8785fb764d9f
remove last bang
lib/exabgp/bgp/message/open/capability/refresh.py
lib/exabgp/bgp/message/open/capability/refresh.py
# encoding: utf-8 """ refresh.py Created by Thomas Mangin on 2012-07-17. Copyright (c) 2012 Exa Networks. All rights reserved. """ # =================================================================== RouteRefresh class RouteRefresh (list): def __str__ (self): return "Route Refresh (unparsed)" def extract (self...
#!/usr/bin/env python # encoding: utf-8 """ refresh.py Created by Thomas Mangin on 2012-07-17. Copyright (c) 2012 Exa Networks. All rights reserved. """ # =================================================================== RouteRefresh class RouteRefresh (list): def __str__ (self): return "Route Refresh (unparsed...
Python
0.008047
4fa4fb3f583e787da9594ac8a714a22981842c71
remove now-bogus test
pydoctor/test/test_commandline.py
pydoctor/test/test_commandline.py
from pydoctor import driver import sys, cStringIO def geterrtext(*options): options = list(options) se = sys.stderr f = cStringIO.StringIO() print options sys.stderr = f try: try: driver.main(options) except SystemExit: pass else: asse...
from pydoctor import driver import sys, cStringIO def geterrtext(*options): options = list(options) se = sys.stderr f = cStringIO.StringIO() print options sys.stderr = f try: try: driver.main(options) except SystemExit: pass else: asse...
Python
0.000005
2d8a3b4dfbd9cfb6c5368c1b4a04e2bd07e97f18
Add Big O time complexity
pygorithm/data_structures/heap.py
pygorithm/data_structures/heap.py
# Author: ALLSTON MICKEY # Contributed: OMKAR PATHAK # Created On: 11th August 2017 from queue import Queue # min-heap implementation as priority queue class Heap(Queue): def parent_idx(self, idx): return idx / 2 def left_child_idx(self, idx): return (idx * 2) + 1 def right_child_idx(sel...
# Author: ALLSTON MICKEY # Contributed: OMKAR PATHAK # Created On: 11th August 2017 from queue import Queue # min-heap implementation as priority queue class Heap(Queue): def parent_idx(self, idx): return idx / 2 def left_child_idx(self, idx): return (idx * 2) + 1 def right_child_idx(sel...
Python
0.000056
579904c318031ed049f697f89109bd6909b68eba
Revise docstring
alg_merge_sort.py
alg_merge_sort.py
from __future__ import absolute_import from __future__ import print_function from __future__ import division def _merge_recur(x_list, y_list): """Merge two sorted lists by Recusions.""" if len(x_list) == 0: return y_list if len(y_list) == 0: return x_list if x_list[0] <= y_list[0]: ...
from __future__ import absolute_import from __future__ import print_function from __future__ import division def _merge_recur(x_list, y_list): """Merge two sorted lists by recusions.""" if len(x_list) == 0: return y_list if len(y_list) == 0: return x_list if x_list[0] <= y_list[0]: ...
Python
0.000009
c94f24160e1d9189f13ea0029cccb815fb68d3da
Update postag.py
pythainlp/wangchanberta/postag.py
pythainlp/wangchanberta/postag.py
from typing import Dict, List, Tuple, Union import re from transformers import ( CamembertTokenizer, AutoTokenizer, pipeline, ) _model_name = "wangchanberta-base-att-spm-uncased" _tokenizer = CamembertTokenizer.from_pretrained( f'airesearch/{_model_name}', revision='main') if _model_name ==...
from typing import Dict, List, Tuple, Union import re from transformers import ( CamembertTokenizer, AutoTokenizer, pipeline, ) _model_name = "wangchanberta-base-att-spm-uncased" _tokenizer = CamembertTokenizer.from_pretrained( f'airesearch/{_model_name}', revision='main') if _model_name ==...
Python
0
2c5a345aa7e21045d6a76225dc192f14b62db4f6
fix review permission manage command
symposion/reviews/management/commands/create_review_permissions.py
symposion/reviews/management/commands/create_review_permissions.py
from django.core.management.base import BaseCommand from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType from symposion.proposals.models import ProposalSection class Command(BaseCommand): def handle(self, *args, **options): ct = ContentType.object...
from django.core.management.base import BaseCommand from django.contrib.auth.models import Permission from django.contrib.contenttypes.models import ContentType from symposion.proposals.models import ProposalSection class Command(BaseCommand): def handle(self, *args, **options): ct, created = ContentTy...
Python
0
c8398415bf82a1f68c7654c8d4992661587fccf7
Update pathlib-recursive-rmdir.py
python/pathlib-recursive-rmdir.py
python/pathlib-recursive-rmdir.py
import pathlib # path: pathlib.Path - directory to remove def removeDirectory(path): for i in path.glob('*'): if i.is_dir(): removeDirectory(i) else: i.unlink() # NOTE: can replace above lines with `removeConents(path)` scrap form pathlib-recursive-remove-contents path.rmdir()
import pathlib # path: pathlib.Path - directory to remove def removeDirectory(path): for i in path.glob('*'): if i.is_dir(): removeDirectory(i) else: i.unlink() path.rmdir()
Python
0.000001
e718615eac8e964b46ded826e68fe1087ee33f09
set DEBUG to False (oops)
frontend/fifoci/settings/base.py
frontend/fifoci/settings/base.py
# This file is part of the FifoCI project. # Copyright (c) 2014 Pierre Bourdon <delroth@dolphin-emu.org> # Licensing information: see $REPO_ROOT/LICENSE """ Django settings for fifoci project. For more information on this file, see https://docs.djangoproject.com/en/dev/topics/settings/ For the full list of settings ...
# This file is part of the FifoCI project. # Copyright (c) 2014 Pierre Bourdon <delroth@dolphin-emu.org> # Licensing information: see $REPO_ROOT/LICENSE """ Django settings for fifoci project. For more information on this file, see https://docs.djangoproject.com/en/dev/topics/settings/ For the full list of settings ...
Python
0.000014
7668331e7cc4f5e2a310fcddcb3f90af4c18bb30
add Python 3 compatibility imports to capabilities.py
python/pywatchman/capabilities.py
python/pywatchman/capabilities.py
# Copyright 2015 Facebook, Inc. # All rights reserved. # # 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, # this list of conditions and the f...
# Copyright 2015 Facebook, Inc. # All rights reserved. # # 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, # this list of conditions and the f...
Python
0
97545d3055a0e0044723e0cb4b7ffd7803d1dbd5
Make class constants.
qipipe/staging/airc_collection.py
qipipe/staging/airc_collection.py
import re from .staging_error import StagingError __all__ = ['with_name'] EXTENT = {} """A name => collection dictionary for all supported AIRC collections.""" def collection_with_name(name): """ @param name: the OHSU QIN collection name @return: the corresponding AIRC collection """ return EXTEN...
import re from .staging_error import StagingError __all__ = ['with_name'] EXTENT = {} """A name => collection dictionary for all supported AIRC collections.""" def collection_with_name(name): """ @param name: the OHSU QIN collection name @return: the corresponding AIRC collection """ return EXTEN...
Python
0
ed263e083dcb49bdd3f2d6cc707008cb5fe8ce1b
remove account.reconcile before deleting a account.move
account_statement_ext/account.py
account_statement_ext/account.py
# -*- coding: utf-8 -*- ############################################################################## # # Author: Joel Grand-Guillaume # Copyright 2011-2012 Camptocamp SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License a...
# -*- coding: utf-8 -*- ############################################################################## # # Author: Joel Grand-Guillaume # Copyright 2011-2012 Camptocamp SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License a...
Python
0
55373ddcf68641ec0654b58b8471c01e749366f9
Use a single redis client object for the module
tinman/handlers/redis.py
tinman/handlers/redis.py
"""The RedisRequestHandler uses tornado-redis to support Redis. It will auto-establish a single redis connection when initializing the connection. """ import logging import tornadoredis from tornado import web LOGGER = logging.getLogger(__name__) redis_client = None class RedisRequestHandler(web.RequestHandler): ...
"""The RedisRequestHandler uses tornado-redis to support Redis. It will auto-establish a single redis connection when initializing the connection. """ import logging import tornadoredis from tornado import web LOGGER = logging.getLogger(__name__) class RedisRequestHandler(web.RequestHandler): """This request ha...
Python
0
10766f6f0e66ed3fbe5c6ec23d81926076129163
delete test code
jellyblog/views.py
jellyblog/views.py
from django.shortcuts import render, get_object_or_404, redirect from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from .models import Category, Document def sorted_category(): return_category = list(Category.objects.all()) childList = [] for category in return_category: if ...
from django.shortcuts import render, get_object_or_404, redirect from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from .models import Category, Document def sorted_category(): return_category = list(Category.objects.all()) childList = [] for category in return_category: if ...
Python
0.000001
65972062c03133a79ff77d90f8a11fd16f7d16ff
Correct column name
luigi/tasks/rfam/pgload_go_term_mapping.py
luigi/tasks/rfam/pgload_go_term_mapping.py
# -*- coding: utf-8 -*- """ Copyright [2009-2017] EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless requir...
# -*- coding: utf-8 -*- """ Copyright [2009-2017] EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless requir...
Python
0
a9aad224d6875e774cd0f7db7e30965ea6a3fbdc
Fix simple typo: taget -> target (#591)
algorithms/search/jump_search.py
algorithms/search/jump_search.py
import math def jump_search(arr,target): """Jump Search Worst-case Complexity: O(√n) (root(n)) All items in list must be sorted like binary search Find block that contains target value and search it linearly in that block It returns a first target value in array reference:...
import math def jump_search(arr,target): """Jump Search Worst-case Complexity: O(√n) (root(n)) All items in list must be sorted like binary search Find block that contains target value and search it linearly in that block It returns a first target value in array reference:...
Python
0.999977