code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 28 09:08:29 2021
@author: <NAME>
"""
from . import multiasset as ma
from . import opt_abc as opt
import numpy as np
import scipy.stats as spst
class BsmBasketAsianJu2002(ma.NormBasket):
def __init__(self, sigma, cor=None, weight=None, intr=0.0, divr=0.0, is_fwd=Fals... | [
"numpy.sqrt",
"numpy.isscalar",
"numpy.log",
"numpy.exp",
"numpy.zeros",
"scipy.stats.norm.pdf",
"numpy.full",
"scipy.stats.norm.cdf"
] | [((5440, 5472), 'numpy.zeros', 'np.zeros', (['(num_asset, num_asset)'], {}), '((num_asset, num_asset))\n', (5448, 5472), True, 'import numpy as np\n'), ((9337, 9354), 'numpy.isscalar', 'np.isscalar', (['spot'], {}), '(spot)\n', (9348, 9354), True, 'import numpy as np\n'), ((9411, 9433), 'numpy.isscalar', 'np.isscalar',... |
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
import numpy as np
import os
import datetime
'''
se_txt_to_npz
'''
# # spatial embedding
# f = open("sz/SE(sz).txt", mode='r')
# lines = f.readlines()
# temp = lines[0].split(' ')
# N, dims = int(temp[0]), int(temp[1])
# SE = np.zeros(shape=(N, dims), dtype=np... | [
"os.path.exists",
"tensorflow.compat.v1.disable_v2_behavior",
"os.makedirs",
"os.path.join",
"numpy.sum",
"numpy.isnan",
"numpy.around",
"tensorflow.compat.v1.trainable_variables",
"numpy.isinf"
] | [((34, 58), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.disable_v2_behavior', ([], {}), '()\n', (56, 58), True, 'import tensorflow.compat.v1 as tf\n'), ((763, 787), 'tensorflow.compat.v1.trainable_variables', 'tf.trainable_variables', ([], {}), '()\n', (785, 787), True, 'import tensorflow.compat.v1 as tf\n'), ((138... |
"""
Advent of Code 2020
Day 9
"""
def get_data(fname: str) -> list:
"""
Read the data file into a list.
"""
with open(fname) as f:
return [int(line) for line in f]
def part1(fname: str, n: int) -> int:
"""Part 1.
Tests
>>> part1("./data/day09_test.txt", n=5)
127
"""
... | [
"doctest.testmod"
] | [((1198, 1227), 'doctest.testmod', 'doctest.testmod', ([], {'verbose': '(True)'}), '(verbose=True)\n', (1213, 1227), False, 'import doctest\n')] |
import os
import pytest
from datetime import datetime
from decimal import Decimal
from en16931.entity import Entity
from en16931.invoice import Invoice
from en16931.invoice_line import InvoiceLine
from en16931.tax import Tax
class TestInvoiceAttributes:
def test_default_id_number(self):
i = Invoice()
... | [
"datetime.datetime",
"os.path.exists",
"en16931.invoice.Invoice",
"en16931.entity.Entity",
"pytest.raises"
] | [((308, 317), 'en16931.invoice.Invoice', 'Invoice', ([], {}), '()\n', (315, 317), False, 'from en16931.invoice import Invoice\n'), ((396, 424), 'en16931.invoice.Invoice', 'Invoice', ([], {'invoice_id': '"""1-2018"""'}), "(invoice_id='1-2018')\n", (403, 424), False, 'from en16931.invoice import Invoice\n'), ((725, 734),... |
#!/usr/bin/env python
#=========================================================
#This Module is Written to Execute Stage2 of Ransomeware
#=========================================================
# Stage1
# |____*****TAKES NO ARGUMENTS*****
# |____Searches for Target Extension Files on Different Thread
# |___... | [
"pathlib.Path.home",
"os.path.join",
"time.sleep",
"threading.Thread",
"configparser.RawConfigParser",
"os.walk"
] | [((4224, 4237), 'time.sleep', 'time.sleep', (['(4)'], {}), '(4)\n', (4234, 4237), False, 'import os, time\n'), ((1082, 1144), 'threading.Thread', 'threading.Thread', ([], {'target': 'self.run_locate_class', 'args': '[target1]'}), '(target=self.run_locate_class, args=[target1])\n', (1098, 1144), False, 'import threading... |
# Copyright (c) 2020 BlenderNPR and contributors. MIT license.
import math
#Rotated Grid Super Sampling pattern
def get_RGSS_samples(grid_size):
samples = []
for x in range(0, grid_size):
for y in range(0, grid_size):
_x = (x / grid_size) * 2.0 - 1.0 #(-1 ... +1 range)
_y = (y ... | [
"math.cos",
"math.sin",
"math.sqrt",
"math.atan"
] | [((385, 401), 'math.atan', 'math.atan', (['(1 / 2)'], {}), '(1 / 2)\n', (394, 401), False, 'import math\n'), ((418, 433), 'math.sin', 'math.sin', (['angle'], {}), '(angle)\n', (426, 433), False, 'import math\n'), ((452, 467), 'math.cos', 'math.cos', (['angle'], {}), '(angle)\n', (460, 467), False, 'import math\n'), ((5... |
import alerter
battery_parameters_normal_range = {'charging_temperature': {'min': 0, 'max': 45},
'state_of_charge': {'min': 20, 'max': 80},
'charge_rate': {'min': 0, 'max': 0.8}}
def check_is_battery_parameter_out_of_range(out_of_range_parameters,... | [
"alerter.report_severity_of_battery_health_breach",
"alerter.report_normal_health_status"
] | [((1378, 1464), 'alerter.report_severity_of_battery_health_breach', 'alerter.report_severity_of_battery_health_breach', (['out_of_range_battery_parameters'], {}), '(\n out_of_range_battery_parameters)\n', (1426, 1464), False, 'import alerter\n'), ((1478, 1515), 'alerter.report_normal_health_status', 'alerter.report_... |
import warnings
import wagtail
if wagtail.VERSION < (2, 0):
warnings.warn("GeoPanel only works in Wagtail 2+", Warning) # NOQA
warnings.warn("Please import GeoPanel from wagtailgeowidget.legacy_edit_handlers instead", Warning) # NOQA
warnings.warn("All support for Wagtail 1.13 and below will be droppen ... | [
"warnings.warn",
"wagtailgeowidget.widgets.GeoField"
] | [((66, 125), 'warnings.warn', 'warnings.warn', (['"""GeoPanel only works in Wagtail 2+"""', 'Warning'], {}), "('GeoPanel only works in Wagtail 2+', Warning)\n", (79, 125), False, 'import warnings\n'), ((138, 247), 'warnings.warn', 'warnings.warn', (['"""Please import GeoPanel from wagtailgeowidget.legacy_edit_handlers ... |
from ground.base import (Location,
Relation)
from hypothesis import given
from orient.planar import (point_in_multisegment,
point_in_polygon,
point_in_segment,
segment_in_multisegment,
se... | [
"tests.utils.reverse_polygon_holes",
"tests.utils.compound_to_linear",
"orient.planar.segment_in_polygon",
"tests.utils.to_contour_segments",
"tests.utils.pack_non_shaped",
"tests.utils.to_sorted_segment",
"tests.utils.reverse_multisegment_endpoints",
"tests.utils.reverse_multisegment_coordinates",
... | [((1386, 1431), 'hypothesis.given', 'given', (['strategies.polygons_with_multisegments'], {}), '(strategies.polygons_with_multisegments)\n', (1391, 1431), False, 'from hypothesis import given\n'), ((1739, 1784), 'hypothesis.given', 'given', (['strategies.polygons_with_multisegments'], {}), '(strategies.polygons_with_mu... |
import jwt
from django.http import Http404, HttpResponseBadRequest, JsonResponse
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST
from .user import get_or_create_user
from .validators import UserDataValidator
@csrf_exempt
@require_POST
def sso_sync(request):
... | [
"jwt.decode",
"django.http.HttpResponseBadRequest",
"django.http.Http404",
"django.http.JsonResponse"
] | [((1071, 1100), 'django.http.JsonResponse', 'JsonResponse', (["{'id': user.id}"], {}), "({'id': user.id})\n", (1083, 1100), False, 'from django.http import Http404, HttpResponseBadRequest, JsonResponse\n'), ((374, 383), 'django.http.Http404', 'Http404', ([], {}), '()\n', (381, 383), False, 'from django.http import Http... |
"""
Given a number of bits, write the get_sample function to return a list n of random samples from a finite probability mass function
defined by a dictionary with keys defined by a specified number of bits.
For example, given 3 bits, we have the following dictionary that defines the probability of each of the keys.
Th... | [
"random.choices"
] | [((1963, 1998), 'random.choices', 'random.choices', (['population', 'density'], {}), '(population, density)\n', (1977, 1998), False, 'import random\n')] |
from rdkit import Chem
import argparse
import os
def calc(pdb_fname):
pdb = Chem.MolFromPDBFile(pdb_fname, sanitize=False)
chains = Chem.SplitMolByPDBChainId(pdb)
for name, mol in chains.items():
w = Chem.PDBWriter(os.path.splitext(os.path.abspath(pdb_fname))[0] + "_chain_%s.pdb" % name)
w... | [
"os.path.abspath",
"rdkit.Chem.MolFromPDBFile",
"rdkit.Chem.SplitMolByPDBChainId",
"argparse.ArgumentParser"
] | [((82, 128), 'rdkit.Chem.MolFromPDBFile', 'Chem.MolFromPDBFile', (['pdb_fname'], {'sanitize': '(False)'}), '(pdb_fname, sanitize=False)\n', (101, 128), False, 'from rdkit import Chem\n'), ((142, 172), 'rdkit.Chem.SplitMolByPDBChainId', 'Chem.SplitMolByPDBChainId', (['pdb'], {}), '(pdb)\n', (167, 172), False, 'from rdki... |
import os
from vina_utils import get_separator_filename_mode, get_structure_file_name, get_name_model_pdb
from subprocess import Popen, PIPE
def save_pdbqt_from_list(list_line, path_save, base_file_name_model):
pdbqt_file = os.path.join(path_save, base_file_name_model)
f_file = open(pdbqt_file, "w")
for item in lis... | [
"subprocess.Popen",
"os.path.join",
"vina_utils.get_structure_file_name",
"vina_utils.get_separator_filename_mode",
"vina_utils.get_name_model_pdb"
] | [((226, 271), 'os.path.join', 'os.path.join', (['path_save', 'base_file_name_model'], {}), '(path_save, base_file_name_model)\n', (238, 271), False, 'import os\n'), ((547, 581), 'vina_utils.get_structure_file_name', 'get_structure_file_name', (['structure'], {}), '(structure)\n', (570, 581), False, 'from vina_utils imp... |
#
# Copyright (C) <NAME> 2020 <<EMAIL>>
#
import locale
import sqlite3
import datetime
from playsound import playsound
import gi
from . import config
from .config import log
from . import utility
from . import stats
from .preferencesTabacchi import prefs
from . import preferencesTabacchi
gi.require_version('Gtk', '... | [
"locale.format_string",
"gi.repository.Gtk.ListStore",
"playsound.playsound",
"gi.require_version",
"locale.currency",
"gi.repository.Gtk.CellRendererText",
"datetime.datetime.now",
"gi.repository.Gtk.MessageDialog",
"gi.repository.Gtk.Adjustment"
] | [((293, 325), 'gi.require_version', 'gi.require_version', (['"""Gtk"""', '"""3.0"""'], {}), "('Gtk', '3.0')\n", (311, 325), False, 'import gi\n'), ((11532, 11765), 'gi.repository.Gtk.MessageDialog', 'Gtk.MessageDialog', ([], {'parent': 'self.verificaOrdineDialog', 'flags': 'Gtk.DialogFlags.MODAL', 'type': 'Gtk.MessageT... |
import time
import os
import csv
import torch
import numpy as np
import torch.nn as nn
from torch.optim.optimizer import Optimizer, required
import argparse
import time
class ProxSG(Optimizer):
def __init__(self, params, lr=required, lmbda=required, momentum=required):
if lr is not required a... | [
"torch.norm",
"torch.sum",
"torch.zeros",
"torch.cat"
] | [((3662, 3691), 'torch.norm', 'torch.norm', (['hat_x'], {'p': '(2)', 'dim': '(1)'}), '(hat_x, p=2, dim=1)\n', (3672, 3691), False, 'import torch\n'), ((7738, 7752), 'torch.zeros', 'torch.zeros', (['(5)'], {}), '(5)\n', (7749, 7752), False, 'import torch\n'), ((7683, 7697), 'torch.zeros', 'torch.zeros', (['(5)'], {}), '... |
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
def plot_cca(image, objects_cordinates):
fig, ax = plt.subplots(ncols=1, nrows=1, figsize=(12, 12))
ax.imshow(image, cmap=plt.cm.gray)
for each_cordinate in objects_cordinates:
min_row, min_col, max_row, max_col = each_cordinate... | [
"matplotlib.patches.Rectangle",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((126, 174), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'ncols': '(1)', 'nrows': '(1)', 'figsize': '(12, 12)'}), '(ncols=1, nrows=1, figsize=(12, 12))\n', (138, 174), True, 'import matplotlib.pyplot as plt\n'), ((509, 519), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (517, 519), True, 'import matp... |
# iris/train.py
import json
from argparse import Namespace
from typing import Dict, Tuple
import numpy as np
import optuna
import pandas as pd
import torch
import torch.nn as nn
from numpyencoder import NumpyEncoder
from sklearn.preprocessing import LabelEncoder
# from config import config
from config.config import l... | [
"sklearn.preprocessing.LabelEncoder",
"optuna.TrialPruned",
"torch.optim.lr_scheduler.ReduceLROnPlateau",
"torch.nn.CrossEntropyLoss",
"pandas.read_csv",
"iris.eval.evaluate",
"json.dumps",
"torch.sigmoid",
"config.config.logger.info",
"iris.utils.set_seed",
"torch.inference_mode",
"numpy.vsta... | [((6145, 6177), 'iris.utils.set_seed', 'utils.set_seed', ([], {'seed': 'params.seed'}), '(seed=params.seed)\n', (6159, 6177), False, 'from iris import data, eval, models, utils\n'), ((6191, 6225), 'iris.utils.set_device', 'utils.set_device', ([], {'cuda': 'params.cuda'}), '(cuda=params.cuda)\n', (6207, 6225), False, 'f... |
from Rules import Rules
import random
import copy
class Montecarlo:
def __init__(self, n=1000):
self.iterations = n
self.game = Rules()
def gameOver(self):
winner = self.game.get_winner(end=True)
if winner == 1:
print('AI Winner')
elif winner == 0:
... | [
"Rules.Rules",
"random.choice",
"copy.deepcopy"
] | [((150, 157), 'Rules.Rules', 'Rules', ([], {}), '()\n', (155, 157), False, 'from Rules import Rules\n'), ((606, 630), 'copy.deepcopy', 'copy.deepcopy', (['self.game'], {}), '(self.game)\n', (619, 630), False, 'import copy\n'), ((792, 818), 'random.choice', 'random.choice', (['posibleMove'], {}), '(posibleMove)\n', (805... |
import torch
from .AudioModels import *
from .ImageModels import *
from collections import OrderedDict
def DAVEnet_model_loader(audio_path, image_path):
audio_model = Davenet()
image_model = VGG16()
audio_state_dict = torch.load(audio_path, map_location='cpu')
image_state_dict = torch.load(image_path, ... | [
"torch.load",
"collections.OrderedDict"
] | [((231, 273), 'torch.load', 'torch.load', (['audio_path'], {'map_location': '"""cpu"""'}), "(audio_path, map_location='cpu')\n", (241, 273), False, 'import torch\n'), ((297, 339), 'torch.load', 'torch.load', (['image_path'], {'map_location': '"""cpu"""'}), "(image_path, map_location='cpu')\n", (307, 339), False, 'impor... |
import pdb
import logging
from pathlib import Path
import PIL # type: ignore
import click
from typing import Tuple
from guppy import hpy # type: ignore
import numpy as np # type: ignore
import matplotlib.pyplot as plt # type: ignore
import torch
from sklearn.metrics import pairwise_distances # type: ignore
from tqdm i... | [
"logging.basicConfig",
"logging.getLogger",
"click.argument",
"PIL.Image.fromarray",
"numpy.unique",
"pathlib.Path",
"numpy.random.random",
"utils.load_cifar_imgs",
"sklearn.metrics.pairwise_distances",
"utils.slice_image",
"numpy.argsort",
"numpy.random.randint",
"utils.glue_images",
"cli... | [((565, 620), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': 'log_fmt'}), '(level=logging.INFO, format=log_fmt)\n', (584, 620), False, 'import logging\n'), ((630, 681), 'logging.getLogger', 'logging.getLogger', (['"""Image gluing genetic algorithm"""'], {}), "('Image gluing genet... |
import matplotlib.pyplot as plt
from dgl.data.utils import load_graphs
import numpy as np
from sklearn import linear_model
plt.rcParams.update({'font.size': 14})
def design_size(design_file):
g, _ = load_graphs('data/dgl/' + design_file + '.def.dgl')
return g[0].num_nodes(), g[0].num_edges()
def analyze():
... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.rcParams.update",
"numpy.array",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.tight_layout",
"dgl.data.utils.load_graphs",
"sklearn.linear_model.LinearRegression",
"matplotlib.pyplot.show"
] | [((124, 162), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'font.size': 14}"], {}), "({'font.size': 14})\n", (143, 162), True, 'import matplotlib.pyplot as plt\n'), ((205, 256), 'dgl.data.utils.load_graphs', 'load_graphs', (["('data/dgl/' + design_file + '.def.dgl')"], {}), "('data/dgl/' + design_fil... |
from markdown import markdown
from IPython.display import HTML
import dateutil
from datetime import datetime, timedelta
from namedlist import namedlist
from .utils import parse_markdown
from .tags import tag_reader
from .srs import SRS
class CardQuiz:
def __init__(self, card_id, record):
"""
:pa... | [
"dateutil.parser.parse",
"namedlist.namedlist",
"datetime.datetime.now",
"datetime.timedelta",
"IPython.display.HTML"
] | [((1728, 1830), 'namedlist.namedlist', 'namedlist', (['"""CardNL"""', "['front', 'back', 'keywords', 'tags', 'srs_level', 'next_review']"], {'default': '""""""'}), "('CardNL', ['front', 'back', 'keywords', 'tags', 'srs_level',\n 'next_review'], default='')\n", (1737, 1830), False, 'from namedlist import namedlist\n'... |
import os
import pandas as pd
report_Data = pd.read_excel('E:\\coding\\AutomationWinTest\\qtc_process_auto\\test_report.xlsx')
print(report_Data) | [
"pandas.read_excel"
] | [((45, 132), 'pandas.read_excel', 'pd.read_excel', (['"""E:\\\\coding\\\\AutomationWinTest\\\\qtc_process_auto\\\\test_report.xlsx"""'], {}), "(\n 'E:\\\\coding\\\\AutomationWinTest\\\\qtc_process_auto\\\\test_report.xlsx')\n", (58, 132), True, 'import pandas as pd\n')] |
from itertools import chain
def read_parameter_file(filename):
file_in = open(filename,"r")
input_lines = file_in.readlines()
file_in.close()
input_lines_split = map(lambda i: input_lines[i].replace('=','').replace(';','').split(), range(len(input_lines)))
#remove commented lines
for i in input_lines_split[::-1... | [
"itertools.chain.from_iterable"
] | [((429, 467), 'itertools.chain.from_iterable', 'chain.from_iterable', (['input_lines_split'], {}), '(input_lines_split)\n', (448, 467), False, 'from itertools import chain\n')] |
# mcadmin/util.py
from flask import request, abort
def require_json():
"""
This will raise a 400 HTTP/Bad Request error if the request does not have JSON content.
"""
if not request.is_json:
abort(400, 'Expected JSON')
| [
"flask.abort"
] | [((218, 245), 'flask.abort', 'abort', (['(400)', '"""Expected JSON"""'], {}), "(400, 'Expected JSON')\n", (223, 245), False, 'from flask import request, abort\n')] |
# The MIT License (MIT)
#
# Copyright (c) 2019 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, mod... | [
"time.monotonic"
] | [((3651, 3662), 'time.monotonic', 'monotonic', ([], {}), '()\n', (3660, 3662), False, 'from time import monotonic\n')] |
"""
from logging_factory import get_logger
from logging_config1 import LOGGING
# log = get_logger("redis_lsn",".",cfg)
import toml
#print LOGGING
#print toml.dumps(LOGGING)
print dir(json)
#print json.dumps(LOGGING)
"""
import os
import logging
import logging.handlers
import logging.config
import json
w... | [
"logging.getLogger",
"logging.config.dictConfig",
"json.loads",
"os.sep.join"
] | [((401, 421), 'json.loads', 'json.loads', (['json_str'], {}), '(json_str)\n', (411, 421), False, 'import json\n'), ((567, 609), 'os.sep.join', 'os.sep.join', (["[logroot, app + '_debug.log']"], {}), "([logroot, app + '_debug.log'])\n", (578, 609), False, 'import os\n'), ((659, 700), 'os.sep.join', 'os.sep.join', (["[lo... |
import RPi.GPIO as GPIO
import time
import thread
redled = 17 #Red LED connected to G17
redbtn = 16 # red button connected G16
GPIO.setmode(GPIO.BCM) # function to set up the LEDs
GPIO.setup(redled, GPIO.OUT, initial = GPIO.LOW) #HIGH=1 LOW=0
GPIO.setup(redbtn, GPIO.IN, pull_up_down = GPIO.PUD_DOWN) #HIGH=1 LOW=0
... | [
"RPi.GPIO.add_event_detect",
"RPi.GPIO.setup",
"RPi.GPIO.output",
"time.sleep",
"thread.start_new_thread",
"RPi.GPIO.setmode"
] | [((129, 151), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (141, 151), True, 'import RPi.GPIO as GPIO\n'), ((183, 229), 'RPi.GPIO.setup', 'GPIO.setup', (['redled', 'GPIO.OUT'], {'initial': 'GPIO.LOW'}), '(redled, GPIO.OUT, initial=GPIO.LOW)\n', (193, 229), True, 'import RPi.GPIO as GPIO\n'), ... |
import os.path as osp
import sys
def add_path(path):
if path not in sys.path:
sys.path.insert(0, path)
# path
this_dir = osp.dirname(__file__)
# refer path
refer_dir = osp.join(this_dir, '..', 'data', 'ref')
sys.path.insert(0, refer_dir)
# lib path
sys.path.insert(0, osp.join(this_dir, '..'))
sys.pat... | [
"os.path.dirname",
"sys.path.insert",
"os.path.join"
] | [((138, 159), 'os.path.dirname', 'osp.dirname', (['__file__'], {}), '(__file__)\n', (149, 159), True, 'import os.path as osp\n'), ((186, 225), 'os.path.join', 'osp.join', (['this_dir', '""".."""', '"""data"""', '"""ref"""'], {}), "(this_dir, '..', 'data', 'ref')\n", (194, 225), True, 'import os.path as osp\n'), ((226, ... |
# This file is part of the Open Data Cube, see https://opendatacube.org for more information
#
# Copyright (c) 2015-2020 ODC Contributors
# SPDX-License-Identifier: Apache-2.0
import math
from random import uniform
import numpy as np
import pytest
from affine import Affine
from odc.geo import CRS, geom, resyx_, wh_, ... | [
"odc.geo.roi.scaled_down_roi",
"odc.geo.overlap.LinearPointTransform",
"odc.geo.math.affine_from_pts",
"odc.geo.roi.roi_is_empty",
"odc.geo.xy_",
"odc.geo.CRS",
"affine.Affine",
"odc.geo.gridspec.GridSpec.web_tiles",
"odc.geo.overlap.compute_reproject_roi",
"odc.geo.overlap.compute_axis_overlap",
... | [((2252, 2308), 'odc.geo.testutils.mkA', 'mkA', (['(13)'], {'scale': '(3, 4)', 'shear': '(3)', 'translation': '(100, -3000)'}), '(13, scale=(3, 4), shear=3, translation=(100, -3000))\n', (2255, 2308), False, 'from odc.geo.testutils import AlbersGS, epsg3577, epsg3857, epsg4326, mkA\n'), ((2583, 2592), 'odc.geo.xy_', 'x... |
cores = {"limpa": "\033[m", "cinza_e_azul": "\033[30;46m", "roxo_e_cinza": "\033[35;40m", "azul_e_verde": "\033[34;42m", "vermelho_e_branco": "\033[31;47m"}
def titulo(msg, cor=''):
tamanho = len(msg) + 4
print(cores[f'{cor}'])
print("~" * tamanho)
print(f" {msg} ")
print("~" * tamanho)
print(cores['limpa'])
... | [
"time.sleep"
] | [((373, 383), 'time.sleep', 'sleep', (['(0.2)'], {}), '(0.2)\n', (378, 383), False, 'from time import sleep\n'), ((631, 641), 'time.sleep', 'sleep', (['(0.5)'], {}), '(0.5)\n', (636, 641), False, 'from time import sleep\n')] |
import random
import string
from django.utils.text import slugify
def random_string_generator(size=10, chars=string.ascii_lowercase + string.digits):
return ''.join(random.choice(chars) for _ in range(size))
def generate_slug(title, max=255):
"""
Create a slug from the title
"""
slug = slugify(ti... | [
"django.utils.text.slugify",
"random.choice"
] | [((310, 324), 'django.utils.text.slugify', 'slugify', (['title'], {}), '(title)\n', (317, 324), False, 'from django.utils.text import slugify\n'), ((170, 190), 'random.choice', 'random.choice', (['chars'], {}), '(chars)\n', (183, 190), False, 'import random\n')] |
""" Encoders and decoders specific to tasks that operate over images. """
import torch
import torchvision.transforms as transforms
from coders.coder import Encoder, Decoder
import util.util
class ConcatenationEncoder(Encoder):
"""
Concatenates `k` images into a single image. This class is currently only
... | [
"torchvision.transforms.Resize",
"torch.zeros"
] | [((2872, 2932), 'torchvision.transforms.Resize', 'transforms.Resize', (['(self.resized_height, self.resized_width)'], {}), '((self.resized_height, self.resized_width))\n', (2889, 2932), True, 'import torchvision.transforms as transforms\n'), ((1834, 1903), 'torch.zeros', 'torch.zeros', (['batch_size', '(1)', 'self.orig... |
from model.exam import ExamData
from dbjudge.connection_manager.manager import Manager
from dbjudge import squema_recollector, exceptions
from PyQt5.QtCore import pyqtSlot, QItemSelectionModel
class Exam_controller():
def __init__(self, selection_view, exam_view, results_view):
self.selection_view = sele... | [
"model.exam.ExamData"
] | [((428, 438), 'model.exam.ExamData', 'ExamData', ([], {}), '()\n', (436, 438), False, 'from model.exam import ExamData\n')] |
import numpy as np
import pandas as pd
from pylab import *
import pickle
import tensorflow as tf
import random
import os
from sklearn.model_selection import train_test_split
import matplotlib.lines as mlines
from random import randint
from sklearn import preprocessing
from sklearn.model_selection import KFol... | [
"tensorflow.keras.losses.MSE",
"pandas.read_csv",
"numpy.array",
"tensorflow.compat.v1.keras.initializers.glorot_normal",
"sklearn.model_selection.KFold",
"os.path.exists",
"numpy.mean",
"tensorflow.placeholder",
"itertools.product",
"tensorflow.Session",
"tensorflow.nn.sigmoid",
"tensorflow.m... | [((1498, 1512), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (1509, 1512), False, 'import pickle\n'), ((2169, 2219), 'sklearn.model_selection.KFold', 'KFold', ([], {'n_splits': 'k', 'random_state': 'seed', 'shuffle': '(True)'}), '(n_splits=k, random_state=seed, shuffle=True)\n', (2174, 2219), False, 'from sklear... |
#!/usr/bin/env python
# Copyright 2015-2020 Yelp Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | [
"mock.patch",
"mock.Mock",
"json.dumps",
"bravado.exception.HTTPError",
"tests.cli.test_cmds_status.Struct",
"paasta_tools.cli.cmds.list_deploy_queue.list_deploy_queue",
"pytest.fixture",
"bravado.requests_client.RequestsResponseAdapter"
] | [((859, 887), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (873, 887), False, 'import pytest\n'), ((1071, 1099), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (1085, 1099), False, 'import pytest\n'), ((1649, 1660), 'mock.Mock', 'mock.Mock', ... |
#!/usr/bin/python
## Heavily inspired by /usr/share/bcc/tools/tcptop
import sys
import time
import datetime
from bcc import BPF
from socket import inet_ntop, AF_INET, AF_INET6
from struct import pack
prog="""
#include <linux/types.h>
#include <uapi/linux/ptrace.h>
#include <uapi/linux/bpf_perf_event.h>
#include <l... | [
"datetime.datetime.now",
"bcc.BPF",
"struct.pack",
"time.sleep"
] | [((1396, 1410), 'bcc.BPF', 'BPF', ([], {'text': 'prog'}), '(text=prog)\n', (1399, 1410), False, 'from bcc import BPF\n'), ((1782, 1795), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1792, 1795), False, 'import time\n'), ((1823, 1846), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (1844, 18... |
import datetime
import eml_parser
from bs4 import BeautifulSoup
def eml_to_html():
"""
Grabs .eml file (hard coded name from BASH script) and pulls the HTML body
:return: HTML string
"""
print('pulling html from email')
with open('email_loc/nyrr_email.eml', 'rb') as fhdl:
raw_email = f... | [
"bs4.BeautifulSoup",
"eml_parser.eml_parser.decode_email_b"
] | [((349, 419), 'eml_parser.eml_parser.decode_email_b', 'eml_parser.eml_parser.decode_email_b', (['raw_email'], {'include_raw_body': '(True)'}), '(raw_email, include_raw_body=True)\n', (385, 419), False, 'import eml_parser\n'), ((1131, 1165), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""html.parser"""'], {}), "(ht... |
from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HUnitR04c_CompleteLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HUnitR04c_CompleteLHS
"""
# Flag this instance as compiled now
self.is_compiled = True
sup... | [
"uuid.uuid3"
] | [((635, 690), 'uuid.uuid3', 'uuid.uuid3', (['uuid.NAMESPACE_DNS', '"""HUnitR04c_CompleteLHS"""'], {}), "(uuid.NAMESPACE_DNS, 'HUnitR04c_CompleteLHS')\n", (645, 690), False, 'import uuid\n'), ((951, 990), 'uuid.uuid3', 'uuid.uuid3', (['uuid.NAMESPACE_DNS', '"""State"""'], {}), "(uuid.NAMESPACE_DNS, 'State')\n", (961, 99... |
# (C) Copyright 2005-2021 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at... | [
"traits.trait_converters.check_trait",
"traits.trait_factory._trait_factory_instances.copy",
"traits.trait_converters.trait_cast",
"traits.trait_converters.as_ctrait",
"traits.api.Int",
"traits.trait_converters.trait_from",
"traits.trait_converters.trait_for"
] | [((852, 897), 'traits.trait_factory._trait_factory_instances.copy', 'trait_factory._trait_factory_instances.copy', ([], {}), '()\n', (895, 897), False, 'from traits import trait_factory\n'), ((1121, 1135), 'traits.trait_converters.trait_cast', 'trait_cast', (['ct'], {}), '(ct)\n', (1131, 1135), False, 'from traits.trai... |
from __future__ import division, print_function, absolute_import
import os
import numpy as np
from dipy.direction.peaks import (PeaksAndMetrics,
reshape_peaks_for_visualization)
from dipy.core.sphere import Sphere
from dipy.io.image import save_nifti
import h5py
def _safe_save(grou... | [
"dipy.core.sphere.Sphere",
"os.path.splitext",
"dipy.io.image.save_nifti",
"h5py.File",
"numpy.array",
"dipy.direction.peaks.PeaksAndMetrics",
"dipy.direction.peaks.reshape_peaks_for_visualization"
] | [((1105, 1126), 'h5py.File', 'h5py.File', (['fname', '"""r"""'], {}), "(fname, 'r')\n", (1114, 1126), False, 'import h5py\n'), ((1138, 1155), 'dipy.direction.peaks.PeaksAndMetrics', 'PeaksAndMetrics', ([], {}), '()\n', (1153, 1155), False, 'from dipy.direction.peaks import PeaksAndMetrics, reshape_peaks_for_visualizati... |
from django.contrib import admin
from . import models
# Register your models here.
@admin.register(models.PHR)
class AuthorAdmin(admin.ModelAdmin):
list_display = ('first_name', 'last_name') | [
"django.contrib.admin.register"
] | [((85, 111), 'django.contrib.admin.register', 'admin.register', (['models.PHR'], {}), '(models.PHR)\n', (99, 111), False, 'from django.contrib import admin\n')] |
#!/usr/bin/python3
import sys
import pymongo
import sys
from collections import defaultdict
from ujson import dumps
from flask import Flask
from flask import request
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
db = pymongo.MongoClient().concert_viz
@app.route("/")
def index():
return("API server is... | [
"flask_cors.CORS",
"flask.Flask",
"ujson.dumps",
"collections.defaultdict",
"pymongo.MongoClient"
] | [((202, 217), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (207, 217), False, 'from flask import Flask\n'), ((218, 227), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (222, 227), False, 'from flask_cors import CORS\n'), ((233, 254), 'pymongo.MongoClient', 'pymongo.MongoClient', ([], {}), '()\n', (... |
import dico
client = dico.Client("YOUR_BOT_TOKEN")
client.on_ready = lambda ready: print(f"Bot ready, with {len(ready.guilds)} guilds.")
@client.on_message_create
async def on_message_create(message: dico.Message):
if message.content.startswith("!button"):
button = dico.Button(style=dico.ButtonStyles.PR... | [
"dico.Client",
"dico.ActionRow",
"dico.Button",
"dico.InteractionApplicationCommandCallbackData"
] | [((22, 51), 'dico.Client', 'dico.Client', (['"""YOUR_BOT_TOKEN"""'], {}), "('YOUR_BOT_TOKEN')\n", (33, 51), False, 'import dico\n'), ((282, 361), 'dico.Button', 'dico.Button', ([], {'style': 'dico.ButtonStyles.PRIMARY', 'label': '"""Hello!"""', 'custom_id': '"""hello"""'}), "(style=dico.ButtonStyles.PRIMARY, label='Hel... |
# Copyright 2019 Indiana Biosciences Research Institute (IBRI)
#
# 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 applica... | [
"pika.ConnectionParameters"
] | [((659, 702), 'pika.ConnectionParameters', 'pika.ConnectionParameters', ([], {'host': '"""localhost"""'}), "(host='localhost')\n", (684, 702), False, 'import pika\n')] |
from dataload.dataloader import ListDataset
from config.config import load_config, cfg
from net.unet import UNet
from loss.L1L2loss import Regularization
import numpy as np
import torch
import torch.nn as nn
from torch import optim
import cv2
if __name__ == '__main__':
"""config"""
load_config(cfg, "./config/c... | [
"config.config.load_config",
"net.unet.UNet",
"torch.load",
"cv2.imshow",
"torch.softmax",
"torch.tensor",
"cv2.UMat",
"dataload.dataloader.ListDataset",
"torch.utils.data.DataLoader",
"torch.no_grad",
"cv2.waitKey",
"torch.device"
] | [((292, 332), 'config.config.load_config', 'load_config', (['cfg', '"""./config/config.yaml"""'], {}), "(cfg, './config/config.yaml')\n", (303, 332), False, 'from config.config import load_config, cfg\n'), ((361, 383), 'torch.device', 'torch.device', (['"""cuda:0"""'], {}), "('cuda:0')\n", (373, 383), False, 'import to... |
#
# littletable_demo.py
#
# Copyright 2010, <NAME>
#
from __future__ import print_function
from littletable import Table
from collections import namedtuple
import sys
Customer = namedtuple("Customer", "id name")
CatalogItem = namedtuple("CatalogItem", "sku descr unitofmeas unitprice")
customers = Table("customers")
... | [
"collections.namedtuple",
"littletable.Table.gt",
"littletable.Table"
] | [((180, 213), 'collections.namedtuple', 'namedtuple', (['"""Customer"""', '"""id name"""'], {}), "('Customer', 'id name')\n", (190, 213), False, 'from collections import namedtuple\n'), ((228, 287), 'collections.namedtuple', 'namedtuple', (['"""CatalogItem"""', '"""sku descr unitofmeas unitprice"""'], {}), "('CatalogIt... |
from contextlib import closing
from pathlib import Path
import pytest
from asyncio_extras import open_async
@pytest.fixture(scope='module')
def testdata():
return b''.join(bytes([i] * 1000) for i in range(10))
@pytest.fixture
def testdatafile(tmpdir_factory, testdata):
file = tmpdir_factory.mktemp('file')... | [
"pytest.fixture",
"asyncio_extras.open_async"
] | [((113, 143), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (127, 143), False, 'import pytest\n'), ((1481, 1511), 'asyncio_extras.open_async', 'open_async', (['testdatafile', '"""rb"""'], {}), "(testdatafile, 'rb')\n", (1491, 1511), False, 'from asyncio_extras import open_as... |
# coding=utf-8
# Copyright 2018 Google LLC & <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 o... | [
"compare_gan.architectures.arch_ops.lrelu",
"tensorflow.reshape",
"compare_gan.architectures.arch_ops.deconv2d",
"compare_gan.architectures.arch_ops.batch_norm",
"tensorflow.nn.sigmoid",
"compare_gan.architectures.arch_ops.conv2d",
"compare_gan.architectures.arch_ops.linear"
] | [((1808, 1838), 'compare_gan.architectures.arch_ops.linear', 'linear', (['z', '(1024)'], {'scope': '"""g_fc1"""'}), "(z, 1024, scope='g_fc1')\n", (1814, 1838), False, 'from compare_gan.architectures.arch_ops import linear\n'), ((1921, 1974), 'compare_gan.architectures.arch_ops.linear', 'linear', (['net', '(128 * (h // ... |
# unit tests for Mini-project 6 (Tic-Tac-Toe), by k., 07/25/2014
import unittest
from mini_project6 import TTTBoard
from mini_project6 import mm_move
from mini_project6 import DRAW, EMPTY, PLAYERO, PLAYERX
class TestFunction(unittest.TestCase):
def setUp(self):
pass
def test_move_it(self):
bo... | [
"unittest.main",
"mini_project6.TTTBoard",
"mini_project6.mm_move"
] | [((2465, 2490), 'unittest.main', 'unittest.main', ([], {'exit': '(False)'}), '(exit=False)\n', (2478, 2490), False, 'import unittest\n'), ((326, 438), 'mini_project6.TTTBoard', 'TTTBoard', (['(3)', '(False)', '[[PLAYERO, PLAYERX, PLAYERX], [PLAYERO, PLAYERX, PLAYERO], [PLAYERX,\n PLAYERO, PLAYERX]]'], {}), '(3, Fals... |
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from speedmeter import SpeedMeter
from kivy.uix.floatlayout import FloatLayout
from kivy.clock import Clock
from kivy.animation import Animation
from kivy.properties import NumericProperty
import sys
if sys.platform.startswith('linux'):
import RP... | [
"RPi.GPIO.cleanup",
"kivy.properties.NumericProperty",
"kivy.animation.Animation",
"RPi.GPIO.setup",
"RPi.GPIO.output",
"sys.platform.startswith",
"RPi.GPIO.PWM",
"kivy.clock.Clock.schedule_interval",
"RPi.GPIO.setmode"
] | [((273, 305), 'sys.platform.startswith', 'sys.platform.startswith', (['"""linux"""'], {}), "('linux')\n", (296, 305), False, 'import sys\n'), ((4434, 4454), 'kivy.properties.NumericProperty', 'NumericProperty', (['(360)'], {}), '(360)\n', (4449, 4454), False, 'from kivy.properties import NumericProperty\n'), ((4471, 44... |
''' Strategies are balancing exploitation and exploration. '''
import math
class BaseStrategy():
def __init__(self, start, end, decay):
# Basic input validation
if (start < 0) | (end < 0) | (decay < 0) :
raise ValueError("Only positive arguments accepted")
elif start < end:
... | [
"math.exp"
] | [((664, 711), 'math.exp', 'math.exp', (['(-1.0 * self.current_step * self.decay)'], {}), '(-1.0 * self.current_step * self.decay)\n', (672, 711), False, 'import math\n')] |
import config
import math
import world as w
import matplotlib#type: ignore
import matplotlib.pyplot as plt#type: ignore
from typing import List
import random
repetitions: int = 10_000
config.CAMERA_RESOLUTION = 10
config.CAMERA_SIZE = 10
config.WORLD_SIZE = config.CAMERA_SIZE * config.CAMERA_RESOLUTION+config.CAMERA_R... | [
"random.choice",
"world.World",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((1533, 1547), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (1545, 1547), True, 'import matplotlib.pyplot as plt\n'), ((1607, 1641), 'matplotlib.pyplot.xticks', 'matplotlib.pyplot.xticks', (['k_values'], {}), '(k_values)\n', (1631, 1641), False, 'import matplotlib\n'), ((1764, 1774), 'matplotlib.pyp... |
import sentry_sdk
import uvicorn
from fastapi import FastAPI
from sentry_sdk.integrations.asgi import SentryAsgiMiddleware
from starlette.config import Config
from src import sts_router
###
# Configuration setup
###
config = Config(".env.local")
# This enables stacktraces to show in the UI when hitting errors
DEBUG ... | [
"starlette.config.Config",
"fastapi.FastAPI",
"uvicorn.run",
"sentry_sdk.integrations.asgi.SentryAsgiMiddleware",
"sentry_sdk.init"
] | [((228, 248), 'starlette.config.Config', 'Config', (['""".env.local"""'], {}), "('.env.local')\n", (234, 248), False, 'from starlette.config import Config\n'), ((500, 671), 'fastapi.FastAPI', 'FastAPI', ([], {'debug': 'DEBUG', 'title': '"""OpenShift STS Generation"""', 'description': '"""Static JSON generator for OpenS... |
from django.shortcuts import render
from django.core import serializers
from django.http import HttpResponse
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.conf import settings
import json
impo... | [
"json.dumps",
"registrar.models.Course.objects.get",
"registrar.models.Assignment.objects.filter",
"registrar.models.CourseSubmission.objects.create",
"registrar.models.Lecture.objects.filter",
"registrar.models.Policy.objects.get",
"django.contrib.auth.decorators.login_required",
"registrar.models.Co... | [((719, 756), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'login_url': '"""/landpage"""'}), "(login_url='/landpage')\n", (733, 756), False, 'from django.contrib.auth.decorators import login_required\n'), ((3036, 3073), 'django.contrib.auth.decorators.login_required', 'login_required', ([], ... |
import json
import os
from typing import List, Tuple, Callable, Any
import numpy as np
from piepline.data_producer import BasicDataset, DataProducer
from pietoolbelt.pipeline.abstract_step import AbstractStepDirResult
from pietoolbelt.pipeline.predict.common import AbstractPredictResult
class ThresholdsSearchResult... | [
"numpy.where",
"os.path.join",
"numpy.concatenate",
"piepline.data_producer.DataProducer",
"json.dump"
] | [((442, 478), 'os.path.join', 'os.path.join', (['path', '"""threshold.json"""'], {}), "(path, 'threshold.json')\n", (454, 478), False, 'import os\n'), ((886, 934), 'json.dump', 'json.dump', (['self._thresholds', 'meta_file'], {'indent': '(4)'}), '(self._thresholds, meta_file, indent=4)\n', (895, 934), False, 'import js... |
import unittest
import pinq
class queryable_select_many_tests(unittest.TestCase):
def setUp(self):
self.queryable1 = pinq.as_queryable([[1, 2, 3], [2, 8, 10], [4, 5, 3]])
self.queryable2 = pinq.as_queryable([{"a": [1, 3, 4], "list": [0, 9, 9]}, {
"list": [5, 2, 4]}, {"Fun": "apple", "... | [
"pinq.as_queryable"
] | [((132, 185), 'pinq.as_queryable', 'pinq.as_queryable', (['[[1, 2, 3], [2, 8, 10], [4, 5, 3]]'], {}), '([[1, 2, 3], [2, 8, 10], [4, 5, 3]])\n', (149, 185), False, 'import pinq\n'), ((212, 330), 'pinq.as_queryable', 'pinq.as_queryable', (["[{'a': [1, 3, 4], 'list': [0, 9, 9]}, {'list': [5, 2, 4]}, {'Fun': 'apple',\n ... |
'''Custom metrics for assessing and training performance of obsidian protein classifier
'''
import keras.backend as K
from theano.tensor import basic as T
from theano.tensor import nnet, clip
def precision(y_true, y_pred):
'''Returns batch-wise average of precision.
Precision is a metric of how many selected item... | [
"keras.backend.epsilon",
"keras.backend.clip",
"theano.tensor.nnet.sigmoid",
"theano.tensor.basic.log"
] | [((567, 596), 'keras.backend.clip', 'K.clip', (['(y_true * y_pred)', '(0)', '(1)'], {}), '(y_true * y_pred, 0, 1)\n', (573, 596), True, 'import keras.backend as K\n'), ((637, 657), 'keras.backend.clip', 'K.clip', (['y_pred', '(0)', '(1)'], {}), '(y_pred, 0, 1)\n', (643, 657), True, 'import keras.backend as K\n'), ((714... |
import copy
from src.models.schema_reader import SchemaReader
from src.utils.exceptions import PopulatorException
from src.utils.dict import dictdeepget, dictdeepset
class BaseModel:
item_type = None
# specify `computed_properties` for normalizer to strip off these fields so that they don't get stored in db
c... | [
"src.models.schema_reader.SchemaReader.parse_schema_string",
"src.models.schema_reader.SchemaReader.is_plural_relational_field",
"src.models.schema_reader.SchemaReader.get_schema",
"src.models.schema_reader.SchemaReader.is_nested_field",
"src.models.schema_reader.SchemaReader.is_singular_relational_field"
] | [((1867, 1906), 'src.models.schema_reader.SchemaReader.get_schema', 'SchemaReader.get_schema', (['self.item_type'], {}), '(self.item_type)\n', (1890, 1906), False, 'from src.models.schema_reader import SchemaReader\n'), ((2162, 2217), 'src.models.schema_reader.SchemaReader.is_singular_relational_field', 'SchemaReader.i... |
# must specify UTF-8 encoding due to the non-ASCII characters in the ArduinoJSON description
# encoding: utf-8
# for making custom command line arguments work in conjunction with the unittest module
import sys
# for unit testing
import unittest
# add the parent folder to the module search path
# https://stackoverflow.... | [
"os.path.exists",
"os.listdir",
"os.path.join",
"os.path.isfile",
"os.path.dirname",
"unittest.main",
"unittest.skip"
] | [((356, 381), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (371, 381), False, 'import os\n'), ((19033, 19143), 'unittest.skip', 'unittest.skip', (['"""arduino-ci-script development branch must be merged to master before this will pass"""'], {}), "(\n 'arduino-ci-script development branch... |
# coding: utf-8
# commands/orm.py
import uuid
from sqlalchemy import Column, ForeignKey, Integer, MetaData, String, Table
from sqlalchemy.orm import mapper, relationship
import model
metadata = MetaData()
line = Table(
"line",
metadata,
Column("id", Integer, primary_key=True, autoincrement=True),
... | [
"sqlalchemy.orm.relationship",
"sqlalchemy.ForeignKey",
"uuid.uuid4",
"sqlalchemy.MetaData",
"sqlalchemy.String",
"sqlalchemy.Column"
] | [((199, 209), 'sqlalchemy.MetaData', 'MetaData', ([], {}), '()\n', (207, 209), False, 'from sqlalchemy import Column, ForeignKey, Integer, MetaData, String, Table\n'), ((255, 314), 'sqlalchemy.Column', 'Column', (['"""id"""', 'Integer'], {'primary_key': '(True)', 'autoincrement': '(True)'}), "('id', Integer, primary_ke... |
from datetime import timedelta, datetime
def to_discord_timestamp(delta: timedelta):
return f"<t:{int((datetime.now() + delta).timestamp())}>"
| [
"datetime.datetime.now"
] | [((109, 123), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (121, 123), False, 'from datetime import timedelta, datetime\n')] |
import os
import os.path as osp
import json
import pydicom
import imageio
import argparse
import numpy as np
from glob import glob
from tqdm import tqdm
from sklearn.metrics import cohen_kappa_score
import sys
sys.path.append("..")
from GLD.utils import AverageMeter, cal_dice, Logger
from data_processing import calc_i... | [
"numpy.abs",
"imageio.imread",
"pydicom.dcmread",
"argparse.ArgumentParser",
"numpy.arange",
"GLD.utils.cal_dice",
"os.path.join",
"numpy.argmax",
"GLD.utils.AverageMeter",
"numpy.array",
"json.load",
"numpy.meshgrid",
"sys.path.append",
"glob.glob"
] | [((211, 232), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (226, 232), False, 'import sys\n'), ((423, 460), 'pydicom.dcmread', 'pydicom.dcmread', (['dcm_name'], {'force': '(True)'}), '(dcm_name, force=True)\n', (438, 460), False, 'import pydicom\n'), ((1262, 1302), 'numpy.meshgrid', 'np.meshgri... |
import falcon
import pytest
from falcon import testing
from poseidon_api.api import api
@pytest.fixture
def client():
return testing.TestClient(api)
def test_v1(client):
response = client.simulate_get('/v1')
assert response.status == falcon.HTTP_OK
def test_network(client):
response = client.simul... | [
"falcon.testing.TestClient"
] | [((131, 154), 'falcon.testing.TestClient', 'testing.TestClient', (['api'], {}), '(api)\n', (149, 154), False, 'from falcon import testing\n')] |
from django.db import models
class IotView(models.Model):
name = models.CharField(max_length=255)
description = models.CharField(max_length=255)
view_type = models.CharField(max_length=255)
node0_path = models.CharField(max_length=1024)
node1_path = models.CharField(max_length=1024, default='', bla... | [
"django.db.models.CharField"
] | [((70, 102), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (86, 102), False, 'from django.db import models\n'), ((121, 153), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (137, 153), False, 'from django.db ... |
import setuptools
def readme():
with open('README.md') as f:
return f.read()
setuptools.setup(name='imagee',
version='1.1',
description='Tool for image optimization',
long_description=readme(),
long_description_content_type='text/markdown',
classifiers=[
'Developmen... | [
"setuptools.find_packages"
] | [((729, 766), 'setuptools.find_packages', 'setuptools.find_packages', ([], {'where': '"""src"""'}), "(where='src')\n", (753, 766), False, 'import setuptools\n')] |
Name = 'ReshapeTable'
Label = 'Reshape Table'
FilterCategory = 'CSM Geophysics Filters'
Help = 'This filter will take a vtkTable object and reshape it. This filter essentially treats vtkTables as 2D matrices and reshapes them using numpy.reshape in a C contiguous manner. Unfortunately, data fields will be renamed arbit... | [
"numpy.reshape",
"numpy.array",
"numpy.empty",
"vtk.util.numpy_support.numpy_to_vtk",
"vtk.util.numpy_support.vtk_to_numpy"
] | [((965, 987), 'numpy.empty', 'np.empty', (['(cols, rows)'], {}), '((cols, rows))\n', (973, 987), True, 'import numpy as np\n'), ((1513, 1558), 'numpy.reshape', 'np.reshape', (['data', '(nrows, ncols)'], {'order': 'order'}), '(data, (nrows, ncols), order=order)\n', (1523, 1558), True, 'import numpy as np\n'), ((1060, 10... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# import python libs
import re
import json
import csv
import argparse
import json
import collections
import copy
from os import listdir
from os.path import isfile, join
from pprint import pprint as pp
from operator import itemgetter
# import project libs
from constants... | [
"os.listdir",
"csv.writer",
"os.path.join",
"os.path.isfile",
"json.JSONDecoder",
"json.dump"
] | [((5007, 5040), 'csv.writer', 'csv.writer', (['myfile'], {'delimiter': '""";"""'}), "(myfile, delimiter=';')\n", (5017, 5040), False, 'import csv\n'), ((794, 807), 'os.listdir', 'listdir', (['path'], {}), '(path)\n', (801, 807), False, 'from os import listdir\n'), ((830, 851), 'os.path.join', 'join', (['path', 'file_na... |
"""Pull gSSURGO data based on mukeys."""
# https://gdal.org/python/
# https://gis.stackexchange.com/a/200477/32531
import os
import sys
import sqlite3
import gdal
import pandas as pd
import numpy as np
from pyproj import Proj, transform
from .aoi import state_by_bbox
def query_gpkg(src_tif, gpkg_path, sql_query, ou... | [
"pandas.read_sql_query",
"gdal.Open",
"numpy.reshape",
"pandas.merge",
"pyproj.transform",
"os.path.isfile",
"pyproj.Proj",
"pandas.DataFrame"
] | [((1019, 1037), 'gdal.Open', 'gdal.Open', (['src_tif'], {}), '(src_tif)\n', (1028, 1037), False, 'import gdal\n'), ((1381, 1403), 'pyproj.Proj', 'Proj', ([], {'init': '"""epsg:4326"""'}), "(init='epsg:4326')\n", (1385, 1403), False, 'from pyproj import Proj, transform\n'), ((1417, 1595), 'pyproj.Proj', 'Proj', (['"""+p... |
from trame.app import get_server, jupyter
from trame_mnist.app import engine, ui
def show(server=None, **kwargs):
"""Run and display the trame application in jupyter's event loop
The kwargs are forwarded to IPython.display.IFrame()
"""
if server is None:
server = get_server()
if isinstanc... | [
"logging.getLogger",
"trame_mnist.app.engine.initialize",
"trame.app.jupyter.show",
"trame.app.get_server",
"trame_mnist.app.ui.initialize"
] | [((435, 478), 'logging.getLogger', 'logging.getLogger', (['"""trame_mnist.app.engine"""'], {}), "('trame_mnist.app.engine')\n", (452, 478), False, 'import logging\n'), ((548, 573), 'trame_mnist.app.engine.initialize', 'engine.initialize', (['server'], {}), '(server)\n', (565, 573), False, 'from trame_mnist.app import e... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Copyright [2020] [Indian Institute of Science, Bangalore]
SPDX-License-Identifier: Apache-2.0
"""
import pandas as pd
import numpy as np
import geopandas as gpd
from shapely.geometry import Point, MultiPolygon
def seedIndividuals(city):
cityDF = gpd.read_file(".... | [
"geopandas.read_file",
"pandas.read_csv",
"numpy.logical_and",
"numpy.where",
"numpy.arange",
"shapely.geometry.Point",
"numpy.array",
"numpy.full",
"pandas.read_json",
"shapely.geometry.MultiPolygon"
] | [((304, 358), 'geopandas.read_file', 'gpd.read_file', (["('./data/base/' + city + '/city.geojson')"], {}), "('./data/base/' + city + '/city.geojson')\n", (317, 358), True, 'import geopandas as gpd\n'), ((378, 447), 'pandas.read_json', 'pd.read_json', (["('./data/' + city + '-100K-300students/individuals.json')"], {}), ... |
#!/usr/bin/env python3
#
# This file is part of usb-protocol.
#
""" Examples for using the simple descriptor data structures. """
from usb_protocol.types.descriptors import StringDescriptor
from usb_protocol.emitters.descriptors import DeviceDescriptorEmitter
string_descriptor = bytes([
40, # Length
... | [
"usb_protocol.emitters.descriptors.DeviceDescriptorEmitter",
"usb_protocol.types.descriptors.StringDescriptor.parse"
] | [((928, 969), 'usb_protocol.types.descriptors.StringDescriptor.parse', 'StringDescriptor.parse', (['string_descriptor'], {}), '(string_descriptor)\n', (950, 969), False, 'from usb_protocol.types.descriptors import StringDescriptor\n'), ((1125, 1150), 'usb_protocol.emitters.descriptors.DeviceDescriptorEmitter', 'DeviceD... |
import pyredner
import torch
pyredner.set_use_gpu(torch.cuda.is_available())
position = torch.tensor([1.0, 0.0, -3.0])
look_at = torch.tensor([1.0, 0.0, 0.0])
up = torch.tensor([0.0, 1.0, 0.0])
fov = torch.tensor([45.0])
clip_near = 1e-2
# randomly generate distortion parameters
torch.manual_seed(1234)
target_distor... | [
"torch.manual_seed",
"torch.optim.Adam",
"pyredner.get_use_gpu",
"pyredner.Camera",
"pyredner.render_albedo",
"pyredner.Material",
"pyredner.get_device",
"torch.tensor",
"pyredner.Scene",
"torch.cuda.is_available",
"subprocess.call",
"torch.zeros",
"torch.rand",
"pyredner.imread"
] | [((90, 120), 'torch.tensor', 'torch.tensor', (['[1.0, 0.0, -3.0]'], {}), '([1.0, 0.0, -3.0])\n', (102, 120), False, 'import torch\n'), ((131, 160), 'torch.tensor', 'torch.tensor', (['[1.0, 0.0, 0.0]'], {}), '([1.0, 0.0, 0.0])\n', (143, 160), False, 'import torch\n'), ((166, 195), 'torch.tensor', 'torch.tensor', (['[0.0... |
# Internal
import os
import subprocess
from sys import exit
from tkinter import *
from tkinter import filedialog
from tkinter import messagebox
import tkinter.ttk as ttk
import webbrowser
# User lib
from osu_extractor.GetData import getSubFolder, getAllItemsInFolder, getFolderName, extractFiles, createPathIfNotExist, ... | [
"tkinter.filedialog.askdirectory",
"webbrowser.open_new",
"osu_extractor.GetData.getSubFolder",
"os.startfile",
"sys.exit",
"osu_extractor.Public.jsonHandler.writeSetting",
"tkinter.ttk.Treeview",
"tkinter.messagebox.showwarning",
"tkinter.ttk.Entry",
"subprocess.Popen",
"osu_extractor.Public.js... | [((460, 486), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (476, 486), False, 'import os\n'), ((512, 536), 'webbrowser.open_new', 'webbrowser.open_new', (['url'], {}), '(url)\n', (531, 536), False, 'import webbrowser\n'), ((703, 733), 'osu_extractor.GetData.createPathIfNotExist', 'createP... |
# -*- coding: utf-8 -*-
"""
Created on Mon May 14 16:50:33 2018
@author: ADay
"""
import os
import pandas as pd
import numpy as np
import requests
import time
import json
def get_earliest_date(item):
"""
Given a crossref works record, find the earliest date.
"""
tags = ['issued','created','indexed',... | [
"os.listdir",
"os.path.join",
"time.sleep",
"requests.get",
"pandas.DataFrame",
"pandas.concat",
"pandas.to_datetime"
] | [((3585, 3639), 'requests.get', 'requests.get', (['address'], {'params': 'payload', 'headers': 'headers'}), '(address, params=payload, headers=headers)\n', (3597, 3639), False, 'import requests\n'), ((5135, 5154), 'os.listdir', 'os.listdir', (['"""input"""'], {}), "('input')\n", (5145, 5154), False, 'import os\n'), ((5... |
import unittest
from autumn_ca.cellular_automata.simulation import Simulation
def mock_rule ( array_in, array_out ):
array_out *= 0
array_out += array_in
array_out += 1
class SimulationTestCase ( unittest.TestCase ):
def test_buffer_swapping_pointers(self) :
... | [
"autumn_ca.cellular_automata.simulation.Simulation"
] | [((341, 372), 'autumn_ca.cellular_automata.simulation.Simulation', 'Simulation', (['(10, 10)', 'mock_rule'], {}), '((10, 10), mock_rule)\n', (351, 372), False, 'from autumn_ca.cellular_automata.simulation import Simulation\n'), ((893, 924), 'autumn_ca.cellular_automata.simulation.Simulation', 'Simulation', (['(10, 10)'... |
from pathlib import Path
import pytest
from ics import Calendar, Event
from pythoncz.models.events import (preprocess_ical, find_first_url,
set_url_from_description)
def test_preprocess_ical():
path = Path(__file__).parent / 'invalid_ical.ics'
lines = preprocess_ical(path... | [
"pythoncz.models.events.find_first_url",
"pathlib.Path",
"ics.Event",
"ics.Calendar",
"pytest.mark.parametrize",
"pythoncz.models.events.set_url_from_description"
] | [((697, 1051), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""text,expected"""', "[(None, None), ('', None), ('lorem ipsum dolor sit amet', None), (\n 'https://python.cz', 'https://python.cz'), ('http://python.cz',\n 'http://python.cz'), ('lorem ipsum https://python.cz dolor sit amet',\n 'https://... |
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver=webdriver.Chrome(r'C:\Users\<NAME>\Downloads\chromedriver_win32\chromedriver.exe')
time.sleep(2)
driver.maximize_window()
# driver.get('http://projectredmind.herokuapp.com')
driver.get('http://127.0.0.1:8000')
... | [
"selenium.webdriver.Chrome",
"time.sleep"
] | [((103, 194), 'selenium.webdriver.Chrome', 'webdriver.Chrome', (['"""C:\\\\Users\\\\<NAME>\\\\Downloads\\\\chromedriver_win32\\\\chromedriver.exe"""'], {}), "(\n 'C:\\\\Users\\\\<NAME>\\\\Downloads\\\\chromedriver_win32\\\\chromedriver.exe')\n", (119, 194), False, 'from selenium import webdriver\n'), ((187, 200), 't... |
import sqlite3
def dict_factory(cursor, row):
d = {}
for idx, col in enumerate(cursor.description):
d[col[0]] = row[idx]
return d
def nameNormalize(name):
name = name.split()
normal_name = []
for name_part in name:
firstC = name_part[0].upper()
normal_name.append(firstC... | [
"sqlite3.connect"
] | [((408, 432), 'sqlite3.connect', 'sqlite3.connect', (['db_name'], {}), '(db_name)\n', (423, 432), False, 'import sqlite3\n'), ((1664, 1688), 'sqlite3.connect', 'sqlite3.connect', (['db_name'], {}), '(db_name)\n', (1679, 1688), False, 'import sqlite3\n'), ((2002, 2026), 'sqlite3.connect', 'sqlite3.connect', (['db_name']... |
import logging
from typing import Optional
log: logging.Logger = logging.getLogger(__name__)
class Object:
"""
Represents a generic Call of Duty object.
Parameters
----------
client : callofduty.Client
Client which manages communication with the Call of Duty API.
"""
_type: Opti... | [
"logging.getLogger"
] | [((66, 93), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (83, 93), False, 'import logging\n')] |
import os
import sys
import click
# noinspection PyUnresolvedReferences
from wrktoolbox import stores, version
from wrktoolbox.benchmarks import BenchmarkSuite
# noinspection PyUnresolvedReferences
from wrktoolbox.goals import *
from wrktoolbox.logs import get_app_logger
from wrktoolbox.commands import get_configuratio... | [
"os.path.exists",
"sys.path.insert",
"wrktoolbox.benchmarks.BenchmarkSuite.from_dict",
"click.option",
"os.path.isdir",
"wrktoolbox.commands.get_configuration",
"click.command",
"wrktoolbox.logs.get_app_logger"
] | [((448, 464), 'wrktoolbox.logs.get_app_logger', 'get_app_logger', ([], {}), '()\n', (462, 464), False, 'from wrktoolbox.logs import get_app_logger\n'), ((2507, 2532), 'click.command', 'click.command', ([], {'name': '"""run"""'}), "(name='run')\n", (2520, 2532), False, 'import click\n'), ((2534, 2683), 'click.option', '... |
import requests
import json
from constants import getConstants
# get constants
constants = getConstants()
def api_request(method, url, header=None, data=None, response_type='json'):
response = requests.request(method, url, headers=header, data=data)
if response_type == 'json':
try:
respons... | [
"json.dumps",
"constants.getConstants",
"requests.request"
] | [((92, 106), 'constants.getConstants', 'getConstants', ([], {}), '()\n', (104, 106), False, 'from constants import getConstants\n'), ((199, 255), 'requests.request', 'requests.request', (['method', 'url'], {'headers': 'header', 'data': 'data'}), '(method, url, headers=header, data=data)\n', (215, 255), False, 'import r... |
import sys
import unittest
import pendulum
from src import (
Crypto,
CryptoCommandService,
)
from minos.networks import (
InMemoryRequest,
Response,
)
from tests.utils import (
build_dependency_injector,
)
class TestCryptoCommandService(unittest.IsolatedAsyncioTestCase):
def setUp(self) -> N... | [
"unittest.main",
"tests.utils.build_dependency_injector",
"pendulum.now",
"src.CryptoCommandService"
] | [((1051, 1066), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1064, 1066), False, 'import unittest\n'), ((349, 376), 'tests.utils.build_dependency_injector', 'build_dependency_injector', ([], {}), '()\n', (374, 376), False, 'from tests.utils import build_dependency_injector\n'), ((617, 639), 'src.CryptoCommandSe... |
import os
import sqlite3
class DbConnection:
####################################################################################################################
# Constructor.
####################################################################################################################
def __i... | [
"os.path.isfile",
"sqlite3.connect"
] | [((2106, 2142), 'sqlite3.connect', 'sqlite3.connect', (['self._database_path'], {}), '(self._database_path)\n', (2121, 2142), False, 'import sqlite3\n'), ((2553, 2588), 'os.path.isfile', 'os.path.isfile', (['self._database_path'], {}), '(self._database_path)\n', (2567, 2588), False, 'import os\n')] |
import six
from waldur_core.core.models import User
from waldur_core.logging.loggers import EventLogger, event_logger
class FreeIPAEventLogger(EventLogger):
user = User
username = six.text_type
class Meta:
event_types = (
'freeipa_profile_created',
'freeipa_profile_deleted... | [
"waldur_core.logging.loggers.event_logger.register"
] | [((460, 512), 'waldur_core.logging.loggers.event_logger.register', 'event_logger.register', (['"""freeipa"""', 'FreeIPAEventLogger'], {}), "('freeipa', FreeIPAEventLogger)\n", (481, 512), False, 'from waldur_core.logging.loggers import EventLogger, event_logger\n')] |
"""
Copyright (C) 2018 Intel Corporation
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,
softw... | [
"acs.ErrorHandling.AcsBaseException.AcsBaseException.__init__"
] | [((1645, 1709), 'acs.ErrorHandling.AcsBaseException.AcsBaseException.__init__', 'AcsBaseException.__init__', (['self', 'generic_error_msg', 'specific_msg'], {}), '(self, generic_error_msg, specific_msg)\n', (1670, 1709), False, 'from acs.ErrorHandling.AcsBaseException import AcsBaseException\n')] |
import numpy as np
def value_iteration(env, theta=0.0001, discount_factor=1.0):
"""
Value Iteration Algorithm.
Args:
env: OpenAI environment. env.P represents the transition probabilities of the environment.
theta: Stopping threshold. If the value of all states changes less than theta
... | [
"numpy.abs",
"numpy.zeros",
"numpy.argmax",
"numpy.max"
] | [((545, 561), 'numpy.zeros', 'np.zeros', (['env.nS'], {}), '(env.nS)\n', (553, 561), True, 'import numpy as np\n'), ((575, 601), 'numpy.zeros', 'np.zeros', (['[env.nS, env.nA]'], {}), '([env.nS, env.nA])\n', (583, 601), True, 'import numpy as np\n'), ((1589, 1605), 'numpy.zeros', 'np.zeros', (['env.nA'], {}), '(env.nA)... |
#!/usr/bin/env python3
# coding: utf-8
from __future__ import absolute_import, division, print_function
import logging
import sys
import dv3_api
logging.basicConfig(level=logging.INFO)
dv3_api.KEY, email = sys.argv[1:] # pylint: disable=unbalanced-tuple-unpacking
grade = dv3_api.realtime_check(email)
logging.info('... | [
"logging.basicConfig",
"dv3_api.realtime_check",
"logging.info"
] | [((147, 186), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (166, 186), False, 'import logging\n'), ((276, 305), 'dv3_api.realtime_check', 'dv3_api.realtime_check', (['email'], {}), '(email)\n', (298, 305), False, 'import dv3_api\n'), ((306, 348), 'logging.info... |
from tensorflow.examples.tutorials.mnist import input_data
import tensorflow as tf
minst = input_data.read_data_sets('MINST_data/', one_hot=True)
x = tf.placeholder(tf.float32, [None, 784])
y_ = tf.placeholder(tf.float32, [None, 10])
W = tf.Variable(tf.zeros([784, 10]))
b = tf.Variable(tf.zeros([10]))
y = tf.nn.soft... | [
"tensorflow.InteractiveSession",
"tensorflow.placeholder",
"tensorflow.train.GradientDescentOptimizer",
"tensorflow.examples.tutorials.mnist.input_data.read_data_sets",
"tensorflow.argmax",
"tensorflow.global_variables_initializer",
"tensorflow.matmul",
"tensorflow.cast",
"tensorflow.log",
"tensor... | [((92, 146), 'tensorflow.examples.tutorials.mnist.input_data.read_data_sets', 'input_data.read_data_sets', (['"""MINST_data/"""'], {'one_hot': '(True)'}), "('MINST_data/', one_hot=True)\n", (117, 146), False, 'from tensorflow.examples.tutorials.mnist import input_data\n'), ((152, 191), 'tensorflow.placeholder', 'tf.pla... |
#O mesmo professor do desafio anterior quer sortear a ordem de apresentação
#de trabalhos dos alunos. Faça um programa que leia o nome dos quatro alunos e
#mostre a ordem sorteados.
from random import shuffle #shuffle = embaralhar em ingles
n1 = str(input('Nome do primeiro aluno : '))
n2 = str(input('Nome d... | [
"random.shuffle"
] | [((466, 480), 'random.shuffle', 'shuffle', (['lista'], {}), '(lista)\n', (473, 480), False, 'from random import shuffle\n')] |
# -----------------------------------------------------------------------------
# This source file has been developed within the scope of the
# Technical Director course at Filmakademie Baden-Wuerttemberg.
# http://technicaldirector.de
#
# Written by <NAME>
# Copyright (c) 2019 Animationsinstitut of <NAME>
# ---------... | [
"collections.OrderedDict",
"random.randint",
"Qt.QtWidgets.QInputDialog.getText",
"pymel.core.selected",
"pymel.core.other.hdLog",
"Qt.QtWidgets.QSpinBox",
"Qt.QtWidgets.QHBoxLayout",
"Qt.QtCore.Signal",
"Qt.QtWidgets.QTableView",
"Qt.QtWidgets.QPushButton",
"Qt.QtWidgets.QTabWidget",
"Qt.QtCo... | [((13211, 13229), 'Qt.QtCore.Signal', 'QtCore.Signal', (['str'], {}), '(str)\n', (13224, 13229), False, 'from Qt import QtWidgets, QtGui, QtCore\n'), ((13256, 13406), 'collections.OrderedDict', 'OrderedDict', (["[('Debug', (3, logging.DEBUG)), ('Info', (2, logging.INFO)), ('Warning', (1,\n logging.WARNING)), ('Criti... |
import argparse
import xarray as xr
import numpy as np
import xesmf as xe
from glob import glob
import os
import shutil
def add_2d(
ds,
):
"""
Regrid horizontally.
:param ds: Input xarray dataset
"""
ds['lat2d'] = ds.lat.expand_dims({'lon': ds.lon}).transpose()
ds['lon2d'] = ds.lon.expa... | [
"xarray.open_dataset",
"glob.glob",
"argparse.ArgumentParser",
"shutil.move"
] | [((1488, 1513), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1511, 1513), False, 'import argparse\n'), ((1410, 1446), 'shutil.move', 'shutil.move', (["(fn_out + '.tmp')", 'fn_out'], {}), "(fn_out + '.tmp', fn_out)\n", (1421, 1446), False, 'import shutil\n'), ((1025, 1043), 'glob.glob', 'glob... |
import os
import StringIO
from PIL import Image
import base64
from spriter.image import FileImage, URLImage, class_name_function as cnf
class DefaultImageDoesNotExist(Exception):
message = "The default image path must be exist. Not found in: "
def __init__(self, path):
super(DefaultImageDoesNotExist,... | [
"StringIO.StringIO",
"os.path.exists",
"os.makedirs",
"PIL.Image.new",
"base64.b64encode",
"os.path.join",
"spriter.image.URLImage",
"os.getcwd",
"spriter.image.FileImage"
] | [((3553, 3572), 'StringIO.StringIO', 'StringIO.StringIO', ([], {}), '()\n', (3570, 3572), False, 'import StringIO\n'), ((3705, 3732), 'base64.b64encode', 'base64.b64encode', (['image_str'], {}), '(image_str)\n', (3721, 3732), False, 'import base64\n'), ((4665, 4707), 'os.path.join', 'os.path.join', (['self.css_path', '... |
# Django
from django.http import HttpResponseRedirect,HttpResponse
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth import views as auth_views
from django.shortcuts i... | [
"users.models.Profile.objects.get",
"django.contrib.auth.models.User.objects.get",
"django.urls.reverse_lazy",
"users.models.Follow.objects.filter",
"django.shortcuts.redirect",
"django.urls.reverse",
"users.models.Follow.objects.create",
"posts.models.Post.objects.filter",
"django.contrib.auth.mode... | [((883, 901), 'django.contrib.auth.models.User.objects.all', 'User.objects.all', ([], {}), '()\n', (899, 901), False, 'from django.contrib.auth.models import User\n'), ((2423, 2450), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""users:login"""'], {}), "('users:login')\n", (2435, 2450), False, 'from django.urls impo... |
from os.path import join
def classifier_params_string(args):
classifier_params_string = args.neural_net.architecture
classifier_params_string += f"_{args.optimizer.name}"
classifier_params_string += f"_{args.optimizer.lr_scheduler}"
classifier_params_string += f"_{args.optimizer.lr:.4f}"
class... | [
"os.path.join"
] | [((658, 708), 'os.path.join', 'join', (['args.directory', '"""checkpoints"""', '"""classifiers"""'], {}), "(args.directory, 'checkpoints', 'classifiers')\n", (662, 708), False, 'from os.path import join\n'), ((876, 904), 'os.path.join', 'join', (['args.directory', '"""logs"""'], {}), "(args.directory, 'logs')\n", (880,... |
# Author: <NAME>
# github.com/kaylani2
# kaylani AT gta DOT ufrj DOT br
## Load dataset, describe, hadle categorical attributes
## CICIDS used as an example
import pandas as pd
import numpy as np
import sys
# Random state for eproducibility
STATE = 0
## Hard to not go over 80 columns
CICIDS_DIRECTORY = '../../datase... | [
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.mean_squared_error",
"numpy.append",
"sys.exit",
"sklearn.metrics.r2_score",
"sklearn.linear_model.LinearRegression"
] | [((784, 813), 'pandas.read_csv', 'pd.read_csv', (['CICIDS_WEDNESDAY'], {}), '(CICIDS_WEDNESDAY)\n', (795, 813), True, 'import pandas as pd\n'), ((5358, 5417), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(1 / 5)', 'random_state': 'STATE'}), '(X, y, test_size=1 / 5, random_... |
# Copyright 2020 The MiNLP 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 applicable l... | [
"tensorflow.compat.v1.ConfigProto",
"tensorflow.Graph",
"minlptokenizer.vocab.Vocab",
"tensorflow.io.gfile.GFile",
"tensorflow.compat.v1.GraphDef",
"os.path.join",
"minlptokenizer.lexicon.Lexicon",
"os.path.dirname",
"itertools.chain.from_iterable",
"multiprocessing.Pool",
"tensorflow.import_gra... | [((917, 942), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (932, 942), False, 'import os\n'), ((2705, 2745), 'os.path.join', 'os.path.join', (['pwd', "configs['vocab_path']"], {}), "(pwd, configs['vocab_path'])\n", (2717, 2745), False, 'import os\n'), ((2777, 2850), 'os.path.join', 'os.path... |
"""Project resource module."""
"""
Copyright 2021 Deutsche Telekom AG
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 requir... | [
"onapsdk.aai.business.Project.get_by_name",
"onapsdk.aai.business.Project.create",
"logging.debug"
] | [((1285, 1337), 'logging.debug', 'logging.debug', (['f"""Create Project {self.data[\'name\']}"""'], {}), '(f"Create Project {self.data[\'name\']}")\n', (1298, 1337), False, 'import logging\n'), ((1394, 1427), 'onapsdk.aai.business.Project.create', 'Project.create', (["self.data['name']"], {}), "(self.data['name'])\n", ... |
from setuptools import find_packages, setup
from beacon_api import __license__, __version__, __author__, __description__
setup(
name="beacon_api",
version=__version__,
url="https://beacon-python.rtfd.io/",
project_urls={
"Source": "https://github.com/CSCfi/beacon-python",
},
license=__... | [
"setuptools.find_packages"
] | [((446, 486), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['tests', 'docs']"}), "(exclude=['tests', 'docs'])\n", (459, 486), False, 'from setuptools import find_packages, setup\n')] |
import csv
import time
import os
import pandas as pd
DATA_ROOT = "C:\\RS\\Amazon\\All\\"
MINIMUM_X_CATEGORIES_FILENAME = 'minimum_2_Categories.csv'
# MINIMUM_X_CATEGORIES_FILENAME = 'minimum_2_196k.csv'
SOURCE_RATING_FILES_TO_USE = ['ratings_Movies_and_TV.csv','ratings_CDs_and_Vinyl.csv']
TARGET_RATING_FILE = 'rating... | [
"csv.writer",
"time.strftime",
"os.path.join",
"csv.reader"
] | [((444, 473), 'time.strftime', 'time.strftime', (['"""%y%m%d%H%M%S"""'], {}), "('%y%m%d%H%M%S')\n", (457, 473), False, 'import time\n'), ((716, 813), 'os.path.join', 'os.path.join', (['DATA_ROOT', "(timestamp + category_filename + '_FILTERED_BY_' + TARGET_RATING_FILE)"], {}), "(DATA_ROOT, timestamp + category_filename ... |