code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from enum import auto
import pytest
from napari.util.misc import callsignature, StringEnum
def test_callsignature():
# no arguments
assert str(callsignature(lambda: None)) == '()'
# one arg
assert str(callsignature(lambda a: None)) == '(a)'
# multiple args
assert str(callsignature(lambda a,... | [
"napari.util.misc.StringEnum",
"enum.auto",
"napari.util.misc.callsignature",
"pytest.raises"
] | [((2629, 2677), 'napari.util.misc.StringEnum', 'StringEnum', (['"""Animal"""', '"""AARDVARK BUFFALO CAT DOG"""'], {}), "('Animal', 'AARDVARK BUFFALO CAT DOG')\n", (2639, 2677), False, 'from napari.util.misc import callsignature, StringEnum\n'), ((1942, 1948), 'enum.auto', 'auto', ([], {}), '()\n', (1946, 1948), False, ... |
import tempfile
import os
from datetime import datetime, timedelta
import sqlite3
import mock
import xwavecal.database as db
from xwavecal.tests.utils import FakeImage
def test_format_db_info():
data = FakeImage()
fmt = '%Y-%m-%dT%H:%M:%S.%f'
db_info = db.format_db_info(data, fmt)
fib0, fib1, fib2 = ... | [
"tempfile.TemporaryDirectory",
"mock.patch",
"sqlite3.connect",
"xwavecal.database.query_db_for_nearest",
"xwavecal.database.format_db_info",
"os.path.join",
"datetime.datetime.now",
"xwavecal.tests.utils.FakeImage",
"datetime.timedelta",
"xwavecal.database.add_data_to_db"
] | [((1036, 1105), 'mock.patch', 'mock.patch', (['"""xwavecal.database.query_db_for_match"""'], {'return_value': 'None'}), "('xwavecal.database.query_db_for_match', return_value=None)\n", (1046, 1105), False, 'import mock\n'), ((209, 220), 'xwavecal.tests.utils.FakeImage', 'FakeImage', ([], {}), '()\n', (218, 220), False,... |
import boto3
import random
import string
import uuid
import httplib
import urlparse
import json
import base64
import hashlib
"""
If included in a Cloudformation build as a CustomResource, generate a random string of length
given by the 'length' parameter.
By default the character set used is upper and lowercase ascii ... | [
"boto3.client",
"httplib.HTTPSConnection",
"json.dumps",
"hashlib.sha224",
"uuid.uuid4",
"urlparse.urlparse"
] | [((493, 511), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (505, 511), False, 'import boto3\n'), ((779, 820), 'urlparse.urlparse', 'urlparse.urlparse', (["request['ResponseURL']"], {}), "(request['ResponseURL'])\n", (796, 820), False, 'import urlparse\n'), ((836, 856), 'json.dumps', 'json.dumps', (['... |
import abc
import tensorflow as tf
import numpy as np
from typing import List, Union, Tuple
from pathlib import Path
# Note: this library was used in a previous version which we omitted in favour of plain Keras Models.
# We still use some of the static methods, though.
class NeuralNet:
# General class defining us... | [
"tensorflow.keras.layers.Activation",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.layers.Dropout",
"tensorflow.keras.regularizers.L1L2"
] | [((3997, 4035), 'tensorflow.keras.layers.Activation', 'tf.keras.layers.Activation', (['activation'], {}), '(activation)\n', (4023, 4035), True, 'import tensorflow as tf\n'), ((4959, 5020), 'tensorflow.keras.layers.Dense', 'tf.keras.layers.Dense', (['layer_dims[0]'], {'input_shape': 'input_shape'}), '(layer_dims[0], inp... |
from plantcv.plantcv import fatal_error
from plantcv.plantcv import params
import os
from spectral import *
from osgeo import gdal
from osgeo.gdalconst import *
import numpy as np
def reference2array(path):
"""this function allows you read in hyperspectral reference in raw format and returns it as array that is av... | [
"osgeo.gdal.Open",
"numpy.reshape",
"os.path.isfile"
] | [((991, 1019), 'osgeo.gdal.Open', 'gdal.Open', (['path', 'GA_ReadOnly'], {}), '(path, GA_ReadOnly)\n', (1000, 1019), False, 'from osgeo import gdal\n'), ((2495, 2533), 'numpy.reshape', 'np.reshape', (['output_list', '(bands, cols)'], {}), '(output_list, (bands, cols))\n', (2505, 2533), True, 'import numpy as np\n'), ((... |
import torch
import torch.nn as nn
import torchvision
class AptosModel(nn.Module):
def __init__(self,
arch:str='resnet50',
z_dims:int=512,
nb_classes:int=5,
freeze:bool=True,
drop:float=0.5):
super(AptosModel, self)._... | [
"torch.nn.Sequential",
"torch.no_grad",
"torch.nn.Dropout",
"torch.nn.Linear"
] | [((645, 669), 'torch.nn.Sequential', 'nn.Sequential', (['*backbone'], {}), '(*backbone)\n', (658, 669), True, 'import torch.nn as nn\n'), ((780, 810), 'torch.nn.Linear', 'nn.Linear', (['in_features', 'z_dims'], {}), '(in_features, z_dims)\n', (789, 810), True, 'import torch.nn as nn\n'), ((824, 840), 'torch.nn.Dropout'... |
# Copyright 2012 Burke Software and Consulting LLC
# Author <NAME> <<EMAIL>>
#
# 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 3 of the License, or
# (at your optio... | [
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.BooleanField"
] | [((964, 1077), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)', 'unique': '(True)', 'help_text': '"""Google Group name, do not include @yourdomain.com"""'}), "(max_length=255, unique=True, help_text=\n 'Google Group name, do not include @yourdomain.com')\n", (980, 1077), False, 'from dj... |
"""
AutoCal
Automatic analysis of Calcium imaging data
<NAME> 2017
<EMAIL>
"""
def savitzky_golay(y, window_size, order, deriv=0, rate=1):
"""
Smooth (and optionally differentiate) data with a Savitzky-Golay filter.
Modified from Scipy cookbook by <NAME>
The Savitzky-Golay filter removes high frequ... | [
"numpy.abs",
"numpy.convolve",
"numpy.linalg.pinv",
"math.factorial",
"numpy.concatenate"
] | [((2257, 2299), 'numpy.concatenate', 'np.concatenate', (['(first_vals, y, last_vals)'], {}), '((first_vals, y, last_vals))\n', (2271, 2299), True, 'import numpy as np\n'), ((2348, 2385), 'numpy.convolve', 'np.convolve', (['m[::-1]', 'y'], {'mode': '"""valid"""'}), "(m[::-1], y, mode='valid')\n", (2359, 2385), True, 'im... |
"""Microscope API specific modules."""
import asyncio
import json
import logging
import voluptuous as vol
from camacq.const import (
COMMAND_EVENT,
IMAGE_EVENT,
START_COMMAND_EVENT,
STOP_COMMAND_EVENT,
)
from camacq.event import Event
from camacq.helper import BASE_ACTION_SCHEMA
_LOGGER = logging.get... | [
"logging.getLogger",
"json.loads",
"asyncio.wait",
"voluptuous.Schema",
"voluptuous.Invalid",
"camacq.helper.BASE_ACTION_SCHEMA.extend",
"voluptuous.Coerce"
] | [((309, 336), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (326, 336), False, 'import logging\n'), ((1054, 1112), 'camacq.helper.BASE_ACTION_SCHEMA.extend', 'BASE_ACTION_SCHEMA.extend', (["{'commands': validate_commands}"], {}), "({'commands': validate_commands})\n", (1079, 1112), False... |
# wriiten in python 3.7.6
# Input: path_directory line 32
# Run the bash script first to generate pcd files: ./pcd_bash.sh /home/batool/Desktop/infocom/bag_files
import bagpy
import os,glob
from bagpy import bagreader
import pandas as pd
import numpy as np
import csv
def show_all_files_in_directory(input_path,exten... | [
"os.path.exists",
"os.makedirs",
"csv.writer",
"os.path.join",
"os.walk"
] | [((449, 468), 'os.walk', 'os.walk', (['input_path'], {}), '(input_path)\n', (456, 468), False, 'import os, glob\n'), ((651, 675), 'os.path.exists', 'os.path.exists', (['dir_path'], {}), '(dir_path)\n', (665, 675), False, 'import os, glob\n'), ((715, 736), 'os.makedirs', 'os.makedirs', (['dir_path'], {}), '(dir_path)\n'... |
# Generated by Django 3.0.8 on 2020-08-16 21:44
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('inventories', '0004_auto_20200801_1826'),
]
operations = [
migrations.RemoveField(
model_name='... | [
"django.db.migrations.DeleteModel",
"django.db.migrations.RemoveField",
"django.db.models.ForeignKey"
] | [((272, 340), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""inventoryitem"""', 'name': '"""inventory"""'}), "(model_name='inventoryitem', name='inventory')\n", (294, 340), False, 'from django.db import migrations, models\n'), ((385, 445), 'django.db.migrations.RemoveField', 'migr... |
from django.shortcuts import redirect, render
from django.contrib.auth.decorators import login_required
from django.views.generic import ListView
from .models import TodoItem
# @login_required()
# def home(request):
# context = {
# "todo_items": TodoItem.objects.all(),
# }
# return render(request,... | [
"django.shortcuts.redirect",
"django.contrib.auth.decorators.login_required"
] | [((616, 632), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {}), '()\n', (630, 632), False, 'from django.contrib.auth.decorators import login_required\n'), ((851, 867), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {}), '()\n', (865, 867), False, 'from django.contrib.... |
#!/usr/bin/env python3
# Make sure you have python3 installed.
# Ensure that the json_formatter is kept in Tools with this script.
# They must be in the same folder!
# For Windows:
# Using command prompt type "python material_ammo_update.py"
# For Max OS X or Linux:
# Swap any "\\" with "/", then run the script as in ... | [
"logging.basicConfig",
"base_script.change_file",
"logging.info",
"base_script.load_json"
] | [((393, 470), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""material_ammo_update.log"""', 'level': 'logging.DEBUG'}), "(filename='material_ammo_update.log', level=logging.DEBUG)\n", (412, 470), False, 'import logging\n'), ((471, 503), 'logging.info', 'logging.info', (['"""Started logging."""'], {}... |
"""Some utility functions for working with TfJobs."""
import datetime
import logging
import time
from kubernetes import client as k8s_client
from kubeflow.testing import util
GROUP = "argoproj.io"
VERSION = "v1alpha1"
PLURAL = "workflows"
KIND = "Workflow"
def log_status(workflow):
"""A callback to use with wait... | [
"kubernetes.client.CustomObjectsApi",
"time.sleep",
"datetime.datetime.now",
"datetime.timedelta",
"logging.info"
] | [((340, 492), 'logging.info', 'logging.info', (['"""Workflow %s in namespace %s; phase=%s"""', "workflow['metadata']['name']", "workflow['metadata']['namespace']", "workflow['status']['phase']"], {}), "('Workflow %s in namespace %s; phase=%s', workflow['metadata'][\n 'name'], workflow['metadata']['namespace'], workf... |
from rest_framework import serializers
from .models import Post, Vote
# we use serializer to show/get data to/from api as our model and json format
class PostSerializer(serializers.ModelSerializer):
# here we are giving this fields readonly mode
poster = serializers.ReadOnlyField(source='poster.username')
... | [
"rest_framework.serializers.SerializerMethodField",
"rest_framework.serializers.ReadOnlyField"
] | [((265, 316), 'rest_framework.serializers.ReadOnlyField', 'serializers.ReadOnlyField', ([], {'source': '"""poster.username"""'}), "(source='poster.username')\n", (290, 316), False, 'from rest_framework import serializers\n'), ((333, 378), 'rest_framework.serializers.ReadOnlyField', 'serializers.ReadOnlyField', ([], {'s... |
#!/usr/bin/env python
"""Extracts Simon Property Group property information from its 10-K filings
Sample usage::
$ sorno_extract_spg_properties.py spg_10-k.html
If you get UnicodeEncodingError, you should prefix your command with
"PYTHONIOENCODING=UTF-8". E.g::
$ PYTHONIOENCODING=UTF-8 sorno_extract_spg_pro... | [
"argparse.ArgumentParser"
] | [((1990, 2097), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'description', 'formatter_class': 'argparse.RawDescriptionHelpFormatter'}), '(description=description, formatter_class=argparse.\n RawDescriptionHelpFormatter)\n', (2013, 2097), False, 'import argparse\n')] |
from django.shortcuts import get_object_or_404, redirect, render
from django.template import Context, RequestContext
from django import forms
from django.db.models import Count
try:
# py3
from urllib.parse import urlencode
except ImportError:
# py2
from urllib import urlencode
from astrometry.net.mode... | [
"django.shortcuts.render",
"django.db.models.Count",
"astrometry.net.util.get_page",
"urllib.urlencode",
"django.forms.TextInput"
] | [((1006, 1043), 'astrometry.net.util.get_page', 'get_page', (['images', '(3 * 10)', 'page_number'], {}), '(images, 3 * 10, page_number)\n', (1014, 1043), False, 'from astrometry.net.util import get_page, get_session_form\n'), ((1180, 1227), 'django.shortcuts.render', 'render', (['req', '"""search/user_images.html"""', ... |
#!/usr/bin/env python3
##########################################################################################
# General Information
##########################################################################################
#
# Script created By <NAME> March 3, 2022
#
# Version 1.0 - Initial Creation of Script.
# V... | [
"os.path.exists",
"requests.auth.HTTPBasicAuth",
"requests.Session",
"re.match",
"time.sleep",
"requests.packages.urllib3.util.retry.Retry",
"datetime.datetime.now",
"pandas.DataFrame",
"os.system",
"pandas.ExcelWriter"
] | [((9628, 9809), 'requests.packages.urllib3.util.retry.Retry', 'Retry', ([], {'total': '(10)', 'backoff_factor': '(1)', 'status_forcelist': '[204, 413, 429, 500, 502, 503, 504]', 'allowed_methods': "['HEAD', 'GET', 'PUT', 'DELETE', 'OPTIONS', 'TRACE', 'POST', 'HTTP']"}), "(total=10, backoff_factor=1, status_forcelist=[2... |
from invoke import Collection
from . import tasks
data_ns = Collection.from_module(tasks)
| [
"invoke.Collection.from_module"
] | [((62, 91), 'invoke.Collection.from_module', 'Collection.from_module', (['tasks'], {}), '(tasks)\n', (84, 91), False, 'from invoke import Collection\n')] |
# Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import tempfile
import mmcv
import numpy as np
import pytest
from mmtrack.datasets import DATASETS as DATASETS
PREFIX = osp.join(osp.dirname(__file__), '../../data')
LASOT_ANN_PATH = f'{PREFIX}/demo_sot_data/lasot'
@pytest.mark.parametrize('data... | [
"tempfile.TemporaryDirectory",
"os.path.join",
"os.path.dirname",
"pytest.mark.parametrize",
"os.path.isdir",
"mmtrack.datasets.DATASETS.get"
] | [((291, 379), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""dataset"""', "['SOTTestDataset', 'LaSOTDataset', 'VOTDataset']"], {}), "('dataset', ['SOTTestDataset', 'LaSOTDataset',\n 'VOTDataset'])\n", (314, 379), False, 'import pytest\n'), ((3454, 3529), 'pytest.mark.parametrize', 'pytest.mark.parametri... |
from trees import __version__
from trees.tree import BinaryTree, Node, BinarySearchTree
def test_empty_tree():
tree = BinarySearchTree()
actual = tree.root
expected = None
assert actual == expected
def test_tree_single_node():
tree = BinarySearchTree()
tree.add('A')
actual = tree.root.v... | [
"trees.tree.BinarySearchTree"
] | [((125, 143), 'trees.tree.BinarySearchTree', 'BinarySearchTree', ([], {}), '()\n', (141, 143), False, 'from trees.tree import BinaryTree, Node, BinarySearchTree\n'), ((259, 277), 'trees.tree.BinarySearchTree', 'BinarySearchTree', ([], {}), '()\n', (275, 277), False, 'from trees.tree import BinaryTree, Node, BinarySearc... |
import alf
from alf.algorithms.actor_critic_algorithm import ActorCriticAlgorithm
from alf.algorithms.trac_algorithm import TracAlgorithm
from alf.algorithms.data_transformer import RewardScaling
from alf.environments import suite_simple
from alf.environments.bipolar_chains import BipolarChains
from alf.environments.s... | [
"alf.config",
"alf.optimizers.Adam"
] | [((670, 796), 'alf.config', 'alf.config', (['"""create_environment"""'], {'env_name': 'sweep.CARTPOLE_SWINGUP[0]', 'env_load_fn': 'bsuite.load', 'num_parallel_environments': '(5)'}), "('create_environment', env_name=sweep.CARTPOLE_SWINGUP[0],\n env_load_fn=bsuite.load, num_parallel_environments=5)\n", (680, 796), Fa... |
# Generated by Django 3.1.4 on 2021-03-23 11:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ViloSkyApp', '0001_initial'),
]
operations = [
migrations.RenameModel(
old_name='RadioButtonsAdminInput',
new_name='... | [
"django.db.migrations.RenameModel",
"django.db.models.CharField"
] | [((227, 323), 'django.db.migrations.RenameModel', 'migrations.RenameModel', ([], {'old_name': '"""RadioButtonsAdminInput"""', 'new_name': '"""MultiselectAdminInput"""'}), "(old_name='RadioButtonsAdminInput', new_name=\n 'MultiselectAdminInput')\n", (249, 323), False, 'from django.db import migrations, models\n'), ((... |
# Generated by Django 3.1.7 on 2021-02-27 18:12
from django.db import migrations, models
import django.utils.timezone
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='SimpleModel',
fiel... | [
"django.db.models.ManyToManyField",
"django.db.models.JSONField",
"django.db.models.AutoField",
"django.db.models.PositiveIntegerField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((348, 441), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (364, 441), False, 'from django.db import migrations, models\... |
# Implementation based on the following publication of <NAME>
# Nonparametric Bayesian inference of the microcanonical stochastic block model
# full version with scipy
import math
from scipy.special import binom
from .peixotos_flat_sbm_full import ModelLikelihoodOfFlatMicrocanonicalDegreeCorrectedSbm
from .peixotos... | [
"math.factorial",
"scipy.special.binom"
] | [((4522, 4560), 'math.factorial', 'math.factorial', (['number_of_blocks_below'], {}), '(number_of_blocks_below)\n', (4536, 4560), False, 'import math\n'), ((5275, 5298), 'scipy.special.binom', 'binom', (['*binomial_values'], {}), '(*binomial_values)\n', (5280, 5298), False, 'from scipy.special import binom\n'), ((8882,... |
from dataclasses import dataclass
import datetime
import logging
import os
import sqlite3
from typing import List, Tuple
sqlite3.paramstyle = "named"
DB_NAME = os.path.join("data", "inlet_data.db")
def _table_name(inlet_name: str) -> str:
return inlet_name.lower().replace(" ", "_")
@dataclass(frozen=True)
cla... | [
"sqlite3.connect",
"dataclasses.dataclass",
"os.path.join",
"logging.exception",
"datetime.datetime.fromisoformat"
] | [((162, 199), 'os.path.join', 'os.path.join', (['"""data"""', '"""inlet_data.db"""'], {}), "('data', 'inlet_data.db')\n", (174, 199), False, 'import os\n'), ((294, 316), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (303, 316), False, 'from dataclasses import dataclass\n'), ((1661... |
import torch
import math
from data import pad, NODE_TYPE
from dgl.nn.pytorch import edge_softmax
from torch import nn
from torch.nn.utils.rnn import pack_padded_sequence,pad_packed_sequence
import torch.utils.data
def replace_ent(x, ent, V, emb):
# replace the entity
mask = (x>=V).float()
_x = emb((x*(1.-m... | [
"torch.nn.Dropout",
"torch.LongTensor",
"math.sqrt",
"torch.exp",
"torch.nn.init.xavier_normal_",
"torch.softmax",
"torch.arange",
"torch.nn.LSTM",
"torch.nn.LayerNorm",
"torch.matmul",
"dgl.nn.pytorch.edge_softmax",
"torch.nn.PReLU",
"torch.nn.utils.rnn.pack_padded_sequence",
"torch.cat",... | [((1221, 1236), 'torch.nn.Dropout', 'nn.Dropout', (['(0.1)'], {}), '(0.1)\n', (1231, 1236), False, 'from torch import nn\n'), ((1255, 1329), 'torch.nn.Linear', 'nn.Linear', (['qninp', '(nhead * head_dim)'], {'bias': "(True if mode == 'copy' else False)"}), "(qninp, nhead * head_dim, bias=True if mode == 'copy' else Fal... |
import os
from decouple import config, Csv
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = config('SECRET_KEY')
DEBUG = config('DEBUG', cast=bool)
ALLOWED_HOSTS = config('ALLOWED_HOSTS', cast=Csv())
SOLITONEMS_APPS = [
'recruitment',
'employees',
'payroll',
'leave'... | [
"os.path.abspath",
"decouple.config",
"os.path.join",
"decouple.Csv"
] | [((129, 149), 'decouple.config', 'config', (['"""SECRET_KEY"""'], {}), "('SECRET_KEY')\n", (135, 149), False, 'from decouple import config, Csv\n'), ((158, 184), 'decouple.config', 'config', (['"""DEBUG"""'], {'cast': 'bool'}), "('DEBUG', cast=bool)\n", (164, 184), False, 'from decouple import config, Csv\n'), ((3137, ... |
import pandas as pd
t1 = 5
t2 = 10
data = pd.DataFrame({"end_t": [0,1,6,0,7,11],
"start_t": [3,7,12,15,8,13]})
out = data.loc[((data["end_t"] > t1) & (t1 > data["start_t"])) |
((data["start_t"] < t2) & (t2 < data["end_t"])) |
((data["start_t"] >= t1) & (data... | [
"pandas.DataFrame"
] | [((42, 120), 'pandas.DataFrame', 'pd.DataFrame', (["{'end_t': [0, 1, 6, 0, 7, 11], 'start_t': [3, 7, 12, 15, 8, 13]}"], {}), "({'end_t': [0, 1, 6, 0, 7, 11], 'start_t': [3, 7, 12, 15, 8, 13]})\n", (54, 120), True, 'import pandas as pd\n')] |
from flask import Flask
from datetime import datetime
from flask import current_app
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World! " + str(datetime.now())
@app.route("/applicationpath")
def applicationPath():
return current_app.root_path
| [
"datetime.datetime.now",
"flask.Flask"
] | [((91, 106), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (96, 106), False, 'from flask import Flask\n'), ((170, 184), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (182, 184), False, 'from datetime import datetime\n')] |
from src.controllers.devicesController.models.deviceInitializationEntity import DeviceInitializationEntity
from src.devices.lamp.lampIO import LampIO
from src.service.firebase.Ifirebase import IFirebase
from src import app
from flask import request
import json
class DevicesController:
def __init__(self, home_name... | [
"src.app.add_url_rule",
"json.dumps",
"src.controllers.devicesController.models.deviceInitializationEntity.DeviceInitializationEntity.fromJson"
] | [((581, 627), 'src.controllers.devicesController.models.deviceInitializationEntity.DeviceInitializationEntity.fromJson', 'DeviceInitializationEntity.fromJson', (['body_json'], {}), '(body_json)\n', (616, 627), False, 'from src.controllers.devicesController.models.deviceInitializationEntity import DeviceInitializationEn... |
import requests
import os
from verify_proxies import VerifyProxies
from test_proxies import TestProxies
files = [
(
"./proxies/spys-anonymous-proxy-list.csv",
"./verified_proxies/spys-anonymous-proxy-list_verified.csv"
),
]
verify = False
test = True
for proxy_file in files:
verifyProxies... | [
"verify_proxies.VerifyProxies",
"test_proxies.TestProxies"
] | [((323, 366), 'verify_proxies.VerifyProxies', 'VerifyProxies', (['proxy_file[0]', 'proxy_file[1]'], {}), '(proxy_file[0], proxy_file[1])\n', (336, 366), False, 'from verify_proxies import VerifyProxies\n'), ((554, 574), 'test_proxies.TestProxies', 'TestProxies', (['proxies'], {}), '(proxies)\n', (565, 574), False, 'fro... |
from inflection import (pluralize, underscore)
from invoiced import util
import json
import re
class InvoicedObject(dict):
def __init__(self, client, id=None, values={}):
super(InvoicedObject, self).__init__()
self._client = client
# generate endpoint based on class name
class_n... | [
"json.dumps",
"inflection.underscore",
"invoiced.util.convert_to_object",
"invoiced.util.build_objects",
"re.search"
] | [((1177, 1223), 'invoiced.util.convert_to_object', 'util.convert_to_object', (['self', "response['body']"], {}), "(self, response['body'])\n", (1199, 1223), False, 'from invoiced import util\n'), ((2954, 2996), 'json.dumps', 'json.dumps', (['self'], {'sort_keys': '(True)', 'indent': '(2)'}), '(self, sort_keys=True, ind... |
import numpy as np
import cv2
class Ellipse():
def __init__(self):
"""
A partial ellipse
"""
startAngle = np.random.rand()*360.0
arclength = 60 + np.sum(np.random.rand(2))*140.0
direction = np.random.choice([-1, 1])
self._shape = 'ellipse'
self... | [
"numpy.random.rand",
"numpy.random.choice",
"cv2.imshow",
"numpy.zeros",
"numpy.random.randint",
"cv2.destroyAllWindows",
"cv2.waitKey"
] | [((3370, 3403), 'numpy.zeros', 'np.zeros', (['(500, 500, 3)', 'np.uint8'], {}), '((500, 500, 3), np.uint8)\n', (3378, 3403), True, 'import numpy as np\n'), ((4008, 4031), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (4029, 4031), False, 'import cv2\n'), ((245, 270), 'numpy.random.choice', 'np.ran... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from io import StringIO
import sys, os, signal, unittest, hashlib
# Import the student program and optionally the reference program here.
# import reference_program as my
# import student_program as your
# The score of each testcase. Should be equal to (100 / number of ... | [
"signal.signal",
"os._exit",
"signal.alarm",
"unittest.main",
"io.StringIO",
"hashlib.sha1"
] | [((1065, 1079), 'hashlib.sha1', 'hashlib.sha1', ([], {}), '()\n', (1077, 1079), False, 'import sys, os, signal, unittest, hashlib\n'), ((3055, 3105), 'unittest.main', 'unittest.main', ([], {'exit': '(False)', 'testRunner': 'MyTestRunner'}), '(exit=False, testRunner=MyTestRunner)\n', (3068, 3105), False, 'import sys, os... |
import os
import sys
import numpy as np
from glob import glob
from skimage.io import imread
from skimage.transform import resize
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
import tensorflow_addons as tfa
from tensorflow.keras.utils import to_categorical
from tensorflow.ke... | [
"tensorflow.keras.losses.MeanSquaredError",
"numpy.array_split",
"tensorflow.keras.preprocessing.image.array_to_img",
"tensorflow.keras.optimizers.Adam",
"numpy.concatenate",
"tensorflow.ones_like",
"tensorflow.zeros_like",
"numpy.load"
] | [((5504, 5535), 'tensorflow.keras.losses.MeanSquaredError', 'keras.losses.MeanSquaredError', ([], {}), '()\n', (5533, 5535), False, 'from tensorflow import keras\n'), ((4116, 4148), 'numpy.array_split', 'np.array_split', (['x', 'nside'], {'axis': '(1)'}), '(x, nside, axis=1)\n', (4130, 4148), True, 'import numpy as np\... |
"""Config flow to configure the Open-Meteo integration."""
from __future__ import annotations
from typing import Any
import voluptuous as vol
from homeassistant.components.zone import DOMAIN as ZONE_DOMAIN
from homeassistant.config_entries import ConfigFlow
from homeassistant.const import CONF_ZONE
from homeassistan... | [
"voluptuous.Required",
"homeassistant.helpers.selector.selector"
] | [((1239, 1262), 'voluptuous.Required', 'vol.Required', (['CONF_ZONE'], {}), '(CONF_ZONE)\n', (1251, 1262), True, 'import voluptuous as vol\n'), ((1264, 1309), 'homeassistant.helpers.selector.selector', 'selector', (["{'entity': {'domain': ZONE_DOMAIN}}"], {}), "({'entity': {'domain': ZONE_DOMAIN}})\n", (1272, 1309), Fa... |
#
# Copyright (c) 2021 Adobe Systems Incorporated. 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 a... | [
"lol.model.utils.LinuxFeatureExtraction",
"pandas.read_csv",
"optparse.OptionParser",
"lol.model.utils.WindowsFeatureExtraction",
"sys.stdout.flush",
"sys.path.append",
"sys.stdout.write"
] | [((629, 648), 'sys.path.append', 'sys.path.append', (['""""""'], {}), "('')\n", (644, 648), False, 'import sys\n'), ((3968, 3991), 'optparse.OptionParser', 'optparse.OptionParser', ([], {}), '()\n', (3989, 3991), False, 'import optparse\n'), ((2031, 2055), 'lol.model.utils.LinuxFeatureExtraction', 'LinuxFeatureExtracti... |
# based on DeepMind's train.py
import tensorflow as tf
import repeat_copy
from rl_dnc.model.dnc_wrapper import DNCWrapper
FLAGS = tf.flags.FLAGS
# Task parameters
tf.flags.DEFINE_integer("batch_size", 16, "Batch size for training.")
tf.flags.DEFINE_integer("num_bits", 4, "Dimensionality of each vector to copy")
tf.... | [
"tensorflow.flags.DEFINE_string",
"tensorflow.logging.info",
"repeat_copy.RepeatCopy",
"tensorflow.Session",
"tensorflow.logging.set_verbosity",
"rl_dnc.model.dnc_wrapper.DNCWrapper",
"tensorflow.flags.DEFINE_integer",
"tensorflow.app.run"
] | [((167, 236), 'tensorflow.flags.DEFINE_integer', 'tf.flags.DEFINE_integer', (['"""batch_size"""', '(16)', '"""Batch size for training."""'], {}), "('batch_size', 16, 'Batch size for training.')\n", (190, 236), True, 'import tensorflow as tf\n'), ((237, 316), 'tensorflow.flags.DEFINE_integer', 'tf.flags.DEFINE_integer',... |
from typing import List, Optional
import numpy as np
import pandas as pd
from temporis.dataset.ts_dataset import AbstractTimeSeriesDataset
def variance_information(
dataset: AbstractTimeSeriesDataset,
features: Optional[List[str]] = None,
) -> pd.DataFrame:
"""
Return mean and max null proportion for... | [
"pandas.DataFrame",
"numpy.mean",
"numpy.max",
"numpy.min"
] | [((1622, 1695), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {'columns': "['Feature', 'Min std', 'Mean std', 'Max std']"}), "(data, columns=['Feature', 'Min std', 'Mean std', 'Max std'])\n", (1634, 1695), True, 'import pandas as pd\n'), ((1439, 1467), 'numpy.min', 'np.min', (['std_per_life[column]'], {}), '(std_per_l... |
"""
Leer los datos del archivo /M1/CLASE_03/Data/sales_data_sample_excercise.csv
Este archivo tiene algunos datos numéricos y otros de tipo cadena de caracteres.
Las columnas son:
ORDERNUMBER: int, id de la orden
SALES: float, monto abonado
MONTH_ID: int, mes
YEAR_ID: int, año
PRODUCTLINE: str, producto
COUNTRY... | [
"seaborn.set",
"numpy.median",
"numpy.random.default_rng",
"seaborn.distplot",
"seaborn.set_style",
"numpy.genfromtxt"
] | [((712, 776), 'numpy.genfromtxt', 'np.genfromtxt', (['file'], {'delimiter': '"""\t"""', 'skip_header': '(True)', 'dtype': 'str'}), "(file, delimiter='\\t', skip_header=True, dtype=str)\n", (725, 776), True, 'import numpy as np\n'), ((828, 892), 'numpy.genfromtxt', 'np.genfromtxt', (['file'], {'delimiter': '"""\t"""', '... |
import logging
import sys
import time
import requests
from transifex.native.consts import (KEY_CHARACTER_LIMIT,
KEY_DEVELOPER_COMMENT, KEY_OCCURRENCES,
KEY_TAGS)
TRANSIFEX_CDS_HOST = 'https://cds.svc.transifex.net'
TRANSIFEX_CDS_URLS = {
'... | [
"logging.getLogger",
"logging.StreamHandler",
"time.sleep",
"requests.get"
] | [((549, 590), 'logging.getLogger', 'logging.getLogger', (['"""transifex.native.cds"""'], {}), "('transifex.native.cds')\n", (566, 590), False, 'import logging\n'), ((609, 642), 'logging.StreamHandler', 'logging.StreamHandler', (['sys.stderr'], {}), '(sys.stderr)\n', (630, 642), False, 'import logging\n'), ((11592, 1162... |
"""
Tests for the ZAP CLI.
.. moduleauthor:: <NAME> (grunny)
"""
import unittest
from click.testing import CliRunner
from ddt import ddt, data, unpack
from mock import Mock, MagicMock, patch
import zapv2
from zapcli import zap_helper, cli
from zapcli.exceptions import ZAPError
@ddt
class ZAPCliTestCase(unittest.T... | [
"mock.patch",
"mock.Mock",
"click.testing.CliRunner",
"zapcli.exceptions.ZAPError",
"unittest.main"
] | [((453, 495), 'mock.patch', 'patch', (['"""zapcli.zap_helper.ZAPHelper.start"""'], {}), "('zapcli.zap_helper.ZAPHelper.start')\n", (458, 495), False, 'from mock import Mock, MagicMock, patch\n'), ((784, 826), 'mock.patch', 'patch', (['"""zapcli.zap_helper.ZAPHelper.start"""'], {}), "('zapcli.zap_helper.ZAPHelper.start'... |
# -*- coding: utf-8 -*-
"""
Routes for authentication services
"""
from django.conf.urls import url
from django_cyverse_auth import views
from django_cyverse_auth.protocol.cas import (
cas_loginRedirect, cas_validateTicket,
cas_proxyCallback, cas_storeProxyIOU_ID,
saml_validateTicket
)
urlpa... | [
"django.conf.urls.url"
] | [((335, 375), 'django.conf.urls.url', 'url', (['"""^o_login$"""', 'views.o_login_redirect'], {}), "('^o_login$', views.o_login_redirect)\n", (338, 375), False, 'from django.conf.urls import url\n'), ((418, 481), 'django.conf.urls.url', 'url', (['"""^oauth2.0/callbackAuthorize$"""', 'views.o_callback_authorize'], {}), "... |
"""
MikuAi - Is a toolkit for creating Conversational AI applications.
Copyright by <NAME> [sebidev] and <NAME>
"""
import torch
import json
import random
from mikuai.model import NeuralNet
from mikuai.nltk_utils import tokenize
from mikuai.nltk_utils import stem
from mikuai.nltk_utils import bag_of_wor... | [
"random.choice",
"torch.load",
"torch.max",
"torch.from_numpy",
"torch.softmax",
"torch.cuda.is_available",
"json.load",
"mikuai.model.NeuralNet",
"mikuai.nltk_utils.tokenize",
"mikuai.nltk_utils.bag_of_words"
] | [((572, 588), 'torch.load', 'torch.load', (['FILE'], {}), '(FILE)\n', (582, 588), False, 'import torch\n'), ((1054, 1072), 'mikuai.nltk_utils.tokenize', 'tokenize', (['sentence'], {}), '(sentence)\n', (1062, 1072), False, 'from mikuai.nltk_utils import tokenize\n'), ((1082, 1115), 'mikuai.nltk_utils.bag_of_words', 'bag... |
import gc
def count_type(obj):
return sum([type(obj) == type(o) for o in gc.get_objects()]) | [
"gc.get_objects"
] | [((79, 95), 'gc.get_objects', 'gc.get_objects', ([], {}), '()\n', (93, 95), False, 'import gc\n')] |
from pytest import mark
from django.contrib.auth import get_user_model
from django.shortcuts import reverse
from rest_framework.test import APIClient
from control.models import Control, QuestionFile, Questionnaire
from tests import factories, utils
from user_profiles.models import UserProfile
pytestmark = mark.djan... | [
"tests.factories.UserProfileFactory",
"django.contrib.auth.get_user_model",
"control.models.Control.objects.get",
"tests.utils.update_resource",
"tests.factories.dummy_file.open",
"tests.factories.QuestionFactory",
"control.models.Questionnaire.objects.get",
"rest_framework.test.APIClient",
"tests.u... | [((335, 346), 'rest_framework.test.APIClient', 'APIClient', ([], {}), '()\n', (344, 346), False, 'from rest_framework.test import APIClient\n'), ((355, 371), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (369, 371), False, 'from django.contrib.auth import get_user_model\n'), ((415, 445), 'te... |
#!/usr/bin/env python3
# Copyright (c) 2010-2015, Yahoo Inc.
# Copyrights licensed under the Apache 2.0 License
# See the accompanying LICENSE.txt file for terms.
"""
Unit tests of sshmap
"""
__author__ = 'dhubbard'
import sshmap
import os
import unittest
class TestSshmapCLI(unittest.TestCase):
"""
sshmap com... | [
"unittest.main",
"os.popen",
"os.remove"
] | [((2909, 2924), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2922, 2924), False, 'import unittest\n'), ((471, 510), 'os.popen', 'os.popen', (['"""sshmap localhost echo hello"""'], {}), "('sshmap localhost echo hello')\n", (479, 510), False, 'import os\n'), ((1574, 1630), 'os.popen', 'os.popen', (['"""sshmap loc... |
import numpy as np
import torch
import inspect
from collections import OrderedDict
from data_loader import Dataset, get_loader
import config
def random_candidates(test_users, n_candidates=101, seed=37, validate=False):
if not validate:
np.random.seed(seed)
train_data = Dataset.train_val
t... | [
"torch.LongTensor",
"inspect.signature",
"data_loader.get_loader",
"numpy.random.seed",
"torch.no_grad",
"numpy.log2"
] | [((251, 271), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (265, 271), True, 'import numpy as np\n'), ((1776, 1913), 'data_loader.get_loader', 'get_loader', (['requires'], {'batch_size': '(100)', 'users': 'users', 'num_workers': '(2)', 'process_mode': '(1 if self.validate else 2)', 'shuffle': '(Fa... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-01-24 18:44
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.... | [
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((309, 366), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (340, 366), False, 'from django.db import migrations, models\n'), ((510, 603), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
from datetime import datetime, timezone
from random import randint
from typing import List, Union
from sqlalchemy import select, UniqueConstraint
from sqlalchemy import Table, Column, ForeignKey, Boolean, \
Integer, String, Text, Date, DateTime
from sqlalchemy.orm import relationship
from sqlalchemy.ext.hybrid impo... | [
"sqlalchemy.orm.relationship",
"random.randint",
"datetime.datetime.utcnow",
"sqlalchemy.ForeignKey",
"sqlalchemy.UniqueConstraint",
"sqlalchemy.String",
"datetime.datetime.now",
"sqlalchemy.select",
"sqlalchemy.Column"
] | [((8524, 8696), 'sqlalchemy.orm.relationship', 'relationship', (['"""User"""'], {'secondary': '_mypixiv_union', 'primaryjoin': '(User.id == _mypixiv_union.c.user1_id)', 'secondaryjoin': '(User.id == _mypixiv_union.c.user2_id)', 'viewonly': '(True)'}), "('User', secondary=_mypixiv_union, primaryjoin=User.id ==\n _myp... |
# Copyright 2020 Soda
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
#... | [
"decimal.Decimal",
"sodasql.scan.measurement.Measurement",
"sodasql.scan.group_value.GroupValue"
] | [((892, 937), 'sodasql.scan.measurement.Measurement', 'Measurement', ([], {'metric': 'Metric.ROW_COUNT', 'value': '(5)'}), '(metric=Metric.ROW_COUNT, value=5)\n', (903, 937), False, 'from sodasql.scan.measurement import Measurement\n'), ((1135, 1195), 'sodasql.scan.measurement.Measurement', 'Measurement', ([], {'metric... |
from .signals import *
from plogical.pluginManagerGlobal import pluginManagerGlobal
class pluginManager:
@staticmethod
def preBackupSite(request):
return pluginManagerGlobal.globalPlug(request, preBackupSite)
@staticmethod
def postBackupSite(request, response):
return pluginManagerGlo... | [
"plogical.pluginManagerGlobal.pluginManagerGlobal.globalPlug"
] | [((172, 226), 'plogical.pluginManagerGlobal.pluginManagerGlobal.globalPlug', 'pluginManagerGlobal.globalPlug', (['request', 'preBackupSite'], {}), '(request, preBackupSite)\n', (202, 226), False, 'from plogical.pluginManagerGlobal import pluginManagerGlobal\n'), ((304, 369), 'plogical.pluginManagerGlobal.pluginManagerG... |
#!python
import sys
from graph import Graph
if __name__ == "__main__":
# get args
f_name = sys.argv[1]
# create graph
g = Graph(f_name)
# try recursive dfs from vtx_A to vtx_B
result = g.prims()
# try recursive dfs from vtx_A to vtx_B
result2 = g.dijkstra('a')
# print if there ... | [
"graph.Graph"
] | [((142, 155), 'graph.Graph', 'Graph', (['f_name'], {}), '(f_name)\n', (147, 155), False, 'from graph import Graph\n')] |
"""
Writing Plugins
---------------
nose supports plugins for test collection, selection, observation and
reporting. There are two basic rules for plugins:
* Plugin classes should subclass :class:`nose.plugins.Plugin`.
* Plugins may implement any of the methods described in the class
:doc:`IPluginInterface <interf... | [
"doctest.testmod"
] | [((5551, 5568), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (5566, 5568), False, 'import doctest\n')] |
from fastapi import Depends
from server.dependencies import get_db
from sqlalchemy.orm import Session
from users.schemas import Token_Schema
from .models import User, Blacklisted_Token
def register_or_login(user_data: dict, user_type: str, db: Session = Depends(get_db)):
email = user_data["email"]
name = use... | [
"fastapi.Depends"
] | [((257, 272), 'fastapi.Depends', 'Depends', (['get_db'], {}), '(get_db)\n', (264, 272), False, 'from fastapi import Depends\n'), ((852, 867), 'fastapi.Depends', 'Depends', (['get_db'], {}), '(get_db)\n', (859, 867), False, 'from fastapi import Depends\n'), ((1114, 1129), 'fastapi.Depends', 'Depends', (['get_db'], {}), ... |
from .state import EOF
from .tokens import TokenEof
from .tokens_base import TOKEN_COMMAND_SHELL
from .tokens_base import TokenOfCommand
from VintageousPlus import ex
@ex.command('shell', 'shell')
class TokenShell(TokenOfCommand):
def __init__(self, *args, **kwargs):
super().__init__({},
... | [
"VintageousPlus.ex.command"
] | [((170, 198), 'VintageousPlus.ex.command', 'ex.command', (['"""shell"""', '"""shell"""'], {}), "('shell', 'shell')\n", (180, 198), False, 'from VintageousPlus import ex\n')] |
# -*- coding: utf-8 -*-
'''Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2016, <NAME> <<EMAIL>>
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... | [
"fluids.numerics.linspace",
"fluids.numerics.derivative",
"numpy.log",
"numpy.array",
"pytest.raises"
] | [((3229, 3251), 'fluids.numerics.linspace', 'linspace', (['(300)', '(350)', '(10)'], {}), '(300, 350, 10)\n', (3237, 3251), False, 'from fluids.numerics import linspace, assert_close, derivative, assert_close1d\n'), ((5721, 5765), 'fluids.numerics.linspace', 'linspace', (['(0.7 * Tmin)', '(Tmin * (1 - 1e-10))', '(10)']... |
from tortoise import Model, fields
class DAO(Model):
address = fields.CharField(36, pk=True)
class Address(Model):
address = fields.CharField(36, pk=True)
balance = fields.IntField()
class Meta:
table = 'addresses'
class Proposal(Model):
id = fields.IntField(pk=True)
dao = fields.... | [
"tortoise.fields.CharField",
"tortoise.fields.ForeignKeyField",
"tortoise.fields.IntField"
] | [((69, 98), 'tortoise.fields.CharField', 'fields.CharField', (['(36)'], {'pk': '(True)'}), '(36, pk=True)\n', (85, 98), False, 'from tortoise import Model, fields\n'), ((137, 166), 'tortoise.fields.CharField', 'fields.CharField', (['(36)'], {'pk': '(True)'}), '(36, pk=True)\n', (153, 166), False, 'from tortoise import ... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | [
"trac.perm.PermissionCache",
"unittest.makeSuite",
"multiproduct.env.ProductEnvironment",
"trac.test.Mock",
"unittest.main"
] | [((2362, 2401), 'unittest.main', 'unittest.main', ([], {'defaultTest': '"""test_suite"""'}), "(defaultTest='test_suite')\n", (2375, 2401), False, 'import unittest\n'), ((1678, 1735), 'multiproduct.env.ProductEnvironment', 'ProductEnvironment', (['self.global_env', 'self.default_product'], {}), '(self.global_env, self.d... |
import RPi.GPIO as GPIO
import subprocess, time
buttonPin = 16
holdTime = 2 # Duration to hold down the button before shutting down
tapTime = 0.01
def tap():
print("Tap recognized!")
subprocess.call(["python", "mazy.py", "20"])
subprocess.call(["python", "printer.py"])
def hold():
print("Hold recognized!")
pri... | [
"RPi.GPIO.setup",
"time.sleep",
"RPi.GPIO.input",
"subprocess.call",
"time.time",
"RPi.GPIO.setmode"
] | [((381, 403), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (393, 403), True, 'import RPi.GPIO as GPIO\n'), ((404, 460), 'RPi.GPIO.setup', 'GPIO.setup', (['buttonPin', 'GPIO.IN'], {'pull_up_down': 'GPIO.PUD_UP'}), '(buttonPin, GPIO.IN, pull_up_down=GPIO.PUD_UP)\n', (414, 460), True, 'import RP... |
# SPDX-FileCopyrightText: 2009 <NAME> (blog.jordanterrell.com)
# SPDX-FileCopyrightText: 2020 <NAME> for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
`adafruit_wiznet5k_dhcp`
================================================================================
Pure-Python implementation of Jordan Terrell's DHC... | [
"random.randrange",
"time.monotonic",
"adafruit_wiznet5k.adafruit_wiznet5k_socket.socket",
"time.sleep",
"micropython.const",
"adafruit_wiznet5k.adafruit_wiznet5k_socket.htons",
"adafruit_wiznet5k.adafruit_wiznet5k_socket.htonl",
"gc.collect",
"adafruit_wiznet5k.adafruit_wiznet5k_socket.set_interfac... | [((620, 628), 'micropython.const', 'const', (['(0)'], {}), '(0)\n', (625, 628), False, 'from micropython import const\n'), ((654, 662), 'micropython.const', 'const', (['(1)'], {}), '(1)\n', (659, 662), False, 'from micropython import const\n'), ((687, 695), 'micropython.const', 'const', (['(2)'], {}), '(2)\n', (692, 69... |
# -*- coding: utf-8 -*-
# by yangxufeng.zhao
from ncclient.xml_ import *
from ncclient.operations import util
from ncclient.operations.rpc import RPC
class GetBulk(RPC):
"The *get-bulk* RPC."
def request(self, filter=None):
"""Retrieve running configuration and device state information.
*f... | [
"ncclient.operations.util.datastore_or_url",
"ncclient.operations.util.build_filter"
] | [((1098, 1151), 'ncclient.operations.util.datastore_or_url', 'util.datastore_or_url', (['"""source"""', 'source', 'self._assert'], {}), "('source', source, self._assert)\n", (1119, 1151), False, 'from ncclient.operations import util\n'), ((571, 596), 'ncclient.operations.util.build_filter', 'util.build_filter', (['filt... |
"""Unit tests for themis_ml meta estimators."""
import pytest
from sklearn.linear_model import LogisticRegression
from themis_ml.meta_estimators import FairnessAwareMetaEstimator
from themis_ml.linear_model import counterfactually_fair_models
from themis_ml.preprocessing import relabelling
from themis_ml.postprocess... | [
"themis_ml.preprocessing.relabelling.Relabeller",
"themis_ml.linear_model.counterfactually_fair_models.LinearACFClassifier",
"themis_ml.postprocessing.reject_option_classification.SingleROClassifier",
"themis_ml.postprocessing.reject_option_classification.MultipleROClassifier",
"conftest.create_y",
"sklea... | [((470, 487), 'conftest.create_linear_X', 'create_linear_X', ([], {}), '()\n', (485, 487), False, 'from conftest import create_linear_X, create_y, create_s\n'), ((496, 506), 'conftest.create_y', 'create_y', ([], {}), '()\n', (504, 506), False, 'from conftest import create_linear_X, create_y, create_s\n'), ((515, 525), ... |
import sys
import math
from PySide2.QtWidgets import QApplication, QVBoxLayout, QFileDialog, QMainWindow
from PySide2.QtCore import QCoreApplication, Qt, Slot, QUrl, QFile, QIODevice, QFileInfo
from PySide2.QtGui import QIcon
from PySide2.QtUiTools import QUiLoader
from PySide2.QtMultimedia import QMediaPlayer
from PyS... | [
"PyVideoEditor.settings_tools.SettingsDialog",
"PySide2.QtCore.Slot",
"PyVideoEditor.video_tools.TimelineMarks",
"PySide2.QtWidgets.QFileDialog.getSaveFileName",
"PySide2.QtCore.QFileInfo",
"PySide2.QtUiTools.QUiLoader",
"PySide2.QtWidgets.QMainWindow.__init__",
"PySide2.QtMultimedia.QMediaPlayer",
... | [((2491, 2497), 'PySide2.QtCore.Slot', 'Slot', ([], {}), '()\n', (2495, 2497), False, 'from PySide2.QtCore import QCoreApplication, Qt, Slot, QUrl, QFile, QIODevice, QFileInfo\n'), ((2997, 3003), 'PySide2.QtCore.Slot', 'Slot', ([], {}), '()\n', (3001, 3003), False, 'from PySide2.QtCore import QCoreApplication, Qt, Slot... |
from models import EmailHook
from django import forms
class EmailHookForm(forms.ModelForm):
class Meta:
model = EmailHook
fields = ['recipient', 'destination']
def clean_recipient(self):
recipient = self.cleaned_data.get('recipient').lower()
excluded = [
'webmast... | [
"django.forms.ValidationError"
] | [((461, 509), 'django.forms.ValidationError', 'forms.ValidationError', (['"""Recipient already taken"""'], {}), "('Recipient already taken')\n", (482, 509), False, 'from django import forms\n')] |
from dragonfly import MappingRule
from castervoice.lib.actions import Key
from castervoice.lib.ctrl.mgr.rule_details import RuleDetails
from castervoice.lib.merge.state.short import R
class TotalCommanderRule(MappingRule):
mapping = {
"find [in] files": R(Key('a-f7')),
"view": R(Key('f3')),
... | [
"castervoice.lib.ctrl.mgr.rule_details.RuleDetails",
"castervoice.lib.actions.Key"
] | [((1058, 1132), 'castervoice.lib.ctrl.mgr.rule_details.RuleDetails', 'RuleDetails', ([], {'name': '"""total commander"""', 'executable': "['totalcmd', 'totalcmd64']"}), "(name='total commander', executable=['totalcmd', 'totalcmd64'])\n", (1069, 1132), False, 'from castervoice.lib.ctrl.mgr.rule_details import RuleDetail... |
# -*- coding: utf-8 -*-
"""
@author: <NAME> (<EMAIL>)
(c) <NAME>; This work is licensed under a Creative Commons
Attribution-NonCommercial-NoDerivs 2.0 UK: England & Wales License.
"""
from watchdog.observers.polling import (
PollingEmitter, PollingObserver, DirectorySnapshotDiff,
FileDeletedEvent, FileModif... | [
"watchdog.observers.polling.BaseObserver.__init__",
"watchdog.observers.polling.DirectorySnapshotDiff",
"watchdog.observers.polling.DirDeletedEvent",
"watchdog.observers.polling.DirModifiedEvent",
"watchdog.observers.polling.FileMovedEvent",
"watchdog.observers.polling.DirMovedEvent",
"watchdog.observer... | [((2476, 2562), 'watchdog.observers.polling.BaseObserver.__init__', 'BaseObserver.__init__', (['self'], {'emitter_class': 'OrderedPollingEmitter', 'timeout': 'timeout'}), '(self, emitter_class=OrderedPollingEmitter, timeout=\n timeout)\n', (2497, 2562), False, 'from watchdog.observers.polling import PollingEmitter, ... |
#!/usr/bin/env python
import h5py
import numpy as np
class HDF5IO:
def __init__(self, path_file, handler_file = None, mode='a'):
if(handler_file == None):
self.handler_file = h5py.File(path_file, mode=mode)
else:
self.handler_file = handler_file
def GetMainKeys(self):
... | [
"h5py.File"
] | [((201, 232), 'h5py.File', 'h5py.File', (['path_file'], {'mode': 'mode'}), '(path_file, mode=mode)\n', (210, 232), False, 'import h5py\n')] |
#
# This script should be sourced after slicerqt.py
#
def tcl(cmd):
global _tpycl
try:
_tpycl
except NameError:
# no tcl yet, so first bring in the adapters, then the actual code
import tpycl
_tpycl = tpycl.tpycl()
packages = ['freesurfer', 'mrml', 'mrmlLogic', 'teem', 'vtk', 'vtkITK']
... | [
"os.path.realpath",
"tpycl.tpycl"
] | [((225, 238), 'tpycl.tpycl', 'tpycl.tpycl', ([], {}), '()\n', (236, 238), False, 'import tpycl\n'), ((411, 437), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (427, 437), False, 'import os\n')] |
from ..spacegroup import expand_spacegroup
import numpy as np
def test_expand_spacegroup():
"""test for expand_spacegroup function"""
# try non-integer input
a_float = 31.1
a_string = 'a'
a_list = [1, 2]
# try all non-integer inputs
try:
expand_spacegroup(a_float)
except Excepti... | [
"numpy.random.randint"
] | [((782, 807), 'numpy.random.randint', 'np.random.randint', (['(1)', '(230)'], {}), '(1, 230)\n', (799, 807), True, 'import numpy as np\n')] |
import os
import numpy as np
import matplotlib.image as mpimg
def listdir_nohidden(path: str, jpg_only=False) -> list:
"""
returns an alphabetically sorted list of filenames of the unhidden files of a directory
optionnal arg : jpg_only. Set on True for only .jpg or .JPG
"""
if jpg_only:
ret... | [
"os.listdir",
"numpy.asarray",
"os.path.join",
"os.getcwd",
"numpy.empty",
"cv2.resize",
"os.remove"
] | [((9871, 9882), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (9880, 9882), False, 'import os\n'), ((1312, 1342), 'os.path.join', 'os.path.join', (['directory_', 'zord'], {}), '(directory_, zord)\n', (1324, 1342), False, 'import os\n'), ((6749, 6775), 'os.path.join', 'os.path.join', (['path', 'classe'], {}), '(path, clas... |
# Copyright (c) 2022, Momscode Technologies and contributors
# For license information, please see license.txt
import frappe
from frappe import _, msgprint
def execute(filters=None):
columns, data = [], []
columns=get_columns()
# columns = ["posting date", "opportunity", "customer name", "type"]
parents = frappe.d... | [
"frappe.db.sql",
"frappe._"
] | [((312, 419), 'frappe.db.sql', 'frappe.db.sql', (['"""SELECT posting_date,opportunity,customer_name,type FROM tabBudget BOM """'], {'as_dict': '(1)'}), "(\n 'SELECT posting_date,opportunity,customer_name,type FROM tabBudget BOM ',\n as_dict=1)\n", (325, 419), False, 'import frappe\n'), ((559, 687), 'frappe.db.sql... |
import logging
import daiquiri
daiquiri.setup(level=logging.INFO, outputs=('stdout', 'stderr'))
logger = daiquiri.getLogger(__name__)
logger.info("It works and logs to both stdout and stderr!")
| [
"daiquiri.getLogger",
"daiquiri.setup"
] | [((33, 97), 'daiquiri.setup', 'daiquiri.setup', ([], {'level': 'logging.INFO', 'outputs': "('stdout', 'stderr')"}), "(level=logging.INFO, outputs=('stdout', 'stderr'))\n", (47, 97), False, 'import daiquiri\n'), ((108, 136), 'daiquiri.getLogger', 'daiquiri.getLogger', (['__name__'], {}), '(__name__)\n', (126, 136), Fals... |
'''
Districtr Idea 3.0
The easiest way to list precincts and districts together is by generating
this link in QGIS, then saving to a csv.
NOLA Precincts and Districts are stored in the NOLA Open GIS format.
(Not all parishes make it this easy.) In QGIS, we match the precinct to the
relevant OPSB district and export ... | [
"DistrictrJsonReader.DistrictrJson",
"re.findall",
"csv.reader",
"re.search"
] | [((817, 856), 're.findall', 're.findall', (['"""\\\\d{1,2}?(?!\\\\d)"""', 'oldPrec'], {}), "('\\\\d{1,2}?(?!\\\\d)', oldPrec)\n", (827, 856), False, 'import re\n'), ((1036, 1151), 'DistrictrJsonReader.DistrictrJson', 'DistrictrJson', (['"""Orleans Parish School Board Districts"""', '"""District"""', '"""Districts"""'],... |
# calculating the intragroup average distance, showing that is is significantly increases with age,
# TRF is lower than 24-month-old AL. Make a figure
# note about scaling - the metabolom matrix has the metabolites in rows (animals col),
# and scaling normalizes the columns, so we need to scale the transpose o... | [
"pandas.read_csv",
"matplotlib.pyplot.show",
"sklearn.preprocessing.StandardScaler",
"numpy.array",
"numpy.sum",
"statistics.pstdev",
"matplotlib.pyplot.subplots",
"numpy.arange",
"numpy.random.permutation"
] | [((8529, 8573), 'pandas.read_csv', 'pd.read_csv', (['"""mergedpolarlipid"""'], {'header': 'None'}), "('mergedpolarlipid', header=None)\n", (8540, 8573), True, 'import pandas as pd\n'), ((8726, 8742), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', ([], {}), '()\n', (8740, 8742), False, 'from sklearn.preproces... |
import watson_developer_cloud
YES = "yes"
NO = "no"
LATE_FLIGHT = "late_flight"
class ConversationHelper():
def __init__(self):
#Constructor to initialize conversation tokens
self.last_intent = ''
self.conversation = watson_developer_cloud.ConversationV1(
username = 'fe1f3935... | [
"watson_developer_cloud.ConversationV1"
] | [((249, 390), 'watson_developer_cloud.ConversationV1', 'watson_developer_cloud.ConversationV1', ([], {'username': '"""fe1f3935-fd7f-498e-8fc0-ac4260774df1"""', 'password': '"""<PASSWORD>"""', 'version': '"""2017-12-05"""'}), "(username=\n 'fe1f3935-fd7f-498e-8fc0-ac4260774df1', password='<PASSWORD>', version=\n '... |
from django.urls import path
from . import views
app_name = 'cart'
urlpatterns = [
path('add/<int:product_id>', views.add_cart, name='add_cart'),
path('delete/<int:product_id>', views.delete_cart_item, name='delete_cart'),
path('remove/<int:product_id>',
views.remove_cart_item, name='remove_cart_... | [
"django.urls.path"
] | [((89, 150), 'django.urls.path', 'path', (['"""add/<int:product_id>"""', 'views.add_cart'], {'name': '"""add_cart"""'}), "('add/<int:product_id>', views.add_cart, name='add_cart')\n", (93, 150), False, 'from django.urls import path\n'), ((156, 231), 'django.urls.path', 'path', (['"""delete/<int:product_id>"""', 'views.... |
import FWCore.ParameterSet.Config as cms
from DQMServices.Core.DQMEDHarvester import DQMEDHarvester
from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer
SUSY_HLT_DiJet_MET = DQMEDAnalyzer('SUSY_HLT_DiJet_MET',
trigSummary = cms.InputTag("hltTriggerSummaryAOD",'', 'HLT'),
pfMETCollection = cms.InputTag("pfMet"... | [
"FWCore.ParameterSet.Config.string",
"FWCore.ParameterSet.Config.untracked.double",
"FWCore.ParameterSet.Config.vstring",
"FWCore.ParameterSet.Config.InputTag",
"FWCore.ParameterSet.Config.untracked.uint32",
"FWCore.ParameterSet.Config.untracked.vstring"
] | [((231, 278), 'FWCore.ParameterSet.Config.InputTag', 'cms.InputTag', (['"""hltTriggerSummaryAOD"""', '""""""', '"""HLT"""'], {}), "('hltTriggerSummaryAOD', '', 'HLT')\n", (243, 278), True, 'import FWCore.ParameterSet.Config as cms\n'), ((300, 321), 'FWCore.ParameterSet.Config.InputTag', 'cms.InputTag', (['"""pfMet"""']... |
#!/usr/bin/env python3
"""
Simple HTTPs Server
Copyright 2017-2022 <NAME>
Licensed under the Apache License
Written by <NAME> (<EMAIL>)
"""
# Standard library imports
from http.server import HTTPServer, SimpleHTTPRequestHandler
from ssl import wrap_socket
HOST = "localhost"
PORT = 8443
CERTIFICATE_DIRECTORY = "ssl_t... | [
"http.server.HTTPServer"
] | [((334, 384), 'http.server.HTTPServer', 'HTTPServer', (['(HOST, PORT)', 'SimpleHTTPRequestHandler'], {}), '((HOST, PORT), SimpleHTTPRequestHandler)\n', (344, 384), False, 'from http.server import HTTPServer, SimpleHTTPRequestHandler\n')] |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'untitled.ui'
# Created by: PyQt5 UI code generator 5.9.2
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets,QtWebEngineWidgets
import io,sys,folium
from PyQt5.QtGui import *
from PyQt5.QtW... | [
"PyQt5.QtWidgets.QTextBrowser",
"folium.LatLngPopup",
"pickle.dumps",
"io.BytesIO",
"PyQt5.QtWidgets.QApplication",
"folium.CircleMarker",
"PyQt5.QtWidgets.QTextEdit",
"PyQt5.QtWidgets.QComboBox",
"folium.Map",
"PyQt5.QtWidgets.QStatusBar",
"PyQt5.QtWidgets.QLabel",
"folium.PolyLine",
"foliu... | [((838, 861), 'requests.get', 'requests.get', (['base', 'par'], {}), '(base, par)\n', (850, 861), False, 'import requests\n'), ((5938, 6125), 'folium.Map', 'folium.Map', ([], {'location': '[30.69673, 104.033516]', 'zoom_start': '(12)', 'tiles': '"""http://webrd02.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&sty... |
"""
Testing model and object processors.
"""
import pytest # noqa
import sys
pytestmark = pytest.mark.skipif(sys.version_info[0] < 3,
reason="pyecore is not Python 2 compatible") # noqa
pyecore = pytest.importorskip("pyecore") # noqa
import textx
from textx import metamodel_from_str
... | [
"textx.metamodel_from_str",
"textx.enable_pyecore_support",
"pytest.importorskip",
"pytest.mark.usefixtures",
"pytest.mark.skipif",
"pytest.fixture"
] | [((91, 184), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(sys.version_info[0] < 3)'], {'reason': '"""pyecore is not Python 2 compatible"""'}), "(sys.version_info[0] < 3, reason=\n 'pyecore is not Python 2 compatible')\n", (109, 184), False, 'import pytest\n'), ((230, 260), 'pytest.importorskip', 'pytest.importors... |
"""
Open compressed files transparently.
"""
__all__ = ["xopen", "PipedGzipWriter", "PipedGzipReader", "__version__"]
import gzip
import sys
import io
import os
import bz2
import time
import stat
import signal
import pathlib
from subprocess import Popen, PIPE
from ._version import version as __version__
try:
i... | [
"gzip.open",
"subprocess.Popen",
"multiprocessing.cpu_count",
"lzma.open",
"io.UnsupportedOperation",
"time.sleep",
"os.sched_getaffinity",
"io.TextIOWrapper",
"bz2.open",
"os.stat",
"os.fspath",
"re.search"
] | [((9014, 9038), 'bz2.open', 'bz2.open', (['filename', 'mode'], {}), '(filename, mode)\n', (9022, 9038), False, 'import bz2\n'), ((9226, 9251), 'lzma.open', 'lzma.open', (['filename', 'mode'], {}), '(filename, mode)\n', (9235, 9251), False, 'import lzma\n'), ((12361, 12377), 'os.fspath', 'fspath', (['filename'], {}), '(... |
from socket import *
from mpyc.runtime import mpc
LOCAL = False
if LOCAL:
HOST = '127.0.0.1' # or 'localhost'
else:
HOST = '192.168.150.1'
PORT = 6868
BUFSIZ = 1024
ADDR = (HOST, PORT)
tcpCliSock = socket(AF_INET, SOCK_STREAM)
tcpCliSock.connect(ADDR)
secnum = mpc.SecInt()
if __name__ == '__main__':
lo... | [
"mpyc.runtime.mpc.SecInt"
] | [((274, 286), 'mpyc.runtime.mpc.SecInt', 'mpc.SecInt', ([], {}), '()\n', (284, 286), False, 'from mpyc.runtime import mpc\n')] |
# python3
# pylint: disable=g-bad-file-header
# Copyright 2019 DeepMind Technologies Limited. 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... | [
"absl.testing.parameterized.parameters",
"absl.testing.absltest.main"
] | [((1075, 1116), 'absl.testing.parameterized.parameters', 'parameterized.parameters', (['*sweep.SETTINGS'], {}), '(*sweep.SETTINGS)\n', (1099, 1116), False, 'from absl.testing import parameterized\n'), ((1388, 1403), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (1401, 1403), False, 'from absl.testing... |
# SYNCS Hackathon 2020
# jadaj - Circular
import numpy as np
import matplotlib.pyplot as plt
import statsmodels.api as sm
import cv2
from PIL import Image
import io
import base64
# Inputs:
# image (2d array-like): Will consider all non-zero entries in array as part of circle
# centre ((float, float))
# Outputs:
# (i... | [
"numpy.sqrt",
"numpy.polyfit",
"io.BytesIO",
"numpy.argsort",
"numpy.array",
"numpy.arctan2",
"numpy.linalg.norm",
"numpy.sin",
"matplotlib.pyplot.arrow",
"numpy.where",
"matplotlib.pyplot.close",
"numpy.stack",
"numpy.linspace",
"numpy.exp",
"matplotlib.pyplot.axis",
"matplotlib.pyplo... | [((442, 460), 'numpy.argwhere', 'np.argwhere', (['image'], {}), '(image)\n', (453, 460), True, 'import numpy as np\n'), ((603, 620), 'numpy.argsort', 'np.argsort', (['theta'], {}), '(theta)\n', (613, 620), True, 'import numpy as np\n'), ((682, 755), 'statsmodels.api.nonparametric.lowess', 'sm.nonparametric.lowess', (['... |
# setup.py proper begins here
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
from os import path
import os
# trick to manage package versions in one place only
# http://stackoverflow.com/questions/458550/standard-way-to-emb... | [
"setuptools.find_packages",
"os.path.join",
"os.path.dirname",
"codecs.open",
"os.walk",
"re.search"
] | [((535, 568), 're.search', 're.search', (['VSRE', 'verstrline', 're.M'], {}), '(VSRE, verstrline, re.M)\n', (544, 568), False, 'import re\n'), ((1493, 1523), 'os.path.join', 'os.path.join', (['here', '"""ontodocs"""'], {}), "(here, 'ontodocs')\n", (1505, 1523), False, 'import os\n'), ((1538, 1583), 'os.path.join', 'os.... |
# Copyright 2020 Rubrik, 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 in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distri... | [
"boto3.setup_default_session",
"boto3.session.Session",
"boto3.client",
"rubrik_polaris.exceptions.PolarisException",
"re.sub",
"re.search"
] | [((7410, 7460), 'boto3.client', 'boto3.client', (['"""cloudformation"""'], {'region_name': 'region'}), "('cloudformation', region_name=region)\n", (7422, 7460), False, 'import boto3\n'), ((12775, 12831), 'boto3.client', 'boto3.client', (['"""cloudformation"""'], {'region_name': 'stack_region'}), "('cloudformation', reg... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"logging.basicConfig",
"argparse.ArgumentParser",
"mxnet.io.NDArrayIter",
"mxnet.symbol.Variable",
"mxnet.sym.Variable",
"mxnet.sym.LinearRegressionOutput",
"mxnet.init.Uniform",
"numpy.array",
"numpy.random.randint",
"mxnet.kv.create",
"mxnet.metric.create",
"mxnet.sym.FullyConnected",
"mxn... | [((1521, 1542), 'mxnet.kv.create', 'mx.kv.create', (['"""local"""'], {}), "('local')\n", (1533, 1542), True, 'import mxnet as mx\n'), ((1655, 1678), 'mxnet.metric.create', 'mx.metric.create', (['"""mse"""'], {}), "('mse')\n", (1671, 1678), True, 'import mxnet as mx\n'), ((3092, 3144), 'logging.basicConfig', 'logging.ba... |
import subprocess
import numpy as np
import cv2
import os
import time
#command line selection menu.
vdo = input('Please select a file to play using a number,\n 1. 458_video.mp4\n 2. Pistol.mp4 \n 3. Typewriter \n \n')
i = int(vdo)
if i == 1:
vdo_loc = '458_video.mp4'
elif i == 2:
vdo_loc = 'Pistol.... | [
"cv2.imwrite",
"subprocess.Popen",
"time.sleep",
"cv2.imshow",
"cv2.destroyAllWindows",
"subprocess.call",
"cv2.cvtColor",
"cv2.resize",
"cv2.waitKey",
"os.remove"
] | [((2138, 2161), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (2159, 2161), False, 'import cv2\n'), ((2558, 2695), 'subprocess.Popen', 'subprocess.Popen', (['"""python classify_image_mod.py --image_file=captured.jpg"""'], {'shell': '(True)', 'stdin': 'subprocess.PIPE', 'stdout': 'subprocess.PIPE'}... |
# -*- coding: utf-8 -*-
"""Test the gettext manipulation methods."""
from os import remove
from os.path import exists
from fixtures import fixture_wowsdir # pylint: disable=unused-import
from wren.pomo import backup_original_mo, restore_original_mo
LC = "res/texts/en/LC_MESSAGES"
def test_backup_original_mo(wows... | [
"wren.pomo.backup_original_mo",
"os.path.exists",
"wren.pomo.restore_original_mo",
"os.remove"
] | [((383, 398), 'os.path.exists', 'exists', (['wowsdir'], {}), '(wowsdir)\n', (389, 398), False, 'from os.path import exists\n'), ((410, 445), 'os.path.exists', 'exists', (['f"""{wowsdir}/{LC}/global.mo"""'], {}), "(f'{wowsdir}/{LC}/global.mo')\n", (416, 445), False, 'from os.path import exists\n'), ((510, 543), 'wren.po... |
import sys, os, importlib.util
try:
import current # imports package, i.e. runs current/__init__.py
except ImportError:
print("Can't import current module or package")
else:
print(sys.modules['current'])
# the only way to import module is to use importlib
# otherwise content of the current.py should be m... | [
"os.path.abspath"
] | [((518, 554), 'os.path.abspath', 'os.path.abspath', (["(module_name + '.py')"], {}), "(module_name + '.py')\n", (533, 554), False, 'import sys, os, importlib.util\n')] |
# Objectives and constraints functions (May. 05, 2021)
import math
import numpy as np
# from numpy.cor_t.fromnumeric import around
def objective(var_o,mttf,c_m,c_r,c_inc,t_ser,parametro_1,parametro_2): #objetive functions Lognormal
#confiabilidade
gamma_ = parametro_2
theta = parametro_1
t = int(ma... | [
"math.exp"
] | [((355, 387), 'math.exp', 'math.exp', (['(-(t / theta) ** gamma_)'], {}), '(-(t / theta) ** gamma_)\n', (363, 387), False, 'import math\n'), ((733, 765), 'math.exp', 'math.exp', (['(-(t / theta) ** gamma_)'], {}), '(-(t / theta) ** gamma_)\n', (741, 765), False, 'import math\n')] |
# -*- coding: utf-8 -*-
# Third party imports
from qtpy.QtCore import QSize, QPoint, Signal
from spyder.api.translations import get_translation
from spyder.api.widgets.main_container import PluginMainContainer
# Local imports
from spyder_screencast.api import ScreenResolutions
from spyder_screencast.widgets import Sc... | [
"spyder.api.translations.get_translation",
"qtpy.QtCore.Signal",
"spyder_screencast.widgets.ScreenCastStatusWidget"
] | [((362, 398), 'spyder.api.translations.get_translation', 'get_translation', (['"""spyder_screencast"""'], {}), "('spyder_screencast')\n", (377, 398), False, 'from spyder.api.translations import get_translation\n'), ((589, 602), 'qtpy.QtCore.Signal', 'Signal', (['QSize'], {}), '(QSize)\n', (595, 602), False, 'from qtpy.... |
#!/usr/bin/python
# coding=utf-8
"""
Reads the tf records and put them into a TFRecordDataset.
the tfrecords must be in datasets/ folder
run this script from bash perform a benchmark of the dataset performane
"""
import os
import glob
import time
import tensorflow as tf
AUTOTUNE = tf.data.experimental.AUTOTUNE
... | [
"tensorflow.unstack",
"tensorflow.data.TFRecordDataset",
"tensorflow.io.decode_image",
"tensorflow.shape",
"tensorflow.data.Dataset.from_tensor_slices",
"tensorflow.split",
"os.environ.get",
"time.perf_counter",
"os.path.join",
"tensorflow.image.random_crop",
"tensorflow.concat",
"tensorflow.i... | [((828, 876), 'tensorflow.io.parse_example', 'tf.io.parse_example', (['example', 'feature_properties'], {}), '(example, feature_properties)\n', (847, 876), True, 'import tensorflow as tf\n'), ((909, 970), 'tensorflow.io.decode_image', 'tf.io.decode_image', (["example['sharp']"], {'expand_animations': '(False)'}), "(exa... |
import gdb
import re
import gdb.printing
class PuTTYMpintPrettyPrinter(gdb.printing.PrettyPrinter):
"Pretty-print PuTTY's mp_int type."
name = "mp_int"
def __init__(self, val):
super(PuTTYMpintPrettyPrinter, self).__init__(self.name)
self.val = val
def to_string(self):
... | [
"gdb.Value",
"gdb.lookup_type",
"gdb.parse_and_eval",
"gdb.GdbError"
] | [((343, 371), 'gdb.lookup_type', 'gdb.lookup_type', (['"""BignumInt"""'], {}), "('BignumInt')\n", (358, 371), False, 'import gdb\n'), ((2386, 2413), 'gdb.parse_and_eval', 'gdb.parse_and_eval', (['cmdline'], {}), '(cmdline)\n', (2404, 2413), False, 'import gdb\n'), ((9561, 9590), 'gdb.parse_and_eval', 'gdb.parse_and_eva... |
import numpy as np
import collections
from ..utils.utils_def import FlopyBinaryData
from ..utils.reference import SpatialReference
class MfGrdFile(FlopyBinaryData):
def __init__(self, filename, precision='double', verbose=False):
"""
Class constructor.
"""
super(MfGrdFile, sel... | [
"numpy.array",
"collections.OrderedDict",
"numpy.column_stack"
] | [((467, 492), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (490, 492), False, 'import collections\n'), ((518, 543), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (541, 543), False, 'import collections\n'), ((4101, 4124), 'numpy.column_stack', 'np.column_stack', (['(x... |
#!/usr/bin/python
import sys
from os import path
# Need to append server root path to ensure we can import the necessary files.
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
def cron():
from mod_ci.controllers import start_platform
from run import config, log
from database import cr... | [
"os.path.abspath",
"run.log.info",
"github.GitHub",
"database.create_session",
"mod_ci.controllers.start_platform"
] | [((368, 424), 'run.log.info', 'log.info', (['"""Run the cron for kicking off CI platform(s)."""'], {}), "('Run the cron for kicking off CI platform(s).')\n", (376, 424), False, 'from run import config, log\n'), ((455, 493), 'database.create_session', 'create_session', (["config['DATABASE_URI']"], {}), "(config['DATABAS... |
'''
Created on Feb 3, 2017
@author: Akash
link_preview is now a fashionable way of sharing links
in social media. The contents of what the preview is
made up are:-
1. og.title:-
Title of the preview.
In HTML: <meta property="og.title" content="XYZ">
... | [
"re.findall",
"urllib.request.urlopen"
] | [((2645, 2724), 're.findall', 're.findall', (['"""<[\\\\s]*meta[^<>]+og:(?:title|image|description)(?!:)[^<>]+>"""', 'html'], {}), "('<[\\\\s]*meta[^<>]+og:(?:title|image|description)(?!:)[^<>]+>', html)\n", (2655, 2724), False, 'import re\n'), ((3775, 3824), 're.findall', 're.findall', (['"""content[\\\\s]*=[\\\\s]*"[... |
from ufl import Identity
from glimslib.fenics_local import *
# -- youngs modulus, poisson ration -> mu, lambda
def compute_mu(young_modulus, poisson_ratio):
return young_modulus / (2.0 * (1.0 + poisson_ratio))
def compute_lambda(young_modulus, poisson_ratio):
return young_modulus * poisson_ratio / ((1.0 + po... | [
"ufl.Identity"
] | [((1122, 1135), 'ufl.Identity', 'Identity', (['dim'], {}), '(dim)\n', (1130, 1135), False, 'from ufl import Identity\n'), ((967, 980), 'ufl.Identity', 'Identity', (['dim'], {}), '(dim)\n', (975, 980), False, 'from ufl import Identity\n'), ((1254, 1267), 'ufl.Identity', 'Identity', (['dim'], {}), '(dim)\n', (1262, 1267)... |