CombinedText stringlengths 4 3.42M |
|---|
import torch
import numpy as np
from baseline.utils import lookup_sentence, get_version
from baseline.utils import crf_mask as crf_m
from torch.autograd import Variable
import torch.autograd
import torch.nn as nn
import torch.nn.functional
import math
import copy
PYT_MAJOR_VERSION = get_version(torch)
def sequence_m... |
from __future__ import annotations
import json
import time
from typing import Any, Callable, NamedTuple
from collections import namedtuple
from enum import Enum
from pyinstrument import processors
from pyinstrument.frame import BaseFrame
from pyinstrument.renderers.base import ProcessorList, Renderer
from pyinstrumen... |
re-enable cap
|
# Copyright 2019 The Magenta 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 ... |
"""
Serilizers for the accounts application API
"""
from django.contrib.auth.models import User
from rest_framework import serializers
from muckrock.accounts.models import Profile, Statistics
from muckrock.jurisdiction.models import Jurisdiction
# pylint: disable=too-few-public-methods
class ProfileSerializer(seri... |
'''
Created on Feb 6, 2015
@author: cmccully
'''
from __future__ import absolute_import, division, print_function
from future.utils import iteritems
import om10
import numpy as np
import re
import json
import os
import pandas as pd
import copy
import gzip
import shutil
from lsst.utils import getPackageDir
from lsst.si... |
"""
Run GradeFast.
Licensed under the MIT License. For more, see the LICENSE file.
Author: Jake Hartz <jake@hartz.io>
"""
import threading
import time
import webbrowser
from typing import Sequence
from iochannels import Channel, Msg
from pyprovide import Injector
from gradefast.gradebook.gradebook import GradeBook... |
"""Extract reference documentation from the NumPy source tree.
"""
import inspect
from nose.plugins.skip import SkipTest
import re
import sys
import types
class Reader(object):
"""A line-based string reader.
"""
def __init__(self, data):
"""
Parameters
----------
data : s... |
"""django-cms plugins for the ``multilingual_orgs`` app."""
from django.utils.translation import ugettext_lazy as _
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from .models import OrganizationPluginModel
class OrganizationPlugin(CMSPluginBase):
model = OrganizationPluginMod... |
'''
Created on Feb 6, 2015
@author: cmccully
'''
from __future__ import absolute_import, division, print_function
from future.utils import iteritems
import om10
import numpy as np
import re
import json
import os
import pandas as pd
import copy
import gzip
import shutil
from lsst.utils import getPackageDir
from lsst.si... |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
from grako.model import Node
from grako.rendering import render, Renderer, RenderingFormatter
class DelegatingRenderingFormatter(RenderingFormatter):
def __init__(self, delegate):
assert hasattr(del... |
#!/usr/bin/env python
# pep8.py - Check Python source code formatting, according to PEP 8
# Copyright (C) 2006-2009 Johann C. Rocholl <johann@rocholl.net>
# Copyright (C) 2009-2013 Florent Xicluna <florent.xicluna@gmail.com>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this soft... |
#!/usr/bin/env python3
# -*- coding:UTF-8 -*-
# Copyright (c) 2019 Nicolas Iooss
#
# 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... |
# Copyright (c) 2009-2016 The Regents of the University of Michigan
# This file is part of the HOOMD-blue project, released under the BSD 3-Clause License.
R""" Pair potentials.
Generally, pair forces are short range and are summed over all non-bonded particles
within a certain cutoff radius of each particle. Any num... |
"""cffLib.py -- read/write tools for Adobe CFF fonts."""
__version__ = "1.0b1"
__author__ = "jvr"
import struct, sstruct
import string
import types
import psCharStrings
cffHeaderFormat = """
major: B
minor: B
hdrSize: B
offSize: B
"""
class CFFFontSet:
def __init__(self):
self.fonts = {}
def decomp... |
import connect
from engine.event import *
from engine.action import *
from engine.code import *
from engine.player import *
from engine.round import *
from engine.team import *
from engine.spawn import *
from flask import Flask, render_template, request, json, session, jsonify
import os
import json
app = Flask(__na... |
"""Iterables of DOT source code lines (including final newline)."""
import typing
from . import copying
__all__ = ['Base']
class LineIterator:
"""Iterable of DOT Source code lines."""
def __iter__(self) -> typing.Iterator[str]:
r"""Yield the generated DOT source line by line.
Yields: Line... |
from flask import Flask, jsonify, abort, request
from goshna import *
from goshna import ApiFunctions, DisplayFlight
from datetime import date, time;
class Flight:
def __init__(self, id, date, airline_id, source_airport_id, dest_airport_id, flight_number, departure_time):
self.id = id
self.date = d... |
from math import floor
from decimal import Decimal
import settings
def format_timedelta(value, time_format="{days} days, {hours2}:{minutes2}:{seconds2}"):
if hasattr(value, 'seconds'):
seconds = value.seconds + value.days * 24 * 3600
else:
seconds = int(value)
seconds_total = seconds
... |
#!/usr/bin/python
# Based on the topo.py script from the P4 tutorial
# Copyright 2013-present Barefoot Networks, 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.ap... |
#
# This file is part of Bakefile (http://www.bakefile.org)
#
# Copyright (C) 2012 Vaclav Slavik
#
# 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 ... |
# -*- coding: utf-8 -*-
from flask import Blueprint, current_app, flash, jsonify, redirect, render_template, request, url_for
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm import joinedload
from doorman.forms import (
AddDistributedQueryForm,
CreateQueryForm,
UpdateQueryForm,
CreateTagF... |
# Copyright 2013 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 a... |
# coding: utf-8
from __future__ import unicode_literals, division, print_function
"""
Workflows for GW calculations:
VaspGWFWWorkFlow fireworks wf for vasp
SingleAbinitGWWorkFlow workflow for abinit
Under construction:
general GW workflow that should manage all the code independent logic
"""
__author__ = "Michie... |
""" Classes to represent and manipulate gravity's stored configuration and
state data.
"""
import enum
import errno
import os
import sys
from collections import defaultdict
import yaml
from gravity.util import AttributeDict
GALAXY_YML_SAMPLE_PATH = "lib/galaxy/config/sample/galaxy.yml.sample"
DEFAULT_GALAXY_ENVIRON... |
__author__ = 'Nicolas'
import t411
import os
import transmissionrpc
import base64
import inspect
#https://api.t411.me/
class cmdLoop:
__result_len_limit__ = 20
def command(command_string):
def decorator(func):
func.command_string = command_string
return func
return d... |
# -*- coding: utf-8 -*-
"""
Google Cloud Storage pythonic interface
"""
from __future__ import print_function
import decorator
import array
from base64 import b64encode
import google.auth as gauth
import google.auth.compute_engine
from google.auth.transport.requests import AuthorizedSession
from google.auth.exception... |
#!/usr/bin/env python
#=============================================================================================
# MODULE DOCSTRING
#=============================================================================================
"""
Tools to build Yank experiments from a YAML configuration file.
"""
#============... |
#!/usr/bin/env python2
"""Standardize images."""
from __future__ import division
import argparse
import numpy as np
import scipy as sp
import dwi.dataset
import dwi.mask
import dwi.plot
import dwi.util
def parse_args():
"""Parse command-line arguments."""
p = argparse.ArgumentParser(description=__doc__)
... |
# Copyright (c) 2011 Tencent Inc.
# All rights reserved.
#
# Author: Huan Yu <huanyu@tencent.com>
# Feng Chen <phongchen@tencent.com>
# Yi Wang <yiwang@tencent.com>
# Chong Peng <michaelpeng@tencent.com>
# Wenting Li <wentingli@tencent.com>
# Date: October 20, 2011
"""
This is the s... |
#!/usr/bin/env python
######################################################
#
# howdoi - instant coding answers via the command line
# written by Benjamin Gleitzman (gleitz@mit.edu)
# inspired by Rich Jones (rich@anomos.info)
#
######################################################
from __future__ import print_functi... |
#!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2011, Georgia Institute of Technology
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributio... |
# Copyright 2001-2012 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permissio... |
"""
function for calculating the convergence of an x, y data set
main function:
test_conv(xs, ys, name, tol)
tries to fit multiple functions to the x, y data
calculates which function fits best
for tol < 0
returns the x value for which y is converged within tol of the assymtotic value
for tol > 0
returns the x_value fo... |
# Copyright 2019-2021 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) an... |
# Copyright 2013 dotCloud inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed t... |
from corehq import Domain
from corehq.apps.locations.models import SQLLocation
from corehq.apps.products.models import SQLProduct
from corehq.apps.reports.datatables import DataTablesHeader, DataTablesColumn
from corehq.apps.reports.filters.fixtures import AsyncLocationFilter
from corehq.apps.reports.graph_models impor... |
import requests
import json
base_url = 'http://gis.co.hennepin.mn.us/ArcGIS/rest/services/Maps/PROPERTY/MapServer/0'
output_file = 'output.geojson'
metadata = requests.get(base_url, params={'f': 'json'}).json()
bounds = metadata['extent']
fields = metadata['fields']
geom_type = metadata['geometryType']
saved = set()
... |
# -*- coding: utf-8 -*-
"""
Google Cloud Storage pythonic interface
"""
from __future__ import print_function
import array
import io
import json
import logging
import oauth2client.client # version 1.5.2
import os
import pickle
import re
import requests
import sys
import time
import warnings
import webbrowser
from .... |
"""constants for YesssSMS."""
VERSION = "0.3.1a3"
_UNSUPPORTED_CHARS_STRING = "<strong>Achtung:</strong> Ihre SMS konnte nicht \
versendet werden, da sie folgende ungültige Zeichen enthält:"
_LOGIN_ERROR_STRING = "<strong>Login nicht erfolgreich"
_LOGIN_LOCKED_MESS = "Wegen 3 ungültigen Login-Versuchen ist Ihr Account ... |
# -*- coding: utf-8 -*-
"""
gspread.utils
~~~~~~~~~~~~~
This module contains utility functions.
"""
import re
from functools import wraps
from collections import defaultdict
from itertools import chain
from xml.etree import ElementTree
from .exceptions import IncorrectCellLabel, NoValidUrlKeyFound
MAGIC_NUMBER =... |
import os
import sys
import json
import string
import argparse as ap
from os import path
from glob import glob
from collections import namedtuple
import jedi
global verbose_, quiet_
def log(msg):
if verbose_:
sys.stderr.write(msg + '\n')
def error(msg):
if not quiet_:
sys.stderr.write(msg + ... |
#!/usr/bin/env python
######################################################
#
# howdoi - instant coding answers via the command line
# written by Benjamin Gleitzman (gleitz@mit.edu)
# inspired by Rich Jones (rich@anomos.info)
#
######################################################
from __future__ import print_funct... |
import importlib
import inspect
import os
import re
import sys
import tempfile
from io import StringIO
from pathlib import Path
from django.conf.urls import url
from django.core import mail
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db import DatabaseError, connection
from django.shortcu... |
"""
Marshalls a collection of project information together in to a dictionary called the `context`.
When an instance of a project is launched on AWS, we need to tweak things a bit
with no manual steps in some cases, or as few as possible in other cases.
Case 1: New, standardized environment
We launch journal--ci, a t... |
from test.test_support import verbose, have_unicode, TestFailed
import sys
from test.test_support import MAX_Py_ssize_t
maxsize = MAX_Py_ssize_t
# test string formatting operator (I am not sure if this is being tested
# elsewhere but, surely, some of the given cases are *not* tested because
# they crash python)
# test... |
"""
function for calculating the convergence of an x, y data set
main function:
test_conv(xs, ys, name, tol)
tries to fit multiple functions to the x, y data
calculates which function fits best
for tol < 0
returns the x value for which y is converged within tol of the assymtotic value
for tol > 0
returns the x_value fo... |
from ctypes import *
import numpy as np
import sys
if sys.platform.startswith('linux'):
libcsound = CDLL("libcsound64.so")
elif sys.platform.startswith('win'):
libcsound = cdll.libcsound64
elif sys.platform.startswith('darwin'):
libcsound = CDLL("libcsound64.dylib")
else:
sys.exit("Don't know your syst... |
# Copyright 2019 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any lat... |
from __future__ import absolute_import
from itertools import izip_longest, repeat
import logging
import time
import numbers
from threading import Lock, Thread, Event
from multiprocessing import Process, Queue as MPQueue, Event as MPEvent, Value
from Queue import Empty, Queue
import kafka
from kafka.common import (
... |
from .base_settings import *
ALLOWED_HOSTS = ['*']
if os.getenv('AUTH', 'NONE') == 'SAML_MOCK':
MOCK_SAML_ATTRIBUTES = {
'uwnetid': ['jfaculty'],
'affiliations': ['faculty', 'employee', 'member'],
'eppn': ['jfacult@washington.edu'],
'scopedAffiliations': [
'employee@was... |
#!/usr/bin/env python
# Author: Scott Haskell
# Company: Splunk Inc.
# Date: 2016-10-21
#
# The MIT License
#
# Copyright (c) 2016 Scott Haskell, Splunk Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
#... |
import logging
from wordpress import WPException
from .config import WPPluginConfig
class WPPolylangConfig(WPPluginConfig):
def configure(self, languages=None, default=None, **kwargs):
""" kwargs:
- `languages`, array: all languages to install
- `default`, string: default languag... |
import os
from mimetypes import guess_type
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.files.storage import Storage, StorageFile
from django.utils.functional impo... |
import re
import ipaddress
class VLAN(object):
"""
Represents a 802.1Q VLAN.
"""
def __init__(self, switch, vid):
"""
Constructs a new VLAN and retrieves its attributes from the given `switch` by using the given VID.
"""
self.vid = vid
self.switch = switch
... |
#!/usr/bin/env python
"""This file starts the game"""
import pygame
from pgu import gui, timer
class DrawingArea(gui.Widget):
def __init__(self, width, height):
gui.Widget.__init__(self, width=width, height=height)
self.imageBuffer = pygame.Surface((width, height))
def paint(self, surf):
... |
# We import importlib *ASAP* in order to test #15386
import importlib
import builtins
import imp
from importlib.test.import_ import test_suite as importlib_import_test_suite
from importlib.test.import_ import util as importlib_util
import marshal
import os
import platform
import py_compile
import random
import stat
imp... |
#!/usr/bin/python
'''The MIT License (MIT)
Copyright (c) 2017 Yu Xiong Wei(try.dash.now@gmail.com)
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... |
import time
import asyncio
import aiohttp
import requests
import mimetypes
from requests.adapters import HTTPAdapter
from python_rucaptcha.config import app_key
from python_rucaptcha.errors import RuCaptchaError
from python_rucaptcha.result_handler import get_sync_result, get_async_result
from python_rucaptcha.decora... |
"""
function for calculating the convergence of an x, y data set
main function:
test_conv(xs, ys, name, tol)
tries to fit multiple functions to the x, y data
calculates which function fits best
for tol < 0
returns the x value for which y is converged within tol of the assymtotic value
for tol > 0
returns the x_value fo... |
# -*- coding: utf-8 -*-
##
## $Id$
##
## This file is part of CDS Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006 CERN.
##
## CDS Invenio 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... |
"""Django settings for use within the docker container."""
from os import environ
import dj_database_url
from .base import *
# Disable debug mode
DEBUG = False
SECRET_KEY = environ.get('SECRET_KEY') or 'please-change-me'
PROJECT_ROOT = (
environ.get('PROJECT_ROOT') or dirname(dirname(abspath(__file__))))
SE... |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
__version__ = '0.4'
__release__ = '0.4.4dev'
Version 0.4.4
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_li... |
import json
import operator
from collections import OrderedDict
from functools import reduce
from django.conf import settings
from django.core.exceptions import FieldDoesNotExist
from django.forms import BooleanField, CharField, ModelForm, MultipleChoiceField, ValidationError
from django.forms.widgets import HiddenInp... |
# $Id: ethernet.py 65 2010-03-26 02:53:51Z dugsong $
# -*- coding: utf-8 -*-
"""Ethernet II, LLC (802.3+802.2), LLC/SNAP, and Novell raw 802.3,
with automatic 802.1q, MPLS, PPPoE, and Cisco ISL decapsulation."""
from copy import copy
import dpkt
import llc
ETH_CRC_LEN = 4
ETH_HDR_LEN = 14
ETH_LEN_MIN = 64 # minimu... |
"""Define celery tasks for hs_core app."""
import os
import sys
import traceback
import zipfile
import logging
import json
from datetime import datetime, timedelta, date
from xml.etree import ElementTree
import requests
from celery import shared_task
from celery.schedules import crontab
from celery.task import perio... |
# -*- coding: utf-8 -*-
import pytz
import re
import time
import openerp
import openerp.service.report
import uuid
from werkzeug.exceptions import BadRequest
from datetime import datetime, timedelta
from dateutil import parser
from dateutil import rrule
from dateutil.relativedelta import relativedelta
from openerp imp... |
"""
@package mi.instrument.teledyne.workhorse_monitor_150_khz.cgsn.test.test_driver
@author Roger Unwin
@brief Test cases for InstrumentDriver
USAGE:
Make tests verbose and provide stdout
* From the IDK
$ bin/test_driver
$ bin/test_driver -u
$ bin/test_driver -i
$ bin/test_driver -q
""... |
import unittest
from test import support
from contextlib import closing
import gc
import pickle
import select
import signal
import struct
import subprocess
import traceback
import sys, os, time, errno
try:
import threading
except ImportError:
threading = None
if sys.platform in ('os2', 'riscos'):
raise uni... |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# ... |
import math
import time
import os
import re
from utils import add_cmd, commands, cmd_list, PY3, PrintError
import logging
def chunks(l, n):
"""Yield successive n-sized chunks from l."""
for i in range(0, len(l), n):
yield l[i:i+n]
@add_cmd("calc", alias=["math"], minArgs=1)
def calc(bot, event, irc,... |
""" Tests for part of the numpy module. """
import unittest
import numpy
from pythran.typing import List, NDArray, Tuple
from pythran.tests import TestEnv
@TestEnv.module
class TestNumpyFunc3(TestEnv):
"""
This module includes tests for multiple numpy module function.
Tested functions are:
- nump... |
# Copyright 2012 Kevin Goodsell
#
# This software is licensed under the Eclipse Public License (EPL) V1.0.
'''
Direct wrappers for STAF functions. These aren't "Pythonized", and aren't
intended to be used directly.
'''
import ctypes
from ._errors import STAFResultError
staf = ctypes.cdll.LoadLibrary('libSTAF.so')
... |
#!/usr/bin/env python
import urllib2,urllib
from django.conf import settings
from nodegroups import *
try:
import json
except ImportError:
import simplejson as json
class SaltAPI(object):
__token_id = ''
def __init__(self):
self.__url = settings.SALT_API_URL
self.__user = settings.SALT_... |
# -*- coding: utf-8 -*-
"""
gspread.utils
~~~~~~~~~~~~~
This module contains utility functions.
"""
import re
from xml.etree import ElementTree
from .exceptions import IncorrectCellLabel
MAGIC_NUMBER = 64
CELL_ADDR_RE = re.compile(r'([A-Za-z]+)([1-9]\d*)')
def finditem(func, seq):
"""Finds and returns first... |
import os
import copy
import etcd
import time
from gevent import socket
from tendrl.commons.utils import etcd_utils
from tendrl.commons.utils import log_utils as logger
from tendrl.monitoring_integration.grafana import cluster_detail
class GraphitePlugin():
def __init__(self):
self.host = NS.config.... |
"""
Freezes final grades for a course
"""
import csv
import argparse
from collections import namedtuple
from django.core.management import BaseCommand, CommandError
from grades.models import ProctoredExamGrade
class ParsingError(CommandError):
"""Custom class for parsing exceptions"""
pass
class GradeRowPa... |
# Python query script that reads all ES records on the l2b server, stores them in a dictionary and prints it.
from elasticsearch import Elasticsearch
import certifi
import datetime
import calendar
es = Elasticsearch(
'[...]',
# name of node to be added here 'http(s)://user:password@server:port']
port= #ad... |
#!/usr/bin/env python-sirius
"""."""
import time as _time
from epics import PV
from siriuspy.csdevice.orbitcorr import SOFBFactory
class SOFB:
"""."""
def __init__(self, acc):
"""."""
self.data = SOFBFactory.create(acc)
orbtp = 'MTurn' if self.data.isring else 'SPass'
self._t... |
import re
import os.path
import glob
from . import cmake
from . import vsinfo
from .build_item import BuildItem
# -----------------------------------------------------------------------------
class Generator(BuildItem):
"""Visual Studio aliases example:
vs2013: use the bitness of the current system
vs2... |
# Copyright (C) 2010-2012 Cuckoo Sandbox Developers.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import pkgutil
import inspect
import logging
from collections import defaultdict
from lib.cuckoo.common.exceptions import CuckooCriticalError
... |
"""Define celery tasks for hs_core app."""
import os
import sys
import traceback
import zipfile
import logging
import json
from celery.signals import task_postrun
from datetime import datetime, timedelta, date
from xml.etree import ElementTree
import requests
from celery import shared_task
from celery.schedules impo... |
import random
import numpy as np
import time
import robot
c = 0;
sigmaX = sigmaY = 1.6
sigmaT = 0.2
def getRandomX():
return random.gauss(0,sigmaX)
def getRandomY():
return random.gauss(0,sigmaY)
def getRandomTheta():
return random.gauss(0,sigmaT)
numberOfParticles = 100
#line1 = (10, 10, 10, 500) # (... |
# Copyright 2017 Mycroft AI Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2011-2014 OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... |
# -*- coding: utf8 -*-
# Copyright (c) 2014 by Ecreall under licence AGPL terms
# avalaible on http://www.gnu.org/licenses/agpl.html
# licence: AGPL
# author: Amen Souissi
"""
This module represent all of behaviors used in the
Proposal management process definition.
"""
import datetime
import pytz
from persistent... |
#!/usr/bin/env python
import ast
import base64
import ccd
import hashlib
import os
import numpy as np
import sys
import requests
import cw
from glob import glob
from datetime import datetime
class SparkException(Exception):
pass
class Spark(object):
def __init__(self, config):
self.config = config
... |
#!/usr/bin/python2.5
#
# Copyright 2008 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... |
#!/bin/sh
# -*- python -*-
################################################################################
# This file is python bilingual: The next line starts a comment in Python,
# and is a no-op in shell
""":"
# Find a suitable python interpreter (adapt for your specific needs)
for cmd in python3 python python2;... |
#!/usr/bin/env python
'''
Creates a fake XDCAM EX structure for testing purposes
'''
import os
import sys
import subprocess
def make_clip(clip_dir):
'''
Creates some dummy clips.
'''
clip_name = os.path.basename(clip_dir)
mp4 = os.path.join(clip_dir, clip_name + '.MP4')
smi = os.path.join(clip_... |
#
# Collective Knowledge (individual environment - setup)
#
# See CK LICENSE.txt for licensing details
# See CK COPYRIGHT.txt for copyright details
#
# Developer: Grigori Fursin, Grigori.Fursin@cTuning.org, http://fursin.net
#
extra_dirs=['C:\\Program Files (x86)\\Microsoft Visual Studio\\2017',
'D:\\Progr... |
#!/usr/bin/python
'''The MIT License (MIT)
Copyright (c) 2017 Yu Xiong Wei(try.dash.now@gmail.com)
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 command file for every external command not specifically for running
# the bot. Even more relevant commands like broadcast options and whitelists
# are treated as such.
#
# Every command in here should follow the basic structure of:
# elif cmd == 'commandHere':
# doYourThings(lots, of, variables)
# return... |
# -*- mode: python; coding: utf-8 -*-
# Copyright (c) 2020 Radio Astronomy Software Group
# Licensed under the 2-clause BSD License
"""Tests for Mir class.
Performs a series of test for the Mir class, which inherits from UVData. Note that
there is a separate test module for the MirParser class (mir_parser.py), which ... |
""" Summary plots of SHAP values across a whole dataset.
"""
from __future__ import division
import warnings
import numpy as np
from scipy.stats import gaussian_kde
try:
import matplotlib.pyplot as pl
except ImportError:
warnings.warn("matplotlib could not be loaded!")
pass
from . import labels
from . imp... |
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 28 18:56:43 2014
@author: micha
"""
from pyNN.models import BaseCellType
# These are defined in $GeNNPATH/lib/utils.h and extra_neurons.h
class RulkovMapNeuron(BaseCellType):
"""
Rulkov map-based neurons.
"""
default_parameters = {}
default_initial_... |
#!/usr/bin/env python
__all__ = ['twitter_download']
from ..common import *
from .vine import vine_download
def twitter_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
html = get_html(url)
screen_name = r1(r'data-screen-name="([^"]*)"', html)
item_id = r1(r'data-item-id="([^"]*)"', ... |
import cherrypy
import os
# static dir defined here for static content
STATIC_DIR = os.path.abspath("%s/../client" % os.path.dirname(__file__))
def CORS():
cherrypy.response.headers["Access-Control-Allow-Origin"] = "*"
# this class just returns the fixed-chart html file
class GetChart(object):
@cherrypy.ex... |
"""
CLI for kalite
"""
from __future__ import print_function
from __future__ import unicode_literals
import getpass
import logging
import os
import re
import json
import pwd
import shlex
import subprocess
from distutils.spawn import find_executable
from .exceptions import ValidationError
from . import validators
l... |
from .market_calendar import MarketCalendar
def get_calendar(name, open_time=None, close_time=None):
"""
Retrieves an instance of an MarketCalendar whose name is given.
:param name: The name of the MarketCalendar to be retrieved.
:param open_time: Market open time override as datetime.time object. I... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.