code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
"""Console script for glob_to_gif."""
import sys
import click
import glob
import imageio
@click.command()
@click.argument("input", type=click.STRING, nargs=1)
@click.argument("output", type=click.STRING, nargs=1)
@click.option("--fps", type=click.INT, default=30, help="Default: 30")
def main(input, output, fps):
... | [
"click.argument",
"imageio.imread",
"click.option",
"click.command",
"glob.glob",
"imageio.mimsave"
] | [((92, 107), 'click.command', 'click.command', ([], {}), '()\n', (105, 107), False, 'import click\n'), ((109, 160), 'click.argument', 'click.argument', (['"""input"""'], {'type': 'click.STRING', 'nargs': '(1)'}), "('input', type=click.STRING, nargs=1)\n", (123, 160), False, 'import click\n'), ((162, 214), 'click.argume... |
from unittest import TestCase
from src.color_models import RGB, HSV, LAB
class TestConversions(TestCase):
"""
Tests to ensure that the conversions between all supported color spaces works.
Going from LAB color space to either RGB or HSV then back to LAB will result in
a LAB value that not is 100% corr... | [
"src.color_models.HSV.random_hsv",
"src.color_models.RGB.random_rgb"
] | [((454, 470), 'src.color_models.RGB.random_rgb', 'RGB.random_rgb', ([], {}), '()\n', (468, 470), False, 'from src.color_models import RGB, HSV, LAB\n'), ((663, 679), 'src.color_models.HSV.random_hsv', 'HSV.random_hsv', ([], {}), '()\n', (677, 679), False, 'from src.color_models import RGB, HSV, LAB\n'), ((872, 888), 's... |
import datetime
import os
import pyjokes
import pyttsx3
import nltk
import numpy as np
import speech_recognition as sr
import joblib
from textblob import TextBlob
from nltk.corpus import stopwords
from nltk.stem.snowball import SnowballStemmer
from .phrases import BasicPhrases
class PersonalAssistant:
"""
A... | [
"nltk.stem.snowball.SnowballStemmer",
"pyttsx3.init",
"os.system",
"speech_recognition.Microphone",
"pyjokes.get_joke",
"textblob.TextBlob",
"numpy.linspace",
"nltk.corpus.stopwords.words",
"joblib.load",
"datetime.datetime.now",
"speech_recognition.Recognizer"
] | [((1519, 1534), 'speech_recognition.Recognizer', 'sr.Recognizer', ([], {}), '()\n', (1532, 1534), True, 'import speech_recognition as sr\n'), ((1556, 1571), 'speech_recognition.Microphone', 'sr.Microphone', ([], {}), '()\n', (1569, 1571), True, 'import speech_recognition as sr\n'), ((1594, 1608), 'pyttsx3.init', 'pytts... |
# -----------------------------------------------------------
# Copyright (C) 2020 NVIDIA Corporation. All rights reserved.
# Nvidia Source Code License-NC
# Code written by <NAME>.
# -----------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from ... | [
"torchvision.models.resnet18",
"torch.ones",
"torch.nn.functional.grid_sample",
"torch.LongTensor",
"torch.load",
"torch.FloatTensor",
"torch.cat",
"absl.flags.DEFINE_string",
"torch.nn.LeakyReLU",
"torch.Tensor",
"absl.flags.DEFINE_integer",
"absl.flags.DEFINE_boolean",
"torch.nn.functional... | [((643, 711), 'absl.flags.DEFINE_boolean', 'flags.DEFINE_boolean', (['"""symmetric"""', '(True)', '"""Use symmetric mesh or not"""'], {}), "('symmetric', True, 'Use symmetric mesh or not')\n", (663, 711), False, 'from absl import app, flags\n'), ((712, 778), 'absl.flags.DEFINE_integer', 'flags.DEFINE_integer', (['"""nz... |
"""Helpers for building Dash applications."""
import csv
import json
import sqlite3
import time
from contextlib import ContextDecorator
from datetime import datetime
from pathlib import Path
import pandas as pd
from cerberus import Validator
# -------------------------------------------------------------------------... | [
"csv.writer",
"json.dumps",
"pandas.options",
"pathlib.Path",
"datetime.datetime.strptime",
"sqlite3.connect",
"time.time_ns",
"datetime.datetime.fromtimestamp",
"cerberus.Validator",
"pandas.set_option",
"pandas.concat"
] | [((906, 948), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', 'None'], {}), "('display.max_columns', None)\n", (919, 948), True, 'import pandas as pd\n'), ((953, 989), 'pandas.set_option', 'pd.set_option', (['"""display.width"""', 'None'], {}), "('display.width', None)\n", (966, 989), True, 'import... |
"""
Contains the Inspector class:
Inspects a file or directory given the directory, then returns a dictionary
containing the package or module's information.
If the path is to a directory, Inspector will determine whether it's a
Python package or whether it just contains Python files.
Information is stored in ... | [
"os.path.abspath",
"os.path.isdir",
"inspect.isclass",
"os.path.exists",
"json.dumps",
"importlib.machinery.SourceFileLoader",
"os.path.isfile",
"inspect.signature",
"os.path.splitext",
"inspect.isfunction",
"os.path.split",
"os.listdir",
"re.compile"
] | [((2654, 2679), 'os.path.abspath', 'os.path.abspath', (['mainpath'], {}), '(mainpath)\n', (2669, 2679), False, 'import os\n'), ((3054, 3078), 're.compile', 're.compile', (['"""__(\\\\S+)__"""'], {}), "('__(\\\\S+)__')\n", (3064, 3078), False, 'import re\n'), ((3096, 3142), 're.compile', 're.compile', (['"""((\\\\S+).py... |
#!/usr/bin/env python
# encoding: utf-8
'''
A very forgiving JSON parser.
'''
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import codecs
import re
from six import iteritems
from pyparsing import *
__version__ = '0.1.1'
class IllegalValue(object):
... | [
"six.iteritems",
"re.sub",
"re.compile"
] | [((1699, 2050), 're.compile', 're.compile', (['"""\n ( \\\\\\\\U........ # 8-digit hex escapes\n | \\\\\\\\u.... # 4-digit hex escapes\n | \\\\\\\\x.. # 2-digit hex escapes\n | \\\\\\\\[0-7]{1,3} # Octal escapes\n | \\\\\\\\N\\\\{[^}]+\\\\} # Unicode characters by name\n ... |
import pytest
from mdut.mdut import extract_title
@pytest.mark.parametrize(
"html,title",
[
("<html><head><title>foo</title></head></html>", "foo"),
("<html><head><title>bar</title>", "bar"),
("<html><head><title>baz</head></html>", "baz"),
('<html><head><title>b"a“r”f</title>... | [
"pytest.mark.parametrize",
"mdut.mdut.extract_title"
] | [((54, 329), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""html,title"""', '[(\'<html><head><title>foo</title></head></html>\', \'foo\'), (\n \'<html><head><title>bar</title>\', \'bar\'), (\n \'<html><head><title>baz</head></html>\', \'baz\'), (\n \'<html><head><title>b"a“r”f</title></head></html... |
import boto3
import json
import os
import praw
comprehend = boto3.client('comprehend')
target_words = os.environ['TARGETWORDS'].split(",")
sentiment_analyzed = []
def lambda_handler(event, context):
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table(os.environ['PREFIX'] + '-' + os.environ['SUBREDDIT... | [
"boto3.resource",
"json.dumps",
"boto3.client",
"praw.Reddit"
] | [((61, 87), 'boto3.client', 'boto3.client', (['"""comprehend"""'], {}), "('comprehend')\n", (73, 87), False, 'import boto3\n'), ((216, 242), 'boto3.resource', 'boto3.resource', (['"""dynamodb"""'], {}), "('dynamodb')\n", (230, 242), False, 'import boto3\n'), ((366, 555), 'praw.Reddit', 'praw.Reddit', ([], {'user_agent'... |
import os, sys
from PIL import Image, ImageDraw, ImageFont, ImageOps, ImageChops
from makememe.generator.design.font import font_path
from makememe.generator.prompts.helper import Helper
class Image_Manager:
def __init__(self):
print("Image manager create")
@staticmethod
def add_text(base, text, position... | [
"PIL.Image.new",
"makememe.generator.prompts.helper.Helper.wrap",
"PIL.ImageFont.truetype",
"sys.exc_info",
"PIL.ImageDraw.Draw",
"os.path.split"
] | [((455, 497), 'PIL.Image.new', 'Image.new', (['"""RGBA"""', 'base.size', '(0, 0, 0, 0)'], {}), "('RGBA', base.size, (0, 0, 0, 0))\n", (464, 497), False, 'from PIL import Image, ImageDraw, ImageFont, ImageOps, ImageChops\n'), ((597, 637), 'PIL.ImageFont.truetype', 'ImageFont.truetype', (['font_path', 'font_size'], {}), ... |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | [
"st2tests.config.parse_args",
"st2common.bootstrap.runnersregistrar.register_runners",
"st2common.persistence.workflow.TaskExecution.query",
"st2common.models.db.liveaction.LiveActionDB",
"tests.unit.base.get_wf_fixture_meta_data",
"st2common.persistence.workflow.WorkflowExecution.get_by_id",
"st2common... | [((842, 867), 'st2tests.config.parse_args', 'tests_config.parse_args', ([], {}), '()\n', (865, 867), True, 'import st2tests.config as tests_config\n'), ((1965, 1998), 'mock.MagicMock', 'mock.MagicMock', ([], {'return_value': 'None'}), '(return_value=None)\n', (1979, 1998), False, 'import mock\n'), ((2084, 2172), 'mock.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""PAiP Web Build System
NAME - PAiP Web Build System
AUTHOR - <NAME> <<EMAIL>>
LICENSE - MIT
"""
### Imports
import sys
from os import path, getcwd
### From Module Imports
from .pwm.pwm_system import SystemVersion
from .command_interpreter import print_prefix
### Functio... | [
"os.getcwd",
"os.path.dirname"
] | [((2592, 2600), 'os.getcwd', 'getcwd', ([], {}), '()\n', (2598, 2600), False, 'from os import path, getcwd\n'), ((2555, 2577), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (2567, 2577), False, 'from os import path, getcwd\n')] |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
"knack.util.CLIError",
"knack.log.get_logger",
"time.sleep"
] | [((697, 717), 'knack.log.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (707, 717), False, 'from knack.log import get_logger\n'), ((6283, 6297), 'time.sleep', 'time.sleep', (['(30)'], {}), '(30)\n', (6293, 6297), False, 'import time\n'), ((1048, 1193), 'knack.util.CLIError', 'CLIError', (['"""The pod id... |
import json
from src.models.type import Type
from src.ext.database import db
class TypeService():
def delete(request):
try:
typeJson = request.args.get('id')
type = Type.query.filter_by(id_type = typeJson).first()
db.session.delete(type)
db.sess... | [
"src.models.type.Type.query.filter_by",
"src.ext.database.db.session.commit",
"src.models.type.Type",
"json.dumps",
"src.ext.database.db.session.delete",
"src.ext.database.db.session.add",
"src.models.type.Type.query.all"
] | [((276, 299), 'src.ext.database.db.session.delete', 'db.session.delete', (['type'], {}), '(type)\n', (293, 299), False, 'from src.ext.database import db\n'), ((313, 332), 'src.ext.database.db.session.commit', 'db.session.commit', ([], {}), '()\n', (330, 332), False, 'from src.ext.database import db\n'), ((559, 569), 's... |
"""Day 23: Amphipod"""
import collections
import heapq
import itertools
import sys
def parse_input(puzzle_input):
start = [[], [], [], []]
d = {c: i for i, c in enumerate("ABCD")}
for y, row in enumerate(puzzle_input.splitlines()):
for x, v in enumerate(row):
if (i := d.get(v)) is not ... | [
"sys.stdin.read",
"heapq.heappush",
"heapq.heappop",
"collections.defaultdict",
"itertools.product"
] | [((654, 683), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (677, 683), False, 'import collections\n'), ((532, 578), 'itertools.product', 'itertools.product', (['[0, 1, 3, 5, 7, 9, 10]', '[0]'], {}), '([0, 1, 3, 5, 7, 9, 10], [0])\n', (549, 578), False, 'import itertools\n'), ((596, ... |
# -*- coding: utf-8 -*-
"""
This code is auto generated from troposphere_mate.code_generator.__init__.py scripts.
"""
import sys
if sys.version_info.major >= 3 and sys.version_info.minor >= 5: # pragma: no cover
from typing import Union, List, Any
import troposphere.codedeploy
from troposphere.codedeploy impor... | [
"troposphere_mate.core.mate.preprocess_init_kwargs"
] | [((1690, 1782), 'troposphere_mate.core.mate.preprocess_init_kwargs', 'preprocess_init_kwargs', ([], {'title': 'title', 'CommitId': 'CommitId', 'Repository': 'Repository'}), '(title=title, CommitId=CommitId, Repository=\n Repository, **kwargs)\n', (1712, 1782), False, 'from troposphere_mate.core.mate import preproces... |
"""
Parameter Server
================
The parameter server is a framework for distributed machine learning training.
In the parameter server framework, a centralized server (or group of server
nodes) maintains global shared parameters of a machine-learning model
(e.g., a neural network) while the data and computation... | [
"os.path.expanduser",
"numpy.stack",
"torch.from_numpy",
"torchvision.transforms.RandomHorizontalFlip",
"torch.nn.Conv2d",
"torch.nn.CrossEntropyLoss",
"time.time",
"torchvision.datasets.CIFAR10",
"torch.max",
"torch.nn.functional.log_softmax",
"torch.nn.Linear",
"torch.nn.MaxPool2d",
"torch... | [((900, 931), 'os.path.join', 'os.path.join', (['root_dir', '"""train"""'], {}), "(root_dir, 'train')\n", (912, 931), False, 'import os\n'), ((946, 975), 'os.path.join', 'os.path.join', (['root_dir', '"""val"""'], {}), "(root_dir, 'val')\n", (958, 975), False, 'import os\n'), ((3221, 3236), 'torch.no_grad', 'torch.no_g... |
#!/bin/python3
import random
from random import uniform, gauss
from math import sin, cos, pi, sqrt
TRANSLATE_STEPS = 15
class Planet:
def __init__(self, name, radius, r, g, b, distance=None, moons=[], rings=[], orbit_x=None, orbit_y=None, texture=None):
self.name = name
self.distance = distance
... | [
"random.gauss",
"math.cos",
"math.sin",
"random.uniform"
] | [((769, 784), 'random.uniform', 'uniform', (['(20)', '(40)'], {}), '(20, 40)\n', (776, 784), False, 'from random import uniform, gauss\n'), ((2791, 2809), 'random.uniform', 'uniform', (['(0)', '(2 * pi)'], {}), '(0, 2 * pi)\n', (2798, 2809), False, 'from random import uniform, gauss\n'), ((4283, 4294), 'random.gauss', ... |
#!/usr/bin/python
# python 3.7
# 数据检查工具
import os
import operator
import fileIndex
import txtfile
dataDir = ["target", "target/11-5"]
def formatValue(x):
if len(x) == 1:
return "0" + x
else:
return x
def unformatValue(x):
if operator.eq(x[0], "0"):
return x[1:]
else:
... | [
"operator.ne",
"txtfile.loadDict",
"operator.eq",
"os.path.exists",
"txtfile.saveDict",
"os.path.join",
"fileIndex._getTxtFiles"
] | [((258, 280), 'operator.eq', 'operator.eq', (['x[0]', '"""0"""'], {}), "(x[0], '0')\n", (269, 280), False, 'import operator\n'), ((389, 423), 'fileIndex._getTxtFiles', 'fileIndex._getTxtFiles', (['dataDir[0]'], {}), '(dataDir[0])\n', (411, 423), False, 'import fileIndex\n'), ((540, 574), 'os.path.join', 'os.path.join',... |
import numpy as np
def pad_targets(xy):
"""
Pad the targets to be 1hot.
:param xy: A tuple containing the x and y matrices.
:return: The 1hot coded dataset.
"""
x, y = xy
classes = np.max(y) + 1
tmp_data_y = np.zeros((x.shape[0], classes))
for i, dp in zip(range(len(y)), y):
... | [
"numpy.max",
"numpy.where",
"numpy.zeros",
"numpy.hstack"
] | [((242, 273), 'numpy.zeros', 'np.zeros', (['(x.shape[0], classes)'], {}), '((x.shape[0], classes))\n', (250, 273), True, 'import numpy as np\n'), ((211, 220), 'numpy.max', 'np.max', (['y'], {}), '(y)\n', (217, 220), True, 'import numpy as np\n'), ((326, 343), 'numpy.zeros', 'np.zeros', (['classes'], {}), '(classes)\n',... |
import os
import nuke
from pipe.am.project import Project
from pipe.am.environment import Department
from pipe.am.environment import Environment
import pipe.gui.select_from_list as sfl
from pipe.tools.nuketools.nukeutils import utils
class NukeImporter:
def __init__(self):
pass
def import_shot(self... | [
"pipe.tools.nuketools.nukeutils.utils.get_main_window",
"pipe.am.environment.Environment",
"nuke.nodePaste",
"nuke.createNode",
"pipe.am.project.Project",
"os.path.splitext",
"os.path.join",
"os.listdir"
] | [((988, 1040), 'os.path.join', 'os.path.join', (['comp_filepath', "(selection + '.####.jpg')"], {}), "(comp_filepath, selection + '.####.jpg')\n", (1000, 1040), False, 'import os\n'), ((1057, 1106), 'nuke.createNode', 'nuke.createNode', (['"""Write"""', "('file ' + comp_filepath)"], {}), "('Write', 'file ' + comp_filep... |
from mapr.ojai.storage.ConnectionFactory import ConnectionFactory
# Create a connection to data access server
connection_str = "localhost:5678?auth=basic;user=mapr;password=<PASSWORD>;" \
"ssl=true;" \
"sslCA=/opt/mapr/conf/ssl_truststore.pem;" \
"sslTargetNameOverride=node1.mapr.com"
con... | [
"mapr.ojai.storage.ConnectionFactory.ConnectionFactory.get_connection"
] | [((330, 393), 'mapr.ojai.storage.ConnectionFactory.ConnectionFactory.get_connection', 'ConnectionFactory.get_connection', ([], {'connection_str': 'connection_str'}), '(connection_str=connection_str)\n', (362, 393), False, 'from mapr.ojai.storage.ConnectionFactory import ConnectionFactory\n')] |
import argparse
import os
import ref
class opts():
def __init__(self):
self.parser = argparse.ArgumentParser()
def init(self):
self.parser.add_argument('-expID', default = 'default', help = 'Experiment ID')
self.parser.add_argument('-test', action = 'store_true', help = 'test')
self.parser.add_argument('-DE... | [
"os.makedirs",
"os.path.join",
"argparse.ArgumentParser",
"os.path.exists"
] | [((89, 114), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (112, 114), False, 'import argparse\n'), ((3133, 3173), 'os.path.join', 'os.path.join', (['ref.expDir', 'self.opt.expID'], {}), '(ref.expDir, self.opt.expID)\n', (3145, 3173), False, 'import os\n'), ((3504, 3545), 'os.path.join', 'os.p... |
from scapy.layers.bluetooth import *
from pcap_file import PcapFile
class BluetoothUserSocket_WithTrace(BluetoothUserSocket):
def __init__(self, pcap_path, *args, **kws):
self._pcap = PcapFile(pcap_path, 'H4')
super(BluetoothUserSocket_WithTrace, self).__init__(*args, **kws)
def raw(self, x):
... | [
"pcap_file.PcapFile"
] | [((197, 222), 'pcap_file.PcapFile', 'PcapFile', (['pcap_path', '"""H4"""'], {}), "(pcap_path, 'H4')\n", (205, 222), False, 'from pcap_file import PcapFile\n')] |
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Tests of miscellaneous stuff."""
import pytest
from coverage.misc import arcz_to_arcs, contract, dummy_decorator_with_args, file_be_gone
from coverage.misc imp... | [
"coverage.misc.one_of",
"coverage.misc.dummy_decorator_with_args",
"coverage.misc.substitute_variables",
"pytest.raises",
"coverage.misc.contract",
"pytest.mark.parametrize",
"coverage.misc.arcz_to_arcs",
"coverage.misc.Hasher",
"coverage.misc.file_be_gone"
] | [((4148, 4684), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""before, after"""', "[('Nothing to do', 'Nothing to do'), ('Dollar: $$', 'Dollar: $'), (\n 'Simple: $FOO is fooey', 'Simple: fooey is fooey'), (\n 'Braced: X${FOO}X.', 'Braced: XfooeyX.'), (\n 'Missing: x${NOTHING}y is xy', 'Missing: xy... |
#!/usr/bin/python3
# Test installing a quickcpplib project under https://github.com/cpp-pm/hunter
#
# (C) 2020 <NAME> http://www.nedproductions.biz/
# File created: Mar 2020
from __future__ import print_function
import os, sys, shutil, subprocess
from git import Repo
resourcepath = os.path.join(os.path.dirname(__file... | [
"os.makedirs",
"shutil.rmtree",
"os.path.isdir",
"os.path.dirname",
"shutil.copy2",
"os.path.exists",
"sys.exit",
"os.path.join",
"os.listdir",
"shutil.copy",
"git.Repo.init"
] | [((1016, 1048), 'git.Repo.init', 'Repo.init', (['"""test_cpp-pm_install"""'], {}), "('test_cpp-pm_install')\n", (1025, 1048), False, 'from git import Repo\n'), ((1095, 1151), 'shutil.copy', 'shutil.copy', (['testcpppath', '"""test_cpp-pm_install/test.cpp"""'], {}), "(testcpppath, 'test_cpp-pm_install/test.cpp')\n", (11... |
# 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 applic... | [
"pgl.graph.MultiGraph",
"numpy.arange",
"numpy.array",
"paddle.reader.buffered",
"pgl.utils.mp_reader.multiprocess_reader",
"numpy.random.shuffle"
] | [((1206, 1221), 'numpy.arange', 'np.arange', (['size'], {}), '(size)\n', (1215, 1221), True, 'import numpy as np\n'), ((1226, 1249), 'numpy.random.shuffle', 'np.random.shuffle', (['perm'], {}), '(perm)\n', (1243, 1249), True, 'import numpy as np\n'), ((2506, 2534), 'pgl.graph.MultiGraph', 'pgl.graph.MultiGraph', (['gra... |
from django.db import models
class Service(models.Model):
name = models.CharField(max_length=70)
img = models.ImageField(upload_to='services_img')
url = models.CharField(max_length=200)
active = models.BooleanField(default=True)
def __unicode__(self):
return self.name
| [
"django.db.models.CharField",
"django.db.models.BooleanField",
"django.db.models.ImageField"
] | [((71, 102), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(70)'}), '(max_length=70)\n', (87, 102), False, 'from django.db import models\n'), ((113, 156), 'django.db.models.ImageField', 'models.ImageField', ([], {'upload_to': '"""services_img"""'}), "(upload_to='services_img')\n", (130, 156), F... |
#
# Copyright 2019 The FATE 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 appli... | [
"fate_flow.db.db_models.Job",
"fate_flow.utils.session_utils.session_detect",
"fate_flow.db.db_models.DB.connection_context",
"arch.api.utils.log_utils.schedule_logger",
"fate_flow.utils.job_utils.generate_session_id",
"fate_flow.db.db_models.DB.create_tables",
"fate_flow.db.db_models.Task",
"fate_flo... | [((10421, 10451), 'fate_flow.utils.session_utils.session_detect', 'session_utils.session_detect', ([], {}), '()\n', (10449, 10451), False, 'from fate_flow.utils import job_utils, api_utils, model_utils, session_utils\n'), ((12799, 12829), 'fate_flow.utils.session_utils.session_detect', 'session_utils.session_detect', (... |
import datetime
import pytz
from wx.enums import FlashTypeEnum
from wx.models import Flash
def get_int_from_bytes(bytes, signed=False):
return int.from_bytes(bytes, byteorder='big', signed=signed)
def read_data(byte_data):
if byte_data[0] == 56:
type = FlashTypeEnum.CG.value if byte_data[1] == 0 e... | [
"wx.models.Flash.objects.create",
"datetime.datetime.fromtimestamp"
] | [((1710, 2119), 'wx.models.Flash.objects.create', 'Flash.objects.create', ([], {'type': 'type', 'datetime': 'flash_datetime', 'latitude': 'latitude', 'longitude': 'longitude', 'peak_current': 'peak_current', 'ic_height': 'ic_height', 'num_sensors': 'num_sensors', 'ic_multiplicity': 'ic_multiplicity', 'cg_multiplicity':... |
from common.models import AbstractBaseModel
from django.conf import settings
from django.db import models
from django.db.models import Count
class PlayerQuerySet(models.QuerySet):
def have_complete_profile(self):
return self.annotate(
num_regions=Count('regions'),
num_positions=Cou... | [
"django.db.models.OneToOneField",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.Count"
] | [((551, 583), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (567, 583), False, 'from django.db import models\n'), ((595, 667), 'django.db.models.OneToOneField', 'models.OneToOneField', (['settings.AUTH_USER_MODEL'], {'on_delete': 'models.CASCADE'}), '(settings.AU... |
#!/usr/bin/env python3
import sys
import subprocess
from os.path import expanduser
import cliplunch
with open(expanduser("~/.config/cliplunch/clip.lunch"), "r") as conf_file:
config = cliplunch.parse_config(conf_file)
selections = {}
for item in config:
selections[item.name] = item
dmenu_input=""
for key i... | [
"os.path.expanduser",
"cliplunch.parse_config"
] | [((191, 224), 'cliplunch.parse_config', 'cliplunch.parse_config', (['conf_file'], {}), '(conf_file)\n', (213, 224), False, 'import cliplunch\n'), ((113, 157), 'os.path.expanduser', 'expanduser', (['"""~/.config/cliplunch/clip.lunch"""'], {}), "('~/.config/cliplunch/clip.lunch')\n", (123, 157), False, 'from os.path impo... |
import sounddevice as sd
import scipy.io.wavfile as wav
import os
fs=16000
duration = 2 # seconds
name = input("enter your name:")
newpath = r'b:/recordings/{}'.format(name)
if not os.path.exists(newpath):
os.makedirs(newpath)
dataset = 1
while(dataset == 1):
label = input("enter label of dataset:... | [
"os.path.exists",
"os.makedirs",
"sounddevice.wait",
"sounddevice.rec"
] | [((183, 206), 'os.path.exists', 'os.path.exists', (['newpath'], {}), '(newpath)\n', (197, 206), False, 'import os\n'), ((212, 232), 'os.makedirs', 'os.makedirs', (['newpath'], {}), '(newpath)\n', (223, 232), False, 'import os\n'), ((400, 424), 'os.path.exists', 'os.path.exists', (['newpath1'], {}), '(newpath1)\n', (414... |
#!/usr/bin/env python
'''
Execute all pycallgraph examples in this directory.
'''
from glob import glob
examples = glob('*.py')
examples.remove('all.py')
for example in examples:
print(example)
execfile(example)
| [
"glob.glob"
] | [((117, 129), 'glob.glob', 'glob', (['"""*.py"""'], {}), "('*.py')\n", (121, 129), False, 'from glob import glob\n')] |
import logging
from typing import Dict, List, Optional
from allennlp.data import TextFieldTensors, Vocabulary
from allennlp.models import Model
from allennlp.modules import TextFieldEmbedder
from allennlp.nn import InitializerApplicator, RegularizerApplicator
from allennlp.models import Model
from allennlp.training.m... | [
"torch.no_grad",
"logging.getLogger",
"allennlp.models.Model.register"
] | [((697, 726), 'logging.getLogger', 'logging.getLogger', (['"""__name__"""'], {}), "('__name__')\n", (714, 726), False, 'import logging\n'), ((730, 759), 'allennlp.models.Model.register', 'Model.register', (['"""gan_aligner"""'], {}), "('gan_aligner')\n", (744, 759), False, 'from allennlp.models import Model\n'), ((2952... |
"""
Implementation of Base GAN models.
"""
import torch
from torch_mimicry.nets.basemodel import basemodel
from torch_mimicry.modules import losses
class BaseGenerator(basemodel.BaseModel):
r"""
Base class for a generic unconditional generator model.
Attributes:
nz (int): Noise dimension for ups... | [
"torch_mimicry.modules.losses.hinge_loss_gen",
"torch_mimicry.modules.losses.hinge_loss_dis",
"torch.randn",
"torch.sigmoid",
"torch_mimicry.modules.losses.minimax_loss_gen",
"torch_mimicry.modules.losses.ns_loss_gen",
"torch_mimicry.modules.losses.wasserstein_loss_gen",
"torch_mimicry.modules.losses.... | [((1176, 1225), 'torch.randn', 'torch.randn', (['(num_images, self.nz)'], {'device': 'device'}), '((num_images, self.nz), device=device)\n', (1187, 1225), False, 'import torch\n'), ((1682, 1713), 'torch_mimicry.modules.losses.minimax_loss_gen', 'losses.minimax_loss_gen', (['output'], {}), '(output)\n', (1705, 1713), Fa... |
# Copyright 2020 Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | [
"ctypes.byref",
"ctypes.c_char_p",
"ctypes.util.find_library",
"ctypes.POINTER"
] | [((726, 748), 'ctypes.util.find_library', 'find_library', (['"""nispor"""'], {}), "('nispor')\n", (738, 748), False, 'from ctypes.util import find_library\n'), ((844, 861), 'ctypes.POINTER', 'POINTER', (['c_char_p'], {}), '(c_char_p)\n', (851, 861), False, 'from ctypes import c_int, c_char_p, c_uint32, Structure, POINT... |
"""
Builds interacts with builds.json
"""
import json
import os
import semver
import gi
import collections
gi.require_version('OSTree', '1.0')
from gi.repository import Gio, OSTree
from cosalib.cmdlib import (
get_basearch,
rfc3339_time,
get_timestamp,
load_json,
write_json)
Build = collections.... | [
"cosalib.cmdlib.write_json",
"json.dump",
"gi.require_version",
"json.load",
"cosalib.cmdlib.rfc3339_time",
"cosalib.cmdlib.load_json",
"cosalib.cmdlib.get_timestamp",
"os.path.isfile",
"collections.namedtuple",
"gi.repository.Gio.File.new_for_path",
"os.path.join",
"os.scandir",
"cosalib.cm... | [((109, 144), 'gi.require_version', 'gi.require_version', (['"""OSTree"""', '"""1.0"""'], {}), "('OSTree', '1.0')\n", (127, 144), False, 'import gi\n'), ((308, 374), 'collections.namedtuple', 'collections.namedtuple', (['"""Build"""', "['id', 'timestamp', 'basearches']"], {}), "('Build', ['id', 'timestamp', 'basearches... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'default_mode.ui'
#
# Created by: PyQt5 UI code generator 5.15.0
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore,... | [
"PyQt5.QtWidgets.QGridLayout",
"PyQt5.QtCore.QSize",
"PyQt5.QtGui.QCursor",
"PyQt5.QtCore.QMetaObject.connectSlotsByName",
"PyQt5.QtWidgets.QListWidget"
] | [((482, 509), 'PyQt5.QtWidgets.QGridLayout', 'QtWidgets.QGridLayout', (['Form'], {}), '(Form)\n', (503, 509), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((682, 709), 'PyQt5.QtWidgets.QListWidget', 'QtWidgets.QListWidget', (['Form'], {}), '(Form)\n', (703, 709), False, 'from PyQt5 import QtCore, QtGui, QtWi... |
from PIL import Image
def quarterImage(ifile,TL,TR,BL,BR):
im = Image.open(ifile)
topLeft = im.crop((0,0,50,50))
topRight = im.crop((50,0,100,50))
bottomLeft = im.crop((0,50,50,100))
bottomRight = im.crop((50,50,100,100))
topLeft.save(TL,"PNG")
topRight.save(TR,"PNG")
bottomLeft.save(BL,... | [
"PIL.Image.open"
] | [((68, 85), 'PIL.Image.open', 'Image.open', (['ifile'], {}), '(ifile)\n', (78, 85), False, 'from PIL import Image\n')] |
#Exercícios Numpy-06
#*******************
import numpy as np
arr=np.zeros(10)
arr[5]=1
print(arr) | [
"numpy.zeros"
] | [((66, 78), 'numpy.zeros', 'np.zeros', (['(10)'], {}), '(10)\n', (74, 78), True, 'import numpy as np\n')] |
from discord import Message
from discord.ext import commands
from bashbot.command import session_exists, has_permission
from bashbot.terminal.sessions import sessions
from bashbot.terminal.terminal import Terminal
class ControlsCommand(commands.Cog):
@commands.group(name='.controls')
async def controls(self,... | [
"bashbot.command.has_permission",
"bashbot.terminal.sessions.sessions",
"bashbot.command.session_exists",
"discord.ext.commands.group"
] | [((259, 291), 'discord.ext.commands.group', 'commands.group', ([], {'name': '""".controls"""'}), "(name='.controls')\n", (273, 291), False, 'from discord.ext import commands\n'), ((417, 433), 'bashbot.command.session_exists', 'session_exists', ([], {}), '()\n', (431, 433), False, 'from bashbot.command import session_ex... |
import csv
table = []
with open('iso639-autonyms.tsv', 'rt', newline='', encoding='utf-8') as f:
reader = csv.reader(f, dialect='excel-tab')
for row in reader:
current_row = []
current_row.extend(row[:3])
current_row.append(row[3].title())
table.append(current_row)
with open('iso639-autonyms.csv', 'wt', ne... | [
"csv.reader",
"csv.writer"
] | [((109, 143), 'csv.reader', 'csv.reader', (['f'], {'dialect': '"""excel-tab"""'}), "(f, dialect='excel-tab')\n", (119, 143), False, 'import csv\n'), ((368, 381), 'csv.writer', 'csv.writer', (['f'], {}), '(f)\n', (378, 381), False, 'import csv\n')] |
from __future__ import unicode_literals
from django import forms
from django.utils.safestring import mark_safe
from django.utils.encoding import force_text
from django.forms.utils import flatatt
class AlohaWidget(forms.Widget):
def __init__(self, attrs=None):
default_attrs = {}
if attrs:
... | [
"django.forms.utils.flatatt",
"django.utils.encoding.force_text"
] | [((775, 792), 'django.utils.encoding.force_text', 'force_text', (['value'], {}), '(value)\n', (785, 792), False, 'from django.utils.encoding import force_text\n'), ((794, 814), 'django.forms.utils.flatatt', 'flatatt', (['final_attrs'], {}), '(final_attrs)\n', (801, 814), False, 'from django.forms.utils import flatatt\n... |
r"""Functions for inclusive semi-leptonic $B$ decays.
See arXiv:1107.3100."""
import flavio
from flavio.physics.bdecays.wilsoncoefficients import get_wceff_fccc_std
from math import pi
from cmath import log, sqrt
from flavio.classes import Observable, Prediction
from flavio.config import config
from functools import... | [
"flavio.physics.running.running.get_mb",
"cmath.sqrt",
"flavio.physics.running.running.get_mb_KS",
"cmath.log",
"flavio.physics.ckm.get_ckm",
"flavio.classes.Observable",
"flavio.physics.bdecays.wilsoncoefficients.get_wceff_fccc_std",
"flavio.physics.running.running.get_mc",
"flavio.physics.running.... | [((3234, 3285), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': "config['settings']['cache size']"}), "(maxsize=config['settings']['cache size'])\n", (3243, 3285), False, 'from functools import lru_cache\n'), ((4874, 4925), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': "config['settings']['cache size']"}), ... |
from django.contrib import admin
# Register your models here.
from quiz.base.models import Pergunta, Player, Resposta
@admin.register(Pergunta)
class PerguntaAdmin(admin.ModelAdmin):
list_display = ('id', 'sub_title', 'disponivel')
@admin.register(Player)
class PlayerAdmin(admin.ModelAdmin):
list_display =... | [
"django.contrib.admin.register"
] | [((122, 146), 'django.contrib.admin.register', 'admin.register', (['Pergunta'], {}), '(Pergunta)\n', (136, 146), False, 'from django.contrib import admin\n'), ((242, 264), 'django.contrib.admin.register', 'admin.register', (['Player'], {}), '(Player)\n', (256, 264), False, 'from django.contrib import admin\n'), ((356, ... |
from __future__ import absolute_import
import datetime
from pytest import fixture, mark
from freezegun import freeze_time
from huskar_api.models import huskar_client
from huskar_api.models.container import ContainerManagement
from huskar_api.models.instance import InstanceManagement
from ..utils import assert_respon... | [
"huskar_api.models.container.ContainerManagement.vacuum_stale_barriers",
"huskar_api.models.container.ContainerManagement",
"freezegun.freeze_time",
"datetime.timedelta",
"pytest.mark.parametrize",
"huskar_api.models.instance.InstanceManagement"
] | [((1992, 2374), 'pytest.mark.parametrize', 'mark.parametrize', (['"""registry,instance_list"""', "[([], []), ([('base.foo', 'alpha_stable')], [('base.foo', 'alpha_stable')]),\n ([('base.foo', 'alpha_stable'), ('base.bar', 'alpha_dev')], [(\n 'base.foo', 'alpha_stable')]), ([('base.foo', 'alpha_stable'), (\n 'b... |
#!/usr/local/bin/python
"""
Author: <NAME>
Contact: <EMAIL>
Testing:
import dash_client
mpd_file = <MPD_FILE>
dash_client.playback_duration(mpd_file, 'http://172.16.31.10:8005/')
From commandline:
python dash_client.py -m "http://172.16.31.10:8006/media/mpd/x4ukwHdACDw.mpd" -p ... | [
"urllib.parse.urljoin",
"argparse.ArgumentParser",
"os.unlink",
"adaptation.basic_dash.basic_dash",
"adaptation.basic_dash2.basic_dash2",
"collections.defaultdict",
"os.path.isfile",
"multiprocessing.Queue",
"os.path.join",
"urllib.parse.urlparse",
"config_dash.LOG.debug",
"os.path.dirname",
... | [((3110, 3123), 'urllib.parse.urlparse', 'urlparse', (['url'], {}), '(url)\n', (3118, 3123), False, 'from urllib.parse import urlparse\n'), ((4607, 4628), 'urllib.parse.urlparse', 'urlparse', (['segment_url'], {}), '(segment_url)\n', (4615, 4628), False, 'from urllib.parse import urlparse\n'), ((5658, 5680), 'timeit.de... |
# -*- coding: utf-8 -*-
"""
profiling.remote.background
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Utilities to run a profiler in a background thread.
"""
from __future__ import absolute_import
import os
import signal
import threading
from ..profiler import ProfilerWrapper
__all__ = ['BackgroundProfiler']
class Bac... | [
"signal.signal",
"threading.Event",
"os.getpid"
] | [((575, 592), 'threading.Event', 'threading.Event', ([], {}), '()\n', (590, 592), False, 'import threading\n'), ((840, 888), 'signal.signal', 'signal.signal', (['self.signum', 'self._signal_handler'], {}), '(self.signum, self._signal_handler)\n', (853, 888), False, 'import signal\n'), ((1051, 1062), 'os.getpid', 'os.ge... |
import pytest
def make_greet_mod(greeting):
from cgen import FunctionBody, FunctionDeclaration, Block, \
Const, Pointer, Value, Statement
from codepy.bpl import BoostPythonModule
mod = BoostPythonModule()
mod.add_function(
FunctionBody(
FunctionDeclaration(Con... | [
"cgen.Value",
"codepy.bpl.BoostPythonModule",
"codepy.toolchain.guess_toolchain",
"cgen.Statement",
"pytest.mark.xfail"
] | [((557, 683), 'pytest.mark.xfail', 'pytest.mark.xfail', ([], {'reason': '"""You probably don\'t have Boost.Python installed where I am looking for it, and that\'s OK."""'}), '(reason=\n "You probably don\'t have Boost.Python installed where I am looking for it, and that\'s OK."\n )\n', (574, 683), False, 'import ... |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html
import scrapy
# 景点基本信息
class XiechengScrapyItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
scenic_id = scrapy.Fiel... | [
"scrapy.Field"
] | [((309, 323), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (321, 323), False, 'import scrapy\n'), ((342, 356), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (354, 356), False, 'import scrapy\n'), ((376, 390), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (388, 390), False, 'import scrapy\n'), ((412, 426), ... |
import numpy as np
# parse the numpy versions
np_version = [int(i) for i in np.version.full_version.split('.')]
# comparing strings does not work for version lower 1.10
if np_version >= [1, 14]:
np.set_printoptions(legacy='1.13') | [
"numpy.version.full_version.split",
"numpy.set_printoptions"
] | [((200, 234), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'legacy': '"""1.13"""'}), "(legacy='1.13')\n", (219, 234), True, 'import numpy as np\n'), ((77, 111), 'numpy.version.full_version.split', 'np.version.full_version.split', (['"""."""'], {}), "('.')\n", (106, 111), True, 'import numpy as np\n')] |
# Generated by Django 2.2.4 on 2019-10-27 12:51
import django.contrib.gis.db.models.fields
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
... | [
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.SmallIntegerField",
"django.db.models.DateTimeField"
] | [((423, 516), '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", (439, 516), False, 'from django.db import migrations, models\... |
import json
import sys
from io import StringIO
import requests
import pandas
import time
import urllib
from SciServer import Authentication, Config
######################################################################################################################
# Jobs:
def getJobStatus(jobId):
"""
Ge... | [
"SciServer.Config.isSciServerComputeEnvironment",
"SciServer.Authentication.getToken",
"json.dumps",
"requests.delete",
"requests.get",
"requests.put",
"requests.post"
] | [((963, 988), 'SciServer.Authentication.getToken', 'Authentication.getToken', ([], {}), '()\n', (986, 988), False, 'from SciServer import Authentication, Config\n'), ((2592, 2617), 'SciServer.Authentication.getToken', 'Authentication.getToken', ([], {}), '()\n', (2615, 2617), False, 'from SciServer import Authenticatio... |
# -------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
# ----------------------------------------------------------------------... | [
"pytest.mark.timeout",
"uniProt.localcopy.LocalCopy",
"pathlib.Path"
] | [((557, 598), 'uniProt.localcopy.LocalCopy', 'LocalCopy', (['TEST_FILES_DIR'], {'save_copy': '(True)'}), '(TEST_FILES_DIR, save_copy=True)\n', (566, 598), False, 'from uniProt.localcopy import LocalCopy\n'), ((602, 625), 'pytest.mark.timeout', 'pytest.mark.timeout', (['(10)'], {}), '(10)\n', (621, 625), False, 'import ... |
import torch
import random
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
import torch.optim as optim
import math
class MyNetwork(nn.Module):
def __init__(self, inputs, outputs, intermediary=4, learning_rate=0.0005, dropout=0.5, model=None):
super(MyNetwork, self).__init__()
... | [
"torch.nn.Dropout",
"torch.nn.MSELoss",
"torch.load",
"torch.nn.Softmax",
"torch.nn.Linear",
"torch.tensor"
] | [((509, 550), 'torch.nn.Linear', 'nn.Linear', (['self.inputs', 'self.intermediary'], {}), '(self.inputs, self.intermediary)\n', (518, 550), True, 'import torch.nn as nn\n'), ((570, 612), 'torch.nn.Linear', 'nn.Linear', (['self.intermediary', 'self.outputs'], {}), '(self.intermediary, self.outputs)\n', (579, 612), True,... |
"""generate_abstract_features.py
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Run the images in RMNIST through a truncated version of ResNet-18, and
save the features in the final layer. Based on the transfer learning
tutorial and code by <NAME>, at
http://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html.
Note that... | [
"torchvision.models.resnet18",
"gzip.open",
"torchvision.transforms.Scale",
"torch.autograd.Variable",
"numpy.zeros",
"data_loader.load_data",
"cPickle.dump",
"PIL.Image.fromarray",
"torchvision.transforms.Normalize",
"torchvision.transforms.ToTensor"
] | [((870, 902), 'torchvision.models.resnet18', 'models.resnet18', ([], {'pretrained': '(True)'}), '(pretrained=True)\n', (885, 902), False, 'from torchvision import datasets, models, transforms\n'), ((3728, 3749), 'gzip.open', 'gzip.open', (['name', '"""wb"""'], {}), "(name, 'wb')\n", (3737, 3749), False, 'import gzip\n'... |
#!/usr/bin/env python2
#
# Copyright 2016 <NAME>. 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... | [
"voluptuous.Range",
"yaml.load",
"voluptuous.Optional",
"voluptuous.Any",
"voluptuous.Length",
"voluptuous.Required",
"datetime.datetime.strptime",
"voluptuous.Schema"
] | [((838, 866), 'voluptuous.Any', 'voluptuous.Any', (['str', 'unicode'], {}), '(str, unicode)\n', (852, 866), False, 'import voluptuous\n'), ((868, 892), 'voluptuous.Length', 'voluptuous.Length', ([], {'min': '(1)'}), '(min=1)\n', (885, 892), False, 'import voluptuous\n'), ((919, 947), 'voluptuous.Any', 'voluptuous.Any',... |
import site
import os
names = site.getusersitepackages()
found = False
for name in names:
if (not found):
fullname = name + os.sep +'numpy'+os.sep+'core'+os.sep+'include'
found = os.path.isdir(fullname)
if (found):
print(fullname)
if (not found):
names = site.get... | [
"site.getsitepackages",
"os.path.isdir",
"site.getusersitepackages"
] | [((34, 60), 'site.getusersitepackages', 'site.getusersitepackages', ([], {}), '()\n', (58, 60), False, 'import site\n'), ((312, 334), 'site.getsitepackages', 'site.getsitepackages', ([], {}), '()\n', (332, 334), False, 'import site\n'), ((203, 226), 'os.path.isdir', 'os.path.isdir', (['fullname'], {}), '(fullname)\n', ... |
from PySide2.QtWidgets import QFrame, QVBoxLayout, QWidget
from PySide2.QtCore import Qt
from core_rope_sim import CoreRopeSim
from erasable_mem_sim import ErasableMemSim
from measurements import Measurements
from alarms import Alarms
from trace import Trace
class AlarmMemPanel(QFrame):
def __init__(self, parent, ... | [
"measurements.Measurements",
"core_rope_sim.CoreRopeSim",
"PySide2.QtWidgets.QVBoxLayout",
"alarms.Alarms",
"trace.Trace",
"erasable_mem_sim.ErasableMemSim"
] | [((546, 563), 'PySide2.QtWidgets.QVBoxLayout', 'QVBoxLayout', (['self'], {}), '(self)\n', (557, 563), False, 'from PySide2.QtWidgets import QFrame, QVBoxLayout, QWidget\n'), ((747, 772), 'alarms.Alarms', 'Alarms', (['self', 'self._usbif'], {}), '(self, self._usbif)\n', (753, 772), False, 'from alarms import Alarms\n'),... |
# This file is part of the Data Cleaning Library (openclean).
#
# Copyright (C) 2018-2021 New York University.
#
# openclean is released under the Revised BSD License. See file LICENSE for
# full license details.
"""Unit tests for majority vote selector."""
import pytest
from openclean.function.value.aggregate impor... | [
"openclean.function.value.vote.MajorityVote",
"pytest.raises",
"openclean.function.value.aggregate.Max"
] | [((844, 869), 'pytest.raises', 'pytest.raises', (['ValueError'], {}), '(ValueError)\n', (857, 869), False, 'import pytest\n'), ((595, 609), 'openclean.function.value.vote.MajorityVote', 'MajorityVote', ([], {}), '()\n', (607, 609), False, 'from openclean.function.value.vote import MajorityVote\n'), ((879, 893), 'opencl... |
import atexit
import logging
import os
import shlex
import subprocess
import sys
import threading
import time
import yaml
from future.standard_library import install_aliases
from pyngrok import conf
from pyngrok.exception import PyngrokNgrokError, PyngrokSecurityError
from pyngrok.installer import validate_config
in... | [
"atexit.register",
"subprocess.Popen",
"threading.Thread",
"pyngrok.installer.validate_config",
"future.standard_library.install_aliases",
"subprocess.check_output",
"shlex.split",
"urllib.request.urlopen",
"os.path.exists",
"time.time",
"subprocess.call",
"yaml.safe_load",
"logging.getLogge... | [((318, 335), 'future.standard_library.install_aliases', 'install_aliases', ([], {}), '()\n', (333, 335), False, 'from future.standard_library import install_aliases\n'), ((688, 715), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (705, 715), False, 'import logging\n'), ((7959, 7989), 'su... |
#
# USBProxy logging filters
#
import datetime
from ..USBProxy import USBProxyFilter
class USBProxyPrettyPrintFilter(USBProxyFilter):
"""
Filter that pretty prints USB transactions according to log levels.
"""
def __init__(self, verbose, decoration=''):
"""
Sets up a new USBProxy pret... | [
"datetime.datetime.now"
] | [((2879, 2902), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (2900, 2902), False, 'import datetime\n')] |
import csv
import pathlib
import requests
# create folders for later use
pathlib.Path('data/recent_changes').mkdir(parents=True, exist_ok=True)
pathlib.Path('data/allrevisions').mkdir(parents=True, exist_ok=True)
base_url = 'https://de.wikipedia.org/w/api.php?action=query&format=json&list=categorymembers&cmtitle=K... | [
"pathlib.Path",
"requests.get",
"csv.DictWriter"
] | [((452, 469), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (464, 469), False, 'import requests\n'), ((1113, 1159), 'csv.DictWriter', 'csv.DictWriter', (['csvfile'], {'fieldnames': 'fieldnames'}), '(csvfile, fieldnames=fieldnames)\n', (1127, 1159), False, 'import csv\n'), ((75, 110), 'pathlib.Path', 'pathli... |
import dicom
import os
import numpy as np
from matplotlib import pyplot, cm
def readDataset(folder):
X = []
label = []
for dirName, subdirList, fileList in os.walk(folder):
for filename in fileList:
filename = os.path.join(dirName, filename)
# Lendo o arquivo
RefDs = dicom.read_file(filename)
#... | [
"numpy.rollaxis",
"os.walk",
"os.path.join",
"dicom.read_file"
] | [((162, 177), 'os.walk', 'os.walk', (['folder'], {}), '(folder)\n', (169, 177), False, 'import os\n'), ((221, 252), 'os.path.join', 'os.path.join', (['dirName', 'filename'], {}), '(dirName, filename)\n', (233, 252), False, 'import os\n'), ((286, 311), 'dicom.read_file', 'dicom.read_file', (['filename'], {}), '(filename... |
#Use this code for dev as of 11.9.21
#The Art VanDeLay imports/exports... but more imports than exports... and that's his problem
import pandas as pd
import os
import re
from itertools import chain
from datetime import date
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from collec... | [
"pandas.DataFrame",
"itertools.chain.from_iterable",
"re.split",
"os.getcwd",
"numpy.std",
"pandas.ExcelWriter",
"pandas.ExcelFile",
"openpyxl.load_workbook",
"datetime.date.today",
"numpy.percentile",
"numpy.mean",
"scipy.stats.sem",
"numpy.round",
"matplotlib.pyplot.subplots",
"os.list... | [((5645, 5656), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (5654, 5656), False, 'import os\n'), ((6835, 6864), 'os.listdir', 'os.listdir', (['self.path_to_data'], {}), '(self.path_to_data)\n', (6845, 6864), False, 'import os\n'), ((16923, 16945), 'pandas.DataFrame', 'pd.DataFrame', (['df_maker'], {}), '(df_maker)\n', ... |
"""Normalization layers implementation."""
import numpy as np
import tensorflow as tf
from tensorflow.python.keras import initializers
import tf_encrypted as tfe
from tf_encrypted.keras import backend as KE
from tf_encrypted.keras.engine import Layer
from tf_encrypted.keras.layers.layers_utils import default_args_chec... | [
"tf_encrypted.define_public_placeholder",
"tf_encrypted.add",
"tf_encrypted.keras.layers.layers_utils.default_args_check",
"tensorflow.python.keras.initializers.get",
"tf_encrypted.keras.backend.get_session",
"tensorflow.sqrt",
"tf_encrypted.assign",
"tf_encrypted.define_public_variable"
] | [((5541, 5575), 'tensorflow.python.keras.initializers.get', 'initializers.get', (['beta_initializer'], {}), '(beta_initializer)\n', (5557, 5575), False, 'from tensorflow.python.keras import initializers\n'), ((5609, 5644), 'tensorflow.python.keras.initializers.get', 'initializers.get', (['gamma_initializer'], {}), '(ga... |
import math
from voronoi.graph.coordinate import Coordinate
class Breakpoint:
"""
A breakpoint between two arcs.
"""
def __init__(self, breakpoint: tuple, edge=None):
"""
The breakpoint is stored by an ordered tuple of sites (p_i, p_j) where p_i defines the parabola left of the
... | [
"voronoi.graph.coordinate.Coordinate",
"math.sqrt"
] | [((1657, 1669), 'voronoi.graph.coordinate.Coordinate', 'Coordinate', ([], {}), '()\n', (1667, 1669), False, 'from voronoi.graph.coordinate import Coordinate\n'), ((2614, 2740), 'math.sqrt', 'math.sqrt', (['(v * (a ** 2 * u - 2 * a * c * u + b ** 2 * (u - v) + c ** 2 * u) + d ** 2 *\n u * (v - u) + l ** 2 * (u - v) *... |
import os
import sys
import tempfile
import textwrap
import logging
import pytest
class TestBaseClass:
TEST_UNDEFINED_PARAMETER = 'this is an undefined parameter to work around pytest limitations'
@classmethod
def setup_class(cls):
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__) + ... | [
"textwrap.dedent",
"oelint_adv.__main__.run",
"oelint_adv.__main__.create_argparser",
"os.path.dirname",
"tempfile.mkdtemp",
"os.path.join"
] | [((702, 735), 'os.path.join', 'os.path.join', (['self._tmpdir', '_file'], {}), '(self._tmpdir, _file)\n', (714, 735), False, 'import os\n'), ((1935, 1944), 'oelint_adv.__main__.run', 'run', (['args'], {}), '(args)\n', (1938, 1944), False, 'from oelint_adv.__main__ import run\n'), ((2112, 2130), 'oelint_adv.__main__.cre... |
import configparser
from copy import deepcopy
class ConfigReader:
def __init__(self, file_path):
self.file_path = file_path
self.config_parser = configparser.ConfigParser()
self.config_parser.read(file_path)
self.config = {}
if len(self.config_parser.sections()) > 1:
... | [
"copy.deepcopy",
"configparser.ConfigParser"
] | [((167, 194), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (192, 194), False, 'import configparser\n'), ((530, 543), 'copy.deepcopy', 'deepcopy', (['val'], {}), '(val)\n', (538, 543), False, 'from copy import deepcopy\n'), ((722, 735), 'copy.deepcopy', 'deepcopy', (['val'], {}), '(val)\n'... |
from collections import defaultdict
from itertools import chain
from pkgcore.restrictions import packages, values
from snakeoil.strings import pluralism as _pl
from .. import addons, base, results, sources
from . import Check
class PotentialStable(results.VersionResult, results.Info):
"""Stable arches with pote... | [
"collections.defaultdict",
"itertools.chain.from_iterable",
"pkgcore.restrictions.values.ContainmentMatch2",
"snakeoil.strings.pluralism"
] | [((2909, 2926), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (2920, 2926), False, 'from collections import defaultdict\n'), ((2812, 2856), 'pkgcore.restrictions.values.ContainmentMatch2', 'values.ContainmentMatch2', (['self.source_arches'], {}), '(self.source_arches)\n', (2836, 2856), False, 'f... |
# -*- coding: utf-8 -*-
from recc.argparse.config.core_config import CoreConfig
from recc.http.http_app import HttpAppCallback, HttpApp
from recc.core.context import Context
def core_main(
config: CoreConfig,
http_callback: HttpAppCallback = None,
) -> int:
application = HttpApp(
context=Context(... | [
"recc.core.context.Context"
] | [((312, 327), 'recc.core.context.Context', 'Context', (['config'], {}), '(config)\n', (319, 327), False, 'from recc.core.context import Context\n')] |
"""
Email backend that writes messages to console instead of sending them.
"""
import sys
import threading
from django.core.mail.backends.base import BaseEmailBackend
from django.utils import six
class EmailBackend(BaseEmailBackend):
def __init__(self, *args, **kwargs):
self.stream = kwargs.p... | [
"threading.RLock"
] | [((367, 384), 'threading.RLock', 'threading.RLock', ([], {}), '()\n', (382, 384), False, 'import threading\n')] |
import yaml
from typing import Any, Dict, TextIO
import logging
from mlagents.trainers.meta_curriculum import MetaCurriculum
from mlagents.trainers.exception import TrainerConfigError
from mlagents.trainers.trainer import Trainer, UnityTrainerException
from mlagents.trainers.ppo.trainer import PPOTrainer
from mlagents... | [
"mlagents.trainers.trainer.UnityTrainerException",
"mlagents.trainers.ppo.trainer.PPOTrainer",
"mlagents.trainers.exception.TrainerConfigError",
"yaml.safe_load",
"mlagents.trainers.sac.trainer.SACTrainer",
"logging.getLogger"
] | [((370, 408), 'logging.getLogger', 'logging.getLogger', (['"""mlagents.trainers"""'], {}), "('mlagents.trainers')\n", (387, 408), False, 'import logging\n'), ((2874, 3054), 'mlagents.trainers.exception.TrainerConfigError', 'TrainerConfigError', (['f"""Trainer config must have either a "default" section, or a section fo... |
"""
Module installation script
"""
import os
from setuptools import setup, find_packages
with open(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'README.md')) as f:
LONG_DESCRIPTION = f.read()
def package_files(directory):
"""
Get all files/directories in a directory
:param directory: pat... | [
"os.path.dirname",
"os.walk",
"os.path.join",
"setuptools.find_packages"
] | [((473, 491), 'os.walk', 'os.walk', (['directory'], {}), '(directory)\n', (480, 491), False, 'import os\n'), ((972, 987), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (985, 987), False, 'from setuptools import setup, find_packages\n'), ((130, 155), 'os.path.dirname', 'os.path.dirname', (['__file__'], ... |
from MangroveConservation import clean_text1 as clean_txt
import pytest
import datetime
import numpy as np
import os
path = os.getcwd()
def test_import_comment():
data = clean_txt.import_comment(path +r'\MangroveConservation\test\test_tweet.csv', 'text')
assert len(data['text']) == 2
def test_text_cleaner():
... | [
"MangroveConservation.clean_text1.import_comment",
"os.getcwd",
"datetime.date",
"MangroveConservation.clean_text1.import_tweet",
"MangroveConservation.clean_text1.comment_cleaner"
] | [((124, 135), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (133, 135), False, 'import os\n'), ((174, 265), 'MangroveConservation.clean_text1.import_comment', 'clean_txt.import_comment', (["(path + '\\\\MangroveConservation\\\\test\\\\test_tweet.csv')", '"""text"""'], {}), "(path +\n '\\\\MangroveConservation\\\\test\... |
# ANTgen -- the AMBAL-based NILM Trace generator
#
# Copyright (C) 2019-2020 <NAME> <<EMAIL>>, TU Clausthal
#
# 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, i... | [
"LoadModelComponents.OnOffDecayModel",
"LoadModelComponents.LinearModel",
"numpy.zeros",
"LoadModelComponents.OnOffGrowthModel",
"LoadModelComponents.NoiseModel",
"LoadModelComponents.OnOffModel",
"bitarray.bitarray",
"logging.getLogger"
] | [((1518, 1545), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1535, 1545), False, 'import logging\n'), ((1658, 1697), 'bitarray.bitarray', 'bitarray', (['(num_days * Tools.secs_per_day)'], {}), '(num_days * Tools.secs_per_day)\n', (1666, 1697), False, 'from bitarray import bitarray\n'),... |
"""weather sensor unique type and location
Revision ID: <KEY>
Revises: <KEY>
Create Date: 2018-09-12 11:14:46.486640
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revision = "<KEY>"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generate... | [
"alembic.op.create_unique_constraint",
"alembic.op.drop_constraint"
] | [((358, 492), 'alembic.op.create_unique_constraint', 'op.create_unique_constraint', (['"""_type_name_location_unique"""', '"""weather_sensor"""', "['weather_sensor_type_name', 'latitude', 'longitude']"], {}), "('_type_name_location_unique', 'weather_sensor',\n ['weather_sensor_type_name', 'latitude', 'longitude'])\n... |
import fibra
import fibra.net
import fibra.event
try:
import cPickle as pickle
except:
import pickle
import exceptions
import json
import time
import types
import zlib
schedule = fibra.schedule()
class NULL(object): pass
class Timeout(Exception): pass
class Disconnect(Exception): pass
class Connection(f... | [
"pickle.loads",
"fibra.event.Connection.__init__",
"fibra.schedule",
"fibra.event.Connection.dispatch",
"json.loads",
"fibra.Suspend",
"json.dumps",
"time.time",
"fibra.event.Connection.send",
"zlib.compress",
"zlib.decompress",
"fibra.Self",
"fibra.Return",
"pickle.dumps"
] | [((190, 206), 'fibra.schedule', 'fibra.schedule', ([], {}), '()\n', (204, 206), False, 'import fibra\n'), ((451, 501), 'fibra.event.Connection.__init__', 'fibra.event.Connection.__init__', (['self', '*args'], {}), '(self, *args, **kw)\n', (482, 501), False, 'import fibra\n'), ((710, 721), 'time.time', 'time.time', ([],... |
from django.contrib import admin
# Register your models here.
from snippets.models import CourseUsers
@admin.register(CourseUsers)
class CourseUsersAdmin(admin.ModelAdmin):
list_display = ('id', 'course', 'owner')
| [
"django.contrib.admin.register"
] | [((105, 132), 'django.contrib.admin.register', 'admin.register', (['CourseUsers'], {}), '(CourseUsers)\n', (119, 132), False, 'from django.contrib import admin\n')] |
# Really, really stupid commands.
import os
import random
import discord as dc
from discord.ext import commands
from cogs_textbanks import query_bank, response_bank, url_bank
from bot_common import bot
_addpath = lambda f: os.path.join('text', f)
_daves = _addpath('daves.txt')
_ryders = _addpath('ryders.txt')
_dung... | [
"discord.ext.commands.command",
"random.choices",
"discord.ext.commands.Cog.listener",
"discord.Color",
"discord.ext.commands.bot_has_permissions",
"random.randrange",
"discord.ext.commands.group",
"os.path.join"
] | [((226, 249), 'os.path.join', 'os.path.join', (['"""text"""', 'f'], {}), "('text', f)\n", (238, 249), False, 'import os\n'), ((1737, 1760), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (1758, 1760), False, 'from discord.ext import commands\n'), ((1909, 1945), 'discord.ext.commands.com... |
# Copyright 2019 <NAME>, Lingjiao and <NAME>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in... | [
"numpy.nansum",
"numpy.isnan",
"numpy.nanmean"
] | [((2584, 2606), 'numpy.nansum', 'np.nansum', (['m.ent_table'], {}), '(m.ent_table)\n', (2593, 2606), True, 'import numpy as np\n'), ((2929, 2950), 'numpy.isnan', 'np.isnan', (['m.ent_table'], {}), '(m.ent_table)\n', (2937, 2950), True, 'import numpy as np\n'), ((3024, 3048), 'numpy.isnan', 'np.isnan', (['m.att_table[i]... |
#!/usr/bin/env python
from setuptools import setup
VERSION = '1.1.0'
DESCRIPTION = "bloomfpy: Bloom Filter implementation for python, a probabilistic data structure"
LONG_DESCRIPTION = """
bloomfpy is a bloom filter implemented in python, bloom filters are probabilistic data structures with sub linear space requiremen... | [
"setuptools.setup"
] | [((665, 1111), 'setuptools.setup', 'setup', ([], {'name': '"""bloomfpy"""', 'version': 'VERSION', 'description': 'DESCRIPTION', 'long_description': 'LONG_DESCRIPTION', 'classifiers': 'CLASSIFIERS', 'keywords': "('data structures', 'bloom filter', 'bloom', 'filter', 'probabilistic', 'set')", 'author': '"""<NAME>"""', 'a... |
#!/usr/bin/env python3.6
import json
import os
from datetime import datetime
METRICS = ["time", "ping", "upload", "download", "status"]
class Metric:
def __init__(self, ping, upload, download, status_ok, *,
unit_time='ms', unit_bandwidth='bps'):
self.ping = ping
self.upload = ... | [
"os.path.isfile",
"datetime.datetime.now",
"os.stat",
"json.dumps"
] | [((419, 433), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (431, 433), False, 'from datetime import datetime\n'), ((1781, 1807), 'os.path.isfile', 'os.path.isfile', (['self._file'], {}), '(self._file)\n', (1795, 1807), False, 'import os\n'), ((2376, 2402), 'os.path.isfile', 'os.path.isfile', (['self._file... |
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 19 13:43:36 2020
@author: ykrempp
"""
import numpy as np
import cv2
import matplotlib.pyplot as plt
#gabor is a bandpass filter
#parameters (allow to generate a large set of features)
ksize = 5 #depends on the feature size you want to enhance
sigma = 5
theta = 1*np.p... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"cv2.filter2D",
"cv2.cvtColor",
"matplotlib.pyplot.imshow",
"cv2.imread",
"cv2.getGaborKernel",
"matplotlib.pyplot.figure"
] | [((465, 555), 'cv2.getGaborKernel', 'cv2.getGaborKernel', (['(ksize, ksize)', 'sigma', 'theta', 'lambd', 'gamma', 'phi'], {'ktype': 'cv2.CV_32F'}), '((ksize, ksize), sigma, theta, lambd, gamma, phi, ktype=\n cv2.CV_32F)\n', (483, 555), False, 'import cv2\n'), ((558, 586), 'matplotlib.pyplot.figure', 'plt.figure', ([... |
import os
from .base_atari_env import BaseAtariEnv, base_env_wrapper_fn, parallel_wrapper_fn
def raw_env(**kwargs):
mode = 33
num_players = 4
return BaseAtariEnv(game="pong", num_players=num_players, mode_num=mode, env_name=os.path.basename(__file__)[:-3], **kwargs)
env = base_env_wrapper_fn(raw_env)
p... | [
"os.path.basename"
] | [((239, 265), 'os.path.basename', 'os.path.basename', (['__file__'], {}), '(__file__)\n', (255, 265), False, 'import os\n')] |
#!/usr/bin/python3
import json
import re
from computeInsightsFunction import computeInsights
PREDICTIONS_DIR = './Predictions/Russia'
DATASETS_DIR = './Datasets/Russia'
INSIGHTS_DIR = './Insights/Russia'
regions_filename = "./russia-regions.json"
regionsFileHandler = open(regions_filename)
regionsData = json.load(re... | [
"computeInsightsFunction.computeInsights",
"json.dump",
"json.load",
"re.sub"
] | [((308, 337), 'json.load', 'json.load', (['regionsFileHandler'], {}), '(regionsFileHandler)\n', (317, 337), False, 'import json\n'), ((477, 506), 're.sub', 're.sub', (['"""\\\\s+"""', '""" """', 'filename'], {}), "('\\\\s+', ' ', filename)\n", (483, 506), False, 'import re\n'), ((1054, 1072), 'json.load', 'json.load', ... |
from __future__ import annotations
import platform
from pathlib import Path
from urllib.error import HTTPError
import numpy as np
import pytest
import xclim.testing.utils as utilities
from xclim import __version__ as __xclim_version__
from . import TD
class TestFileRequests:
def test_get_failure(self, tmp_pat... | [
"platform.python_version",
"xclim.testing.utils.get_all_CMIP6_variables",
"pytest.warns",
"xclim.testing.utils.publish_release_notes",
"pytest.raises",
"xclim.testing.utils.file_md5_checksum",
"xclim.testing.utils.open_dataset",
"pathlib.Path",
"numpy.testing.assert_allclose",
"xclim.testing.utils... | [((4841, 4899), 'pytest.mark.xfail', 'pytest.mark.xfail', ([], {'reason': '"""Broken link to the excel file."""'}), "(reason='Broken link to the excel file.')\n", (4858, 4899), False, 'import pytest\n'), ((2319, 2344), 'xclim.testing.utils.list_datasets', 'utilities.list_datasets', ([], {}), '()\n', (2342, 2344), True,... |
# Generated by Django 3.0.3 on 2020-03-01 17:10
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('account', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='user',
old_name='major',
new_nam... | [
"django.db.migrations.RenameField"
] | [((216, 303), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""user"""', 'old_name': '"""major"""', 'new_name': '"""department"""'}), "(model_name='user', old_name='major', new_name=\n 'department')\n", (238, 303), False, 'from django.db import migrations\n')] |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC
#
# 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 requ... | [
"keystone.openstack.common.timeutils.utcnow",
"copy.deepcopy",
"keystone.openstack.common.timeutils.normalize_time",
"keystone.exception.TrustNotFound"
] | [((1038, 1056), 'copy.deepcopy', 'copy.deepcopy', (['ref'], {}), '(ref)\n', (1051, 1056), False, 'import copy\n'), ((2077, 2101), 'copy.deepcopy', 'copy.deepcopy', (['trust_ref'], {}), '(trust_ref)\n', (2090, 2101), False, 'import copy\n'), ((968, 986), 'keystone.openstack.common.timeutils.utcnow', 'timeutils.utcnow', ... |
"""
Copyright 2019 NerdWallet
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dis... | [
"terraformpy.Variant",
"terraformpy.OrderedDict",
"terraformpy.Variable",
"json.dumps",
"pytest.raises",
"terraformpy.Provider",
"terraformpy.TFObject.compile",
"collections.OrderedDict",
"terraformpy.Data",
"terraformpy.Resource",
"terraformpy.DuplicateKey",
"terraformpy.TFObject.reset"
] | [((788, 825), 'terraformpy.Resource', 'Resource', (['"""res1"""', '"""foo"""'], {'attr': '"""value"""'}), "('res1', 'foo', attr='value')\n", (796, 825), False, 'from terraformpy import Data, DuplicateKey, OrderedDict, Provider, Resource, Terraform, TFObject, Variable, Variant\n'), ((836, 867), 'terraformpy.Variable', '... |
import nixio
import numpy as np
def main():
nixfile = nixio.File.open("sources.nix", mode=nixio.FileMode.Overwrite)
block = nixfile.create_block("source example block", "session")
subject = block.create_source('subject A', 'nix.experimental_subject')
subject.definition = 'The experimental subject use... | [
"nixio.File.open",
"numpy.arange",
"numpy.random.randn"
] | [((60, 121), 'nixio.File.open', 'nixio.File.open', (['"""sources.nix"""'], {'mode': 'nixio.FileMode.Overwrite'}), "('sources.nix', mode=nixio.FileMode.Overwrite)\n", (75, 121), False, 'import nixio\n'), ((699, 719), 'numpy.random.randn', 'np.random.randn', (['(100)'], {}), '(100)\n', (714, 719), True, 'import numpy as ... |
from __future__ import absolute_import, print_function
from datetime import datetime
from flask import current_app
from sqlalchemy.sql import func
from changes.backends.base import UnrecoverableException
from changes.config import db, queue, statsreporter
from changes.constants import Status, Result
from changes.db.u... | [
"changes.models.test.TestCase.query.join",
"changes.models.jobphase.JobPhase.query.filter",
"datetime.datetime.utcnow",
"changes.utils.agg.safe_agg",
"changes.models.jobstep.JobStep.replacement_id.is_",
"changes.utils.agg.aggregate_status",
"changes.models.jobplan.JobPlan.get_build_step_for_job",
"cha... | [((4721, 4753), 'changes.queue.task.tracked_task', 'tracked_task', ([], {'on_abort': 'abort_job'}), '(on_abort=abort_job)\n', (4733, 4753), False, 'from changes.queue.task import tracked_task\n'), ((1282, 1359), 'changes.db.utils.try_create', 'try_create', (['ItemStat'], {'where': "{'item_id': job.id, 'name': name, 'va... |
from typing import Mapping, Union
import asyncio
from discord.ext import commands
from utils.helpers import get_color
from utils.kurisu import KurisuBot
import discord
class KurisuHelpCommand(commands.HelpCommand):
"""Custom HelpCommand subclass for Kurisu"""
async def send_bot_help(self, mapping: Mapping) ... | [
"utils.helpers.get_color",
"discord.ui.SelectMenu"
] | [((949, 1046), 'discord.ui.SelectMenu', 'discord.ui.SelectMenu', ([], {'options': 'dropdown_options', 'placeholder': '"""Pick a module/cog to preview!"""'}), "(options=dropdown_options, placeholder=\n 'Pick a module/cog to preview!')\n", (970, 1046), False, 'import discord\n'), ((4229, 4250), 'utils.helpers.get_colo... |
"""
This module defines ``django.forms.ModelForms`` for the creation and deletion
of the models defined in ``patients.models``. Generally, forms are used to
capture user input in django and are rendered out by views into HTML elements.
To a large extent, these forms only define which widgets should be used for
creatin... | [
"django.core.exceptions.ValidationError",
"django.forms.widgets.HiddenInput",
"django.forms.widgets.TextInput",
"django.forms.Select",
"pandas.read_csv",
"django.forms.widgets.NumberInput",
"django.forms.widgets.FileInput",
"django.forms.NumberInput",
"django.forms.widgets.Select",
"django.forms.V... | [((1733, 1774), 'django.forms.widgets.Select', 'widgets.Select', ([], {'attrs': "{'class': 'select'}"}), "(attrs={'class': 'select'})\n", (1747, 1774), False, 'from django.forms import widgets\n'), ((1805, 1866), 'django.forms.widgets.NumberInput', 'widgets.NumberInput', ([], {'attrs': "{'class': 'input', 'type': 'date... |
import argparse
import pprint
import subprocess
from utils import pr_green, pr_red
def launch(expt, batch_size, epochs, names):
"""Runs expt at batch_size for all the scripts"""
errors = []
# yapf: disable
cmds_list = [
('jax', f'CUDA_VISIBLE_DEVICES=0 python3 jaxdp.py {expt} --no_dpsgd --epo... | [
"subprocess.run",
"utils.pr_red",
"argparse.ArgumentParser",
"pprint.PrettyPrinter",
"utils.pr_green"
] | [((4495, 4547), 'utils.pr_green', 'pr_green', (['f"""Done {expt} at batch size {batch_size}."""'], {}), "(f'Done {expt} at batch size {batch_size}.')\n", (4503, 4547), False, 'from utils import pr_green, pr_red\n'), ((4593, 4623), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {'indent': '(4)'}), '(indent=4)\n', ... |
import sys
import syslog
from logger import Logger
class SyslogLogger(Logger):
def __init__(self, priority):
self.priority = priority
def log(self, message):
syslog.syslog(self.priority, message) | [
"syslog.syslog"
] | [((185, 222), 'syslog.syslog', 'syslog.syslog', (['self.priority', 'message'], {}), '(self.priority, message)\n', (198, 222), False, 'import syslog\n')] |
from scipy.stats import norm
from scipy.stats import entropy as kl
import matplotlib.pyplot as plt
import numpy as np
#initialize a normal distribution with frozen in mean=-1, std. dev.= 1
blue = norm(loc = -1., scale = 1.0)
red = norm(loc = -1., scale = 3.0)
black = norm(loc = 2., scale = 2.0)
cyan0 = norm(loc = 5., ... | [
"scipy.stats.norm",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((197, 222), 'scipy.stats.norm', 'norm', ([], {'loc': '(-1.0)', 'scale': '(1.0)'}), '(loc=-1.0, scale=1.0)\n', (201, 222), False, 'from scipy.stats import norm\n'), ((232, 257), 'scipy.stats.norm', 'norm', ([], {'loc': '(-1.0)', 'scale': '(3.0)'}), '(loc=-1.0, scale=3.0)\n', (236, 257), False, 'from scipy.stats import... |
from aiogram import types
from .dataset import ANIMATION
animation = types.Animation(**ANIMATION)
def test_export():
exported = animation.to_python()
assert isinstance(exported, dict)
assert exported == ANIMATION
def test_file_name():
assert isinstance(animation.file_name, str)
assert animation... | [
"aiogram.types.Animation"
] | [((70, 98), 'aiogram.types.Animation', 'types.Animation', ([], {}), '(**ANIMATION)\n', (85, 98), False, 'from aiogram import types\n')] |
"""Sampling selection module
The module has one main class called *SampleSelection* which provides a number of random selection methodsand associated probability of selection. All the samping techniques implemented in this
modules are discussed in the following reference book: <NAME>. (1977) [#c1977]_,
<NAME>. (1965... | [
"numpy.sum",
"numpy.random.random_sample",
"numpy.ones",
"numpy.arange",
"samplics.utils.formats.numpy_array",
"numpy.unique",
"pandas.DataFrame",
"numpy.cumprod",
"samplics.utils.formats.sample_units",
"numpy.append",
"numpy.cumsum",
"numpy.ediff1d",
"numpy.linspace",
"numpy.random.choice... | [((3531, 3659), 'pandas.DataFrame', 'pd.DataFrame', (["{'_samp_unit': samp_unit, '_stratum': stratum, '_mos': mos, '_sample':\n sample, '_hits': hits, '_probs': probs}"], {}), "({'_samp_unit': samp_unit, '_stratum': stratum, '_mos': mos,\n '_sample': sample, '_hits': hits, '_probs': probs})\n", (3543, 3659), True... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.