text stringlengths 3.07k 12.6k |
|---|
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import flt
from frappe import _
def execute(filters=None):
if not filters: filters = {}
salary_slips = get_salary_sli... |
# START PROBLEM SET 08
print('Problem set 08 \n')
# SETUP
import csv
state2state_id = {
'Alabama' : 'AL',
'Alaska' : 'AK',
'Arizona' : 'AZ',
'Arkansas' : 'AR',
'California' : 'CA',
'Colorado' : 'CO',
'Connecticut' : 'CT',
'Delaware' : 'DE',
'Florida' : 'FL',
'Georgia' : 'GA',
... |
__source__ = 'https://leetcode.com/problems/distinct-subsequences-ii/'
# Time: O()
# Space: O()
#
# Description: Leetcode # 940. Distinct Subsequences II
#
# Given a string S, count the number of distinct, non-empty subsequences of S .
#
# Since the result may be large, return the answer modulo 10^9 + 7.
#
# Example 1... |
#
# This file is part of the GROMACS molecular simulation package.
#
# Copyright (c) 2019,2020,2021, by the GROMACS development team, led by
# <NAME>, <NAME>, <NAME>, and <NAME>,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
#
# GROMACS is ... |
""" Contains functions to make http GET and http POST with. version 0.0.6 """
import time
import logging
import requests
from requests.utils import quote, unquote
__all__ = ['quote', 'unquote']
log = logging.getLogger(__name__)
# A session that all requests will use...apparently not.
__request_session = requests.s... |
# import numpy as np
# import scipy
# from pycqed.measurement import sweep_functions as swf
# from sweep_functions import (Sweep_function, Soft_Sweep)
# from pycqed.measurement import AWG_sweep_functions as awg_swf
# from pycqed.measurement import detector_functions as det
# import matplotlib.pyplot as plt
# from pycqe... |
'''
Seed a new project with a directory tree and first files
'''
# Import python libs
import os
SETUP = '''#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Import python libs
import os
import sys
import shutil
from setuptools import setup, Command
NAME = '%%NAME%%'
DESC = ('')
# Version info -- read without importi... |
"""
This is an advanced Piccolo feature which allows runtime reflection of database
tables.
"""
import asyncio
import typing as t
from dataclasses import dataclass
from piccolo.apps.schema.commands.generate import get_output_schema
from piccolo.table import Table
class Immutable(object):
def _immutable(self, *a... |
import json
import plotly
import plotly.express as px
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import pickle
import pandas as pd
import numpy as np
import utilities as utils
import constants as const
def plot_map(date_index, total, iva, death, mobility):
"""Generates the map in... |
#!/usr/bin/env python
# Copyright (c) 2018, <NAME>
#
# This program is free software; you can redistribute and/or modify
# it under the terms of the Apache License, Version 2.0. See the
# accompanying LICENSE file or read the terms at:
# http://www.apache.org/licenses/LICENSE-2.0
# To see the help and options, in co... |
import logging
from datetime import datetime
from pathlib import Path
import pkg_resources
import re
import subprocess
import sys
import traceback
from ibllib.io.extractors.base import get_session_extractor_type, get_pipeline
from ibllib.pipes import ephys_preprocessing, training_preprocessing, tasks
from ibllib.time ... |
import sys
import sqlite3
import getpass
import logging
import keyring
from itertools import chain
from typing import Iterator
from urllib.parse import urlparse
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers import Cipher
from cryptography.hazmat.primitives.ciphers.... |
#
# Copyright 2021 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... |
import numpy as np
class Quaternion:
"""Quaternion Rotation:
Class to aid in representing 3D rotations via quaternions.
"""
@classmethod
def from_v_theta(cls, v, theta):
"""
Construct quaternions from unit vectors v and rotation angles theta
Parameters
----------
... |
#!/usr/bin/env python3
from os import error
import sys
import time
import yaml
import signal
import argparse
import threading
import paho.mqtt.client as mqtt
from sensors import *
mqttClient = None
global poll_interval
deviceName = None
settings = {}
class ProgramKilled(Exception):
pass
def signal_handler(si... |
import enum
import re
from typing import Any
from typing import Optional
from typing import Tuple
import _onigurumacffi
_ffi = _onigurumacffi.ffi
_lib = _onigurumacffi.lib
_BACKREF_RE = re.compile(r'((?<!\\)(?:\\\\)*)\\([0-9]+)')
class OnigError(RuntimeError):
pass
class OnigSearchOption(enum.IntEnum):
N... |
from typing import Any, Dict, List, Optional, Union
import great_expectations.exceptions as ge_exceptions
from great_expectations import DataContext
from great_expectations.core.batch import BatchRequest
from great_expectations.execution_engine.execution_engine import MetricDomainTypes
from great_expectations.profile.... |
# Copyright 2017--2021 Amazon.com, Inc. or its affiliates. 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. A copy of the License
# is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" fi... |
import re
from cryptography import x509
from cryptography.exceptions import UnsupportedAlgorithm, InvalidSignature
from cryptography.hazmat.backends import default_backend
from cryptography.x509 import NameOID
from flask import current_app
from marshmallow.exceptions import ValidationError
from lemur.auth.permissions... |
import pandas as pd
import numpy as np
import random
import tensorflow as tf
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
def dump_tf_info():
print("Version: ", tf.__version__)
print("Eager mode: ", tf.executing_eagerly())
pri... |
from flask import Flask, render_template, g, redirect, url_for, Blueprint, request, session, abort
from . import db
from portal.auth import login_required, teacher_required
from . import course
bp = Blueprint("assignment", __name__)
def get_assignment(id):
user_id = session.get('user_id')
con = db.get_db(... |
from random import Random
from music21 import pitch
from music21.interval import Interval
from ea import initialisation, simulation, constants, duration
from ea.individual import Individual, Measure
import copy
rng = Random()
def applyMutation(individual: Individual, elitist_population: [Individual]):
mutation... |
"""This module contains simple helper functions """
from __future__ import print_function
import torch
import numpy as np
from PIL import Image
import os
import pytorch_lightning as pl
import numpy as np
import torch
import torch.nn.functional as F
def tensor2im(input_image, imtype=np.uint8):
""""Converts a Tensor ... |
import os
import typing
from typing import Type
import pandas
from flytekit import FlyteContext
from flytekit.configuration import sdk
from flytekit.core.type_engine import T, TypeEngine, TypeTransformer
from flytekit.models.literals import Literal, Scalar, Schema
from flytekit.models.types import LiteralType, Schema... |
from django.db.models import Q
from django.core.cache import cache
from django.urls import reverse
from django.utils.translation import ugettext as _
from base64 import b64encode
from base64 import b64decode
import json
from model_utils import Choices
from helpdesk.serializers import DatatablesTicketSerializer
def... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `openclsim` package."""
import pytest
import simpy
import shapely.geometry
import logging
import datetime
import time
import numpy as np
import pandas as pd
from click.testing import CliRunner
from openclsim import core
from openclsim import model
from open... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020 Nekokatt
# Copyright (c) 2021 davfsa
#
# 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 right... |
"""
Utility functions to retrieve information about available services and setting up security for the Hops platform.
These utils facilitates development by hiding complexity for programs interacting with Hops services.
"""
import os
from hops import hdfs as hopshdfs
from hops import tensorboard
from hops import devi... |
# Copyright: 2007-2010 <NAME> <<EMAIL>>
# License: GPL2/BSD
import os
from snakeoil.osutils import pjoin
from snakeoil.test.mixins import tempdir_decorator
from pkgcore.fs import livefs
from pkgcore.fs.contents import contentsSet
from pkgcore.merge import engine
from pkgcore.test import TestCase
from pkgcore.test.fs... |
import random
from datetime import date, datetime
import dateutil.parser
from ast import literal_eval
from typing import Callable, Any, Optional, Union, List, Tuple
from faker import Faker
from .data_gen_exceptions import DataGenError
import snowfakery.data_generator_runtime # noqa
RuntimeContext = "snowfakery.da... |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Utilities for manipulating blocks and transactions."""
from .mininode import *
from .script import CSc... |
"""Feature Extraction and Parameter Prediction networks
"""
import logging
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from models.pointnet_util import sample_and_group_multi
_raw_features_sizes = {'xyz': 3, 'dxyz': 3, 'ppf': 4}
_raw_features_order = {'xyz': 0, 'dxyz': 1, 'pp... |
from collections import OrderedDict
from dataclasses import dataclass
from enum import Enum
from pathlib import Path
from typing import Dict, Generator, List, Sequence
from dotmodules.modules.hooks import (
Hook,
LinkCleanUpHook,
LinkDeploymentHook,
ShellScriptHook,
)
from dotmodules.modules.links impo... |
import consul
import datetime
import logging
import time
from spaceone.core import config
from spaceone.core.locator import Locator
from spaceone.core.scheduler import HourlyScheduler
from spaceone.core.auth.jwt.jwt_util import JWTUtil
__all__ = ['StatHourlyScheduler']
_LOGGER = logging.getLogger(__name__)
def _ge... |
# -------------------------------------------------------------------------------
# Copyright IBM Corp. 2017
#
# 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/licens... |
import json
import pprint
from indy import pool, ledger, wallet, did
from indy.error import IndyError
from .interfaces import Initiator
from ..transfer import Transfer
def print_log(value_color="", value_noncolor=""):
"""set the colors for text."""
HEADER = '\033[92m'
ENDC = '\033[0m'
print(HEADER +... |
# import statements
from flask import Flask, render_template, request
from spotipy.oauth2 import SpotifyClientCredentials
import spotipy
import matplotlib.pyplot as plt
import numpy as np
# making and configuring flask app
app = Flask(__name__)
app.config['DEBUG'] = True
app.config['EXPLAIN_TEMPLATE_LOADING'] = True
... |
from os.path import dirname, abspath, join, isfile, isdir
import sys
import rosbag
import numpy as np
def get_data_dir():
return dirname(abspath(__file__))
def get_models_dir():
return join(dirname(dirname(abspath(__file__))), 'models')
def get_utils_dir():
return join(dirname(dirname(abspath(__file__)))... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
import logging.config
from flask import Flask, redirect, jsonify
from flask_restful import Api
from flask_session import Session
from flask_sqlalchemy import SQLAlchemy
from api.v1.scheduler.pbspro.job import Job
from api.v1.scheduler.pbspro.jobs import Jobs
from api.v1.scheduler.pbspro.queue import Queue
from api.v1.s... |
"""Utilities for working with intervals."""
import itertools
from typing import (
Any,
Collection,
Dict,
FrozenSet,
Hashable,
Iterable,
Iterator,
List,
Mapping,
Sequence,
Set,
Tuple,
TypeVar,
)
from typing_extensions import Literal, Protocol
End = Literal["L", "R"]
... |
import argparse
import random
import subprocess
import pysubs2
import genanki
import re
from pathlib import Path
OFFSET_AUDIO_START = -250
OFFSET_AUDIO_END = 250
OFFSET_IMAGE = 0
model = genanki.Model(
1740692504,
"japanese + subs2srs",
fields=[
{"name": "SequenceMarker"},
{"name": "Expres... |
from sly import Lexer, Parser
import sys
from copy import deepcopy
class JsonLexer(Lexer):
tokens = {
LSBRACKET,
RSBRACKET,
LBRACE,
RBRACE,
COLON,
STRING,
SINGLE_STRING,
CONSTANT,
COMMA,
INT,
FLOAT,
LITERRAL_VALUE,
... |
import json
import logging
import os
import re
import subprocess
from buildpack import util
def compile(buildpack_path, cache_path, local_path, java_version):
logging.debug("begin download and install java")
util.mkdir_p(os.path.join(local_path, "bin"))
jvm_location = ensure_and_get_jvm(
java_ver... |
#!/usr/bin/python
"""Module for parsing FLUKA output data. FLUKA is a fully integrated particle
physics MonteCarlo simulation package. It has many applications in high
energy experimental physics and engineering, shielding, detector and telescope
design, cosmic ray studies, dosimetry, medical physics and radio-biology.... |
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: MIT
from __future__ import absolute_import, print_function, unicode_literals
import os
from boltons.fileutils import atomic_rename, atomic_save
import portalocker
from .compat import os_makedirs, FileNotFoundError, IS_WINDOWS
__all__ = ['create_maildir_directorie... |
import logging
from abc import ABCMeta
from abc import abstractmethod
from io import BytesIO
from string import Template
from urllib.parse import urlencode, urljoin
from galaxy.util import unicodify
from .util import copy_to_path
log = logging.getLogger(__name__)
class PulsarInterface(metaclass=ABCMeta):
"""
... |
import torch
import numpy as np
EPISILON = 1e-6
# we can track dynamic infomation
# naively, we can also directly insert all information into LSTM
def TrackingDynamicInfos(prevROIFeature, prevROI, currROIFeature, currROI, kernel=5):
'''
calculate the dynamic movement info and feed into our TrackingLocGRU
input l... |
from collections import OrderedDict
from . import regexshim as _re
import sys
""" tags which we consider empty. This is largely the same as HTML but includes a few more. """
_EMPTY_TAGS = ( 'area', 'base', 'br', 'col', 'command', 'embed', 'hr', 'img',
'input', 'keygen', 'link', 'meta', 'param', 'sour... |
# -*- coding: utf-8 -*-
__version__ = '0.1.0'
__author__ = '<NAME>'
import bson
from flask import json, current_app
app = current_app
def create_from_file(file_path=None):
"""
Import song data from JSON file.
:param file_path: full file path to JSON file
:return: status: True if creation is done ... |
import base64
import datetime
import io
import plotly.graph_objs as go
import dash
from dash.dependencies import Input, Output, State
import dash_core_components as dcc
import dash_html_components as html
import dash_table
import pandas as pd
from sqlalchemy import create_engine
# INSERT INTO "data1.... |
"""This demo shows how to use Traits TreeEditors with PyTables to walk the
heirarchy of an HDF5 file. This only picks out arrays and groups, but could
easily be extended to other structures, like tables.
In the demo, the path to the selected item is printed whenever the selection
changes. In order to run, a path to ... |
#!/usr/bin/env python3
#-*- coding:utf-8 -*-
"""
Provides definition for Helix:
* Geom data: r, z
* Model Axi: definition of helical cut (provided from MagnetTools)
* Model 3D: actual 3D CAD
* Shape: definition of Shape eventually added to the helical cut
"""
import json
import yaml
from . import deserialize
from .... |
# max len = 56
from __future__ import absolute_import
from __future__ import print_function
import logging
import os
import sys
import numpy as np
import pandas as pd
from keras import Sequential
from keras.layers import Dense, Dropout, Embedding, GRU, Bidirectional
from keras.models import Model
from keras.preproces... |
import argparse
import time
import os
import gym
import tensorflow as tf
import numpy as np
from mpi4py import MPI
from stable_baselines import logger, bench
from stable_baselines.common.misc_util import set_global_seeds, boolean_flag
from stable_baselines.ddpg.policies import MlpPolicy, LnMlpPolicy
from ... |
"""An implementation of qubits and gates acting on them.
Todo:
* Update docstrings.
* Update tests.
* Implement apply using decompose.
* Implement represent using decompose or something smarter. For this to
work we first have to implement represent for SWAP.
* Decide if we want upper index to be inclusive in the co... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... |
import linecache
import logging
import os
import re
from typing import Optional, List
from detect_secrets import SecretsCollection
from detect_secrets.core import scan
from detect_secrets.core.potential_secret import PotentialSecret
from detect_secrets.settings import transient_settings
from typing_extensions import T... |
import pytest
from nbformat.v4.nbbase import new_code_cell, new_notebook
from jupytext import read, reads, writes
from jupytext.compare import compare
from jupytext.pep8 import (
cell_ends_with_code,
cell_ends_with_function_or_class,
cell_has_code,
next_instruction_is_function_or_class,
pep8_lines_... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
class Configuration(object):
LINKS_ARRAY = ['http://www.emsbrno.cz/p.axd/cs/%C5%BDab%C4%8Dice.PPS.MZLUUAB.html',
'http://www.emsbrno.cz/p.axd/cs/Vigantice.MZLUUAB.html',
'http://www.emsbrno.cz/p.axd/cs/Marchegg.M... |
import os
import yaml
import torch
import nibabel as nib
import numpy as np
import pandas as pd
import torch.nn as nn
import torch.nn.functional as F
from torch import optim
import time
import pickle
from torch.utils.data import Dataset, DataLoader
from torch.optim.lr_scheduler import LambdaLR,MultiStepLR
import matplo... |
from functools import partial
from typing import Any, Callable, Dict, List, Optional
from tartiflette.coercers.outputs.directives_coercer import (
output_directives_coercer,
)
from tartiflette.coercers.outputs.object_coercer import object_coercer
from tartiflette.types.helpers.get_directive_instances import (
... |
__author__ = '<EMAIL>'
import logging
import traceback
from modules.util import environment, exceptions, data_defs, error_cache
from modules.util import redis, requests, pipeline_data_utils
def handle_recommendation(pipeline_data, application_name, recommendation_text):
logger = logging.getLogger(__name__)
re... |
import warnings
import torch
import torch.nn as nn
from torch.nn import functional as F
from torchvision.models.utils import load_state_dict_from_url
from torchvision.models.googlenet import (
GoogLeNetOutputs, BasicConv2d, Inception, InceptionAux, GoogLeNet, model_urls)
from .utils import _replace_relu, quantize... |
#!/usr/bin/env python3
'''
MIT License
Copyright (c) 2021 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify,... |
# -*- coding: utf-8 -*-
"""
Plot graph according to the DAT file
@author: <NAME>
"""
import csv
import glob
import os
import matplotlib.pyplot as plt
import scipy.signal as signal
import numpy as np
import math
from astropy.timeseries import LombScargle
def read_raw_file_data(filepath):
'''
Read data in list... |
"""
Our very own ``flake8`` formatter for better error messages.
That's how all ``flake8`` formatters work:
.. mermaid::
:caption: ``flake8`` formatting API calls order.
graph LR
F2[start] --> F3[after_init]
F3 --> F4[start]
F4 --> F5[beggining]
F5 --> ... |
"""Test for 'database_manager' functions."""
import sqlite3
import unittest
from itertools import islice
from src import database_manager
DB_NAME = "tests/testdb.sqlite3"
VAULT_TABLE_SQL = "create table if not exists vault (\
account_id integer primary key,\
name text not null,\
login text not null,\
password text no... |
import json
import re
from functools import lru_cache
from math import log10
from malaya.text.regex import _expressions
from malaya.model.tf import Segmentation
from malaya.path import PATH_PREPROCESSING, S3_PATH_PREPROCESSING
from malaya.supervised import transformer as load_transformer
from malaya.function import che... |
import subprocess, sys, time, os
import json, numpy
import cv2
from twitchstream.outputvideo import TwitchBufferedOutputStream
from pose_estimation import PoseProcessor
# import tensorflow as tf
import torch
import posenet
FFMPEG= 'ffmpeg'
FFPROBE = 'ffprobe'
def get_stream_resolution(stream_name):
metadata = {}
... |
from django.shortcuts import render
from django.http import JsonResponse
from rest_framework.response import Response
from rest_framework.decorators import api_view, permission_classes
from users.serializers import *
from users.models import *
# Create your views here.
from rest_framework import status
from django.cont... |
import datetime
from asyncio.events import AbstractEventLoop
from typing import Generator, List, Union
from ..exceptions import VoyagerException
from .base import BaseResource
__all__ = [
'FireballResource',
]
class FireballRecord(object):
__slots__ = [
'_fc',
'_date',
'_lat',
... |
from vyper import ast
from vyper.exceptions import (
ConstancyViolationException,
FunctionDeclarationException,
StructureException,
TypeMismatchException,
VariableDeclarationException,
)
from vyper.parser.lll_node import (
LLLnode,
)
from vyper.parser.parser_utils import (
getpos,
pack_a... |
import configargparse
import os, time, datetime
import torch
import numpy as np
import dataio
from torch.utils.data import DataLoader
from srns import *
import util
p = configargparse.ArgumentParser()
p.add('-c', '--config_filepath', required=False, is_config_file=True, help='Path to config file.')
# Note: in contr... |
import pathlib
import os
import sys
from time import sleep
import shutil
from selenium import webdriver
from selenium.webdriver.common.by import By
BASE_URL = 'https://transparencia.mpms.mp.br/QvAJAXZfc/opendoc.htm?document=portaltransparencia%5Cportaltransparencia.qvw&lang=pt-BR&host=QVS%40srv-1645&anonymous=true'
M... |
# https://deeplearningcourses.com/c/advanced-computer-vision
# https://www.udemy.com/advanced-computer-vision
from __future__ import print_function, division
from builtins import range, input
# Note: you may need to update your version of future
# sudo pip install -U future
# Let's go up to the end of the first conv ... |
#!/usr/bin/env python
"""
Script to migrate a group, along with its classes and
parameters (but not nodes, parents, or child groups)
from Puppet Enterprise Console (or Dashboard?) to
NodeMeister.
Since Console/Dashboard doesn't have a real API, this
directly accesses the MySQL database.
"""
import MySQLdb
import MyS... |
#!/usr/bin/python3
# File: leds.py
#
# Methods:
# leds.all_on(egpg) turn two red blinker leds on and two "eyes" on bright white
# leds.all_off(egpg) turn two red blinker leds off and two "eyes" off
# wifi_blinker_on(egpg,color=RED) make wifi led blink on/off,on/off...
# pass colors as leds.YELLOW or l... |
import os
import numpy as np
import random
def print_file(str_, save_file_path=None):
print(str_)
if save_file_path != None:
f = open(save_file_path, 'a')
print(str_, file=f)
class Metrictor_PPI:
def __init__(self, pre_y, truth_y, is_binary=False):
self.TP = 0
self.FP = 0
... |
""" run the comparisons using asyncio """
import asyncio
import asks
import regex
import settingsmay2021 as settings
import aiohttp
import langdetect
import os
import schedule
from time import sleep
from flask_bootstrap import Bootstrap
from collections import OrderedDict
from flask_wtf import FlaskForm
from wtforms i... |
"""Tests for the teams module."""
import dateutil.parser
import functools
import json
from auvsi_suas.models.aerial_position import AerialPosition
from auvsi_suas.models.gps_position import GpsPosition
from auvsi_suas.models.mission_config import MissionConfig
from auvsi_suas.models.takeoff_or_landing_event import Tak... |
'''Functions for loading dynamic libraries.
These extend and correct ctypes functions.
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id: $'
import os
import re
import sys
import ctypes
import ctypes.util
class LibraryLoader(object):
def load_library(self, *names, **kwargs):
'''Find and load a ... |
import os
import pytest
from ilexconf import Config, from_json, to_json
# from ilexconf.tests.debug import debug
@pytest.fixture(scope="module")
def resulting_dict():
return {
"database": {
"connection": {
"host": "test.local",
"port": 8080,
"u... |
#------------------------------------------------------------------------------
# Copyright (c) 2013, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-------------------------------------------------... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Looking up addresses for function names / symbols, and
vice-versa.
Uses IDA when available if there isn't sufficient symbol
information available.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __fu... |
# From GRAN repo, with minor changes
###############################################################################
#
# Some code is adapted from https://github.com/JiaxuanYou/graph-generation
#
###############################################################################
import os
import torch
import pickle
import... |
"""
stategy
---------
"""
# use future imports for python 3.x forward compatibility
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
# other imports
import pandas as pd
import matplotlib.pyplot as plt
import datetime
f... |
# Arguments are:
# 1. Working directory.
# 2. Rope folder
import io
import sys
import json
import traceback
import rope
from rope.base import libutils
from rope.refactor.rename import Rename
from rope.refactor.extract import ExtractMethod, ExtractVariable
import rope.base.project
import rope.base.taskhandle
WORKSPAC... |
from ..abstract import Processor, SequentialProcessor
from .. import processors as pr
from .detection import HaarCascadeFrontalFace
from .keypoints import FaceKeypointNet2D32
import numpy as np
FACE_KEYPOINTNET3D = np.array([
[-220, 678, 1138], # left--center-eye
[+220, 678, 1138], # right-center-eye
[... |
#!/usr/bin/env python
import argparse
import math
from collections import namedtuple
from time import sleep
Coordinates = namedtuple('Coordinates', 'x y')
class Ship:
def __init__(self, x, y, heading: int):
self.x = x
self.y = y
self.heading = heading
def __repr__(self):
x =... |
# -*- coding: utf-8 -*-
"""Classes wrapping ASGI requests in a nicer interface"""
import http.cookies
import re
from typing import Tuple
import urllib.parse
class FormDataError(Exception):
"""Represents an error handling form data"""
pass
class RequestData:
"""Simple object container for attaching data... |
#!/usr/bin/env python3
#
# id3v1.py
# From the stagger project: http://code.google.com/p/stagger/
#
# Copyright (c) 2009-2011 <NAME> <<EMAIL>>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#... |
try:
import math
import sys
from PyQt4 import QtGui, QtCore
from random import randint
from time import sleep
except ImportError as ie:
print (str(ie))
# Catched if any packages are missing
missing = str(ie).split("named")[1]
print("Software needs %s installed\nPlease run pip instal... |
"""
Python enumerations for use with Sublime API methods.
In addition to the standard behavior,
these enumerations' constructors accept the name of an enumerated value as a string:
.. code-block:: python
>>> PointClass(sublime.DIALOG_YES)
<DialogResult.YES: 1>
>>> PointClass("YES")
<DialogResult.YES: 1>
... |
import curses
import os
import stat
import random
import sys
from pathlib import PosixPath
from subprocess import check_output, check_call, call, CalledProcessError
from typing import List, Iterator, Tuple
from .ldm_gtk import LdmGtk
def get_cmd(monitor_name: str) -> List[str]:
"""
The system command which ... |
import os
import sublime
import linecache
from .core.panels import ensure_panel
from .core.protocol import Request, Point
from .core.registry import get_position
from .core.registry import LspTextCommand
from .core.registry import windows
from .core.settings import PLUGIN_NAME
from .core.settings import userprefs
from... |
# Author: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
import os.path as op
import numpy as np
from numpy.testing import assert_allclose, assert_equal
import pytest
from mne.io import read_raw_artemis123
from mne.io.tests.test_raw import _test_raw_reader
from mne.datasets import testing
from mne.io.artemis123.utils... |
# -*- python -*-
#
# spatial_image: spatial nd images
#
# Copyright 2006 INRIA - CIRAD - INRA
#
# File author(s): <NAME> <<EMAIL>>
#
# Distributed under the Cecill-C License.
# See accompanying file LICENSE.txt or copy at
# http://www.cecill.info/licences/Licence_CeCILL-C_V1-en.h... |
def make_empty(seq):
"""
>>> make_empty([1, 2, 3, 4])
[]
>>> make_empty(('a', 'b', 'c'))
()
>>> make_empty("No, not me!")
''
"""
if type(seq) == list:
return list()
elif type(seq) == tuple:
return tuple()
elif type(seq) == str:
return str()... |
from flask import Flask, jsonify, request
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.sql import func
from flask_cors import CORS
from jsonschema import validate
from geopy import Point
from geopy.distance import vincenty
import cloudinary
import cloudinary.uploader
import cloudinary.api
from datetime i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.