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 |
|---|---|---|---|---|---|---|---|
740cf4e1a25533b4d3279a17e23b1ff9f6c13006 | Update Watchers.py | examples/Watchers.py | examples/Watchers.py | from seleniumbase import BaseCase
class MyTestClass(BaseCase):
def test_basic(self):
self.open('stockstwits.com') # Navigate to the web page
self.assert_element('sentiment-tab') # Assert element on page
self.click('sentiment-tab') # Click element on page
... | Import openpyxl
from seleniumbase import BaseCase
los = []
url = 'https://stocktwits.com/symbol/'
workbook = openpyxl.load_workbook('Test.xlsx')
worksheet = workbook.get_sheet_by_name(name = 'Sheet1')
for col in worksheet['A']:
los.append(col.value)
los2 = []
print(los)
class MyTestClass(BaseCase):
#for i in ... | Python | 0.000001 |
3462a4755eac0ea74b9c90f867e769c47504c5bd | add license to top of __init__ in examples | examples/__init__.py | examples/__init__.py | # Licensed to the Cloudkick, Inc under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# libcloud.org licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file exc... | Python | 0.000007 | |
87da5bcf5b11762605c60f57b3cb2019d458fcd3 | Set version to v2.1.0a3 | spacy/about.py | spacy/about.py | # inspired from:
# https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/
# https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py
__title__ = 'spacy-nightly'
__version__ = '2.1.0a3'
__summary__ = 'Industrial-strength Natural Language Processing (NLP) with Python and Cython'... | # inspired from:
# https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/
# https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py
__title__ = 'spacy-nightly'
__version__ = '2.1.0a3.dev0'
__summary__ = 'Industrial-strength Natural Language Processing (NLP) with Python and Cy... | Python | 0.000041 |
939f7a9e91022c8dab5da13e9e3f738f6c25c524 | Update perception_obstacle_sender.py | modules/tools/record_analyzer/tools/perception_obstacle_sender.py | modules/tools/record_analyzer/tools/perception_obstacle_sender.py | #!/usr/bin/env python
###############################################################################
# Copyright 2018 The Apollo Authors. 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 ... | #!/usr/bin/env python
###############################################################################
# Copyright 2018 The Apollo Authors. 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 ... | Python | 0.000001 |
8fa528696393c18f74ceb5d6bbcf87231e072b21 | update gentle/transcriber.py __main__ | gentle/transcriber.py | gentle/transcriber.py | import math
import logging
import wave
from gentle import transcription
from multiprocessing.pool import ThreadPool as Pool
class MultiThreadedTranscriber:
def __init__(self, kaldi_queue, chunk_len=20, overlap_t=2, nthreads=4):
self.chunk_len = chunk_len
self.overlap_t = overlap_t
self.nt... | import math
import logging
import wave
from gentle import transcription
from multiprocessing.pool import ThreadPool as Pool
class MultiThreadedTranscriber:
def __init__(self, kaldi_queue, chunk_len=20, overlap_t=2, nthreads=4):
self.chunk_len = chunk_len
self.overlap_t = overlap_t
self.nt... | Python | 0 |
203cba83527ed39cc478c4f0530e513c71f2a6ad | format date in title | examples/daynight.py | examples/daynight.py | import numpy as np
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
from datetime import datetime
# example showing how to compute the day/night terminator and shade nightime
# areas on a map.
# miller projection
map = Basemap(projection='mill',lon_0=180)
# plot coastlines, draw label meridia... | import numpy as np
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
from datetime import datetime
# example showing how to compute the day/night terminator and shade nightime
# areas on a map.
# miller projection
map = Basemap(projection='mill',lon_0=180)
# plot coastlines, draw label meridia... | Python | 0.000172 |
ddb0a5d3b684c96b8fe8c4678cdb5e018f1b3d7b | Revert last change. Just in case... | rbm2m/action/downloader.py | rbm2m/action/downloader.py | # -*- coding: utf-8 -*-
import urllib
import sys
import requests
from .debug import dump_exception
HOST = 'http://www.recordsbymail.com/'
GENRE_LIST_URL = '{host}browse.php'.format(host=HOST)
SEARCH_URL = '{host}search.php?genre={genre_slug}&format=LP&instock=1'
IMAGE_LIST_URL = '{host}php/getImageArray.php?item={r... | # -*- coding: utf-8 -*-
import urllib
import sys
import requests
from .debug import dump_exception
HOST = 'http://www.recordsbymail.com/'
GENRE_LIST_URL = '{host}browse.php'.format(host=HOST)
SEARCH_URL = '{host}search.php?genre={genre_slug}&instock=1'
IMAGE_LIST_URL = '{host}php/getImageArray.php?item={rec_id}'
TI... | Python | 0 |
480e55794c5f06129b8b2fb7ed02a787f70275e2 | add --silent option to update-toplist | mygpo/directory/management/commands/update-toplist.py | mygpo/directory/management/commands/update-toplist.py | from datetime import datetime
from optparse import make_option
from django.core.management.base import BaseCommand
from mygpo.core.models import Podcast, SubscriberData
from mygpo.users.models import PodcastUserState
from mygpo.utils import progress
from mygpo.decorators import repeat_on_conflict
class Command(Base... | from datetime import datetime
from django.core.management.base import BaseCommand
from mygpo.core.models import Podcast, SubscriberData
from mygpo.users.models import PodcastUserState
from mygpo.utils import progress
from mygpo.decorators import repeat_on_conflict
class Command(BaseCommand):
def handle(self, *... | Python | 0 |
006e6b67af6cfb2cca214666ac48dc9fd2cc0339 | Update test values | scopus/tests/test_CitationOverview.py | scopus/tests/test_CitationOverview.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `CitationOverview` module."""
from collections import namedtuple
from nose.tools import assert_equal, assert_true
import scopus
co = scopus.CitationOverview("2-s2.0-84930616647", refresh=True,
start=2015, end=2018)
def test_a... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `CitationOverview` module."""
from collections import namedtuple
from nose.tools import assert_equal, assert_true
import scopus
co = scopus.CitationOverview("2-s2.0-84930616647", refresh=True,
start=2015, end=2017)
def test_a... | Python | 0.000001 |
ca8bbd03f57bf6e15abd406533dc7088d449e9ab | add published date to properties | scrapi/consumers/figshare/consumer.py | scrapi/consumers/figshare/consumer.py | """
Figshare harvester of public projects for the SHARE Notification Service
Example API query: http://api.figshare.com/v1/articles/search?search_for=*&from_date=2015-2-1&end_date=2015-2-1
"""
from __future__ import unicode_literals
import time
import json
import logging
from dateutil.parser import parse
from dateti... | """
Figshare harvester of public projects for the SHARE Notification Service
Example API query: http://api.figshare.com/v1/articles/search?search_for=*&from_date=2015-2-1&end_date=2015-2-1
"""
from __future__ import unicode_literals
import time
import json
import logging
from dateutil.parser import parse
from dateti... | Python | 0 |
4464b72eac2cc995a3276341f066bee30497d621 | Bump version to 1.1.0 for release | globus_sdk/version.py | globus_sdk/version.py | # single source of truth for package version,
# see https://packaging.python.org/en/latest/single_source_version/
__version__ = "1.1.0"
| # single source of truth for package version,
# see https://packaging.python.org/en/latest/single_source_version/
__version__ = "1.0.0"
| Python | 0 |
bb9d1255548b46dc2ba7a85e26606b7dd4c926f3 | Update original "Hello, World!" parser to latest coding, plus runTests | examples/greeting.py | examples/greeting.py | # greeting.py
#
# Demonstration of the pyparsing module, on the prototypical "Hello, World!"
# example
#
# Copyright 2003, 2019 by Paul McGuire
#
import pyparsing as pp
# define grammar
greet = pp.Word(pp.alphas) + "," + pp.Word(pp.alphas) + pp.oneOf("! ? .")
# input string
hello = "Hello, World!"
# parse input stri... | # greeting.py
#
# Demonstration of the pyparsing module, on the prototypical "Hello, World!"
# example
#
# Copyright 2003, by Paul McGuire
#
from pyparsing import Word, alphas
# define grammar
greet = Word( alphas ) + "," + Word( alphas ) + "!"
# input string
hello = "Hello, World!"
# parse input stri... | Python | 0.000077 |
04d0bb1bf71ee3a17efbb4bb15bb808cc832f04b | Update examples.py | examples/examples.py | examples/examples.py | from py_fuzz.generator import *
print random_language(language="russian")
print random_ascii(
seed="this is a test", randomization="byte_jitter",
mutation_rate=0.25
)
print random_regex(
length=20, regex="[a-zA-Z]"
)
print random_utf8(
min_length=10,
max_length=50
)
print random_bytes()
print ra... | from py_fuzz import *
print random_language(language="russian")
print random_ascii(
seed="this is a test", randomization="byte_jitter",
mutation_rate=0.25
)
print random_regex(
length=20, regex="[a-zA-Z]"
)
print random_utf8(
min_length=10,
max_length=50
)
print random_bytes()
print random_utf8(... | Python | 0 |
bc6c3834cd8383f7e1f9e109f0413bb6015a92bf | Remove unneeded datetime from view | go/scheduler/views.py | go/scheduler/views.py | from django.views.generic import ListView
from go.scheduler.models import Task
class SchedulerListView(ListView):
paginate_by = 12
context_object_name = 'tasks'
template = 'scheduler/task_list.html'
def get_queryset(self):
return Task.objects.filter(
account_id=self.request.user_... | import datetime
from django.views.generic import ListView
from go.scheduler.models import Task
class SchedulerListView(ListView):
paginate_by = 12
context_object_name = 'tasks'
template = 'scheduler/task_list.html'
def get_queryset(self):
now = datetime.datetime.utcnow()
return Task.... | Python | 0 |
654034d3a0c6ec4e023af6118d6e628336bc39dd | Upgrade to Python 3 | rpt2csv.py | rpt2csv.py | import sys
import csv
import codecs
def convert(inputFile,outputFile):
"""
Convert a RPT file to a properly escaped CSV file
RPT files are usually sourced from old versions of Microsoft SQL Server Management Studio
RPT files are fixed width with column names on the first line, a second line with dashes and space... | import sys
import csv
def convert(inputFile,outputFile):
"""
Convert a RPT file to a properly escaped CSV file
RPT files are usually sourced from old versions of Microsoft SQL Server Management Studio
RPT files are fixed width with column names on the first line, a second line with dashes and spaces,
and then o... | Python | 0.000672 |
7571b4519e54e2e747a21f7f900e486ccee19aa0 | Update job_crud.py | examples/job_crud.py | examples/job_crud.py | # Copyright 2016 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | # Copyright 2016 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | Python | 0.000001 |
f0df0e081aba7e9eb7a39088613d29c7c1e8a596 | set integrationtime to 80% of sampling interval | examples/liveview.py | examples/liveview.py | #!/usr/bin/env python
""" File: example_liveview.py
Author: Andreas Poehlmann
Last change: 2013/02/27
Liveview example
"""
import oceanoptics
import time
import numpy as np
from gi.repository import Gtk, GLib
class mpl:
from matplotlib.figure import Figure
from matplotlib.ba... | #!/usr/bin/env python
""" File: example_liveview.py
Author: Andreas Poehlmann
Last change: 2013/02/27
Liveview example
"""
import oceanoptics
import time
import numpy as np
from gi.repository import Gtk, GLib
class mpl:
from matplotlib.figure import Figure
from matplotlib.ba... | Python | 0 |
4d5edd17d7382108b90d3f60f2f11317da228603 | Add kafka start/stop script | script/kafkaServer.py | script/kafkaServer.py | #!/bin/python
from __future__ import print_function
import subprocess
import sys
import json
from util import appendline, get_ip_address
if __name__ == "__main__":
# start server one by one
if len(sys.argv) < 2 or sys.argv[1] not in ['start', 'stop']:
sys.stderr.write("Usage: python %s start or stop\n" % (sys.arg... | #!/bin/python
from __future__ import print_function
import subprocess
import sys
import json
from util import appendline, get_ip_address
if __name__ == "__main__":
# start server one by one
if len(sys.argv) < 2 or sys.argv[1] not in ['start', 'stop']:
sys.stderr.write("Usage: python %s start or stop\n" % (sys.arg... | Python | 0.000001 |
ebfaf30fca157e83ea9e4bf33173221fc9525caf | Fix emplorrs demo salary db error | demo/examples/employees/forms.py | demo/examples/employees/forms.py | from django import forms
from .models import Employee, DeptManager, Title, Salary
class ChangeManagerForm(forms.Form):
manager = forms.ModelChoiceField(queryset=Employee.objects.all()[:100])
def __init__(self, *args, **kwargs):
self.department = kwargs.pop('department')
super(ChangeManagerFo... | from datetime import date
from django import forms
from django.utils import timezone
from .models import Employee, DeptManager, Title, Salary
class ChangeManagerForm(forms.Form):
manager = forms.ModelChoiceField(queryset=Employee.objects.all()[:100])
def __init__(self, *args, **kwargs):
self.depart... | Python | 0.000001 |
d82d43a32d770498e802b44089637e774c331c13 | test for post and terminals | busineme/core/tests/test_views.py | busineme/core/tests/test_views.py | from django.test import TestCase
from django.test import Client
from ..models import Busline
from ..models import Terminal
from ..models import Post
from authentication.models import BusinemeUser
STATUS_OK = 200
STATUS_NOT_FOUND = 404
GENERIC_NOT_FOUND_ID = 99999999
class TestSearchResultView(TestCase):
def set... | from django.test import TestCase
from django.test import Client
from ..models import Busline
from ..models import Terminal
STATUS_OK = 200
STATUS_NOT_FOUND = 404
BUSLINE_NOT_FOUND_ID = 99999999
class TestSearchResultView(TestCase):
def setUp(self):
self.client = Client()
self.busline = Busline(... | Python | 0 |
dd7a857c98975eac7930747e0aee34ebcb9f3178 | Update Evaluation.py | src/LiviaNet/Modules/General/Evaluation.py | src/LiviaNet/Modules/General/Evaluation.py | """
Copyright (c) 2016, Jose Dolz .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 notice,
this list of conditions and the f... | """
Copyright (c) 2016, Jose Dolz .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 notice,
this list of conditions and the f... | Python | 0 |
06f78c21e6b7e3327244e89e90365169f4c32ea1 | Fix style issues raised by pep8. | calaccess_campaign_browser/api.py | calaccess_campaign_browser/api.py | from tastypie.resources import ModelResource, ALL
from .models import Filer, Filing
from .utils.serializer import CIRCustomSerializer
class FilerResource(ModelResource):
class Meta:
queryset = Filer.objects.all()
serializer = CIRCustomSerializer()
filtering = {'filer_id_raw': ALL}
... | from tastypie.resources import ModelResource, ALL
from .models import Filer, Filing
from .utils.serializer import CIRCustomSerializer
class FilerResource(ModelResource):
class Meta:
queryset = Filer.objects.all()
serializer = CIRCustomSerializer()
filtering = { 'filer_id_raw': ALL }
... | Python | 0 |
a473b2cb9af95c1296ecae4d2138142f2be397ee | Add variant extension in example script | examples/variants.py | examples/variants.py | #!/usr/bin/env python
# -*- coding: utf8 - *-
from __future__ import print_function, unicode_literals
from cihai.bootstrap import bootstrap_unihan
from cihai.core import Cihai
def variant_list(unihan, field):
for char in unihan.with_fields(field):
print("Character: {}".format(char.char))
for var... | #!/usr/bin/env python
# -*- coding: utf8 - *-
from __future__ import print_function, unicode_literals
from cihai.bootstrap import bootstrap_unihan
from cihai.core import Cihai
def variant_list(unihan, field):
for char in unihan.with_fields(field):
print("Character: {}".format(char.char))
for var... | Python | 0 |
eeebe264c4d873369f3d24b2e7b676e004eb6671 | Fix path bug in update_source. | neuroimaging/externals/pynifti/utils/update_source.py | neuroimaging/externals/pynifti/utils/update_source.py | #!/usr/bin/env python
"""Copy source files from pynifti git directory into nipy source directory.
We only want to copy the files necessary to build pynifti and the nifticlibs,
and use them within nipy. We will not copy docs, tests, etc...
Pynifti should be build before this script is run so swig generates the
wrappe... | #!/usr/bin/env python
"""Copy source files from pynifti git directory into nipy source directory.
We only want to copy the files necessary to build pynifti and the nifticlibs,
and use them within nipy. We will not copy docs, tests, etc...
Pynifti should be build before this script is run so swig generates the
wrappe... | Python | 0 |
ccb6728111a3142830bd4b3fccb8a956002013f0 | Update example to remove upload, not relevant for plotly! | examples/plotly_datalogger.py | examples/plotly_datalogger.py | from pymoku import Moku, MokuException
from pymoku.instruments import *
import pymoku.plotly_support as pmp
import time, logging, traceback
logging.basicConfig(format='%(asctime)s:%(name)s:%(levelname)s::%(message)s')
logging.getLogger('pymoku').setLevel(logging.INFO)
# Use Moku.get_by_serial() or get_by_name() if ... | from pymoku import Moku, MokuException
from pymoku.instruments import *
import pymoku.plotly_support as pmp
import time, logging, traceback
logging.basicConfig(format='%(asctime)s:%(name)s:%(levelname)s::%(message)s')
logging.getLogger('pymoku').setLevel(logging.DEBUG)
# Use Moku.get_by_serial() or get_by_name() if... | Python | 0 |
6f9cd84e454ee101dab23b74be345060fa4633e1 | rewrote the person.py | examples/postgresql/person.py | examples/postgresql/person.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from base import PostgreSQL
class Person(PostgreSQL):
# You need the name of table, of course.
table = 'person'
# Squash some columns?
squash_all = True
# The above is equals to listing all of the columns:
#squashed = set(['person_id', 'name... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from base import PostgreSQL
class Person(PostgreSQL):
table = 'person'
arrange_by = ('person_id', )
squashed = set(['person_id', 'name'])
ident_by = arrange_by
if __name__ == '__main__':
print '# select all'
person = Person.select()
... | Python | 0.999986 |
09bd40bc8d29fab157630d6411aa8316148a10d6 | Fix indentation bug | src/backend.py | src/backend.py | import os
import logging
import imp
import translation
#from mpi4py import MPI
class Backend(object):
def __init__(self, config_file):
if(config_file is None):
# Try to load an example configuration file
config_file = os.path.abspath(os.path.dirname(__file__)+
... | import os
import logging
import imp
import translation
#from mpi4py import MPI
class Backend(object):
def __init__(self, config_file):
if(config_file is None):
# Try to load an example configuration file
config_file = os.path.abspath(os.path.dirname(__file__)+
... | Python | 0.000019 |
a333ca8964132b3f1830c2ceda8cbb805df78999 | Fix locale initialization | product/runtime/src/main/python/java/android/__init__.py | product/runtime/src/main/python/java/android/__init__.py | """Copyright (c) 2018 Chaquo Ltd. All rights reserved."""
from importlib import reload
import os
from os.path import exists, join
import sys
import traceback
from . import stream, importer
def initialize(context, build_json, app_path):
stream.initialize()
importer.initialize(context, build_json, app_path)
... | """Copyright (c) 2018 Chaquo Ltd. All rights reserved."""
from importlib import reload
import os
from os.path import exists, join
import sys
import traceback
from . import stream, importer
def initialize(context, build_json, app_path):
stream.initialize()
importer.initialize(context, build_json, app_path)
... | Python | 0.009032 |
2e5f5fc689ee55f32556be69dcbf0672ea7fdbed | change deprecation warning | district42/json_schema/schema.py | district42/json_schema/schema.py | import warnings
from copy import deepcopy
from ..errors import DeclarationError
from .types import (Any, AnyOf, Array, ArrayOf, Boolean, Enum, Null, Number,
Object, OneOf, SchemaType, String, Timestamp, Undefined)
class Schema:
def ref(self, schema):
return deepcopy(schema)
def ... | import warnings
from copy import deepcopy
from ..errors import DeclarationError
from .types import (Any, AnyOf, Array, ArrayOf, Boolean, Enum, Null, Number,
Object, OneOf, SchemaType, String, Timestamp, Undefined)
class Schema:
def ref(self, schema):
return deepcopy(schema)
def ... | Python | 0.000001 |
a0e1183d9da98dd9f79c496b055cab0bb2638532 | Update h_RNN | h_RNN/Mnist.py | h_RNN/Mnist.py | import os
import sys
root_path = os.path.abspath("../")
if root_path not in sys.path:
sys.path.append(root_path)
import time
import numpy as np
import tensorflow as tf
from h_RNN.RNN import RNNWrapper, Generator
from h_RNN.SpRNN import SparseRNN
from Util.Util import DataUtil
class MnistGenerator... | import time
import tflearn
import numpy as np
import tensorflow as tf
from h_RNN.RNN import RNNWrapper, Generator
from h_RNN.SpRNN import SparseRNN
from Util.Util import DataUtil
class MnistGenerator(Generator):
def __init__(self, im=None, om=None, one_hot=True):
super(MnistGenerator, self)._... | Python | 0.000001 |
b9cc76d410ca034918c615402e3fbe82b226859e | Add public address validation test. | path_and_address/tests/test_validation.py | path_and_address/tests/test_validation.py | from itertools import product
from ..validation import valid_address, valid_hostname, valid_port
def _join(host_and_port):
return '%s:%s' % host_and_port
def _join_all(hostnames, ports):
return map(_join, product(hostnames, ports))
hostnames = [
'0.0.0.0',
'127.0.0.1',
'localhost',
'exampl... | from itertools import product
from ..validation import valid_address, valid_hostname, valid_port
def _join(host_and_port):
return '%s:%s' % host_and_port
def _join_all(hostnames, ports):
return map(_join, product(hostnames, ports))
hostnames = [
'127.0.0.1',
'localhost',
'example.com',
'ex... | Python | 0 |
fd7454610f4cffcfc8c289539b3824f023fe973f | change cruise input dim | modules/tools/prediction/mlp_train/common/configure.py | modules/tools/prediction/mlp_train/common/configure.py | #!/usr/bin/env python
###############################################################################
# Copyright 2018 The Apollo Authors. 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 ... | #!/usr/bin/env python
###############################################################################
# Copyright 2018 The Apollo Authors. 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 ... | Python | 0.99845 |
8092efdd0bf5f5ca8d5498cf679b019920c00bfd | format with black | plugins/feeds/public/virustotal_apiv3.py | plugins/feeds/public/virustotal_apiv3.py | import logging
import re
import json
from datetime import timedelta, datetime
from core import Feed
from core.config.config import yeti_config
from core.observables import Hash, File
# Variable
VTAPI = yeti_config.get("vt", "key")
headers = {"x-apikey": VTAPI}
limit = 10
params = {"limit": limit}
regex = "[A-Fa-f0-9]... | import logging
import re
import json
from datetime import timedelta, datetime
from core import Feed
from core.config.config import yeti_config
from core.observables import Hash, File
# Variable
VTAPI = yeti_config.get('vt', 'key')
headers = {"x-apikey": VTAPI}
limit = 10
params = {'limit': limit}
regex = "[A-Fa-f0-9]... | Python | 0.000001 |
aae5146bd672fdec9a055666c9742acbc1dddd5b | remove obsolete comment | planetstack/core/dashboard/views/shell.py | planetstack/core/dashboard/views/shell.py | import datetime
import os
import sys
import time
import json
from django.http import HttpResponse, HttpResponseServerError, HttpResponseForbidden
from django.views.generic import TemplateView, View
from core.models import *
from django.forms.models import model_to_dict
def ensure_serializable(d):
d2={}
for (k,... | # /opt/planetstack/core/dashboard/views/helloworld.py
import datetime
import os
import sys
import time
import json
from django.http import HttpResponse, HttpResponseServerError, HttpResponseForbidden
from django.views.generic import TemplateView, View
from core.models import *
from django.forms.models import model_to_d... | Python | 0 |
d60b460928c55c544b18c57c0eb697ae88fde9e0 | Make masked fill values into nan before further processing to avoid issues with precision leading to different behaviours. (#632) | lib/improver/ensemble_calibration/ensemble_calibration_utilities.py | lib/improver/ensemble_calibration/ensemble_calibration_utilities.py | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2017-2018 Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions a... | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2017-2018 Met Office.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions a... | Python | 0 |
51a9a02ccf4a133818f14f3ff6e864c1e041ec37 | Update event_chat.py | ark/events/event_chat.py | ark/events/event_chat.py | from ark.chat_commands import ChatCommands
from ark.cli import *
from ark.database import Db
from ark.rcon import Rcon
class EventChat(object):
@classmethod
def output_chat_from_server(cls,text,line):
out(line)
@classmethod
def parse_chat_command(cls,steam_name,player_name,text,line):
... | from ark.chat_commands import ChatCommands
from ark.cli import *
from ark.database import Db
from ark.rcon import Rcon
class EventChat(object):
@classmethod
def output_chat_from_server(cls,text,line):
out(line)
@classmethod
def parse_chat_command(cls,steam_name,player_name,text,line):
... | Python | 0.000002 |
e236b7d34cdf156cc16ba8c95b0526785e717898 | update scenario | enquiry/tests/scenario.py | enquiry/tests/scenario.py | from datetime import datetime
from dateutil.relativedelta import relativedelta
from enquiry.tests.model_maker import make_enquiry
def default_scenario_enquiry():
make_enquiry(
'Rick',
'Can I buy some hay?',
'',
'07840 538 357',
)
make_enquiry(
'Ryan',
(
... | from enquiry.tests.model_maker import make_enquiry
def default_scenario_enquiry():
make_enquiry(
'Rick',
'Can I buy some hay?',
'',
'07840 538 357',
)
make_enquiry(
'Ryan',
(
'Can I see some of the fencing you have done?\n'
"I would l... | Python | 0.000001 |
ecceb10500a395ce2cb79d913ab43187921468be | move fn towards dictionary comprehension | iatidataquality/dqparsetests.py | iatidataquality/dqparsetests.py | import re
import sys
import itertools
from functools import partial
import iatidataquality.models as models
class TestSyntaxError(Exception): pass
comment = re.compile('#')
blank = re.compile('^$')
def ignore_line(line):
return bool(comment.match(line) or blank.match(line))
def test_functions():
mappings = ... | import re
import sys
import itertools
from functools import partial
import iatidataquality.models as models
class TestSyntaxError(Exception): pass
comment = re.compile('#')
blank = re.compile('^$')
def ignore_line(line):
return bool(comment.match(line) or blank.match(line))
def test_functions():
mappings = ... | Python | 0.000018 |
ddcd166b72ef96296a884f63f626c3ffd236059f | make tests pass without LMS settings | common/djangoapps/status/tests.py | common/djangoapps/status/tests.py | from django.conf import settings
from django.test import TestCase
from mock import Mock
import os
from override_settings import override_settings
from tempfile import NamedTemporaryFile
from status import get_site_status_msg
# Get a name where we can put test files
TMP_FILE = NamedTemporaryFile(delete=False)
TMP_NAME... | from django.conf import settings
from django.test import TestCase
from tempfile import NamedTemporaryFile
import os
from override_settings import override_settings
from status import get_site_status_msg
import xmodule.modulestore.django
from xmodule.modulestore.django import modulestore
from xmodule.modulestore impor... | Python | 0 |
c2f99fe178ff853e87b3f034394b18956d395e87 | Change credits verbose_name to autorship. | ideascube/mediacenter/models.py | ideascube/mediacenter/models.py | from django.core.urlresolvers import reverse
from django.db import models
from django.utils.translation import ugettext_lazy as _
from taggit.managers import TaggableManager
from ideascube.models import (
LanguageField, SortedTaggableManager, TimeStampedModel)
from ideascube.search.models import SearchableQuerySe... | from django.core.urlresolvers import reverse
from django.db import models
from django.utils.translation import ugettext_lazy as _
from taggit.managers import TaggableManager
from ideascube.models import (
LanguageField, SortedTaggableManager, TimeStampedModel)
from ideascube.search.models import SearchableQuerySe... | Python | 0 |
f113aaae2232d0041e01a6f12ab2ba083df65d44 | Change submit module to use new interface. | autocms/submit.py | autocms/submit.py | """Functions to submit and register new jobs."""
import os
def submit_and_stamp(counter, testname, scheduler, config):
"""Submit a job to the scheduler and produce a newstamp file.
The full path of the newstamp file is returned."""
result = scheduler.submit_job(counter, testname, config)
stamp_filen... | """Functions to submit and register new jobs."""
import os
import socket
def submit_and_stamp(counter, testname, scheduler, config):
"""Submit a job to the scheduler and produce a newstamp file.
This function should be run from within the test directory.
If the submission fails an output log will be pro... | Python | 0 |
0973acf04fd2fd59db4880d5ba4d994f4c1733db | Add length detection for PNG images. | identifiers/image_identifier.py | identifiers/image_identifier.py |
import io
from struct import unpack
import sys
from identifier import Result
#############
# Constants #
#############
PNG_CHUNK_IEND = b'IEND'
PNG_CHUNK_IHDR = b'IHDR'
#######################
# Identifier Patterns #
#######################
JPEG_PATTERNS = [
'FF D8 FF E0',
'FF D8 FF E1',
'FF D8 FF FE',
]
GIF_P... |
# Identifier for basic image files
from identifier import Result
JPEG_PATTERNS = [
'FF D8 FF E0',
'FF D8 FF E1',
'FF D8 FF FE',
]
GIF_PATTERNS = [
'47 49 46 38 39 61',
'47 49 46 38 37 61',
]
PNG_PATTERNS = [
'89 50 4E 47'
]
BMP_PATTERNS = [
'42 4D 62 25',
'42 4D F8 A9',
'42 4D 76 02',
]
ICO_PATTERNS = [
... | Python | 0 |
d7c5b8784fd747355884e3371f1c85ede9a9bf6f | Disable some packages for now, so that packaging can finish on the buildbots as they are. This should let wrench run the Mono test suite. | profiles/mono-mac-release-64/packages.py | profiles/mono-mac-release-64/packages.py | import os
from bockbuild.darwinprofile import DarwinProfile
class MonoReleasePackages:
def __init__(self):
# Toolchain
#package order is very important.
#autoconf and automake don't depend on CC
#ccache uses a different CC since it's not installed yet
#every thing after ccache needs a working ccache
self... | import os
from bockbuild.darwinprofile import DarwinProfile
class MonoReleasePackages:
def __init__(self):
# Toolchain
#package order is very important.
#autoconf and automake don't depend on CC
#ccache uses a different CC since it's not installed yet
#every thing after ccache needs a working ccache
self... | Python | 0 |
fe0d872c69280b5713a4ad6f0a1cd4a5623fdd75 | Add createnapartcommand contents | cadnano/part/createnapartcommand.py | cadnano/part/createnapartcommand.py | from ast import literal_eval
from cadnano.cnproxy import UndoCommand
from cadnano.part.nucleicacidpart import NucleicAcidPart
class CreateNucleicAcidPartCommand(UndoCommand):
def __init__(self, document, grid_type, use_undostack):
# TODO[NF]: Docstring
super(CreateNucleicAcidPartCommand, self)._... | Python | 0 | |
72117d55715b80df0a01fa519be09bfeec0bc272 | fix generate empty tag bug | ezblog/blog/views.py | ezblog/blog/views.py | from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
from django.core.urlresolvers import reverse
from django.http import Http404, HttpResponse
from django.shortcuts import render, redirect, get_object_or_404
from .models import Post, Category, Tag
# index
def index(request):
per_page = 2
... | from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
from django.core.urlresolvers import reverse
from django.http import Http404, HttpResponse
from django.shortcuts import render, redirect, get_object_or_404
from .models import Post, Category, Tag
# index
def index(request):
per_page = 2
... | Python | 0.000003 |
899254d3bd064ba8e5653ad9081674b7af1495fa | fix capture=True | fabfile/openstack.py | fabfile/openstack.py | #!/usr/bin/env python
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
import os
import yaml
from fabric.api import task, local, settings, warn_only
from cuisine import file_exists
@task
def up():
""" Boot instances """
# call class OpenStack
op = OpenStack()
# Check if fingerprint exis... | #!/usr/bin/env python
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
import os
import yaml
from fabric.api import task, local, settings, warn_only
from cuisine import file_exists
@task
def up():
""" Boot instances """
# call class OpenStack
op = OpenStack()
# Check if fingerprint exis... | Python | 0.998992 |
0fb32166825d630cc5e87b39588e280737567448 | Fix AWS Athena Sensor object has no attribute 'mode' (#4844) | airflow/contrib/sensors/aws_athena_sensor.py | airflow/contrib/sensors/aws_athena_sensor.py | # -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | # -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | Python | 0 |
f2b25679ff906615906552810368092cc5321a3c | Add source and issue tracker link warnings | fdroidserver/lint.py | fdroidserver/lint.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# rewritemeta.py - part of the FDroid server tool
# Copyright (C) 2010-12, Ciaran Gultnieks, ciaran@ciarang.com
#
# 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 Fr... | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
#
# rewritemeta.py - part of the FDroid server tool
# Copyright (C) 2010-12, Ciaran Gultnieks, ciaran@ciarang.com
#
# 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 Fr... | Python | 0 |
4d1c465e5c946ac17334e29e0ded7b6134533d12 | Disable save in Crop multi roi and show the image instead | plugins/Scripts/Plugins/Crop_Multi_Roi.py | plugins/Scripts/Plugins/Crop_Multi_Roi.py | from ij import IJ
from ij.plugin.frame import RoiManager
from io.scif.config import SCIFIOConfig
from io.scif.img import ImageRegion
from io.scif.img import ImgOpener
from io.scif.img import ImgSaver
from net.imagej.axis import Axes
from net.imglib2.img.display.imagej import ImageJFunctions
import os
def main():
... | from ij import IJ
from ij.plugin.frame import RoiManager
from io.scif.config import SCIFIOConfig
from io.scif.img import ImageRegion
from io.scif.img import ImgOpener
from io.scif.img import ImgSaver
from net.imagej.axis import Axes
import os
def main():
# Get current image filename
imp = IJ.getImage()
f... | Python | 0 |
9a19c34a104aabd0c5b34734f587573d5766a4bd | support multi-file results | finishTest/Finish.py | finishTest/Finish.py | from __future__ import print_function
from BaseTask import BaseTask
from Engine import MasterTbl, Error, get_platform
from Dbg import Dbg
import os, json, time, platform
dbg = Dbg()
validA = ("passed", "failed", "diff")
comment_block = """
Test Results:
'notfinished': means that the test has s... | from __future__ import print_function
from BaseTask import BaseTask
from Engine import MasterTbl, Error, get_platform
from Dbg import Dbg
import os, json, time, platform
dbg = Dbg()
validA = ("passed", "failed", "diff")
comment_block = """
Test Results:
'notfinished': means that the test has s... | Python | 0 |
8481cb40caa896b81386f4a9ddb6fda92e14cc76 | Fix a typo | ironic/tests/unit/db/sqlalchemy/test_types.py | ironic/tests/unit/db/sqlalchemy/test_types.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.999988 |
38efb136609b645b0076c0aa1481330f9e28ee51 | Add a rule for matching packages by regex. | fmn/rules/generic.py | fmn/rules/generic.py | # Generic rules for FMN
import re
import fedmsg
import fmn.rules.utils
def user_filter(config, message, fasnick=None, *args, **kw):
""" All messages for a certain user
Use this rule to include messages that are associated with a
specific user.
"""
fasnick = kw.get('fasnick', fasnick)
if fa... | # Generic rules for FMN
import fedmsg
import fmn.rules.utils
def user_filter(config, message, fasnick=None, *args, **kw):
""" All messages for a certain user
Use this rule to include messages that are associated with a
specific user.
"""
fasnick = kw.get('fasnick', fasnick)
if fasnick:
... | Python | 0 |
7f974b87c278ef009535271461b5e49686057a9a | Fix for django >= 1.10 | avatar/management/commands/rebuild_avatars.py | avatar/management/commands/rebuild_avatars.py | from django.core.management.base import BaseCommand
from avatar.conf import settings
from avatar.models import Avatar
class Command(BaseCommand):
help = ("Regenerates avatar thumbnails for the sizes specified in "
"settings.AVATAR_AUTO_GENERATE_SIZES.")
def handle(self, *args, **options):
... | from django.core.management.base import NoArgsCommand
from avatar.conf import settings
from avatar.models import Avatar
class Command(NoArgsCommand):
help = ("Regenerates avatar thumbnails for the sizes specified in "
"settings.AVATAR_AUTO_GENERATE_SIZES.")
def handle_noargs(self, **options):
... | Python | 0 |
f36cad198c45caa40f179e5a9de134610cc3f6fe | fix date filter | skylines/commands/flights/selector.py | skylines/commands/flights/selector.py | from flask.ext.script import Option
from sqlalchemy import func
from datetime import datetime
from skylines.model import Airport, Flight
selector_options = (
Option('--date-from', help='Date from (YYYY-MM-DD)'),
Option('--date-to', help='Date to (YYYY-MM-DD)'),
Option('--uploaded-from', help='Date from (... | from flask.ext.script import Option
from sqlalchemy import func
from datetime import datetime
from skylines.model import Airport, Flight
selector_options = (
Option('--date-from', help='Date from (YYYY-MM-DD)'),
Option('--date-to', help='Date to (YYYY-MM-DD)'),
Option('--uploaded-from', help='Date from (... | Python | 0.000011 |
0da189464703837e212bff06c24cc6eb5b62eeea | Fix name of room | blackbelt/slack.py | blackbelt/slack.py | from slacker import Slacker
from blackbelt.config import config
class Slack(object):
def __init__(self, token=None):
if not token:
token = config['slack']['access_token']
slack = Slacker(token)
self.slack = slack
if not token:
raise ValueError("Can't ... | from slacker import Slacker
from blackbelt.config import config
class Slack(object):
def __init__(self, token=None):
if not token:
token = config['slack']['access_token']
slack = Slacker(token)
self.slack = slack
if not token:
raise ValueError("Can't ... | Python | 0.999953 |
eb3a332cf5aeb6b213c333cbfba78b26b776db49 | fix facebook api | social_publisher/backends/facebook.py | social_publisher/backends/facebook.py | # -*- coding: utf-8 -*-
from social_publisher import facebook
from social_publisher.backends import base
class FacebookBackend(base.BaseBackend):
name = 'facebook'
auth_provider = 'facebook'
def get_api(self, social_user):
return facebook.GraphAPI(social_user.extra_data.get('access_token'))
... | # -*- coding: utf-8 -*-
from social_publisher import facebook
from social_publisher.backends import base
class FacebookBackend(base.BaseBackend):
name = 'facebook'
auth_provider = 'facebook'
def get_api(self, social_user):
return facebook.GraphAPI(social_user.extra_data.get('access_token'))
... | Python | 0.000014 |
07c8888a3623ea40c4f2047e11445726e61e2438 | Fix lint. | packs/csv/tests/test_action_parse.py | packs/csv/tests/test_action_parse.py | import unittest2
from parse_csv import ParseCSVAction
__all__ = [
'ParseCSVActionTestCase'
]
MOCK_DATA = """
first,last,year
name1,surename1,1990
""".strip()
class ParseCSVActionTestCase(unittest2.TestCase):
def test_run(self):
result = ParseCSVAction().run(data=MOCK_DATA, delimiter=',')
ex... | import unittest2
from parse_csv import ParseCSVAction
__all__ = [
'ParseCSVActionTestCase'
]
MOCK_DATA = """
first,last,year
name1,surename1,1990
""".strip()
class ParseCSVActionTestCase(unittest2.TestCase):
def test_run(self):
result = ParseCSVAction().run(data=MOCK_DATA, delimiter=',')
exp... | Python | 0.000001 |
7c75a9c01aec6427bef573e69605087e7b30ff33 | test cases for createview | parcellate/apps/winparcel/tests.py | parcellate/apps/winparcel/tests.py | from django.test import TestCase
from django.test.client import (Client,
RequestFactory)
from .models import (RSSObject,
RSSEntry)
from .lib import ReadRSS
from .views import RSSObjectCreateView
class RSSObjectAddViewTests(TestCase):
""" RSS Object Add View tes... | """
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
from .models import (RSSObject,
RSSEntry)
from .lib import ReadRSS
class Simple... | Python | 0 |
c68792c50f91445ed733c5e5ed0c226a04b1e173 | Use chromium snapshots for Linux_64 and Mac. | chrome/test/chromedriver/archive.py | chrome/test/chromedriver/archive.py | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Downloads items from the Chromium continuous archive."""
import os
import platform
import urllib
import util
CHROME_34_REVISION = '251854'
CHROME_3... | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Downloads items from the Chromium continuous archive."""
import os
import platform
import urllib
import util
CHROME_34_REVISION = '251854'
CHROME_3... | Python | 0.000001 |
9c898d7e547b13bb289c0d1cada0bbd4078803dc | Allow passing of size_cutoff to preassembler methods. | indra/db/pre_assemble_script.py | indra/db/pre_assemble_script.py | import indra.tools.assemble_corpus as ac
from indra.db.util import get_statements, insert_pa_stmts
from indra.preassembler import Preassembler
from indra.preassembler.hierarchy_manager import hierarchies
def make_unique_statement_set(preassembler, stmts):
stmt_groups = preassembler.get_stmt_matching_groups(stmts)... | import indra.tools.assemble_corpus as ac
from indra.db.util import get_statements, insert_pa_stmts
from indra.preassembler import Preassembler
from indra.preassembler.hierarchy_manager import hierarchies
def make_unique_statement_set(preassembler, stmts):
stmt_groups = preassembler.get_stmt_matching_groups(stmts)... | Python | 0 |
4df8aafb1d4ab12ad795b30f1f75937072216f1b | Implement proper event detection, lots of debugging code | hdltools/vcd/event.py | hdltools/vcd/event.py | """VCD Event tracker."""
from typing import Tuple, Dict
from colorama import Fore, Back, init
from hdltools.vcd.parser import BaseVCDParser, VCDParserError
from hdltools.vcd.trigger import VCDTriggerDescriptor
from hdltools.vcd.mixins.conditions import VCDConditionMixin
from hdltools.vcd.mixins.time import VCDTimeRes... | """VCD Event tracker."""
from typing import Tuple, Dict
from hdltools.vcd.parser import BaseVCDParser, VCDParserError
from hdltools.vcd.trigger import VCDTriggerDescriptor
from hdltools.vcd.mixins.conditions import VCDConditionMixin
from hdltools.vcd.mixins.time import VCDTimeRestrictionMixin
from hdltools.vcd.trigge... | Python | 0.000001 |
37c65efa1b78abcc75d506554e6fb877678ec2f2 | Fix a typo | editorsnotes/api/views/topics.py | editorsnotes/api/views/topics.py | from editorsnotes.main.models import Topic
from .. import filters as es_filters
from ..serializers.topics import TopicSerializer
from .base import BaseListAPIView, BaseDetailView, DeleteConfirmAPIView
from .mixins import (ElasticSearchListMixin, EmbeddedMarkupReferencesMixin,
HydraProjectPermissi... | from editorsnotes.main.models import Topic
from .. import filters as es_filters
from ..serializers.topics import TopicSerializer
from .base import BaseListAPIView, BaseDetailView, DeleteConfirmAPIView
from .mixins import (ElasticSearchListMixin, EmbeddedMarkupReferencesMixin,
HydraProjectPermissi... | Python | 1 |
0091c41d8dd064b40ccf35d4d24c01ae4438f028 | Set sender in signal handlers | cityhallmonitor/signals/handlers.py | cityhallmonitor/signals/handlers.py | from django.db.models.signals import pre_save, post_save
from django.dispatch import receiver
from django.utils import timezone
from cityhallmonitor.models import DirtyFieldsModel
@receiver(pre_save, sender=DirtyFieldsModel)
def handle_pre_save(sender, instance, *args, **kwargs):
"""Set updated_at timestamp if mo... | from django.db.models.signals import pre_save, post_save
from django.dispatch import receiver
from django.utils import timezone
@receiver(pre_save)
def handle_pre_save(sender, instance, *args, **kwargs):
"""
Set updated_at timestamp if model is actually dirty
"""
if hasattr(sender, 'is_dirty'):
... | Python | 0.000001 |
2409bf1377ceaee99e4d4b49d0c8c2a2fef57687 | Generate a new 'name' if necessary | ckanext/ddi/importer/ddiimporter.py | ckanext/ddi/importer/ddiimporter.py | import requests
import traceback
from pprint import pprint
from ckan.lib.munge import munge_title_to_name
from ckanext.harvest.harvesters import HarvesterBase
from ckanext.ddi.importer import metadata
import ckanapi
import logging
log = logging.getLogger(__name__)
class DdiImporter(HarvesterBase):
def run(self... | import requests
import traceback
from pprint import pprint
from ckan.lib.munge import munge_title_to_name
from ckanext.harvest.harvesters import HarvesterBase
from ckanext.ddi.importer import metadata
import ckanapi
import logging
log = logging.getLogger(__name__)
class DdiImporter(HarvesterBase):
def run(self... | Python | 1 |
fbe9de1d8f019b6f1c263337f04e5866131d0e60 | drop the chunk size of the kafka feed down | corehq/apps/change_feed/pillow.py | corehq/apps/change_feed/pillow.py | import json
from kafka import KeyedProducer
from kafka.common import KafkaUnavailableError
from casexml.apps.case.models import CommCareCase
from corehq.apps.change_feed import data_sources
from corehq.apps.change_feed.connection import get_kafka_client
from corehq.apps.change_feed.models import ChangeMeta
from corehq.... | import json
from kafka import KeyedProducer
from kafka.common import KafkaUnavailableError
from casexml.apps.case.models import CommCareCase
from corehq.apps.change_feed import data_sources
from corehq.apps.change_feed.connection import get_kafka_client
from corehq.apps.change_feed.models import ChangeMeta
from corehq.... | Python | 0 |
41d6c18aee851c9b2430d74c51ef51b49948b0f4 | raise version | brilws/_version.py | brilws/_version.py | __version__ = "3.5.0"
| __version__ = "3.4.1"
| Python | 0 |
fadab627469d008a2bf39a9544a77a3bd6518b20 | use the local path in the gui to run stuff. | rp-mt-scripts-graphical.py | rp-mt-scripts-graphical.py | #! /usr/bin/env python
"""Main module to create GTK interface to the MT scripts."""
import os.path
import gtk
import gobject
import subprocess
class ScriptsWindow:
"""Class to manage the demo window for the pile manager."""
def __init__(self):
self.builder = gtk.Builder()
self.builder.add_from_file("rp-mt... | #! /usr/bin/env python
"""Main module to create GTK interface to the MT scripts."""
import gtk
import gobject
import subprocess
class ScriptsWindow:
"""Class to manage the demo window for the pile manager."""
def __init__(self):
self.builder = gtk.Builder()
self.builder.add_from_file("rp-mt-scripts-interfa... | Python | 0 |
6e2362351d9ccaa46a5a2bc69c4360e4faff166d | Add encoding spec to comply Python 2 | iclib/qibla.py | iclib/qibla.py | # -*- coding: utf-8 -*-
from . import formula
def direction(lat, lng):
return formula.qibla(lat, lng)
def direction_dms(lat, lng):
return _dms(formula.qibla(lat, lng))
def direction_str(lat, lng, prec=0):
d, m, s = direction_dms(lat, lng)
# negative input might returns wrong result
return '{}° {}\' {:.{}f}"'.fo... | from . import formula
def direction(lat, lng):
return formula.qibla(lat, lng)
def direction_dms(lat, lng):
return _dms(formula.qibla(lat, lng))
def direction_str(lat, lng, prec=0):
d, m, s = direction_dms(lat, lng)
# negative input might returns wrong result
return '{}° {}\' {:.{}f}"'.format(d, m, s, prec)
def... | Python | 0.000002 |
9f1913ca658228c2c6551b2c8de1d48ddd73c8aa | raise version to 2 | brilws/_version.py | brilws/_version.py | __version__ = "2.0.0"
| __version__ = "1.0.3"
| Python | 0.000001 |
97831652f0d06236d83d0731813ffcdc44a4e190 | Update pypi version | fontdump/__init__.py | fontdump/__init__.py | __version__ = '1.1.0' | __version__ = '0.1.0' | Python | 0 |
22461c6ddc1a6bff0ee8637139146b8531b3e0b4 | improve python error message when tp fails to start | python/perfetto/trace_processor/shell.py | python/perfetto/trace_processor/shell.py | #!/usr/bin/env python3
# Copyright (C) 2020 The Android Open Source Project
#
# 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 requ... | #!/usr/bin/env python3
# Copyright (C) 2020 The Android Open Source Project
#
# 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 requ... | Python | 0.000001 |
c182e4f3d7df431fe5c542988fcef9f05825913c | Update the raw_parameter_script | 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.000193 |
a713bbb1226863b4417362019431de0266faa2d9 | Update automateprojectscript.py | automateprojectscript.py | automateprojectscript.py | #!/usr/bin/python
"""
This python file just runs all of the terminal commands needed to run the project. It just saves time not having to manually type in these commands every time you want to run the project.
At the moment it only works for the example project, as the project later develops this script might be upda... | #!/usr/bin/python
"""
This python file just runs all of the terminal commands needed to run the project. It just saves time not having to manually type in these commands every time you want to run the project.
At the moment it only works for the example project, as the project later develops this script might be upda... | Python | 0 |
252d4212e7952db3d36e0324ba237cc109d62279 | Replace . by _ in signal and entity names. | src/dynamic_graph/sot/core/feature_position.py | src/dynamic_graph/sot/core/feature_position.py | # -*- coding: utf-8 -*-
# Copyright 2011, Florent Lamiraux, Thomas Moulard, JRL, CNRS/AIST
#
# This file is part of dynamic-graph.
# dynamic-graph is free software: you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either ... | # -*- coding: utf-8 -*-
# Copyright 2011, Florent Lamiraux, Thomas Moulard, JRL, CNRS/AIST
#
# This file is part of dynamic-graph.
# dynamic-graph is free software: you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation, either ... | Python | 0.000027 |
ae9b94f28b3677be2867bfffb9e1dcec8851aaa0 | Fix typo in example usage for extract_variable.py script. | prompt_tuning/scripts/extract_variable.py | prompt_tuning/scripts/extract_variable.py | # Copyright 2022 Google.
#
# 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, soft... | # Copyright 2022 Google.
#
# 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, soft... | Python | 0.99978 |
3f1d30c2aeff73bb4863f2d0fd0660a264715739 | Tidy up | src/planner.py | src/planner.py | from collections import deque
class GamePlan(object):
"""
initialise the tournament object with an overall list of players' IDs
input:
a list of players
output:
a list (len = number of rounds) of lists of tuples
with players' names (maybe change to IDs from db) in white, black order
... | from collections import deque
class GamePlan(object):
"""
initialise the tournament object with an overall list of players' IDs
input:
a list of players
output:
a list (len = number of rounds) of lists of tuples
with players' names (maybe change to IDs from db) in white, black order
... | Python | 0.000001 |
856171e4933b872b1537945d3e6033da4313a1cb | enable gzip in django | ses_maker/settings.py | ses_maker/settings.py | """
Django settings for ses_maker project.
Generated by 'django-admin startproject' using Django 1.10.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import ... | """
Django settings for ses_maker project.
Generated by 'django-admin startproject' using Django 1.10.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import ... | Python | 0.000001 |
65783ec0baac5886232a5334905a748750b3c0c2 | fix NameError | sfa/methods/Update.py | sfa/methods/Update.py | ### $Id: update.py 16477 2010-01-05 16:31:37Z thierry $
### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/methods/update.py $
import time
from sfa.util.faults import *
from sfa.util.method import Method
from sfa.util.parameter import Parameter, Mixed
from sfa.trust.credential import Credential
class Update(Metho... | ### $Id: update.py 16477 2010-01-05 16:31:37Z thierry $
### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/methods/update.py $
import time
from sfa.util.faults import *
from sfa.util.method import Method
from sfa.util.parameter import Parameter, Mixed
from sfa.trust.credential import Credential
class Update(Metho... | Python | 0.000003 |
6a582b6e2fa852d6a80268c7ddd305d45416c8ef | Fix YUM and DNF usage. | hotness/repository.py | hotness/repository.py | import logging
import subprocess
import os
import ConfigParser
from six import StringIO
from hotness.cache import cache
log = logging.getLogger('fedmsg')
thn_section = 'thn'
class ThnConfigParser(ConfigParser.ConfigParser):
def read(self, filename):
try:
text = open(filename).read()
... | import logging
import subprocess
import os
import ConfigParser
from six import StringIO
from hotness.cache import cache
log = logging.getLogger('fedmsg')
thn_section = 'thn'
class ThnConfigParser(ConfigParser.ConfigParser):
def read(self, filename):
try:
text = open(filename).read()
... | Python | 0 |
d307b65f8bf5f9ae8eaaefa071fd2055304a6725 | Remove custom form from admin. | saskatoon/harvest/admin.py | saskatoon/harvest/admin.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib import admin
from forms import RFPForm, PropertyForm, HarvestForm, HarvestYieldForm, EquipmentForm
from member.models import *
from harvest.models import *
from harvest.forms import *
class PropertyInline(admin.TabularInline):
model = Property
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.contrib import admin
from forms import RFPForm, PropertyForm, HarvestForm, HarvestYieldForm, EquipmentForm
from member.models import *
from harvest.models import *
from harvest.forms import *
class PropertyInline(admin.TabularInline):
model = Property
... | Python | 0 |
5bb92bea9d910c788efa3ea5b7ca41499d92be26 | update cuba.py with the autogenerated one | simphony/core/cuba.py | simphony/core/cuba.py | # code auto-generated by the cuba-generate.py script.
from enum import IntEnum, unique
@unique
class CUBA(IntEnum):
NAME = 1
DIRECTION = 3
STATUS = 4
LABEL = 5
MATERIAL_ID = 6
CHEMICAL_SPECIE = 7
MATERIAL_TYPE = 8
SHAPE_CENTER = 9
SHAPE_LENGTH_UC = 10
SHAPE_LENGTH = 11
SHA... | from enum import IntEnum, unique
@unique
class CUBA(IntEnum):
NAME = 0
DIRECTION = 1
STATUS = 2
LABEL = 3
MATERIAL_ID = 4
MATERIAL_TYPE = 5
SHAPE_CENTER = 6
SHAPE_LENGTH_UC = 7
SHAPE_LENGTH = 8
SHAPE_RADIUS = 9
SHAPE_SIDE = 10
CRYSTAL_STORAGE = 11
NAME_UC = 12
... | Python | 0 |
e28a41e5996651aefdf7966ead73310a5a761040 | fix flake8 violation | simphony/cuds/bond.py | simphony/cuds/bond.py | class Bond(object):
"""
Bond entity
"""
def __init__(self, id, particles, data=None):
self.id = id
self.particles = particles
if data is None:
self.data = {}
else:
self.data = data
def __eq__(self, other):
if isinstance(other, self.__c... | class Bond(object):
"""
Bond entity
"""
def __init__(self, id, particles, data=None):
self.id = id
self.particles = particles
if data is None:
self.data = {}
else:
self.data = data
def __eq__(self, other):
if isinstance(other, self.__... | Python | 0 |
2e2f6d2a6480a4ca43c76e6559cfe6aadc434a8b | change to dumps | functions/webhook.py | functions/webhook.py | #!/usr/bin/python
# Written by: Andrew Jackson
# This is used to send a JSON payload to a webhook.
import json
import logging
import os
import time
import uuid
import boto3
import requests
import decimal
#def default(obj):
# if isinstance(obj, decimal.Decimal):
# return int(obj)
# return o.__dict__
def h... | #!/usr/bin/python
# Written by: Andrew Jackson
# This is used to send a JSON payload to a webhook.
import json
import logging
import os
import time
import uuid
import boto3
import requests
import decimal
#def default(obj):
# if isinstance(obj, decimal.Decimal):
# return int(obj)
# return o.__dict__
def h... | Python | 0.000004 |
f83369a263fb606a6f92b62a45d72e8faf0f1770 | Add RunGM and RunBench steps for Android Review URL: https://codereview.appspot.com/5987049 | master/skia_master_scripts/android_factory.py | master/skia_master_scripts/android_factory.py | # Copyright (c) 2011 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.
"""Utility class to build the Skia master BuildFactory's for Android buildbots.
Overrides SkiaFactory with any Android-specific steps."""
from skia_mas... | # Copyright (c) 2011 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.
"""Utility class to build the Skia master BuildFactory's for Android buildbots.
Overrides SkiaFactory with any Android-specific steps."""
from skia_mas... | Python | 0 |
984422fe3fb0b34a17e42910a9c1b98afa572452 | Revert r9607 -- it caused a BuildbotSelfTest failure | master/skia_master_scripts/android_factory.py | master/skia_master_scripts/android_factory.py | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utility class to build the Skia master BuildFactory's for Android buildbots.
Overrides SkiaFactory with any Android-specific steps."""
from buildb... | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utility class to build the Skia master BuildFactory's for Android buildbots.
Overrides SkiaFactory with any Android-specific steps."""
from buildb... | Python | 0 |
4b740ddb11fb5c4b2b29bc6eef0a5569349272f8 | make random_metadata compliant | datalake_common/tests/conftest.py | datalake_common/tests/conftest.py | import pytest
import random
import string
from datetime import datetime, timedelta
@pytest.fixture
def basic_metadata():
return {
'version': 0,
'start': 1426809600000,
'end': 1426895999999,
'where': 'nebraska',
'what': 'apache',
'hash': '12345'
}
def random_wo... | import pytest
import random
import string
from datetime import datetime, timedelta
@pytest.fixture
def basic_metadata():
return {
'version': 0,
'start': 1426809600000,
'end': 1426895999999,
'where': 'nebraska',
'what': 'apache',
'hash': '12345'
}
def random_wo... | Python | 0.000004 |
4507c0cb56ed72253d52c92f621ec33600e5e36b | Add version number for future use | sla_bot.py | sla_bot.py | import asyncio
import datetime as dt
import math
import os
import traceback
import discord
from discord.ext import commands
from SLA_bot.config import Config as cf
from SLA_bot.schedule import Schedule
VERSION = 0.10
curr_dir = os.path.dirname(__file__)
configs = [
os.path.join(curr_dir, 'docs', 'default_conf... | import asyncio
import datetime as dt
import math
import os
import traceback
import discord
from discord.ext import commands
from SLA_bot.config import Config as cf
from SLA_bot.schedule import Schedule
curr_dir = os.path.dirname(__file__)
configs = [
os.path.join(curr_dir, 'docs', 'default_config.ini'),
o... | Python | 0 |
5d82c2d9f6d2874ae4621edb4dc1e6455652666b | Remove Dropout and unnecessary imports | examples/imdb_fasttext.py | examples/imdb_fasttext.py | '''This example demonstrates the use of fasttext for text classification
Based on Joulin et al's paper:
Bags of Tricks for Efficient Text Classification
https://arxiv.org/abs/1607.01759
Can achieve accuracy around 88% after 5 epochs in 70s.
'''
from __future__ import print_function
import numpy as np
np.random.see... | '''This example demonstrates the use of fasttext for text classification
Based on Joulin et al's paper:
Bags of Tricks for Efficient Text Classification
https://arxiv.org/abs/1607.01759
Can achieve accuracy around 88% after 5 epochs in 70s.
'''
from __future__ import print_function
import numpy as np
np.random.see... | Python | 0 |
20ef3aed661d5b77bedf48df9ed6917e24319c01 | Fix typo | factory/glideFactoryLogParser.py | factory/glideFactoryLogParser.py | #
# Description:
# This module implements classes to track
# changes in glidein status logs
#
# Author:
# Igor Sfiligoi (Feb 2nd 2007)
#
import os, os.path
import condorLogParser
# for now it is just a constructor wrapper
# Further on it will need to implement glidein exit code checks
class dirSummaryTimings(c... | #
# Description:
# This module implements classes to track
# changes in glidein status logs
#
# Author:
# Igor Sfiligoi (Feb 2nd 2007)
#
import os, os.path
import condorLogParser
# for now it is just a constructor wrapper
# Further on it will need to implement glidein exit code checks
class dirSummaryTimings(c... | Python | 0.999999 |
ae38884444be3b3e0f98ca406352fe92037423f1 | making the products model abstract | scofield/product/models.py | scofield/product/models.py | from django.db import models
from datetime import datetime
from scofield.category.models import *
from scofield.manufacturer.models import Manufacturer
class ProductModel(models.Model):
"""
Base class for products
"""
#timestamps
date_added = models.DateTimeField(default=datetime.now)
date_... | from django.db import models
from scofield.category.models import *
from scofield.manufacturer.models import Manufacturer
class Product(models.Model):
"""
Base class for products
"""
name = models.CharField(max_length=200, null=False, blank=False, help_text='Product Name')
slug = models.SlugFie... | Python | 0.999999 |
c47a51db4f7ccc514aa687a1859ed592574d1a58 | Change API Endpoint to BzAPI Compatibility Layer | bugzilla/agents.py | bugzilla/agents.py | from bugzilla.models import *
from bugzilla.utils import *
class InvalidAPI_ROOT(Exception):
def __str__(self):
return "Invalid API url specified. " + \
"Please set BZ_API_ROOT in your environment " + \
"or pass it to the agent constructor"
class BugzillaAgent(object):
de... | from bugzilla.models import *
from bugzilla.utils import *
class InvalidAPI_ROOT(Exception):
def __str__(self):
return "Invalid API url specified. " + \
"Please set BZ_API_ROOT in your environment " + \
"or pass it to the agent constructor"
class BugzillaAgent(object):
de... | Python | 0 |
22b91d3f58eb9a6c021645a4aea56c864d151bba | Fix get_favorite_for typo in templatetags | favit/templatetags/favit_tags.py | favit/templatetags/favit_tags.py | # -*- coding: utf-8 -*-
from django import template
from django.db.models import get_model
from django.template.loader import render_to_string
from ..models import Favorite
register = template.Library()
@register.simple_tag(takes_context=True)
def favorite_button(context, target):
user = context['request'].use... | # -*- coding: utf-8 -*-
from django import template
from django.db.models import get_model
from django.template.loader import render_to_string
from ..models import Favorite
register = template.Library()
@register.simple_tag(takes_context=True)
def favorite_button(context, target):
user = context['request'].use... | Python | 0 |
66ad5e449b1f28dbde2bc30a37ad3c568ae9166f | Fix bins | examples/plot_dom_hits.py | examples/plot_dom_hits.py | # -*- coding: utf-8 -*-
"""
==================
DOM hits.
==================
Estimate track/DOM distances using the number of hits per DOM.
"""
from __future__ import absolute_import, print_function, division
# Author: Tamas Gal <tgal@km3net.de>
# License: BSD-3
from collections import defaultdict, Counter
import nu... | # -*- coding: utf-8 -*-
"""
==================
DOM hits.
==================
Estimate track/DOM distances using the number of hits per DOM.
"""
from __future__ import absolute_import, print_function, division
# Author: Tamas Gal <tgal@km3net.de>
# License: BSD-3
from collections import defaultdict, Counter
import nu... | Python | 0.000001 |
14c31307fd31631ecce0378aedbef95cec8531f2 | Fix autodiscovery | gargoyle/__init__.py | gargoyle/__init__.py | """
gargoyle
~~~~~~~~
:copyright: (c) 2010 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
from django.utils.module_loading import autodiscover_modules
from gargoyle.manager import gargoyle
__version__ = '1.2.0'
VERSION = __version__ # old version compat
__all__ = ('gargoyle', 'autodiscover... | """
gargoyle
~~~~~~~~
:copyright: (c) 2010 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
from django.utils.module_loading import autodiscover_modules
from gargoyle.manager import gargoyle
__version__ = '1.2.0'
VERSION = __version__ # old version compat
__all__ = ('gargoyle', 'autodiscover... | Python | 0 |
e0def112fda555307cc9d8249056b92c7f86f29a | Pass the amount of values to softmax | eva/models/wavenet.py | eva/models/wavenet.py | from keras.models import Model
from keras.layers import Input, Convolution1D, Activation, Merge, Lambda
from keras.layers.advanced_activations import PReLU
from keras.optimizers import Nadam
from eva.layers.causal_atrous_convolution1d import CausalAtrousConvolution1D
from eva.layers.wavenet_block import WavenetBlock, ... | from keras.models import Model
from keras.layers import Input, Convolution1D, Activation, Merge, Lambda
from keras.layers.advanced_activations import PReLU
from keras.optimizers import Nadam
from eva.layers.causal_atrous_convolution1d import CausalAtrousConvolution1D
from eva.layers.wavenet_block import WavenetBlock, ... | Python | 0.9994 |
f4063d86404adbb5489edefd6c12d855de246dee | test that we can decode all doubly-encoded characters (doesn't pass yet) | ftfy/test_unicode.py | ftfy/test_unicode.py | # -*- coding: utf-8 -*-
from ftfy.fixes import fix_text_encoding
import unicodedata
import sys
from nose.tools import eq_
if sys.hexversion >= 0x03000000:
unichr = chr
# Most single-character strings which have been misencoded should be restored.
def test_all_bmp_characters():
for index in range(0xa0, 0xfffd)... | # -*- coding: utf-8 -*-
from ftfy.fixes import fix_text_encoding
import unicodedata
import sys
if sys.hexversion >= 0x03000000:
unichr = chr
# Most single-character strings which have been misencoded should be restored.
def test_all_bmp_characters():
for index in range(0xa0, 0xfffd):
char = unichr(ind... | Python | 0.000001 |
c9e37f9b241c2bef2ffdb4811cec41c951b21ef9 | Update fluid_cat_slim.py | cat_boxing/caged_cat/python/fluid_cat_slim.py | cat_boxing/caged_cat/python/fluid_cat_slim.py | from random import randint
def generate_cat():
cat_size = randint(1,100)
return cat_size
def fill_box():
empty_room = 400
j = 0
while empty_room > 0:
cat = generate_cat()
empty_room = empty_room - cat
j = j + 1
return j
def fill_truck():
truck_size = 40
ca... | from random import randint
def generate_cat():
cat_size = randint(1,100)
return cat_size
def fill_box():
box_size = 400
empty_room = 400
j = 0
while empty_room > 0:
cat = generate_cat()
empty_room = empty_room - cat
j = j + 1
return j
def fill_truck():
tru... | Python | 0.000003 |
f9e543f8c84f8a6f9d6ead0d2a1f9979d6a0ab8b | add write timing | humanhive/audio_interface.py | humanhive/audio_interface.py | import pyaudio
import time
class AudioInterface:
"""
Manages the sound interface. This manages the main callback for the audio
interface and delegates behaviour to the Playback and Recording modules.
"""
def __init__(self,
playback,
recording_queue,
... | import pyaudio
import time
class AudioInterface:
"""
Manages the sound interface. This manages the main callback for the audio
interface and delegates behaviour to the Playback and Recording modules.
"""
def __init__(self,
playback,
recording_queue,
... | Python | 0.00001 |
d1e66c414aac60cc7770ddeff091dedc5c0047f6 | Remove debug `print` from feature extraction | feature_extraction/extraction.py | feature_extraction/extraction.py | import numpy as np
import skimage.exposure as exposure
from .util import AttributeDict
def extract_features(image, measurements):
"""
Given an image as a Numpy array and a set of measurement objects
implementing a compute method returning a feature vector, return a combined
feature vector.
"""
# TODO(liam): par... | import numpy as np
import skimage.exposure as exposure
from .util import AttributeDict
def extract_features(image, measurements):
"""
Given an image as a Numpy array and a set of measurement objects
implementing a compute method returning a feature vector, return a combined
feature vector.
"""
# TODO(liam): par... | Python | 0.000001 |
15652a0b80b0fa0c87ac9ccd33eaada22859bfa2 | Update the_most_numbers.py | checkio/python/elementary/the_most_numbers.py | checkio/python/elementary/the_most_numbers.py | def distance(*args):
if args:
min = args[0]
max = args[0]
for x in args:
if x < min:
min = x
if x > max:
max = x
else:
min = 0
max = 0
return max - min
| Python | 0.998495 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.