code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- coding: utf-8 -*-
"""
Created on Wed May 30 12:05:46 2018
@author: MichaelEK
"""
import pytest
import numpy as np
from hilltoppy.web_service import measurement_list, site_list, collection_list, get_data, wq_sample_parameter_list
### Parameters
test_data1 = dict(
base_url = 'http://data.ecan.govt.nz/',
... | [
"hilltoppy.web_service.collection_list",
"pytest.mark.parametrize",
"hilltoppy.web_service.wq_sample_parameter_list",
"hilltoppy.web_service.site_list",
"hilltoppy.web_service.measurement_list",
"hilltoppy.web_service.get_data"
] | [((868, 913), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""data"""', '[test_data1]'], {}), "('data', [test_data1])\n", (891, 913), False, 'import pytest\n'), ((1031, 1076), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""data"""', '[test_data1]'], {}), "('data', [test_data1])\n", (1054, 1076)... |
##Author : <NAME>
##Date : 9/24/2017
import csv
import sys
import operator
from xml.etree.ElementTree import ElementTree
from xml.etree.ElementTree import Element
import xml.etree.ElementTree as etree
from docutils.writers.odf_odt import ToString
from _elementtree import SubElement
from sqlalchemy.sql.expression import... | [
"xml.etree.ElementTree.tostring",
"csv.writer",
"xml.etree.ElementTree.Element",
"_elementtree.SubElement",
"csv.reader"
] | [((4031, 4065), 'csv.reader', 'csv.reader', (['csvfile'], {'delimiter': '""","""'}), "(csvfile, delimiter=',')\n", (4041, 4065), False, 'import csv\n'), ((5622, 5665), 'csv.writer', 'csv.writer', (['csvfile'], {'quoting': 'csv.QUOTE_NONE'}), '(csvfile, quoting=csv.QUOTE_NONE)\n', (5632, 5665), False, 'import csv\n'), (... |
import json
import glob
import os
import argparse
import time
_DEFAULT_DATASET_DIR_PATH = "D:\\Documents\\output_vvs_2020\\labeled"
_DEFAULT_METADATA_PATH = "C:\\Users\\Steven\\github\\kvasir-capsule\\metadata.json"
_DEFAULT_WORK_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")
_ANATOMY_CLASSES =... | [
"argparse.ArgumentParser",
"os.path.join",
"json.load",
"os.path.basename",
"os.path.abspath",
"time.time"
] | [((647, 686), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '""""""'}), "(description='')\n", (670, 686), False, 'import argparse\n'), ((1501, 1512), 'time.time', 'time.time', ([], {}), '()\n', (1510, 1512), False, 'import time\n'), ((267, 292), 'os.path.abspath', 'os.path.abspath', (['__fi... |
from django_datatables_view.base_datatable_view import BaseDatatableView
from django.db.models import Q
from django.contrib.postgres.aggregates.general import ArrayAgg
from website.models import Genome
class GenomeTableAjax(BaseDatatableView):
# The model we're going to show
model = Genome
# set max limi... | [
"django.db.models.Q",
"django.contrib.postgres.aggregates.general.ArrayAgg"
] | [((2237, 2240), 'django.db.models.Q', 'Q', ([], {}), '()\n', (2238, 2240), False, 'from django.db.models import Q\n'), ((1496, 1532), 'django.contrib.postgres.aggregates.general.ArrayAgg', 'ArrayAgg', (['"""tags__tag"""'], {'distinct': '(True)'}), "('tags__tag', distinct=True)\n", (1504, 1532), False, 'from django.cont... |
from pyrogram import Client, Filters, InlineKeyboardButton, InlineKeyboardMarkup
from .antiflood import BANNED_USERS
from ..database import querymanager
from pyrogram.errors import FloodWait, exceptions
import logging
import time
import re
from base64 import b64encode as b64enc
from base64 import b64decode as b64dec
im... | [
"pyrogram.InlineKeyboardMarkup",
"pyrogram.Filters.create",
"re.match",
"pyrogram.Filters.command",
"dateparser.parse",
"pyrogram.Client.on_message",
"time.sleep",
"collections.defaultdict",
"time.time",
"logging.error",
"pyrogram.InlineKeyboardButton"
] | [((419, 459), 'collections.defaultdict', 'defaultdict', (['(lambda : [None, None, None])'], {}), '(lambda : [None, None, None])\n', (430, 459), False, 'from collections import defaultdict\n'), ((924, 952), 'pyrogram.Filters.create', 'Filters.create', (['flt_schedule'], {}), '(flt_schedule)\n', (938, 952), False, 'from ... |
# SPDX-FileCopyrightText: 2019-2021 REFITT Team
# SPDX-License-Identifier: Apache-2.0
"""Database file_type model integration tests."""
# external libs
import pytest
from sqlalchemy.exc import IntegrityError
# internal libs
from refitt.database.model import FileType, NotFound
from tests.integration.test_database.te... | [
"refitt.database.model.FileType.add",
"refitt.database.model.FileType.from_dict",
"pytest.raises",
"refitt.database.model.FileType",
"refitt.database.model.FileType.from_id",
"refitt.database.model.FileType.from_name"
] | [((678, 694), 'refitt.database.model.FileType', 'FileType', ([], {}), '(**data)\n', (686, 694), False, 'from refitt.database.model import FileType, NotFound\n'), ((968, 992), 'refitt.database.model.FileType.from_dict', 'FileType.from_dict', (['data'], {}), '(data)\n', (986, 992), False, 'from refitt.database.model impo... |
import os
import os.path as op
import shutil
import sys
from datetime import datetime
from tempfile import TemporaryDirectory
import boto3
import sh
from termcolor import cprint
from .cloudformation import get_cf_resources
from .config import Config
def _docker(*args):
cprint("$", "red", end=" ")
cprint("do... | [
"tempfile.TemporaryDirectory",
"boto3.client",
"datetime.datetime.utcnow",
"os.path.join",
"boto3.resource",
"sys.exit",
"os.path.abspath",
"termcolor.cprint",
"sh.docker"
] | [((278, 305), 'termcolor.cprint', 'cprint', (['"""$"""', '"""red"""'], {'end': '""" """'}), "('$', 'red', end=' ')\n", (284, 305), False, 'from termcolor import cprint\n'), ((4478, 4498), 'boto3.resource', 'boto3.resource', (['"""s3"""'], {}), "('s3')\n", (4492, 4498), False, 'import boto3\n'), ((4792, 4814), 'boto3.cl... |
#!/usr/bin/python3
import os
import subprocess
import sys
md5sums = {}
dirname = sys.argv[1]
for fn in os.listdir(dirname):
md5sum = subprocess.check_output(['md5sum', os.path.join(dirname, fn)]).decode('ascii').partition(" ")[0]
if md5sum in md5sums:
# This blob already exists. Symlink it
o... | [
"os.listdir",
"os.path.join"
] | [((106, 125), 'os.listdir', 'os.listdir', (['dirname'], {}), '(dirname)\n', (116, 125), False, 'import os\n'), ((329, 354), 'os.path.join', 'os.path.join', (['dirname', 'fn'], {}), '(dirname, fn)\n', (341, 354), False, 'import os\n'), ((392, 417), 'os.path.join', 'os.path.join', (['dirname', 'fn'], {}), '(dirname, fn)\... |
'''
clyther.rttt
--------------------
Run Time Type Tree (rttt)
'''
from clast import cast
from clyther.pybuiltins import builtin_map
from inspect import isroutine, isclass, isfunction
from meta.asttools.visitors import visit_children, Mutator
from meta.asttools.visitors.print_visitor import print_ast
from opencl im... | [
"ast.Load",
"clast.cast.CStruct",
"re.compile",
"opencl.type_formats.type_format",
"clast.cast.CTypeName",
"inspect.isroutine",
"meta.asttools.visitors.visit_children",
"opencl.type_formats.cdefn",
"clast.cast.CVarDec",
"inspect.isclass",
"inspect.isfunction",
"meta.asttools.visitors.Mutator.m... | [((4953, 4995), 're.compile', 're.compile', (['"""^\\\\((\\\\d)\\\\)([f|i|I|d|l|L])$"""'], {}), "('^\\\\((\\\\d)\\\\)([f|i|I|d|l|L])$')\n", (4963, 4995), False, 'import re\n'), ((13302, 13331), 'clast.cast.CStruct', 'cast.CStruct', (['struct_id', 'decs'], {}), '(struct_id, decs)\n', (13314, 13331), False, 'from clast i... |
# -*- coding: utf-8 -*-
"""Check versions"""
import sys
import json
import aiida_raspa
def test_version_agreement():
"""Check if versions in setup.json and in plugin are consistent"""
version1 = aiida_raspa.__version__
with open("setup.json") as fhandle:
version2 = json.load(fhandle)['version']
... | [
"json.load",
"sys.exit"
] | [((499, 510), 'sys.exit', 'sys.exit', (['(3)'], {}), '(3)\n', (507, 510), False, 'import sys\n'), ((289, 307), 'json.load', 'json.load', (['fhandle'], {}), '(fhandle)\n', (298, 307), False, 'import json\n')] |
from collections import defaultdict
from copy import copy, deepcopy
from tqdm import tqdm
from ..eventuality import Eventuality
from ..relation import Relation
def conceptualize_eventualities(aser_conceptualizer, eventualities):
""" Conceptualize eventualities by an ASER conceptualizer
:param aser_conceptual... | [
"tqdm.tqdm",
"collections.defaultdict",
"copy.deepcopy"
] | [((907, 926), 'tqdm.tqdm', 'tqdm', (['eventualities'], {}), '(eventualities)\n', (911, 926), False, 'from tqdm import tqdm\n'), ((2252, 2269), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (2263, 2269), False, 'from collections import defaultdict\n'), ((2290, 2305), 'tqdm.tqdm', 'tqdm', (['relat... |
from abc import ABCMeta, abstractmethod
from django_tooling.exceptions import ValidationError
class FailedValidation():
def __init__(self, code, details, msg):
self.code = code
self.details = details
self.msg = msg
if msg and details:
self.msg = msg.format(**details)
... | [
"django_tooling.exceptions.ValidationError"
] | [((892, 1003), 'django_tooling.exceptions.ValidationError', 'ValidationError', (['[failedValidation.msg for failedValidation in self.__failedValidations]', 'self.__fieldName'], {}), '([failedValidation.msg for failedValidation in self.\n __failedValidations], self.__fieldName)\n', (907, 1003), False, 'from django_to... |
# Generated by Django 2.2.6 on 2019-10-29 20:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('registry', '0005_auto_20191029_2312'),
]
operations = [
migrations.AlterField(
model_name='primary',
name='recommend... | [
"django.db.models.ManyToManyField"
] | [((347, 441), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'blank': '(True)', 'to': '"""registry.Sport_type"""', 'verbose_name': '"""Рекомендации"""'}), "(blank=True, to='registry.Sport_type', verbose_name=\n 'Рекомендации')\n", (369, 441), False, 'from django.db import migrations, models\n')] |
from fastapi.testclient import TestClient
import pytest
from main import app
client = TestClient(app)
def get_response_for_test(path):
response = client.get(path)
return response.json(), response.status_code
def post_response_for_test(path, input_json):
response = client.post(path, json=input_json)... | [
"fastapi.testclient.TestClient",
"pytest.mark.parametrize"
] | [((88, 103), 'fastapi.testclient.TestClient', 'TestClient', (['app'], {}), '(app)\n', (98, 103), False, 'from fastapi.testclient import TestClient\n'), ((466, 1239), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["('category', 'status', 'response_json')", "[('symbols', 200, {'Properties': [{'Parameter': 'frequ... |
import argparse
import sys
import optax
import torch
import numpy as np
import time
import jax
import jax.numpy as jnp
import matplotlib as mp
import haiku as hk
import dill as pickle
try:
mp.use("Qt5Agg")
mp.rc('text', usetex=True)
mp.rcParams['text.latex.preamble'] = [r"\usepackage{amsmath}"]
import... | [
"deep_lagrangian_networks.utils.load_dataset",
"numpy.array",
"matplotlib.rc",
"numpy.arange",
"dill.load",
"numpy.mean",
"numpy.max",
"numpy.concatenate",
"numpy.min",
"matplotlib.cm.get_cmap",
"numpy.ones",
"matplotlib.use",
"jax.numpy.cumsum",
"matplotlib.patches.Patch",
"numpy.std",
... | [((194, 210), 'matplotlib.use', 'mp.use', (['"""Qt5Agg"""'], {}), "('Qt5Agg')\n", (200, 210), True, 'import matplotlib as mp\n'), ((215, 241), 'matplotlib.rc', 'mp.rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (220, 241), True, 'import matplotlib as mp\n'), ((4554, 4581), 'matplotlib.pyplot.rc... |
#!flask/bi.python
from app import app
app.run(debug = True)
| [
"app.app.run"
] | [((39, 58), 'app.app.run', 'app.run', ([], {'debug': '(True)'}), '(debug=True)\n', (46, 58), False, 'from app import app\n')] |
#!/usr/bin/env python
import numpy as np
import scipy.sparse
from sklearn import svm
from sklearn.metrics import f1_score, recall_score, precision_score, accuracy_score, make_scorer
from sklearn.model_selection import cross_val_score
def zero_pivot_columns(matrix, pivots):
matrix_lil = scipy.sparse.lil_matrix(matr... | [
"sklearn.metrics.f1_score",
"numpy.where",
"numpy.delete",
"sklearn.svm.LinearSVC",
"sklearn.metrics.make_scorer",
"sklearn.metrics.precision_score",
"sklearn.metrics.recall_score",
"numpy.zeros",
"numpy.matrix",
"sklearn.metrics.accuracy_score"
] | [((481, 509), 'numpy.matrix', 'np.matrix', (['array'], {'copy': '(False)'}), '(array, copy=False)\n', (490, 509), True, 'import numpy as np\n'), ((1070, 1120), 'sklearn.metrics.recall_score', 'recall_score', (['y_test', 'preds'], {'pos_label': 'score_label'}), '(y_test, preds, pos_label=score_label)\n', (1082, 1120), F... |
"""Training a SEAL-CI model."""
import torch
from utils import tab_printer
from seal import SEALCITrainer
from param_parser import parameter_parser
def main():
"""
Parsing command line parameters, reading data.
Fitting and scoring a SEAL-CI model.
"""
args = parameter_parser()
tab_printer(args... | [
"utils.tab_printer",
"param_parser.parameter_parser",
"seal.SEALCITrainer"
] | [((281, 299), 'param_parser.parameter_parser', 'parameter_parser', ([], {}), '()\n', (297, 299), False, 'from param_parser import parameter_parser\n'), ((304, 321), 'utils.tab_printer', 'tab_printer', (['args'], {}), '(args)\n', (315, 321), False, 'from utils import tab_printer\n'), ((336, 355), 'seal.SEALCITrainer', '... |
"""
Calm DSL Sample Runbook for parallel task
"""
from calm.dsl.runbooks import runbook, parallel, branch
from calm.dsl.runbooks import RunbookTask as Task
@runbook
def ParallelTask():
"Runbook Service example"
with parallel() as p:
with branch(p):
Task.Delay(60, name="Delay1")
w... | [
"calm.dsl.runbooks.branch",
"calm.dsl.runbooks.RunbookTask.Delay",
"calm.dsl.runbooks.parallel"
] | [((228, 238), 'calm.dsl.runbooks.parallel', 'parallel', ([], {}), '()\n', (236, 238), False, 'from calm.dsl.runbooks import runbook, parallel, branch\n'), ((258, 267), 'calm.dsl.runbooks.branch', 'branch', (['p'], {}), '(p)\n', (264, 267), False, 'from calm.dsl.runbooks import runbook, parallel, branch\n'), ((281, 310)... |
from .scripts import ClearScreen
from PyInquirer import prompt
def SelectTemplateGraft(statBlock):
ClearScreen()
print("You can optionally use a template graft to start the creation process. Template grafts grant specific bonuses and unique abilities. They also " +
"largely determine the creature t... | [
"PyInquirer.prompt"
] | [((3664, 3680), 'PyInquirer.prompt', 'prompt', (['question'], {}), '(question)\n', (3670, 3680), False, 'from PyInquirer import prompt\n')] |
"""
Convert scenery image to tactile image.
# Algorithm
1. Read scenery image.
2. Grayscale.
3. Histogram equalize.
4. Compute fine-grained saliency map.
5. Scale to [0, 255]
6. Compute binary threshold map.
7. Invert binary threshold map.
8. Write tactile image.
References at the corresponding source code below.
"""... | [
"cv2.imwrite",
"cv2.saliency.StaticSaliencyFineGrained_create",
"argparse.ArgumentParser",
"cv2.imshow",
"cv2.equalizeHist",
"cv2.waitKey",
"cv2.cvtColor",
"cv2.bitwise_not",
"cv2.imread"
] | [((354, 379), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (377, 379), False, 'import argparse\n'), ((896, 918), 'cv2.imread', 'cv2.imread', (['args.image'], {}), '(args.image)\n', (906, 918), False, 'import cv2\n'), ((938, 977), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2GRAY'... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018 Fetch.AI Limited
#
# 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 Lice... | [
"oef.query_pb2.Query.Relation",
"oef.query_pb2.Query.DoublePair",
"oef.query_pb2.Query.Set.Values.Ints",
"oef.query_pb2.Query.Set",
"oef.query_pb2.Query.Value",
"oef.query_pb2.Query.Set.Values.Doubles",
"oef.query_pb2.Query.ConstraintExpr.Or",
"oef.schema.DataModel.from_pb",
"oef.query_pb2.Query.Mod... | [((2671, 2703), 'oef.query_pb2.Query.ConstraintExpr', 'query_pb2.Query.ConstraintExpr', ([], {}), '()\n', (2701, 2703), True, 'import oef.query_pb2 as query_pb2\n'), ((4906, 4942), 'oef.query_pb2.Query.ConstraintExpr.And', 'query_pb2.Query.ConstraintExpr.And', ([], {}), '()\n', (4940, 4942), True, 'import oef.query_pb2... |
import numpy as np
from algorithm.base import Algorithm
class Greedy(Algorithm):
def __init__(self, knapsack):
assert isinstance(knapsack, dict)
self.capacity = knapsack['capacity'][0]
self.weights = knapsack['weights']
self.profits = knapsack['profits']
self.n = ... | [
"numpy.zeros",
"numpy.arange"
] | [((736, 768), 'numpy.zeros', 'np.zeros', (['self.n'], {'dtype': 'np.int64'}), '(self.n, dtype=np.int64)\n', (744, 768), True, 'import numpy as np\n'), ((479, 496), 'numpy.arange', 'np.arange', (['self.n'], {}), '(self.n)\n', (488, 496), True, 'import numpy as np\n')] |
"""
File: tools.py
"""
import random
import time
def getRandomList(n):
"""Returns a list of unique random numbers in the
range 0..n-1"""
items = list(range(n))
random.shuffle(items)
return items
def compare(titleList, functionList, sizeList,
dataSet=lambda x: x, counter=None, compar... | [
"time.time",
"random.shuffle"
] | [((180, 201), 'random.shuffle', 'random.shuffle', (['items'], {}), '(items)\n', (194, 201), False, 'import random\n'), ((1135, 1146), 'time.time', 'time.time', ([], {}), '()\n', (1144, 1146), False, 'import time\n'), ((1502, 1513), 'time.time', 'time.time', ([], {}), '()\n', (1511, 1513), False, 'import time\n')] |
#!/usr/bin/env python
#
# This library is for Grove - Button(https://www.seeedstudio.com/s/Grove-Button-p-766.html)
#
# This is the library for Grove Base Hat which used to connect grove sensors for raspberry pi.
#
'''
## License
The MIT License (MIT)
Grove Base Hat for the Raspberry Pi, used to connect grove senso... | [
"grove.factory.Factory.getButton",
"time.sleep",
"time.time",
"grove.helper.SlotHelper"
] | [((2797, 2824), 'grove.helper.SlotHelper', 'SlotHelper', (['SlotHelper.GPIO'], {}), '(SlotHelper.GPIO)\n', (2807, 2824), False, 'from grove.helper import SlotHelper\n'), ((1581, 1616), 'grove.factory.Factory.getButton', 'Factory.getButton', (['"""GPIO-HIGH"""', 'pin'], {}), "('GPIO-HIGH', pin)\n", (1598, 1616), False, ... |
"""Load the Tatoeba dataset."""
import sys
import os
import csv
import subprocess
import time
from multiprocessing import Pool, Lock, cpu_count
from tqdm import tqdm
from scipy.io import wavfile
from python.params import MIN_EXAMPLE_LENGTH, MAX_EXAMPLE_LENGTH
from python.dataset.config import CACHE_DIR, CORPUS_DIR
f... | [
"os.path.exists",
"os.path.getsize",
"python.dataset.txt_files.generate_txt",
"os.makedirs",
"multiprocessing.Lock",
"python.dataset.download.download_with_progress",
"python.util.storage.delete_file_if_exists",
"os.path.join",
"multiprocessing.cpu_count",
"time.sleep",
"os.path.isfile",
"os.p... | [((673, 711), 'os.path.join', 'os.path.join', (['CACHE_DIR', '__FOLDER_NAME'], {}), '(CACHE_DIR, __FOLDER_NAME)\n', (685, 711), False, 'import os\n'), ((745, 784), 'os.path.join', 'os.path.join', (['CORPUS_DIR', '__FOLDER_NAME'], {}), '(CORPUS_DIR, __FOLDER_NAME)\n', (757, 784), False, 'import os\n'), ((1175, 1244), 'p... |
# =============================================================================== #
# #
# This file has been generated automatically!! Do not change this manually! #
# ... | [
"pydantic.Field"
] | [((1372, 1408), 'pydantic.Field', 'Field', (['"""maskPosition"""'], {'alias': '"""@type"""'}), "('maskPosition', alias='@type')\n", (1377, 1408), False, 'from pydantic import Field\n')] |
from flask import Flask, request, json
from TextSummarizer import Preprocess
app = Flask(__name__)
app.debug = True
@app.route('/summarize', methods=['POST'])
def summrize():
text = request.json['text']
serve = Preprocess()
log, slead, srefresh, sgold = serve.run_textmode(text)
return json.dumps({'st... | [
"TextSummarizer.Preprocess",
"flask.json.dumps",
"flask.Flask"
] | [((85, 100), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (90, 100), False, 'from flask import Flask, request, json\n'), ((222, 234), 'TextSummarizer.Preprocess', 'Preprocess', ([], {}), '()\n', (232, 234), False, 'from TextSummarizer import Preprocess\n'), ((305, 401), 'flask.json.dumps', 'json.dumps', ... |
'''
This is a ready to use package consisting of several supervised machine learning
algorithms with a predefined parameter-grid (which then you can update its values)
to fine tune these models on your data. You can calculate some features from your
peptides data set using our feature extraction tool to feed these ... | [
"pandas.read_csv",
"sklearn.neighbors.KNeighborsClassifier",
"sklearn.metrics.precision_score",
"sklearn.metrics.recall_score",
"sklearn.metrics.roc_auc_score",
"sys.exit",
"json.dumps",
"getopt.getopt",
"sklearn.model_selection.train_test_split",
"sklearn.ensemble.RandomForestClassifier",
"os.p... | [((6233, 6260), 'sklearn.metrics.make_scorer', 'make_scorer', (['accuracy_score'], {}), '(accuracy_score)\n', (6244, 6260), False, 'from sklearn.metrics import make_scorer, accuracy_score, precision_score, recall_score, f1_score, roc_auc_score, mean_squared_error\n'), ((6287, 6315), 'sklearn.metrics.make_scorer', 'make... |
from shlex import split
import json
class RawCommand:
def __init__(self, command, client="local", posix=True, inline=False):
# TODO: check shlex.quote, raw string, etc..
if inline:
self.command = split(command, posix=posix)
else:
self.command = split(command, posix=... | [
"shlex.split",
"json.loads"
] | [((230, 257), 'shlex.split', 'split', (['command'], {'posix': 'posix'}), '(command, posix=posix)\n', (235, 257), False, 'from shlex import split\n'), ((299, 326), 'shlex.split', 'split', (['command'], {'posix': 'posix'}), '(command, posix=posix)\n', (304, 326), False, 'from shlex import split\n'), ((2702, 2719), 'json.... |
# script to test the parallelized gradient / divergence from pymirc
import numpy as np
import pymirc.image_operations as pi
# seed the random generator
np.random.seed(1)
# create a random 3D/4D image
shape = (6,200,190,180)
# create random array and pad with 0s
x = np.pad(np.random.rand(*shape), 1)
# allocate arra... | [
"numpy.random.rand",
"pymirc.image_operations.grad",
"pymirc.image_operations.div",
"numpy.zeros",
"numpy.random.seed"
] | [((154, 171), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (168, 171), True, 'import numpy as np\n'), ((348, 392), 'numpy.zeros', 'np.zeros', (['((x.ndim,) + x.shape)'], {'dtype': 'x.dtype'}), '((x.ndim,) + x.shape, dtype=x.dtype)\n', (356, 392), True, 'import numpy as np\n'), ((421, 439), 'pymirc.ima... |
from happytransformer import HappyNextSentence
def test_sp_true():
happy_ns = HappyNextSentence()
result = happy_ns.predict_next_sentence(
"Hi nice to meet you. How old are you?",
"I am 21 years old."
)
assert result > 0.5
def test_sp_false():
happy_ns = HappyNextSentence()
r... | [
"happytransformer.HappyNextSentence"
] | [((84, 103), 'happytransformer.HappyNextSentence', 'HappyNextSentence', ([], {}), '()\n', (101, 103), False, 'from happytransformer import HappyNextSentence\n'), ((295, 314), 'happytransformer.HappyNextSentence', 'HappyNextSentence', ([], {}), '()\n', (312, 314), False, 'from happytransformer import HappyNextSentence\n... |
from setuptools import setup
with open("Readme.md", 'r') as f:
long_description = f.read()
setup(
name='pysqlizer',
version='1.0',
description='A module that can be used to convert a CSV file into a SQL file',
author='<NAME>',
author_email='<EMAIL>',
url="https://github.com/slafi",
license="M... | [
"setuptools.setup"
] | [((97, 374), 'setuptools.setup', 'setup', ([], {'name': '"""pysqlizer"""', 'version': '"""1.0"""', 'description': '"""A module that can be used to convert a CSV file into a SQL file"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/slafi"""', 'license': '"""MIT"""', 'long_des... |
import numpy as np
class Grid:
def __init__(self, width, heigth, discount = 0.9):
self.width = width
self.heigth = heigth
self.x_pos = 0
self.y_pos = 0
self.values = np.zeros((heigth, width))
self.discount = discount
self.vertex_sources = []
self.vert... | [
"numpy.zeros",
"numpy.random.rand"
] | [((2602, 2618), 'numpy.zeros', 'np.zeros', (['(5, 5)'], {}), '((5, 5))\n', (2610, 2618), True, 'import numpy as np\n'), ((211, 236), 'numpy.zeros', 'np.zeros', (['(heigth, width)'], {}), '((heigth, width))\n', (219, 236), True, 'import numpy as np\n'), ((808, 843), 'numpy.zeros', 'np.zeros', (['(self.heigth, self.width... |
# Copyright (C) <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 by applicable law or agree... | [
"nemo.utils.env_var_parsing.get_envbool",
"sys.platform.lower"
] | [((900, 952), 'nemo.utils.env_var_parsing.get_envbool', 'get_envbool', (['NEMO_ENV_VARNAME_ENABLE_COLORING', '(False)'], {}), '(NEMO_ENV_VARNAME_ENABLE_COLORING, False)\n', (911, 952), False, 'from nemo.utils.env_var_parsing import get_envbool\n'), ((857, 877), 'sys.platform.lower', 'sys.platform.lower', ([], {}), '()\... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# pylint: disable=invalid-name
"""Let viewers pay currency to boost currency payouts
for everyone in chat for x seconds"""
import json
import os, os.path
import operator
import time
import codecs
#---------------------------------------
# [Required] Script information
#-------... | [
"os.path.exists",
"json.loads",
"json.dumps",
"os.path.isfile",
"os.path.dirname",
"json.load",
"codecs.open",
"time.time",
"json.dump"
] | [((766, 791), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (781, 791), False, 'import os, os.path\n'), ((836, 861), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (851, 861), False, 'import os, os.path\n'), ((907, 932), 'os.path.dirname', 'os.path.dirname', (['__f... |
import numpy as np
import tensorflow as tf
#----------------------------------------------------------------------------
# Encoder network.
# Extract the feature of content and style image
# Use VGG19 network to extract features.
ENCODER_LAYERS = (
'conv1_1', 'relu1_1', 'conv1_2', 'relu1_2', 'pool1',
'conv2... | [
"tensorflow.nn.conv2d",
"tensorflow.local_variables_initializer",
"tensorflow.nn.max_pool",
"tensorflow.pad",
"tensorflow.variable_scope",
"tensorflow.transpose",
"tensorflow.nn.relu",
"tensorflow.nn.avg_pool",
"tensorflow.Session",
"tensorflow.Variable",
"tensorflow.global_variables_initializer... | [((3289, 3348), 'tensorflow.pad', 'tf.pad', (['x', '[[0, 0], [1, 1], [1, 1], [0, 0]]'], {'mode': '"""REFLECT"""'}), "(x, [[0, 0], [1, 1], [1, 1], [0, 0]], mode='REFLECT')\n", (3295, 3348), True, 'import tensorflow as tf\n'), ((3384, 3453), 'tensorflow.nn.conv2d', 'tf.nn.conv2d', (['x_padded', 'kernel'], {'strides': '[1... |
"""WebSDL URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-base... | [
"dataloaderinterface.views.LeafPackListUpdateView.as_view",
"django.conf.urls.url",
"dataloaderinterface.views.SiteDetailView.as_view",
"dataloaderinterface.views.PrivacyView.as_view",
"dataloaderinterface.views.SitesListView.as_view",
"dataloaderinterface.views.StatusListView.as_view",
"dataloaderinter... | [((2301, 2357), 'django.conf.urls.url', 'url', (['"""^dataloader/ajax/"""', 'views.ajax_router'], {'name': '"""ajax"""'}), "('^dataloader/ajax/', views.ajax_router, name='ajax')\n", (2304, 2357), False, 'from django.conf.urls import url, include\n'), ((1041, 1059), 'dataloaderinterface.views.HomeView.as_view', 'HomeVie... |
# =======================================================================================================================================
# VNU-HCM, University of Science
# Department Computer Science, Faculty of Information Technology
# Authors: <NAME> (<NAME>)
# © 2020
"""
We have a loud talking parrot. The "hour" ... | [
"unittest.main"
] | [((1549, 1564), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1562, 1564), False, 'import unittest\n')] |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'newGui.ui'
#
# Created by: PyQt5 UI code generator 5.15.2
#
# 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, QtGui, ... | [
"PyQt5.QtGui.QIcon",
"matplotlib.pyplot.specgram",
"PyQt5.QtWidgets.QApplication",
"pyqtgraph.mkPen",
"pyqtgraph.QtCore.QTimer",
"numpy.genfromtxt",
"PyQt5.QtCore.QFileInfo",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.Qt... | [((553, 577), 'matplotlib.use', 'matplotlib.use', (['"""Qt5Agg"""'], {}), "('Qt5Agg')\n", (567, 577), False, 'import matplotlib\n'), ((23354, 23386), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (23376, 23386), False, 'from PyQt5 import QtCore, QtGui, QtWidgets, QtPrintS... |
"""Main Parser Class"""
import json
from .segments.utilities.operations import convert_bitmap_to_active_bits
from .segments.iso import ISO
from .segments.header import Header
from .segments.mti import MTI
from .segments.primary_bitmap import PrimaryBitmap
from .segments.data_elements import DataElements
class Parser... | [
"json.dumps",
"json.dump"
] | [((1740, 1762), 'json.dumps', 'json.dumps', (['to_convert'], {}), '(to_convert)\n', (1750, 1762), False, 'import json\n'), ((1669, 1723), 'json.dump', 'json.dump', (['to_convert', 'f'], {'ensure_ascii': '(False)', 'indent': '(4)'}), '(to_convert, f, ensure_ascii=False, indent=4)\n', (1678, 1723), False, 'import json\n'... |
from dataclasses import dataclass
from logging import getLogger
from typing import List, Callable, Awaitable, Optional, Dict
from pydantic.main import BaseModel
@dataclass
class ActionHandler:
name: str
description: str
handler: Callable[[], Awaitable]
async def __call__(self):
return await ... | [
"logging.getLogger"
] | [((3036, 3074), 'logging.getLogger', 'getLogger', (['self.__class__.__qualname__'], {}), '(self.__class__.__qualname__)\n', (3045, 3074), False, 'from logging import getLogger\n'), ((2286, 2324), 'logging.getLogger', 'getLogger', (['self.__class__.__qualname__'], {}), '(self.__class__.__qualname__)\n', (2295, 2324), Fa... |
from collections import Counter
def parse_policy(policy):
range_str, c = policy.split()
lo,hi = range_str.split('-')
lo,hi = int(lo),int(hi)
return lo,hi,c
def pwcheck(pw, policy):
counts = Counter(pw)
lo,hi,char = parse_policy(policy)
if char not in counts:
return False
retu... | [
"collections.Counter",
"fileinput.input"
] | [((212, 223), 'collections.Counter', 'Counter', (['pw'], {}), '(pw)\n', (219, 223), False, 'from collections import Counter\n'), ((581, 598), 'fileinput.input', 'fileinput.input', ([], {}), '()\n', (596, 598), False, 'import fileinput\n')] |
import h5py
import matplotlib.pyplot as plt
import numpy as np
import scipy.io
import scipy.stats
import complex_pca
def plot_pca_variance_curve(x: np.ndarray, title: str = 'PCA -- Variance Explained Curve') -> None:
pca = complex_pca.ComplexPCA(n_components=x.shape[1])
pca.fit(x)
plt.figure()
plt.p... | [
"matplotlib.pyplot.grid",
"numpy.log10",
"matplotlib.pyplot.ylabel",
"numpy.hstack",
"complex_pca.ComplexPCA",
"numpy.unwrap",
"numpy.array",
"numpy.imag",
"numpy.arange",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.diff",
"numpy.real",
"numpy.linspace",
"matplotlib.pypl... | [((230, 277), 'complex_pca.ComplexPCA', 'complex_pca.ComplexPCA', ([], {'n_components': 'x.shape[1]'}), '(n_components=x.shape[1])\n', (252, 277), False, 'import complex_pca\n'), ((298, 310), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (308, 310), True, 'import matplotlib.pyplot as plt\n'), ((436, 480),... |
import sys
import re
import string
from collections import Counter
import pickle
def normalize_answer(s):
def remove_articles(text):
return re.sub(r'\b(a|an|the)\b', ' ', text)
def white_space_fix(text):
return ' '.join(text.split())
def remove_punc(text):
exclude = set(string.... | [
"collections.Counter",
"re.sub",
"unicodedata.normalize"
] | [((1530, 1564), 'unicodedata.normalize', 'unicodedata.normalize', (['"""NFD"""', 'text'], {}), "('NFD', text)\n", (1551, 1564), False, 'import unicodedata\n'), ((156, 193), 're.sub', 're.sub', (['"""\\\\b(a|an|the)\\\\b"""', '""" """', 'text'], {}), "('\\\\b(a|an|the)\\\\b', ' ', text)\n", (162, 193), False, 'import re... |
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from modelcluster.fields import ParentalKey
from modelcluster.models import ClusterableModel
from wagtail.wagtailadmin.edit_handlers import FieldPanel, InlinePanel, MultiFieldPanel, PageChooserPanel
from wagtail.wagtailcore.mode... | [
"django.db.models.EmailField",
"wagtail.wagtailadmin.edit_handlers.PageChooserPanel",
"django.db.models.ForeignKey",
"wagtail.wagtailadmin.edit_handlers.FieldPanel",
"wagtail.wagtailadmin.edit_handlers.InlinePanel",
"wagtail.wagtaildocs.edit_handlers.DocumentChooserPanel",
"django.db.models.URLField",
... | [((609, 765), 'django.db.models.URLField', 'models.URLField', (['"""External link"""'], {'blank': '(True)', 'null': '(True)', 'help_text': '"""Set an external link if you want the link to point somewhere outside the CMS."""'}), "('External link', blank=True, null=True, help_text=\n 'Set an external link if you want ... |
## Author: <NAME>
import json
import io
import os
import re
from hl7apy.parser import parse_message
from hl7apy.exceptions import UnsupportedVersion
#receives the name of the file and reads the messages in the file
def readMessageFile(filename):
#read the file
message = open(filename, 'r').read()
print("St... | [
"re.split",
"json.dumps",
"io.open",
"os.path.isfile",
"hl7apy.parser.parse_message",
"os.remove"
] | [((2847, 2879), 'os.path.isfile', 'os.path.isfile', (['"""ml7tojson.json"""'], {}), "('ml7tojson.json')\n", (2861, 2879), False, 'import os\n'), ((501, 527), 're.split', 're.split', (['"""\\\\n\\\\n"""', 'strmsg'], {}), "('\\\\n\\\\n', strmsg)\n", (509, 527), False, 'import re\n'), ((2885, 2912), 'os.remove', 'os.remov... |
# -*- coding:utf-8 -*-
import urllib
import urllib.request
import json
import django.utils.http
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
from operator import itemgetter # 排序
import time
from django.core.paginator import Paginator
servers = ['127.0.0.1:8100', '127.0.... | [
"urllib.request.HTTPBasicAuthHandler",
"urllib.request.HTTPPasswordMgrWithDefaultRealm",
"urllib.request.install_opener",
"urllib.request.build_opener",
"time.localtime",
"urllib.request.urlopen",
"django.core.paginator.Paginator"
] | [((689, 737), 'urllib.request.HTTPPasswordMgrWithDefaultRealm', 'urllib.request.HTTPPasswordMgrWithDefaultRealm', ([], {}), '()\n', (735, 737), False, 'import urllib\n'), ((802, 840), 'urllib.request.HTTPBasicAuthHandler', 'urllib.request.HTTPBasicAuthHandler', (['p'], {}), '(p)\n', (837, 840), False, 'import urllib\n'... |
from dnsget import dnsget
from analyse_dependency import a_d
f=open("targetd2")
line=f.readline().strip('\n')
o=open("targetd2r",'w')
target=[]
name="top50"
while (line):
target.append(line)
line=f.readline().strip('\n')
r=dnsget(target,name)
a_d(name)
f.close()
o.close()
| [
"analyse_dependency.a_d",
"dnsget.dnsget"
] | [((225, 245), 'dnsget.dnsget', 'dnsget', (['target', 'name'], {}), '(target, name)\n', (231, 245), False, 'from dnsget import dnsget\n'), ((245, 254), 'analyse_dependency.a_d', 'a_d', (['name'], {}), '(name)\n', (248, 254), False, 'from analyse_dependency import a_d\n')] |
import os
from random import sample
import numpy as np
from numpy import cos
from scipy.linalg import lstsq
from compmech.constants import CMHOME
from compmech.logger import *
def load_c0(name, funcnum, m0, n0):
path = os.path.join(CMHOME, 'conecyl', 'imperfections', 'c0',
'c0_{0}_f{1}_m{2:03d}_n{3:0... | [
"scipy.linalg.lstsq",
"os.path.isfile",
"os.path.basename",
"numpy.savetxt",
"numpy.loadtxt",
"mgi.fa"
] | [((380, 400), 'os.path.isfile', 'os.path.isfile', (['path'], {}), '(path)\n', (394, 400), False, 'import os\n'), ((5034, 5077), 'mgi.fa', 'mgi.fa', (['m0', 'n0', 'xs', 'thetas'], {'funcnum': 'funcnum'}), '(m0, n0, xs, thetas, funcnum=funcnum)\n', (5040, 5077), False, 'import mgi\n'), ((417, 433), 'numpy.loadtxt', 'np.l... |
import numpy as np
from cost_functions import trajectory_cost_fn
import time
class Controller():
def __init__(self):
pass
# Get the appropriate action(s) for this state(s)
def get_action(self, state):
pass
class RandomController(Controller):
def __init__(self, env):
""" YOUR... | [
"numpy.argmin",
"numpy.array",
"numpy.empty",
"cost_functions.trajectory_cost_fn"
] | [((1235, 1327), 'numpy.empty', 'np.empty', (['(self.num_simulated_paths, self.horizon, self.env.observation_space.shape[0])'], {}), '((self.num_simulated_paths, self.horizon, self.env.\n observation_space.shape[0]))\n', (1243, 1327), True, 'import numpy as np\n'), ((1364, 1456), 'numpy.empty', 'np.empty', (['(self.n... |
import torch
import numpy as np
from torch import nn
from torch.nn import functional as F
# from modeling.dynamic_filters.multiheadatt import TransformerBlock
from modeling.dynamic_filters.build import DynamicFilter,ACRM_query,ACRM_video
from utils import loss as L
from utils.rnns import feed_forward_rnn
import utils.p... | [
"torch.nn.Dropout",
"torch.log",
"torch.nn.Tanh",
"modeling.dynamic_filters.build.ACRM_query",
"torch.abs",
"torch.nn.LSTM",
"torch.mean",
"utils.rnns.feed_forward_rnn",
"torch.stack",
"utils.pooling.MeanPoolingLayer",
"torch.tensor",
"torch.norm",
"torch.sum",
"torch.nn.Linear",
"modeli... | [((549, 564), 'modeling.dynamic_filters.build.ACRM_query', 'ACRM_query', (['cfg'], {}), '(cfg)\n', (559, 564), False, 'from modeling.dynamic_filters.build import DynamicFilter, ACRM_query, ACRM_video\n'), ((1371, 1386), 'modeling.dynamic_filters.build.ACRM_video', 'ACRM_video', (['cfg'], {}), '(cfg)\n', (1381, 1386), F... |
import os
import sys
import json
accasim = os.path.abspath(os.path.join('../../accasim'))
sys.path.insert(0, accasim)
import unittest
from accasim.base.resource_manager_class import Resources
class ResourcesTests(unittest.TestCase):
def load_sys_config(self):
fp = 'data/system_def.con... | [
"sys.path.insert",
"os.path.join",
"json.load",
"accasim.base.resource_manager_class.Resources",
"unittest.main"
] | [((96, 123), 'sys.path.insert', 'sys.path.insert', (['(0)', 'accasim'], {}), '(0, accasim)\n', (111, 123), False, 'import sys\n'), ((64, 93), 'os.path.join', 'os.path.join', (['"""../../accasim"""'], {}), "('../../accasim')\n", (76, 93), False, 'import os\n'), ((1369, 1384), 'unittest.main', 'unittest.main', ([], {}), ... |
#!/usr/bin/env python3
import traceback
from progressbar import ProgressBar, ETA, FormatLabel, Bar
import csv
import requests
from bs4 import BeautifulSoup
from datetime import datetime
from praw import Reddit
from redditnfl.reddittools.reddittoken import ensure_scopes
import sys
import pytz
EST = pytz.timezone('Amer... | [
"datetime.datetime.utcfromtimestamp",
"pytz.timezone",
"progressbar.Bar",
"requests.get",
"bs4.BeautifulSoup",
"datetime.datetime.now",
"traceback.print_exc",
"praw.Reddit",
"progressbar.ETA",
"redditnfl.reddittools.reddittoken.ensure_scopes",
"progressbar.FormatLabel"
] | [((301, 334), 'pytz.timezone', 'pytz.timezone', (['"""America/New_York"""'], {}), "('America/New_York')\n", (314, 334), False, 'import pytz\n'), ((1528, 1566), 'requests.get', 'requests.get', ([], {'url': 'url', 'headers': 'headers'}), '(url=url, headers=headers)\n', (1540, 1566), False, 'import requests\n'), ((1578, 1... |
import random
import string
import json
import os
KEYS_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)), "project", "keys_file.json")
def get_random_alphanumeric_string(length):
letters_and_digits = string.ascii_letters + string.digits
result_str = ''.join((random.choice(letters_and_digits) for... | [
"os.path.realpath",
"json.load",
"random.choice",
"json.dump"
] | [((92, 118), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (108, 118), False, 'import os\n'), ((472, 505), 'json.dump', 'json.dump', (['keys_data', 'f'], {'indent': '(2)'}), '(keys_data, f, indent=2)\n', (481, 505), False, 'import json\n'), ((283, 316), 'random.choice', 'random.choice', ([... |
#!/usr/bin/env python
import random
import subprocess
HOURS = range(1, 13)
MINUTES = ["o'clock"] + ["o %s" % x for x in range(1, 10)] + range(10, 60)
AM_PM = ['a.m.', 'p.m.']
TIME = 'it is now {} {} {}'.format(random.choice(HOURS),
random.choice(MINUTES),
... | [
"random.choice",
"subprocess.call"
] | [((345, 389), 'subprocess.call', 'subprocess.call', (["['say', '-v', 'Alex', TIME]"], {}), "(['say', '-v', 'Alex', TIME])\n", (360, 389), False, 'import subprocess\n'), ((212, 232), 'random.choice', 'random.choice', (['HOURS'], {}), '(HOURS)\n', (225, 232), False, 'import random\n'), ((266, 288), 'random.choice', 'rand... |
# -*- coding: utf-8 -*-
"""Helper to deal with querystring parameters according to jsonapi specification"""
import json
from flask import current_app
from flapison.exceptions import (
BadRequest,
InvalidFilters,
InvalidSort,
InvalidField,
InvalidInclude,
)
from flapison.schema import get_model_f... | [
"json.loads",
"flapison.exceptions.InvalidFilters",
"flapison.schema.get_model_field",
"flapison.exceptions.BadRequest",
"flapison.schema.get_schema_from_type",
"flask.current_app.config.get",
"flapison.schema.get_relationships"
] | [((4414, 4509), 'flapison.exceptions.BadRequest', 'BadRequest', (['"""You are not allowed to disable pagination"""'], {'source': "{'parameter': 'page[size]'}"}), "('You are not allowed to disable pagination', source={'parameter':\n 'page[size]'})\n", (4424, 4509), False, 'from flapison.exceptions import BadRequest, ... |
# Copyright (C) 2021-2022 INPE.
# DSAT-Cli is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
__author__ = '<NAME>'
__email__ = '<EMAIL>'
from dsat import cache
from dsat.config import Config
from dsat.utils import computeImageSize, cre... | [
"dsat.cache.exists",
"PIL.Image.open",
"dsat.utils.pickServer",
"tqdm.tqdm",
"dsat.cache.load",
"dsat.config.Config.missingTileImage.copy",
"requests.get",
"dsat.cache.save",
"multiprocessing.Lock",
"dsat.utils.createImage",
"multiprocessing.Queue",
"logging.info",
"multiprocessing.current_p... | [((460, 469), 'multiprocessing.Lock', 'mp.Lock', ([], {}), '()\n', (467, 469), True, 'import multiprocessing as mp\n'), ((498, 529), 'logging.info', 'log.info', (["('Request ' + url[11:])"], {}), "('Request ' + url[11:])\n", (506, 529), True, 'import logging as log\n'), ((2615, 2648), 'dsat.utils.createImage', 'createI... |
import logging
from io import BytesIO
from zipfile import ZipFile
from opennem.utils.handlers import _handle_zip, chain_streams
from opennem.utils.http import http
from opennem.utils.mime import mime_from_content, mime_from_url
logger = logging.getLogger("opennem.downloader")
def url_downloader(url: str) -> bytes:
... | [
"logging.getLogger",
"opennem.utils.mime.mime_from_content",
"zipfile.ZipFile",
"io.BytesIO",
"opennem.utils.handlers.chain_streams",
"opennem.utils.mime.mime_from_url",
"opennem.utils.http.http.get"
] | [((239, 278), 'logging.getLogger', 'logging.getLogger', (['"""opennem.downloader"""'], {}), "('opennem.downloader')\n", (256, 278), False, 'import logging\n'), ((465, 478), 'opennem.utils.http.http.get', 'http.get', (['url'], {}), '(url)\n', (473, 478), False, 'from opennem.utils.http import http\n'), ((591, 609), 'io.... |
import re
from functools import lru_cache
from pathlib import Path
import typing as T
from yaml import dump as yaml_dump
from faker import Faker
from faker.config import AVAILABLE_LOCALES
from tools.faker_docs_utils.format_samples import (
yaml_samples_for_docstring,
snowfakery_output_for,
)
from .summarize_fa... | [
"yaml.dump",
"re.compile",
"pathlib.Path",
"snowfakery.fakedata.fake_data_generator.FakeData",
"tools.faker_docs_utils.format_samples.snowfakery_output_for",
"faker.Faker",
"tools.faker_docs_utils.format_samples.yaml_samples_for_docstring",
"functools.lru_cache"
] | [((484, 520), 're.compile', 're.compile', (['"""(?<=^) +"""', 're.MULTILINE'], {}), "('(?<=^) +', re.MULTILINE)\n", (494, 520), False, 'import re\n'), ((542, 586), 're.compile', 're.compile', (['"""^\\\\s*:sample:.*$"""', 're.MULTILINE'], {}), "('^\\\\s*:sample:.*$', re.MULTILINE)\n", (552, 586), False, 'import re\n'),... |
from distutils.core import setup
setup(
name='entrypoints',
version='0.2.2',
description='Discover and load entry points from installed packages.',
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/takluyver/entrypoints',
py_modules=['entrypoints'],
)
| [
"distutils.core.setup"
] | [((34, 279), 'distutils.core.setup', 'setup', ([], {'name': '"""entrypoints"""', 'version': '"""0.2.2"""', 'description': '"""Discover and load entry points from installed packages."""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/takluyver/entrypoints"""', 'py_modules': "['... |
# -*- coding: utf-8 -*-
"""The main module for running the SEAMM installer.
"""
import argparse
import logging
import sys
import seamm_installer
logger = logging.getLogger(__name__)
def run():
"""Run the installer.
How the installer runs is controlled by command-line arguments.
We need the installer ... | [
"logging.getLogger",
"logging.basicConfig",
"argparse.ArgumentParser",
"seamm_installer.SEAMMInstaller"
] | [((157, 184), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (174, 184), False, 'import logging\n'), ((525, 550), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (548, 550), False, 'import argparse\n'), ((1384, 1416), 'logging.basicConfig', 'logging.basicConfig', (... |
#!/usr/bin/env python
# encoding: utf-8
import sys
import os
sys.path.append('./../')
from petsc4py import PETSc
if __name__=="__main__":
from psystem import *
refn = 7 # goal 7 (1024 DoFs)
outdir = './_output'
rank = PETSc.COMM_WORLD.rank
if rank==0:
if not os.path.exists(outdir): os.mkdi... | [
"os.path.exists",
"sys.path.append",
"os.mkdir"
] | [((61, 85), 'sys.path.append', 'sys.path.append', (['"""./../"""'], {}), "('./../')\n", (76, 85), False, 'import sys\n'), ((289, 311), 'os.path.exists', 'os.path.exists', (['outdir'], {}), '(outdir)\n', (303, 311), False, 'import os\n'), ((313, 329), 'os.mkdir', 'os.mkdir', (['outdir'], {}), '(outdir)\n', (321, 329), F... |
import os
import time
from concurrent import futures
from contextlib import contextmanager
from unittest import mock
import pytest
import diffuse
from diffuse.diffuser.base import pool
def target(msg):
return f"hello {msg}"
def target_exception(msg):
raise ValueError("Test")
def target_long_running(msg)... | [
"diffuse.Diffuser.create",
"concurrent.futures.wait",
"pytest.raises",
"time.sleep"
] | [((326, 344), 'time.sleep', 'time.sleep', (['(1 / 10)'], {}), '(1 / 10)\n', (336, 344), False, 'import time\n'), ((3729, 3796), 'diffuse.Diffuser.create', 'diffuse.Diffuser.create', ([], {'target': 'target', 'diffuser_type': 'diffuser_type'}), '(target=target, diffuser_type=diffuser_type)\n', (3752, 3796), False, 'impo... |
#
# Copyright (C) 2018 ETH Zurich, University of Bologna
# and GreenWaves Technologies
#
# 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
#
# U... | [
"collections.OrderedDict"
] | [((2080, 2107), 'collections.OrderedDict', 'collections.OrderedDict', (['[]'], {}), '([])\n', (2103, 2107), False, 'import collections\n'), ((2918, 2945), 'collections.OrderedDict', 'collections.OrderedDict', (['[]'], {}), '([])\n', (2941, 2945), False, 'import collections\n'), ((2971, 2998), 'collections.OrderedDict',... |
import h5py
from os import listdir, getcwd
from os.path import isfile, join
def hdf_to_csv():
path = getcwd() + '/2020_Challenge_IOT_Analytics/competitionfiles'
files = [f for f in listdir(path) if isfile(join(path, f))]
for file in files:
rf = h5py.File(path + '/' + file, 'r')
chanIDs = r... | [
"h5py.File",
"os.listdir",
"os.path.join",
"os.getcwd"
] | [((107, 115), 'os.getcwd', 'getcwd', ([], {}), '()\n', (113, 115), False, 'from os import listdir, getcwd\n'), ((267, 300), 'h5py.File', 'h5py.File', (["(path + '/' + file)", '"""r"""'], {}), "(path + '/' + file, 'r')\n", (276, 300), False, 'import h5py\n'), ((1093, 1101), 'os.getcwd', 'getcwd', ([], {}), '()\n', (1099... |
import logging
import magic
import os.path
import requests
from tqdm import tqdm
def read_in_chunks(file_path, blocksize=1024, chunks=-1):
""" Splitting the file into chunks. """
with open(file_path, 'rb') as file_object:
size = os.path.getsize(file_path)
pbar = tqdm(total=100)
curre... | [
"magic.Magic",
"tqdm.tqdm"
] | [((1787, 1809), 'magic.Magic', 'magic.Magic', ([], {'mime': '(True)'}), '(mime=True)\n', (1798, 1809), False, 'import magic\n'), ((291, 306), 'tqdm.tqdm', 'tqdm', ([], {'total': '(100)'}), '(total=100)\n', (295, 306), False, 'from tqdm import tqdm\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 14 09:15:33 2020
@author: dhulls
"""
# Imports
import numpy as np
np.random.seed(100)
from tensorflow import random
random.set_seed(100)
import os
import pathlib
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
os.chdir('/... | [
"tensorflow.random.set_seed",
"pandas.read_csv",
"numpy.power",
"tensorflow_docs.modeling.EpochDots",
"os.chdir",
"tensorflow.keras.layers.Dense",
"numpy.random.seed",
"pandas.DataFrame",
"tensorflow.keras.optimizers.RMSprop"
] | [((138, 157), 'numpy.random.seed', 'np.random.seed', (['(100)'], {}), '(100)\n', (152, 157), True, 'import numpy as np\n'), ((188, 208), 'tensorflow.random.set_seed', 'random.set_seed', (['(100)'], {}), '(100)\n', (203, 208), False, 'from tensorflow import random\n'), ((309, 371), 'os.chdir', 'os.chdir', (['"""/Users/s... |
import torch
from torch import nn
class Cache(nn.Module):
def __init__(self, n_entries, entry_size):
super(Cache, self).__init__()
self.n_entries = n_entries
self.entry_size = entry_size
self.register_buffer(
name='idx_sparse',
tensor=torch.z... | [
"torch.zeros"
] | [((313, 367), 'torch.zeros', 'torch.zeros', (['(n_entries, entry_size)'], {'dtype': 'torch.long'}), '((n_entries, entry_size), dtype=torch.long)\n', (324, 367), False, 'import torch\n'), ((461, 497), 'torch.zeros', 'torch.zeros', (['(n_entries, entry_size)'], {}), '((n_entries, entry_size))\n', (472, 497), False, 'impo... |
# stdlib
import os
import sys
import logging
# addlib
import boto3
log = logging.getLogger(__name__)
class RecordAccumulator(object):
def __init__(self, limit=20):
self.limit = limit
self.container = []
def empty(self):
result, self.container = self.container, []
... | [
"logging.getLogger",
"boto3.client"
] | [((83, 110), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (100, 110), False, 'import logging\n'), ((686, 733), 'boto3.client', 'boto3.client', (['api_name'], {'region_name': 'region_name'}), '(api_name, region_name=region_name)\n', (698, 733), False, 'import boto3\n')] |
# https://atcoder.jp/contests/math-and-algorithm/tasks/math_and_algorithm_v
from collections import Counter
n = int(input())
aa = list(map(int, input().split()))
ctr = Counter(aa)
ans = 0
for x, c in ctr.items():
if x == 100000 // 2:
ans += ctr[x] * (ctr[x] - 1)
else:
ans += ctr[x] * ctr[100000... | [
"collections.Counter"
] | [((169, 180), 'collections.Counter', 'Counter', (['aa'], {}), '(aa)\n', (176, 180), False, 'from collections import Counter\n')] |
from abc import ABC, abstractmethod
from typing import Callable, cast, Set, List, Dict, Optional
import numpy as np
from autofit import ModelInstance, Analysis, DirectoryPaths
from autofit.graphical.expectation_propagation import AbstractFactorOptimiser
from autofit.graphical.expectation_propagation import EPMeanFiel... | [
"numpy.prod",
"autofit.mapper.prior_model.collection.CollectionPriorModel",
"autofit.graphical.expectation_propagation.EPMeanField.from_approx_dists",
"autofit.graphical.expectation_propagation.EPOptimiser",
"autofit.graphical.messages.NormalMessage.from_prior",
"typing.cast"
] | [((2759, 2819), 'autofit.graphical.expectation_propagation.EPMeanField.from_approx_dists', 'EPMeanField.from_approx_dists', (['self.graph', 'self.message_dict'], {}), '(self.graph, self.message_dict)\n', (2788, 2819), False, 'from autofit.graphical.expectation_propagation import EPMeanField\n'), ((2985, 3158), 'autofit... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-23 15:42
from __future__ import unicode_literals
import django.contrib.postgres.fields.hstore
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('correctiv_eurosfueraerzte', '0021_paymentrecipi... | [
"django.db.models.URLField",
"django.db.models.CharField"
] | [((475, 518), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(50)'}), '(blank=True, max_length=50)\n', (491, 518), False, 'from django.db import migrations, models\n'), ((650, 694), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(255)... |
import json
from justfunc.env import setup_env
from justfunc.evaluator import evaluate
from justfunc.reader import read
class JustFunc:
def __init__(self):
self.env = setup_env()
def run(self, src):
return evaluate(read(src), self.env)
def run_repl(self, prompt=">>> "):
while li... | [
"json.dumps",
"justfunc.reader.read",
"justfunc.env.setup_env"
] | [((182, 193), 'justfunc.env.setup_env', 'setup_env', ([], {}), '()\n', (191, 193), False, 'from justfunc.env import setup_env\n'), ((243, 252), 'justfunc.reader.read', 'read', (['src'], {}), '(src)\n', (247, 252), False, 'from justfunc.reader import read\n'), ((420, 438), 'json.dumps', 'json.dumps', (['result'], {}), '... |
import numpy as np
import torch
from fairseq.data.indexed_dataset import __best_fitting_dtype, MMapIndexedDatasetBuilder, IndexedDatasetBuilder
from fairseq.tokenizer import tokenize_line
# TODO move this file into data folder
def make_builder(out_file, impl, vocab_size=None, dtype=None):
if impl == 'mmap':
... | [
"fairseq.data.indexed_dataset.MMapIndexedDatasetBuilder",
"fairseq.tokenizer.tokenize_line",
"fairseq.data.indexed_dataset.__best_fitting_dtype",
"torch.tensor",
"fairseq.data.indexed_dataset.IndexedDatasetBuilder"
] | [((409, 457), 'fairseq.data.indexed_dataset.MMapIndexedDatasetBuilder', 'MMapIndexedDatasetBuilder', (['out_file'], {'dtype': 'dtype'}), '(out_file, dtype=dtype)\n', (434, 457), False, 'from fairseq.data.indexed_dataset import __best_fitting_dtype, MMapIndexedDatasetBuilder, IndexedDatasetBuilder\n'), ((483, 514), 'fai... |
"""
Protocol wrapper that will detect hung connections.
In particular, since PB expects the server to talk first and HTTP
expects the client to talk first, when a PB client talks to an HTTP
server, neither side will talk, leading to a hung connection. This
wrapper will disconnect in that case, and inform the caller.
"... | [
"twisted.python.components.proxyForInterface"
] | [((620, 669), 'twisted.python.components.proxyForInterface', 'proxyForInterface', (['IProtocol', '"""_wrapped_protocol"""'], {}), "(IProtocol, '_wrapped_protocol')\n", (637, 669), False, 'from twisted.python.components import proxyForInterface\n'), ((2938, 2993), 'twisted.python.components.proxyForInterface', 'proxyFor... |
import ctypes
import os
so = os.path.join(os.path.dirname(__file__), 'maths.so')
lib = ctypes.CDLL(so)
lib.relax.argtypes = [
ctypes.c_void_p,
ctypes.c_void_p,
ctypes.c_void_p,
ctypes.c_void_p,
ctypes.c_void_p,
ctypes.c_void_p,
ctypes.c_void_p,
ctypes.c_int,
ctypes.c_int,
]
de... | [
"os.path.dirname",
"ctypes.CDLL"
] | [((88, 103), 'ctypes.CDLL', 'ctypes.CDLL', (['so'], {}), '(so)\n', (99, 103), False, 'import ctypes\n'), ((43, 68), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (58, 68), False, 'import os\n')] |
from newspaperclassifier.evaluation.merging import merge_labels
import click
@click.command()
@click.option('--aws-dir', type=str, help="Directory where AWS labels are stored")
@click.option('--gc-dir', type=str, help="Directory where GC labels are stored")
@click.option('--destination', type=str, help="Destination f... | [
"click.option",
"newspaperclassifier.evaluation.merging.merge_labels",
"click.command"
] | [((80, 95), 'click.command', 'click.command', ([], {}), '()\n', (93, 95), False, 'import click\n'), ((97, 183), 'click.option', 'click.option', (['"""--aws-dir"""'], {'type': 'str', 'help': '"""Directory where AWS labels are stored"""'}), "('--aws-dir', type=str, help=\n 'Directory where AWS labels are stored')\n", ... |
from shapely.geometry import shape
import fiona
import networkx as nx
import matplotlib.pyplot as plt
import math
import random
import traffic
import pickle
from datetime import datetime
from request import Request
import numpy as np
try:
from itertools import izip as zip
except ImportError:
pass
def main():... | [
"numpy.sqrt",
"shapely.geometry.shape",
"networkx.astar_path",
"numpy.divide",
"datetime.datetime",
"numpy.multiply",
"matplotlib.pyplot.plot",
"numpy.subtract",
"fiona.open",
"matplotlib.pyplot.axis",
"random.randint",
"traffic.process_traffic",
"pickle.load",
"numpy.cos",
"matplotlib.p... | [((804, 821), 'matplotlib.pyplot.axis', 'plt.axis', (['"""equal"""'], {}), "('equal')\n", (812, 821), True, 'import matplotlib.pyplot as plt\n'), ((826, 836), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (834, 836), True, 'import matplotlib.pyplot as plt\n'), ((2669, 2760), 'fiona.open', 'fiona.open', (['"""... |
import time
from TSP_toStudents import *
def main():
maxMenu = 6
iterationNumber = 1
maxIterations = 4
for i in range(1, maxMenu + 1):
for j in range(1, maxIterations+1):
BasicTSP.menuChoice = i
data_input_file = sys.argv[1]
print('=========================... | [
"time.time"
] | [((508, 519), 'time.time', 'time.time', ([], {}), '()\n', (517, 519), False, 'import time\n'), ((1183, 1194), 'time.time', 'time.time', ([], {}), '()\n', (1192, 1194), False, 'import time\n'), ((1858, 1869), 'time.time', 'time.time', ([], {}), '()\n', (1867, 1869), False, 'import time\n'), ((2533, 2544), 'time.time', '... |
#
# Copyright IBM Corp. 2016 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 applicable law or ... | [
"bdd_request_util.getTokenedHeaders",
"bdd_request_util.httpPost",
"bdd_request_util.getSchema",
"bdd_request_util.httpGet"
] | [((868, 894), 'bdd_request_util.getTokenedHeaders', 'getTokenedHeaders', (['context'], {}), '(context)\n', (885, 894), False, 'from bdd_request_util import httpGet, httpPost, getTokenedHeaders, getToken, getSchema\n'), ((1015, 1044), 'bdd_request_util.httpGet', 'httpGet', (['url'], {'headers': 'headers'}), '(url, heade... |
#!/usr/bin/env python
"""
BSD 3-Clause License
Copyright (c) 2017, SafeBreach Labs
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notic... | [
"logging.getLogger",
"exceptions_.BucketValueMissingException",
"providers.common.calculations.calculate_bits_sum",
"wmi.WMI",
"os.path.dirname",
"ctypes.c_wchar_p"
] | [((2519, 2546), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2536, 2546), False, 'import logging\n'), ((3053, 3062), 'wmi.WMI', 'wmi.WMI', ([], {}), '()\n', (3060, 3062), False, 'import wmi\n'), ((4040, 4083), 'providers.common.calculations.calculate_bits_sum', 'calculate_bits_sum', ([... |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | [
"numpy.array",
"paddle.disable_static",
"unittest.main",
"paddle.CPUPlace",
"numpy.random.random",
"paddle.vision.ops.psroi_pool",
"paddle.vision.ops.PSRoIPool",
"paddle.fluid.create_lod_tensor",
"paddle.enable_static",
"paddle.to_tensor",
"paddle.fluid.core.is_compiled_with_cuda",
"paddle.set... | [((1156, 1178), 'numpy.zeros', 'np.zeros', (['output_shape'], {}), '(output_shape)\n', (1164, 1178), True, 'import numpy as np\n'), ((13311, 13326), 'unittest.main', 'unittest.main', ([], {}), '()\n', (13324, 13326), False, 'import unittest\n'), ((3454, 3476), 'paddle.enable_static', 'paddle.enable_static', ([], {}), '... |
from django.urls import path, re_path
from Net640.apps.images import views
app_name = 'images'
urlpatterns = [
path(r'my_images/', views.user_images_view, name="my_images"),
# TODO move to rest api
path(r'action/', views.user_image_action, name="user_image_action"),
]
| [
"django.urls.path"
] | [((116, 176), 'django.urls.path', 'path', (['"""my_images/"""', 'views.user_images_view'], {'name': '"""my_images"""'}), "('my_images/', views.user_images_view, name='my_images')\n", (120, 176), False, 'from django.urls import path, re_path\n'), ((211, 277), 'django.urls.path', 'path', (['"""action/"""', 'views.user_im... |
import csv
# django-request analytics package, NOT requests URL library!
from request.models import Request
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import RequestFactory
from . import views
class GraphsTestCase(... | [
"request.models.Request",
"django.contrib.auth.models.User.objects.create_user",
"django.test.client.RequestFactory",
"django.core.urlresolvers.reverse"
] | [((444, 460), 'django.test.client.RequestFactory', 'RequestFactory', ([], {}), '()\n', (458, 460), False, 'from django.test.client import RequestFactory\n'), ((649, 712), 'django.contrib.auth.models.User.objects.create_user', 'User.objects.create_user', ([], {'username': '"""foo"""', 'password': '"""<PASSWORD>"""'}), "... |
import sys, inspect
class Tutorial:
flow = "TUTORIAL"
type = "embed"
title = "__TUTORIAL HELP__"
colour = "green"
def __init__(self, player=None):
self.fields = (('Official Discord Server:',
'''
https://discord.com/invite/discord-developers... | [
"inspect.getmembers"
] | [((2063, 2104), 'inspect.getmembers', 'inspect.getmembers', (['sys.modules[__name__]'], {}), '(sys.modules[__name__])\n', (2081, 2104), False, 'import sys, inspect\n')] |
import connexion
import six
from deregnet_rest.models.score import Score # noqa: E501
from deregnet_rest.models.score_info import ScoreInfo # noqa: E501
from deregnet_rest import util
from deregnet_rest.controllers_impl.scores import ScoreController
def delete_score(score_id): # noqa: E501
"""Delete a previo... | [
"deregnet_rest.controllers_impl.scores.ScoreController.get_score",
"deregnet_rest.controllers_impl.scores.ScoreController.delete_score",
"deregnet_rest.controllers_impl.scores.ScoreController.get_scores",
"deregnet_rest.controllers_impl.scores.ScoreController.post_score",
"connexion.request.get_json"
] | [((521, 559), 'deregnet_rest.controllers_impl.scores.ScoreController.delete_score', 'ScoreController.delete_score', (['score_id'], {}), '(score_id)\n', (549, 559), False, 'from deregnet_rest.controllers_impl.scores import ScoreController\n'), ((794, 829), 'deregnet_rest.controllers_impl.scores.ScoreController.get_score... |
#!/usr/bin/env python
#
# Copyright (c) 2006 <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# - Redistributions of source code must retain the above copyright
# notice, this list of ... | [
"struct.pack",
"re.compile"
] | [((1611, 1684), 're.compile', 're.compile', (['"""([0-9a-f]+)\\\\s+[lg]\\\\s+.\\\\s+\\\\.text\\\\s+([0-9a-f]+)\\\\s+(.*)$"""'], {}), "('([0-9a-f]+)\\\\s+[lg]\\\\s+.\\\\s+\\\\.text\\\\s+([0-9a-f]+)\\\\s+(.*)$')\n", (1621, 1684), False, 'import re\n'), ((1690, 1769), 're.compile', 're.compile', (['"""([0-9a-f]+)\\\\s+[lg... |
#!/usr/bin/env python3
import random
import time
import sys
import pygame
from pygame.locals import *
import pygame.surfarray as surfarray # for performance
import numpy as np
import colors # color definition
SCREEN_SIZE = (1600, 900) # change it to your screen size
#color definition... | [
"colors.random_color",
"sys.exit",
"pygame.init",
"random.shuffle",
"pygame.event.get",
"pygame.Surface",
"pygame.display.set_mode",
"pygame.display.update",
"pygame.quit",
"numpy.bool",
"numpy.roll",
"pygame.mouse.set_visible",
"numpy.zeros",
"pygame.surfarray.blit_array",
"pygame.time.... | [((1014, 1027), 'pygame.init', 'pygame.init', ([], {}), '()\n', (1025, 1027), False, 'import pygame\n'), ((1032, 1063), 'pygame.mouse.set_visible', 'pygame.mouse.set_visible', (['(False)'], {}), '(False)\n', (1056, 1063), False, 'import pygame\n'), ((1075, 1127), 'pygame.display.set_mode', 'pygame.display.set_mode', ([... |
import unittest #unitest module
from password import Credential #imports Credential class for testing
from password import User #imports User class for testing
class TestUser(unittest.TestCase):
'''
Test class that helps define test cases for the credentials class behaviours
Args:
Testcase class ta... | [
"password.Credential.display_accounts",
"password.Credential.find_by_accountUsername",
"password.Credential",
"unittest.main",
"password.Credential.account_exist",
"password.User"
] | [((4125, 4140), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4138, 4140), False, 'import unittest\n'), ((547, 572), 'password.User', 'User', (['"""Vernice"""', '"""<NAME>"""'], {}), "('Vernice', '<NAME>')\n", (551, 572), False, 'from password import User\n'), ((1287, 1336), 'password.Credential', 'Credential', ... |
import enum
import sys
import os.path
TokenType = enum.Enum("TokenType", "form lemma parse morph_lemma all")
ChunkType = enum.Enum("ChunkType", "book chapter verse paragraph pericope")
chunk_data_filename = {
ChunkType.book: "books.txt",
ChunkType.chapter: "chapters.txt",
ChunkType.verse: "verses.txt",
... | [
"heb_lex_tools.HEBLEX",
"enum.Enum",
"sys.exit"
] | [((51, 109), 'enum.Enum', 'enum.Enum', (['"""TokenType"""', '"""form lemma parse morph_lemma all"""'], {}), "('TokenType', 'form lemma parse morph_lemma all')\n", (60, 109), False, 'import enum\n'), ((122, 185), 'enum.Enum', 'enum.Enum', (['"""ChunkType"""', '"""book chapter verse paragraph pericope"""'], {}), "('Chunk... |
# Script to pull outcome data for most recent HLA data from Refugio
import pandas as pd
import os
os.chdir("/Users/laurahughes/GitHub/cvisb_data/sample-viewer-api/src/static/data/")
# from getHLApatients import cleanCohort, cleanOutcome, cleanCountry, getAltIDs
import helpers
import_path = "/Users/laurahughes/GitHub/c... | [
"os.chdir",
"pandas.merge",
"pandas.read_json",
"pandas.read_excel"
] | [((98, 186), 'os.chdir', 'os.chdir', (['"""/Users/laurahughes/GitHub/cvisb_data/sample-viewer-api/src/static/data/"""'], {}), "(\n '/Users/laurahughes/GitHub/cvisb_data/sample-viewer-api/src/static/data/')\n", (106, 186), False, 'import os\n'), ((555, 595), 'pandas.read_excel', 'pd.read_excel', (['import_path'], {'s... |
################################################################################
# Copyright (c) 2020-2021, Berkeley Design Technology, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to ... | [
"yaml.load"
] | [((1478, 1519), 'yaml.load', 'yaml.load', (['stream'], {'Loader': 'yaml.FullLoader'}), '(stream, Loader=yaml.FullLoader)\n', (1487, 1519), False, 'import yaml\n')] |
#!/usr/bin/python
###############################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# #
# Licensed under the Apache License Version 2.0 (the "License"). Y... | [
"botocore.config.Config",
"boto3.client"
] | [((1282, 1320), 'boto3.client', 'boto3.client', (['"""s3"""'], {'config': 'boto_config'}), "('s3', config=boto_config)\n", (1294, 1320), False, 'import boto3\n'), ((1383, 1419), 'botocore.config.Config', 'Config', ([], {'retries': "{'mode': 'standard'}"}), "(retries={'mode': 'standard'})\n", (1389, 1419), False, 'from ... |
# -*- coding: utf-8 -*-
from collections import Sequence
from datetime import datetime
try:
from urlparse import urljoin
except ImportError:
from urllib.parse import urljoin # NOQA
from xively.models import (
Datapoint,
Datastream,
Feed,
Key,
Location,
Permission,
Resource,
T... | [
"xively.models.Feed",
"xively.models.Waypoint",
"xively.models.Resource",
"datetime.datetime.strptime",
"xively.models.Datapoint",
"xively.models.Key",
"xively.models.Trigger",
"xively.models.Unit",
"xively.models.Datastream",
"datetime.datetime.now",
"xively.models.Location",
"xively.models.P... | [((1288, 1337), 'datetime.datetime.strptime', 'datetime.strptime', (['value', '"""%Y-%m-%dT%H:%M:%S.%fZ"""'], {}), "(value, '%Y-%m-%dT%H:%M:%S.%fZ')\n", (1305, 1337), False, 'from datetime import datetime\n'), ((10483, 10500), 'xively.models.Feed', 'Feed', ([], {}), '(**feed_data)\n', (10487, 10500), False, 'from xivel... |
from django.shortcuts import render
from django.views.generic import CreateView
from django.urls import reverse_lazy
from dal import autocomplete
# from .models import Country, Person
# from .forms import PersonForm
from .models import Country
from .forms import CountryForm
# Create your views here.
# class PersonCrea... | [
"django.urls.reverse_lazy"
] | [((714, 737), 'django.urls.reverse_lazy', 'reverse_lazy', (['view_name'], {}), '(view_name)\n', (726, 737), False, 'from django.urls import reverse_lazy\n')] |
#! /usr/bin/python3
from library_traverser import traverse_module, MemberVisitor, MemberInfoExtractor
import re
import inspect
import pymongo
import flask
import pkgutil
import importlib
sub_modules = [m for m in pkgutil.iter_modules(flask.__path__) if m[2]]
for m in sub_modules:
importlib.import_module("flask.... | [
"inspect.getdoc",
"importlib.import_module",
"re.compile",
"library_traverser.MemberVisitor",
"library_traverser.traverse_module",
"pymongo.MongoClient",
"pkgutil.iter_modules"
] | [((1774, 1812), 'pymongo.MongoClient', 'pymongo.MongoClient', ([], {'host': '"""172.17.0.2"""'}), "(host='172.17.0.2')\n", (1793, 1812), False, 'import pymongo\n'), ((2078, 2122), 'library_traverser.MemberVisitor', 'MemberVisitor', (['insert_db', 'inspect', 'extractor'], {}), '(insert_db, inspect, extractor)\n', (2091,... |
# ------------------------------------------------------------
# Copyright (c) 2017-present, SeetaTech, Co.,Ltd.
#
# Licensed under the BSD 2-Clause License.
# You should have received a copy of the BSD 2-Clause License
# along with the software. If not, See,
#
# <https://opensource.org/licenses/BSD-2-Clause>
#
# ... | [
"dragon.workspace.HasTensor",
"numpy.array",
"dragon.vm.torch.c_api.device"
] | [((1121, 1150), 'dragon.vm.torch.c_api.device', '_Device', (['types[0]', 'indices[0]'], {}), '(types[0], indices[0])\n', (1128, 1150), True, 'from dragon.vm.torch.c_api import device as _Device\n'), ((1487, 1496), 'dragon.vm.torch.c_api.device', '_Device', ([], {}), '()\n', (1494, 1496), True, 'from dragon.vm.torch.c_a... |
from Scripts.Resources import Bot, timer
from Scripts.Classes import Markup, button, User
from Scripts.Additional import all_groups, yes_no_markup, get_info
from Scripts.MainMenu import send_student_menu
from DataBase.DataBaseWork import get_query
bot = Bot()
def confirm_user(update, user, params):
answer, stude... | [
"Scripts.Additional.yes_no_markup",
"Scripts.Additional.all_groups.values",
"Scripts.Classes.Markup",
"DataBase.DataBaseWork.get_query",
"Scripts.Additional.get_info",
"Scripts.Classes.button",
"Scripts.Resources.Bot",
"Scripts.Classes.User",
"Scripts.MainMenu.send_student_menu"
] | [((255, 260), 'Scripts.Resources.Bot', 'Bot', ([], {}), '()\n', (258, 260), False, 'from Scripts.Resources import Bot, timer\n'), ((349, 365), 'Scripts.Classes.User', 'User', (['student_id'], {}), '(student_id)\n', (353, 365), False, 'from Scripts.Classes import Markup, button, User\n'), ((1239, 1271), 'Scripts.Additio... |
from google.cloud import storage
# Explicitly use service account credentials by specifying the private key
# file.
storage_client = storage.Client.from_service_account_json(
'credentials.json')
# Make an authenticated API request
buckets = list(storage_client.list_buckets())
print(buckets) | [
"google.cloud.storage.Client.from_service_account_json"
] | [((134, 194), 'google.cloud.storage.Client.from_service_account_json', 'storage.Client.from_service_account_json', (['"""credentials.json"""'], {}), "('credentials.json')\n", (174, 194), False, 'from google.cloud import storage\n')] |