code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#!/usr/bin/env python
#
# Copyright 2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
# ... | [
"gnuradio.gr.top_block",
"gnuradio.blocks.vector_sink_f",
"pmt.intern",
"gnuradio.gr_unittest.run",
"gnuradio.blocks.head"
] | [((2699, 2756), 'gnuradio.gr_unittest.run', 'gr_unittest.run', (['test_tags_strobe', '"""test_tags_strobe.xml"""'], {}), "(test_tags_strobe, 'test_tags_strobe.xml')\n", (2714, 2756), False, 'from gnuradio import gr, gr_unittest, blocks\n'), ((960, 974), 'gnuradio.gr.top_block', 'gr.top_block', ([], {}), '()\n', (972, 9... |
"""
Multi-device matrix multiplication using parla with cupy as the kernel engine.
"""
import sys
import time
import numpy as np
import cupy as cp
from parla import Parla, get_all_devices
from parla.array import copy, clone_here
from parla.cpu import cpu
from parla.cuda import gpu
from parla.function_decorators impo... | [
"cupy.cuda.Device",
"parla.cuda.gpu",
"numpy.random.rand",
"parla.tasks.TaskSpace",
"time.perf_counter",
"cupy.cuda.runtime.getDevice",
"numpy.array",
"parla.Parla",
"numpy.random.seed",
"numpy.empty",
"parla.tasks.spawn",
"cupy.cuda.runtime.getDeviceCount",
"cupy.cuda.stream.get_current_str... | [((530, 550), 'parla.tasks.spawn', 'spawn', ([], {'placement': 'cpu'}), '(placement=cpu)\n', (535, 550), False, 'from parla.tasks import spawn, TaskSpace, CompletedTaskSpace, reserve_persistent_memory\n'), ((594, 626), 'cupy.cuda.runtime.getDeviceCount', 'cp.cuda.runtime.getDeviceCount', ([], {}), '()\n', (624, 626), T... |
import subprocess
import re
import os
"""cargo_test_app application."""
class App:
def __init__(self, args):
self.args = args
self.prj_dir = f"prj/{self.args.prj}"
self.first_cycle_done = False
def prepare_empty_directories(self):
os.system("rm -rf _work _out_log _out... | [
"os.system",
"re.search"
] | [((283, 350), 'os.system', 'os.system', (['"""rm -rf _work _out_log _out_step _out_out _out_results"""'], {}), "('rm -rf _work _out_log _out_step _out_out _out_results')\n", (292, 350), False, 'import os\n'), ((359, 418), 'os.system', 'os.system', (['"""mkdir _out_log _out_step _out_out _out_results"""'], {}), "('mkd... |
# core/operators/_affine.py
"""Classes for operators that depend affinely on external parameters, i.e.,
A(µ) = sum_{i=1}^{nterms} θ_{i}(µ) * A_{i}.
"""
__all__ = [
"AffineConstantOperator",
"AffineLinearOperator",
"AffineQuadraticOperator",
# AffineCrossQuadraticOperator",
"AffineCubicOperator... | [
"numpy.all"
] | [((4884, 4905), 'numpy.all', 'np.all', (['(left == right)'], {}), '(left == right)\n', (4890, 4905), True, 'import numpy as np\n')] |
from django.db import models
class Location(models.Model):
city_name = models.CharField(max_length=100)
population = models.IntegerField()
class Subscription(models.Model):
email = models.EmailField()
location = models.ForeignKey(Location, on_delete=models.CASCADE)
confirmation_id = models.UUIDF... | [
"django.db.models.EmailField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.BooleanField",
"django.db.models.CharField",
"django.db.models.DateTimeField",
"django.db.models.UUIDField"
] | [((77, 109), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (93, 109), False, 'from django.db import models\n'), ((127, 148), 'django.db.models.IntegerField', 'models.IntegerField', ([], {}), '()\n', (146, 148), False, 'from django.db import models\n'), ((197, 216... |
#!/usr/bin/env python3
import tensorflow as tf
import numpy as np
import os
import time
import random
import sys
model_name = sys.argv[2]
textfile = sys.argv[1]
if model_name == None:
model_name = "shakespeare"
if textfile == None:
sys.exit('No data text file specified in command line args')
text = open(text... | [
"sys.exit",
"tensorflow.data.Dataset.from_tensor_slices",
"tensorflow.random.categorical",
"os.path.join",
"tensorflow.keras.layers.Embedding",
"numpy.array",
"tensorflow.keras.losses.sparse_categorical_crossentropy",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.callbacks.ModelCheckpoint",
"... | [((458, 473), 'numpy.array', 'np.array', (['vocab'], {}), '(vocab)\n', (466, 473), True, 'import numpy as np\n'), ((489, 531), 'numpy.array', 'np.array', (['[char_to_index[c] for c in text]'], {}), '([char_to_index[c] for c in text])\n', (497, 531), True, 'import numpy as np\n'), ((603, 650), 'tensorflow.data.Dataset.f... |
import numpy as np
from typing import Tuple
def similarity_transform(
X: np.ndarray, Y: np.ndarray, dim: int = 3
) -> Tuple[np.ndarray, float, np.ndarray]:
"""Calculate the similarity transform between two (matching) point sets.
Parameters
----------
X: np.ndarray
Points of first trajecto... | [
"numpy.identity",
"numpy.mean",
"numpy.eye",
"numpy.copy",
"numpy.linalg.matrix_rank",
"numpy.ones",
"numpy.trace",
"numpy.diag",
"numpy.linalg.det",
"numpy.sum",
"numpy.dot",
"numpy.zeros",
"numpy.linalg.svd"
] | [((1453, 1471), 'numpy.mean', 'np.mean', (['X'], {'axis': '(1)'}), '(X, axis=1)\n', (1460, 1471), True, 'import numpy as np\n'), ((1483, 1501), 'numpy.mean', 'np.mean', (['Y'], {'axis': '(1)'}), '(Y, axis=1)\n', (1490, 1501), True, 'import numpy as np\n'), ((1676, 1699), 'numpy.linalg.svd', 'np.linalg.svd', (['Sigma_xy... |
# -*- coding: utf-8 -*-
"""Validators for users."""
import re
from localflavor.it.util import ssn_validation
from rest_framework.exceptions import ValidationError
class CfValidator:
"""Validator for italian ssn."""
def __call__(self, cf):
"""Check if the cf is valid."""
cf = cf.upper()
... | [
"re.match",
"localflavor.it.util.ssn_validation",
"rest_framework.exceptions.ValidationError"
] | [((403, 465), 'rest_framework.exceptions.ValidationError', 'ValidationError', (['"""Not valid cf. It should have 16 characters."""'], {}), "('Not valid cf. It should have 16 characters.')\n", (418, 465), False, 'from rest_framework.exceptions import ValidationError\n'), ((477, 534), 're.match', 're.match', (['"""[A-Z]{... |
from keyring.testing.backend import BackendBasicTests
from sagecipher.keyring import Keyring
class TestKeyring(BackendBasicTests):
def init_keyring(self):
return Keyring()
| [
"sagecipher.keyring.Keyring"
] | [((176, 185), 'sagecipher.keyring.Keyring', 'Keyring', ([], {}), '()\n', (183, 185), False, 'from sagecipher.keyring import Keyring\n')] |
print('[-- O mesmo professor do desafio anterior quer sortear a ordem de apresentação de trabalhos dos alunos. Faça um programa que leia o nome dos quatro alunos e mostre a ordem sorteada. --]\n')
from random import shuffle
nome01 = input('Digite o nome do primeiro aluno: ')
nome02 = input('Digite o nome do segundo alu... | [
"random.shuffle"
] | [((484, 512), 'random.shuffle', 'shuffle', (['ordemdeapresentacao'], {}), '(ordemdeapresentacao)\n', (491, 512), False, 'from random import shuffle\n')] |
import networkx as nx
import pandas as pd
from src.cegpy import StagedTree, Evidence, ChainEventGraph
from pathlib import Path
class TestUnitCEG(object):
def setup(self):
self.node_prefix = 'w'
self.sink_suffix = '∞'
df_path = Path(__file__).resolve(
).parent.parent.joinp... | [
"networkx.relabel_nodes",
"networkx.MultiDiGraph",
"src.cegpy.Evidence",
"pathlib.Path",
"src.cegpy.ChainEventGraph",
"networkx.get_node_attributes",
"pandas.read_excel"
] | [((554, 578), 'src.cegpy.ChainEventGraph', 'ChainEventGraph', (['self.st'], {}), '(self.st)\n', (569, 578), False, 'from src.cegpy import StagedTree, Evidence, ChainEventGraph\n'), ((2318, 2384), 'networkx.relabel_nodes', 'nx.relabel_nodes', (['self.ceg', "{'s0': self.ceg.root_node}"], {'copy': '(False)'}), "(self.ceg,... |
import pytest
from spacy import registry
from spacy.tokens import Doc, Span
from spacy.language import Language
from spacy.lang.en import English
from spacy.pipeline import EntityRuler, EntityRecognizer, merge_entities
from spacy.pipeline.ner import DEFAULT_NER_MODEL
from spacy.errors import MatchPatternError
from spa... | [
"spacy.pipeline.EntityRuler",
"spacy.tests.util.make_tempdir",
"spacy.lang.en.English",
"spacy.tokens.Doc",
"pytest.mark.parametrize",
"spacy.tokens.Span",
"spacy.language.Language",
"pytest.raises",
"spacy.registry.resolve",
"spacy.registry.misc",
"spacy.pipeline.merge_entities",
"spacy.pipel... | [((473, 511), 'spacy.registry.misc', 'registry.misc', (['"""entity_ruler_patterns"""'], {}), "('entity_ruler_patterns')\n", (486, 511), False, 'from spacy import registry\n'), ((940, 969), 'spacy.language.Language.component', 'Language.component', (['"""add_ent"""'], {}), "('add_ent')\n", (958, 969), False, 'from spacy... |
import spacy_streamlit
import typer
def main(models: str, default_text: str):
models = [name.strip() for name in models.split(",")]
spacy_streamlit.visualize(models, default_text, visualizers=["ner"])
if __name__ == "__main__":
try:
typer.run(main)
except SystemExit:
pass
| [
"typer.run",
"spacy_streamlit.visualize"
] | [((142, 210), 'spacy_streamlit.visualize', 'spacy_streamlit.visualize', (['models', 'default_text'], {'visualizers': "['ner']"}), "(models, default_text, visualizers=['ner'])\n", (167, 210), False, 'import spacy_streamlit\n'), ((257, 272), 'typer.run', 'typer.run', (['main'], {}), '(main)\n', (266, 272), False, 'import... |
"""Faça um programa que leia o comprimento do cateto oposto e do cateto
adjacente de um triângulo retângulo. Calcule e mostre o comprimento da hipotenusa"""
from math import hypot
ca = float(input("Informe o cateto adjacente: "))
co = float(input('Informe o cateto oposto: '))
print(f'A hipotenusa do triângulo retângu... | [
"math.hypot"
] | [((329, 342), 'math.hypot', 'hypot', (['ca', 'co'], {}), '(ca, co)\n', (334, 342), False, 'from math import hypot\n')] |
# encoding: utf-8
"""
Test suite for the docxx.oxml.text.run module.
"""
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
import pytest
from ...unitutil.cxml import element, xml
class DescribeCT_R(object):
def it_can_add_a_t_preserving_edge_whitespace(self, add_t_fix... | [
"pytest.fixture"
] | [((510, 761), 'pytest.fixture', 'pytest.fixture', ([], {'params': '[(\'w:r\', \'foobar\', \'w:r/w:t"foobar"\'), (\'w:r\', \'foobar \',\n \'w:r/w:t{xml:space=preserve}"foobar "\'), (\n \'w:r/(w:rPr/w:rStyle{w:val=emphasis}, w:cr)\', \'foobar\',\n \'w:r/(w:rPr/w:rStyle{w:val=emphasis}, w:cr, w:t"foobar")\')]'}),... |
from enum import Enum
class MongoLib(Enum):
"""enumeration for mongo libs for python
"""
MONGO_ALCHEMY = 1
PYMONGO = 2
MONGOENGINE = 3
class DBStatus(object):
def mongo_checker(self, dbmongo, mongo_libs):
def mongoengine():
import copy
result = True, 'mongo u... | [
"copy.copy"
] | [((389, 407), 'copy.copy', 'copy.copy', (['dbmongo'], {}), '(dbmongo)\n', (398, 407), False, 'import copy\n'), ((915, 933), 'copy.copy', 'copy.copy', (['dbmongo'], {}), '(dbmongo)\n', (924, 933), False, 'import copy\n')] |
# -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. 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... | [
"vega.algorithms.hpo.bayes_conf.BayesConfig",
"vega.algorithms.hpo.sha_base.tuner.TunerBuilder",
"vega.algorithms.hpo.ea.ga.GeneticAlgorithm",
"vega.common.ClassFactory.register"
] | [((949, 998), 'vega.common.ClassFactory.register', 'ClassFactory.register', (['ClassType.SEARCH_ALGORITHM'], {}), '(ClassType.SEARCH_ALGORITHM)\n', (970, 998), False, 'from vega.common import ClassFactory, ClassType\n'), ((1089, 1102), 'vega.algorithms.hpo.bayes_conf.BayesConfig', 'BayesConfig', ([], {}), '()\n', (1100... |
from __future__ import print_function
import jinja2
import aiohttp_jinja2
import grpc
import os.path
from aiohttp import web
from cancontroller import ROOT_DIR
from cancontroller.ipc import model_pb2
from cancontroller.ipc import model_pb2_grpc
from cancontroller import configuration
from cancontroller.controller.... | [
"aiohttp.web.run_app",
"cancontroller.controller.api.API",
"cancontroller.configuration.get_controller_log_file",
"aiohttp.web.Response",
"grpc.insecure_channel",
"aiohttp.web.FileResponse",
"aiohttp.web.static",
"cancontroller.ipc.model_pb2_grpc.CanControllerStub",
"aiohttp.web.post",
"aiohttp_ji... | [((1439, 1478), 'aiohttp_jinja2.template', 'aiohttp_jinja2.template', (['"""home.view.j2"""'], {}), "('home.view.j2')\n", (1462, 1478), False, 'import aiohttp_jinja2\n'), ((1647, 1687), 'aiohttp_jinja2.template', 'aiohttp_jinja2.template', (['"""alarm.view.j2"""'], {}), "('alarm.view.j2')\n", (1670, 1687), False, 'impo... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# File : transforms.py
# Author : <NAME>
# Email : <EMAIL>
# Date : 03/03/2018
#
# This file is part of Jacinle.
# Distributed under terms of the MIT license.
import random
import torch
import torchvision.transforms as transforms
import jactorch.transforms.image a... | [
"random.random",
"torch.from_numpy"
] | [((1180, 1202), 'torch.from_numpy', 'torch.from_numpy', (['bbox'], {}), '(bbox)\n', (1196, 1202), False, 'import torch\n'), ((2317, 2332), 'random.random', 'random.random', ([], {}), '()\n', (2330, 2332), False, 'import random\n'), ((2508, 2523), 'random.random', 'random.random', ([], {}), '()\n', (2521, 2523), False, ... |
import asyncio
import os
import tempfile
import wave
from unittest import TestCase
import av
from aiortc import AudioStreamTrack, VideoStreamTrack
from aiortc.contrib.media import MediaBlackhole, MediaPlayer, MediaRecorder
from aiortc.mediastreams import MediaStreamError
from .codecs import CodecTestCase
from .utils... | [
"tempfile.TemporaryDirectory",
"wave.open",
"asyncio.sleep",
"aiortc.VideoStreamTrack",
"aiortc.contrib.media.MediaPlayer",
"os.path.join",
"av.open",
"aiortc.contrib.media.MediaRecorder",
"aiortc.contrib.media.MediaBlackhole",
"aiortc.AudioStreamTrack"
] | [((416, 445), 'tempfile.TemporaryDirectory', 'tempfile.TemporaryDirectory', ([], {}), '()\n', (443, 445), False, 'import tempfile\n'), ((649, 670), 'wave.open', 'wave.open', (['path', '"""wb"""'], {}), "(path, 'wb')\n", (658, 670), False, 'import wave\n'), ((1059, 1077), 'av.open', 'av.open', (['path', '"""w"""'], {}),... |
#!/usr/bin/env python
# This document is part of Pelagos Data
# https://github.com/skytruth/pelagos-data
# =========================================================================== #
#
# The MIT License (MIT)
#
# Copyright (c) 2014 SkyTruth
#
# Permission is hereby granted, free of charge, to any person obtain... | [
"inspect.currentframe",
"shutil.copyfile"
] | [((5997, 6050), 'shutil.copyfile', 'shutil.copyfile', (['assets.sample_configfile', 'configfile'], {}), '(assets.sample_configfile, configfile)\n', (6012, 6050), False, 'import shutil\n'), ((1917, 1939), 'inspect.currentframe', 'inspect.currentframe', ([], {}), '()\n', (1937, 1939), False, 'import inspect\n')] |
import os
import numpy as np
from .filewrappers import *
from .from_binary import bioptigen_binary_reader as bioptigen
from .from_binary import heidelberg_binary_reader as heidelberg
from .from_binary import bioptigen_scan_type_map
from ..utilities import get_lut
from ..exceptions import FileLoadError
import matplotlib... | [
"numpy.fromfile",
"matplotlib.use",
"numpy.asarray",
"numpy.max",
"numpy.rot90",
"os.path.abspath",
"numpy.float_power"
] | [((328, 345), 'matplotlib.use', 'mpl.use', (['"""Qt5Agg"""'], {}), "('Qt5Agg')\n", (335, 345), True, 'import matplotlib as mpl\n'), ((549, 598), 'numpy.fromfile', 'np.fromfile', (['f'], {'dtype': 'np.uint16', 'count': 'self.count'}), '(f, dtype=np.uint16, count=self.count)\n', (560, 598), True, 'import numpy as np\n'),... |
# -*- coding: utf-8 -*-
"""
Functions for generating spatial permutations
"""
import warnings
import numpy as np
from scipy import optimize, spatial
def _gen_rotation(seed=None):
"""
Generates random matrix for rotating spherical coordinates
Parameters
----------
seed : {int, np.random.RandomSt... | [
"numpy.random.default_rng",
"numpy.unique",
"scipy.optimize.linear_sum_assignment",
"scipy.spatial.cKDTree",
"scipy.spatial.distance_matrix",
"numpy.linalg.det",
"numpy.asanyarray",
"numpy.array",
"numpy.max",
"numpy.diag",
"numpy.min",
"warnings.warn",
"numpy.all"
] | [((549, 576), 'numpy.random.default_rng', 'np.random.default_rng', (['seed'], {}), '(seed)\n', (570, 576), True, 'import numpy as np\n'), ((630, 674), 'numpy.array', 'np.array', (['[[-1, 0, 0], [0, 1, 0], [0, 0, 1]]'], {}), '([[-1, 0, 0], [0, 1, 0], [0, 0, 1]])\n', (638, 674), True, 'import numpy as np\n'), ((7397, 742... |
import numpy as np
import struct
class IdxFile:
TYPE_MAPPING = {b"\x08": "unsigned byte", b"\x09": "signed byte", b"\x0B": "short (2 bytes)",
b"\x0C": "int (4 bytes)", b"\x0D": "float (4 bytes)", b"\x0E": "double (8 bytes)"}
BYTE_MAPPING = {b"\x08": 1, b"\x09": 1, b"\x0B": 2, b"\x0C": 4, b... | [
"numpy.prod",
"numpy.ndarray"
] | [((910, 944), 'numpy.ndarray', 'np.ndarray', (['shape', '"""B"""', 'data_bytes'], {}), "(shape, 'B', data_bytes)\n", (920, 944), True, 'import numpy as np\n'), ((862, 876), 'numpy.prod', 'np.prod', (['shape'], {}), '(shape)\n', (869, 876), True, 'import numpy as np\n')] |
import itertools
import torch
CORPUS = "corpus.txt"
MODE = "E2C" # English to Chinese
MAX_TOKEN_LEN = 10
# Default word tokens
PAD_token = 0 # Used for padding short sentences
SOS_token = 1 # Start-of-sentence token
EOS_token = 2 # End-of-sentence token
def nameLine_generator(corpus=CORPUS):
with open(cor... | [
"torch.LongTensor",
"itertools.zip_longest",
"torch.ByteTensor"
] | [((834, 886), 'itertools.zip_longest', 'itertools.zip_longest', (['*indexes'], {'fillvalue': 'fillvalue'}), '(*indexes, fillvalue=fillvalue)\n', (855, 886), False, 'import itertools\n'), ((2757, 2782), 'torch.LongTensor', 'torch.LongTensor', (['padList'], {}), '(padList)\n', (2773, 2782), False, 'import torch\n'), ((31... |
from __future__ import division, absolute_import, print_function
import numpy as np
"""
A sript to generate van der Waals surface of molecules.
"""
# Van der Waals radii (in angstrom) are taken from GAMESS.
vdw_r = {'H': 1.20, 'HE': 1.20,
'LI': 1.37, 'BE': 1.45, 'B': 1.45, 'C': 1.50,
'N': 1.50, 'O... | [
"numpy.sqrt",
"numpy.power",
"numpy.array",
"numpy.cos",
"numpy.linalg.norm",
"numpy.sin"
] | [((1273, 1284), 'numpy.array', 'np.array', (['u'], {}), '(u)\n', (1281, 1284), True, 'import numpy as np\n'), ((795, 813), 'numpy.sqrt', 'np.sqrt', (['(np.pi * n)'], {}), '(np.pi * n)\n', (802, 813), True, 'import numpy as np\n'), ((918, 928), 'numpy.cos', 'np.cos', (['fi'], {}), '(fi)\n', (924, 928), True, 'import num... |
# Generated by Django 3.1.2 on 2020-10-14 05:54
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Customer... | [
"django.db.models.EmailField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.PositiveIntegerField",
"django.db.models.CharField"
] | [((367, 460), '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", (383, 460), False, 'from django.db import migrations, models\... |
import pygame
import globals
pygame.font.init()
class Score_counter:
def __init__(self, font, size, pos, color):
# font: a string with the name of a system font to use
# size: font size
# pos: a tuple with x and y pos as ints
# color: what color it is
self.font = pygame.fo... | [
"pygame.font.init",
"pygame.font.SysFont"
] | [((30, 48), 'pygame.font.init', 'pygame.font.init', ([], {}), '()\n', (46, 48), False, 'import pygame\n'), ((311, 342), 'pygame.font.SysFont', 'pygame.font.SysFont', (['font', 'size'], {}), '(font, size)\n', (330, 342), False, 'import pygame\n')] |
"""Unit tests for encoder_layers.py.
Copyright PolyAI Limited.
"""
import tensorflow as tf
import encoder_layers
_TEST_ENCODER = "testdata/tfhub_modules/encoder"
_TEST_EXTRA_CONTEXT_ENCODER = "testdata/tfhub_modules/extra_context_encoder"
class EncoderLayersTest(tf.test.TestCase):
def test_encode_sentences(se... | [
"encoder_layers.ContextualizedSubwordsLayer",
"encoder_layers.ContextEncoderLayer",
"tensorflow.gradients",
"tensorflow.test.main",
"encoder_layers.ContextAndResponseEncoderLayer",
"encoder_layers.ResponseEncoderLayer",
"tensorflow.compat.v1.local_variables_initializer",
"tensorflow.compat.v1.tables_i... | [((9759, 9773), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (9771, 9773), True, 'import tensorflow as tf\n'), ((387, 437), 'encoder_layers.SentenceEncoderLayer', 'encoder_layers.SentenceEncoderLayer', (['_TEST_ENCODER'], {}), '(_TEST_ENCODER)\n', (422, 437), False, 'import encoder_layers\n'), ((1177, 1244... |
import logging
from rest_framework import mixins
from rest_framework.viewsets import GenericViewSet
from rest_framework.views import APIView
from rest_framework.permissions import IsAuthenticatedOrReadOnly
from rest_framework.response import Response
from rest_framework import status
from django.shortcuts import get_ob... | [
"logging.getLogger",
"talentmap_api.bidding.models.BidCycle.objects.all",
"django.shortcuts.get_object_or_404",
"talentmap_api.common.common_helpers.in_group_or_403",
"talentmap_api.common.permissions.isDjangoGroupMemberOrReadOnly",
"talentmap_api.bidding.models.BidCycle.objects.get",
"rest_framework.re... | [((1015, 1042), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1032, 1042), False, 'import logging\n'), ((2181, 2233), 'talentmap_api.common.common_helpers.in_group_or_403', 'in_group_or_403', (['self.request.user', '"""bidcycle_admin"""'], {}), "(self.request.user, 'bidcycle_admin')\n",... |
import uuid
from libs import logger
class RequestIdMiddleware(object):
def __init__(self, get_response=None):
self.get_response = get_response
def __call__(self, request):
self.process_request(request)
response = self.get_response(request)
return response
def process_re... | [
"libs.logger.get_thread_logger",
"uuid.uuid4"
] | [((711, 737), 'libs.logger.get_thread_logger', 'logger.get_thread_logger', ([], {}), '()\n', (735, 737), False, 'from libs import logger\n'), ((373, 385), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (383, 385), False, 'import uuid\n')] |
import os
#This program finds all the files in a directory whose address we provide and prints it.
def get_files():
directory = os.path.join('C:\\Users\\%s\\Desktop' %os.getlogin())
file_list = os.listdir(directory)
print (file_list)
def main():
get_files()
if __name__ == '__main__':
main() | [
"os.getlogin",
"os.listdir"
] | [((197, 218), 'os.listdir', 'os.listdir', (['directory'], {}), '(directory)\n', (207, 218), False, 'import os\n'), ((169, 182), 'os.getlogin', 'os.getlogin', ([], {}), '()\n', (180, 182), False, 'import os\n')] |
import logging
from icat.client import Client
from object_pool import ObjectPool
from datagateway_api.src.common.config import Config
log = logging.getLogger()
class ICATClient(Client):
"""Wrapper class to allow an object pool of client objects to be created"""
def __init__(self, client_use="datagateway_a... | [
"logging.getLogger",
"object_pool.ObjectPool"
] | [((143, 162), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (160, 162), False, 'import logging\n'), ((1216, 1402), 'object_pool.ObjectPool', 'ObjectPool', (['ICATClient'], {'min_init': 'Config.config.datagateway_api.client_pool_init_size', 'max_capacity': 'Config.config.datagateway_api.client_pool_max_siz... |
# -*- coding: utf-8 -*-
"""
Library for computing features that describe the local boundary curvature
This module provides functions that one can use to obtain, visualise and describe local curvature of a given object.
Available Functions:
-circumradius:Finds the radius of a circumcircle
-local_radius_curvature: Com... | [
"math.sqrt",
"numpy.column_stack",
"numpy.array",
"numpy.arctan2",
"numpy.divide",
"matplotlib.pyplot.imshow",
"numpy.mean",
"numpy.where",
"skimage.morphology.erosion",
"numpy.max",
"numpy.vstack",
"scipy.signal.find_peaks",
"pandas.DataFrame",
"numpy.abs",
"numpy.floor",
"numpy.sign"... | [((3099, 3158), 'numpy.pad', 'np.pad', (['bw'], {'pad_width': '(5)', 'mode': '"""constant"""', 'constant_values': '(0)'}), "(bw, pad_width=5, mode='constant', constant_values=0)\n", (3105, 3158), True, 'import numpy as np\n'), ((3577, 3618), 'numpy.column_stack', 'np.column_stack', (['(boundary_x, boundary_y)'], {}), '... |
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
from decimal import Decimal
import discord
from discord.ext import commands
import user_db
import config
rpc_connection = 'http://{0}:{1}@{2}:{3}'.format(config.rpc_user, config.rpc_password, config.ip, config.rpc_port)
def str_isfloat(str):
try... | [
"user_db.check_user",
"user_db.add_user",
"bitcoinrpc.authproxy.AuthServiceProxy",
"discord.Embed",
"discord.ext.commands.command",
"decimal.Decimal"
] | [((490, 508), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (506, 508), False, 'from discord.ext import commands\n'), ((583, 615), 'bitcoinrpc.authproxy.AuthServiceProxy', 'AuthServiceProxy', (['rpc_connection'], {}), '(rpc_connection)\n', (599, 615), False, 'from bitcoinrpc.authproxy import Aut... |
# (C) Datadog, Inc. 2019-present
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
import json
import os
import re
from mock import MagicMock
from pyVmomi import vim
from requests import Response
from six import iteritems
from tests.common import HERE
from datadog_checks.vsphere.api import V... | [
"datadog_checks.vsphere.api.VersionInfo",
"re.match",
"os.path.join",
"json.load",
"six.iteritems",
"mock.MagicMock"
] | [((454, 493), 'mock.MagicMock', 'MagicMock', ([], {'key': "counter['groupInfo.key']"}), "(key=counter['groupInfo.key'])\n", (463, 493), False, 'from mock import MagicMock\n'), ((518, 556), 'mock.MagicMock', 'MagicMock', ([], {'key': "counter['nameInfo.key']"}), "(key=counter['nameInfo.key'])\n", (527, 556), False, 'fro... |
from datetime import datetime
from zcrmsdk.src.com.zoho.crm.api import ParameterMap, HeaderMap
from zcrmsdk.src.com.zoho.crm.api.profiles import Profile
from zcrmsdk.src.com.zoho.crm.api.roles import Role
from zcrmsdk.src.com.zoho.crm.api.users import *
from zcrmsdk.src.com.zoho.crm.api.users import User as ZCRMUser
... | [
"zcrmsdk.src.com.zoho.crm.api.ParameterMap",
"zcrmsdk.src.com.zoho.crm.api.profiles.Profile",
"zcrmsdk.src.com.zoho.crm.api.roles.Role",
"datetime.datetime.fromisoformat",
"zcrmsdk.src.com.zoho.crm.api.HeaderMap",
"zcrmsdk.src.com.zoho.crm.api.users.User"
] | [((656, 670), 'zcrmsdk.src.com.zoho.crm.api.ParameterMap', 'ParameterMap', ([], {}), '()\n', (668, 670), False, 'from zcrmsdk.src.com.zoho.crm.api import ParameterMap, HeaderMap\n'), ((977, 988), 'zcrmsdk.src.com.zoho.crm.api.HeaderMap', 'HeaderMap', ([], {}), '()\n', (986, 988), False, 'from zcrmsdk.src.com.zoho.crm.a... |
# Example BDT creation from: https://scikit-learn.org/stable/modules/ensemble.html
from sklearn.datasets import make_hastie_10_2
from sklearn.ensemble import RandomForestClassifier
import conifer
import datetime
# Make a random dataset from sklearn 'hastie'
X, y = make_hastie_10_2(random_state=0)
X_train, X_test = X[... | [
"conifer.model",
"conifer.backends.vivadohls.auto_config",
"sklearn.ensemble.RandomForestClassifier",
"sklearn.datasets.make_hastie_10_2",
"datetime.datetime.now"
] | [((267, 299), 'sklearn.datasets.make_hastie_10_2', 'make_hastie_10_2', ([], {'random_state': '(0)'}), '(random_state=0)\n', (283, 299), False, 'from sklearn.datasets import make_hastie_10_2\n'), ((519, 559), 'conifer.backends.vivadohls.auto_config', 'conifer.backends.vivadohls.auto_config', ([], {}), '()\n', (557, 559)... |
'''
AudioAvplayer: implementation of Sound using pyobjus / AVFoundation.
Works on iOS / OSX.
'''
__all__ = ('SoundAvplayer', )
from kivy.core.audio import Sound, SoundLoader
from pyobjus import autoclass
from pyobjus.dylib_manager import load_framework, INCLUDE
load_framework(INCLUDE.AVFoundation)
AVAudioPlayer = au... | [
"pyobjus.dylib_manager.load_framework",
"kivy.core.audio.SoundLoader.register",
"pyobjus.autoclass"
] | [((265, 301), 'pyobjus.dylib_manager.load_framework', 'load_framework', (['INCLUDE.AVFoundation'], {}), '(INCLUDE.AVFoundation)\n', (279, 301), False, 'from pyobjus.dylib_manager import load_framework, INCLUDE\n'), ((318, 344), 'pyobjus.autoclass', 'autoclass', (['"""AVAudioPlayer"""'], {}), "('AVAudioPlayer')\n", (327... |
# Copyright (c) 2013 Yubico AB
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditi... | [
"u2flib_server.utils.websafe_encode",
"json.loads",
"cryptography.x509.ObjectIdentifier",
"os.urandom",
"json.dumps",
"binascii.a2b_hex",
"u2flib_server.utils.websafe_decode",
"struct.pack",
"cryptography.hazmat.backends.default_backend",
"six.indexbytes",
"cryptography.hazmat.primitives.hashes.... | [((2195, 2243), 'cryptography.x509.ObjectIdentifier', 'x509.ObjectIdentifier', (['"""1.3.6.1.4.1.45724.2.1.1"""'], {}), "('1.3.6.1.4.1.45724.2.1.1')\n", (2216, 2243), False, 'from cryptography import x509\n'), ((2265, 2328), 'binascii.a2b_hex', 'a2b_hex', (['"""3059301306072a8648ce3d020106082a8648ce3d030107034200"""'],... |
#%%
import pandas as pd
pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)
import matplotlib
matplotlib.use('module://backend_interagg')
import matplotlib.pyplot as plt
#%%
df1 = pd.read_table("exac_2015/data/recurrence/fordist_1KG_mutation_rate_ta... | [
"matplotlib.use",
"matplotlib.pyplot.show",
"pandas.read_table",
"pandas.set_option"
] | [((25, 63), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', '(500)'], {}), "('display.max_rows', 500)\n", (38, 63), True, 'import pandas as pd\n'), ((64, 105), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', '(500)'], {}), "('display.max_columns', 500)\n", (77, 105), True, 'import... |
#! /usr/bin/python
# -*- coding: utf-8 -*-
import time
import tensorflow as tf
import tensorlayer as tl
from keras import backend as K
from keras.layers import *
from tensorlayer.layers import *
X_train, y_train, X_val, y_val, X_test, y_test = \
tl.files.load_mnist_dataset(shape=(-1, 784))
sess = tf.... | [
"tensorflow.InteractiveSession",
"tensorlayer.files.load_mnist_dataset",
"tensorlayer.layers.initialize_global_variables",
"tensorlayer.cost.cross_entropy",
"keras.backend.learning_phase",
"tensorflow.placeholder",
"tensorlayer.iterate.minibatches",
"tensorflow.argmax",
"tensorflow.train.AdamOptimiz... | [((264, 308), 'tensorlayer.files.load_mnist_dataset', 'tl.files.load_mnist_dataset', ([], {'shape': '(-1, 784)'}), '(shape=(-1, 784))\n', (291, 308), True, 'import tensorlayer as tl\n'), ((317, 340), 'tensorflow.InteractiveSession', 'tf.InteractiveSession', ([], {}), '()\n', (338, 340), True, 'import tensorflow as tf\n... |
# Copyright 2014 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | [
"os.path.exists",
"cement.utils.misc.minimal_logger",
"subprocess.call"
] | [((862, 886), 'cement.utils.misc.minimal_logger', 'minimal_logger', (['__name__'], {}), '(__name__)\n', (876, 886), False, 'from cement.utils.misc import minimal_logger\n'), ((2505, 2564), 'subprocess.call', 'subprocess.call', (["['ssh', '-i', ident_file, user + '@' + ip]"], {}), "(['ssh', '-i', ident_file, user + '@' ... |
import hmac
from bcrypt import hashpw
from flask import abort, redirect, render_template, request, session
class AnonymousAuthBackend(object):
get_login = False
post_login = False
get_logout = False
def __init__(self, config):
pass
def is_logged_in(self):
return True
class Sim... | [
"flask.render_template",
"flask.session.get",
"flask.abort",
"flask.redirect",
"flask.session.pop",
"bcrypt.hashpw"
] | [((919, 943), 'flask.session.get', 'session.get', (['"""logged_in"""'], {}), "('logged_in')\n", (930, 943), False, 'from flask import abort, redirect, render_template, request, session\n'), ((985, 1021), 'flask.render_template', 'render_template', (['"""simple_login.html"""'], {}), "('simple_login.html')\n", (1000, 102... |
from os import environ
from subprocess import Popen, PIPE, STDOUT
from threading import Thread
from sys import argv
apkpath = "~/Downloads/app-castrolZoomAlpha-release.apk"
aaptpath = "~/Library/Android/sdk/build-tools/28.0.1"
adbpath = "~/Library/Android/sdk/platform-tools"
pkgname = ''
"""
Get list of android d... | [
"subprocess.Popen",
"threading.Thread"
] | [((962, 1012), 'subprocess.Popen', 'Popen', (['cmd'], {'stdout': 'PIPE', 'stderr': 'STDOUT', 'shell': '(True)'}), '(cmd, stdout=PIPE, stderr=STDOUT, shell=True)\n', (967, 1012), False, 'from subprocess import Popen, PIPE, STDOUT\n'), ((1435, 1485), 'subprocess.Popen', 'Popen', (['cmd'], {'stdout': 'PIPE', 'stderr': 'ST... |
# Copyright 2021 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
import logging
from vdk.api.job_input import IJobInput
log = logging.getLogger(__name__)
def run(job_input: IJobInput):
job_input.execute_query(
"""
INSERT INTO {db}.{table_destination}
SELECT uuid, 'python', hostname, pa__arri... | [
"logging.getLogger"
] | [((131, 158), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (148, 158), False, 'import logging\n')] |
import unittest
from bibliopixel.util import offset_range
class OffsetRangeTest(unittest.TestCase):
def test_empty(self):
dmx = offset_range.DMXChannel.make()
self.assertEqual(dmx.index(0), None)
self.assertEqual(dmx.index(1), 0)
self.assertEqual(dmx.index(2), 1)
self.asse... | [
"bibliopixel.util.offset_range.MidiChannel",
"bibliopixel.util.offset_range.DMXChannel.make"
] | [((142, 172), 'bibliopixel.util.offset_range.DMXChannel.make', 'offset_range.DMXChannel.make', ([], {}), '()\n', (170, 172), False, 'from bibliopixel.util import offset_range\n'), ((721, 751), 'bibliopixel.util.offset_range.DMXChannel.make', 'offset_range.DMXChannel.make', ([], {}), '()\n', (749, 751), False, 'from bib... |
from . import app
from flask_sqlalchemy import SQLAlchemy
import datetime
import os
# SQLAlchemy setup
basedir = os.path.abspath(os.path.dirname(__file__))
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///'+os.path.join(basedir, '../data.sqlite')
app.config['SQLALCHEMY_COMMIT_ON_TEARDOWN'] = True
db = SQLAlchemy(a... | [
"os.path.exists",
"os.path.join",
"os.path.dirname",
"datetime.datetime.now",
"flask_sqlalchemy.SQLAlchemy"
] | [((308, 323), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', (['app'], {}), '(app)\n', (318, 323), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((131, 156), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (146, 156), False, 'import os\n'), ((211, 250), 'os.path.join', 'os.path.join', (['... |
'''
TIEGCM Kamodo reader, adapted to new structure for satellite flythrough software
Initial version - <NAME> (?)
Initial version of model_varnames contributed by <NAME>
New code: <NAME> (June 2021 and on)
NOTE: The current logic for variables that depend on imlev slices off self._imlev coordinate
This only works ... | [
"datetime.datetime.utcfromtimestamp",
"numpy.array",
"numpy.sin",
"numpy.mean",
"numpy.where",
"netCDF4.Dataset",
"time.perf_counter",
"numpy.diff",
"glob.glob",
"numpy.abs",
"kamodo.readers.reader_utilities.regdef_4D_interpolators",
"kamodo.readers.reader_utilities.regdef_3D_interpolators",
... | [((9885, 9927), 'datetime.datetime.strptime', 'datetime.strptime', (['date_string', '"""%Y-%m-%d"""'], {}), "(date_string, '%Y-%m-%d')\n", (9902, 9927), False, 'from datetime import datetime, timezone, timedelta\n'), ((11507, 11521), 'time.perf_counter', 'perf_counter', ([], {}), '()\n', (11519, 11521), False, 'from ti... |
# Generated by Django 3.1.12 on 2021-09-24 11:41
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
dependencies = [
('teams', '0001_squashed_0003_auto_20210325_0812'),
]
operations = [
migrations.CreateModel(
... | [
"django.db.models.TextField",
"django.db.models.UUIDField",
"django.db.models.ForeignKey"
] | [((674, 824), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'default': 'None', 'null': '(True)', 'on_delete': 'django.db.models.deletion.SET_NULL', 'related_name': '"""teams"""', 'to': '"""teams.department"""'}), "(blank=True, default=None, null=True, on_delete=django.db.\n models.dele... |
"""
Script for calculating the IPO index in each ensemble member
Author : <NAME>
Date : 17 September 2021
Version : 12
"""
### Import packages
import sys
import math
import time
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy.stats as stats
from mpl_toolkits.basemap im... | [
"matplotlib.pyplot.ylabel",
"calc_dataFunctions.getRegion",
"numpy.nanmean",
"scipy.stats.pearsonr",
"numpy.nanmin",
"numpy.genfromtxt",
"numpy.arange",
"numpy.mean",
"numpy.where",
"calc_Utilities.calc_weightedAve",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"calc_Stats.remove_en... | [((782, 809), 'matplotlib.pyplot.rc', 'plt.rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (788, 809), True, 'import matplotlib.pyplot as plt\n'), ((809, 882), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {}), "('font', **{'family': 'sans-serif', 'sans-serif': ['Avant Garde']})\n", (815, 8... |
from system.utils import *
from indy import did
import pytest
import hashlib
import time
import asyncio
from datetime import datetime, timedelta, timezone
import json
import testinfra
from system.docker_setup import client, pool_builder, pool_starter,\
DOCKER_BUILD_CTX_PATH, DOCKER_IMAGE_NAME, NODE_NAME_BASE, NETWO... | [
"hashlib.sha256",
"system.docker_setup.pool_builder",
"system.docker_setup.client.containers.get",
"json.dumps",
"datetime.datetime.now",
"asyncio.sleep",
"datetime.timedelta",
"indy.did.create_and_store_my_did",
"time.time"
] | [((3460, 3471), 'time.time', 'time.time', ([], {}), '()\n', (3469, 3471), False, 'import time\n'), ((3547, 3596), 'indy.did.create_and_store_my_did', 'did.create_and_store_my_did', (['wallet_handler', '"""{}"""'], {}), "(wallet_handler, '{}')\n", (3574, 3596), False, 'from indy import did\n'), ((4258, 4274), 'asyncio.s... |
import argparse
import logging
import os
import shutil
import sys
import tensorboardX as tb
import numpy as np
import torch
import yaml
from configs import *
from runners import *
def parse_args_and_config():
parser = argparse.ArgumentParser(description=globals()['__doc__'])
parser.add_argument('--config',... | [
"logging.getLogger",
"torch.manual_seed",
"torch.cuda.manual_seed_all",
"logging.StreamHandler",
"os.path.exists",
"tensorboardX.SummaryWriter",
"os.makedirs",
"yaml.dump",
"sys.exit",
"logging.Formatter",
"os.path.join",
"torch.cuda.is_available",
"numpy.random.seed",
"shutil.rmtree",
"... | [((4556, 4596), 'os.path.join', 'os.path.join', (['args.exp', '"""logs"""', 'args.doc'], {}), "(args.exp, 'logs', args.doc)\n", (4568, 4596), False, 'import os\n'), ((4821, 4864), 'os.makedirs', 'os.makedirs', (['args.fid_folder'], {'exist_ok': '(True)'}), '(args.fid_folder, exist_ok=True)\n', (4832, 4864), False, 'imp... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-12 14:22
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('JottoWebApp', '0003_auto_20170812_1410'),
]
operations... | [
"django.db.models.DateTimeField"
] | [((431, 486), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'default': 'django.utils.timezone.now'}), '(default=django.utils.timezone.now)\n', (451, 486), False, 'from django.db import migrations, models\n')] |
# Copyright (c) 2020 NVIDIA Corporation. All rights reserved.
# This work is licensed under a NVIDIA Open Source Non-commercial license.
# system modules
import os, argparse
# basic pytorch modules
import torch
import torch.nn as nn
import torch.nn.functional as F
# custom utilities
from dataloader impor... | [
"torch.nn.functional.l1_loss",
"torch.nn.functional.mse_loss",
"argparse.ArgumentParser",
"os.path.join",
"torch.nn.DataParallel",
"torch.cuda.device_count",
"torch.cuda.is_available",
"torch.no_grad",
"convlstmnet.ConvLSTMNet",
"torch.device"
] | [((574, 617), 'torch.device', 'torch.device', (["('cuda' if use_cuda else 'cpu')"], {}), "('cuda' if use_cuda else 'cpu')\n", (586, 617), False, 'import torch\n'), ((908, 1233), 'convlstmnet.ConvLSTMNet', 'ConvLSTMNet', ([], {'input_channels': 'args.img_channels', 'layers_per_block': '(3, 3, 3, 3)', 'hidden_channels': ... |
from jschon import JSON, JSONPatch, URI
from odp.lib.schema import schema_catalog as catalog
def test_validity():
input_schema = catalog.get_schema(URI('https://odp.saeon.ac.za/schema/metadata/saeon/iso19115'))
input_json = catalog.load_json(URI('https://odp.saeon.ac.za/schema/metadata/saeon/iso19115-example... | [
"jschon.JSONPatch",
"jschon.URI",
"jschon.JSON"
] | [((155, 216), 'jschon.URI', 'URI', (['"""https://odp.saeon.ac.za/schema/metadata/saeon/iso19115"""'], {}), "('https://odp.saeon.ac.za/schema/metadata/saeon/iso19115')\n", (158, 216), False, 'from jschon import JSON, JSONPatch, URI\n'), ((253, 322), 'jschon.URI', 'URI', (['"""https://odp.saeon.ac.za/schema/metadata/saeo... |
from flee import pflee
from flee.datamanager import handle_refugee_data
from flee.datamanager import DataTable # DataTable.subtract_dates()
from flee import InputGeography
import numpy as np
import flee.postprocessing.analysis as a
import sys
import argparse
import time
import os
def date_to_sim_days(date):
retu... | [
"flee.datamanager.DataTable.subtract_dates",
"argparse.ArgumentParser",
"flee.pflee.Ecosystem",
"os.path.join",
"time.time",
"flee.InputGeography.InputGeography"
] | [((323, 379), 'flee.datamanager.DataTable.subtract_dates', 'DataTable.subtract_dates', ([], {'date1': 'date', 'date2': '"""2010-01-01"""'}), "(date1=date, date2='2010-01-01')\n", (347, 379), False, 'from flee.datamanager import DataTable\n'), ((679, 690), 'time.time', 'time.time', ([], {}), '()\n', (688, 690), False, '... |
# -*- coding: utf-8 -*-
"""
Nmap command module.
"""
__author__ = '<NAME>, <NAME>, <NAME>, <NAME>'
__copyright__ = 'Copyright (C) 2018-2020, Nokia'
__email__ = '<EMAIL>, <EMAIL>, <EMAIL>,' \
'<EMAIL>'
import re
from moler.cmd.unix.genericunix import GenericUnixCommand
from moler.exceptions import Parsing... | [
"moler.util.converterhelper.ConverterHelper.get_converter_helper",
"moler.exceptions.ParsingDone",
"re.compile"
] | [((2600, 2744), 're.compile', 're.compile', (['"""^(?P<LINES>(?P<PORTS>(?P<PORT>\\\\d+)\\\\/(?P<TYPE>\\\\w+))\\\\s+(?P<STATE>\\\\S+)\\\\s+(?P<SERVICE>\\\\S+)\\\\s*(?P<REASON>\\\\S+)?\\\\s*)$"""'], {}), "(\n '^(?P<LINES>(?P<PORTS>(?P<PORT>\\\\d+)\\\\/(?P<TYPE>\\\\w+))\\\\s+(?P<STATE>\\\\S+)\\\\s+(?P<SERVICE>\\\\S+)\\... |
# Generated by Django 3.2.4 on 2021-06-29 15:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wagtail_localize_test', '0014_auto_20210217_0924'),
]
operations = [
migrations.AddField(
model_name='testsnippet',
... | [
"django.db.models.CharField"
] | [((362, 405), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(10)'}), '(blank=True, max_length=10)\n', (378, 405), False, 'from django.db import migrations, models\n')] |
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2021 Scipp contributors (https://github.com/scipp)
# @file
# @author <NAME>
import numpy as np
import pytest
import scipp as sc
def test_shape():
a = sc.Variable(value=1)
d = sc.Dataset(data={'a': a})
assert d.shape == []
a = sc.Variable(['x'], ... | [
"numpy.random.rand",
"scipp.DataArray",
"numpy.array",
"copy.deepcopy",
"copy.copy",
"numpy.arange",
"numpy.int64",
"scipp.mean",
"numpy.float64",
"scipp.merge",
"scipp.sum",
"scipp.concatenate",
"numpy.random.seed",
"numpy.testing.assert_array_equal",
"scipp.Dataset",
"scipp.rebin",
... | [((213, 233), 'scipp.Variable', 'sc.Variable', ([], {'value': '(1)'}), '(value=1)\n', (224, 233), True, 'import scipp as sc\n'), ((242, 267), 'scipp.Dataset', 'sc.Dataset', ([], {'data': "{'a': a}"}), "(data={'a': a})\n", (252, 267), True, 'import scipp as sc\n'), ((301, 330), 'scipp.Variable', 'sc.Variable', (["['x']"... |
import numpy as np
try:
import PyQt4.QtGui as QtGui
import PyQt4.QtCore as QtCore
except:
import PyQt5.QtGui as QtGui
import PyQt5.QtCore as QtCore
class SetFittingVariablesHandler(object):
colorscale_nbr_row = 15
colorscale_cell_size = {'width': 75,
'height':... | [
"numpy.mean",
"PyQt5.QtGui.QTableWidgetItem",
"PyQt5.QtGui.QColor",
"PyQt5.QtGui.QBrush",
"PyQt5.QtGui.QRadialGradient",
"numpy.zeros",
"numpy.isnan",
"numpy.nanmax",
"numpy.nanmin",
"numpy.shape",
"numpy.int",
"numpy.arange"
] | [((1834, 1859), 'numpy.shape', 'np.shape', (['array_2d_values'], {}), '(array_2d_values)\n', (1842, 1859), True, 'import numpy as np\n'), ((1880, 1898), 'numpy.arange', 'np.arange', (['nbr_row'], {}), '(nbr_row)\n', (1889, 1898), True, 'import numpy as np\n'), ((4770, 4788), 'numpy.arange', 'np.arange', (['nbr_row'], {... |
#!/usr/bin/env python
"""
Example from pybedtools documentation: find reads in introns and exons using
multiple CPUs.
Prints a tab-separated file containing class (exon, intron, both) and number of
reads in each class.
"""
from __future__ import print_function
import pybedtools
import argparse
import os
import sys
im... | [
"pybedtools.BedTool",
"os.path.basename",
"multiprocessing.Pool"
] | [((2526, 2572), 'multiprocessing.Pool', 'multiprocessing.Pool', ([], {'processes': 'args.processes'}), '(processes=args.processes)\n', (2546, 2572), False, 'import multiprocessing\n'), ((2867, 2894), 'pybedtools.BedTool', 'pybedtools.BedTool', (['introns'], {}), '(introns)\n', (2885, 2894), False, 'import pybedtools\n'... |
"""
tests.config.conftest
~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2017 by ConsenSys France.
:license: BSD, see LICENSE for more details.
"""
import os
import pytest
@pytest.fixture(scope='session')
def config_files_dir(test_dir):
yield os.path.join(test_dir, 'config', 'files')
| [
"pytest.fixture",
"os.path.join"
] | [((191, 222), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (205, 222), False, 'import pytest\n'), ((265, 306), 'os.path.join', 'os.path.join', (['test_dir', '"""config"""', '"""files"""'], {}), "(test_dir, 'config', 'files')\n", (277, 306), False, 'import os\n')] |
import math
# inverse square root is 1 / square root of a number
# relatively time consuming
def get_inverse_square(num):
return 1/math.sqrt(num)
# using a lookup table could help a lot if we know we're going to do this over and over for numbers between 1 and 1000
def build_lookup_table():
lookup_table = ... | [
"math.sqrt"
] | [((138, 152), 'math.sqrt', 'math.sqrt', (['num'], {}), '(num)\n', (147, 152), False, 'import math\n')] |
from sphinxcontrib.needs.logging import get_logger
class BaseService:
def __init__(self, *args, **kwargs):
self.log = get_logger(__name__)
def request(self, *args, **kwargs):
raise NotImplementedError("Must be implemented by the service!")
def debug(self, *args, **kwargs):
raise ... | [
"sphinxcontrib.needs.logging.get_logger"
] | [((132, 152), 'sphinxcontrib.needs.logging.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (142, 152), False, 'from sphinxcontrib.needs.logging import get_logger\n')] |
from random import choice
import pygame
import pygame.freetype
import sys
class Node:
def __init__(self, id, x, y):
self.x = x
self.y = y
self.north = None
self.south = None
self.east = None
self.west = None
self._id = id
def setConnections(self, nodeNorth, nodeSouth, nodeEast, nodeWest... | [
"random.choice",
"sys.exit",
"pygame.init",
"pygame.quit",
"pygame.freetype.SysFont",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.key.get_pressed",
"pygame.draw.rect",
"pygame.time.Clock",
"pygame.display.update",
"pygame.font.SysFont"
] | [((1345, 1358), 'pygame.init', 'pygame.init', ([], {}), '()\n', (1356, 1358), False, 'import pygame\n'), ((1422, 1472), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(self.width, self.height)'], {}), '((self.width, self.height))\n', (1445, 1472), False, 'import pygame\n'), ((1489, 1508), 'pygame.time.Clock',... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | [
"rest_framework.response.Response",
"backend.helm.helm.models.ChartVersion.objects.get",
"backend.uniapps.network.serializers.ChartVersionSLZ",
"backend.helm.helm.models.ChartVersion.objects.filter"
] | [((2509, 2533), 'rest_framework.response.Response', 'Response', (['chart_versions'], {}), '(chart_versions)\n', (2517, 2533), False, 'from rest_framework.response import Response\n'), ((2645, 2691), 'backend.uniapps.network.serializers.ChartVersionSLZ', 'serializers.ChartVersionSLZ', ([], {'data': 'request.data'}), '(d... |
"""
Utility functions for dealing with Human3.6M dataset.
Some functions are adapted from https://github.com/una-dinosauria/3d-pose-baseline
"""
import os
import numpy as np
import copy
import logging
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import libs.dataset.h36m.cameras as cameras
... | [
"numpy.hstack",
"numpy.array",
"copy.deepcopy",
"numpy.divide",
"numpy.mean",
"numpy.multiply",
"numpy.repeat",
"scipy.spatial.transform.Rotation.from_euler",
"numpy.reshape",
"numpy.delete",
"libs.dataset.h36m.pth_dataset.PoseDataset",
"numpy.random.choice",
"numpy.std",
"matplotlib.pyplo... | [((1093, 1160), 'numpy.array', 'np.array', (['[0, 1, 2, 0, 6, 7, 0, 12, 13, 14, 13, 17, 18, 13, 25, 26]'], {}), '([0, 1, 2, 0, 6, 7, 0, 12, 13, 14, 13, 17, 18, 13, 25, 26])\n', (1101, 1160), True, 'import numpy as np\n'), ((1180, 1248), 'numpy.array', 'np.array', (['[1, 2, 3, 6, 7, 8, 12, 13, 14, 15, 17, 18, 19, 25, 26... |
# -*- 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... | [
"hackathon.util.get_now",
"hackathon.RequiredFeature",
"sys.path.append"
] | [((1380, 1401), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (1395, 1401), False, 'import sys\n'), ((1605, 1614), 'hackathon.util.get_now', 'get_now', ([], {}), '()\n', (1612, 1614), False, 'from hackathon.util import get_now\n'), ((1704, 1741), 'hackathon.RequiredFeature', 'RequiredFeature', (... |
#!/usr/bin/env python
#
# test_ldp_isis_topo1.py
# Part of NetDEF Topology Tests
#
# Copyright (c) 2020 by <NAME>
#
# Permission to use, copy, modify, and/or distribute this software
# for any purpose with or without fee is hereby granted, provided
# that the above copyright notice and this permission notice appear
# ... | [
"lib.topotest.run_and_expect",
"re.split",
"lib.topogen.get_topogen",
"os.path.join",
"lib.topotest.sleep",
"lib.topotest.json_cmp",
"pytest.main",
"os.path.realpath",
"lib.topolog.logger.info",
"re.match",
"functools.partial",
"lib.topogen.Topogen",
"pytest.skip",
"lib.topolog.logger.warn... | [((2807, 2833), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (2823, 2833), False, 'import os\n'), ((2851, 2875), 'os.path.join', 'os.path.join', (['CWD', '"""../"""'], {}), "(CWD, '../')\n", (2863, 2875), False, 'import os\n'), ((4119, 4152), 'lib.topogen.Topogen', 'Topogen', (['build_top... |
#Task2
import socket
socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM);
#Listen port
socket.bind(("localhost",8181));
#Clients connect
socket.listen(2)
cnt = 1;
chk = '';
while cnt <= 2:
(c, Addresses) = socket.accept();
print("Connected %s:%s"%(Addresses[0], Addresses[1]));
if cnt == 1:
... | [
"socket.accept",
"socket.listen",
"socket.bind",
"socket.socket"
] | [((30, 79), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (43, 79), False, 'import socket\n'), ((94, 126), 'socket.bind', 'socket.bind', (["('localhost', 8181)"], {}), "(('localhost', 8181))\n", (105, 126), False, 'import socket\n'), ((144, 1... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
from bs4 import BeautifulSoup
import scrape_common as sc
def get_nw_page():
url = 'https://www.nw.ch/gesundheitsamtdienste/6044'
content = sc.download(url, silent=True)
content = content.replace(" ", " ")
content = re.sub(r'(\d+)\'(\d+)', ... | [
"bs4.BeautifulSoup",
"re.sub",
"scrape_common.download"
] | [((207, 236), 'scrape_common.download', 'sc.download', (['url'], {'silent': '(True)'}), '(url, silent=True)\n', (218, 236), True, 'import scrape_common as sc\n'), ((296, 340), 're.sub', 're.sub', (['"""(\\\\d+)\\\\\'(\\\\d+)"""', '"""\\\\1\\\\2"""', 'content'], {}), '("(\\\\d+)\\\\\'(\\\\d+)", \'\\\\1\\\\2\', content)\... |
# coding: utf-8
"""
Apache NiFi Registry REST API
The REST API provides an interface to a registry with operations for saving, versioning, reading NiFi flows and components.
OpenAPI spec version: 1.15.0
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from p... | [
"six.iteritems"
] | [((13637, 13666), 'six.iteritems', 'iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (13646, 13666), False, 'from six import iteritems\n')] |
'''
Interact with a peripheral 'button' device hooked up to an FTDI chip
'''
import threading
import queue
import ftdi
import time
class Button(threading.Thread):
''' Docstring '''
def __init__(self):
'''
Docstring
Parameters
----------
Returns
-------
... | [
"ftdi.ftdi_usb_close",
"ftdi.ftdi_get_error_string",
"ftdi.ftdi_deinit",
"time.sleep",
"ftdi.ftdi_usb_open_string",
"ftdi.ftdi_set_bitmode",
"ftdi.ftdi_disable_bitbang",
"ftdi.ftdi_new",
"ftdi.ftdi_read_pins",
"queue.Queue"
] | [((404, 419), 'ftdi.ftdi_new', 'ftdi.ftdi_new', ([], {}), '()\n', (417, 419), False, 'import ftdi\n'), ((439, 497), 'ftdi.ftdi_usb_open_string', 'ftdi.ftdi_usb_open_string', (['port', '"""s:0x403:0x6001:2eb80091"""'], {}), "(port, 's:0x403:0x6001:2eb80091')\n", (464, 497), False, 'import ftdi\n'), ((528, 560), 'ftdi.ft... |
from django.test import TestCase
from django.conf import settings
import json
from newt.tests import MyTestClient, newt_base_url, login
class AuthTests(TestCase):
fixtures = ["test_fixture.json"]
def setUp(self):
self.client = MyTestClient()
def test_login(self):
# Should not be logged i... | [
"newt.tests.MyTestClient"
] | [((246, 260), 'newt.tests.MyTestClient', 'MyTestClient', ([], {}), '()\n', (258, 260), False, 'from newt.tests import MyTestClient, newt_base_url, login\n')] |
import os, os.path, sys
from threading import Thread
NO_OF_CHARS = 256
path = "input/"
def badCharHeuristic(string, size):
badChar = [-1]*NO_OF_CHARS
for i in range(size):
badChar[ord(string[i])] = i;
return badChar
def search(txt, pat):
m = len(pat)
n = len(txt)
badChar = badCharHeuri... | [
"sys.stdin.readline",
"threading.Thread",
"os.listdir"
] | [((665, 681), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (675, 681), False, 'import os, os.path, sys\n'), ((2448, 2516), 'threading.Thread', 'Thread', ([], {'target': 'searchThreadFunction', 'args': '(files[start:end], tokens)'}), '(target=searchThreadFunction, args=(files[start:end], tokens))\n', (2454, 2... |
from __future__ import absolute_import
import mock
import os.path
import responses
import pytest
import re
import time
from flask import current_app
from uuid import UUID
from changes.config import db, redis
from changes.constants import Status, Result
from changes.lib.artifact_store_lib import ArtifactState
from c... | [
"re.compile",
"mock.Mock",
"pytest.mark.timeout",
"changes.config.redis.sadd",
"changes.models.test.TestCase.query.filter",
"changes.models.patch.Patch",
"changes.config.db.session.add",
"mock.patch",
"changes.lib.artifact_store_mock.ArtifactStoreMock",
"changes.jobs.create_job.create_job.delay",
... | [((5307, 5353), 'mock.patch.object', 'mock.patch.object', (['JenkinsBuilder', '"""_find_job"""'], {}), "(JenkinsBuilder, '_find_job')\n", (5324, 5353), False, 'import mock\n'), ((13807, 13896), 'mock.patch', 'mock.patch', (['"""changes.backends.jenkins.builder.ArtifactStoreClient"""', 'ArtifactStoreMock'], {}), "('chan... |
# This file is part of PyTMM.
#
# PyTMM is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# PyTMM is distributed in t... | [
"numpy.identity",
"numpy.multiply",
"numpy.linalg.solve",
"numpy.hstack",
"numpy.conj",
"numpy.array",
"numpy.dot",
"numpy.linalg.inv",
"numpy.real",
"numpy.cos",
"numpy.zeros",
"numpy.sin",
"numpy.imag"
] | [((4361, 4448), 'numpy.array', 'numpy.array', (['[[transferMatrix.matrix[0, 1], -1], [transferMatrix.matrix[1, 1], 0]]'], {}), '([[transferMatrix.matrix[0, 1], -1], [transferMatrix.matrix[1, 1\n ], 0]])\n', (4372, 4448), False, 'import numpy\n'), ((4477, 4550), 'numpy.array', 'numpy.array', (['[-transferMatrix.matri... |
"""empty message
Revision ID: 180_remove_user_locked_flag
Revises: 170_add_login_tracking
Create Date: 2015-07-03 16:07:45.172143
"""
# revision identifiers, used by Alembic.
revision = '180_remove_user_locked_flag'
down_revision = '170_add_login_tracking'
from alembic import op
import sqlalchemy as sa
def upgrad... | [
"alembic.op.alter_column",
"alembic.op.drop_column",
"sqlalchemy.BOOLEAN",
"alembic.op.execute"
] | [((393, 426), 'alembic.op.drop_column', 'op.drop_column', (['"""users"""', '"""locked"""'], {}), "('users', 'locked')\n", (407, 426), False, 'from alembic import op\n'), ((645, 718), 'alembic.op.execute', 'op.execute', (['"""UPDATE users SET locked=FALSE WHERE failed_login_count < 6;"""'], {}), "('UPDATE users SET lock... |
"""
Various utilities used in the main code.
NOTE: there should be no autograd functions here, only plain numpy/scipy
"""
import numpy as np
from scipy.linalg import toeplitz
from scipy.optimize import brentq
def ftinv(ft_coeff, gvec, xgrid, ygrid):
"""
Returns the discrete inverse Fourier transform over a ... | [
"numpy.abs",
"numpy.triu",
"numpy.unique",
"scipy.optimize.brentq",
"numpy.ones",
"numpy.max",
"numpy.exp",
"numpy.array",
"numpy.zeros",
"scipy.linalg.toeplitz",
"numpy.sum",
"numpy.meshgrid",
"numpy.int_",
"numpy.arange"
] | [((658, 683), 'numpy.meshgrid', 'np.meshgrid', (['xgrid', 'ygrid'], {}), '(xgrid, ygrid)\n', (669, 683), True, 'import numpy as np\n'), ((696, 738), 'numpy.zeros', 'np.zeros', (['xmesh.shape'], {'dtype': 'np.complex128'}), '(xmesh.shape, dtype=np.complex128)\n', (704, 738), True, 'import numpy as np\n'), ((807, 849), '... |
import numpy as np
from nltk.tokenize import word_tokenize
class Dataset(object):
def __init__(self, text_file, context_size, vocab_min_count):
self.text_file = text_file
self.context_size = context_size
self.vocab_min_count = vocab_min_count
self.vocab = []
self.comat = N... | [
"numpy.zeros",
"numpy.unique",
"numpy.nonzero",
"nltk.tokenize.word_tokenize"
] | [((587, 606), 'nltk.tokenize.word_tokenize', 'word_tokenize', (['text'], {}), '(text)\n', (600, 606), False, 'from nltk.tokenize import word_tokenize\n'), ((698, 738), 'numpy.unique', 'np.unique', (['word_list'], {'return_counts': '(True)'}), '(word_list, return_counts=True)\n', (707, 738), True, 'import numpy as np\n'... |
import nltk
class Analyzer():
"""Implements sentiment analysis."""
def __init__(self, positives, negatives):
"""Initialize Analyzer."""
self.negatives=[]
self.positives=[]
with open ("negative-words.txt") as negative:
for line in negative:
... | [
"nltk.tokenize.TweetTokenizer"
] | [((769, 799), 'nltk.tokenize.TweetTokenizer', 'nltk.tokenize.TweetTokenizer', ([], {}), '()\n', (797, 799), False, 'import nltk\n')] |
import alpaca_trade_api as tradeapi
import datetime
ALPACA_API_KEY = "<KEY>"
ALPACA_SECRET_KEY = "<KEY>"
USE_POLYGON = False
# Utility to truncate a float value to a certain number of decimal places.
# We'll use this to see if a "penny level" was crossed when we compare prices.
# This is necessary because a price ca... | [
"alpaca_trade_api.StreamConn",
"datetime.timedelta",
"alpaca_trade_api.REST",
"datetime.datetime.utcnow"
] | [((1855, 1881), 'datetime.datetime.utcnow', 'datetime.datetime.utcnow', ([], {}), '()\n', (1879, 1881), False, 'import datetime\n'), ((1945, 2003), 'alpaca_trade_api.REST', 'tradeapi.REST', (['self.key_id', 'self.secret_key', 'self.base_url'], {}), '(self.key_id, self.secret_key, self.base_url)\n', (1958, 2003), True, ... |
#!/usr/bin/env python
from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
# http://www.imagemagick.org/Usage/text/
# original imagemagick command:
# convert -background lightblue -fill blue \
# -font Candice -pointsize 72 label:Anthony \
# label.gif
with Ima... | [
"wand.image.Image",
"wand.drawing.Drawing",
"wand.color.Color"
] | [((317, 341), 'wand.image.Image', 'Image', ([], {'width': '(1)', 'height': '(1)'}), '(width=1, height=1)\n', (322, 341), False, 'from wand.image import Image\n'), ((361, 370), 'wand.drawing.Drawing', 'Drawing', ([], {}), '()\n', (368, 370), False, 'from wand.drawing import Drawing\n'), ((838, 851), 'wand.color.Color', ... |
from random import randint
lista = list()
games = list()
cont = 0
quant = int(input('how many numbers do you want?'))
tot = 1
while tot <= quant:
cont = 0
while True:
num = randint(1, 60)
if num not in lista:
lista.append(num)
cont += 1
if cont >= 6:
... | [
"random.randint"
] | [((198, 212), 'random.randint', 'randint', (['(1)', '(60)'], {}), '(1, 60)\n', (205, 212), False, 'from random import randint\n')] |
#!/usr/bin/python
# doKhaiii.py
import os
import sys
import re
from khaiii import KhaiiiApi
api = KhaiiiApi()
# 전달 인자 읽기 및 파일 패스 생성
if len(sys.argv) < 3:
print("usage: doKahiii [input file to process] [output file]")
exit(1)
inputPath = sys.argv[1]
outputPath = sys.argv[2]
fileList = os.listdir(inputPath)
... | [
"re.split",
"os.listdir",
"re.match",
"re.sub",
"khaiii.KhaiiiApi"
] | [((101, 112), 'khaiii.KhaiiiApi', 'KhaiiiApi', ([], {}), '()\n', (110, 112), False, 'from khaiii import KhaiiiApi\n'), ((298, 319), 'os.listdir', 'os.listdir', (['inputPath'], {}), '(inputPath)\n', (308, 319), False, 'import os\n'), ((2151, 2186), 're.sub', 're.sub', (['"""([,.]$)|(^[,.])"""', '""""""', 'unit'], {}), "... |
"""
pigpio is a Python module for the Raspberry which talks to
the pigpio daemon to allow control of the general purpose
input outputs (GPIO).
[http://abyz.co.uk/rpi/pigpio/python.html]
*Features*
o the pigpio Python module can run on Windows, Macs, or Linux
o controls one or more Pi's
o hardware timed PWM on any ... | [
"threading.Thread.__init__",
"socket.socket",
"os.getenv",
"threading.Lock",
"struct.pack",
"time.sleep",
"struct.unpack",
"time.time",
"atexit.register"
] | [((24469, 24485), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (24483, 24485), False, 'import threading\n'), ((26931, 26966), 'struct.pack', 'struct.pack', (['"""IIII"""', 'cmd', 'p1', 'p2', '(0)'], {}), "('IIII', cmd, p1, p2, 0)\n", (26942, 26966), False, 'import struct\n'), ((27471, 27507), 'struct.pack', 's... |
# Copyright 2019 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | [
"numpy.sqrt",
"scipy.special.factorial",
"numpy.sinh",
"numpy.array",
"numpy.sin",
"pytest.mark.backends",
"numpy.arange",
"numpy.exp",
"pytest.skip",
"numpy.abs",
"numpy.tile",
"numpy.allclose",
"numpy.conj",
"strawberryfields.utils.squeezed_state",
"pytest.raises",
"numpy.cos",
"nu... | [((6225, 6271), 'pytest.mark.backends', 'pytest.mark.backends', (['"""fock"""', '"""tf"""', '"""gaussian"""'], {}), "('fock', 'tf', 'gaussian')\n", (6245, 6271), False, 'import pytest\n'), ((8725, 8757), 'pytest.mark.backends', 'pytest.mark.backends', (['"""gaussian"""'], {}), "('gaussian')\n", (8745, 8757), False, 'im... |
import time
class StatsTracker(object):
def __init__(self):
self.num_iterations = None
self.num_guesses = 0
self.max_recursion_depth = 0
self.start_time = 0
self.end_time = 0
@property
def num_iterations(self):
return self._num_iterations
@num_iteratio... | [
"time.time"
] | [((830, 841), 'time.time', 'time.time', ([], {}), '()\n', (839, 841), False, 'import time\n'), ((893, 904), 'time.time', 'time.time', ([], {}), '()\n', (902, 904), False, 'import time\n')] |
'''
Created on 22.10.2014
@author: Philip
'''
import flask
import flask_login
import tournaments.forms
import tournaments.models
import utils.forms
from utils.views import create_action_urls, alert_success, error_not_found, \
error_access_denied
bp_tournaments = flask.Blueprint("tournaments", __name__)
@bp_t... | [
"flask.render_template",
"utils.views.alert_success",
"flask.Blueprint",
"utils.views.create_action_urls"
] | [((272, 312), 'flask.Blueprint', 'flask.Blueprint', (['"""tournaments"""', '__name__'], {}), "('tournaments', __name__)\n", (287, 312), False, 'import flask\n'), ((1584, 1657), 'utils.views.create_action_urls', 'create_action_urls', (["{'Delete': '.delete'}", 'tournament'], {'tournament_id': '"""id"""'}), "({'Delete': ... |
import utils
import pickle as pkl
import constants
infile = 'data/agr_50_mostcommon_10K.tsv'
worddict = {}
worddict[constants.pad] = constants.pad_idx
worddict[constants.unk] = constants.unk_idx # probably we won't need this
worddict[constants.bos] = constants.bos_idx
worddict[constants.eos] = constants.eos_idx
for d... | [
"utils.deps_from_tsv",
"pickle.dump"
] | [((326, 353), 'utils.deps_from_tsv', 'utils.deps_from_tsv', (['infile'], {}), '(infile)\n', (345, 353), False, 'import utils\n'), ((507, 528), 'pickle.dump', 'pkl.dump', (['worddict', 'f'], {}), '(worddict, f)\n', (515, 528), True, 'import pickle as pkl\n')] |
import os
import sys
import argparse
import importlib
import multiprocessing
import cv2 as cv
import torch.backends.cudnn
env_path = os.path.join(os.path.dirname(__file__), '..')
if env_path not in sys.path:
sys.path.append(env_path)
import ltr.admin.settings as ws_settings
def run_training(train_module, train_... | [
"cv2.setNumThreads",
"argparse.ArgumentParser",
"os.path.dirname",
"ltr.admin.settings.Settings",
"sys.path.append",
"multiprocessing.set_start_method"
] | [((147, 172), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (162, 172), False, 'import os\n'), ((213, 238), 'sys.path.append', 'sys.path.append', (['env_path'], {}), '(env_path)\n', (228, 238), False, 'import sys\n'), ((676, 695), 'cv2.setNumThreads', 'cv.setNumThreads', (['(0)'], {}), '(0)\... |
import os
from typing import List
from asm_utils import hex_to_bin
def read_obj(obj_file: str) -> List[str]:
"""Reads object file and returns list of instructions
Parameters
----------
obj_file : str
path to object file
Returns
-------
List[str]
list of instructions in th... | [
"os.path.isfile",
"asm_utils.hex_to_bin"
] | [((522, 546), 'os.path.isfile', 'os.path.isfile', (['obj_file'], {}), '(obj_file)\n', (536, 546), False, 'import os\n'), ((869, 901), 'asm_utils.hex_to_bin', 'hex_to_bin', (['hex_instruction[:-1]'], {}), '(hex_instruction[:-1])\n', (879, 901), False, 'from asm_utils import hex_to_bin\n')] |
import numpy as np
import requests
from io import BytesIO
from pathlib import Path
from PIL import Image
from urllib.parse import urlparse
# Use a Chrome-based user agent to avoid getting needlessly blocked.
USER_AGENT = (
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/51.0... | [
"PIL.Image.open",
"urllib.parse.urlparse",
"pathlib.Path",
"io.BytesIO",
"requests.get",
"numpy.stack"
] | [((1046, 1061), 'PIL.Image.open', 'Image.open', (['uri'], {}), '(uri)\n', (1056, 1061), False, 'from PIL import Image\n'), ((1437, 1467), 'numpy.stack', 'np.stack', (['([image] * 3)'], {'axis': '(-1)'}), '([image] * 3, axis=-1)\n', (1445, 1467), True, 'import numpy as np\n'), ((1071, 1084), 'urllib.parse.urlparse', 'ur... |
# importiamo i pacchetti necessari
import pandas as pd
import matplotlib.pyplot as plt
# l'indirizzo da cui vogliamo scaricare la tabella
pageURL = 'https://it.wikipedia.org/wiki/Leone_d%27oro_al_miglior_film'
# facciamo scaricare la pagina direttamente a pandas, dando indizi su qual e' la tabella che ci interessa
... | [
"pandas.read_html",
"matplotlib.pyplot.savefig",
"pandas.DataFrame"
] | [((441, 486), 'pandas.read_html', 'pd.read_html', (['pageURL'], {'match': '"""Anno"""', 'header': '(0)'}), "(pageURL, match='Anno', header=0)\n", (453, 486), True, 'import pandas as pd\n'), ((1509, 1540), 'pandas.DataFrame', 'pd.DataFrame', (['corrected_records'], {}), '(corrected_records)\n', (1521, 1540), True, 'impo... |
'''
Sub encoder that is based on the Alphanum Encoder that is part of monay.py
and the Optimised Subencoder that is part of Metasploit
https://github.com/rapid7/metasploit-framework/blob/master//modules/encoders/x86/opt_sub.rb
https://github.com/corelan/mona
'''
import argparse
import binascii
import sys
import os
... | [
"argparse.ArgumentTypeError",
"binascii.a2b_hex",
"argparse.ArgumentParser",
"sys.exit"
] | [((23729, 23939), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Encode payload using sub instructions. Optimized to use the previous opcode to calculate twos complement. Attempts to calculate necessary offsets for decoding."""'}), "(description=\n 'Encode payload using sub instruct... |
from aiohttp import web
from aleph.model.messages import get_computed_address_aggregates
async def address_aggregate(request):
"""Returns the aggregate of an address.
TODO: handle filter on a single key, or even subkey.
"""
address = request.match_info["address"]
keys = request.query.get("keys"... | [
"aleph.model.messages.get_computed_address_aggregates",
"aiohttp.web.HTTPNotFound",
"aiohttp.web.json_response"
] | [((773, 798), 'aiohttp.web.json_response', 'web.json_response', (['output'], {}), '(output)\n', (790, 798), False, 'from aiohttp import web\n'), ((479, 566), 'aleph.model.messages.get_computed_address_aggregates', 'get_computed_address_aggregates', ([], {'address_list': '[address]', 'key_list': 'keys', 'limit': 'limit'... |
from configs import EXP_CONFIGS
import xml.etree.cElementTree as ET
from xml.etree.ElementTree import dump
from lxml import etree as ET
import os
E = ET.Element
def indent(elem, level=0):
i = "\n " + level*" "
if len(elem):
if not elem.text or not elem.text.strip():
elem.text = i + ""
... | [
"lxml.etree.Element",
"os.path.exists",
"lxml.etree.SubElement",
"lxml.etree.ElementTree",
"os.path.join",
"os.mkdir",
"xml.etree.ElementTree.dump",
"os.path.abspath"
] | [((956, 1004), 'os.path.join', 'os.path.join', (['self.current_path', '"""training_data"""'], {}), "(self.current_path, 'training_data')\n", (968, 1004), False, 'import os\n'), ((2544, 2583), 'os.path.join', 'os.path.join', (['self.current_path', '"""data"""'], {}), "(self.current_path, 'data')\n", (2556, 2583), False,... |
import qctests.Argo_global_range_check
import util.testingProfile
import numpy
from util import obs_utils
##### Argo_global_range_check ---------------------------------------------------
def test_Argo_global_range_check_temperature():
'''
Make sure AGRC is flagging temperature excursions
'''
# shoul... | [
"numpy.zeros",
"numpy.array_equal",
"util.obs_utils.pressure_to_depth"
] | [((489, 515), 'numpy.zeros', 'numpy.zeros', (['(1)'], {'dtype': 'bool'}), '(1, dtype=bool)\n', (500, 515), False, 'import numpy\n'), ((547, 575), 'numpy.array_equal', 'numpy.array_equal', (['qc', 'truth'], {}), '(qc, truth)\n', (564, 575), False, 'import numpy\n'), ((786, 812), 'numpy.zeros', 'numpy.zeros', (['(1)'], {... |
import inspect
from typing import Callable, Dict, Hashable, Optional
from .service import Parameterized
from .._internal import API
from .._internal.utils import FinalImmutable, SlotRecord, debug_repr
from ..core import (Container, DependencyDebug, DependencyValue, Provider,
Scope)
@API.private
c... | [
"inspect.isclass"
] | [((3977, 4000), 'inspect.isclass', 'inspect.isclass', (['output'], {}), '(output)\n', (3992, 4000), False, 'import inspect\n'), ((2369, 2404), 'inspect.isclass', 'inspect.isclass', (['factory.dependency'], {}), '(factory.dependency)\n', (2384, 2404), False, 'import inspect\n')] |