src stringlengths 721 1.04M |
|---|
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
from odoo.exceptions import UserError
from odoo.tools.float_utils import float_round
class ReturnPickingLine(models.TransientModel):
_name = "stock.return.picking.line"
_... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""""""
import tkinter as tk
from tkinter import ttk
import os
# link
__title__ = "FileNavigator"
__version__ = "1.4.0"
__author__ = "DeflatedPickle"
class FileNavigator(ttk.Frame):
"""
-----DESCRIPTION-----
A Treeview that shows all contents of a di... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
analyze assortativity of the graphs in terms of sentiment
'''
from igraph import *
import networkx as nx
import os
import numpy as np
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import os
import matplotlib.cm as cm
from collections import defaultdict... |
# Copyright (C) 2013 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 required by applicable law or ag... |
#!/usr/bin/python
# Custom import script to process the Costa Rica import csv files.
# NOTE: Will wipe the database before performing import.
from edgar_importing import db
import json
import sys
import csv
from datetime import datetime
import logging.handlers
import re
def main():
# make sure this isn't run acc... |
try:
from mpi4py import MPI
except ImportError:
MPI = None
import tensorflow as tf, baselines.common.tf_util as U, numpy as np
class RunningMeanStd(object):
# https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm
def __init__(self, epsilon=1e-2, shape=()):
self.... |
#!/usr/bin/env python
# Description: Identify good and bad chars in HPNNM-B.07.53
# author: greyshell
# Script requirements: python 2.7 x86, pydbg 32bit binary, python wmi, pywin32
# Copy pydbg inside C:\Python27\Lib\site-packages\
# Copy pydasm.pyd inside C:\Python27\Lib\site-packages\pydbg\
import os
import socket... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class Channel(models.Model):
_inherit = 'mail.channel'
def partner_info(self, all_partners, direct_partners):
partner_infos = super(Channel, self).partner_info(all_... |
from django.db.models import F
from stats.models import Page
class StatsMiddleware(object):
def process_view(self, request, view_func, view_args, view_kwargs):
""" Incrémente le nombre de page vues à chaque appel de vues """
try:
# Le compteur lié à la page est récupéré et incrémenté
... |
import numpy as np
from scipy import optimize
from scipy import asarray as ar,exp
from scipy.integrate import quad
import matplotlib.pyplot as plt
verbose = 0
#--------------------------------------------------------------------------#
# Fit Functions
#-------------------------------------------------------... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Tommy Winther
# http://tommy.winther.nu
#
# Modified for FTV Guide (09/2014 onwards)
# by Thomas Geppert [bluezed] - bluezed.apps@gmail.com
#
# Modified for EPG-Direct (08/2016 onwards)
# by Thomas Geppert [bluezed] - bluezed.apps@gmail.com
#
... |
# Copyright 2020 Makani Technologies LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
"""
This file will be copied to a temporary directory in order to
exercise caching compiled Numba functions.
See test_dispatcher.py.
"""
from __future__ import division, print_function, absolute_import
import sys
import numpy as np
from numba import jit, generated_jit, types
from numba.tests.ctypes_usecases import... |
#!/bin/env python3
import unittest
import os
import sys
import util
import log
from PIL import Image
from layout import SimpleLayout, ComplexLayout
class CardTemplate:
""" Parsed version of a JSON card template """
def __init__(self, json, rootdir="."):
self.front_name = util.get_default(json, "front-im... |
from utils import compare_lists_of_dict
from zvm_exporter.parser import Parser
from data import (page_data, spool_data, cpu_memory_data, disk_def_data,
disk_free_data, emptyData1, emptyData2)
def test_make_snake_case():
p = Parser()
assert p.make_snake_case("UPPER CASES") == "upper_cases"
... |
# -*- coding: utf-8 -*-
# File: model_box.py
import numpy as np
import tensorflow as tf
from collections import namedtuple
from tensorpack.tfutils.scope_utils import under_name_scope
from config import config
@under_name_scope()
def clip_boxes(boxes, window, name=None):
"""
Args:
boxes: nx4, xyxy
... |
#
# Copyright 2009 Eigenlabs Ltd. http://www.eigenlabs.com
#
# This file is part of EigenD.
#
# EigenD is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) a... |
import requests
import traceback
import unicodedata
import re
from Foundation import NSLog
class DatafileModel:
def __init__(self,mytardisUrl,username,password,datafileID,datafileName):
self.mytardisUrl = mytardisUrl
self.username = username
self.password = password
self.datafileID... |
import os
import time
from enigma import iPlayableService, eTimer, eServiceCenter, iServiceInformation, ePicLoad, eServiceReference
from ServiceReference import ServiceReference
from Screens.Screen import Screen
from Screens.HelpMenu import HelpableScreen
from Screens.MessageBox import MessageBox
from Screens.InputBox ... |
class Solution(object):
MAGIC_SQUARES = [
[4, 9, 2, 3, 5, 7, 8, 1, 6],
[2, 9, 4, 7, 5, 3, 6, 1, 8],
[8, 3, 4, 1, 5, 9, 6, 7, 2],
[4, 3, 8, 9, 5, 1, 2, 7, 6],
[6, 1, 8, 7, 5, 3, 2, 9, 4],
[8, 1, 6, 3, 5, 7, 4, 9, 2],
[6, 7, 2, 1, 5, 9, 8, 3, 4],
[2, 7, ... |
# Licenced under the txaws licence available at /LICENSE in the txaws source.
"""
Tests for L{txaws.route53._util}.
"""
from txaws.testing.base import TXAWSTestCase
from txaws.route53._util import maybe_bytes_to_unicode, to_xml, tags
class MaybeBytesToUnicodeTestCase(TXAWSTestCase):
"""
Tests for L{maybe_b... |
# Copyright 2021 Northern.tech AS
#
# 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 ag... |
"""Base geometry class and utilities
"""
import sys
from warnings import warn
from binascii import a2b_hex
from ctypes import pointer, c_size_t, c_char_p, c_void_p
from shapely.coords import CoordinateSequence
from shapely.ftools import wraps
from shapely.geos import lgeos, ReadingError
from shapely.geos import WKBWr... |
# Adolpy - Algorithmic Differentiation Through Operator Overloading on
# Python using the Forward Method.
#
# Copyright (C) 2008 Luis Zarrabeitia
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published b... |
from django.views.generic import DetailView
class WagtailMvcView(DetailView):
"""
Basic default wagtail mvc view class
"""
page = None
def dispatch(self, request, *args, **kwargs):
"""
Pops the page out of the keyword args and
stores it against the view instance
:... |
"""Provide the WikiPage class."""
from typing import Any, Dict, Generator, Optional, TypeVar, Union
from ...const import API_PATH
from ...util.cache import cachedproperty
from ..listing.generator import ListingGenerator
from .base import RedditBase
from .redditor import Redditor
_WikiPage = TypeVar("_WikiPage")
Reddi... |
"""
[2017-04-28] Challenge #312 [Hard] Text Summarizer
https://www.reddit.com/r/dailyprogrammer/comments/683w4s/20170428_challenge_312_hard_text_summarizer/
# Description
Automatic summarization is the process of reducing a text document with a computer program in order to create a summary
that retains the most impor... |
import os
import importlib
from gmc.conf import global_settings
ENVIRONMENT_VARIABLE = "GMC_SETTINGS_MODULE"
class Settings:
"""
Module to load settings to configure gmc
"""
def __init__(self, *args, **kwargs):
self.settings = None
self.settings_module = None
def __getattr__(self, ... |
#Copyright 2015 B. Johan G. Svensson
#Licensed under the terms of the MIT license (see LICENSE).
from __future__ import division
import struct, time, csv
import fsslib
class CSVWriter():
def __init__(self, fid, samplerate):
pass
class CSVReader():
def __init__(self, fid, samplerate):
... |
# This file is part of GuestI.
#
# GuestI is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# SSP is distributed in the hope that it wi... |
from typing import Dict, List, Optional, Union
import numpy as np
import pandas as pd
from great_expectations.core.batch import Batch
from great_expectations.core.expectation_configuration import ExpectationConfiguration
from great_expectations.execution_engine import ExecutionEngine, PandasExecutionEngine
from great... |
from nogame import db
class Player(db.Model):
__tablename__ = 'player'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(24), unique=True)
planets = db.relationship('Planet')
moons = db.relationship('Moon')
fleets = db.relationship('Fleet')
class Planet(db.Model):
__... |
# -*- coding: iso-8859-1 -*-
# Copyright (C) 2004-2009 Bastian Kleineidam
"""
Routines for updating filter and rating configuration.
"""
import os
import md5
from . import log, LOG_GUI, Name, Version, configuration
#XXXfrom filter.Rating import rating_cache_merge, rating_cache_parse
#
# urlutils.py - Simplified urll... |
#!/usr/bin/env python
import kalipi
from kalipi import *
#############################
## Local Functions ##
## Local Functions ##
#############################
#############################
## Buttons ##
# define all of the buttons
label1 = Button(labelPadding * " " + " ", originX... |
import json
import re
from django.http import HttpResponse, JsonResponse
from django.views.generic import View
from .forms import UserSerializer
from .models import User
allowed_filters = re.compile(r'^(username|email|gender|title|first_name|'
r'last_name|street|city|state|phone|cell|pp... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2016, F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
---
module: bigip_selfip
short_desc... |
"""
IF Rule Action
Locate sync jobs older than the provided amount of days
"""
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import sys
import datetime
import json
sys.path.append('/opt/cloudbolt')
from common.methods import set_progress
from utilities.logger import ThreadLogger
logger = ThreadLogger(__... |
import logging
import unittest
try:
from unittest.mock import patch
except ImportError:
from mock import patch
import librato
from mock_connection import MockConnect, server
#logging.basicConfig(level=logging.DEBUG)
# Mock the server
librato.HTTPSConnection = MockConnect
class TestLibrato(unittest.TestCase):
... |
from file_experts.data_set.data_set_validator import DataSetValidator
from file_experts.data_set import data_set_creator
from time import sleep
import constants.create_data_set_constants as const
import file_experts.file_expert as fe
import urllib.request
import threading
import tarfile
class Cifar10DataSetPrepara... |
import os
import file_util
import html_util
import hamming_util
# table properties
BORDER = 1
MIN_CELL_WIDTH = 36
MIN_CELL_HEIGHT = 16
# superclass for our two question types
class hamming:
def __init__(self,question_library_path,question_path):
self.question_library_path = question_library_path
self.question_pa... |
import datetime
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import smtplib
host = "smtp.gmail.com"
port = 587
username = "hungrypy@gmail.com"
password = "iamhungry2016"
from_email = username
to_list = ["hungrypy@gmail.com"]
class MessageUser():
user_details = []
messag... |
#!/usr/bin/env python
"""This file is part of the django ERP project.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLD... |
#!/usr/bin/env python3
# type: ignore
import argparse
import numpy as np
from collections import defaultdict, deque
from common.realtime import sec_since_boot
import cereal.messaging as messaging
if __name__ == "__main__":
context = messaging.Context()
poller = messaging.Poller()
parser = argparse.ArgumentPar... |
"""User interface."""
import sys
import time
from pathlib import Path
from subprocess import PIPE, CalledProcessError
import click
from clit.files import shell
def notify(title, message):
"""If terminal-notifier is installed, use it to display a notification."""
check = "which" if sys.platform == "linux" el... |
"""
Jeremy Jao
2/24/2015
This was introduced because BitmapDescriptorFactory.fromAsset() no longer works...
Must use a hack to use the resource enumeration...
String Reversing....
"""
import os
def renameFile(filename):
"""
renames the file....
"""
routename = filename[:-4]
os.rename(filename, '... |
"""
Eithon Cadag, University of Washington, 2009
pyroc.py is released under GPL
Python module for calculating the area under the receiver operating
characteristic curve, given a dataset. matplotlib package is needed
to generate plots from the ROC.
Example usage:
>> from pyroc import *
>> rmm = random_mixture_model()... |
"""Dummy DIMSE-C SCPs for use in unit tests"""
from copy import deepcopy
import logging
import os
import socket
import time
import threading
from pydicom import read_file
from pydicom.dataset import Dataset
from pydicom.uid import UID, ImplicitVRLittleEndian, JPEG2000Lossless
from pynetdicom import (
AE,
Ass... |
import pygame
import sys
import os
from collections import namedtuple
import time
import resourcemanager
ColorList = namedtuple("ColorList", "black white red green blue")
colors = ColorList((0,0,0),(0xFF,0xFF,0xFF),(0xFF,0,0),(0,0xFF,0),(0,0,0xFF))
PyListener = namedtuple("PyListener", "condition effect")
PyEventList... |
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2016, MIT Probabilistic Computing 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/LICENS... |
import Analysis.pipeline as p
def test_classes():
try:
p.Int()
p.Bool()
p.Float()
p.String()
p.Struct()
p.Ensemble(p.Int())
p.And(p.Bool(True), p.Bool(False))
p.Or(p.Bool(True), p.Bool(False))
p.Input()
p.Connector()
p.RangeGen... |
# Authors:
# Pavel Zuna <pzuna@redhat.com>
#
# Copyright (C) 2009 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either versio... |
import numpy
### sample standard deviation
class stdevs:
def __init__(self):
self.list = []
self.x = 0
def step(self, value):
if value != None:
self.list.append(value)
def finalize(self):
#print(self.list)
if len(self.list) > 1:
self.x = numpy... |
from lettuce import step, world
from iotqautils.gtwRest import Rest_Utils_SBC
from common.user_steps import UserSteps, URLTypes, ProtocolTypes
from common.gw_configuration import IOT_SERVER_ROOT,CBROKER_HEADER,CBROKER_PATH_HEADER,MANAGER_SERVER_ROOT
api = Rest_Utils_SBC(server_root=IOT_SERVER_ROOT+'/iot')
api2 = Rest... |
#!/usr/bin/env python
'''
From: http://home.wlu.edu/~levys/software/kbhit.py
A Python class implementing KBHIT, the standard keyboard-interrupt poller.
Works transparently on Windows and Posix (Linux, Mac OS X). Doesn't work
with IDLE.
This program is free software: you can redistribute it and/or modify
it under the... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2008-2013 AvanzOSC S.L. All Rights Reserved
# Date: 01/07/2013
#
# This program is free software: you can redistribute it and/or modif... |
#!/usr/bin/python2
# Copyright (c) 2010, 2011, Sebastian Wiesner <lunaryorn@googlemail.com>
# 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 abov... |
class Opportunities(object):
"""
A class to query and use Pardot opportunities.
Opportunity field reference: http://developer.pardot.com/kb/api-version-3/object-field-references/#opportunity
"""
def __init__(self, client):
self.client = client
def query(self, **kwargs):
"""
... |
peforth
[x] 13:59 2017-07-31 找到 JavaScript eval() equivalent in Python
https://stackoverflow.com/questions/701802/how-do-i-execute-a-string-containing-python-code-in-python
成功了!!
>>> mycode = 'print ("hello world")'
>>> exec(mycode)
hello world
>>>
The technique of returning a function fr... |
# encoding: utf-8
# module PyQt4.QtGui
# from /usr/lib/python3/dist-packages/PyQt4/QtGui.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyQt4.QtCore as __PyQt4_QtCore
from .QWidget import QWidget
class QAbstractSpinBox(QWidget):
""" QAbstractSpinBox(QWidget parent=None) """
d... |
import pytest
import numpy as np
from numpy.testing import assert_allclose
import quimb as qu
@pytest.mark.parametrize("sparse", [False, True])
@pytest.mark.parametrize("stype", ['csr', 'csc'])
@pytest.mark.parametrize("dtype", ["don't pass", None, np.float64, np.complex128])
def test_hamiltonian_builder(sparse, stype... |
#
# Basic library to interface with Pololu Maestro servo controllers
# through serial port.
#
# Limitations:
# * CRC-7 not yet supported
import serial
class PololuMaestro:
CMD_SET_TARGET = 0x04
CMD_SET_SPEED = 0x07
CMD_SET_ACCEL = 0x09
def __init__(self, port, baud_rate=9600):
self.port = por... |
#!/usr/bin/python
#
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
#!/usr/bin/env python
# Copyright 2014-2021 The PySCF Developers. 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
#
# U... |
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.selector import HtmlXPathSelector
from scrapybot.items import ScrapybotItem
from scrapybot.utils import normalizeFriendlyDate
import datetime
from dateutil.parser import parse
from django... |
"""
Class file for the ArmedSwitch class
"""
class ArmedSwitch(object):
"""
ArmedSwitch is a boolean switch that must be explicitly re-armed after
each time it switches, or else it keeps the same state.
"""
# __init__: ArmedSwitch initializer
def __init__(self, switched=False, armed=True):
... |
# -*- coding: utf-8 -*-
from Screens.Screen import Screen
from Components.ConfigList import ConfigListScreen
from Components.config import config, ConfigSubsection, ConfigInteger, ConfigSelection, getConfigListEntry
modelist = {"0": _("Off"), "2": _("On"), "1": _("Auto")}
config.plugins.FanSetup = ConfigSubsection()
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2021 Snowflake Computing Inc. All right reserved.
#
import codecs
import glob
import os
from os import path
from snowflake.connector.constants import UTF8
from snowflake.connector.encryption_util import SnowflakeEncryptionUtil
from snowflake.connect... |
from datetime import datetime
from tests.conftest import wait_for_message
from wxpy import *
def sent_message(sent_msg, msg_type, receiver):
assert isinstance(sent_msg, SentMessage)
assert sent_msg.type == msg_type
assert sent_msg.receiver == receiver
assert sent_msg.bot == receiver.bot
assert se... |
#
# Copyright (C) 2008 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 required by applicable la... |
#!/usr/bin/python
#
# Copyright 2010 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 b... |
import sublime, sublime_plugin
import re
import os
import json
import fnmatch
import StringIO
import contextlib
import cmd_parser
import sublime_lib.view as vlib
from sublime_lib.view import append
TOKEN_TARGET_APPLICATION = 0
TOKEN_TARGET_WINDOW = 1
TOKEN_TARGET_VIEW = 2
TOKEN_ACTION_QUERY = 3... |
from sympy.core.basic import Basic, S, C, sympify
from sympy.core import oo, Rational, Pow
from sympy.core.cache import cacheit
class Order(Basic):
"""
Represents O(f(x)) at the point x = 0.
Definition
==========
g(x) = O(f(x)) as x->0 if and only if
|g(x)|<=M|f(x)| near x=0 ... |
"""
messaging.py
A Flask Blueprint module for Meerkat messaging services.
"""
from flask.ext.babel import gettext
from flask import Blueprint, render_template
from flask import redirect, flash, request, current_app, g, jsonify
import random
from meerkat_frontend import app, auth
import meerkat_libs as libs
from .. imp... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('books', '0010_auto_20160422_1158'),
]
operations = [
migrations.AddField(
model_name='bookhasautho... |
# Version: 0.18
"""The Versioneer - like a rocketeer, but for versions.
The Versioneer
==============
* like a rocketeer, but for versions!
* https://github.com/warner/python-versioneer
* Brian Warner
* License: Public Domain
* Compatible With: python2.6, 2.7, 3.2, 3.3, 3.4, 3.5, 3.6, and pypy
* [![Latest Version]
... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
# pylint: disable=unsubscriptable-object
import os
import argparse
import numpy as np
import tensorflow as tf
from sklearn.datasets import load_iris
def quantize_data(header, dtypes, X):
for i, (h, dtype) in enumerate(zip(header, dtypes)):
if h[0] != 'f' or dtype != np.int32:
continue
... |
#!/usr/bin/env python
"""
Build index for full-text whoosh search of files in data libraries.
Requires configuration settings in galaxy.ini. See the whoosh settings in the
data library search section for more details.
Run from the ~/scripts/data_libraries directory:
%sh build_whoosh_index.sh
"""
import sys, os, csv, ... |
import inspect
from threading import RLock
from metrology.exceptions import RegistryException
from metrology.instruments import Counter, Derive, Profiler, Meter, Timer, UtilizationTimer, HistogramUniform
class Registry(object):
def __init__(self):
self.lock = RLock()
self.metrics = {}
def c... |
# -*- coding: utf-8 -*-
# Copyright (c) 2014-2019 Dontnod Entertainment
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use,... |
import sys
from setuptools.command.test import test as TestCommand
from setuptools import setup
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
import pytest
errno... |
import sys
from uncompyle6 import PYTHON3
from uncompyle6.scanners.tok import NoneToken
from spark_parser.ast import AST as spark_AST
if PYTHON3:
intern = sys.intern
class AST(spark_AST):
def isNone(self):
"""An AST None token. We can't use regular list comparisons
because AST token offsets mi... |
# -*- coding: utf-8 -*-
import numpy as np
from sklearn.cluster import KMeans
from sklearn.mixture import GMM
from sklearn.preprocessing import scale
from sklearn import metrics
def locate_nans(data):
return np.sum(np.isnan(data), axis=1, dtype=bool)
def reorder_clusters(clusters, centers, covars=None):
n... |
# coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
im... |
import tornado.httpserver
import tornado.websocket
import tornado.ioloop
from tornado.ioloop import PeriodicCallback
import tornado.web
from random import randint #Random generator
#Config
port = 9000 #Websocket Port
timeInterval= 2000 #Milliseconds
class WSHandler(tornado.websocket.WebSocketHandler):
#check_origin ... |
"""
Tests of LibraryUsageLocator
"""
import itertools # pylint: disable=wrong-import-order
from unittest import TestCase
import ddt
from bson.objectid import ObjectId
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import UsageKey
from opaque_keys.edx.locator import (
BlockUsageLocator,
Li... |
import theano as th
import theano.tensor as T
import Antipasti.netkit as nk
import Antipasti.netarchs as na
import Antipasti.archkit as ak
import Antipasti.netools as ntl
import Antipasti.netrain as nt
import Antipasti.backend as A
__doc__ = """Model Zoo"""
# Define shortcuts
# Convlayer with ELU
cl = lambda fmapsin... |
#
# See top-level LICENSE.rst file for Copyright information
#
# -*- coding: utf-8 -*-
"""
desispec.pipeline.control
===========================
Tools for controling pipeline production.
"""
from __future__ import absolute_import, division, print_function
import os
import sys
import re
import time
from collections ... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
# Copyright 2016:
# * Jim Unroe KC9HI, <rock.unroe@gmail.com>
# * Pavel Milanes CO7WT <pavelmc@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# ... |
# -*- coding: utf-8 -*-
{
"name" : "InfoSaône - Module Odoo pour Coheliance",
"version" : "0.1",
"author" : "InfoSaône / Tony Galmiche",
"category" : "InfoSaône",
'description': """
InfoSaône - Module Odoo pour Coheliance
===================================================
InfoSaône - Module Odoo pour Cohel... |
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either... |
#!/usr/bin/env python
import requests
import traceback
import sys
from bs4 import BeautifulSoup
import csv
## getHTML
def getHTML():
url = "http://en.wikipedia.org/wiki/Mobile_country_code"
html = ""
try :
r = requests.get(url)
html = r.text.encode("utf-8")
except:
traceback.p... |
#! /usr/bin/env python
try:
import sys
import math
import collections
import os
import argparse
import treeIO
from treeIO import Tree, SeqGroup
from nexus import NexusReader
from PTPLLH import lh_ratio_test, exp_distribution, species_setting, exponential_mixture
from summary import partitionparser
except Impo... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from parlai.core.teachers import Teacher
from parlai.utils.io import PathManager
from .build import build
import json
i... |
#This file will time various versions of LCA
from __future__ import division
import numpy as np
import sklearn.preprocessing as skp
from timeit import default_timer as timer
from LCAnumpy import lca as lcan
from LCAfortran import lca as lcaf
from LCAnumbaprog import lca as lcag
def main():
"""Profiles various ver... |
'''
Created on 10 August 2014
@author: vincent
'''
# Loading necessary packages
import numpy as np
import sys
from seizures.data.DataLoader_v2 import DataLoader
from seizures.evaluation.XValidation import XValidation
from seizures.evaluation.performance_measures import accuracy, auc
from seizures.features.FeatureExt... |
import random, math
def highest(v):
return random.choice([i for i in range(len(v)) if max(v) == v[i]])
def lowest(v):
return random.choice([i for i in range(len(v)) if min(v) == v[i]])
def best(c):
return highest([c[1]-c[2], c[2]-c[0], c[0]-c[1]])
if(1):
if (input == ""):
N = 1
AR1 =... |
import logging
import pytest
import numpy as np
import pandas as pd
from eval.pipeline.feature_extractors import FeatureExtractor
from eval.scripts.kmeans_disco import cluster_vectors
from eval.pipeline.multivectors import KmeansVectorizer
logging.basicConfig(level=logging.INFO,
format="%(asctime... |
import copy
import datetime
import decimal
import math
import warnings
from itertools import tee
from django.db import connection
from django.db.models.query_utils import QueryWrapper
from django.conf import settings
from django import forms
from django.core import exceptions, validators
from django.utils.datastructur... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.