code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""
Provide a Python interface to the Akamai CCU API.
The CCU API is used to purge content from Akamai. This module will expose
that API in the form of Python objects
"""
import os
import sys
# Handle the fact that ConfigParser was renamed to configparser in PY3
# pylint: disable=import-error
try:
import configp... | [
"os.environ.get",
"os.path.expanduser",
"ConfigParser.SafeConfigParser"
] | [((481, 520), 'os.environ.get', 'os.environ.get', (['"""AKAMAI_USERNAME"""', 'None'], {}), "('AKAMAI_USERNAME', None)\n", (495, 520), False, 'import os\n'), ((539, 578), 'os.environ.get', 'os.environ.get', (['"""AKAMAI_PASSWORD"""', 'None'], {}), "('AKAMAI_PASSWORD', None)\n", (553, 578), False, 'import os\n'), ((601, ... |
import arcade
def test_point_in_rectangle():
polygon = [
(0, 0),
(0, 50),
(50, 50),
(50, 0),
]
result = arcade.is_point_in_polygon(25, 25, polygon)
assert result is True
def test_point_not_in_empty_polygon():
polygon = []
result = arcade.is_point_in_polygon(25... | [
"arcade.is_point_in_polygon"
] | [((150, 193), 'arcade.is_point_in_polygon', 'arcade.is_point_in_polygon', (['(25)', '(25)', 'polygon'], {}), '(25, 25, polygon)\n', (176, 193), False, 'import arcade\n'), ((291, 334), 'arcade.is_point_in_polygon', 'arcade.is_point_in_polygon', (['(25)', '(25)', 'polygon'], {}), '(25, 25, polygon)\n', (317, 334), False,... |
import pandas as pd
from pathlib import Path
def process_files(input_dir, output_dir, record_name):
img_dir = output_dir / 'images'
labels_dir = output_dir / 'labels'
record_path = output_dir / record_name
class_path = output_dir / 'classes.names'
img_dir.mkdir(exist_ok=True)
labels_dir.mkdi... | [
"pandas.read_csv",
"pathlib.Path"
] | [((798, 828), 'pandas.read_csv', 'pd.read_csv', (['input_labels_path'], {}), '(input_labels_path)\n', (809, 828), True, 'import pandas as pd\n'), ((2279, 2308), 'pathlib.Path', 'Path', (['"""tensorflow/data/train"""'], {}), "('tensorflow/data/train')\n", (2283, 2308), False, 'from pathlib import Path\n'), ((2329, 2349)... |
from shutil import which
from starlette.config import Config
from starlette.datastructures import CommaSeparatedStrings
config = Config(".env")
DEBUG = config("DEBUG", cast=bool, default=False)
DB_NAME = config("DATABASE_NAME", default="PS5Tracker")
DB_USER = config("DATABASE_USER", default="root")
DB_PASS = config... | [
"starlette.config.Config",
"shutil.which"
] | [((132, 146), 'starlette.config.Config', 'Config', (['""".env"""'], {}), "('.env')\n", (138, 146), False, 'from starlette.config import Config\n'), ((904, 926), 'shutil.which', 'which', (['"""google-chrome"""'], {}), "('google-chrome')\n", (909, 926), False, 'from shutil import which\n'), ((856, 877), 'shutil.which', '... |
import os
import pytest
from mock import MagicMock
from datadog_checks.base.errors import CheckException
from datadog_checks.lighthouse import LighthouseCheck
HERE = os.path.dirname(os.path.abspath(__file__))
def mock_get_lighthouse_report(cmd, lgr, re=False):
if "https" not in cmd[1]:
return "", "erro... | [
"datadog_checks.lighthouse.LighthouseCheck",
"os.path.join",
"pytest.raises",
"os.path.abspath",
"mock.MagicMock"
] | [((185, 210), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (200, 210), False, 'import os\n'), ((843, 880), 'datadog_checks.lighthouse.LighthouseCheck', 'LighthouseCheck', (['"""lighthouse"""', '{}', '{}'], {}), "('lighthouse', {}, {})\n", (858, 880), False, 'from datadog_checks.lighthouse i... |
#!/usr/bin/env python
import json
from auth0_client.Auth0Client import Auth0Client
from auth0_client.menu.menu_helper.common import *
from auth0_client.menu.menu_helper.pretty import *
try:
client_applications = {}
app_type = [
'all',
'native',
'spa',
'regular_web',
'... | [
"json.loads"
] | [((1185, 1204), 'json.loads', 'json.loads', (['results'], {}), '(results)\n', (1195, 1204), False, 'import json\n')] |
"""
file3
Copyright (C) 2021 <NAME> (<EMAIL>)
This program is free software; you can redistribute it and/or modify
it under the terms of the Python Packaging Authority License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
... | [
"setuptools.find_packages"
] | [((1270, 1329), 'setuptools.find_packages', 'setuptools.find_packages', ([], {'exclude': "['venv', 'file-test-env']"}), "(exclude=['venv', 'file-test-env'])\n", (1294, 1329), False, 'import setuptools\n')] |
# -*- coding: utf-8 -*-
import unittest
import subprocess
import os
from io import StringIO
import pandas as pd
import sys
test_dir_1 = os.path.dirname(os.path.realpath(__file__))
sys.path.append(test_dir_1)
from base import TestBase
###############################################################################
... | [
"os.path.realpath",
"sys.path.append",
"unittest.main",
"pandas.read_csv"
] | [((184, 211), 'sys.path.append', 'sys.path.append', (['test_dir_1'], {}), '(test_dir_1)\n', (199, 211), False, 'import sys\n'), ((156, 182), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (172, 182), False, 'import os\n'), ((7302, 7317), 'unittest.main', 'unittest.main', ([], {}), '()\n', (... |
import cv2
import numpy as np
import os
import random
# Mars surface image (Curiosity rover) labeled data set
def ffzk(input_dir):
imgname_array=[];input_dir=input_dir.strip("\"\'")
for fd_path, _, sb_file in os.walk(input_dir):
for fil in sb_file:imgname_array.append(fd_path.replace('\\','/') + '/' + ... | [
"os.makedirs",
"numpy.average",
"random.randrange",
"os.path.join",
"os.path.isfile",
"cv2.imread",
"os.walk"
] | [((483, 527), 'os.makedirs', 'os.makedirs', (['"""./datasets/mls"""'], {'exist_ok': '(True)'}), "('./datasets/mls', exist_ok=True)\n", (494, 527), False, 'import os\n'), ((527, 571), 'os.makedirs', 'os.makedirs', (['"""./datasets/mls"""'], {'exist_ok': '(True)'}), "('./datasets/mls', exist_ok=True)\n", (538, 571), Fals... |
from spike import Motor
motor = Motor('A')
# Run clockwise for half a second at 75% speed
motor.run_for_seconds(0.5, 75)
# Run counterclockwise for 6 seconds at 30% speed
motor.run_for_seconds(6, -30)
# Run the motor 90 degrees clockwise:
#motor.run_for_rotations(0.25)
# Run the motor 90 degrees counterclockwise:
... | [
"spike.Motor"
] | [((33, 43), 'spike.Motor', 'Motor', (['"""A"""'], {}), "('A')\n", (38, 43), False, 'from spike import Motor\n')] |
# -*- coding: utf-8 -*-
"""
Given an integer array nums, find the contiguous subarray (containing at least one number)
which has the largest sum and return its sum.
Example:
Input: [-2,1,-3,4,-1,2,1,-5,4],
Output: 6
Explanation: [4,-1,2,1] has the largest sum = 6.
Follow up:
If you have figured out the O(n) solutio... | [
"doctest.testmod"
] | [((1318, 1347), 'doctest.testmod', 'doctest.testmod', ([], {'verbose': '(True)'}), '(verbose=True)\n', (1333, 1347), False, 'import doctest\n')] |
#!/usr/bin/env python
# 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
# "L... | [
"sys.path.insert",
"numpy.random.rand",
"mxnet.nd.zeros",
"mxnet.nd.ones",
"numpy.arange",
"numpy.array",
"numpy.random.randint",
"numpy.argwhere",
"mxnet.kv.create",
"numpy.random.seed",
"mxnet.random.seed",
"mxnet.optimizer.create",
"mxnet.nd.array"
] | [((840, 875), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../../python/"""'], {}), "(0, '../../python/')\n", (855, 875), False, 'import sys\n'), ((1270, 1295), 'mxnet.kv.create', 'mx.kv.create', (['"""dist_sync"""'], {}), "('dist_sync')\n", (1282, 1295), True, 'import mxnet as mx\n'), ((1388, 1409), 'mxnet.nd.on... |
"""Read Schedule .tub file and store as events. Also create branch-file.
"""
from datetime import datetime
import roxar_api_utils.events
# -------------------------------------------------
# Script parameters
# Output event set. Set overwrite flag to False to merge with existing events.
eset_out = 'Sched... | [
"datetime.datetime"
] | [((670, 690), 'datetime.datetime', 'datetime', (['(1990)', '(1)', '(1)'], {}), '(1990, 1, 1)\n', (678, 690), False, 'from datetime import datetime\n')] |
# coding: utf-8
import os
MODULE_DIR = os.path.abspath(os.path.dirname(__file__))
DATA_DIR = os.path.join(MODULE_DIR, "data")
from . import form, utils
from .__meta__ import *
| [
"os.path.dirname",
"os.path.join"
] | [((94, 126), 'os.path.join', 'os.path.join', (['MODULE_DIR', '"""data"""'], {}), "(MODULE_DIR, 'data')\n", (106, 126), False, 'import os\n'), ((56, 81), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (71, 81), False, 'import os\n')] |
from django.contrib.sites.models import Site
SITE_CACHE = {}
def plugin_get_url(obj):
if getattr(obj, "page", None):
domain = '/'
title = obj.page.get_title_obj()
if title and title.path:
if obj.page.site_id != Site.objects.get_current().pk:
domain = 'http://%s... | [
"django.contrib.sites.models.Site.objects.get",
"django.contrib.sites.models.Site.objects.get_current"
] | [((544, 572), 'django.contrib.sites.models.Site.objects.get', 'Site.objects.get', ([], {'pk': 'site_id'}), '(pk=site_id)\n', (560, 572), False, 'from django.contrib.sites.models import Site\n'), ((254, 280), 'django.contrib.sites.models.Site.objects.get_current', 'Site.objects.get_current', ([], {}), '()\n', (278, 280)... |
import numpy as np
import torch
from PIL import Image
from skimage import exposure, morphology
from skimage.filters import threshold_otsu
from torch import nn
from torchvision import transforms
import inferno
from inferno.extensions.layers import ConvReLU2D
from inferno.extensions import model as inf_model
class All... | [
"torch.nn.Sigmoid",
"skimage.filters.threshold_otsu",
"inferno.extensions.model.ResBlockUNet",
"torch.Tensor",
"numpy.stack",
"skimage.exposure.rescale_intensity",
"numpy.percentile",
"skimage.morphology.binary_opening"
] | [((956, 979), 'numpy.stack', 'np.stack', (['input'], {'axis': '(0)'}), '(input, axis=0)\n', (964, 979), True, 'import numpy as np\n'), ((1360, 1384), 'numpy.stack', 'np.stack', (['result'], {'axis': '(0)'}), '(result, axis=0)\n', (1368, 1384), True, 'import numpy as np\n'), ((1935, 1959), 'skimage.filters.threshold_ots... |
import subprocess
import sys
import eventlet.queue
import eventlet.tpool
import eventlet.green.subprocess
from eventlet import green
from eventlet.greenpool import GreenPool
from .BaseTerminal import BaseTerminal
import logging
logger = logging.getLogger(__name__)
class SubprocessTerminal(BaseTerminal):
def __... | [
"logging.getLogger",
"eventlet.greenpool.GreenPool",
"eventlet.green.subprocess.Popen"
] | [((240, 267), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (257, 267), False, 'import logging\n'), ((529, 541), 'eventlet.greenpool.GreenPool', 'GreenPool', (['(5)'], {}), '(5)\n', (538, 541), False, 'from eventlet.greenpool import GreenPool\n'), ((3381, 3448), 'eventlet.green.subproces... |
import cx_Freeze
# name of the main game file
executables = [cx_Freeze.Executable("OpenField_TTT.py")]
cx_Freeze.setup(
# title of the application window
name="Open Field Tic Tac Toe with AI",
options={"build_exe": {"packages": ["pygame"],
# other files that are part of the proj... | [
"cx_Freeze.Executable",
"cx_Freeze.setup"
] | [((105, 398), 'cx_Freeze.setup', 'cx_Freeze.setup', ([], {'name': '"""Open Field Tic Tac Toe with AI"""', 'options': "{'build_exe': {'packages': ['pygame'], 'include_files': ['O.png', 'X.png',\n 'AI_algo_custom.py', 'ZealotOutline-rnMy.ttf', 'Gallant-2O1r3.ttf',\n 'TicTacToe.ttf', 'FrostbiteBossFight-dL0Z.ttf']}}... |
import torch.nn as nn
from Models.PathEncoder import PathEncoder
from Models.SequenceEncoder import SequenceEncoder
from Models.Transformer import Transformer
from Models.OperationMix import OperationMix
from torch.nn.utils.rnn import pad_packed_sequence, pack_padded_sequence, pack_sequence
import torch
class Encoder... | [
"Models.PathEncoder.PathEncoder",
"torch.split",
"torch.nn.init.xavier_uniform_",
"torch.nn.utils.rnn.pack_sequence",
"torch.Tensor",
"Models.SequenceEncoder.SequenceEncoder",
"Models.OperationMix.OperationMix",
"torch.nn.utils.rnn.pad_packed_sequence",
"torch.cat",
"Models.Transformer.Transformer... | [((552, 674), 'Models.PathEncoder.PathEncoder', 'PathEncoder', (['path_vocab_size', 'src_tgt_vocab_size', 'position_vocab_size', 'in_dim', 'h_dim', 'num_layers', 'dropout', 'padding_idx'], {}), '(path_vocab_size, src_tgt_vocab_size, position_vocab_size,\n in_dim, h_dim, num_layers, dropout, padding_idx)\n', (563, 67... |
'''OpenGL extension ARB.shadow_ambient
Automatically generated by the get_gl_extensions script, do not edit!
'''
from OpenGL import platform, constants, constant, arrays
from OpenGL import extensions
from OpenGL.GL import glget
import ctypes
EXTENSION_NAME = 'GL_ARB_shadow_ambient'
_DEPRECATED = False
GL_TEXTURE_COMPA... | [
"OpenGL.extensions.hasGLExtension",
"OpenGL.constant.Constant"
] | [((340, 401), 'OpenGL.constant.Constant', 'constant.Constant', (['"""GL_TEXTURE_COMPARE_FAIL_VALUE_ARB"""', '(32959)'], {}), "('GL_TEXTURE_COMPARE_FAIL_VALUE_ARB', 32959)\n", (357, 401), False, 'from OpenGL import platform, constants, constant, arrays\n'), ((520, 561), 'OpenGL.extensions.hasGLExtension', 'extensions.ha... |
from numpy import *
from scipy.linalg.basic import *
from scipy.linalg.decomp import *
from util import *
import cvxopt.coneprog;
from cvxopt.base import matrix, spmatrix
from cvxopt import solvers
import settings as S
def translate_matrix(t):
"""
Given a d-dim vector t, returns (d+1)x(d+1) matrix M such that
... | [
"cvxopt.base.spmatrix",
"cvxopt.solvers.sdp",
"cvxopt.base.matrix"
] | [((4608, 4656), 'cvxopt.base.spmatrix', 'spmatrix', (['vs', 'rs', 'cs', '((m + 1) * (m + 1), n + 1)'], {}), '(vs, rs, cs, ((m + 1) * (m + 1), n + 1))\n', (4616, 4656), False, 'from cvxopt.base import matrix, spmatrix\n'), ((5213, 5249), 'cvxopt.base.spmatrix', 'spmatrix', (['vs', 'rs', 'cs', '(k * k, n + 1)'], {}), '(v... |
from enum import Enum
from reconstruction.network import AE, SpiralDeblock, SpiralEnblock, Pool
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_scatter import scatter_add
from conv import SpiralConv, GatedSpiralConv
class SkipAE(nn.Module):
def __init__(self, in_channels, out_chann... | [
"reconstruction.network.SpiralEnblock",
"torch.nn.init.constant_",
"torch.nn.ModuleList",
"torch.nn.init.xavier_uniform_",
"torch.flatten",
"torch.nn.Linear",
"torch.reshape",
"reconstruction.network.SpiralDeblock",
"torch.cat"
] | [((867, 882), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (880, 882), True, 'import torch.nn as nn\n'), ((1530, 1545), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (1543, 1545), True, 'import torch.nn as nn\n'), ((3942, 3957), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (3955, 3... |
from exts import config
pos_channel_cooldown = [x.strip() for x in (config.get(
'cooldown channels', 'pos_channel')).split(",")]
bl_channel_cooldown = [x.strip() for x in (config.get(
'cooldown channels', 'bl_channel')).split(",")]
aoc_channel_cooldown = [x.strip() for x in (config.get(
'cooldown channel... | [
"exts.config.get"
] | [((69, 115), 'exts.config.get', 'config.get', (['"""cooldown channels"""', '"""pos_channel"""'], {}), "('cooldown channels', 'pos_channel')\n", (79, 115), False, 'from exts import config\n'), ((178, 223), 'exts.config.get', 'config.get', (['"""cooldown channels"""', '"""bl_channel"""'], {}), "('cooldown channels', 'bl_... |
import psutil
# cpu
cpu_info = psutil.cpu_times()
print("cpu执行用户进程时间: {}".format(cpu_info.user))
print("cpu执行系统调用时间: {}".format(cpu_info.system))
mem_info = psutil.virtual_memory()
print(mem_info)
print("总内存:{}".format(mem_info.total))
print("可用内存:{}".format(mem_info.available))
print("内存使用率: {}".format(mem_info.pe... | [
"psutil.swap_memory",
"psutil.disk_usage",
"psutil.virtual_memory",
"psutil.disk_partitions",
"psutil.cpu_times"
] | [((33, 51), 'psutil.cpu_times', 'psutil.cpu_times', ([], {}), '()\n', (49, 51), False, 'import psutil\n'), ((160, 183), 'psutil.virtual_memory', 'psutil.virtual_memory', ([], {}), '()\n', (181, 183), False, 'import psutil\n'), ((396, 420), 'psutil.disk_partitions', 'psutil.disk_partitions', ([], {}), '()\n', (418, 420)... |
import os
from os.path import abspath, dirname, join
from setuptools import setup, find_packages
INIT_FILE = join(dirname(abspath(__file__)), 'pydux', '__init__.py')
def long_description():
if os.path.exists('README.txt'):
return open('README.txt').read()
else:
return 'Python implementation of... | [
"os.path.abspath",
"os.path.exists"
] | [((199, 227), 'os.path.exists', 'os.path.exists', (['"""README.txt"""'], {}), "('README.txt')\n", (213, 227), False, 'import os\n'), ((123, 140), 'os.path.abspath', 'abspath', (['__file__'], {}), '(__file__)\n', (130, 140), False, 'from os.path import abspath, dirname, join\n')] |
import os
import pickle
import torch
import numpy as np
import matplotlib.pyplot as plt
from deluca.lung.controllers import ResidualExplorer, PID
from deluca.lung.environments import PhysicalLung
from deluca.lung.utils.data.analyzer import Analyzer
from deluca.lung.utils.core import BreathWaveform
from deluca.lung.ut... | [
"deluca.lung.utils.scripts.run_calibration.run_calibration",
"os.path.join",
"deluca.lung.utils.scripts.run_controller.run_controller",
"deluca.lung.environments.PhysicalLung",
"deluca.lung.utils.core.BreathWaveform",
"matplotlib.pyplot.rc"
] | [((441, 474), 'matplotlib.pyplot.rc', 'plt.rc', (['"""figure"""'], {'figsize': '(10, 3)'}), "('figure', figsize=(10, 3))\n", (447, 474), True, 'import matplotlib.pyplot as plt\n'), ((1248, 1286), 'deluca.lung.utils.scripts.run_calibration.run_calibration', 'run_calibration', (['R', 'C', 'PEEP', 'directory'], {}), '(R, ... |
# Copyright (c) 2019 PaddlePaddle Authors. 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 app... | [
"logging.warn",
"paddle.fluid.layers.elementwise_sub",
"six.moves.reduce",
"paddle.fluid.layers.rsqrt",
"paddle.fluid.layers.square",
"paddle.fluid.initializer.Constant",
"paddle.fluid.layers.elementwise_mul",
"paddle.fluid.layers.elementwise_add"
] | [((2784, 2827), 'paddle.fluid.layers.elementwise_sub', 'layers.elementwise_sub', ([], {'x': 'x', 'y': 'mean', 'axis': '(0)'}), '(x=x, y=mean, axis=0)\n', (2806, 2827), True, 'import paddle.fluid.layers as layers\n'), ((3053, 3091), 'paddle.fluid.layers.rsqrt', 'layers.rsqrt', (['(variance + self._epsilon)'], {}), '(var... |
# Copyright (c) 2020 freedesktop-sdk
#
# 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, dis... | [
"os.path.isfile",
"os.path.dirname",
"re.match",
"json.dump"
] | [((6020, 6040), 'os.path.isfile', 'os.path.isfile', (['path'], {}), '(path)\n', (6034, 6040), False, 'import os\n'), ((4502, 4564), 're.match', 're.match', (['"""(?P<tag>.*)-[0-9]+-g(?P<ref>.*)"""', 'source.mirror.ref'], {}), "('(?P<tag>.*)-[0-9]+-g(?P<ref>.*)', source.mirror.ref)\n", (4510, 4564), False, 'import re\n'... |
from django import template
from ..models import PythonTipHashTag
register = template.Library()
@register.inclusion_tag('apps/twee/includes/templatetags/hash_tags.html', name='hashtags_template')
def hash_tags_with_template():
tags = PythonTipHashTag.objects.all()
return {'hash_tags': tags}
@register.simp... | [
"django.template.Library"
] | [((79, 97), 'django.template.Library', 'template.Library', ([], {}), '()\n', (95, 97), False, 'from django import template\n')] |
# -*- coding: utf-8 -*-
from behave import *
import subprocess
import yaml
@when("validate template is run")
def step_impl(context):
context.response = subprocess.check_output([
"sceptre", "validate-template",
"test-env/a", "wait-condition-handle"
])
@then("the template is marked as valid")... | [
"subprocess.check_output",
"yaml.safe_load"
] | [((159, 259), 'subprocess.check_output', 'subprocess.check_output', (["['sceptre', 'validate-template', 'test-env/a', 'wait-condition-handle']"], {}), "(['sceptre', 'validate-template', 'test-env/a',\n 'wait-condition-handle'])\n", (182, 259), False, 'import subprocess\n'), ((365, 397), 'yaml.safe_load', 'yaml.safe_... |
# Copyright (C) 2019-2022, <NAME>.
# This program is licensed under the Apache License version 2.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0.txt> for full license details.
"""
Training script for semantic segmentation
"""
import datetime
import os
import time
import matplotlib.pyplot as plt... | [
"wandb.log",
"torch.nn.CrossEntropyLoss",
"torchvision.transforms.functional.to_pil_image",
"torch.initial_seed",
"holocron.optim.AdamP",
"numpy.iinfo",
"wandb.init",
"torchvision.transforms.ColorJitter",
"holocron.nn.MutualChannelLoss",
"transforms.Resize",
"os.cpu_count",
"transforms.ImageTr... | [((1475, 1519), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(2)', 'nb_samples'], {'figsize': '(20, 5)'}), '(2, nb_samples, figsize=(20, 5))\n', (1487, 1519), True, 'import matplotlib.pyplot as plt\n'), ((2090, 2100), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2098, 2100), True, 'import matplotlib.pyp... |
import datetime
now = datetime.datetime.now()
print(now)
print(now.astimezone())
| [
"datetime.datetime.now"
] | [((22, 45), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (43, 45), False, 'import datetime\n')] |
"""This module is a Crazyflie Checker"""
import logging
import sys
import cflib.crtp
import colorama
from prompt_toolkit import prompt
from prompt_toolkit.history import FileHistory
from prompt_toolkit.shortcuts import checkboxlist_dialog
from prompt_toolkit.completion import WordCompleter
from prompt_toolkit.valida... | [
"logging.basicConfig",
"qualisys.check_qtm",
"lib.check_drone",
"prompt_toolkit.history.FileHistory",
"prompt_toolkit.validation.ValidationError",
"prompt_toolkit.shortcuts.checkboxlist_dialog",
"prompt_toolkit.completion.WordCompleter",
"sys.exit",
"colorama.init"
] | [((447, 476), 'colorama.init', 'colorama.init', ([], {'autoreset': '(True)'}), '(autoreset=True)\n', (460, 476), False, 'import colorama\n'), ((561, 601), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.ERROR'}), '(level=logging.ERROR)\n', (580, 601), False, 'import logging\n'), ((1728, 1754), 'pr... |
# THIS IS A TESTING FILE AND IS NOT PART OF THE PROJECT
# The code below can be called from a diffrerent file with import face_recon
# and webcam_detection(numpy_array_image, user_name)
# If you want to test this file on your own make sure you install face_recognition lib (tutorial found on Trello board)
# and also... | [
"face_recognition.face_locations",
"face_recognition.face_distance",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"face_recognition.compare_faces",
"face_recognition.face_encodings",
"numpy.argmin",
"cv2.resize",
"cv2.waitKey"
] | [((533, 552), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (549, 552), False, 'import cv2\n'), ((3061, 3084), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (3082, 3084), False, 'import cv2\n'), ((642, 686), 'face_recognition.face_encodings', 'face_recognition.face_encodings', ([... |
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 12 09:22:40 2020
@author: lenovouser
"""
from sklearn import datasets
from sklearn.linear_model import LinearRegression
import matplotlib.pyplot as plt
loaded_data = datasets.load_boston()
data_X = loaded_data.data
data_y = loaded_data.target
model = LinearRegression(T... | [
"sklearn.datasets.make_regression",
"sklearn.datasets.load_boston",
"matplotlib.pyplot.scatter",
"sklearn.linear_model.LinearRegression",
"matplotlib.pyplot.show"
] | [((216, 238), 'sklearn.datasets.load_boston', 'datasets.load_boston', ([], {}), '()\n', (236, 238), False, 'from sklearn import datasets\n'), ((302, 341), 'sklearn.linear_model.LinearRegression', 'LinearRegression', (['(True)', '(True)'], {'n_jobs': '(-1)'}), '(True, True, n_jobs=-1)\n', (318, 341), False, 'from sklear... |
##
## setup1.py
##
from functools import reduce
class Card:
"""
Represents a card from a "standard" deck of playing cards that consists
of 52 Cards in each of the 4 suits of Spades, Hearts, Diamonds, and Clubs.
Each suit contains 13 cards named:
Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King.... | [
"functools.reduce"
] | [((3661, 3699), 'functools.reduce', 'reduce', (['(lambda x, y: x + y)', 'score_list'], {}), '(lambda x, y: x + y, score_list)\n', (3667, 3699), False, 'from functools import reduce\n')] |
import logging
from datetime import datetime
from banal import is_mapping, ensure_list
from followthemoney import model
from followthemoney.exc import InvalidData
from followthemoney.helpers import remove_checksums
from aleph.logic.collections import index_aggregator, refresh_collection
from aleph.logic.aggregator imp... | [
"logging.getLogger",
"followthemoney.exc.InvalidData",
"datetime.datetime.utcnow",
"aleph.logic.collections.index_aggregator",
"followthemoney.model.get_proxy",
"banal.ensure_list",
"aleph.logic.collections.refresh_collection",
"banal.is_mapping",
"followthemoney.helpers.remove_checksums",
"aleph.... | [((384, 411), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (401, 411), False, 'import logging\n'), ((1006, 1032), 'aleph.logic.aggregator.get_aggregator', 'get_aggregator', (['collection'], {}), '(collection)\n', (1020, 1032), False, 'from aleph.logic.aggregator import get_aggregator\n'... |
import os
import sys
import datetime
import math
def sleep():
print("Going to sleep")
sys.exit()
def shutdown(platform):
print("Shutting down")
if platform == "win32":
os.system("shutdown /p /f")
if platform == "linux" or "darwin" or "linux2":
os.system("poweroff")
def screenshot... | [
"psutil.cpu_percent",
"os.makedirs",
"pyautogui.screenshot",
"datetime.datetime.now",
"os.path.isdir",
"psutil.sensors_battery",
"sys.exit",
"os.startfile",
"os.system",
"wikipedia.summary"
] | [((95, 105), 'sys.exit', 'sys.exit', ([], {}), '()\n', (103, 105), False, 'import sys\n'), ((365, 387), 'pyautogui.screenshot', 'pyautogui.screenshot', ([], {}), '()\n', (385, 387), False, 'import pyautogui\n'), ((637, 662), 'os.path.isdir', 'os.path.isdir', (['folderPath'], {}), '(folderPath)\n', (650, 662), False, 'i... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm, t
np.random.seed(1)
#%%
N = 1_0
mu = 5
sd = 2
#%%
x = np.random.randn(N)*sd + mu
#%% Z-CI
mu_hat = x.mean()
sigma_hat = x.std(ddof=1)
z_left = norm.ppf(0.0250)
z_right = norm.ppf(0.9750)
left_ci = mu_hat + z_left*sigma_hat/np.sqrt(N)
ri... | [
"numpy.mean",
"numpy.sqrt",
"scipy.stats.norm.ppf",
"numpy.random.seed",
"numpy.random.randn",
"scipy.stats.t.ppf"
] | [((83, 100), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (97, 100), True, 'import numpy as np\n'), ((227, 242), 'scipy.stats.norm.ppf', 'norm.ppf', (['(0.025)'], {}), '(0.025)\n', (235, 242), False, 'from scipy.stats import norm, t\n'), ((254, 269), 'scipy.stats.norm.ppf', 'norm.ppf', (['(0.975)'], {... |
import numpy as np
# Creating vectors (unidimensional arrays)
vector_a = np.arange(5) # 0 to 4 array
vector_b = np.arange(start=3, stop=7, step=1) # start, stop, step
vector_c = np.arange(11, 1, -2)
vector_d = np.linspace(start=0, stop=1, num=11) # Automatic step calculation with explicit array length definition (thi... | [
"numpy.ones",
"numpy.full_like",
"numpy.array",
"numpy.linspace",
"numpy.zeros",
"numpy.full",
"numpy.arange"
] | [((75, 87), 'numpy.arange', 'np.arange', (['(5)'], {}), '(5)\n', (84, 87), True, 'import numpy as np\n'), ((114, 148), 'numpy.arange', 'np.arange', ([], {'start': '(3)', 'stop': '(7)', 'step': '(1)'}), '(start=3, stop=7, step=1)\n', (123, 148), True, 'import numpy as np\n'), ((180, 200), 'numpy.arange', 'np.arange', ([... |
#!/usr/bin/env python
""" Read out the telegram my smart meter sends me over it's P1-port every 10
seconds. """
import serial
import sys
import re
from time import time
from collections import namedtuple
# Contains parsed lines.
Line = namedtuple('Line', 'id value unit line')
# This should match every line in the te... | [
"collections.namedtuple",
"re.compile",
"re.match",
"serial.Serial",
"time.time"
] | [((238, 278), 'collections.namedtuple', 'namedtuple', (['"""Line"""', '"""id value unit line"""'], {}), "('Line', 'id value unit line')\n", (248, 278), False, 'from collections import namedtuple\n'), ((396, 441), 're.compile', 're.compile', (['"""(.*)\\\\(([^\\\\*]*)(?:\\\\*(.*))?\\\\)"""'], {}), "('(.*)\\\\(([^\\\\*]*... |
from .exceptions import *
import random
# Complete with your own, just for fun :)
LIST_OF_WORDS = []
""" Mask word"""
def _mask_word(word):
if word =='':
raise InvalidWordException
else:
mask_word = '*' * len(word)
return mask_word
""" Uncover word """
def _uncover_word(answer_word, masked_w... | [
"random.choice"
] | [((1264, 1292), 'random.choice', 'random.choice', (['list_of_words'], {}), '(list_of_words)\n', (1277, 1292), False, 'import random\n')] |
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# PYTHON VERSION OF MATTHEW LEONAWICZ's DOF/DOT/LOGS R Script
# --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
# Author: <NAME> -- 2019 -- <EMAIL>
# LICENSE: MIT
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
def tfg_days( ... | [
"numpy.array",
"numpy.arange",
"os.path.exists",
"numpy.where",
"itertools.product",
"numpy.ctypeslib.as_array",
"numpy.diff",
"numpy.concatenate",
"rasterio.open",
"numpy.warnings.filterwarnings",
"os.path.dirname",
"numpy.isnan",
"numpy.sign",
"multiprocessing.sharedctypes.RawArray",
"... | [((765, 775), 'numpy.sign', 'np.sign', (['x'], {}), '(x)\n', (772, 775), True, 'import numpy as np\n'), ((946, 961), 'numpy.where', 'np.where', (['(s < 0)'], {}), '(s < 0)\n', (954, 961), True, 'import numpy as np\n'), ((5722, 5748), 'numpy.array', 'np.array', (['[dof, dot, grow]'], {}), '([dof, dot, grow])\n', (5730, ... |
from rest_framework import routers
from api import views as api_views
router = routers.DefaultRouter()
router.register(r'users', api_views.UserViewSet)
router.register(r'tokens', api_views.TokenViewSet)
router.register(r'settings', api_views.SettingViewSet)
router.register(r'custom_commands', api_views.CustomCommandsV... | [
"rest_framework.routers.DefaultRouter"
] | [((80, 103), 'rest_framework.routers.DefaultRouter', 'routers.DefaultRouter', ([], {}), '()\n', (101, 103), False, 'from rest_framework import routers\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2018-04-07 17:23
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('productos', '0004_auto_20180407_1210'),
]
operations = [
migrations.AddField... | [
"django.db.models.DateTimeField",
"django.db.models.CharField",
"django.db.models.IntegerField"
] | [((413, 455), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(11)', 'null': '(True)'}), '(max_length=11, null=True)\n', (429, 455), False, 'from django.db import migrations, models\n'), ((574, 617), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(150)', 'null': '(True)'})... |
import socket
import sys
import threading
import base64
import pytesseract as ocr
import numpy as np
import cv2
import struct
from PIL import Image
hostname = "redesb.space"
HOST = socket.gethostbyname(hostName) # Symbolic name meaning all available interfaces
PORT = 9666 # Arbitrary non-privileged port
H... | [
"socket.gethostbyname",
"PIL.Image.fromarray",
"sys.exit",
"PIL.Image.open",
"socket.socket",
"cv2.threshold",
"numpy.asarray",
"base64.b64decode",
"numpy.array",
"cv2.cvtColor",
"pytesseract.image_to_string"
] | [((193, 223), 'socket.gethostbyname', 'socket.gethostbyname', (['hostName'], {}), '(hostName)\n', (213, 223), False, 'import socket\n'), ((326, 352), 'socket.gethostbyname', 'socket.gethostbyname', (['HOST'], {}), '(HOST)\n', (346, 352), False, 'import socket\n'), ((376, 425), 'socket.socket', 'socket.socket', (['socke... |
import subprocess
import sys
def main():
tox = subprocess.run(["poetry", "run", "tox", "-q"])
sys.exit(tox.returncode)
if __name__ == "__main__":
main()
| [
"subprocess.run",
"sys.exit"
] | [((53, 99), 'subprocess.run', 'subprocess.run', (["['poetry', 'run', 'tox', '-q']"], {}), "(['poetry', 'run', 'tox', '-q'])\n", (67, 99), False, 'import subprocess\n'), ((104, 128), 'sys.exit', 'sys.exit', (['tox.returncode'], {}), '(tox.returncode)\n', (112, 128), False, 'import sys\n')] |
# -*- coding: UTF-8 -*-
"""
Flask-VueSFC
-------------
Flask extension for rendering Vue.js SFCs
"""
try:
from setuptools import setup
except:
from distutils.core import setup
import codecs
version = '0.1.3'
setup(
name='Flask-VueSFC',
version=version,
url='https://github.com/michaelbukachi/flas... | [
"codecs.open"
] | [((481, 520), 'codecs.open', 'codecs.open', (['"""README.rst"""', '"""r"""', '"""utf-8"""'], {}), "('README.rst', 'r', 'utf-8')\n", (492, 520), False, 'import codecs\n')] |
import os.path
from pathlib import Path
from inspect import signature
import torch
import numpy as np
__all__ = [
"Callback",
"ModelSaver",
"Logger",
"EarlyStopping",
"VarianceBasedEarlyStopping",
"MetricEvaluator"
]
class Callback:
"""Base class for callbacks."""
def on_train_star... | [
"inspect.signature",
"torch.save",
"pathlib.Path"
] | [((6571, 6588), 'pathlib.Path', 'Path', (['folder_path'], {}), '(folder_path)\n', (6575, 6588), False, 'from pathlib import Path\n'), ((7001, 7032), 'torch.save', 'torch.save', (['metadata', 'save_path'], {}), '(metadata, save_path)\n', (7011, 7032), False, 'import torch\n'), ((3481, 3494), 'inspect.signature', 'signat... |
from amqp_aio.amqp.amqp_types import NoField, ShortString, Boolean, FieldTable, \
LongInt
from amqp_aio.amqp.base_frame import FrameField
from amqp_aio.amqp.consts import QUEUE_CLASS_ID, QUEUE_DECLARE_ID, \
QUEUE_DECLARE_OK_ID, QUEUE_BIND_ID, QUEUE_BIND_OK_ID, QUEUE_UNBIND_ID, \
QUEUE_UNBIND_OK_ID, QUEUE_P... | [
"amqp_aio.amqp.base_frame.FrameField"
] | [((849, 868), 'amqp_aio.amqp.base_frame.FrameField', 'FrameField', (['NoField'], {}), '(NoField)\n', (859, 868), False, 'from amqp_aio.amqp.base_frame import FrameField\n'), ((881, 904), 'amqp_aio.amqp.base_frame.FrameField', 'FrameField', (['ShortString'], {}), '(ShortString)\n', (891, 904), False, 'from amqp_aio.amqp... |
from aiohttp import web
from redbull import Manager
mg = Manager(web.Application())
@mg.api()
async def say_hi(name: str, please: bool):
"Says hi if you say please"
if please:
return 'hi ' + name
return 'um hmm'
mg.run()
| [
"aiohttp.web.Application"
] | [((67, 84), 'aiohttp.web.Application', 'web.Application', ([], {}), '()\n', (82, 84), False, 'from aiohttp import web\n')] |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe, json, erpnext
from frappe import _
from frappe.utils import flt, getdate, nowdate, add_days
from erpnext.controllers.acco... | [
"erpnext.accounts.general_ledger.make_gl_entries",
"frappe.get_doc",
"frappe.db.exists",
"frappe.db.get_value",
"frappe.db.sql",
"erpnext.get_default_cost_center",
"frappe.utils.flt",
"frappe.new_doc",
"json.loads",
"frappe.whitelist",
"frappe.bold",
"frappe.utils.nowdate",
"frappe.get_cache... | [((8097, 8115), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (8113, 8115), False, 'import frappe, json, erpnext\n'), ((8640, 9021), 'frappe.db.sql', 'frappe.db.sql', (['("""\n\t\tselect\n\t\t\tname as sales_invoice,\n\t\t\tcustomer,\n\t\t\tposting_date,\n\t\t\toutstanding_amount,\n\t\t\tdebit_to\n\t\tfrom ... |
import requests
from bs4 import BeautifulSoup
import threading
from collections import Counter
def textGetter(link):
'''
Returns all the text from a wepage of a given link.
'''
r = requests.get(link)
# grabs web content as BeautifulSoup object
soup = BeautifulSoup(r.content, 'html.parser')
... | [
"collections.Counter",
"threading.Thread",
"bs4.BeautifulSoup",
"requests.get"
] | [((579, 588), 'collections.Counter', 'Counter', ([], {}), '()\n', (586, 588), False, 'from collections import Counter\n'), ((1123, 1160), 'threading.Thread', 'threading.Thread', ([], {'target': 'recordQuotes'}), '(target=recordQuotes)\n', (1139, 1160), False, 'import threading\n'), ((1166, 1203), 'threading.Thread', 't... |
import time
import os
import random
import re
from decorator import decorator
from functools import partial
from shorty.logger import logger
class AttemptsExceededError(Exception):
pass
class MaxDelayExceededError(Exception):
pass
class BlankException(Exception):
pass
def __retry_interval(
f,
... | [
"random.uniform",
"re.compile",
"re.match",
"time.sleep",
"functools.partial"
] | [((4656, 4875), 're.compile', 're.compile', (['"""^(?:http|ftp)s?://(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\\\\.)+(?:[A-Z]{2,6}\\\\.?|[A-Z0-9-]{2,}\\\\.?)|localhost|\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3})(?::\\\\d+)?(?:/?|[/?]\\\\S+)$"""', 're.IGNORECASE'], {}), "(\n '^(?:http|ftp)s?://(?:(?:[A-Z... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2018-01-30 13:02
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
dependencies = [
... | [
"django.db.models.DateTimeField",
"django.db.models.AutoField"
] | [((505, 598), '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", (521, 598), False, 'from django.db import migrations, models\... |
import pandas as pd
import numpy as np
from unidecode import unidecode
import os
from src import config
def get_tweets_csv(csv_path: str) -> np.array:
df = pd.read_csv(csv_path)
X = df['text'].apply(lambda row: unidecode(row)).to_numpy()
return X
def get_tweets_df(df) -> np.array:
X = df['text'].ap... | [
"pandas.read_csv",
"unidecode.unidecode"
] | [((163, 184), 'pandas.read_csv', 'pd.read_csv', (['csv_path'], {}), '(csv_path)\n', (174, 184), True, 'import pandas as pd\n'), ((222, 236), 'unidecode.unidecode', 'unidecode', (['row'], {}), '(row)\n', (231, 236), False, 'from unidecode import unidecode\n'), ((336, 350), 'unidecode.unidecode', 'unidecode', (['row'], {... |
from haro.plugins.alias_models import UserAliasName
from haro.slack import get_slack_id_by_name
def get_slack_id(session, user_name):
"""指定したユーザー名のSlackのuser_idを返す
Slackのユーザー名として存在すればAPIからuser_idを取得
取得できない場合、user_alias_nameにエイリアス名として登録されたユーザー名であれば、
それに紐づくSlackのuser_idを返す
:params session: sqlalch... | [
"haro.slack.get_slack_id_by_name"
] | [((393, 424), 'haro.slack.get_slack_id_by_name', 'get_slack_id_by_name', (['user_name'], {}), '(user_name)\n', (413, 424), False, 'from haro.slack import get_slack_id_by_name\n')] |
"""Module dedicated to framework testing."""
import pytest
import typing as t
import numpy as np
import sklearn.tree
from pymfe import _internal
from pymfe.mfe import MFE
from . import utils
GNAME = "framework-testing"
def summary_exception(values: np.ndarray,
raise_exception: bool = False) -... | [
"pymfe._internal.summarize",
"numpy.array",
"numpy.arange",
"numpy.random.seed",
"pymfe.mfe.MFE",
"numpy.allclose",
"numpy.ones",
"numpy.isnan",
"pytest.raises",
"numpy.copy",
"numpy.isclose",
"pymfe.mfe.MFE.metafeature_description",
"numpy.unique",
"numpy.logical_and",
"pytest.mark.para... | [((8086, 8979), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""groups, summary"""', "[('statistical', 'all'), ('general', 'all'), ('landmarking', 'all'), (\n 'relative', 'all'), ('model-based', 'all'), ('info-theory', 'all'), (\n 'statistical', ('mean', 'sd')), ('general', ('mean', 'sd')), (\n 'la... |
"""This submodule handles all interaction with the LALSuite C API.
It provides a class for inputs and a class for outputs and functions for
reading/writing/comparing them. The inputs method has a 'run' method
for calling the C API.
"""
import numpy as np
import glob
import math
import lal_cuda
# Generate mocks for... | [
"numpy.fromfile",
"lal_cuda.log.error",
"lal_cuda.import_mock_RTD",
"lal_cuda.log.warning",
"numpy.array",
"lal_cuda.log.comment",
"lal_cuda.log.open",
"math.fabs",
"numpy.array_equal",
"numpy.linspace",
"lal_cuda.log.close",
"lal_cuda.full_path_datafile"
] | [((360, 391), 'lal_cuda.import_mock_RTD', 'lal_cuda.import_mock_RTD', (['"""lal"""'], {}), "('lal')\n", (384, 391), False, 'import lal_cuda\n'), ((408, 449), 'lal_cuda.import_mock_RTD', 'lal_cuda.import_mock_RTD', (['"""lalsimulation"""'], {}), "('lalsimulation')\n", (432, 449), False, 'import lal_cuda\n'), ((2221, 224... |
# Copyright (c) 2021 - present / Neuralmagic, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | [
"torch.nn.functional.mse_loss",
"os.getenv",
"flaky.flaky",
"tests.sparseml.pytorch.sparsification.pruning.helpers.pruning_modifier_serialization_vals_test",
"sparseml.pytorch.sparsification.pruning.MFACPruningModifier.load_obj",
"sparseml.pytorch.utils.tensor_sparsity",
"pytest.mark.parametrize",
"to... | [((2019, 2050), 'flaky.flaky', 'flaky', ([], {'max_runs': '(3)', 'min_passes': '(2)'}), '(max_runs=3, min_passes=2)\n', (2024, 2050), False, 'from flaky import flaky\n'), ((3378, 3427), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""model_lambda"""', '[MLPNet]'], {}), "('model_lambda', [MLPNet])\n", (3401,... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import warnings
import glob
import csv
from builtins import str
from typing import Any
from typing import Dict
from typing import Optional
from typing import Te... | [
"rasa_nlu.utils.as_text_type",
"csv.DictReader",
"builtins.str"
] | [((1680, 1708), 'rasa_nlu.utils.as_text_type', 'utils.as_text_type', (['entity_a'], {}), '(entity_a)\n', (1698, 1708), False, 'from rasa_nlu import utils\n'), ((1735, 1763), 'rasa_nlu.utils.as_text_type', 'utils.as_text_type', (['entity_b'], {}), '(entity_b)\n', (1753, 1763), False, 'from rasa_nlu import utils\n'), ((4... |
#!/usr/bin/env python
import itertools
import os
import signal
import socket
import subprocess
import sys
import uuid
from contextlib import contextmanager
from functools import partial
from threading import Thread
import click
from dask.distributed import Client, as_completed
def timed_wait_proc(proc, timeout):
... | [
"click.argument",
"os.kill",
"click.option",
"subprocess.Popen",
"itertools.product",
"os.path.splitext",
"os.environ.copy",
"uuid.uuid4",
"dask.distributed.Client",
"functools.partial",
"os.path.abspath",
"threading.Thread",
"os.read",
"click.command",
"socket.gethostname",
"dask.dist... | [((5423, 5438), 'click.command', 'click.command', ([], {}), '()\n', (5436, 5438), False, 'import click\n'), ((5565, 5671), 'click.option', 'click.option', (['"""-l"""', '"""--log-file"""'], {'default': 'None', 'required': '(False)', 'help': '"""Save console log to this file."""'}), "('-l', '--log-file', default=None, r... |
from threading import Timer
from time import sleep
import pytest
from chouette_iot import Cancellable, Scheduler
PERIODIC_JOB_METHODS = (
Scheduler.schedule_at_fixed_rate,
Scheduler.schedule_with_fixed_delay,
)
@pytest.fixture(scope="module", params=PERIODIC_JOB_METHODS)
def periodic_job_method(request):
... | [
"chouette_iot.Cancellable",
"chouette_iot.Scheduler.schedule_at_fixed_rate",
"threading.Timer",
"time.sleep",
"chouette_iot.Scheduler.stop_all",
"pytest.fixture",
"chouette_iot.Scheduler.schedule_once"
] | [((225, 284), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""', 'params': 'PERIODIC_JOB_METHODS'}), "(scope='module', params=PERIODIC_JOB_METHODS)\n", (239, 284), False, 'import pytest\n'), ((996, 1014), 'chouette_iot.Cancellable', 'Cancellable', (['timer'], {}), '(timer)\n', (1007, 1014), False, 'from... |
import numpy as np
import gym
from gym.spaces import Discrete
from gym import utils
from gym.utils import seeding
class State:
ZERO = 0
ONE = 1
TWO = 2
THREE = 3
FOUR = 4
class Action:
A = 0
B = 1
class Chain(gym.Env, utils.EzPickle):
def __init__(self, random_slip_prob=True,
... | [
"numpy.array",
"IPython.embed",
"gym.spaces.Discrete",
"gym.utils.seeding.np_random"
] | [((3025, 3040), 'IPython.embed', 'IPython.embed', ([], {}), '()\n', (3038, 3040), False, 'import IPython\n'), ((807, 824), 'gym.spaces.Discrete', 'Discrete', (['self.nA'], {}), '(self.nA)\n', (815, 824), False, 'from gym.spaces import Discrete\n'), ((858, 875), 'gym.spaces.Discrete', 'Discrete', (['self.nS'], {}), '(se... |
import cv2
import numpy as np
import scipy
from scipy import fftpack, signal
from sklearn.neighbors import ball_tree
from scipy.sparse import spdiags
import matplotlib.pyplot as plt
def sinc_psf(window_size=15, edge=15/4):
x = np.expand_dims(np.linspace(-edge, edge, window_size),axis=0)
s = np.sinc(x.T @ x)
... | [
"numpy.array",
"numpy.linalg.norm",
"numpy.arange",
"matplotlib.pyplot.imshow",
"numpy.float64",
"numpy.exp",
"scipy.fftpack.fft2",
"numpy.linspace",
"numpy.meshgrid",
"matplotlib.pyplot.cla",
"scipy.signal.convolve2d",
"numpy.abs",
"numpy.tile",
"matplotlib.pyplot.savefig",
"sklearn.nei... | [((302, 318), 'numpy.sinc', 'np.sinc', (['(x.T @ x)'], {}), '(x.T @ x)\n', (309, 318), True, 'import numpy as np\n'), ((442, 476), 'numpy.linspace', 'np.linspace', (['(-edge)', 'edge'], {'num': 'size'}), '(-edge, edge, num=size)\n', (453, 476), True, 'import numpy as np\n'), ((490, 509), 'numpy.meshgrid', 'np.meshgrid'... |
# CubETL
# Copyright (c) 2013-2019
# See AUTHORS and LICENSE files for more information.
# This file is part of the CubETL library.
# This file is meant to be included from other CubETL configuration files,
# it provides data types, schema and other objects.
from cubetl.olap import Dimension, Key, Attribute, Hierar... | [
"cubetl.text.RegExp",
"cubetl.table.CSVMemoryTable",
"cubetl.olap.Attribute",
"cubetl.olap.Hierarchy",
"cubetl.olap.Dimension",
"cubetl.olap.Measure"
] | [((875, 924), 'cubetl.olap.Dimension', 'Dimension', ([], {'name': '"""client_address"""', 'label': '"""Address"""'}), "(name='client_address', label='Address')\n", (884, 924), False, 'from cubetl.olap import Dimension, Key, Attribute, HierarchyDimension, Hierarchy, Fact, Measure, DimensionAttribute\n'), ((988, 1035), '... |
#!/usr/bin/python
"""
Author: <NAME> (<EMAIL>)
Description: stylizes an image using a generative model trained on a particular style
Args:
--input: path to the input image you'd like to apply a style to
--style: name of style (found in 'lib/generators') to apply to the input
--out:... | [
"tensorflow.expand_dims",
"generator.Generator",
"os.listdir",
"tensorflow.variable_scope",
"argparse.ArgumentParser",
"os.makedirs",
"tensorflow.Session",
"tensorflow.train.Saver",
"os.path.abspath",
"os.path.realpath",
"tensorflow.global_variables_initializer",
"os.path.isdir",
"helpers.re... | [((644, 670), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (660, 670), False, 'import os\n'), ((827, 865), 'os.path.isdir', 'os.path.isdir', (["(DIR_PATH + '/../output')"], {}), "(DIR_PATH + '/../output')\n", (840, 865), False, 'import os\n'), ((871, 907), 'os.makedirs', 'os.makedirs', ([... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 2 10:49:13 2020
@author: becker
"""
import numpy as np
import scipy
k = 3
d = 1
def sums(length, total_sum):
if length == 1:
yield (total_sum,)
else:
for value in range(total_sum + 1):
for permutation in sums(... | [
"numpy.array"
] | [((462, 484), 'numpy.array', 'np.array', (['i'], {'dtype': 'int'}), '(i, dtype=int)\n', (470, 484), True, 'import numpy as np\n')] |
import smtplib
import mimetypes
from email.message import EmailMessage
from rich.console import Console
def send(sender:str, password:str, receiver:str, attachment, subject="Title", body="Body", debug=False):
attachmentName = f"{attachment}"
message = EmailMessage()
message['From'] = sender
message[... | [
"mimetypes.guess_type",
"email.message.EmailMessage",
"rich.console.Console",
"smtplib.SMTP_SSL"
] | [((264, 278), 'email.message.EmailMessage', 'EmailMessage', ([], {}), '()\n', (276, 278), False, 'from email.message import EmailMessage\n'), ((420, 452), 'mimetypes.guess_type', 'mimetypes.guess_type', (['attachment'], {}), '(attachment)\n', (440, 452), False, 'import mimetypes\n'), ((759, 793), 'smtplib.SMTP_SSL', 's... |
# download so-simple.json from
# https://github.com/The-Sequence-Ontology/SO-Ontologies/tree/master/Ontology_Files
# or pull from
# https://github.com/SynBioDex/SBOLExplorer/blob/master/flask/so-simplified.json
import os
import json
import csv
cwd = os.getcwd()
path_in = os.path.join(cwd, "excel2sbol", "resources", "... | [
"json.loads",
"csv.writer",
"os.path.join",
"os.getcwd"
] | [((252, 263), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (261, 263), False, 'import os\n'), ((274, 365), 'os.path.join', 'os.path.join', (['cwd', '"""excel2sbol"""', '"""resources"""', '"""taxonomy_scrapers"""', '"""so-simplified.json"""'], {}), "(cwd, 'excel2sbol', 'resources', 'taxonomy_scrapers',\n 'so-simplifie... |
from functions import my_functions
my_functions.hello("s")
| [
"functions.my_functions.hello"
] | [((36, 59), 'functions.my_functions.hello', 'my_functions.hello', (['"""s"""'], {}), "('s')\n", (54, 59), False, 'from functions import my_functions\n')] |
# Copyright 2018 AT&T Intellectual Property. All other 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... | [
"logging.getLogger",
"urllib.parse.urlparse",
"service_endpoint.ucp_service_endpoint",
"airflow.exceptions.AirflowException",
"drydock_provisioner.drydock_client.client.DrydockClient",
"drydock_provisioner.drydock_client.session.DrydockSession",
"copy.copy",
"pprint.pprint"
] | [((1188, 1215), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1205, 1215), False, 'import logging\n'), ((5143, 5201), 'service_endpoint.ucp_service_endpoint', 'ucp_service_endpoint', (['self'], {'svc_type': 'self.drydock_svc_type'}), '(self, svc_type=self.drydock_svc_type)\n', (5163, 52... |
from pathlib import Path
from django.conf import settings
from django.core.files import File
from django.core.management.base import BaseCommand
from wagtail.core.models import Site, Locale
from wagtailmenus.models import FlatMenu
from wagtailsvg.models import Svg
from home.models import IogtFlatMenuItem
class Comm... | [
"wagtailsvg.models.Svg.objects.create",
"wagtail.core.models.Locale.objects.all",
"pathlib.Path",
"wagtailmenus.models.FlatMenu.objects.get_or_create",
"wagtail.core.models.Site.objects.get",
"home.models.IogtFlatMenuItem.objects.get_or_create"
] | [((393, 431), 'wagtail.core.models.Site.objects.get', 'Site.objects.get', ([], {'is_default_site': '(True)'}), '(is_default_site=True)\n', (409, 431), False, 'from wagtail.core.models import Site, Locale\n'), ((549, 569), 'wagtail.core.models.Locale.objects.all', 'Locale.objects.all', ([], {}), '()\n', (567, 569), Fals... |
import inspect
import torch.optim.lr_scheduler as lr_scheduler
from ocpmodels.common.utils import warmup_lr_lambda
class LRScheduler:
"""
Learning rate scheduler class for torch.optim learning rate schedulers
Notes:
If no learning rate scheduler is specified in the config the default
sc... | [
"ocpmodels.common.utils.warmup_lr_lambda",
"inspect.signature"
] | [((1839, 1872), 'inspect.signature', 'inspect.signature', (['self.scheduler'], {}), '(self.scheduler)\n', (1856, 1872), False, 'import inspect\n'), ((978, 1010), 'ocpmodels.common.utils.warmup_lr_lambda', 'warmup_lr_lambda', (['x', 'self.config'], {}), '(x, self.config)\n', (994, 1010), False, 'from ocpmodels.common.ut... |
import numpy as np
import pandas as pd
import os
from features import *
from util import *
# Handle datasets
def merge_data(key_list, array_list):
all_keys = np.array([kl[i] for kl in key_list for i in range(len(kl))])
all_keys_idxs = np.argsort(all_keys)
all_keys_sorted = np.sort(all_k... | [
"numpy.sort",
"os.path.join",
"numpy.argsort",
"numpy.empty",
"numpy.save"
] | [((263, 283), 'numpy.argsort', 'np.argsort', (['all_keys'], {}), '(all_keys)\n', (273, 283), True, 'import numpy as np\n'), ((307, 324), 'numpy.sort', 'np.sort', (['all_keys'], {}), '(all_keys)\n', (314, 324), True, 'import numpy as np\n'), ((505, 531), 'numpy.empty', 'np.empty', (['all_arrays_shape'], {}), '(all_array... |
import os
from glob import glob
import subprocess
import sys
import pathlib
import json
import yaml
import nbformat
import nbterm
import traceback
import asyncio
import config
import click
def get_toc_files(notebooks_only=True):
"""return a list of files in the _toc.yml"""
with open("_toc.yml") as fid:
... | [
"subprocess.check_output",
"os.path.exists",
"json.loads",
"traceback.format_exc",
"sys.exit",
"config.get",
"click.option",
"nbformat.read",
"pathlib.Path",
"subprocess.check_call",
"nbformat.write",
"io.open",
"os.getcwd",
"yaml.safe_load",
"nbterm.Notebook",
"os.path.basename",
"n... | [((4507, 4522), 'click.command', 'click.command', ([], {}), '()\n', (4520, 4522), False, 'import click\n'), ((4524, 4670), 'click.option', 'click.option', (['"""--notebook"""'], {'default': 'None', 'help': '"""Optionally select a particular notebook to run. If omitted, then all notebooks are run."""'}), "('--notebook',... |
import ujson
import re
import random
def rnd():
x = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
return "".join([random.choice(x) for _ in range(32)])
def write_to_json_file(name, data):
with open(name, 'w') as f:
ujson.dump(data, f, indent=4)
def write_to_te... | [
"ujson.dump",
"re.findall",
"random.choice"
] | [((270, 299), 'ujson.dump', 'ujson.dump', (['data', 'f'], {'indent': '(4)'}), '(data, f, indent=4)\n', (280, 299), False, 'import ujson\n'), ((1292, 1333), 're.findall', 're.findall', (['regex', 'response', 're.MULTILINE'], {}), '(regex, response, re.MULTILINE)\n', (1302, 1333), False, 'import re\n'), ((150, 166), 'ran... |
from django.contrib import admin
from .models import UserDetails
from .models import Contact
from .models import Book
from .models import Diagnostic
from .models import Report
# Register your models here.
admin.site.register(UserDetails)
admin.site.register(Contact)
admin.site.register(Book)
admin.site.register(Diag... | [
"django.contrib.admin.site.register"
] | [((208, 240), 'django.contrib.admin.site.register', 'admin.site.register', (['UserDetails'], {}), '(UserDetails)\n', (227, 240), False, 'from django.contrib import admin\n'), ((241, 269), 'django.contrib.admin.site.register', 'admin.site.register', (['Contact'], {}), '(Contact)\n', (260, 269), False, 'from django.contr... |
import pytest
from hydrosdk.image import DockerImage
@pytest.mark.parametrize("image", ["test:latest", "test:1", "www.registry.io/test:latest"])
def test_image_parsing(image):
parsed = DockerImage.from_string(image)
print(parsed)
assert parsed.name is not None
assert parsed.tag is not None
| [
"pytest.mark.parametrize",
"hydrosdk.image.DockerImage.from_string"
] | [((55, 149), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""image"""', "['test:latest', 'test:1', 'www.registry.io/test:latest']"], {}), "('image', ['test:latest', 'test:1',\n 'www.registry.io/test:latest'])\n", (78, 149), False, 'import pytest\n'), ((190, 220), 'hydrosdk.image.DockerImage.from_string',... |
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
import os
from PIL import Image
import imghdr
import base64
from io import BytesIO
import dash
from dash.dependencies import Input,Output,State
import dash_table
import dash_core_components as dcc
import dash_html_components as html
from dash.exceptions im... | [
"numpy.hstack",
"dash_html_components.Button",
"io.BytesIO",
"dash.dependencies.Input",
"numpy.array",
"dash_html_components.Div",
"dash.Dash",
"os.walk",
"dash.dependencies.Output",
"dash_html_components.Br",
"pandas.DataFrame",
"os.path.isfile",
"os.path.dirname",
"PIL.Image.fromarray",
... | [((624, 640), 'os.walk', 'os.walk', (['"""data/"""'], {}), "('data/')\n", (631, 640), False, 'import os\n'), ((2181, 2200), 'numpy.load', 'np.load', (['"""rank.npy"""'], {}), "('rank.npy')\n", (2188, 2200), True, 'import numpy as np\n'), ((2542, 2561), 'dash.Dash', 'dash.Dash', (['__name__'], {}), '(__name__)\n', (2551... |
# Generated by Django 2.1.8 on 2019-10-20 01:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api_v1', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='post',
name='map_lat',
field... | [
"django.db.models.ImageField",
"django.db.models.DecimalField"
] | [((321, 407), 'django.db.models.DecimalField', 'models.DecimalField', ([], {'decimal_places': '(7)', 'default': '(0)', 'max_digits': '(9)', 'verbose_name': '"""緯度"""'}), "(decimal_places=7, default=0, max_digits=9, verbose_name\n ='緯度')\n", (340, 407), False, 'from django.db import migrations, models\n'), ((521, 607... |
#!/usr/bin/python3
"""
Path: lab4_main.py
Author: <NAME> - <EMAIL>
Date: 2022-01-17
Description: Update the hosts file with new hosts from a file
**** CAUTION ****
This script will overwrite the hosts file without check if
the hosts are already in the file
This script will:
1. open the file specified in "new... | [
"lab4_libs.write_to_file",
"lab4_libs.get_hosts_from",
"lab4_libs.get_file_content",
"re.split"
] | [((659, 694), 'lab4_libs.get_hosts_from', 'lab4_libs.get_hosts_from', (['new_hosts'], {}), '(new_hosts)\n', (683, 694), False, 'import lab4_libs\n'), ((713, 751), 'lab4_libs.get_file_content', 'lab4_libs.get_file_content', (['hosts_file'], {}), '(hosts_file)\n', (739, 751), False, 'import lab4_libs\n'), ((1102, 1156), ... |
"""
.. moduleauthor:: <NAME>
.. module:: rbackup.script
:synopsis: library for common script operations
"""
import logging
from subprocess import CalledProcessError
import rbackup.config.config_files as config
import rbackup.rsync
import rbackup.system as system
# ========== Constants ==========
# ----- Error Co... | [
"logging.getLogger",
"rbackup.system.change_umask",
"rbackup.config.config_files.merge_include_files",
"rbackup.config.config_files.merge_exclude_files"
] | [((426, 453), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (443, 453), False, 'import logging\n'), ((1871, 1902), 'rbackup.system.change_umask', 'system.change_umask', (['args.umask'], {}), '(args.umask)\n', (1890, 1902), True, 'import rbackup.system as system\n'), ((1918, 1946), 'rback... |
from django.shortcuts import get_object_or_404
from django.http import JsonResponse
from first_app.models import Student
from django.core.serializers import serialize
from django.views.decorators.csrf import csrf_exempt
import json
from rest_framework.response import Response
from rest_framework.decorators import api_v... | [
"json.loads",
"django.http.JsonResponse",
"first_app.models.Student.objects.create",
"django.shortcuts.get_object_or_404",
"first_app.models.Student.objects.count",
"first_app.models.Student.objects.all",
"rest_framework.response.Response",
"first_app.models.Student.objects.filter",
"django.core.ser... | [((3760, 3785), 'rest_framework.decorators.api_view', 'api_view', (["['GET', 'POST']"], {}), "(['GET', 'POST'])\n", (3768, 3785), False, 'from rest_framework.decorators import api_view\n'), ((5035, 5069), 'rest_framework.decorators.api_view', 'api_view', (["['GET', 'PUT', 'DELETE']"], {}), "(['GET', 'PUT', 'DELETE'])\n... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# The MIT License
#
# Copyright (c) 2016 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Soft... | [
"pytest.fixture",
"mock.mock.patch",
"yagocd.resources.pipeline.PipelineInstance",
"mock.mock.MagicMock"
] | [((1579, 1595), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1593, 1595), False, 'import pytest\n'), ((1814, 1876), 'mock.mock.patch', 'mock.patch', (['"""yagocd.resources.pipeline.PipelineInstance.stage"""'], {}), "('yagocd.resources.pipeline.PipelineInstance.stage')\n", (1824, 1876), False, 'from mock impor... |
from django.shortcuts import render
from django.http import HttpResponse
from apps.inverted import main, main2, main3
# Create your views here.
# def index(request):
# return HttpResponse("Hello, world. You're at the polls index.")
def home(request):
return render(request, 'apps/home.html')
def index(request... | [
"django.shortcuts.render",
"apps.inverted.main2.detail",
"apps.inverted.main2.main",
"apps.inverted.main3.main",
"apps.inverted.main.main",
"apps.inverted.main3.detail",
"apps.inverted.main.detail"
] | [((268, 301), 'django.shortcuts.render', 'render', (['request', '"""apps/home.html"""'], {}), "(request, 'apps/home.html')\n", (274, 301), False, 'from django.shortcuts import render\n'), ((334, 368), 'django.shortcuts.render', 'render', (['request', '"""apps/index.html"""'], {}), "(request, 'apps/index.html')\n", (340... |
from sense_hat import SenseHat
sense = SenseHat()
sense.set_rotation(180)
sense.show_message("IoT Sensor Pack")
| [
"sense_hat.SenseHat"
] | [((39, 49), 'sense_hat.SenseHat', 'SenseHat', ([], {}), '()\n', (47, 49), False, 'from sense_hat import SenseHat\n')] |
import json
from falcon.testing import TestBase
from app import api
from app.config import API_KEY, CONTENT_TYPE_METHODS
HEADERS = {
'Content-Type': 'application/json',
'X-API-KEY': API_KEY
}
class APITestCase(TestBase):
def setUp(self):
super(APITestCase, self).setUp()
def _simulate_requ... | [
"json.dumps"
] | [((898, 914), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (908, 914), False, 'import json\n')] |
import pandas as pd
from tqdm import tqdm
tqdm.pandas()
import os
import glob
import json
import sys
import gzip
from helpers import create_folder_path, write_csv_file, write_list_to_txt, save_pk_file
def read_jsonl_file( file_name, columns):
"""
Read jsonl file and create a data frame of the requi... | [
"pandas.DataFrame.from_records",
"json.loads",
"helpers.write_csv_file",
"os.listdir",
"gzip.open",
"helpers.write_list_to_txt",
"pandas.merge",
"os.path.join",
"pandas.DataFrame",
"helpers.save_pk_file",
"tqdm.tqdm.pandas",
"pandas.concat"
] | [((44, 57), 'tqdm.tqdm.pandas', 'tqdm.pandas', ([], {}), '()\n', (55, 57), False, 'from tqdm import tqdm\n'), ((1836, 1872), 'pandas.merge', 'pd.merge', (['inst_df', 'truth_df'], {'on': '"""id"""'}), "(inst_df, truth_df, on='id')\n", (1844, 1872), True, 'import pandas as pd\n'), ((4275, 4312), 'helpers.write_csv_file',... |
from __future__ import absolute_import
from typing import List, Dict, Any, Optional
from tinydb import TinyDB, Query
from tinydb.operations import add, decrement, set
import logging
import random
db = TinyDB('../data/list.json', indent=4)
teamdata = Query()
file = '../teams/2020ICPCJinan'
f = open(file, 'r')
ranklist ... | [
"tinydb.operations.set",
"tinydb.Query",
"tinydb.TinyDB"
] | [((201, 238), 'tinydb.TinyDB', 'TinyDB', (['"""../data/list.json"""'], {'indent': '(4)'}), "('../data/list.json', indent=4)\n", (207, 238), False, 'from tinydb import TinyDB, Query\n'), ((250, 257), 'tinydb.Query', 'Query', ([], {}), '()\n', (255, 257), False, 'from tinydb import TinyDB, Query\n'), ((1438, 1484), 'tiny... |
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class User(db.Model):
user_id = db.Column(db.Integer, unique=True, primary_key=True)
username = db.Column(db.String(80), unique=True, nullable=False)
password = db.Column(db.String(64), nullable=False)
purchases = db.relationship('Purchase', b... | [
"flask_sqlalchemy.SQLAlchemy"
] | [((46, 58), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', ([], {}), '()\n', (56, 58), False, 'from flask_sqlalchemy import SQLAlchemy\n')] |
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 25 14:57:50 2019
@author: pustekdata-2
"""
import os, fnmatch, sys
if __name__ == "__main__":
diri=sys.argv[1]
file_filter = '*.tif'
alltif={}
for r,d,f in os.walk(diri, topdown=False):
for nama_tile in fnmatch.filter(f... | [
"os.path.join",
"os.path.isdir",
"os.mkdir",
"fnmatch.filter",
"os.walk"
] | [((248, 276), 'os.walk', 'os.walk', (['diri'], {'topdown': '(False)'}), '(diri, topdown=False)\n', (255, 276), False, 'import os, fnmatch, sys\n'), ((304, 334), 'fnmatch.filter', 'fnmatch.filter', (['f', 'file_filter'], {}), '(f, file_filter)\n', (318, 334), False, 'import os, fnmatch, sys\n'), ((358, 384), 'os.path.jo... |
from machine import Pin
from utime import sleep
led = Pin(25, Pin.OUT)
while True:
led.on()
sleep(0.5) # pause
led.off()
sleep(0.5) | [
"utime.sleep",
"machine.Pin"
] | [((55, 71), 'machine.Pin', 'Pin', (['(25)', 'Pin.OUT'], {}), '(25, Pin.OUT)\n', (58, 71), False, 'from machine import Pin\n'), ((102, 112), 'utime.sleep', 'sleep', (['(0.5)'], {}), '(0.5)\n', (107, 112), False, 'from utime import sleep\n'), ((139, 149), 'utime.sleep', 'sleep', (['(0.5)'], {}), '(0.5)\n', (144, 149), Fa... |
# -*- coding: utf-8 -*-
#
# -----------------------------------------------------------------------------------
# Copyright (c) Microsoft Open Technologies (Shanghai) Co. Ltd. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this softw... | [
"json.loads",
"urllib2.Request",
"hackathon.RequiredFeature",
"sys.path.append",
"urllib2.build_opener"
] | [((1421, 1442), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (1436, 1442), False, 'import sys\n'), ((1623, 1654), 'hackathon.RequiredFeature', 'RequiredFeature', (['"""user_manager"""'], {}), "('user_manager')\n", (1638, 1654), False, 'from hackathon import RequiredFeature, Component\n'), ((218... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# 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 ... | [
"easyb.log.error",
"sys.getsizeof",
"easyb.conf.get_error",
"math.floor"
] | [((1879, 1899), 'sys.getsizeof', 'sys.getsizeof', (['value'], {}), '(value)\n', (1892, 1899), False, 'import sys\n'), ((2211, 2231), 'sys.getsizeof', 'sys.getsizeof', (['value'], {}), '(value)\n', (2224, 2231), False, 'import sys\n'), ((2471, 2491), 'sys.getsizeof', 'sys.getsizeof', (['value'], {}), '(value)\n', (2484,... |
#__init__ file.
## TK opgl Window:
# An opengl frame for pyopengl-tkinter based on ctypes (no togl compilation)
#
# Collected together by <NAME>, Jan 2018.
#
# Based on the work of others:
# C + Tcl/Tk
# http://github.com/codeplea/opengl-tcltk/
# (zlib license)
# Article at:
# https://codeplea.com/opengl-with-c-and-t... | [
"OpenGL.GLX.glXQueryVersion",
"OpenGL.GL.glGetString",
"sys.platform.startswith",
"OpenGL.WGL.SwapBuffers",
"OpenGL.WGL.PIXELFORMATDESCRIPTOR",
"ctypes.WinDLL",
"time.sleep",
"OpenGL.GLX.glXCreateContext",
"OpenGL.GLU.gluProject",
"OpenGL.GL.glViewport",
"OpenGL.GL.glGetIntegerv",
"OpenGL.GL.g... | [((7425, 7457), 'sys.platform.startswith', 'sys.platform.startswith', (['"""win32"""'], {}), "('win32')\n", (7448, 7457), False, 'import sys, math, time, random\n'), ((9091, 9123), 'sys.platform.startswith', 'sys.platform.startswith', (['"""linux"""'], {}), "('linux')\n", (9114, 9123), False, 'import sys, math, time, r... |
import scrapy
from scrapy.loader.processors import MapCompose, TakeFirst
def get_autor(value):
editado_msg = ','
if editado_msg in value:
value = value.split(editado_msg)[0]
return value
def get_revisor(value):
editado_msg = ' por '
if editado_msg in value:
value = value.split(e... | [
"scrapy.loader.processors.TakeFirst",
"scrapy.Field",
"scrapy.loader.processors.MapCompose"
] | [((1338, 1352), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (1350, 1352), False, 'import scrapy\n'), ((1460, 1474), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (1472, 1474), False, 'import scrapy\n'), ((562, 573), 'scrapy.loader.processors.TakeFirst', 'TakeFirst', ([], {}), '()\n', (571, 573), False, 'from ... |
#!python
#cython: language_level=3
""""""
#
# Libraries - native
#
import pprint
import sys
import time
#
# Libraries - native - collections
#
# Used for node traversals
from collections import deque
# Used to elaborate on raised exceptions
from collections.abc import Hashable
# Base class for Data_tree_node
from col... | [
"sys._getframe",
"collections.deque",
"pprint.PrettyPrinter",
"time.sleep"
] | [((960, 1013), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {'compact': '(True)', 'indent': '(2)', 'width': '(1)'}), '(compact=True, indent=2, width=1)\n', (980, 1013), False, 'import pprint\n'), ((17672, 17711), 'collections.deque', 'deque', (['[[_node_start, _dict_from_tree]]'], {}), '([[_node_start, _dict_fr... |
import os
import urllib.parse
from pelican import signals, contents
# Generate an XML sitemap for the blog
# The XML sitemap is NOT manually sent to Google but it is publicaly
# available
# The output filename
FILENAME = 'sitemap.xml'
# Table for change frequencies
# These are default values that can be overriden i... | [
"pelican.signals.get_generators.connect",
"os.path.join"
] | [((4356, 4402), 'pelican.signals.get_generators.connect', 'signals.get_generators.connect', (['get_generators'], {}), '(get_generators)\n', (4386, 4402), False, 'from pelican import signals, contents\n'), ((2608, 2648), 'os.path.join', 'os.path.join', (['self.output_path', 'FILENAME'], {}), '(self.output_path, FILENAME... |
from xfit.fitting import fit_dataArray, fit_dataArray_models, fit_dataset
import numpy as np
import xarray as xr
from xarray.testing import assert_equal, assert_allclose
bs = xr.DataArray(np.linspace(0,10,6), coords={'b_true': np.linspace(0,10,6)}, dims='b_true')
xs = xr.DataArray(np.linspace(0,10,11), coords={'x': ... | [
"numpy.mean",
"numpy.ones",
"xfit.fitting.fit_dataset",
"xarray.Dataset",
"numpy.linspace",
"numpy.zeros",
"xarray.full_like",
"xfit.fitting.fit_dataArray",
"xarray.testing.assert_equal",
"numpy.arange"
] | [((544, 570), 'xarray.Dataset', 'xr.Dataset', (["{'data': data}"], {}), "({'data': data})\n", (554, 570), True, 'import xarray as xr\n'), ((1231, 1272), 'xarray.full_like', 'xr.full_like', (['expected_yda', 'np.nan', 'float'], {}), '(expected_yda, np.nan, float)\n', (1243, 1272), True, 'import xarray as xr\n'), ((191, ... |