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 |
|---|---|---|---|---|---|---|---|
bffdc451e8dc9df2219158349b60f082ab087a27 | add proposal pk to serializer to give votes unique id | meinberlin/apps/budgeting/serializers.py | meinberlin/apps/budgeting/serializers.py | from rest_framework import serializers
from adhocracy4.categories.models import Category
from .models import Proposal
class CategoryField(serializers.Field):
def to_internal_value(self, category):
if category:
return Category.objects.get(pk=category)
else:
return None
... | from rest_framework import serializers
from adhocracy4.categories.models import Category
from .models import Proposal
class CategoryField(serializers.Field):
def to_internal_value(self, category):
if category:
return Category.objects.get(pk=category)
else:
return None
... | Python | 0 |
49cccc635c7a0491b81c915ac8a4cdeb54e7dcc8 | Optimize normals computation. | Core/Normal.py | Core/Normal.py | # -*- coding:utf-8 -*-
# ***************************************************************************
# Normal.py
# -------------------
# update : 2013-11-23
# copyright : (C) 2013 by Michaël Roy
# email : mic... | # -*- coding:utf-8 -*-
# ***************************************************************************
# Normal.py
# -------------------
# update : 2013-11-21
# copyright : (C) 2013 by Michaël Roy
# email : mic... | Python | 0.000002 |
b8fb50f9f1b7c85811ed3550418eae2b72d30faf | Add index | radar/radar/models/logs.py | radar/radar/models/logs.py | from datetime import datetime
from sqlalchemy import event, DDL, Column, Integer, DateTime, String, text, Index
from sqlalchemy.dialects import postgresql
from sqlalchemy.orm import relationship
from radar.database import db
class Log(db.Model):
__tablename__ = 'logs'
id = Column(Integer, primary_key=True)... | from datetime import datetime
from sqlalchemy import event, DDL, Column, Integer, DateTime, String, text
from sqlalchemy.dialects import postgresql
from sqlalchemy.orm import relationship
from radar.database import db
class Log(db.Model):
__tablename__ = 'logs'
id = Column(Integer, primary_key=True)
da... | Python | 0.000017 |
628655791fc41e5496dd8bed05beb232d7c0d104 | Store calculated intermediate values and use them for inheritance | UM/Settings/SettingOverrideDecorator.py | UM/Settings/SettingOverrideDecorator.py | # Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the AGPLv3 or higher.
from UM.Scene.SceneNodeDecorator import SceneNodeDecorator
from UM.Signal import Signal, SignalEmitter
from UM.Application import Application
from copy import deepcopy
## A decorator that can be used to override indiv... | # Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the AGPLv3 or higher.
from UM.Scene.SceneNodeDecorator import SceneNodeDecorator
from UM.Signal import Signal, SignalEmitter
from UM.Application import Application
from copy import deepcopy
## A decorator that can be used to override indiv... | Python | 0 |
9df2420f152e48a0e99598220e4560fe25c9fd36 | add an argument to TblTreeEntries.__init__() | AlphaTwirl/HeppyResult/TblTreeEntries.py | AlphaTwirl/HeppyResult/TblTreeEntries.py | # Tai Sakuma <tai.sakuma@cern.ch>
from ..mkdir_p import mkdir_p
from ..listToAlignedText import listToAlignedText
import os
import ROOT
##__________________________________________________________________||
class TblTreeEntries(object):
def __init__(self, analyzerName, fileName, treeName, outPath, columnName = 'n'... | # Tai Sakuma <tai.sakuma@cern.ch>
from ..mkdir_p import mkdir_p
from ..listToAlignedText import listToAlignedText
import os
import ROOT
##__________________________________________________________________||
class TblTreeEntries(object):
def __init__(self, analyzerName, fileName, treeName, outPath):
self.an... | Python | 0.000551 |
1fcaeb69048a5124ad2a74ce8761685e2d76a360 | normalize elem start in wp_parser.py | wp_parser.py | wp_parser.py | """
parse data (naive & wreckless) from huge Wikipedia XML Dump
"""
__author__ = "siznax"
__verion__ = "29 Sep 2015"
class WPParser:
MAX_ELEM_BYTES = 1024**2
_ebfr = ""
_found_end = False
_found_start = False
_sbfr = ""
elem = ""
elems_found = 0
elems_processed = 0
def __init__(... | """
parse data from huge Wikipedia XML Dump
"""
__author__ = "siznax"
__verion__ = "29 Sep 2015"
class WPParser:
MAX_ELEM_BYTES = 1024**2
_ebfr = ""
_found_end = False
_found_start = False
_sbfr = ""
elem = ""
elems_found = 0
elems_processed = 0
def __init__(self, start="<page>"... | Python | 0.000013 |
b850d7738a48633192452a95ecbefe2dc145822b | update requirements | myideas/core/migrations/0001_initial.py | myideas/core/migrations/0001_initial.py | # -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-04-29 08:13
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import tagulous.models.fields
import tagulous.models.models
class Migration(migrations.Migration)... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-10 15:52
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import tagulous.models.fields
import tagulous.models.models
class Migration(migrations.Migration)... | Python | 0 |
0de57c0c14362d2f9c40975326c8cb1bf792e2a0 | make compiled dir | binding.gyp | binding.gyp | {
'targets': [
{
'target_name': 'chimera',
'sources': [
'src/top.cc',
'src/cookiejar.cc',
'src/chimera.cc',
'src/browser.cc'
],
'conditions': [
['OS=="mac"', {
'include_dirs': [
'qt_compiled/include',
'qt_compiled/in... | {
'targets': [
{
'target_name': 'chimera',
'sources': [
'src/top.cc',
'src/cookiejar.cc',
'src/chimera.cc',
'src/browser.cc'
],
'conditions': [
['OS=="mac"', {
'include_dirs': [
'qt/include',
'qt/include/QtCore',
... | Python | 0 |
20ee95f56033b5a7d9d1e5f022118850b339ace9 | remove old ssl | binding.gyp | binding.gyp | {
'targets': [
{
'target_name': 'chimera',
'sources': [
'src/top.cc',
'src/cookiejar.cc',
'src/chimera.cc',
'src/browser.cc'
],
'conditions': [
['OS=="mac"', {
'include_dirs': [
'qt_compiled/include',
'qt_compiled/in... | {
'targets': [
{
'target_name': 'chimera',
'sources': [
'src/top.cc',
'src/cookiejar.cc',
'src/chimera.cc',
'src/browser.cc'
],
'conditions': [
['OS=="mac"', {
'include_dirs': [
'qt_compiled/include',
'qt_compiled/in... | Python | 0.999082 |
fe290c9f3edc477707e88cb5942ee6c5bd1db568 | fix the http backend -- outgoing was still busted | lib/rapidsms/backends/http.py | lib/rapidsms/backends/http.py | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import BaseHTTPServer, SocketServer
import select
import random
import re
import urllib
import httphandlers as handlers
import rapidsms
from rapidsms.backends.base import BackendBase
class HttpServer (BaseHTTPServer.HTTPServer, SocketServer.ThreadingMixIn):
... | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4
import BaseHTTPServer, SocketServer
import select
import random
import re
import urllib
import httphandlers as handlers
import rapidsms
from rapidsms.backends.base import BackendBase
class HttpServer (BaseHTTPServer.HTTPServer, SocketServer.ThreadingMixIn):
... | Python | 0.000001 |
9f53cdc4ffa2b34aae59cf9f95958aae83964e7f | Update pexels.py | postcards/plugin_pexels/util/pexels.py | postcards/plugin_pexels/util/pexels.py | import random
import requests
from bs4 import BeautifulSoup
import os
import urllib
import sys
import base64
from pypexels import PyPexels
#Decode pexels API key from abertschi
base64_message = 'NTYzNDkyYWQ2ZjkxNzAwMDAxMDAwMDAxNmEzNTcyNDA4YmVjNGFmNzc0YTYzYTRjNjdjZGNkMGIK'
base64_bytes = base64_message.encode('ascii')
... | import random
import requests
from bs4 import BeautifulSoup
import os
import urllib
import sys
words_location = os.path.dirname(os.path.realpath(__file__)) + '/words.txt'
pexels_search_url = 'https://www.pexels.com/search/'
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like... | Python | 0 |
bf336d99484cc3804f469631b513a927940ada30 | Add scan_steps wrapper for scan_nd | profile_collection/startup/50-scans.py | profile_collection/startup/50-scans.py | # vim: sw=4 ts=4 sts expandtab smarttab
# HXN step-scan configuration
import hxntools.scans
from bluesky.global_state import get_gs
gs = get_gs()
hxntools.scans.setup()
ct = hxntools.scans.count
ascan = hxntools.scans.absolute_scan
dscan = hxntools.scans.relative_scan
fermat = hxntools.scans.relative_fermat
spiral =... | # vim: sw=4 ts=4 sts expandtab smarttab
# HXN step-scan configuration
import hxntools.scans
from bluesky.global_state import get_gs
gs = get_gs()
hxntools.scans.setup()
ct = hxntools.scans.count
ascan = hxntools.scans.absolute_scan
dscan = hxntools.scans.relative_scan
fermat = hxntools.scans.relative_fermat
spiral =... | Python | 0.000001 |
817fbb054f7422ec8adc16f079b8f70ed2534356 | remove shebang and executable bit | bin/auth.py | bin/auth.py | import argparse
import pathlib
import googleapiclient.discovery
import httplib2
import oauth2client.client
import oauth2client.file
import oauth2client.tools
YOUTUBE_API_SERVICE_NAME = 'youtube'
YOUTUBE_API_VERSION = 'v3'
YOUTUBE_ANALYTICS_API_SERVICE_NAME = 'youtubeAnalytics'
YOUTUBE_ANALYTICS_API_VERSION = 'v1'
HE... | #!/usr/bin/env python3
import argparse
import pathlib
import googleapiclient.discovery
import httplib2
import oauth2client.client
import oauth2client.file
import oauth2client.tools
YOUTUBE_API_SERVICE_NAME = 'youtube'
YOUTUBE_API_VERSION = 'v3'
YOUTUBE_ANALYTICS_API_SERVICE_NAME = 'youtubeAnalytics'
YOUTUBE_ANALYTIC... | Python | 0.000001 |
0f518f87e7e2af5d93481704c2430255373a4965 | fix a typo. | governor.py | governor.py | #!/usr/bin/env python
import logging
import os
import sys
import time
import yaml
from helpers.api import RestApiServer
from helpers.etcd import Etcd
from helpers.postgresql import Postgresql
from helpers.ha import Ha
from helpers.utils import setup_signal_handlers, sleep
from helpers.aws import AWSConnection
class ... | #!/usr/bin/env python
import logging
import os
import sys
import time
import yaml
from helpers.api import RestApiServer
from helpers.etcd import Etcd
from helpers.postgresql import Postgresql
from helpers.ha import Ha
from helpers.utils import setup_signal_handlers, sleep
import helpers.aws import AWSConnection
clas... | Python | 0.03285 |
3453e903a50859c596c0997e87b62fb0f54d6d56 | add inchi_lock.cc | binding.gyp | binding.gyp | {
"target_defaults": {
"conditions": [
['OS=="win"', {
}, {
'cflags' : [ "-fexceptions" ],
'cflags_cc' : [ "-fexceptions" ]
} ]
],
"configurations": {
"Release": {
'msvs_settings': {
'VCCLCompilerTool': {
'WholeProgramOptimization': ... | {
"target_defaults": {
"conditions": [
['OS=="win"', {
}, {
'cflags' : [ "-fexceptions" ],
'cflags_cc' : [ "-fexceptions" ]
} ]
],
"configurations": {
"Release": {
'msvs_settings': {
'VCCLCompilerTool': {
'WholeProgramOptimization': ... | Python | 0.000001 |
a292e1fe8ec72355ce2bb3c1f99dd82d6f145438 | Add path to homebrew-installed pkgconfig for Mac OS 10.8 (10.9 is symlinked to 10.8) #9 | binding.gyp | binding.gyp | {
'targets': [{
'target_name': 'sharp',
'sources': ['src/sharp.cc'],
'libraries': [
'<!@(PKG_CONFIG_PATH="/usr/local/Library/ENV/pkgconfig/10.8:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig" pkg-config --libs vips)'
],
'include_dirs': [
'/usr/local/include/glib-2.0',
'/usr/local/li... | {
'targets': [{
'target_name': 'sharp',
'sources': ['src/sharp.cc'],
'libraries': [
'<!@(PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" pkg-config --libs vips)',
'<!@(PKG_CONFIG_PATH="/usr/lib/pkgconfig" pkg-config --libs vips)'
],
'include_dirs': [
'/usr/local/include/glib-2.0',
... | Python | 0.000001 |
88021aeb5e7c4d0f3a50333b3f77624ac718c03c | Use `ASM` mode on the linux + non glibc environ | binding.gyp | binding.gyp | {
'target_defaults': {
'default_configuration': 'Release',
'configurations': {
'Release': {
'cflags': [ '-O3' ],
'xcode_settings': {
'GCC_OPTIMIZATION_LEVEL': '3',
'GCC_GENERATE_DEBUGGING_SYMBOLS': 'NO',
},
'msvs_settings': {
'VCCLCompilerTool': {
'Optimization': 3,
'F... | {
'target_defaults': {
'default_configuration': 'Release',
'configurations': {
'Release': {
'cflags': [ '-O3' ],
'xcode_settings': {
'GCC_OPTIMIZATION_LEVEL': '3',
'GCC_GENERATE_DEBUGGING_SYMBOLS': 'NO',
},
'msvs_settings': {
'VCCLCompilerTool': {
'Optimization': 3,
'F... | Python | 0.000002 |
e68f66043b2770aa782d2d7d293de281527d1891 | test travis | binding.gyp | binding.gyp | {
"targets": [
{
"target_name": "addon",
"sources": [
"src/addon.cc",
"src/object.cc",
"src/async.cc",
"src/engine.cc",
"src/results.cc"
],
#"cflags": [ "-Werror", "-Wall", "-Wextra", "-Wpedantic", "-Wunused-parameter", "-funroll-loops", "-Ofast" ],#targets all... | {
"targets": [
{
"target_name": "addon",
"sources": [
"src/addon.cc",
"src/object.cc",
"src/async.cc",
"src/engine.cc",
"src/results.cc"
],
#"cflags": [ "-Werror", "-Wall", "-Wextra", "-Wpedantic", "-Wunused-parameter", "-funroll-loops", "-Ofast" ],#targets all... | Python | 0.000002 |
73c8378f91687abfb58a8a964c2e5664b3e4c096 | Fix ordinal naming | angr/procedures/win32/dynamic_loading.py | angr/procedures/win32/dynamic_loading.py | import angr
import claripy
import logging
l = logging.getLogger('angr.procedures.win32.dynamic_loading')
class LoadLibraryA(angr.SimProcedure):
def run(self, lib_ptr):
lib = self.state.mem[lib_ptr].string.concrete
return self.load(lib)
def load(self, lib):
if '.' not in lib:
... | import angr
import claripy
import logging
l = logging.getLogger('angr.procedures.win32.dynamic_loading')
class LoadLibraryA(angr.SimProcedure):
def run(self, lib_ptr):
lib = self.state.mem[lib_ptr].string.concrete
return self.load(lib)
def load(self, lib):
if '.' not in lib:
... | Python | 0.999575 |
b5df30371e7f975311ed4e783e204a9e38f97b0a | add conditions in binding.gyp file to fix issues | binding.gyp | binding.gyp | {
"targets": [
{
"target_name": "addon",
"sources": [ "addon.cc", "myobject.cc" ],
"conditions": [
['OS=="mac"', {
"cflags": [ "-m64" ],
"ldflags": [ "-m64" ],
"xcode_settings": {
"OTHER_CFLAGS": ["-O... | {
"targets": [
{
"target_name": "addon",
"sources": [ "addon.cc", "myobject.cc" ]
}
]
}
| Python | 0 |
8efda67b5ca352e92183132dcf78a9292da057a0 | Fix loading of .plist files | package_reviewer/checkers/check_resource_files.py | package_reviewer/checkers/check_resource_files.py | import functools
import itertools
import json
import logging
import plistlib
import xml.etree.ElementTree as ET
from ..base import Checker
from .. import jsonc
l = logging.getLogger(__name__)
class CheckResourceFiles(Checker):
# Cache results of glob calls
@functools.lru_cache()
def glob(self, pattern)... | import functools
import itertools
import json
import logging
import plistlib
import xml.etree.ElementTree as ET
from ..base import Checker
from .. import jsonc
l = logging.getLogger(__name__)
class CheckResourceFiles(Checker):
# Cache results of glob calls
@functools.lru_cache()
def glob(self, pattern)... | Python | 0 |
9b9359c06e44fe5a8f5f16f662fcea2ef3e8f18d | Remove delay load hook | binding.gyp | binding.gyp | {
"targets" : [{
"target_name" : "ofe",
"sources" : [ "ofe.cc" ],
"include_dirs": [
'<!(node -e "require(\'nan\')")'
],
"win_delay_load_hook" : "false"
}]
}
| {
"targets" : [{
"target_name" : "ofe",
"sources" : [ "ofe.cc" ],
"include_dirs": [
'<!(node -e "require(\'nan\')")'
]
}]
}
| Python | 0.000001 |
a30eb4a1eaa3a9677950c37f273e7ac16cae698f | Change init method | DSTC2/basic.py | DSTC2/basic.py | # -*- coding:utf-8 -*-
from sklearn.cross_validation import train_test_split
from DSTC2.traindev.scripts import myLogger
from DSTC2.traindev.scripts.model import bp
from traindev.scripts import file_reader
from traindev.scripts import initializer
from traindev.scripts.initializer import Set
__author__ = "JOHNKYON"... | # -*- coding:utf-8 -*-
from sklearn.cross_validation import train_test_split
from DSTC2.traindev.scripts import myLogger
from DSTC2.traindev.scripts.model import bp
from traindev.scripts import file_reader
from traindev.scripts import initializer
from traindev.scripts.initializer import Set
__author__ = "JOHNKYON"... | Python | 0.000008 |
e36054ab878b10d9e2bc0b21a21d589a16945449 | Add -Wno-unused-function to xcode flags | binding.gyp | binding.gyp | {
"targets": [
{
"target_name": "bswap",
"sources": [ "src/bswap.cc" ],
"include_dirs" : [
"<!(node -e \"require('nan')\")"
],
"cflags":[
"-march=native",
"-falign-loops=32", # See readme; significant improvement for some cases
"-Wno-unused-function", ... | {
"targets": [
{
"target_name": "bswap",
"sources": [ "src/bswap.cc" ],
"include_dirs" : [
"<!(node -e \"require('nan')\")"
],
"cflags":[
"-march=native",
"-falign-loops=32", # See readme; significant improvement for some cases
"-Wno-unused-function", ... | Python | 0.000001 |
5fade792a45a7434f1b8c03e7835756ef8c2a672 | Use pkg-config in node's binding.gyp | binding.gyp | binding.gyp | {
"targets" : [
{
'include_dirs': [
"<!(node -e \"require('nan')\")"
],
'cflags': [
'-std=c++0x',
'-Wall',
'-pthread',
'-pedantic',
'-g',
'-zdefs'
'-Werror'
],
'ldflags': [
'-g'
],
"conditions": [
... | {
"targets" : [
{
'include_dirs': [
"<!(node -e \"require('nan')\")"
],
'cflags': [
'-std=c++0x',
'-Wall',
'-pthread',
'-pedantic',
'-g',
'-zdefs'
'-Werror'
],
'ldflags': [
'-g'
],
'link_settings': {
... | Python | 0.000001 |
5578af9e99c6792e375db143f2423d92c847e001 | update binding.gyp to compile new feature | binding.gyp | binding.gyp | {
"targets": [
{
"target_name": "ons",
"sources": [
"src/entry.cpp",
"src/log_util.cpp",
"src/ons_options.cpp",
"src/consumer_ack.cpp",
"src/consumer.cpp",
"src/producer.cpp",
"src/real_producer_wrapper.cpp",
"src/consumer_listener.cpp"
... | {
"targets": [
{
"target_name": "ons",
"sources": [
"src/entry.cpp",
"src/log_util.cpp",
"src/ons_options.cpp",
"src/consumer_ack.cpp",
"src/consumer.cpp",
"src/producer.cpp",
"src/consumer_listener.cpp"
],
"include_dirs": [
"... | Python | 0 |
d749361a7ee14b96c2235300b15fbba1222a6a9c | remove comment. | binding.gyp | binding.gyp | {
'targets': [{
'target_name': 'bitcoindjs',
'variables': {
'BOOST_INCLUDE': '<!(test -n "$BOOST_INCLUDE"'\
' && echo "$BOOST_INCLUDE"'\
' || test -e /usr/include/boost && echo /usr/include/boost' \
' || echo ./include)',
'LEVELDB_INCLUDE': '<!(test -n "$LEVELDB_INCLUDE"'\
... | {
'targets': [{
'target_name': 'bitcoindjs',
'variables': {
'BOOST_INCLUDE': '<!(test -n "$BOOST_INCLUDE"'\
' && echo "$BOOST_INCLUDE"'\
' || test -e /usr/include/boost && echo /usr/include/boost' \
' || echo ./include)',
'LEVELDB_INCLUDE': '<!(test -n "$LEVELDB_INCLUDE"'\
... | Python | 0 |
50bfb78e3e384e341021662316c71ccd3ab27905 | Delete test_event_str from the tests | core/tests/tests_event.py | core/tests/tests_event.py | #! /usr/bin/env python
__author__ = 'Henri Buyse'
import pytest
from core.models import Event, Tournament
def test_get_all_tournaments_related():
assert True
def test_get_vbuserprofile():
vbu = VBUserProfile.objects.create(user=User.objects.create_user(username='jdoe', email='jdoe@jdoe.... | #! /usr/bin/env python
__author__ = 'Henri Buyse'
import pytest
from core.models import Event, Tournament
def test_str():
e = Event.objects.create(name="VolleyBall Day")
assert print(e) != None
assert print(e) != ''
assert print(e) == "VolleyBall Day"
def test_get_all_tournament... | Python | 0.000007 |
539f575832244e426d768b0901113a1e45b25f3f | modify python ext setup script | src/python_zfor/setup.py | src/python_zfor/setup.py | #!/usr/bin/env python
from distutils.core import setup, Extension
zformod = Extension(
'zfor',
sources = ['src/zfor.c'],
include_dirs = ['../libzfor'],
library_dirs = ['/usr/local/lib', '../libzfor'],
libraries = ['zfor']
)
setup(
name = 'zfo... | #!/usr/bin/env python
from distutils.core import setup, Extension
zformod = Extension('zfor',
sources = ['src/zfor.c'], library_dirs = ['/usr/local/lib'], libraries = ['zfor']
)
setup(name = 'zfor',
version = '0.1',
description = 'Python zfor binding',
... | Python | 0 |
e346f70eb34a029642410a92e449915801d9f78f | use relative import | antimarkdown/__init__.py | antimarkdown/__init__.py | # -*- coding: utf-8 -*-
"""antimarkdown -- convert Markdown to HTML.
"""
from lxml import html
from lxml.builder import E
from . import handlers
default_safe_tags = set('p blockquote i em strong b u a h1 h2 h3 h4 h5 h6 hr pre code div br img ul ol li span'.split())
default_safe_attrs = set('href src alt style title'... | # -*- coding: utf-8 -*-
"""antimarkdown -- convert Markdown to HTML.
"""
from lxml import html
from lxml.builder import E
import handlers
default_safe_tags = set('p blockquote i em strong b u a h1 h2 h3 h4 h5 h6 hr pre code div br img ul ol li span'.split())
default_safe_attrs = set('href src alt style title'.split(... | Python | 0 |
c5a156921b7c50c1cf6dc0344b92b661e73c5e32 | Build Results object from a dictionary | rnacentral/nhmmer/utils.py | rnacentral/nhmmer/utils.py | """
Copyright [2009-2014] 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 applicable law or a... | """
Copyright [2009-2014] 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 applicable law or a... | Python | 0.000055 |
1a0828bd9dda4b17f6121174bd826ace1fe2eefb | Fix remove_item (#112) | Core/automation/lib/python/core/items.py | Core/automation/lib/python/core/items.py | # NOTE: Requires JythonItemProvider component
from core.jsr223 import scope
scope.scriptExtension.importPreset(None)
import core
from core import osgi, JythonItemProvider
from core.log import logging, LOG_PREFIX
from core.links import remove_all_links
ItemBuilderFactory = osgi.get_service(
"org.openhab.core.i... | # NOTE: Requires JythonItemProvider component
from core.jsr223 import scope
scope.scriptExtension.importPreset(None)
import core
from core import osgi, JythonItemProvider
from core.log import logging, LOG_PREFIX
from core.links import remove_all_links
ItemBuilderFactory = osgi.get_service(
"org.openhab.core.i... | Python | 0 |
08869ed4f1ac6190e5a3f6ec3439ce4cc7e010ba | add migration messenger | migrate2v2_dump.py | migrate2v2_dump.py | #!/usr/bin/env python
import os
from json import dump
from bitfield import BitField
from django import setup
from django.core.serializers.json import DjangoJSONEncoder
from django.db.models import ImageField
class BatchSaveStreamList(list):
def __init__(self, model_class, model_name, except_fields=None, list_map... | #!/usr/bin/env python
import os
from json import dump
from bitfield import BitHandler, BitField
from django import setup
from django.core.serializers.json import DjangoJSONEncoder
from django.db.models import ImageField
class BatchSaveStreamList(list):
def __init__(self, model_class, model_name, except_fields=No... | Python | 0.000001 |
d00235a494b8dc5db18e0d0b7fa1135826ae49d3 | Set template_debug to False. | restfulgrok/fancyhtmlview.py | restfulgrok/fancyhtmlview.py | from jinja2 import Template
from pkg_resources import resource_string
from view import GrokRestViewMixin
from contenttype import ContentType, ContentTypesRegistry
from contenttype import JsonContentType
class HtmlContentType(ContentType):
"""
XHTML content type. Provides a dumps-method that uses a jinja2-te... | from jinja2 import Template
from pkg_resources import resource_string
from view import GrokRestViewMixin
from contenttype import ContentType, ContentTypesRegistry
from contenttype import JsonContentType
class HtmlContentType(ContentType):
"""
XHTML content type. Provides a dumps-method that uses a jinja2-te... | Python | 0 |
a25b720d46ba4d8322e0a3d87b526c95de071913 | update cryo manager | pychron/hardware/lakeshore/model330.py | pychron/hardware/lakeshore/model330.py | # ===============================================================================
# Copyright 2018 ross
#
# 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/LICE... | # ===============================================================================
# Copyright 2018 ross
#
# 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/LICE... | Python | 0 |
0a725db8e8d7f1e73a84fb0d0acc181603e706cb | Refactor to readability test | kboard/functional_test/test_post_delete.py | kboard/functional_test/test_post_delete.py | from .base import FunctionalTest, login_test_user_with_browser, NotFoundPostError
class DeletePostTest(FunctionalTest):
@login_test_user_with_browser
def test_delete_post(self):
# 지훈이는 게시글을 삭제하는 기능이 제대로 동작하는지 확인하기 위해 기본 게시판으로 이동한다.
self.move_to_default_board()
# 'django' 대한 게시글과 'spri... | from .base import FunctionalTest, login_test_user_with_browser, NotFoundPostError
class DeletePostTest(FunctionalTest):
@login_test_user_with_browser
def test_delete_post(self):
# 지훈이는 게시글을 삭제하는 기능이 제대로 동작하는지 확인하기 위해 기본 게시판으로 이동한다.
self.move_to_default_board()
# 'django' 대한 게시글과 'spri... | Python | 0.000004 |
bbd7266a9e228ac111497b12d00ea71b3e0f4f5a | fix imports | edx_proctoring/management/commands/set_attempt_status.py | edx_proctoring/management/commands/set_attempt_status.py | """
Django management command to manually set the attempt status for a user in a proctored exam
"""
from optparse import make_option
from django.core.management.base import BaseCommand
from edx_proctoring.models import ProctoredExamStudentAttemptStatus
class Command(BaseCommand):
"""
Django Management comm... | """
Django management command to manually set the attempt status for a user in a proctored exam
"""
from optparse import make_option
from django.core.management.base import BaseCommand
from edx_proctoring.api import (
update_attempt_status,
get_exam_by_id
)
from edx_proctoring.models import ProctoredExamStu... | Python | 0.000002 |
9c0d62d7b08d63b7daf338a16fc34896856aefb2 | Test code for encoding password in postgresql uri | controllers/lms.py | controllers/lms.py | import sys
import os
import subprocess
import urllib
from gluon import current
import paramiko
from ednet.ad import AD
from ednet.canvas import Canvas
from ednet.appsettings import AppSettings
# Needed for remote connection?
auth.settings.allow_basic_login = True
#auth.settings.actions_disabled.append('login')
#aut... | import sys
import os
import subprocess
from gluon import current
import paramiko
from ednet.ad import AD
from ednet.canvas import Canvas
from ednet.appsettings import AppSettings
# Needed for remote connection?
auth.settings.allow_basic_login = True
#auth.settings.actions_disabled.append('login')
#auth.settings.al... | Python | 0 |
30eaa94cb788bc8eeb85aab7edc4bd544ce3e811 | Fix Chrome 46 window management | lg_common/src/lg_common/managed_browser.py | lg_common/src/lg_common/managed_browser.py | import sys
import rospy
import socket
import shutil
from lg_common import ManagedApplication, ManagedWindow
from tornado.websocket import websocket_connect
DEFAULT_BINARY = '/usr/bin/google-chrome'
DEFAULT_ARGS = [
'--no-first-run',
'--allow-file-access-from-files',
'--disable-default-apps',
'--disabl... | import sys
import rospy
import socket
import shutil
from lg_common import ManagedApplication, ManagedWindow
from tornado.websocket import websocket_connect
DEFAULT_BINARY = '/usr/bin/google-chrome'
DEFAULT_ARGS = [
'--no-first-run',
'--allow-file-access-from-files',
'--disable-default-apps',
'--disabl... | Python | 0 |
a619f703b2d259877e30d3e1ede11813c014f3ad | Fix the AvailableActionsPrinter to support the new multiplayer action spec. | pysc2/env/available_actions_printer.py | pysc2/env/available_actions_printer.py | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Python | 0 |
e67dc6d0cb46bcce0750246f99c6f99cd3e1ccbc | fix tempita.py for distutils build | scipy/_build_utils/tempita.py | scipy/_build_utils/tempita.py | import sys
import os
import argparse
from Cython import Tempita as tempita
# XXX: If this import ever fails (does it really?), vendor either
# cython.tempita or numpy/npy_tempita.
def process_tempita(fromfile, outfile=None):
"""Process tempita templated file and write out the result.
The template file is ex... | import sys
import os
import argparse
from Cython import Tempita as tempita
# XXX: If this import ever fails (does it really?), vendor either
# cython.tempita or numpy/npy_tempita.
def process_tempita(fromfile, outfile=None):
"""Process tempita templated file and write out the result.
The template file is ex... | Python | 0 |
c489157661b5738f37c5213f64736d7e88a0700b | Update application_filter.py | Data-Science-Tools/application_filter.py | Data-Science-Tools/application_filter.py | '''
Decision Tree V.1
Simple tool for a company to screen applications in the hiring process
Coded By: Tyler Linne
Date: 4/27/16
'''
#Import required packages
import numpy as np
import pandas as pd
import pydot
from sklearn import tree
from IPython.display import Image
from sklearn.externals.six import StringIO... | '''
Decision Tree V.1
Simple tool for a company to screen applications in the hiring process
Coded By: Tyler Linne
Date: 4/27/16
'''
#Import required packages
import numpy as np
import pandas as pd
import pydot
from sklearn import tree
from IPython.display import Image
from sklearn.externals.six import StringIO... | Python | 0.000001 |
78856b3752dc1db113074c848a0c3f664c55fcd9 | fix rebooting after a partially interactive install | subiquity/server/controllers/reboot.py | subiquity/server/controllers/reboot.py | # Copyright 2020 Canonical, Ltd.
#
# 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, or (at your option) any later version.
#
# This program is distribute... | # Copyright 2020 Canonical, Ltd.
#
# 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, or (at your option) any later version.
#
# This program is distribute... | Python | 0.000001 |
bfa1a36d1c731f730cabbc914d52c51d5ddf61dc | Add token auth and session | api/evas_api/settings.py | api/evas_api/settings.py | import os
import dj_database_url
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = '-@y4mtyhs=i-uc7q9b==ur(zhs%gu628wtku%q8d8$-vp1qbza'
DEBUG = bool(os.environ.get('DEBUG', False))
TEMPLATE_DEBUG = bool(os.environ.get('TEMPLATE_DEBUG', False))
DATABASES = {'default': dj_database_url.config(default... | import os
import dj_database_url
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = '-@y4mtyhs=i-uc7q9b==ur(zhs%gu628wtku%q8d8$-vp1qbza'
DEBUG = bool(os.environ.get('DEBUG', False))
TEMPLATE_DEBUG = bool(os.environ.get('TEMPLATE_DEBUG', False))
DATABASES = {'default': dj_database_url.config(default... | Python | 0 |
d38a1fd25c9ffbfb8599c81e69617a1cb271c068 | Add timeout | certserver.py | certserver.py | #!/usr/bin/python3
import argparse
import json
from http import server
import socket
import ssl
import subprocess
parser = argparse.ArgumentParser(description='certserver')
parser.add_argument(
'--ca-cert',
dest='ca_cert',
action='store',
required=True)
parser.add_argument(
'--listen-host',
d... | #!/usr/bin/python3
import argparse
import json
from http import server
import socket
import ssl
import subprocess
parser = argparse.ArgumentParser(description='certserver')
parser.add_argument(
'--ca-cert',
dest='ca_cert',
action='store',
required=True)
parser.add_argument(
'--listen-host',
d... | Python | 0.000015 |
130ce365a0d7c709004da5dedf0e0e35ff6ad3d0 | Fix reference error and add script for packing pypi package (#1172) | python/dllib/src/bigdl/utils/engine.py | python/dllib/src/bigdl/utils/engine.py | #
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | #
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | Python | 0 |
b0a948e2036ff232c2026e742a42ab9e9c4fbc07 | Drop unused IndexTypeVar | cfgrib/abc.py | cfgrib/abc.py | """Abstract Base Classes for GRIB messsages and containers"""
import abc
import typing as T
MessageIdTypeVar = T.TypeVar("MessageIdTypeVar")
MessageTypeVar = T.TypeVar("MessageTypeVar", bound="Message")
Message = T.Mapping[str, T.Any]
MutableMessage = T.MutableMapping[str, T.Any]
Container = T.Mapping[MessageIdTypeVa... | """Abstract Base Classes for GRIB messsages and containers"""
import abc
import typing as T
MessageIdTypeVar = T.TypeVar("MessageIdTypeVar")
MessageTypeVar = T.TypeVar("MessageTypeVar", bound="Message")
IndexTypeVar = T.TypeVar("IndexTypeVar", bound="Index") # type: ignore
Message = T.Mapping[str, T.Any]
MutableMess... | Python | 0 |
54f978c3ed960997b8a5fa9f0e443b17e702ec85 | Update build_flags to point to proper libdir | python/scannerpy/stdlib/build_flags.py | python/scannerpy/stdlib/build_flags.py | import os.path
import sys
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
def get_include():
return os.path.abspath(os.path.join(SCRIPT_DIR, '..', 'include'))
def print_include():
sys.stdout.write(get_include())
def get_lib():
return os.path.abspath(os.path.join(SCRIPT_DIR, '..', 'lib'))
def p... | import os.path
import sys
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
def get_include():
return os.path.abspath(os.path.join(SCRIPT_DIR, '..', 'include'))
def print_include():
sys.stdout.write(get_include())
def get_lib():
return os.path.abspath(os.path.join(SCRIPT_DIR, '..'))
def print_li... | Python | 0 |
1bf4ae32aa5f423b4124a89108df27f04dca8f71 | Include environment at lambda function qualifier | kappa/event_source/s3.py | kappa/event_source/s3.py | # -*- coding: utf-8 -*-
# Copyright (c) 2014, 2015 Mitch Garnaat
#
# 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 appl... | # -*- coding: utf-8 -*-
# Copyright (c) 2014, 2015 Mitch Garnaat
#
# 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 appl... | Python | 0 |
2027d3347a839ca30abbcb778b34b3f261b266ef | Update Naive Bayes classifier | mla/naive_bayes.py | mla/naive_bayes.py | import numpy as np
from mla.base import BaseEstimator
from mla.neuralnet.activations import softmax
class NaiveBayesClassifier(BaseEstimator):
"""Gaussian Naive Bayes."""
# Binary problem.
n_classes = 2
def fit(self, X, y=None):
self._setup_input(X, y)
# Check target labels
as... | import numpy as np
from mla.base import BaseEstimator
from mla.neuralnet.activations import softmax
class NaiveBayesClassifier(BaseEstimator):
"""Gaussian Naive Bayes."""
# Binary problem.
n_classes = 2
def fit(self, X, y=None):
self._setup_input(X, y)
# Check target labels
as... | Python | 0.000006 |
fd5c84a1272ded54afaa6323fc10c637474096a3 | Increment version to 0.2.5 | approvaltests/version.py | approvaltests/version.py | version_number = "0.2.5"
| version_number = "0.2.4"
| Python | 0.998918 |
aa1772c013cad2fe423613cb88e37fbf1958bd82 | Update retrosign.py | retrosign/retrosign.py | retrosign/retrosign.py | import discord, aiohttp, re
from bs4 import BeautifulSoup as b_s
from io import BytesIO
from discord.ext import commands
import os
import random
from random import choice
import lxml
class retrosign:
def __init__(self, bot):
self.bot = bot
@commands.group()
async def retrosign(self, conten... | import discord, aiohttp, re
from bs4 import BeautifulSoup as b_s
from io import BytesIO
from discord.ext import commands
import os
import random
from random import choice
import lxml
class retrosign:
def __init__(self, bot):
self.bot = bot
@commands.group()
async def retrosign(self, conten... | Python | 0 |
959dfe1dafb81523365fc30bfa4cd7e6c2b9eecb | CHANGE GcodeFile() function names | GcodeParser.py | GcodeParser.py | #!/usr/bin/env python
# coding=UTF-8
"""Module containing Gcode parsing functions"""
__author__ = "Dylan Armitage"
__email__ = "d.armitage89@gmail.com"
####---- Imports ----####
from pygcode import Line, GCodeLinearMove
class GcodeFile(object):
"""A file of gcode"""
def __init__(self, gcode_file=[]):
... | #!/usr/bin/env python
# coding=UTF-8
"""Module containing Gcode parsing functions"""
__author__ = "Dylan Armitage"
__email__ = "d.armitage89@gmail.com"
####---- Imports ----####
from pygcode import Line, GCodeLinearMove
class GcodeFile(object):
"""A file of gcode"""
def __init__(self, gcode_file=[]):
... | Python | 0.000001 |
ec2d66e85275313c206f760364724108f9508204 | Add execute permission | scripts/contrib/model_info.py | scripts/contrib/model_info.py | #!/usr/bin/env python3
import sys
import argparse
import numpy as np
import yaml
DESC = "Prints keys and values from model.npz file."
S2S_SPECIAL_NODE = "special:model.yml"
def main():
args = parse_args()
model = np.load(args.model)
if args.special:
if S2S_SPECIAL_NODE not in model:
... | #!/usr/bin/env python3
import sys
import argparse
import numpy as np
import yaml
DESC = "Prints keys and values from model.npz file."
S2S_SPECIAL_NODE = "special:model.yml"
def main():
args = parse_args()
model = np.load(args.model)
if args.special:
if S2S_SPECIAL_NODE not in model:
... | Python | 0.000001 |
fee8e6371c2884ba8cdc587ecae06093e5f6e4de | restructure python 2 to use a generator | 01-50/02/2.py | 01-50/02/2.py | def fib():
a, b = 0, 1
while True:
yield b
a, b = b, a + b
total = 0
i = 0
for i in fib():
if i >= 4000000:
break
if i % 2 == 0:
total += i
print total
| a, b = 0, 1
total = 0
while b < 4000000:
a, b = b, a + b
if b % 2 == 0:
total += b
print total
| Python | 0.000486 |
51fa99659a0b975175a0a33ace21021de7de4b45 | Add load_json | saau/sections/image_provider.py | saau/sections/image_provider.py | import json
import inspect
from os.path import join, exists
def not_implemented():
frame_info = inspect.currentframe().f_back
msg = ''
if 'self' in frame_info.f_locals:
self = frame_info.f_locals['self']
try:
msg += self.__name__ + '#' # for static/class methods
excep... | import json
import inspect
from os.path import join, exists
def not_implemented():
frame_info = inspect.currentframe().f_back
msg = ''
if 'self' in frame_info.f_locals:
self = frame_info.f_locals['self']
try:
msg += self.__name__ + '#' # for static/class methods
excep... | Python | 0.00001 |
7907edc07b7607e1892a35a4ad49e8eb7340ed4e | Update __openerp__.py | sale_order_types/__openerp__.py | sale_order_types/__openerp__.py | # -*- encoding: utf-8 -*-
##############################################################################
# #
# OpenERP, Open Source Management Solution. #
# ... | # -*- encoding: utf-8 -*-
##############################################################################
# #
# OpenERP, Open Source Management Solution. #
# ... | Python | 0.000024 |
ee50bea2810676ef655e7ea57565070f7e715741 | Validate quotation is non-empty before allowing conversion to template. | sale_template_quotation/sale.py | sale_template_quotation/sale.py | # -*- coding: utf-8 -*-
##############################################################################
#
# Template Quotations
# Copyright (C) 2015 OpusVL (<http://opusvl.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
# p... | # -*- coding: utf-8 -*-
##############################################################################
#
# Template Quotations
# Copyright (C) 2015 OpusVL (<http://opusvl.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
# p... | Python | 0 |
a537f049bfb61488a056333d362d9983e8e9f88d | Fix minor issues in 2020.10.1 file | 2020/10/p1.py | 2020/10/p1.py | # Python 3.8.3
def get_input():
with open('input.txt', 'r') as f:
return set(int(i) for i in f.read().split())
def main():
puzzle = get_input()
last_joltage = 0
one_jolt = 0
three_jolts = 1
while len(puzzle) != 0:
if last_joltage + 1 in puzzle:
last_joltage = last_... | # Python 3.8.3
def get_input():
with open('input.txt', 'r') as f:
return set(int(i) for i in f.read().split())
def main():
puzzle = get_input()
last_joltage = 0
one_jolt = 0
three_jolts = 1 # this is bad lmao
while len(puzzle) != 0:
if last_joltage + 1 in puzzle:
... | Python | 0 |
b51e51dc8b1ce66815980bf2e8424f6fe282af66 | test type declare with resolve | metaconfig/tests/test_simple.py | metaconfig/tests/test_simple.py | from nose.tools import *
from io import StringIO
from textwrap import dedent
from metaconfig import Config
def test_declare_empty():
source = """
--- !declare {}
...
"""
config = Config()
with StringIO(dedent(source)) as stream:
config.load(stream)
def test_declare_resolve():
... | from nose.tools import *
from io import StringIO
from textwrap import dedent
from metaconfig import Config
def test_declare_empty():
source = """
--- !declare {}
...
"""
config = Config()
with StringIO(dedent(source)) as stream:
config.load(stream)
| Python | 0 |
8c2ac2e2af173c071f895879f078fa8cf4c39173 | Change the docstring indentation | bears/python/PEP8Bear.py | bears/python/PEP8Bear.py | import autopep8
import sys
from coalib.bearlib import deprecate_settings
from coalib.bearlib.spacing.SpacingHelper import SpacingHelper
from coalib.bears.LocalBear import LocalBear
from dependency_management.requirements.PipRequirement import PipRequirement
from coalib.results.Diff import Diff
from coalib.results.Resu... | import autopep8
import sys
from coalib.bearlib import deprecate_settings
from coalib.bearlib.spacing.SpacingHelper import SpacingHelper
from coalib.bears.LocalBear import LocalBear
from dependency_management.requirements.PipRequirement import PipRequirement
from coalib.results.Diff import Diff
from coalib.results.Resu... | Python | 0 |
60b4fc88617f800208f00f24468db6798369fe2e | Add user-supplied arguments in log_handler | neutron/openstack/common/log_handler.py | neutron/openstack/common/log_handler.py | # Copyright 2013 IBM Corp.
#
# 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 t... | # Copyright 2013 IBM Corp.
#
# 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 t... | Python | 0.002685 |
f83a4b400a65b3cb63a4ca946103f25816909b62 | Remove accidental hard-coding of Firefox binary path in tests | conftest.py | conftest.py | # Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | # Licensed to the Software Freedom Conservancy (SFC) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The SFC licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | Python | 0.000011 |
6dade12592e4ef9e5bfd236846882f1856789476 | Fix throwing exceptions. | routeros_api/base_api.py | routeros_api/base_api.py | import socket
from routeros_api import exceptions
LENGTH_MATRIX = [
(0x80, 0x0),
(0x40, 0x80),
(0x20, 0xC0),
(0x10, 0xE0),
(0x1, 0xF0),
]
OVER_MAX_LENGTH_MASK = 0xF8
class Connection(object):
def __init__(self, socket):
self.socket = socket
def send_sentence(self, words):
... | import socket
from routeros_api import exceptions
LENGTH_MATRIX = [
(0x80, 0x0),
(0x40, 0x80),
(0x20, 0xC0),
(0x10, 0xE0),
(0x1, 0xF0),
]
OVER_MAX_LENGTH_MASK = 0xF8
class Connection(object):
def __init__(self, socket):
self.socket = socket
def send_sentence(self, words):
... | Python | 0 |
0af36c8e43f0a7a633897ac3f0112f0d2b521a6e | Delete all ReviewFollowers and remove the entry in the ranker before deleting a StudentProposal. | app/soc/logic/models/student_proposal.py | app/soc/logic/models/student_proposal.py | #!/usr/bin/python2.5
#
# Copyright 2009 the Melange 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... | #!/usr/bin/python2.5
#
# Copyright 2009 the Melange 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... | Python | 0 |
80176ae73fc9843f63aca68306523da822d0b258 | add "group" property to devices | samantha/plugins/plugin.py | samantha/plugins/plugin.py | """Contains a baseclass for plugins."""
###############################################################################
#
# TODO: [ ] default methods
#
###############################################################################
# standard library imports
import logging
# related third party imports
# applicati... | """Contains a baseclass for plugins."""
###############################################################################
#
# TODO: [ ] default methods
#
###############################################################################
# standard library imports
import logging
# related third party imports
# applicati... | Python | 0 |
586d5f34fc508d4a3eaa93bd39c5dc2b41e4878d | Migrate api7 to api8 | project_task_state/project_task_state.py | project_task_state/project_task_state.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Addons modules by CLEARCORP S.A.
# Copyright (C) 2009-TODAY CLEARCORP S.A. (<http://clearcorp.co.cr>).
#
# This program is free software: you can redistribute... | Python | 0.000122 |
c3d7e7fdcbea0fc34bfa6d9d517efc4d54dc0b15 | add file extension | scripts/generateQANotebook.py | scripts/generateQANotebook.py | import argparse
import os
parser = argparse.ArgumentParser()
parser.add_argument('repo', help='data repository')
parser.add_argument('--tract', type=int)
parser.add_argument('--filt', type=str)
parser.add_argument('--output', '-o', default='QA', help='output folder')
args = parser.parse_args()
from explorer.noteboo... | import argparse
import os
parser = argparse.ArgumentParser()
parser.add_argument('repo', help='data repository')
parser.add_argument('--tract', type=int)
parser.add_argument('--filt', type=str)
parser.add_argument('--output', '-o', default='QA', help='output folder')
args = parser.parse_args()
from explorer.noteboo... | Python | 0.000002 |
1f5bdf4ce98d55339bee0aad16f40439d8a99a33 | Upgrade to the most recent version of buildkit. | buildkit.py | buildkit.py | """
Common code used in my setup.py files.
"""
from __future__ import with_statement
import os.path
import sys
def read(*filenames):
"""Read files relative to the executable."""
files = []
for filename in filenames:
full_path = os.path.join(os.path.dirname(sys.argv[0]), filename)
with op... | """
Common code used in my setup.py files.
"""
from __future__ import with_statement
import re
import os.path
import sys
def read(filename):
"""Read files relative to this file."""
full_path = os.path.join(os.path.dirname(sys.argv[0]), filename)
with open(full_path, 'r') as fh:
return fh.read()
... | Python | 0 |
0ba69643331f769116fbda0660377f08b0291e6a | Update searchAndStoreTweets.py | app/utils/insert/searchAndStoreTweets.py | app/utils/insert/searchAndStoreTweets.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Search and Store Tweets utility.
Search for tweets in the Twitter API for given input terms, then store
the tweet and the tweet's author data locally, updating or adding objects
as required.
Send search terms as arguments to the command-line tool to search for
them. ... | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
"""
import os
import sys
#import time
# Allow imports to be done when executing this file directly.
appDir = os.path.abspath(os.path.join(os.path.dirname(__file__),
os.path.pardir, os.path.pardir))
sys.path.insert(0, appDir)
fro... | Python | 0.000001 |
28adc3fbce76a562e729aef3ae19bdefd3379586 | add taxonomy information to loaded sequences | scripts/load_into_database.py | scripts/load_into_database.py | #!/usr/bin/env python
import sys
import argparse
from BioSQL import BioSeqDatabase
from Bio import SeqIO
def add_taxid(inIter, taxid):
inIter.annotations['ncbi_taxid'] = taxid
yield inIter
def load_gff(db, gff_file, fasta_file, fetch_taxonomy=False, taxid=None):
from BCBio.GFF import GFFParser
with op... | #!/usr/bin/env python
import sys
import argparse
from BioSQL import BioSeqDatabase
from Bio import SeqIO
def load_gff(db, gff_file, fasta_file):
from BCBio.GFF import GFFParser
with open(fasta_file) as seq_handle:
seq_dict = SeqIO.to_dict(SeqIO.parse(seq_handle, "fasta"))
parser = GFFParser()
... | Python | 0.000001 |
93b52ac533086bfa1747c2f3e10ca98d9e666197 | Stop sending stepFinished updates from the tryserver. | scripts/master/status_push.py | scripts/master/status_push.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.
import logging
import os
import urlparse
from buildbot.status import status_push
CR_PASSWORD_FILE = '.code_review_password'
class TryServerHttpStatus... | # 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.
import logging
import os
import urlparse
from buildbot.status import status_push
CR_PASSWORD_FILE = '.code_review_password'
class TryServerHttpStatus... | Python | 0.000003 |
aecc7b0af53c3d8c0136373b254c1b674bcf28ef | use decorator api | ryu/app/rest_topology.py | ryu/app/rest_topology.py | # Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
#
# 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 appli... | # Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
#
# 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 appli... | Python | 0 |
4748a68b6bde662245b85ecf2a52fbedffc4ffcb | Remove exception handling. | beetsplug/sonosupdate.py | beetsplug/sonosupdate.py | # -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2018, Tobias Sauerwein.
#
# 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... | # -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2018, Tobias Sauerwein.
#
# 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... | Python | 0 |
77ddff664ad1e10037a43c3ffabd816387c35e42 | Use a comprehension instead of a lambda function | rotational-cipher/rotational_cipher.py | rotational-cipher/rotational_cipher.py | import string
UPPER = string.ascii_uppercase
LOWER = string.ascii_lowercase
def rotate(s, n):
rules = shift_rules(n)
return "".join(rules.get(ch, ch) for ch in s)
def shift_rules(n):
shifted = UPPER[n:] + UPPER[:n] + LOWER[n:] + LOWER[:n]
return {k:v for k,v in zip(UPPER+LOWER, shifted)}
| import string
UPPER = string.ascii_uppercase
LOWER = string.ascii_lowercase
def rotate(s, n):
rules = shift_rules(n)
return "".join(map(lambda k: rules.get(k, k), s))
def shift_rules(n):
shifted = UPPER[n:] + UPPER[:n] + LOWER[n:] + LOWER[:n]
return {k:v for k,v in zip(UPPER+LOWER, shifted)}
| Python | 0.00054 |
25beb8ce9f21d5ef5255304700a76ed2d7aaa425 | Add initial solution | rotational-cipher/rotational_cipher.py | rotational-cipher/rotational_cipher.py | import string
UPPER = string.ascii_uppercase
LOWER = string.ascii_lowercase
def rotate(s, n):
return "".join(rot_gen(s,n))
def shift_rules(n):
shifted = UPPER[n:] + UPPER[:n] + LOWER[n:] + LOWER[:n]
return {k:v for k,v in zip(UPPER+LOWER, shifted)}
def rot_gen(s, n):
rules = shift_rules(n)
f... | def rotate():
pass
| Python | 0.000001 |
644f66a39fd59b1983eee6f127e13e1585a598cd | Fix breakages from girder-client v2.0 | script/upload-test-images.py | script/upload-test-images.py | import girder_client
import os
import sys
def main():
# Use the API key to authenticate.
key = os.environ.get("GIRDER_API_KEY")
if key is None:
print >>sys.stderr, "Environment variable GIRDER_API_KEY is blank. Cannot upload images."
return 1
gc = girder_client.GirderClient(host="data... | import girder_client
import os
import sys
def main():
# Use the API key to authenticate.
key = os.environ.get("GIRDER_API_KEY")
if key is None:
print >>sys.stderr, "Environment variable GIRDER_API_KEY is blank. Cannot upload images."
return 1
gc = girder_client.GirderClient(host="data... | Python | 0 |
c71c82a8f1da678da740b726a66ab5bc9955b261 | work on digits_video.py | samples/python2/digits_video.py | samples/python2/digits_video.py | import numpy as np
import cv2
import digits
import os
import video
from common import mosaic
def main():
cap = video.create_capture()
classifier_fn = 'digits_svm.dat'
if not os.path.exists(classifier_fn):
print '"%s" not found, run digits.py first' % classifier_fn
return
... | import numpy as np
import cv2
import digits
import os
import video
from common import mosaic
def main():
cap = video.create_capture()
classifier_fn = 'digits_svm.dat'
if not os.path.exists(classifier_fn):
print '"%s" not found, run digits.py first' % classifier_fn
return
... | Python | 0.000105 |
9b0612b0a4d5c483013311d7c7814cc268609cb0 | Fix URL in setup.py | support/python/collins_client/setup.py | support/python/collins_client/setup.py | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(name="collins_client",
version="0.1.0",
description="The python interface to the collins api.",
author="John Bunting, Nick Thuesen, Nick Sauro, Will Richard",
author_email="opensourcesoftware@tumblr.com",
url="https:... | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(name="collins_client",
version="0.1.0",
description="The python interface to the collins api.",
author="John Bunting, Nick Thuesen, Nick Sauro, Will Richard",
author_email="opensourcesoftware@tumblr.com",
url="https:... | Python | 0.000002 |
e69f45ecc3ee23be203136be02e9648a4930a3e8 | Make test.py use difflib instead of filecmp. | test/test.py | test/test.py | # -*- coding: utf-8 -*-
import os
import sys
import filecmp
import difflib
from subprocess import call
def run_test(fmt, sample, arg):
psdump = "../build/psdump -o temp -f {0} {1}".format(fmt, arg)
call(psdump.split())
with open("temp", "r") as temp_file:
temp_lines = temp_file.readlines()
... | # -*- coding: utf-8 -*-
import os
import sys
import filecmp
import tempfile
from subprocess import call
def run_test(fmt, sample, arg):
temp = tempfile.NamedTemporaryFile()
psdump = "../build/psdump -o {0} -f {1} {2}".format(temp.name, fmt, arg)
call(psdump.split())
if not filecmp.cmp(temp.name, samp... | Python | 0 |
80c5f94f3c2ed02c8603d3eecea23cdb4711ae79 | Use hanging indent | openfisca_france/tests/test_tax_rates.py | openfisca_france/tests/test_tax_rates.py | # -*- coding: utf-8 -*-
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca is free software; you can redistribute it and/or modify
# it ... | # -*- coding: utf-8 -*-
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca is free software; you can redistribute it and/or modify
# it ... | Python | 0.000001 |
20e7453d143223ae1c95ad32ee49660ceeadf3f7 | Prepare for 1.1.0 | crudset/version.py | crudset/version.py | version = "1.1.0-dev"
| version = "1.0.0"
| Python | 0.000014 |
4510db1e8f2fe3298de395a9d8b1e0783f92c758 | update revision | source/tyr/migrations/versions/1b59ffb421e4_change_max_nb_crowfly_by_mode_type.py | source/tyr/migrations/versions/1b59ffb421e4_change_max_nb_crowfly_by_mode_type.py | """change max_nb_crowfly_by_mode to JSONB and set server_default
Revision ID: 1b59ffb421e4
Revises: 483639f1f00
Create Date: 2018-08-30 12:42:21.089095
"""
# revision identifiers, used by Alembic.
revision = '1b59ffb421e4'
down_revision = '105823db902c'
from alembic import op
import sqlalchemy as sa
from sqlalchemy... | """change max_nb_crowfly_by_mode to JSONB and set server_default
Revision ID: 1b59ffb421e4
Revises: 483639f1f00
Create Date: 2018-08-30 12:42:21.089095
"""
# revision identifiers, used by Alembic.
revision = '1b59ffb421e4'
down_revision = '483639f1f00'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.... | Python | 0 |
0e1c2dad600da595403ee893b787a29bdc38e215 | Bump to 2.1.1 | crudset/version.py | crudset/version.py | version = "2.1.1"
| version = "0.2.0-dev"
| Python | 0.000134 |
513c7a2f5c5fb5a8c47b3173a8d5854755f7928f | Use factories instead of creating instance from model | pylab/website/tests/test_about_page.py | pylab/website/tests/test_about_page.py | import datetime
from django_webtest import WebTest
from pylab.core.models import Event
from pylab.core.factories import EventFactory
class AboutPageTests(WebTest):
def test_no_events_on_about_page(self):
resp = self.app.get('/about/')
self.assertEqual(resp.status_int, 200)
self.assertTr... | import datetime
from django_webtest import WebTest
from django.contrib.auth.models import User
from pylab.core.models import Event
class AboutPageTests(WebTest):
def setUp(self):
self.user = User.objects.create(username='u1')
def test_no_events_on_about_page(self):
resp = self.app.get('/ab... | Python | 0 |
244649b9908de64b97498d3d29d7718f487f84a3 | Fix test | test/command_line/tst_stills_process.py | test/command_line/tst_stills_process.py | from __future__ import division
from dials.array_family import flex # import dependency
class Test(object):
def __init__(self):
from os.path import join
import libtbx.load_env
try:
dials_regression = libtbx.env.dist_path('dials_regression')
except KeyError, e:
print 'SKIP: dials_regress... | from __future__ import division
from dials.array_family import flex # import dependency
class Test(object):
def __init__(self):
from os.path import join
import libtbx.load_env
try:
dials_regression = libtbx.env.dist_path('dials_regression')
except KeyError, e:
print 'SKIP: dials_regress... | Python | 0.000004 |
c9ba9b8796de0802f7b941245cc41eb7d59ce7c8 | Normalize output path to cp.py | build/cp.py | build/cp.py | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Copy a file.
This module works much like the cp posix command - it takes 2 arguments:
(src, dst) and copies the file with path ... | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Copy a file.
This module works much like the cp posix command - it takes 2 arguments:
(src, dst) and copies the file with path ... | Python | 0.999758 |
55c00fd6684d6fb378326026475945aea59bfa0b | Fix iterator to list | pyosmo/end_conditions/step_coverage.py | pyosmo/end_conditions/step_coverage.py | from pyosmo.end_conditions.base import OsmoEndCondition
class StepCoverage(OsmoEndCondition):
"""
Stops testing when count is filled
"""
def __init__(self, coverage_percent):
if coverage_percent > 100 or coverage_percent < 0:
raise Exception(f"Coverage is {coverage_percent} and it... | from pyosmo.end_conditions.base import OsmoEndCondition
class StepCoverage(OsmoEndCondition):
"""
Stops testing when count is filled
"""
def __init__(self, coverage_percent):
if coverage_percent > 100 or coverage_percent < 0:
raise Exception(f"Coverage is {coverage_percent} and it... | Python | 0.000084 |
1a40afa75693f0c2ae3b2eaac62ff9ca6bb02488 | Add sqlite schema | synapse/storage/schema/delta/24/fts.py | synapse/storage/schema/delta/24/fts.py | # Copyright 2015 OpenMarket Ltd
#
# 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 writin... | # Copyright 2015 OpenMarket Ltd
#
# 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 writin... | Python | 0.000005 |
544782d2da7fa918133c70ea4e9d0ffe918dcdb4 | Fix documentation for eval and change default display to False | kindred/evalFunctions.py | kindred/evalFunctions.py |
import kindred
from collections import Counter
def evaluate(goldCorpus,testCorpus,metric='f1score',display=False):
""" Compares the gold corpus with the test corpus and calculate appropriate metrics.
:param goldCorpus: The gold standard set of data
:param testCorpus: The test set for comparison
:param metric: W... |
import kindred
from collections import Counter
def evaluate(goldCorpus,testCorpus,metric='f1score',display=True):
""" Compares the gold corpus with the test corpus and calculate appropriate metrics.
:param goldCorpus: The gold standard set of data
:type goldCorpus: kindred.Corpus
:param testCorpus: The test set... | Python | 0.003999 |
95768a09d0bf7f6f3576fc28568c3b7897467541 | Add license | src/python/tensorflow_cloud/core/tests/examples/multi_file_example/scale_model.py | src/python/tensorflow_cloud/core/tests/examples/multi_file_example/scale_model.py | # Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | import tensorflow_cloud as tfc
tfc.run(
entry_point="train_model.py",
requirements_txt="requirements.txt",
stream_logs=True,
)
| Python | 0 |
6c2e00084fb11a6d37d55fed247d2e7b6a373823 | Fix dependencies. | partner_contact_nationality/__openerp__.py | partner_contact_nationality/__openerp__.py | # -*- encoding: utf-8 -*-
# Odoo, Open Source Management Solution
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
#
# 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 versio... | # -*- encoding: utf-8 -*-
# Odoo, Open Source Management Solution
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
#
# 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 versio... | Python | 0 |
86d604f69ac0e42fb05ec84c3b20da03c7d7d109 | Fix lint error | scripts/download_oai_harvest.py | scripts/download_oai_harvest.py | #!/usr/bin/env python3
# -*- encoding: utf-8 -*-
"""
Standalone script for downloading the OAI-PMH for Calm.
The final output is dumped into a JSON file ``calm_records.json``, which
can be useful for doing bulk analysis of the Calm data.
"""
import collections
import json
import re
from urllib.parse import unquote
i... | #!/usr/bin/env python3
# -*- encoding: utf-8 -*-
"""
Standalone script for downloading the OAI-PMH for Calm.
The final output is dumped into a JSON file ``calm_records.json``, which
can be useful for doing bulk analysis of the Calm data.
"""
import collections
import json
import re
from urllib.parse import unquote
i... | Python | 0.000035 |
96b3904e64617d6c04b0e44506482cd264e28132 | use common method for permission checking | osmaxx-py/osmaxx/contrib/auth/frontend_permissions.py | osmaxx-py/osmaxx/contrib/auth/frontend_permissions.py | from django.conf import settings
from django.contrib.auth.decorators import login_required, user_passes_test
from django.core.urlresolvers import reverse_lazy
from django.utils.decorators import method_decorator
from rest_framework import permissions
FRONTEND_USER_GROUP = settings.OSMAXX_FRONTEND_USER_GROUP
def _may... | from django.conf import settings
from django.contrib.auth.decorators import login_required, user_passes_test
from django.core.urlresolvers import reverse_lazy
from django.utils.decorators import method_decorator
from rest_framework import permissions
FRONTEND_USER_GROUP = settings.OSMAXX_FRONTEND_USER_GROUP
def fron... | Python | 0 |
fc4214c19fdbdee6118155e5b51d037028670300 | Remove get_events and get_cosine_graph | pygraphc/similarity/LogTextSimilarity.py | pygraphc/similarity/LogTextSimilarity.py | from pygraphc.preprocess.PreprocessLog import PreprocessLog
from pygraphc.similarity.StringSimilarity import StringSimilarity
from itertools import combinations
import networkx as nx
import csv
class LogTextSimilarity(object):
"""A class for calculating cosine similarity between a log pair. This class is intended... | from pygraphc.preprocess.PreprocessLog import PreprocessLog
from pygraphc.similarity.StringSimilarity import StringSimilarity
from itertools import combinations
import networkx as nx
import csv
class LogTextSimilarity(object):
"""A class for calculating cosine similarity between a log pair. This class is intended... | Python | 0.000005 |
e38e0b61b74316a171d49fa9390ecc736408694d | Simplify nanomsg sample | samples/nanomsg/hello_world_asyncio.py | samples/nanomsg/hello_world_asyncio.py | import asyncio
import sys
import nanomsg as nn
from nanomsg.asyncio import Socket
async def ping(url, ack):
with Socket(protocol=nn.NN_PUSH) as sock, sock.connect(url):
await sock.send(b'Hello, World!')
# Shutdown the endpoint after the other side ack'ed; otherwise
# the message could be ... | import asyncio
import sys
import nanomsg as nn
from nanomsg.asyncio import Socket
async def ping(url, barrier):
with Socket(protocol=nn.NN_PUSH) as sock, sock.connect(url):
await sock.send(b'Hello, World!')
# Shutdown the endpoint after the other side ack'ed; otherwise
# the message could... | Python | 0.000006 |
f3b6771c43042c599e57d3a26fa678518e12455d | Update jupyterlab/tests/mock_packages/interop/consumer/setup.py | jupyterlab/tests/mock_packages/interop/consumer/setup.py | jupyterlab/tests/mock_packages/interop/consumer/setup.py | import json
from glob import glob
import os.path as osp
name = 'jlab_mock_consumer'
HERE = osp.abspath(osp.dirname(__file__))
with open(osp.join(HERE, 'package.json')) as fid:
data = json.load(fid)
from setuptools import setup
js_name = data['name']
setup(name=name,
version=data['version'],
py_modu... | import json
from glob import glob
import os.path as osp
name = 'jlab_mock_consumer'
HERE = osp.abspath(osp.dirname(__file__))
with open(osp.join(HERE, 'package.json')) as fid:
data = json.load(fid)
from setuptools import setup
js_name = data['name']
setup(name=name,
version=data['version'],
py_modu... | Python | 0 |
7c3d2f8afbc5c6d1dc7c719f97ca93ffb908d6ce | Add tests of tangential velocity. | test_SR1d.py | test_SR1d.py | import eos_defns
import SR1d
from numpy.testing import assert_allclose
def test_standard_sod():
"""
Relativistic Sod test.
Numbers are taken from the General Matlab code, so accuracy isn't perfect.
"""
eos = eos_defns.eos_gamma_law(5.0/3.0)
w_left = SR1d.State(1.0, 0.0, 0.0, 1.5, eos, labe... | import eos_defns
import SR1d
from numpy.testing import assert_allclose
def test_standard_sod():
"""
Relativistic Sod test.
Numbers are taken from the General Matlab code, so accuracy isn't perfect.
"""
eos = eos_defns.eos_gamma_law(5.0/3.0)
w_left = SR1d.State(1.0, 0.0, 0.0, 1.5, eos, labe... | Python | 0 |
1786702388abc4fe737ee73d64ef5864f42f0c3d | Fix missing offset for Query | chat/query.py | chat/query.py | # Copyright 2017 Oursky Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2017 Oursky Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | Python | 0.00002 |
c637eb216e9dc148a588019d22bc96db3565b3fc | Correct breakpoints | cmsplugin_bs4forcascade/bootstrap4/settings.py | cmsplugin_bs4forcascade/bootstrap4/settings.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.translation import ugettext_lazy as _
from cmsplugin_cascade.extra_fields.config import PluginExtraFieldsConfig
CASCADE_PLUGINS = getat... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.translation import ugettext_lazy as _
from cmsplugin_cascade.extra_fields.config import PluginExtraFieldsConfig
CASCADE_PLUGINS = getat... | Python | 0.000193 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.