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 |
|---|---|---|---|---|---|---|---|
5de02410d6a1b78b8ac5f2c6fed6d119a76565a5 | Remove print statement | agenda/events/templatetags/calendar.py | agenda/events/templatetags/calendar.py | #
# Copyright (C) 2009 Novopia Solutions Inc.
#
# Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@nov
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License,... | #
# Copyright (C) 2009 Novopia Solutions Inc.
#
# Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@nov
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License,... | Python | 0.007015 |
7847d22f95f44792e35108af24267161411c5bf1 | Remove settings override with no effect | analytical/tests/test_tag_gosquared.py | analytical/tests/test_tag_gosquared.py | """
Tests for the GoSquared template tags and filters.
"""
from django.contrib.auth.models import User, AnonymousUser
from django.http import HttpRequest
from django.template import Context
from django.test.utils import override_settings
from analytical.templatetags.gosquared import GoSquaredNode
from analytical.test... | """
Tests for the GoSquared template tags and filters.
"""
from django.contrib.auth.models import User, AnonymousUser
from django.http import HttpRequest
from django.template import Context
from django.test.utils import override_settings
from analytical.templatetags.gosquared import GoSquaredNode
from analytical.test... | Python | 0 |
8713f44fbd35f012ac7e01a64cffcfdf846fee9f | Remove a relative import that escaped test.test_importlib. | Lib/test/test_importlib/__init__.py | Lib/test/test_importlib/__init__.py | import os
import sys
from test import support
import unittest
def test_suite(package=__package__, directory=os.path.dirname(__file__)):
suite = unittest.TestSuite()
for name in os.listdir(directory):
if name.startswith(('.', '__')):
continue
path = os.path.join(directory, name)
... | import os
import sys
from .. import support
import unittest
def test_suite(package=__package__, directory=os.path.dirname(__file__)):
suite = unittest.TestSuite()
for name in os.listdir(directory):
if name.startswith(('.', '__')):
continue
path = os.path.join(directory, name)
... | Python | 0 |
4d597a8e71c0020b0f1d36e1cca64b5a353b0643 | modify version | Abe/version.py | Abe/version.py | __version__ = '0.88'
| __version__ = '0.8pre'
| Python | 0 |
8c7abe561cd95331fef17b4fd1c7fe67386826a2 | change the input url | AddDataTest.py | AddDataTest.py | __author__ = 'chuqiao'
import EventsPortal
from datetime import datetime
import logging
def logger():
"""
Function that initialises logging system
"""
global logger
# create logger with 'syncsolr'
logger = logging.getLogger('adddata')
logger.setLevel(logging.DEBUG)
# specifies the ... | __author__ = 'chuqiao'
import EventsPortal
from datetime import datetime
import logging
def logger():
"""
Function that initialises logging system
"""
global logger
# create logger with 'syncsolr'
logger = logging.getLogger('adddata')
logger.setLevel(logging.DEBUG)
# specifies the ... | Python | 0.999997 |
d98cdb7eae40b5bb11b5d1fc0eacc35ef6bf310d | Order filter for report page | wye/reports/views.py | wye/reports/views.py | from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from wye.organisations.models import Organisation
from wye.workshops.models import Workshop
from wye.profiles.models import Profile
import datetime
from wye.base.constants import WorkshopStatus
@login_required
def index(requ... | from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from wye.organisations.models import Organisation
from wye.workshops.models import Workshop
from wye.profiles.models import Profile
import datetime
from wye.base.constants import WorkshopStatus
@login_required
def index(requ... | Python | 0 |
0403ba1bcbc1089f42cdb0ed7a37439363f4e963 | Fix bug | reid/utils/data/dataset.py | reid/utils/data/dataset.py | from __future__ import print_function
import os.path as osp
import numpy as np
from ..serialization import read_json
def _pluck(identities, indices, relabel=False):
ret = []
for index, pid in enumerate(indices):
pid_images = identities[pid]
for camid, cam_images in enumerate(pid_images):
... | from __future__ import print_function
import os.path as osp
import numpy as np
from ..serialization import read_json
def _pluck(identities, indices, relabel=False):
ret = []
for index, pid in enumerate(indices):
pid_images = identities[pid]
for camid, cam_images in enumerate(pid_images):
... | Python | 0.000001 |
af669e8ab8a502505389adf63e0d5216765fdba4 | fix exclude events | viradacultural_social_api/views.py | viradacultural_social_api/views.py | from rest_framework import viewsets
from rest_framework import generics
from rest_framework.views import APIView
from rest_framework.response import Response
from .models import FbUser, Event
from .serializer import FbUserSerializer
from rest_framework import permissions
import facebook
class MinhaViradaView(APIView)... | from rest_framework import viewsets
from rest_framework import generics
from rest_framework.views import APIView
from rest_framework.response import Response
from .models import FbUser, Event
from .serializer import FbUserSerializer
from rest_framework import permissions
import facebook
class MinhaViradaView(APIView)... | Python | 0.000024 |
10f7938e37180c0cb3b701223cf6d1855e7d8f93 | Drop python_2_unicode_compatible for Settings, fix docs build on rtfd | watchdog_kj_kultura/main/models.py | watchdog_kj_kultura/main/models.py | from django.db import models
from django.utils.translation import ugettext_lazy as _
from model_utils.models import TimeStampedModel
from tinymce.models import HTMLField
from django.contrib.sites.models import Site
class SettingsQuerySet(models.QuerySet):
pass
class Settings(TimeStampedModel):
site = models... | from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible
from model_utils.models import TimeStampedModel
from tinymce.models import HTMLField
from django.contrib.sites.models import Site
class SettingsQuerySet(models.QuerySet):
... | Python | 0 |
5f8580e9d28d08e13f40692a2247f41ea8c5b4b9 | Remove extra newline. | tests/test_additional_io.py | tests/test_additional_io.py | __author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>"
__date__ = "$Jul 28, 2014 11:50:37 EDT$"
import nanshe.nanshe.additional_io
class TestAdditionalIO(object):
num_files = 10
def setup(self):
import tempfile
self.temp_dir = tempfile.mkdtemp()
self.temp_files = []
for ... | __author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>"
__date__ = "$Jul 28, 2014 11:50:37 EDT$"
import nanshe.nanshe.additional_io
class TestAdditionalIO(object):
num_files = 10
def setup(self):
import tempfile
self.temp_dir = tempfile.mkdtemp()
self.temp_files = []
for ... | Python | 0 |
db06f101a07f0e122c35e8b662ed4fe6a26c4811 | Add SkipTest to test_content_disposition | tests/test_awss3_storage.py | tests/test_awss3_storage.py | import os
import uuid
import mock
import requests
from nose import SkipTest
from depot._compat import PY2
S3Storage = None
FILE_CONTENT = b'HELLO WORLD'
class TestS3FileStorage(object):
def setup(self):
try:
global S3Storage
from depot.io.awss3 import S3Storage
except ... | import os
import uuid
import mock
import requests
from nose import SkipTest
from depot._compat import PY2
S3Storage = None
FILE_CONTENT = b'HELLO WORLD'
class TestS3FileStorage(object):
def setup(self):
try:
global S3Storage
from depot.io.awss3 import S3Storage
except ... | Python | 0.000001 |
1b11207f40d956267ae046bc51313a3cccc4776a | Fix typo in cdl filename | cdl_parser.py | cdl_parser.py | #!/usr/bin/env python
"""
Class to load and parse Common Data Language (CDL) files and
tokenize the dimensions and variables
Written by Brian Powell on 04/30/13
Copyright (c)2013 University of Hawaii under the BSD-License.
"""
from __future__ import print_function
import datetime
import re
def cdl_parser(fil... | #!/usr/bin/env python
"""
Class to load and parse Common Data Language (CDL) files and
tokenize the dimensions and variables
Written by Brian Powell on 04/30/13
Copyright (c)2013 University of Hawaii under the BSD-License.
"""
from __future__ import print_function
import datetime
import re
def cdl_parser(fil... | Python | 0.997939 |
10e2638b8bafb15f66deb4a9ca442593a0ab52f2 | test fix | tests/test_core/test_ffi.py | tests/test_core/test_ffi.py | from textwrap import dedent
from os.path import dirname, join
try:
from unittest.mock import Mock, patch
except ImportError:
from mock import Mock, patch
from cffi import FFI
from pywincffi.core.ffi import Library
from pywincffi.core.testutil import TestCase
from pywincffi.exceptions import ResourceNotFoundE... | from textwrap import dedent
from os.path import dirname, join
try:
from unittest.mock import Mock, patch
except ImportError:
from mock import Mock, patch
from cffi import FFI
from pywincffi.core.ffi import Library
from pywincffi.core.testutil import TestCase
from pywincffi.exceptions import ResourceNotFoundE... | Python | 0.000001 |
78c3e6b7b3a12d74416f43995d50b04bdb817f0b | Fix test failure | tests/test_pkg_resources.py | tests/test_pkg_resources.py | import sys
import tempfile
import os
import zipfile
import pkg_resources
try:
unicode
except NameError:
unicode = str
class EggRemover(unicode):
def __call__(self):
if self in sys.path:
sys.path.remove(self)
if os.path.exists(self):
os.remove(self)
class TestZipPr... | import sys
import tempfile
import os
import zipfile
import pkg_resources
try:
unicode
except NameError:
unicode = str
class EggRemover(unicode):
def __call__(self):
if self in sys.path:
sys.path.remove(self)
if os.path.exists(self):
os.remove(self)
class TestZipPr... | Python | 0.000128 |
f356adde3cb4776ad0a34b47be54a6e14972ce17 | Improve Python 3.x compatibility | tests/unit/test_excutils.py | tests/unit/test_excutils.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012, Red Hat, 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
#
... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012, Red Hat, 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
#
... | Python | 0.000022 |
514064ce5a0bc7d3ecab10d1b810e5b751ed79af | update supported thumbnail types | contrib/frontends/django/nntpchan/nntpchan/thumbnail.py | contrib/frontends/django/nntpchan/nntpchan/thumbnail.py | from django.conf import settings
import subprocess
import os
img_ext = ['png', 'jpg', 'jpeg', 'gif', 'webp', 'ico']
vid_ext = ['mp4', 'webm', 'm4v', 'ogv', 'avi', 'txt']
def generate(fname, tname, placeholder):
"""
generate thumbnail
"""
ext = fname.split('.')[-1]
cmd = None
if ext in img_ext:
... | from django.conf import settings
import subprocess
import os
img_ext = ['png', 'jpg', 'jpeg', 'gif', 'webp', 'ico', 'pdf', 'ps']
vid_ext = ['mp4', 'webm', 'm4v', 'ogv', 'avi', 'txt']
def generate(fname, tname, placeholder):
"""
generate thumbnail
"""
ext = fname.split('.')[-1]
cmd = None
if ext... | Python | 0 |
d9204f19287060e1a88dfd1ac6072cd81eab5fe4 | add a validation mode | parse_aurinfo.py | parse_aurinfo.py | #!/usr/bin/env python
from copy import deepcopy
import pprint
import sys
MULTIVALUED_ATTRS = set([
'arch',
'groups',
'makedepends',
'checkdepends',
'optdepends',
'depends',
'provides',
'conflicts',
'replaces',
'options',
'license',
'source',
'noextract',
'backup... | #!/usr/bin/env python
from copy import deepcopy
import pprint
MULTIVALUED_ATTRS = set([
'arch',
'groups',
'makedepends',
'checkdepends',
'optdepends',
'depends',
'provides',
'conflicts',
'replaces',
'options',
'license',
'source',
'noextract',
'backup',
])
def ... | Python | 0.000005 |
31c70f509a849de98e0327902c48bdfcb8bd99a9 | fix another off by one with blur | pendulum_demo.py | pendulum_demo.py | #!/usr/bin/env python
import sys
import math
import time
import StringIO
from PIL import Image
import scipy.constants
from mathics.world import World
from mathics.viewport import Viewport
from mathics.machines import Pendulum, Timer, Point, Vector
def serve_gif(frames, duration, nq=0):
from PIL import Image
... | #!/usr/bin/env python
import sys
import math
import time
import StringIO
from PIL import Image
import scipy.constants
from mathics.world import World
from mathics.viewport import Viewport
from mathics.machines import Pendulum, Timer, Point, Vector
def serve_gif(frames, duration, nq=0):
from PIL import Image
... | Python | 0.000001 |
14b473fc1b3a084a22c3e1ef37e2589d91650b2f | Add td_includes argument to allow more flexible relative include paths for td files. | third_party/mlir/tblgen.bzl | third_party/mlir/tblgen.bzl | """BUILD extensions for MLIR table generation."""
def gentbl(name, tblgen, td_file, tbl_outs, td_srcs = [], td_includes = [], strip_include_prefix = None):
"""gentbl() generates tabular code from a table definition file.
Args:
name: The name of the build rule for use in dependencies.
tblgen: The b... | """BUILD extensions for MLIR table generation."""
def gentbl(name, tblgen, td_file, tbl_outs, td_srcs = [], strip_include_prefix = None):
"""gentbl() generates tabular code from a table definition file.
Args:
name: The name of the build rule for use in dependencies.
tblgen: The binary used to prod... | Python | 0 |
9920f7f8bab741146b436c864fb1ff4682a4bda9 | Use a bigger buffer | tile-hash-proxy/__init__.py | tile-hash-proxy/__init__.py | import SimpleHTTPServer
import SocketServer
import requests
import md5
def calc_hash_terrain(s):
# When Ian built the hash for terrain tiles he used the path without
# the leading slash and the first 6 chars of the hex digest instead of 5
m = md5.new()
m.update(s[1:])
md5_hash = m.hexdigest()
... | import SimpleHTTPServer
import SocketServer
import requests
import md5
def calc_hash_terrain(s):
# When Ian built the hash for terrain tiles he used the path without
# the leading slash and the first 6 chars of the hex digest instead of 5
m = md5.new()
m.update(s[1:])
md5_hash = m.hexdigest()
... | Python | 0.000051 |
45b778c637d263208699a16ba926f0da10d5b0f4 | Fix incorrect behaviour with check.py | tmc/exercise_tests/check.py | tmc/exercise_tests/check.py | import re
import xml.etree.ElementTree as ET
from os import path
from tmc.exercise_tests.basetest import BaseTest, TestResult
class CheckTest(BaseTest):
def __init__(self):
super().__init__("Check")
def applies_to(self, exercise):
return path.isfile(path.join(exercise.path(), "Makefile"))
... | import re
import xml.etree.ElementTree as ET
from os import path
from tmc.exercise_tests.basetest import BaseTest, TestResult
class CheckTest(BaseTest):
def __init__(self):
super().__init__("Check")
def applies_to(self, exercise):
return path.isfile(path.join(exercise.path(), "Makefile"))
... | Python | 0.000001 |
6fc67196062dcfbf6d14679e3c735bdcd27ca5a2 | add one file type in basic mode | HomeworkCleaner.py | HomeworkCleaner.py | #! D:\Python33\python.exe
# -*- coding: utf-8 -*-
# Module : HomeworkCleaner.py
# Author : bss
# Project : TA
# State :
# Creation Date : 2014-12-26
# Last modified: 2015-01-02 11:56:12
# Description :
#
import os
import zipfile
g_basicList = ['obj','tlog','pdb','ilk','idb','log','las... | #! D:\Python33\python.exe
# -*- coding: utf-8 -*-
# Module : HomeworkCleaner.py
# Author : bss
# Project : TA
# State :
# Creation Date : 2014-12-26
# Last modified: 2014-12-29 17:44:18
# Description :
#
import os
import zipfile
g_basicList = ['obj','tlog','pdb','ilk','idb','log','las... | Python | 0.000001 |
85aa5449a040247a6156801e88857048a7db6dd5 | update revnum | IPython/Release.py | IPython/Release.py | # -*- coding: utf-8 -*-
"""Release data for the IPython project.
$Id: Release.py 2446 2007-06-14 22:30:58Z vivainio $"""
#*****************************************************************************
# Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
#
# Copyright (c) 2001 Janko Hauser <jhause... | # -*- coding: utf-8 -*-
"""Release data for the IPython project.
$Id: Release.py 2409 2007-05-28 18:45:23Z vivainio $"""
#*****************************************************************************
# Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
#
# Copyright (c) 2001 Janko Hauser <jhause... | Python | 0.000001 |
5e409ec1d8d53cd3005022ff090043a9e5f5cb31 | Update nyan.py | NyanCheck/nyan.py | NyanCheck/nyan.py | #!/usr/bin/python3
from gi.repository import Gtk
from gi.repository import GObject
import webbrowser
import urllib.request
import re
def getNyan():
USER_AGENT = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36"
r = urllib.request.Request("http://nyanyan.it/", h... | #!/usr/bin/python3
from gi.repository import Gtk
from gi.repository import GObject
import webbrowser
import urllib.request
import re
def getNyan():
USER_AGENT = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36"
r = urllib.request.Request("http://nyanyan.it/", h... | Python | 0.000001 |
992dc795d1f7c7ef670832a5144b7e72a9374af8 | update test_forms | wizard_builder/tests/test_forms.py | wizard_builder/tests/test_forms.py | from django.test import TestCase
from .. import managers
class FormSerializationTest(TestCase):
manager = managers.FormManager
fixtures = [
'wizard_builder_data',
]
expected_data = [{
'descriptive_text': 'answer wisely',
'field_id': 'question_2',
'id': 2,
'page... | from django.test import TestCase
from .. import managers
class FormSerializationTest(TestCase):
manager = managers.FormManager
fixtures = [
'wizard_builder_data',
]
expected_data = [{
'descriptive_text': 'answer wisely',
'field_id': 'question_2',
'id': 2,
'page... | Python | 0.000001 |
a9465bcfe387a3eb8ba730eeda5285be079044d3 | test cleanup | wizard_builder/tests/test_views.py | wizard_builder/tests/test_views.py | from unittest import mock
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import TestCase
from .. import view_helpers
class ViewTest(TestCase):
fixtures = [
'wizard_builder_data',
]
@classmethod
def setUpClass(cls):
settings.SITE_ID = 1... | from unittest import mock
from django.conf import settings
from django.core.urlresolvers import reverse
from django.test import TestCase
from .. import view_helpers
class ViewTest(TestCase):
fixtures = [
'wizard_builder_data',
]
@classmethod
def setUpClass(cls):
settings.SITE_ID = 1... | Python | 0.000001 |
17d12027929365e8ebcc69c32642068cc6208678 | Decode stdout in shell.run_cmd | powerline/lib/shell.py | powerline/lib/shell.py | # vim:fileencoding=utf-8:noet
from subprocess import Popen, PIPE
from locale import getlocale, getdefaultlocale, LC_MESSAGES
def run_cmd(pl, cmd, stdin=None):
try:
p = Popen(cmd, stdout=PIPE, stdin=PIPE)
except OSError as e:
pl.exception('Could not execute command ({0}): {1}', e, cmd)
return None
else:
st... | # vim:fileencoding=utf-8:noet
from subprocess import Popen, PIPE
def run_cmd(pl, cmd, stdin=None):
try:
p = Popen(cmd, stdout=PIPE, stdin=PIPE)
except OSError as e:
pl.exception('Could not execute command ({0}): {1}', e, cmd)
return None
else:
stdout, err = p.communicate(stdin)
return stdout.strip()
de... | Python | 0.999042 |
12b806a0c68ceb146eed3b4a9406f36e9f930ba6 | Fix bug with closing socket without creating it again. | rl-rc-car/sensor_client.py | rl-rc-car/sensor_client.py | """
This is used to gather our readings from the remote sensor server.
http://ilab.cs.byu.edu/python/socket/echoclient.html
"""
import socket
import numpy as np
import time
class SensorClient:
def __init__(self, host='192.168.2.9', port=8888, size=1024):
self.host = host
self.port = port
... | """
This is used to gather our readings from the remote sensor server.
http://ilab.cs.byu.edu/python/socket/echoclient.html
"""
import socket
import numpy as np
import time
class SensorClient:
def __init__(self, host='192.168.2.9', port=8888, size=1024):
self.host = host
self.port = port
... | Python | 0 |
a45d744a73c4ac54990854655dfec7e57df67eb4 | Add the device keyword to the array creation functions | numpy/_array_api/creation_functions.py | numpy/_array_api/creation_functions.py | def arange(start, /, *, stop=None, step=1, dtype=None, device=None):
from .. import arange
if device is not None:
# Note: Device support is not yet implemented on ndarray
raise NotImplementedError("Device support is not yet implemented")
return arange(start, stop=stop, step=step, dtype=dtype... | def arange(start, /, *, stop=None, step=1, dtype=None):
from .. import arange
return arange(start, stop=stop, step=step, dtype=dtype)
def empty(shape, /, *, dtype=None):
from .. import empty
return empty(shape, dtype=dtype)
def empty_like(x, /, *, dtype=None):
from .. import empty_like
return ... | Python | 0.000004 |
8dcb778c62c3c6722e2f6dabfd97f6f75c349e62 | Set celery max tasks child to 1 | celery_cgi.py | celery_cgi.py | import os
import logging
from celery import Celery
from temp_config.set_environment import DeployEnv
runtime_env = DeployEnv()
runtime_env.load_deployment_environment()
redis_server = os.environ.get('REDIS_HOSTNAME')
redis_port = os.environ.get('REDIS_PORT')
celery_tasks = [
'hms_flask.modules.hms_controller',
... | import os
import logging
from celery import Celery
from temp_config.set_environment import DeployEnv
runtime_env = DeployEnv()
runtime_env.load_deployment_environment()
redis_server = os.environ.get('REDIS_HOSTNAME')
redis_port = os.environ.get('REDIS_PORT')
celery_tasks = [
'hms_flask.modules.hms_controller',
... | Python | 0.999855 |
c82219ea0a651b01d7b9dd91286450e8ecab8fef | Make sure we clean up correctly after failed thrift connection | elasticsearch/connection/thrift.py | elasticsearch/connection/thrift.py | from __future__ import absolute_import
import time
try:
from .esthrift import Rest
from .esthrift.ttypes import Method, RestRequest
from thrift.transport import TTransport, TSocket, TSSLSocket
from thrift.protocol import TBinaryProtocol
from thrift.Thrift import TException
THRIFT_AVAILABLE = T... | from __future__ import absolute_import
import time
try:
from .esthrift import Rest
from .esthrift.ttypes import Method, RestRequest
from thrift.transport import TTransport, TSocket, TSSLSocket
from thrift.protocol import TBinaryProtocol
from thrift.Thrift import TException
THRIFT_AVAILABLE = T... | Python | 0 |
3d6fcb5c5ef05224f0129caf58507b555d17f35d | Fix indentation error in Flask | episode-2/flask/src/translation.py | episode-2/flask/src/translation.py | # -*- coding: utf-8 -*-
# Copyright 2016 IBM Corp. 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | # -*- coding: utf-8 -*-
# Copyright 2016 IBM Corp. 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | Python | 0.000002 |
4026d575cac94d98f8fa5467674020b18442359d | Update h-index.py | Python/h-index.py | Python/h-index.py | # Time: O(nlogn)
# Space: O(1)
# Given an array of citations (each citation is a non-negative integer)
# of a researcher, write a function to compute the researcher's h-index.
#
# According to the definition of h-index on Wikipedia:
# "A scientist has index h if h of his/her N papers have
# at least h citations each... | # Time: O(nlogn)
# Space: O(1)
# Given an array of citations (each citation is a non-negative integer)
# of a researcher, write a function to compute the researcher's h-index.
#
# According to the definition of h-index on Wikipedia:
# "A scientist has index h if h of his/her N papers have
# at least h citations each... | Python | 0.000002 |
8deb3e45511950cc1a5d317f79f30bf59ed4821a | Update Changedate | changedate.py | changedate.py | """ Calcular Data a partir de uma quantidade de minutos """
def alterar_data(data_ent, op, minutos_ent):
""" Calcular nova data """
spl_Data_ent, spl_Hora_ent = data_ent.split(" ", 2)
spl_Dia_ent, spl_Mes_ent, spl_Ano_ent = spl_Data_ent.split("/", 3)
spl_Hora_ent, spl_Minu_ent = spl_Hora_ent.split(":",... | """ Calcular Data a partir de uma quantidade de minutos """
MINUTOSENTRADA = 4000
OPERADOR = "+"
DATA_E, HORA_E = "31/12/2016 23:35".split(" ", 2)
DIA_E, MES_E, ANO_E = DATA_E.split("/", 3)
HR_E, MINU_E = HORA_E.split(":", 2)
# transformar tudo em minutos
# converter horas em minutos
MIN_TOT_E = (int(HR_E) * 60) + in... | Python | 0.000001 |
62a2b5ab62a5c1080cdc30e3334cc62f4a51d6a9 | Make job mode API update change. | eurekaclinical/analytics/client.py | eurekaclinical/analytics/client.py | from eurekaclinical import APISession, API, Struct, construct_api_session_context_manager
class Job(Struct):
def __init__(self):
super(Job, self).__init__()
self.sourceConfigId = None
self.destinationId = None
self.dateRangePhenotypeKey = None
self.earliestDate = None
... | from eurekaclinical import APISession, API, Struct, construct_api_session_context_manager
class Job(Struct):
def __init__(self):
super(Job, self).__init__()
self.sourceConfigId = None
self.destinationId = None
self.dateRangePhenotypeKey = None
self.earliestDate = None
... | Python | 0 |
5294abf9253a077c0a23fe0e573174afd3728ac7 | fix caching in test | corehq/ex-submodules/casexml/apps/stock/tests/test_logistics_consumption.py | corehq/ex-submodules/casexml/apps/stock/tests/test_logistics_consumption.py | import uuid
from decimal import Decimal
from django.test import TestCase
from casexml.apps.case.models import CommCareCase
from casexml.apps.stock.models import StockReport, StockTransaction
from casexml.apps.stock.tests import ago
from casexml.apps.stock import const
from corehq.apps.commtrack.consumption import shoul... | import uuid
from decimal import Decimal
from django.test import TestCase
from casexml.apps.case.models import CommCareCase
from casexml.apps.stock.models import StockReport, StockTransaction
from casexml.apps.stock.tests import ago
from casexml.apps.stock import const
from corehq.apps.commtrack.models import CommtrackC... | Python | 0.000001 |
11cc0c5f8aae526eddb372fbe339f649f2c654eb | Update pattern for inline comments to allow anything after '#' | poyo/patterns.py | poyo/patterns.py | # -*- coding: utf-8 -*-
INDENT = r"(?P<indent>^ *)"
VARIABLE = r"(?P<variable>.+):"
VALUE = r"(?P<value>((?P<q2>['\"]).*?(?P=q2))|[^#]+?)"
NEWLINE = r"$\n"
BLANK = r" +"
INLINE_COMMENT = r"( +#.*)?"
COMMENT = r"^ *#.*" + NEWLINE
BLANK_LINE = r"^[ \t]*" + NEWLINE
SECTION = INDENT + VARIABLE + INLINE_COMMENT + NEWLINE... | # -*- coding: utf-8 -*-
INDENT = r"(?P<indent>^ *)"
VARIABLE = r"(?P<variable>.+):"
VALUE = r"(?P<value>((?P<q2>['\"]).*?(?P=q2))|[^#]+?)"
NEWLINE = r"$\n"
BLANK = r" +"
INLINE_COMMENT = r"( +#\w*)?"
COMMENT = r"^ *#.*" + NEWLINE
BLANK_LINE = r"^[ \t]*" + NEWLINE
SECTION = INDENT + VARIABLE + INLINE_COMMENT + NEWLIN... | Python | 0 |
0f9b5bdba841d707e236bb8ed8df5ba4aa7806c2 | Allow a None value for os_config_path. | praw/settings.py | praw/settings.py | # This file is part of PRAW.
#
# PRAW 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.
#
# PRAW is distributed in the hope that it will ... | # This file is part of PRAW.
#
# PRAW 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.
#
# PRAW is distributed in the hope that it will ... | Python | 0 |
28c3f4e17a1f7a003d75353005cd96c854bd30d9 | replace lb:no_nsfw | cogs/nekos.py | cogs/nekos.py | """
The MIT License (MIT)
Copyright (c) 2018 tilda
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 rights to use, copy, modify, merge, publis... | """
The MIT License (MIT)
Copyright (c) 2018 tilda
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 rights to use, copy, modify, merge, publis... | Python | 0.002582 |
a307b6a059e1da4fc415296016280e5149bbd061 | Update radio.py | cogs/radio.py | cogs/radio.py | from .utils import config, checks, formats
import discord
from discord.ext import commands
import discord.utils
from .utils.api.pycopy import Copy
import random, json, asyncio
from urllib.parse import unquote
class Radio:
"""The radio-bot related commands."""
def __init__(self, bot):
self.... | from .utils import config, checks, formats
import discord
from discord.ext import commands
import discord.utils
from .utils.api.pycopy import Copy
import random, json, asyncio
from urllib.parse import unquote
class Radio:
"""The radio-bot related commands."""
def __init__(self, bot):
self.... | Python | 0.000001 |
d84a4efcf880bb668b2721af3f4ce18220e8baab | Use np.genfromtext to handle missing values | xvistaprof/reader.py | xvistaprof/reader.py | #!/usr/bin/env python
# encoding: utf-8
"""
Reader for XVISTA .prof tables.
"""
import numpy as np
from astropy.table import Table
from astropy.io import registry
def xvista_table_reader(filename):
dt = [('R', np.float), ('SB', np.float), ('SB_err', np.float),
('ELL', np.float), ('PA', np.float), ('EMA... | #!/usr/bin/env python
# encoding: utf-8
"""
Reader for XVISTA .prof tables.
"""
import numpy as np
from astropy.table import Table
from astropy.io import registry
def xvista_table_reader(filename):
dt = [('R', np.float), ('SB', np.float), ('SB_err', np.float),
('ELL', np.float), ('PA', np.float), ('E... | Python | 0.000022 |
0dde9454d05a6d5533454fbac8996c560d007c67 | make a proper hook/task split in cython. | yaku/tools/cython.py | yaku/tools/cython.py | import os
import sys
from yaku.task_manager \
import \
extension, get_extension_hook
from yaku.task \
import \
Task
from yaku.compiled_fun \
import \
compile_fun
from yaku.utils \
import \
ensure_dir, find_program
import yaku.errors
@extension(".pyx")
def cython_hook(se... | import os
import sys
from yaku.task_manager \
import \
extension, get_extension_hook
from yaku.task \
import \
Task
from yaku.compiled_fun \
import \
compile_fun
from yaku.utils \
import \
ensure_dir, find_program
import yaku.errors
@extension(".pyx")
def cython_task(se... | Python | 0 |
af96c316f485ebed2ad342aa2ea720d8b699f649 | bump version | ydcommon/__init__.py | ydcommon/__init__.py | """
YD Technology common libraries
"""
VERSION = (0, 1, 2)
__version__ = '.'.join((str(each) for each in VERSION[:4]))
def get_version():
"""
Returns shorter version (digit parts only) as string.
"""
version = '.'.join((str(each) for each in VERSION[:3]))
if len(VERSION) > 3:
version += ... | """
YD Technology common libraries
"""
VERSION = (0, 1, 1)
__version__ = '.'.join((str(each) for each in VERSION[:4]))
def get_version():
"""
Returns shorter version (digit parts only) as string.
"""
version = '.'.join((str(each) for each in VERSION[:3]))
if len(VERSION) > 3:
version += ... | Python | 0 |
de48a47cf813177e824026a994a5a814f5cc1a2d | fix socket.TCP_KEEPIDLE error on Mac OS | routeros_api/api_socket.py | routeros_api/api_socket.py | import socket
from routeros_api import exceptions
try:
import errno
except ImportError:
errno = None
EINTR = getattr(errno, 'EINTR', 4)
def get_socket(hostname, port, timeout=15.0):
api_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
api_socket.settimeout(timeout)
while True:
tr... | import socket
from routeros_api import exceptions
try:
import errno
except ImportError:
errno = None
EINTR = getattr(errno, 'EINTR', 4)
def get_socket(hostname, port, timeout=15.0):
api_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
api_socket.settimeout(timeout)
while True:
tr... | Python | 0 |
5a31ed001626937772a30ab46b94fe2b4bb5cfb8 | allow 2013 candidates | fecreader/summary_data/management/commands/add_candidates.py | fecreader/summary_data/management/commands/add_candidates.py | from django.core.management.base import BaseCommand, CommandError
from ftpdata.models import Candidate
from summary_data.models import Candidate_Overlay
from summary_data.utils.overlay_utils import make_candidate_overlay_from_masterfile
election_year = 2014
cycle = str(election_year)
class Command(BaseCommand):
... | from django.core.management.base import BaseCommand, CommandError
from ftpdata.models import Candidate
from summary_data.models import Candidate_Overlay
from summary_data.utils.overlay_utils import make_candidate_overlay_from_masterfile
election_year = 2014
cycle = str(election_year)
class Command(BaseCommand):
... | Python | 0.000005 |
bf4a197618bf09a164f03a53cd6998bcd6ee8196 | Fix function name | google/cloud/security/common/data_access/violation_format.py | google/cloud/security/common/data_access/violation_format.py | # Copyright 2017 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, s... | # Copyright 2017 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, s... | Python | 0.999896 |
17b9ccbcf940c653c2ee0994eefec87ca2961b75 | Fix extension scraper on Python 3.x | Release/Product/Python/PythonTools/ExtensionScraper.py | Release/Product/Python/PythonTools/ExtensionScraper.py | # ############################################################################
#
# Copyright (c) Microsoft Corporation.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of this distribution.... | # ############################################################################
#
# Copyright (c) Microsoft Corporation.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of this distribution.... | Python | 0.000001 |
9780274756ef4bc2966a0f8290ca28bd3c1e8163 | update dev version after 0.31.1 tag [skip ci] | py/desisim/_version.py | py/desisim/_version.py | __version__ = '0.31.1.dev1940'
| __version__ = '0.31.1'
| Python | 0 |
bc905d9d01060fdaff2765f64e810b4eb927820e | fix arcseciv typo | py/legacypipe/units.py | py/legacypipe/units.py |
def get_units_for_columns(cols, bands=[], extras=None):
deg = 'deg'
degiv = '1/deg^2'
arcsec = 'arcsec'
arcseciv = '1/arcsec^2'
flux = 'nanomaggy'
fluxiv = '1/nanomaggy^2'
pm = 'mas/yr'
pmiv = '1/(mas/yr)^2'
unitmap = dict(
ra=deg, dec=deg, ra_ivar=degiv, dec_ivar=degiv,
... |
def get_units_for_columns(cols, bands=[], extras=None):
deg = 'deg'
degiv = '1/deg^2'
arcsec = 'arcsec'
arcseciv = '1/arcsec^2'
flux = 'nanomaggy'
fluxiv = '1/nanomaggy^2'
pm = 'mas/yr'
pmiv = '1/(mas/yr)^2'
unitmap = dict(
ra=deg, dec=deg, ra_ivar=degiv, dec_ivar=degiv,
... | Python | 0.018115 |
edc13c1309d550a3acc5b833d0efedaf7be4045e | Fix several off-by-one errors in split_tex_string() and add regression tests. | pybtex/bibtex/utils.py | pybtex/bibtex/utils.py | # Copyright (C) 2007, 2008, 2009 Andrey Golovizin
#
# This program 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.
#
# This program ... | # Copyright (C) 2007, 2008, 2009 Andrey Golovizin
#
# This program 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.
#
# This program ... | Python | 0 |
d883d551f74bbfa0c0ee0db6b94aa98a3af41fca | Expanded NUMERIC_MISSING_VALUES to have 64 values | pybufrkit/constants.py | pybufrkit/constants.py | """
pybufrkit.constants
~~~~~~~~~~~~~~~~~~~
Various constants used in the module.
"""
from __future__ import absolute_import
from __future__ import print_function
import sys
import os
# Set the base directory accordingly for PyInstaller
# noinspection PyUnresolvedReferences,PyProtectedMember
BASE_DIR = sys._MEIPASS... | """
pybufrkit.constants
~~~~~~~~~~~~~~~~~~~
Various constants used in the module.
"""
from __future__ import absolute_import
from __future__ import print_function
import sys
import os
# Set the base directory accordingly for PyInstaller
# noinspection PyUnresolvedReferences,PyProtectedMember
BASE_DIR = sys._MEIPASS... | Python | 0.999172 |
a1dd37c9127501ad440c7777d14fb28b1b59b85b | Add list guests function | characters.py | characters.py | from adventurelib import Item, Bag, when
class Man(Item):
subject_pronoun = 'he'
object_pronoun = 'him'
class Woman(Item):
subject_pronoun = 'she'
object_pronoun = 'her'
dr_black = the_victim = Man('Dr. Black', 'Dr Black', 'the victim')
dr_black.def_name = 'the victim'
dr_black.description = """\
... | from adventurelib import Item, Bag
class Man(Item):
subject_pronoun = 'he'
object_pronoun = 'him'
class Woman(Item):
subject_pronoun = 'she'
object_pronoun = 'her'
dr_black = the_victim = Man('Dr. Black', 'Dr Black', 'the victim')
dr_black.def_name = 'the victim'
dr_black.description = """\
Dr. Bl... | Python | 0 |
02ebf235704ea6c61969a20ff86717c796dd5e06 | Fix typo: get_destination_queues should be get_queue | queue_util/consumer.py | queue_util/consumer.py | """Listens to 1 (just one!) queue and consumes messages from it endlessly.
We set up a consumer with two things:
1) The name of the source queue (`source_queue_name`)
2) A callable that will process
The `handle_data` method must process the data. It can return nothing or a
sequence of `queue_name, data` pairs.
If it r... | """Listens to 1 (just one!) queue and consumes messages from it endlessly.
We set up a consumer with two things:
1) The name of the source queue (`source_queue_name`)
2) A callable that will process
The `handle_data` method must process the data. It can return nothing or a
sequence of `queue_name, data` pairs.
If it r... | Python | 0.999999 |
919d67e6f46d4f991cc5caa5893beebfe94e0d9e | Add hash mock | cli/crypto.py | cli/crypto.py | from ctypes import *
import base64
import os
def generate_hex_sstr():
publicKey64 = "Not implemente"
privateKey64 = "Not implemente"
return (publicKey64,privateKey64)
def hash(msg):
return "Not implemente" | from ctypes import *
import base64
import os
def generate_hex_sstr():
publicKey64 = "Not implemente"
privateKey64 = "Not implemente"
return (publicKey64,privateKey64)
| Python | 0.000004 |
d262bcf59c9779a387e9f7d213030c958b85d891 | fix sur les phrase | sara_flexbe_states/src/sara_flexbe_states/StoryboardSetStoryKey.py | sara_flexbe_states/src/sara_flexbe_states/StoryboardSetStoryKey.py | #!/usr/bin/env python
from flexbe_core import EventState, Logger
import rospy
from vizbox.msg import Story
class StoryboardSetStoryFromAction(EventState):
"""
set_story
-- titre string the title
-- actionList string[][] the steps
<= done what's suppose to be written is written
... | #!/usr/bin/env python
from flexbe_core import EventState, Logger
import rospy
from vizbox.msg import Story
class StoryboardSetStoryFromAction(EventState):
"""
set_story
-- titre string the title
-- actionList string[][] the steps
<= done what's suppose to be written is written
... | Python | 0.007946 |
73873d47de67be9ab2b954c2a14c58fb3423fb3b | remove unused imports | txdarn/resources/support.py | txdarn/resources/support.py | import hashlib
import datetime
import functools
import pkgutil
import eliot
from twisted.web import resource, template, http
from .. import encoding, compat
from . import headers
DEFAULT_CACHEABLE_POLICY = headers.CachePolicy(
cacheDirectives=(headers.PUBLIC,
headers.MAX_AGE(headers.ONE_YEA... | import hashlib
import datetime
import functools
import pkgutil
from wsgiref.handlers import format_date_time
import eliot
from twisted.web import resource, template, http
from twisted.python.constants import Names, ValueConstant
from .. import encoding, compat
from . import headers
DEFAULT_CACHEABLE_POLICY = header... | Python | 0.000001 |
747013feb65b7c9621234a4f2c808b00f0e6787f | Fix config passing when master pillar is turned off | salt/transport/__init__.py | salt/transport/__init__.py | # -*- coding: utf-8 -*-
'''
Encapsulate the different transports available to Salt. Currently this is only ZeroMQ.
'''
import salt.payload
import salt.auth
class Channel(object):
@staticmethod
def factory(opts, **kwargs):
# Default to ZeroMQ for now
ttype = 'zeromq'
if 'transport_... | # -*- coding: utf-8 -*-
'''
Encapsulate the different transports available to Salt. Currently this is only ZeroMQ.
'''
import salt.payload
import salt.auth
class Channel(object):
@staticmethod
def factory(opts, **kwargs):
# Default to ZeroMQ for now
ttype = 'zeromq'
if 'transport_... | Python | 0 |
2159a35811cac75b0c68677fc41443aa8eac6e5b | Stop conn_join from overriding channel restrictions | txircd/modules/conn_join.py | txircd/modules/conn_join.py | from txircd.channel import IRCChannel
from txircd.modbase import Module
class Autojoin(Module):
def joinOnConnect(self, user):
if "client_join_on_connect" in self.ircd.servconfig:
for channel in self.ircd.servconfig["client_join_on_connect"]:
user.handleCommand("JOIN", None, [ch... | from txircd.channel import IRCChannel
from txircd.modbase import Module
class Autojoin(Module):
def joinOnConnect(self, user):
if "client_join_on_connect" in self.ircd.servconfig:
for channel in self.ircd.servconfig["client_join_on_connect"]:
user.join(self.ircd.channels[channel... | Python | 0 |
493e48ddb52889fcb282b7747e0f5a9c2b541005 | Remove internal variables/properties with the reserved words | salt/utils/asynchronous.py | salt/utils/asynchronous.py | # -*- coding: utf-8 -*-
'''
Helpers/utils for working with tornado asynchronous stuff
'''
from __future__ import absolute_import, print_function, unicode_literals
import tornado.ioloop
import tornado.concurrent
import contextlib
from salt.utils import zeromq
@contextlib.contextmanager
def current_ioloop(io_loop):
... | # -*- coding: utf-8 -*-
'''
Helpers/utils for working with tornado async stuff
'''
from __future__ import absolute_import, print_function, unicode_literals
import tornado.ioloop
import tornado.concurrent
import contextlib
from salt.utils import zeromq
@contextlib.contextmanager
def current_ioloop(io_loop):
'''
... | Python | 0.000001 |
142538049bd1bf8ae92c80060435965104ec54bb | Add ability to use the pattern ((args, kwargs), callable) when specifying schema | scrapi/base/transformer.py | scrapi/base/transformer.py | from __future__ import unicode_literals
import abc
import logging
logger = logging.getLogger(__name__)
class BaseTransformer(object):
__metaclass__ = abc.ABCMeta
def transform(self, doc):
return self._transform(self.schema, doc)
def _transform(self, schema, doc):
transformed = {}
... | from __future__ import unicode_literals
import abc
import logging
logger = logging.getLogger(__name__)
class BaseTransformer(object):
__metaclass__ = abc.ABCMeta
def transform(self, doc):
return self._transform(self.schema, doc)
def _transform(self, schema, doc):
transformed = {}
... | Python | 0.000015 |
465c1c1c9d7c102b4d35eb8c228565dbf8d35910 | simplify the code | util/remaining-gnu-error.py | util/remaining-gnu-error.py | #!/usr/bin/env python3
# This script lists the GNU failing tests by size
# Just like with util/run-gnu-test.sh, we expect the gnu sources
# to be in ../
import urllib.request
import urllib
import os
import glob
import json
base = "../gnu/tests/"
urllib.request.urlretrieve(
"https://raw.githubusercontent.com/uutil... | #!/usr/bin/env python3
# This script lists the GNU failing tests by size
# Just like with util/run-gnu-test.sh, we expect the gnu sources
# to be in ../
import urllib.request
import urllib
import os
import glob
import json
base = "../gnu/tests/"
urllib.request.urlretrieve(
"https://raw.githubusercontent.com/uutil... | Python | 0.000677 |
b2a4967e956c07831516d90411f16d9f46a62cfb | Update script for py3 and cross-platform TMPDIR access | scripts/avogadro-remote.py | scripts/avogadro-remote.py | #!/usr/bin/python
from __future__ import print_function
import sys
import json
import time
import socket
import struct
import tempfile
class Connection:
def __init__(self, name = "avogadro"):
# create socket
self.sock = socket.socket(socket.AF_UNIX,
socket.SOCK_STREAM)
# ... | #!/usr/bin/python
import sys
import json
import time
import socket
import struct
class Connection:
def __init__(self, name = "avogadro"):
# create socket
self.sock = socket.socket(socket.AF_UNIX,
socket.SOCK_STREAM)
# connect
self.sock.connect("/tmp/" + name)
def se... | Python | 0 |
0b038b8348de12eab4396cbae69095ff54407075 | update SHEF soilm code to MV for ISUSM | scripts/isuag/isusm2rr5.py | scripts/isuag/isusm2rr5.py | """Create the RR5 SHEF product that the Weather Bureau Desires
Run from RUN_20_AFTER.sh
"""
import subprocess
import datetime
import os
import tempfile
import numpy as np
from pyiem.util import get_dbconn
from pyiem.tracker import loadqc
def mt(prefix, tmpf, depth, q):
"""Properly encode a value at depth into ... | """Create the RR5 SHEF product that the Weather Bureau Desires
Run from RUN_20_AFTER.sh
"""
import subprocess
import datetime
import os
import unittest
import tempfile
import numpy as np
from pyiem.util import get_dbconn
from pyiem.tracker import loadqc
def mt(prefix, tmpf, depth, q):
"""Properly encode a valu... | Python | 0 |
5489fe0abc5dda3b6d41bee368cd0b9727459af3 | Add search urls for projects | projects/urls.py | projects/urls.py | from django.conf.urls import patterns, url
urlpatterns = patterns('projects.views',
url(r'^add/$', 'add_project', name='add-project'),
url(r'^edit/(?P<project_id>\d+)/$', 'edit_project', name='edit-project'),
url(r'^edit_status/(?P<project_id>\d+)/$', 'edit_status', name='edit-status'),
url(r'^archive... | from django.conf.urls import patterns, url
urlpatterns = patterns('projects.views',
url(r'^add/$', 'add_project', name='add-project'),
url(r'^edit/(?P<project_id>\d+)/$', 'edit_project', name='edit-project'),
url(r'^edit_status/(?P<project_id>\d+)/$', 'edit_status', name='edit-status'),
url(r'^archive... | Python | 0 |
35b0af0fafb117e3cc613d3073602902fadb9c5c | Add daily-view to worker | server/worker/functions.py | server/worker/functions.py | import logging
import time
from django.db import connection
from server.models import SensorValue, Threshold, Notification
import functions
logger = logging.getLogger('worker')
def check_thresholds():
for threshold in Threshold.objects.all():
try:
latest_sensorvalue = SensorValue.objects.fi... | import logging
import time
from django.db import connection
from server.models import SensorValue, Threshold, Notification
import functions
logger = logging.getLogger('worker')
def check_thresholds():
for threshold in Threshold.objects.all():
try:
latest_sensorvalue = SensorValue.objects.fi... | Python | 0.000001 |
13bb0a7ea546fed050b68c73730384c168370ac3 | Add typing for plogger. | ptest/plogger.py | ptest/plogger.py | import logging
import sys
from datetime import datetime
from . import config
class PConsole:
def __init__(self, out):
self.out = out
def write(self, msg: str):
self.out.write(str(msg))
def write_line(self, msg: str):
self.out.write(str(msg) + "\n")
pconsole = PConsole(sys.stdo... | import logging
import sys
from datetime import datetime
from . import config
class PConsole:
def __init__(self, out):
self.out = out
def write(self, msg):
self.out.write(str(msg))
def write_line(self, msg):
self.out.write(str(msg) + "\n")
pconsole = PConsole(sys.stdout)
pconso... | Python | 0 |
3b5b3afbc66f60df45f0458ffdd0d37b9a7c50d0 | Add homemade fast width/height reader for JPEG files | ptoolbox/tags.py | ptoolbox/tags.py | # -*- coding: utf-8 -*-
import struct
from datetime import datetime
TAG_WIDTH = 'EXIF ExifImageWidth'
TAG_HEIGHT = 'EXIF ExifImageLength'
TAG_DATETIME = 'Image DateTime'
def jpeg_size(path):
"""Get image size.
Structure of JPEG file is:
ffd8 [ffXX SSSS DD DD ...] [ffYY SSSS DDDD ...] (S is 16bit si... | # -*- coding: utf-8 -*-
from datetime import datetime
TAG_WIDTH = 'EXIF ExifImageWidth'
TAG_HEIGHT = 'EXIF ExifImageLength'
TAG_DATETIME = 'Image DateTime'
def parse_time(tags):
tag = tags.get(TAG_DATETIME, None)
if not tag:
raise KeyError(TAG_DATETIME)
return datetime.strptime(str(tag), "%Y:%m:%... | Python | 0 |
7a64ac255f53e85f888093daac83b3c0fabcf15e | Update ESPEC_tests.py | ESPEC_tests.py | ESPEC_tests.py | # -*- coding: utf-8 -*-
"""ESPEC_tests.py: Simple test routine for pyESPEC library
__author__ = "Jason M. Battle"
__copyright__ = "Copyright 2016, Jason M. Battle"
__license__ = "MIT"
__email__ = "jason.battle@gmail.com"
"""
from ESPEC import SH241
if __name__ == '__main__':
test = SH241()
tes... | # -*- coding: utf-8 -*-
"""ESPEC_tests.py: Simple test routine for pyESPEC library
__author__ = "Jason M. Battle"
__copyright__ = "Copyright 2016, Jason M. Battle"
__license__ = "MIT"
__email__ = "jason.battle@gmail.com"
"""
from ESPEC import SH241
if __name__ == '__main__':
test = SH241()
tes... | Python | 0 |
d177977ed4da7168e1d04b5420e224bb3b75a4fc | Use StringIO from six & remove trailing space in test file | src/azure/cli/tests/test_commands.py | src/azure/cli/tests/test_commands.py | import os
import sys
import unittest
import re
import vcr
import logging
from six import add_metaclass, StringIO
try:
import unittest.mock as mock
except ImportError:
import mock
from azure.cli.main import main as cli
from command_specs import TEST_SPECS
logging.basicConfig()
vcr_log = logging.getLogger('vc... | import os
import sys
import unittest
import re
import vcr
import logging
from six import add_metaclass
try:
import unittest.mock as mock
except ImportError:
import mock
try:
# Python 3
from io import StringIO
except ImportError:
# Python 2
from StringIO import StringIO
from azure.cli.main imp... | Python | 0 |
72d905e1e4098cf929213f59662c0c3090fd93cf | remove debug print | pyast/dump/js.py | pyast/dump/js.py | import json
import pyast
from collections import OrderedDict
import sys
if sys.version >= '3':
basestring = str
else:
pass
def _dump_node_name(node):
return node.__class__.__name__.lower()
def _dump_node(node, name=None, indent=0):
if isinstance(node, basestring):
return node
elif isins... | import json
import pyast
from collections import OrderedDict
import sys
if sys.version >= '3':
basestring = str
else:
pass
def _dump_node_name(node):
return node.__class__.__name__.lower()
def _dump_node(node, name=None, indent=0):
if isinstance(node, basestring):
return node
elif isins... | Python | 0.000008 |
c46e472755c7b7dd450626e136f31a29ca9a5321 | Fix a regression in accessing the username for the session. | rbtools/utils/users.py | rbtools/utils/users.py | from __future__ import unicode_literals
import getpass
import logging
import sys
from six.moves import input
from rbtools.api.errors import AuthorizationError
from rbtools.commands import CommandError
def get_authenticated_session(api_client, api_root, auth_required=False):
"""Return an authenticated session.
... | from __future__ import unicode_literals
import getpass
import logging
import sys
from six.moves import input
from rbtools.api.errors import AuthorizationError
from rbtools.commands import CommandError
def get_authenticated_session(api_client, api_root, auth_required=False):
"""Return an authenticated session.
... | Python | 0.003157 |
2beb589edc2f7b57be0d6a559e2f29471490bc91 | FIX py2 support! | pyfaker/utils.py | pyfaker/utils.py | import re
import random
import os
import json
from string import Formatter
class BaseFake(object):
pass
class CallFormatter(Formatter):
def get_field(self, field_name, *args, **kwargs):
obj, used_key = Formatter.get_field(self, field_name, *args, **kwargs)
return obj(), used_key
'''
class C... | import re
import random
import os
import json
from string import Formatter
class BaseFake(object):
pass
class CallFormatter(Formatter):
def get_field(self, field_name, *args, **kwargs):
obj, used_key = Formatter.get_field(self, field_name, *args, **kwargs)
return obj(), used_key
'''
class C... | Python | 0 |
24d886b97e6ce1636e95f3c1bde7c889cf622a7c | Change string to byte conversion | pyglet/compat.py | pyglet/compat.py | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | Python | 0.000358 |
be3f26c6f3401290e1bee726f0977cab78bdd61c | Allow unset viewport in lg_earth::client | lg_earth/src/lg_earth/client.py | lg_earth/src/lg_earth/client.py | import os
import shutil
import threading
import xml.etree.ElementTree as ET
from xml.dom import minidom
from tempfile import gettempdir as systmp
import rospy
from lg_common.msg import ApplicationState, WindowGeometry
from lg_common import ManagedApplication, ManagedWindow
from client_config import ClientConfig
TOOLB... | import os
import shutil
import threading
import xml.etree.ElementTree as ET
from xml.dom import minidom
from tempfile import gettempdir as systmp
import rospy
from lg_common.msg import ApplicationState, WindowGeometry
from lg_common import ManagedApplication, ManagedWindow
from client_config import ClientConfig
TOOLB... | Python | 0.000001 |
cf644a17bd8c2abe436a37159bdf3eec7d2a358d | Remove premature optimization | luigi/tasks/quickgo/load_annotations.py | luigi/tasks/quickgo/load_annotations.py | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by... | # -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by... | Python | 0.000015 |
625839a284085e92855b52aaa4abbf0f30d66bb2 | pretty_output().header | qaamus/qaamus.py | qaamus/qaamus.py | import unittest
import requests
from bs4 import BeautifulSoup
from ind_ara_parser import IndAraParser
class pretty_output(object):
def __init__(self, dict_obj):
self.dict_obj = dict_obj
@property
def header(self):
return "-= Arti dari {ind_utama} =-".format(
ind_utama=self... | import unittest
import requests
from bs4 import BeautifulSoup
from ind_ara_parser import IndAraParser
class Qaamus:
def terjemah(self, layanan, query):
"""
Return terjemahan tergantung dengan **layanan** apa yang dia pilih,
dan **query** apa yang dia pakai.
Adapun *layanan* di [Qa... | Python | 0.999995 |
23ab13f192b58f8b550aa2e16d5861e14535698a | Add slot fot empty_patch in cli pop command | quilt/cli/pop.py | quilt/cli/pop.py | # vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:
# python-quilt - A Python implementation of the quilt patch system
#
# Copyright (C) 2012 Björn Ricks <bjoern.ricks@googlemail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as ... | # vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:
# python-quilt - A Python implementation of the quilt patch system
#
# Copyright (C) 2012 Björn Ricks <bjoern.ricks@googlemail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as ... | Python | 0 |
2c386cc3e81caffd906b68a6d527bd8bdd1d5ae5 | Replace nltk.model.NgramModel with nltk.ngrams | marmot/features/lm_feature_extractor.py | marmot/features/lm_feature_extractor.py | from nltk import ngrams, word_tokenize
#from nltk.model import NgramModel
from marmot.features.feature_extractor import FeatureExtractor
from marmot.util.simple_corpus import SimpleCorpus
# Class that extracts various LM features
# Calling an external LM is very slow, so a new lm is constructed with nltk
class LMF... | from nltk.model import NgramModel
from marmot.features.feature_extractor import FeatureExtractor
from marmot.util.simple_corpus import SimpleCorpus
def check_lm_recursive(words, lm, low_order='left'):
if len(words) < lm._n:
return check_lm_recursive(words, lm._backoff, low_order=low_order)
if tuple(words... | Python | 0.999998 |
5d393ff5c007bafb731aaf703a5225081b99f69a | Align the add/remove URL with the filter URL | cotracker/cotracker/urls.py | cotracker/cotracker/urls.py | from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
from checkouts.views import (
PilotList,
PilotDetail,
AirstripList,
AirstripDetail,
BaseList,
BaseAttachedDetail,
BaseUnattachedDetail,
FilterFormView,
CheckoutUpdat... | from django.conf import settings
from django.conf.urls import patterns, include, url
from django.contrib import admin
from checkouts.views import (
PilotList,
PilotDetail,
AirstripList,
AirstripDetail,
BaseList,
BaseAttachedDetail,
BaseUnattachedDetail,
FilterFormView,
CheckoutUpdat... | Python | 0.00003 |
a40ae461472559e2b8740ff1be0b1205254520a1 | Add a manager to centralize webhook API calls | shopify/webhooks/models.py | shopify/webhooks/models.py | from __future__ import unicode_literals
import logging
import uuid
from django.contrib.sites.models import Site
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
import requests
from .utils import shopify_api
logger = logging.getLogger(__name__)
class WebhookManager(mode... | from __future__ import unicode_literals
import logging
import uuid
from django.contrib.sites.models import Site
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
import requests
from .utils import shopify_api
logger = logging.getLogger(__name__)
@python_2_unicode_compati... | Python | 0.000001 |
220f4f7d2d5e94760576cddb607478ef7345a901 | add xtheme plugin to render only products which have discount | shuup/discounts/plugins.py | shuup/discounts/plugins.py | # -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2019, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from django import forms
from django.db.models import Q
from djang... | # -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2019, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from django import forms
from django.db.models import Q
from djang... | Python | 0 |
3c9d45ad67b1a1c274cc5ee7a78d174595445733 | Update websocket | websocket_data_collector.py | websocket_data_collector.py | #!venv/bin/python
'''
websocket_data_collector.py
This script uses websockets to transmit data collected by the NeuroPy module to a remote server.
'''
import NeuroPy.NeuroPy as NP
import socketIO_client
import json
import click
from threading import Lock
CLIENT_ID = "CLIENT1"
# declare this globally
socketIO = None... | #!venv/bin/python
'''
websocket_data_collector.py
This script uses websockets to transmit data collected by the NeuroPy module to a remote server.
'''
import NeuroPy.NeuroPy as NP
import socketIO_client
import json
import click
from threading import Lock
CLIENT_ID = "CLIENT1"
# declare this globally
socketIO = None... | Python | 0.000001 |
531c81d5654783da9443a2392fe878344ff07b3c | Update feed2db.py | newsman/bin/text_based_feeds/feed2db.py | newsman/bin/text_based_feeds/feed2db.py | #!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
feed2db works to turn text-based feed list into database
"""
# @author chengdujin
# @contact chengdujin@gmail.com
# @created Jul. 30, 2013
import sys
reload(sys)
sys.setdefaultencoding('UTF-8')
sys.path.append('../..')
from config.settings import Collection
from conf... | #!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
feed2db works to turn text-based feed list into database
"""
# @author chengdujin
# @contact chengdujin@gmail.com
# @created Jul. 30, 2013
import sys
reload(sys)
sys.setdefaultencoding('UTF-8')
sys.path.append('../..')
from config.settings import Collection
from conf... | Python | 0 |
0cc7fbea3952485e8274c8df1b223fc791181035 | Complete migrate from django to toilets script | ona_migration_script/migrate_toilets.py | ona_migration_script/migrate_toilets.py | import argparse
from ona import OnaApiClient
def generate_location(lat, lon):
return ' '.join([str(lat), str(lon)])
CONVERSIONS = {
'code': 'toilet_code', 'section': 'toilet_section',
'cluster': 'toilet_cluster'}
ADDITIONS = {
'toilet_location': (generate_location, ['lat', 'lon'])
}
DEFAULTS = {
... | Python | 0.000001 | |
a7827ecf5e480c228c881180e63633712e3dbc3c | Modify ARDUINO_SEARCH_PATHS to include default ubuntu package location | site_scons/find_avrdude.py | site_scons/find_avrdude.py | import sys
import os
from itertools import chain
from path import path
home_dir = path('~').expand()
ARDUINO_SEARCH_PATHS = [home_dir, ]
if os.name == 'nt':
from win32com.shell import shell, shellcon
mydocs = shell.SHGetFolderPath(0, shellcon.CSIDL_PERSONAL, 0, 0)
AVRDUDE_NAME = 'avrdude.exe'
ARDUINO_... | import sys
import os
from itertools import chain
from path import path
home_dir = path('~').expand()
ARDUINO_SEARCH_PATHS = [home_dir, ]
if os.name == 'nt':
from win32com.shell import shell, shellcon
mydocs = shell.SHGetFolderPath(0, shellcon.CSIDL_PERSONAL, 0, 0)
AVRDUDE_NAME = 'avrdude.exe'
ARDUINO_... | Python | 0 |
028abc55a2c0e7bf9d727fa73eafff98e5f917d2 | Add sparkhistogram package | Spark_Notes/Spark_Histograms/python/setup.py | Spark_Notes/Spark_Histograms/python/setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
description = "Sparkhistogram contains helper functions for generating data histograms with the Spark DataFrame API."
long_description = """
Use this package, sparkhistogram, together with PySpark for generating data histograms using the Spark DataFra... | #!/usr/bin/env python
from setuptools import setup, find_packages
description = "sparkhistogram contains helper functions for generating data histograms with the Spark DataFrame API and with Spark SQL."
long_description = "sparkhistogram contains helper functions for generating data histograms with the Spark DataFra... | Python | 0 |
03c237551aa08cb70fd397cc348e75531cdabd0e | fix schemas for password views | src/eduid_webapp/security/schemas.py | src/eduid_webapp/security/schemas.py | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016 NORDUnet A/S
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# ... | # -*- coding: utf-8 -*-
#
# Copyright (c) 2016 NORDUnet A/S
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# ... | Python | 0.000002 |
daa92b15852b3572d7ef03392b061184dbbc76c1 | fix to use the right cert in AuthServer provisioning | Code/scripts/provisionAuthServer.py | Code/scripts/provisionAuthServer.py | #!/usr/bin/env python
from __future__ import print_function
from subprocess import check_call
import os
import argparse
parser = argparse.ArgumentParser(description="Generates the keys for authServer.exe")
parser.add_argument("--scriptPath", required="true", help="The path to the directory that contains the scripts u... | #!/usr/bin/env python
from __future__ import print_function
from subprocess import check_call
import os
import argparse
parser = argparse.ArgumentParser(description="Generates the keys for authServer.exe")
parser.add_argument("--scriptPath", required="true", help="The path to the directory that contains the scripts u... | Python | 0 |
93c34ad24f4dc675f1f8d212a6b1a7e53daf381b | change pinout values | RP/static_funcs.py | RP/static_funcs.py | #-------------------------------------------------------------------------------
# Name: Static funcs
# Purpose:
#
# Author: I070890
#
# Created: 18/01/2015
# Copyright: (c) I070890 2015
# Licence: <your licence>
#-------------------------------------------------------------------------------
imp... | #-------------------------------------------------------------------------------
# Name: Static funcs
# Purpose:
#
# Author: I070890
#
# Created: 18/01/2015
# Copyright: (c) I070890 2015
# Licence: <your licence>
#-------------------------------------------------------------------------------
imp... | Python | 0.000002 |
fe4c62acd52a4060eebf4284c15c465970ea8932 | remove duplicate enum key (#7173) | sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_luis_authoring_client_enums.py | sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/authoring/models/_luis_authoring_client_enums.py | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | Python | 0.000003 |
b56882c5d3a145b571deb10f901f35c071c5c34d | Update release.py to blacklist thumbs.db and .ds_store as opposed to whitelisting known file types. | Release/release.py | Release/release.py | VERSION = '0.2.0'
import shutil
import os
import io
import sys
def copyDirectory(source, target):
source = source.replace('/', os.sep)
target = target.replace('/', os.sep)
os.makedirs(target)
for file in os.listdir(source):
fullpath = os.path.join(source, file)
fulltargetpath = os.path.join(targe... | VERSION = '0.2.0'
import shutil
import os
import io
import sys
def copyDirectory(source, target):
source = source.replace('/', os.sep)
target = target.replace('/', os.sep)
os.makedirs(target)
for file in os.listdir(source):
fullpath = os.path.join(source, file)
fulltargetpath = os.path.join(targe... | Python | 0 |
ba7fbebe4285de482028a5b88cc939b910bbcc6c | Remove some duplicated code | pombola/core/management/commands/core_find_stale_elasticsearch_documents.py | pombola/core/management/commands/core_find_stale_elasticsearch_documents.py | import sys
from django.core.management.base import BaseCommand
from haystack import connections as haystack_connections
from haystack.exceptions import NotHandled
from haystack.query import SearchQuerySet
from haystack.utils.app_loading import (
haystack_get_models, haystack_load_apps
)
def get_all_indexed_mode... | import sys
from django.core.management.base import BaseCommand
from haystack import connections as haystack_connections
from haystack.exceptions import NotHandled
from haystack.query import SearchQuerySet
from haystack.utils.app_loading import (
haystack_get_models, haystack_load_apps
)
def get_all_indexed_mode... | Python | 0.003916 |
0bdc25cab0deeca81cedace37f135bef40f6eb09 | use shutdownMicroprocess() instead; fix hilighted by tests. | Sketches/PT/dns.py | Sketches/PT/dns.py | #!/usr/bin/env python
#
# (C) 2007 British Broadcasting Corporation and Kamaelia Contributors(1)
# All Rights Reserved.
#
# You may only modify and redistribute this under the terms of any of the
# following licenses(2): Mozilla Public License, V1.1, GNU General
# Public License, V2.0, GNU Lesser General Public Lic... | #!/usr/bin/env python
# (C) 2006 British Broadcasting Corporation and Kamaelia Contributors(1)
# All Rights Reserved.
#
# You may only modify and redistribute this under the terms of any of the
# following licenses(2): Mozilla Public License, V1.1, GNU General
# Public License, V2.0, GNU Lesser General Public Lice... | Python | 0 |
5f1f1145d4f01f4b30e8782d284feb44781c21ad | Use sorted on the set to parametrize tests so that pytest-xdist works | tests/cupyx_tests/scipy_tests/special_tests/test_ufunc_dispatch.py | tests/cupyx_tests/scipy_tests/special_tests/test_ufunc_dispatch.py | import numpy
import cupy
import scipy.special
import cupyx.scipy.special
from cupy import testing
import pytest
scipy_ufuncs = {
f
for f in scipy.special.__all__
if isinstance(getattr(scipy.special, f), numpy.ufunc)
}
cupyx_scipy_ufuncs = {
f
for f in dir(cupyx.scipy.special)
if isinstance(get... | import numpy
import cupy
import scipy.special
import cupyx.scipy.special
from cupy import testing
import pytest
scipy_ufuncs = {
f
for f in scipy.special.__all__
if isinstance(getattr(scipy.special, f), numpy.ufunc)
}
cupyx_scipy_ufuncs = {
f
for f in dir(cupyx.scipy.special)
if isinstance(get... | Python | 0 |
72c0c74936b7a7c1c9df572adb41f33283c74d57 | don't need to autoescape the output of urlize | localtv/templatetags/filters.py | localtv/templatetags/filters.py | # Copyright 2009 - Participatory Culture Foundation
#
# This file is part of Miro Community.
#
# Miro Community is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at ... | # Copyright 2009 - Participatory Culture Foundation
#
# This file is part of Miro Community.
#
# Miro Community is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at ... | Python | 0.99954 |
fabd8e5a1fbb8dd083b05b053320b090fedad119 | Fix cryptostate to no longer assign multiple states at once (issue #620) | mailpile/plugins/cryptostate.py | mailpile/plugins/cryptostate.py | from gettext import gettext as _
from mailpile.plugins import PluginManager
from mailpile.crypto.state import EncryptionInfo, SignatureInfo
_plugins = PluginManager(builtin=__file__)
##[ Keywords ]################################################################
def text_kw_extractor(index, msg, ctype, text):
... | from gettext import gettext as _
from mailpile.plugins import PluginManager
_plugins = PluginManager(builtin=__file__)
##[ Keywords ]################################################################
def text_kw_extractor(index, msg, ctype, text):
kw = set()
if ('-----BEGIN PGP' in text and '\n-----END PGP'... | Python | 0 |
dfda6dad01050d1198779d1a33838f79adfc2198 | Fix KeyError for FilePath | bro-otx.py | bro-otx.py | #!/usr/bin/env python
import requests
import sys
from ConfigParser import ConfigParser
from datetime import datetime, timedelta
# The URL is hard coded. I'm comfortable doing this since it's unlikely that
# the URL will change without resulting in an API change that will require
# changes to this script.
_URL = 'htt... | #!/usr/bin/env python
import requests
import sys
from ConfigParser import ConfigParser
from datetime import datetime, timedelta
# The URL is hard coded. I'm comfortable doing this since it's unlikely that
# the URL will change without resulting in an API change that will require
# changes to this script.
_URL = 'htt... | Python | 0.000001 |
d5c30bdae34450b4052f83f773ef993e89fc8bef | Prepare 1.1 release | c4ddev.pyp | c4ddev.pyp | # Copyright (C) 2014-2016 Niklas Rosenstein
#
# 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 rights
# to use, copy, modify, merge, publ... | # Copyright (C) 2014-2016 Niklas Rosenstein
#
# 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 rights
# to use, copy, modify, merge, publ... | Python | 0 |
8c0e1a976e6341d565140725d51562cc9021f90e | add hostname to all messages | cc/reqs.py | cc/reqs.py | import time
from cc.json import Struct, Field
from cc.message import CCMessage
from socket import gethostname
__all__ = ['LogMessage', 'InfofileMessage', 'JobRequestMessage', 'JobConfigReplyMessage', 'TaskRegisterMessage', 'TaskSendMessage']
class BaseMessage(Struct):
req = Field(str)
hostname = Field(str, de... | import time
from cc.json import Struct, Field
from cc.message import CCMessage
__all__ = ['LogMessage', 'InfofileMessage', 'JobRequestMessage', 'JobConfigReplyMessage', 'TaskRegisterMessage', 'TaskSendMessage']
class BaseMessage(Struct):
req = Field(str)
def send_to(self, sock):
cmsg = CCMessage(jmsg... | Python | 0.000001 |
89d9328696a01e70428fccfa890d847e91f5f5c4 | Fix copy-paste bug | certifi.py | certifi.py | import platform
if platform.system() == "Windows":
import wincertstore
import atexit
import ssl
certfile = wincertstore.CertFile()
certfile.addstore("CA")
certfile.addstore("ROOT")
atexit.register(certfile.close) # cleanup and remove files on shutdown
def where():
return certfil... | import platform
if platform.system() == "Windows":
import wincertstore
import atexit
import ssl
certfile = wincertstore.CertFile()
certfile.addstore("CA")
certfile.addstore("ROOT")
atexit.register(certfile.close) # cleanup and remove files on shutdown
def where():
return certfil... | Python | 0.000002 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.