code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#!/usr/bin/python2
# Copyright (c) 2011 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This script produces csv data from multiple benchmarking runs with the
# spec2k harness.
#
# A typical usage would be
#
# expor... | [
"sys.stdout.write"
] | [((2320, 2354), 'sys.stdout.write', 'sys.stdout.write', (["('%-20s' % row[0])"], {}), "('%-20s' % row[0])\n", (2336, 2354), False, 'import sys\n'), ((2494, 2516), 'sys.stdout.write', 'sys.stdout.write', (['"""\n"""'], {}), "('\\n')\n", (2510, 2516), False, 'import sys\n'), ((2408, 2440), 'sys.stdout.write', 'sys.stdout... |
# Generated by Django 3.1.3 on 2020-11-23 10:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fit', '0004_auto_20201123_1625'),
]
operations = [
migrations.AlterField(
model_name='disease',
name='med1',
... | [
"django.db.models.CharField"
] | [((331, 386), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'default': '""""""', 'max_length': '(60)'}), "(blank=True, default='', max_length=60)\n", (347, 386), False, 'from django.db import migrations, models\n'), ((507, 562), 'django.db.models.CharField', 'models.CharField', ([], {'blank... |
# For use with I2C OLED screens.
# This requires the Adafruit Circuit Python OLED library, which superceeds earlier Adafruit OLED libraries
# Install it with `pip install adafruit-circuitpython-ssd1306`
import time
from subprocess import check_output
from board import SCL, SDA
import busio
from PIL import Image, Ima... | [
"PIL.Image.new",
"busio.I2C",
"PIL.ImageFont.load_default",
"subprocess.check_output",
"time.sleep",
"PIL.ImageDraw.Draw",
"adafruit_ssd1306.SSD1306_I2C"
] | [((514, 533), 'busio.I2C', 'busio.I2C', (['SCL', 'SDA'], {}), '(SCL, SDA)\n', (523, 533), False, 'import busio\n'), ((692, 734), 'adafruit_ssd1306.SSD1306_I2C', 'adafruit_ssd1306.SSD1306_I2C', (['(128)', '(32)', 'i2c'], {}), '(128, 32, i2c)\n', (720, 734), False, 'import adafruit_ssd1306\n'), ((920, 951), 'PIL.Image.ne... |
import numpy as np
import matplotlib.pyplot as plt
#plt.rc('font', family='serif')
#plt.rc('text', usetex=True)
sol1err = np.fromfile('../out/sol1err')
sol2err = np.fromfile('../out/sol2err')
L2err = np.sqrt(sol2err**2 + sol1err**2)
h = np.fromfile('../out/h')
x = np.sort(h)
fig, ax = plt.subplots(1,1)
for i in ran... | [
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.show",
"numpy.fromfile",
"numpy.sort",
"numpy.log10",
"matplotlib.pyplot.subplots",
"numpy.sqrt"
] | [((124, 153), 'numpy.fromfile', 'np.fromfile', (['"""../out/sol1err"""'], {}), "('../out/sol1err')\n", (135, 153), True, 'import numpy as np\n'), ((164, 193), 'numpy.fromfile', 'np.fromfile', (['"""../out/sol2err"""'], {}), "('../out/sol2err')\n", (175, 193), True, 'import numpy as np\n'), ((202, 238), 'numpy.sqrt', 'n... |
from PySide2 import QtWidgets, QtCore
import os
from ..utils import load_ui_file
from ..widgets.filter import FilterListerWidget, parse_filter_widget
from ..widgets.geo import LocationSelectorWidget
from ...utils import findMainWindow
from futura.utils import create_filter_from_description
from futura import w
from fu... | [
"futura.utils.create_filter_from_description",
"os.path.abspath",
"futura.proxy.WurstProcess",
"futura.w.get_one",
"futura.w.get_many"
] | [((2328, 2371), 'futura.utils.create_filter_from_description', 'create_filter_from_description', (['base_filter'], {}), '(base_filter)\n', (2358, 2371), False, 'from futura.utils import create_filter_from_description\n'), ((2394, 2444), 'futura.utils.create_filter_from_description', 'create_filter_from_description', ([... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 CERN.
#
# invenio-app-ils is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Test records relations siblings."""
import json
from flask import url_for
from invenio_app_ils.documents.api... | [
"invenio_app_ils.documents.api.Document.get_record_by_pid",
"tests.helpers.get_test_record",
"tests.helpers.user_login",
"json.dumps",
"flask.url_for"
] | [((24059, 24097), 'tests.helpers.user_login', 'user_login', (['client', '"""librarian"""', 'users'], {}), "(client, 'librarian', users)\n", (24069, 24097), False, 'from tests.helpers import get_test_record, user_login\n'), ((1538, 1581), 'invenio_app_ils.documents.api.Document.get_record_by_pid', 'Document.get_record_b... |
import argparse
import os
import sys
import radiomics
import SimpleITK as sitk
import csv
import pandas as pd
LABELS_FS = ['Left-Lateral-Ventricle', 'Left-Inf-Lat-Vent', 'Left-Thalamus-Proper', 'Left-Caudate', 'Left-Putamen', 'Left-Pallidum', '3rd-Ventricle',
'4th-Ventricle', 'Brain-Stem', 'Left-Hippocam... | [
"radiomics.setVerbosity",
"csv.writer",
"argparse.ArgumentParser",
"os.path.realpath",
"SimpleITK.ReadImage",
"os.path.exists",
"os.listdir",
"sys.exit"
] | [((3124, 3203), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Extract radiomics features from subjects"""'}), "(description='Extract radiomics features from subjects')\n", (3147, 3203), False, 'import argparse\n'), ((1600, 1635), 'csv.writer', 'csv.writer', (['out_file'], {'delimiter': ... |
from pythonjsonlogger import jsonlogger
from datetime import datetime
import logging
from logging import Logger
from logging.config import dictConfig
from seedwork.utils.functional import SimpleLazyObject
from seedwork.infrastructure.request_context import request_context
class RequestContextFilter(logging.Filter):
... | [
"datetime.datetime.now",
"logging.config.dictConfig",
"logging.getLogger",
"seedwork.utils.functional.SimpleLazyObject"
] | [((5120, 5165), 'seedwork.utils.functional.SimpleLazyObject', 'SimpleLazyObject', (['LoggerFactory.create_logger'], {}), '(LoggerFactory.create_logger)\n', (5136, 5165), False, 'from seedwork.utils.functional import SimpleLazyObject\n'), ((4670, 4696), 'logging.config.dictConfig', 'dictConfig', (['logging_config'], {})... |
import math
import random
import numpy
from tools import *
'''
Parametric Optimizers to search for optimal TSP solution.
Method 1: Stochastic Hill Climbing search
Method 2: Random Search - Used as benchmark
'''
# Initialize the population, a collection of paths
def createPath(m):
n = numpy.arange(1,m+1)
numpy.ra... | [
"numpy.arange",
"numpy.random.shuffle"
] | [((290, 312), 'numpy.arange', 'numpy.arange', (['(1)', '(m + 1)'], {}), '(1, m + 1)\n', (302, 312), False, 'import numpy\n'), ((312, 335), 'numpy.random.shuffle', 'numpy.random.shuffle', (['n'], {}), '(n)\n', (332, 335), False, 'import numpy\n'), ((840, 860), 'numpy.arange', 'numpy.arange', (['v.size'], {}), '(v.size)\... |
from typing import Dict, List, Optional, Union
import torch
from ..torch_utils import padded_stack
def stack_arrays_as_dict(
batch: List[Optional[torch.Tensor]], pad: bool = True
) -> Optional[
Union[
torch.Tensor,
Dict[str, Union[Optional[torch.Tensor], Optional[List[Optional[torch.Tensor]]... | [
"torch.zeros",
"torch.zeros_like",
"torch.tensor"
] | [((2175, 2242), 'torch.tensor', 'torch.tensor', (['[(x.shape[0] if x is not None else 0) for x in batch]'], {}), '([(x.shape[0] if x is not None else 0) for x in batch])\n', (2187, 2242), False, 'import torch\n'), ((1530, 1597), 'torch.tensor', 'torch.tensor', (['[(x.shape[0] if x is not None else 0) for x in batch]'],... |
#!/usr/bin/python3
import math
def is_prime2(n: int) -> bool:
if n >= 2:
for i in range(2, n):
if not (n % i):
return False
else:
return False
return True
def prime_factors(n: int) -> []:
primes = []
for i in range(1, math.floor(math.sqrt(n)) + 1):
... | [
"math.sqrt"
] | [((294, 306), 'math.sqrt', 'math.sqrt', (['n'], {}), '(n)\n', (303, 306), False, 'import math\n')] |
def reward_function(params):
'''
Cosine reward function for heading angle
'''
# Import libraries
import math
# PARAMETERS (CONSTANTS)
# Total num of steps we want the car to finish the lap, it will vary depends on the track length
TOTAL_NUM_STEPS = 300
# Max angle thre... | [
"math.radians",
"math.degrees",
"math.atan2"
] | [((1884, 1956), 'math.atan2', 'math.atan2', (['(next_point[1] - prev_point[1])', '(next_point[0] - prev_point[0])'], {}), '(next_point[1] - prev_point[1], next_point[0] - prev_point[0])\n', (1894, 1956), False, 'import math\n'), ((2002, 2027), 'math.degrees', 'math.degrees', (['track_angle'], {}), '(track_angle)\n', (2... |
"""
.. module:: console
:platform: Unix, Windows
:synopsis: Cilantropy entry-point for console commands
:mod:`console` -- Cilantropy entry-point for console commands
==================================================================
"""
from .helpers import get_shared_data
from .helpers import get_pkg_res
from .... | [
"colorama.init",
"pkg_resources.iter_entry_points",
"urllib.parse.urlencode",
"docopt.docopt"
] | [((8458, 8508), 'pkg_resources.iter_entry_points', 'pkg_resources.iter_entry_points', (['"""console_scripts"""'], {}), "('console_scripts')\n", (8489, 8508), False, 'import pkg_resources\n'), ((8983, 9030), 'urllib.parse.urlencode', 'urllib.parse.urlencode', (["{'code': template_data}"], {}), "({'code': template_data})... |
#programa de recordatorios
import pickle
import os
#crea lista vacia en un archivo llamada outfile con pickle si no exite uno
#de lo contrario abre el creado previamente
if os.path.isfile('./outfile') == False:
recordatorios = []
with open('outfile', 'wb') as fp:
pickle.dump(recordatorios, fp)
else:
... | [
"os.path.isfile",
"pickle.load",
"pickle.dump"
] | [((174, 201), 'os.path.isfile', 'os.path.isfile', (['"""./outfile"""'], {}), "('./outfile')\n", (188, 201), False, 'import os\n'), ((281, 311), 'pickle.dump', 'pickle.dump', (['recordatorios', 'fp'], {}), '(recordatorios, fp)\n', (292, 311), False, 'import pickle\n'), ((381, 396), 'pickle.load', 'pickle.load', (['fp'],... |
from tkinter import *
from tkinter import messagebox, colorchooser
from logging import basicConfig, warning, info, error, DEBUG
from os import getcwd, path, mkdir
from time import strftime, time, localtime
from json import dump, load
from re import findall, search
from hmac import new, compare_digest
from hashl... | [
"email.mime.text.MIMEText",
"hmac.compare_digest",
"hashlib.sha512",
"logging.error",
"smtplib.SMTP",
"logging.warning",
"email.mime.multipart.MIMEMultipart",
"re.findall",
"requests.get",
"time.localtime",
"json.dump",
"tkinter.messagebox.showinfo",
"tkinter.colorchooser.askcolor",
"tkint... | [((23149, 23180), 'logging.info', 'info', (['"""Opened GUI application."""'], {}), "('Opened GUI application.')\n", (23153, 23180), False, 'from logging import basicConfig, warning, info, error, DEBUG\n'), ((838, 946), 're.findall', 'findall', (['"""[\\\\s]|[0123456789]|[~`!@#\\\\$%\\\\^&\\\\*()_\\\\+\\\\-={}|\\\\[\\\\... |
import os
import pyedflib
import h5py
import pytz
import datetime as dt
import struct
psg_properties = {'digital_max': [32767],
'digital_min': [-32767],
'dimension': ['uV'],
'physical_min': [-800.0],
'physical_max': [800.0],
... | [
"datetime.datetime.utcfromtimestamp",
"h5py.File",
"pytz.timezone"
] | [((540, 563), 'h5py.File', 'h5py.File', (['h5_path', '"""r"""'], {}), "(h5_path, 'r')\n", (549, 563), False, 'import h5py\n'), ((863, 915), 'datetime.datetime.utcfromtimestamp', 'dt.datetime.utcfromtimestamp', (["h5.attrs['start_time']"], {}), "(h5.attrs['start_time'])\n", (891, 915), True, 'import datetime as dt\n'), ... |
import cv2
import numpy as np
import os
# import six.moves.urllib as urllib
import sys
import tarfile
import tensorflow as tf
import zipfile
import pathlib
from collections import defaultdict
from io import StringIO
from matplotlib import pyplot as plt
from PIL import Image
from IPython.display import display
from obje... | [
"cv2.waitKey",
"tensorflow.convert_to_tensor",
"numpy.asarray",
"cv2.imshow",
"object_detection.utils.label_map_util.create_category_index_from_labelmap",
"cv2.VideoCapture",
"object_detection.utils.ops.reframe_box_masks_to_image_masks",
"tensorflow.cast",
"numpy.array",
"cv2.destroyAllWindows",
... | [((801, 894), 'object_detection.utils.label_map_util.create_category_index_from_labelmap', 'label_map_util.create_category_index_from_labelmap', (['PATH_TO_LABELS'], {'use_display_name': '(True)'}), '(PATH_TO_LABELS,\n use_display_name=True)\n', (851, 894), False, 'from object_detection.utils import label_map_util\n... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import mock
from preggy import expect
from unittest import TestCase
from tests import read_fixture
from remotecv.pyres_tasks import DetectTask
from remotecv.utils import config
class DetectTaskTestCase(TestCase):
def test_should_run_detector_task(self):
store_m... | [
"preggy.expect",
"mock.Mock",
"remotecv.pyres_tasks.DetectTask.perform"
] | [((326, 337), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (335, 337), False, 'import mock\n'), ((362, 395), 'mock.Mock', 'mock.Mock', ([], {'load_sync': 'read_fixture'}), '(load_sync=read_fixture)\n', (371, 395), False, 'import mock\n'), ((465, 499), 'mock.Mock', 'mock.Mock', ([], {'return_value': 'store_mock'}), '(ret... |
"""
"""
from configparser import ConfigParser, SectionProxy
from os import path
import os
from typing import List, Tuple, Any, Optional, Dict
import numpy as np
import tqdm
from general_utils.config import config_util, config_parser_singleton
from general_utils.exportation import csv_exportation
from ge... | [
"os.mkdir",
"data_providing_module.data_provider_registry.registry.register_consumer",
"data_providing_module.configurable_registry.config_registry.register_configurable",
"os.path.exists",
"numpy.where",
"stock_data_analysis_module.ml_models.evolutionary_computation.TradingPopulation",
"general_utils.c... | [((3132, 3178), 'numpy.where', 'np.where', (['(actual_predictions == 1)', '(True)', '(False)'], {}), '(actual_predictions == 1, True, False)\n', (3140, 3178), True, 'import numpy as np\n'), ((6217, 6282), 'data_providing_module.configurable_registry.config_registry.register_configurable', 'configurable_registry.config_... |
import pygame
size = width, height = 350,500 #Screen Size
class Background(pygame.sprite.Sprite):
def __init__(self, image_file, location):
pygame.sprite.Sprite.__init__(self) #call Sprite initializer
self.image = pygame.image.load(image_file)
self.rect = self.image.get_rect()
self... | [
"pygame.image.load",
"pygame.transform.rotozoom",
"pygame.sprite.Sprite.__init__"
] | [((153, 188), 'pygame.sprite.Sprite.__init__', 'pygame.sprite.Sprite.__init__', (['self'], {}), '(self)\n', (182, 188), False, 'import pygame\n'), ((236, 265), 'pygame.image.load', 'pygame.image.load', (['image_file'], {}), '(image_file)\n', (253, 265), False, 'import pygame\n'), ((540, 588), 'pygame.image.load', 'pyga... |
from flask import Flask, request, make_response
import re
from app import db, bcrypt
from pkg.models.auth_models import user
from pkg.helpers.authentication import generateToken
class Auth:
def init(self):
pass
def signup(self):
name = request.json['name']
email = request.json['email']... | [
"pkg.models.auth_models.user",
"app.bcrypt.generate_password_hash",
"app.bcrypt.check_password_hash",
"pkg.models.auth_models.user.query.filter_by",
"app.db.session.commit",
"flask.make_response",
"pkg.helpers.authentication.generateToken",
"re.search",
"app.db.session.add"
] | [((520, 596), 'flask.make_response', 'make_response', (["{'status': 400, 'data': {'message': 'Email is requred'}}", '(400)'], {}), "({'status': 400, 'data': {'message': 'Email is requred'}}, 400)\n", (533, 596), False, 'from flask import Flask, request, make_response\n'), ((2418, 2492), 'flask.make_response', 'make_res... |
import numpy as np
from pydex.core.designer import Designer
def simulate(ti_controls, model_parameters):
return np.array([
np.exp(model_parameters[0] * ti_controls[0])
])
designer = Designer()
designer.simulate = simulate
reso = 21j
tic = np.mgrid[0:1:reso]
designer.ti_controls_candidates = np.arra... | [
"numpy.random.seed",
"pydex.core.designer.Designer",
"numpy.array",
"numpy.exp",
"numpy.random.normal"
] | [((202, 212), 'pydex.core.designer.Designer', 'Designer', ([], {}), '()\n', (210, 212), False, 'from pydex.core.designer import Designer\n'), ((332, 351), 'numpy.random.seed', 'np.random.seed', (['(123)'], {}), '(123)\n', (346, 351), True, 'import numpy as np\n'), ((392, 444), 'numpy.random.normal', 'np.random.normal',... |
import argparse
import sys
from typing import Sequence
from exabel_data_sdk import ExabelClient
from exabel_data_sdk.client.api.bulk_insert import BulkInsertFailedError
from exabel_data_sdk.client.api.data_classes.entity import Entity
from exabel_data_sdk.scripts.csv_script import CsvScript
from exabel_data_sdk.util.r... | [
"exabel_data_sdk.util.resource_name_normalization.normalize_resource_name",
"sys.exit"
] | [((3383, 3394), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (3391, 3394), False, 'import sys\n'), ((3526, 3564), 'exabel_data_sdk.util.resource_name_normalization.normalize_resource_name', 'normalize_resource_name', (['row[name_col]'], {}), '(row[name_col])\n', (3549, 3564), False, 'from exabel_data_sdk.util.resour... |
from django.http.response import HttpResponse
from django.shortcuts import render, redirect
from django.http import JsonResponse
from django.forms.models import fields_for_model, model_to_dict
from django.views.decorators.csrf import csrf_exempt
from django.db import transaction
from . import models
from . import form... | [
"json.loads",
"django.shortcuts.redirect",
"json.dumps",
"django.http.JsonResponse",
"dataImporter.models.DataImporter",
"django.shortcuts.render",
"django.db.transaction.atomic"
] | [((7318, 7362), 'django.shortcuts.render', 'render', (['request', '"""boundaryref.html"""', 'context'], {}), "(request, 'boundaryref.html', context)\n", (7324, 7362), False, 'from django.shortcuts import render, redirect\n'), ((493, 534), 'django.shortcuts.render', 'render', (['request', '"""overview.html"""', 'context... |
# SPDX-FileCopyrightText: 2020 2020
#
# SPDX-License-Identifier: Apache-2.0
import os.path as op
import socket
import subprocess
from splunklib import binding
from splunklib import client
from splunklib.data import record
cur_dir = op.dirname(op.abspath(__file__))
# Namespace
app = "unittest"
owner = "nobody"
# Se... | [
"os.path.abspath",
"os.path.join",
"os.path.sep.join"
] | [((246, 266), 'os.path.abspath', 'op.abspath', (['__file__'], {}), '(__file__)\n', (256, 266), True, 'import os.path as op\n'), ((1353, 1390), 'os.path.join', 'op.join', (['cur_dir', '"""data/mock_splunk/"""'], {}), "(cur_dir, 'data/mock_splunk/')\n", (1360, 1390), True, 'import os.path as op\n'), ((1479, 1506), 'os.pa... |
import subprocess
from PIL import Image
import torchvision.transforms as transforms
import torch
import functools
import random
import math
import cv2
import numpy as np
import os
# Object annotation class:
class BodyPart:
def __init__(self, name, xmin, ymin, xmax, ymax, x, y, w, h):
self.name = name
... | [
"torch.nn.Dropout",
"cv2.bitwise_and",
"numpy.ones",
"numpy.clip",
"cv2.ellipse",
"cv2.rectangle",
"torchvision.transforms.Normalize",
"torch.no_grad",
"cv2.inRange",
"os.path.join",
"random.randint",
"cv2.dilate",
"cv2.cvtColor",
"cv2.imwrite",
"torch.load",
"torch.nn.ReflectionPad2d"... | [((2016, 2030), 'cv2.split', 'cv2.split', (['img'], {}), '(img)\n', (2025, 2030), False, 'import cv2\n'), ((2855, 2878), 'cv2.merge', 'cv2.merge', (['out_channels'], {}), '(out_channels)\n', (2864, 2878), False, 'import cv2\n'), ((3377, 3430), 'numpy.ma.array', 'np.ma.array', (['matrix'], {'mask': 'mask', 'fill_value':... |
from layer import *
import itertools
# This file just tests the implementations in layer.py
if __name__ == "__main__":
def test_ACL(V):
# construct ACL with complex values
def amFactoryI(Nlayer, activation):
moduleList = []
for l in range(Nlayer-1):
layer = ... | [
"itertools.product"
] | [((3746, 3788), 'itertools.product', 'itertools.product', (['[1, 2, 4, 16]'], {'repeat': '(2)'}), '([1, 2, 4, 16], repeat=2)\n', (3763, 3788), False, 'import itertools\n'), ((4738, 4773), 'itertools.product', 'itertools.product', (['[1, 2]'], {'repeat': '(2)'}), '([1, 2], repeat=2)\n', (4755, 4773), False, 'import iter... |
import enum
from datetime import datetime
from functools import reduce
from sqlalchemy import (create_engine)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
database_uri = 'sqlite:///:memory:'
debug = False
db = create_engine(database_uri, echo=debug)
Base = declarati... | [
"sqlalchemy.create_engine",
"sqlalchemy.ext.declarative.declarative_base",
"sqlalchemy.orm.sessionmaker"
] | [((264, 303), 'sqlalchemy.create_engine', 'create_engine', (['database_uri'], {'echo': 'debug'}), '(database_uri, echo=debug)\n', (277, 303), False, 'from sqlalchemy import create_engine\n'), ((311, 329), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (327, 329), False, 'from sqlal... |
import functools
import typing
from collections import namedtuple
COMPONENT = namedtuple('COMPONENT', ['includes', 'files'])
WEB_INCLUDE = namedtuple('WEB_INCLUDE', ['name', 'src'])
def merge_components(
*components: typing.Union[list, tuple, COMPONENT]
) -> COMPONENT:
"""
Merges multiple COMPONENT i... | [
"functools.reduce",
"functools.partial",
"collections.namedtuple"
] | [((79, 125), 'collections.namedtuple', 'namedtuple', (['"""COMPONENT"""', "['includes', 'files']"], {}), "('COMPONENT', ['includes', 'files'])\n", (89, 125), False, 'from collections import namedtuple\n'), ((140, 182), 'collections.namedtuple', 'namedtuple', (['"""WEB_INCLUDE"""', "['name', 'src']"], {}), "('WEB_INCLUD... |
# Copyright 2019 The TensorFlow 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 applica... | [
"tensorflow.python.platform.test.main",
"tensorflow.python.util.compat.as_bytes",
"tensorflow_estimator.python.estimator.export.export_lib.ServingInputReceiver",
"tensorflow.python.saved_model.save.save",
"tensorflow_estimator.python.estimator.export.function._EstimatorWrappedGraph",
"tensorflow.python.op... | [((2898, 2968), 'tensorflow_estimator.python.estimator.model_fn.EstimatorSpec', 'model_fn_lib.EstimatorSpec', (['ModeKeys.PREDICT'], {'predictions': '(features + 1)'}), '(ModeKeys.PREDICT, predictions=features + 1)\n', (2924, 2968), True, 'from tensorflow_estimator.python.estimator import model_fn as model_fn_lib\n'), ... |
'''
Created on 10-Jul-2018
@author: <NAME>
'''
# We will use seaborn to create plots
import seaborn as sns
# Matplotlib will help us to draw the plots
import matplotlib.pyplot as plt
sns.set(color_codes=True)
# Import pandas to manage data set
import pandas as pd
# Import NumPy for all mathematics operations on ... | [
"matplotlib.pyplot.show",
"pandas.read_csv",
"matplotlib.pyplot.subplots",
"seaborn.countplot",
"seaborn.distplot",
"numpy.random.permutation",
"seaborn.set"
] | [((187, 212), 'seaborn.set', 'sns.set', ([], {'color_codes': '(True)'}), '(color_codes=True)\n', (194, 212), True, 'import seaborn as sns\n'), ((493, 530), 'pandas.read_csv', 'pd.read_csv', (['file_name'], {'delimiter': '""","""'}), "(file_name, delimiter=',')\n", (504, 530), True, 'import pandas as pd\n'), ((1634, 166... |
# Generated by Django 2.2.2 on 2019-09-25 07:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sensors', '0003_auto_20190924_2227'),
]
operations = [
migrations.AlterField(
model_name='cameradata',
name='filenam... | [
"django.db.models.FileField",
"django.db.models.CharField"
] | [((342, 410), 'django.db.models.FileField', 'models.FileField', ([], {'help_text': '"""Camera video file"""', 'upload_to': '"""camera/"""'}), "(help_text='Camera video file', upload_to='camera/')\n", (358, 410), False, 'from django.db import migrations, models\n'), ((539, 762), 'django.db.models.CharField', 'models.Cha... |
from django.shortcuts import render,redirect
from .forms import OrganizationRegisterForm,CreateEventForm,AddImageForm,AddOrgImage
from .models import Organization,OrganizationImages
from django.contrib.auth.models import User
from django.contrib import messages
from evelist.models import Event,EventImages
from voluntee... | [
"django.shortcuts.redirect",
"volunteer.models.Volunteer.objects.filter",
"django.contrib.auth.models.User.objects.filter",
"django.db.models.F",
"evelist.models.Event.objects.filter",
"evelist.models.Event.objects.get",
"django.shortcuts.render",
"django.contrib.messages.success"
] | [((1075, 1134), 'django.shortcuts.render', 'render', (['request', '"""organization/signup.html"""', "{'form': form}"], {}), "(request, 'organization/signup.html', {'form': form})\n", (1081, 1134), False, 'from django.shortcuts import render, redirect\n'), ((1438, 1496), 'django.shortcuts.render', 'render', (['request',... |
from django.conf import settings
from django.shortcuts import get_object_or_404
from rest_framework.permissions import BasePermission
from rest_framework.exceptions import PermissionDenied
from mkt.comm.models import (CommunicationNote, CommunicationThread,
user_has_perm_note, user_has_pe... | [
"rest_framework.exceptions.PermissionDenied",
"django.shortcuts.get_object_or_404",
"mkt.comm.models.user_has_perm_note",
"mkt.comm.models.CommunicationNote.objects.get",
"mkt.comm.models.user_has_perm_thread"
] | [((1101, 1140), 'mkt.comm.models.user_has_perm_thread', 'user_has_perm_thread', (['obj', 'request.user'], {}), '(obj, request.user)\n', (1121, 1140), False, 'from mkt.comm.models import CommunicationNote, CommunicationThread, user_has_perm_note, user_has_perm_thread\n'), ((1550, 1602), 'django.shortcuts.get_object_or_4... |
import pytest as pytest
from unittest.mock import Mock
from marginTrading import github_api
@pytest.fixture
def avatar_url(mocker):
resp_mock = Mock()
url = 'https://avatars.githubusercontent.com/u/78605825?v=4'
resp_mock.json.return_value = {'login': 'sambiase', 'id': 78605825, 'node_id': 'MDQ6VXNlcjc4N... | [
"marginTrading.github_api.buscar_avatar",
"unittest.mock.Mock"
] | [((151, 157), 'unittest.mock.Mock', 'Mock', ([], {}), '()\n', (155, 157), False, 'from unittest.mock import Mock\n'), ((556, 592), 'marginTrading.github_api.buscar_avatar', 'github_api.buscar_avatar', (['"""sambiase"""'], {}), "('sambiase')\n", (580, 592), False, 'from marginTrading import github_api\n'), ((672, 708), ... |
# General imports
import importlib as il
import os
import sys
# Partial imports
from airflow.operators.python import PythonOperator
from airflow.models import Variable
from airflow import DAG
from airflow.utils.db import create_session
from datetime import datetime, timedelta
from typing import List
# Import from cor... | [
"airflow.utils.db.create_session",
"airflow.DAG",
"airflow.operators.python.PythonOperator",
"importlib.import_module",
"os.path.dirname",
"datetime.datetime",
"cornflow_client.ApplicationCore.__subclasses__",
"datetime.timedelta",
"os.path.splitext",
"airflow.models.Variable.delete",
"airflow.m... | [((2702, 2793), 'airflow.DAG', 'DAG', (['"""update_all_schemas"""'], {'default_args': 'default_args', 'catchup': '(False)', 'tags': "['internal']"}), "('update_all_schemas', default_args=default_args, catchup=False, tags=[\n 'internal'])\n", (2705, 2793), False, 'from airflow import DAG\n'), ((2813, 2924), 'airflow.... |
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from vae_train.vae_utils import *
class Encoder(nn.Module):
def __init__(self, embedding_size=128, n_highway_layers=0, encoder_hidden_size=128, n_class=None, encoder_layers=1, bidirectional=False):
super(Encoder, self).__... | [
"torch.nn.LSTM",
"torch.cat",
"torch.arange"
] | [((569, 714), 'torch.nn.LSTM', 'nn.LSTM', ([], {'input_size': 'embedding_size', 'hidden_size': 'encoder_hidden_size', 'num_layers': 'encoder_layers', 'batch_first': '(True)', 'bidirectional': 'bidirectional'}), '(input_size=embedding_size, hidden_size=encoder_hidden_size,\n num_layers=encoder_layers, batch_first=Tru... |
from photons_canvas.animations import register, AnimationRunner
from photons_canvas.animations.action import expand
from photons_app.errors import PhotonsAppError
from photons_app import helpers as hp
from delfick_project.option_merge import MergedOptions
from delfick_project.norms import sb
from textwrap import dede... | [
"textwrap.dedent",
"io.StringIO",
"asyncio.Semaphore",
"photons_canvas.animations.AnimationRunner",
"photons_canvas.animations.register.available_animations",
"photons_app.helpers.TaskHolder",
"photons_app.helpers.ChildOfFuture",
"delfick_project.option_merge.MergedOptions.using",
"logging.getLogger... | [((370, 422), 'logging.getLogger', 'logging.getLogger', (['"""interactor.commander.animations"""'], {}), "('interactor.commander.animations')\n", (387, 422), False, 'import logging\n'), ((1504, 1535), 'photons_canvas.animations.register.available_animations', 'register.available_animations', ([], {}), '()\n', (1533, 15... |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | [
"unittest.mock.create_autospec",
"google.cloud.bigquery.SchemaField",
"pyarrow.decimal256",
"datetime.time",
"pyarrow.time64",
"pyarrow.binary",
"pyarrow.bool_",
"pyarrow.int64",
"datetime.date",
"datetime.datetime",
"pyarrow.timestamp",
"pyarrow.float64",
"pytest.importorskip",
"decimal.D... | [((707, 736), 'pytest.importorskip', 'pytest.importorskip', (['"""pandas"""'], {}), "('pandas')\n", (726, 736), False, 'import pytest\n'), ((3360, 3397), 'unittest.mock.create_autospec', 'mock.create_autospec', (['bigquery.Client'], {}), '(bigquery.Client)\n', (3380, 3397), False, 'from unittest import mock\n'), ((3459... |
import os
import inspect
from tqdm import tqdm
import numpy as np
import typing
import cv2
import torchvision
import torch
from PIL import Image
from torch.utils.data import Dataset, DataLoader
# root (correct even if called)
CRT_ABS_PATH = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
# ke... | [
"os.mkdir",
"numpy.load",
"torch.cat",
"numpy.arange",
"torchvision.transforms.Normalize",
"os.path.join",
"torch.utils.data.DataLoader",
"torch.load",
"os.path.exists",
"torch.is_tensor",
"cv2.resize",
"numpy.random.shuffle",
"tqdm.tqdm",
"numpy.save",
"inspect.currentframe",
"torchvi... | [((1773, 1876), 'os.path.join', 'os.path.join', (['CRT_ABS_PATH', "PATH_TO_DATASET['EI339']", "DATASET_MAPPING_FN['EI339']['train']['data']"], {}), "(CRT_ABS_PATH, PATH_TO_DATASET['EI339'], DATASET_MAPPING_FN[\n 'EI339']['train']['data'])\n", (1785, 1876), False, 'import os\n'), ((1906, 2010), 'os.path.join', 'os.pa... |
# -*- coding utf-8 -*-
import cv2
import os
import numpy as np
from sklearn.model_selection import train_test_split
import random
import tensorflow as tf
def read_data(img_path, image_h = 64, image_w = 64):
image_data = []
label_data = []
image = cv2.imread(img_path)
#cv2.namedWindow("Image... | [
"tensorflow.random_uniform",
"numpy.dot",
"tensorflow.summary.scalar",
"tensorflow.subtract",
"random.randint",
"cv2.copyMakeBorder",
"cv2.imread",
"tensorflow.placeholder",
"tensorflow.zeros",
"numpy.array",
"tensorflow.matmul",
"tensorflow.summary.histogram",
"numpy.random.rand",
"tensor... | [((1750, 1808), 'tensorflow.train.GradientDescentOptimizer', 'tf.train.GradientDescentOptimizer', (['(0.001)'], {'name': '"""Optimizer"""'}), "(0.001, name='Optimizer')\n", (1783, 1808), True, 'import tensorflow as tf\n'), ((1982, 2009), 'tensorflow.summary.merge', 'tf.summary.merge', (['summaries'], {}), '(summaries)\... |
''' Example dangerous usage of urllib[2] opener functions
The urllib and urllib2 opener functions and object can open http, ftp,
and file urls. Often, the ability to open file urls is overlooked leading
to code that can unexpectedly open files on the local server. This
could be used by an attacker to leak information ... | [
"urllib2.HTTPBasicAuthHandler",
"urllib2.install_opener",
"urllib.quote",
"urllib.FancyURLopener",
"urllib2.Request",
"urllib.request.FancyURLopener",
"urllib.urlopen",
"urllib.request.urlopen",
"urllib.request.URLopener",
"urllib.request.urlretrieve",
"six.moves.urllib.request.urlopen",
"urll... | [((469, 499), 'urllib.quote', 'urllib.quote', (['"""file:///bin/ls"""'], {}), "('file:///bin/ls')\n", (481, 499), False, 'import urllib\n'), ((504, 535), 'urllib.urlopen', 'urllib.urlopen', (['url', '"""blah"""', '(32)'], {}), "(url, 'blah', 32)\n", (518, 535), False, 'import urllib\n'), ((540, 588), 'urllib.urlretriev... |
import logging
import os
from abc import ABC
import gin
import MinkowskiEngine as ME
import numpy as np
import open3d as o3d
import torch
from src.models import get_model
class BaseFeatureExtractor(ABC):
def __init__(self):
logging.info(f"Initialize {self.__class__.__name__}")
def extract_feature(s... | [
"torch.ones",
"MinkowskiEngine.SparseTensor",
"torch.load",
"MinkowskiEngine.utils.sparse_quantize",
"os.path.exists",
"open3d.geometry.PointCloud",
"numpy.asarray",
"logging.info",
"open3d.geometry.KDTreeSearchParamHybrid",
"gin.configurable",
"MinkowskiEngine.utils.batched_coordinates",
"src... | [((420, 438), 'gin.configurable', 'gin.configurable', ([], {}), '()\n', (436, 438), False, 'import gin\n'), ((2034, 2052), 'gin.configurable', 'gin.configurable', ([], {}), '()\n', (2050, 2052), False, 'import gin\n'), ((3102, 3120), 'gin.configurable', 'gin.configurable', ([], {}), '()\n', (3118, 3120), False, 'import... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math
import copy
from collections import namedtuple
Move = namedtuple('Move', 'source, target, disc')
def hanoi(discs):
seen = set()
def __solve(rods, depth=0):
if len(rods[2]) == discs:
return []
if rods in seen:
return None
seen.add(rods)
best ... | [
"collections.namedtuple"
] | [((116, 158), 'collections.namedtuple', 'namedtuple', (['"""Move"""', '"""source, target, disc"""'], {}), "('Move', 'source, target, disc')\n", (126, 158), False, 'from collections import namedtuple\n')] |
import os
import configparser
import yaml
import ast
from pathlib import Path
HERE = Path(__file__).parent.absolute()
print(HERE)
config_dir = HERE / 'config/config.ini.model'
config = configparser.ConfigParser()
config.read(config_dir)
ACCESS_TOKEN_EXPIRE_MINUTES = config.get('security', 'access_token_expire_minute... | [
"pathlib.Path",
"configparser.ConfigParser",
"yaml.load"
] | [((187, 214), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (212, 214), False, 'import configparser\n'), ((87, 101), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (91, 101), False, 'from pathlib import Path\n'), ((3142, 3165), 'yaml.load', 'yaml.load', (['yaml_content'], {}),... |
import sublime
import sublime_plugin
import os
from ..lib import log, setup_log_panel, yte_setting, dotty
from ..lib import select_video, select_playlist, select_tag, select_timecode
from ..lib import Request, NetworkManager, stored_credentials_path, video_sort
# TODO:
# - Hit the keyword in the first few lines and... | [
"sublime.windows",
"sublime.load_settings",
"os.path.expanduser"
] | [((2314, 2331), 'sublime.windows', 'sublime.windows', ([], {}), '()\n', (2329, 2331), False, 'import sublime\n'), ((2426, 2481), 'sublime.load_settings', 'sublime.load_settings', (['"""YouTubeEditor.sublime-settings"""'], {}), "('YouTubeEditor.sublime-settings')\n", (2447, 2481), False, 'import sublime\n'), ((2537, 256... |
#!/usr/bin/env python3
from argparse import ArgumentParser
from util import startTunnel, stopTunnel, addressesForInterface, srcAddressForDst
import logging
import signal
import requests
import socket
def main():
parser = ArgumentParser()
parser.add_argument("--bridge", type=str)
parser.add_argument("remot... | [
"logging.error",
"argparse.ArgumentParser",
"signal.pause",
"socket.gethostbyname",
"util.startTunnel",
"util.srcAddressForDst",
"util.stopTunnel"
] | [((227, 243), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (241, 243), False, 'from argparse import ArgumentParser\n'), ((561, 592), 'util.srcAddressForDst', 'srcAddressForDst', (['args.remoteIP'], {}), '(args.remoteIP)\n', (577, 592), False, 'from util import startTunnel, stopTunnel, addressesForInte... |
## This file converts ac to tensorflow graph
## It takes as input a pickle file which contains the AC as a dictionary
## Each value in the dictionary is node_obj class object from Nimish's graph_analysis project
import tensorflow as tf
import pickle
import networkx as nx
import random
import numpy as np
def loa... | [
"random.randint",
"networkx.topological_sort",
"tensorflow.add",
"tensorflow.multiply",
"random.random",
"pickle.load"
] | [((979, 1008), 'networkx.topological_sort', 'nx.topological_sort', (['graph_nx'], {}), '(graph_nx)\n', (998, 1008), True, 'import networkx as nx\n'), ((409, 443), 'pickle.load', 'pickle.load', (['fp'], {'encoding': '"""latin1"""'}), "(fp, encoding='latin1')\n", (420, 443), False, 'import pickle\n'), ((601, 616), 'pickl... |
import os
import json
import glob
import pandas as pd
from typing import Dict, Type, Any
import ConfigSpace
from deepcave.runs.run import Status
from deepcave.runs.converters.converter import Converter
from deepcave.runs.run import Run
from deepcave.runs.objective import Objective
from deepcave.utils.hash import file_... | [
"deepcave.runs.objective.Objective",
"json.loads",
"deepcave.runs.run.Run",
"os.path.join",
"hpbandster.core.result.logged_results_to_HBS_result"
] | [((978, 1013), 'os.path.join', 'os.path.join', (['working_dir', 'run_name'], {}), '(working_dir, run_name)\n', (990, 1013), False, 'import os\n'), ((1386, 1412), 'deepcave.runs.objective.Objective', 'Objective', (['"""Cost"""'], {'lower': '(0)'}), "('Cost', lower=0)\n", (1395, 1412), False, 'from deepcave.runs.objectiv... |
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
from xgboost import XGBRegressor
import os
from django.conf import settings
import numpy as np
from functools import lru_cache
RANDOM_STATE = 42
def get_path(course, file):
return os.path.join(settings.PROJECT_ROOT, '..', 'pandas_api', 'static', ... | [
"sklearn.preprocessing.MinMaxScaler",
"os.path.isfile",
"numpy.histogram",
"xgboost.XGBRegressor",
"functools.lru_cache",
"os.path.join"
] | [((344, 365), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': '(32)'}), '(maxsize=32)\n', (353, 365), False, 'from functools import lru_cache\n'), ((254, 344), 'os.path.join', 'os.path.join', (['settings.PROJECT_ROOT', '""".."""', '"""pandas_api"""', '"""static"""', '"""mit"""', 'course', 'file'], {}), "(settings.... |
import json
pythonValueDic = {
'name': 'zhangsan',
'isCat': True,
'miceCaught': 0
}
data = json.dumps(pythonValueDic)
print(data)
"""
{"name": "zhangsan", "isCat": true, "miceCaught": 0}
"""
| [
"json.dumps"
] | [((105, 131), 'json.dumps', 'json.dumps', (['pythonValueDic'], {}), '(pythonValueDic)\n', (115, 131), False, 'import json\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.MultiCurrencyMoneyOpenApi import MultiCurrencyMoneyOpenApi
class ApInvoiceBillLinkOrderRequest(object):
def __init__(self):
self._amt = None
self._daily_bill_... | [
"alipay.aop.api.domain.MultiCurrencyMoneyOpenApi.MultiCurrencyMoneyOpenApi.from_alipay_dict"
] | [((601, 650), 'alipay.aop.api.domain.MultiCurrencyMoneyOpenApi.MultiCurrencyMoneyOpenApi.from_alipay_dict', 'MultiCurrencyMoneyOpenApi.from_alipay_dict', (['value'], {}), '(value)\n', (643, 650), False, 'from alipay.aop.api.domain.MultiCurrencyMoneyOpenApi import MultiCurrencyMoneyOpenApi\n')] |
# This sample tests the type checker's handling of ParamSpec
# and Concatenate as described in PEP 612.
from typing import Callable, Concatenate, ParamSpec, TypeVar
P = ParamSpec("P")
R = TypeVar("R")
class Request:
...
def with_request(f: Callable[Concatenate[Request, P], R]) -> Callable[P, R]:
def inner... | [
"typing.ParamSpec",
"typing.TypeVar"
] | [((171, 185), 'typing.ParamSpec', 'ParamSpec', (['"""P"""'], {}), "('P')\n", (180, 185), False, 'from typing import Callable, Concatenate, ParamSpec, TypeVar\n'), ((190, 202), 'typing.TypeVar', 'TypeVar', (['"""R"""'], {}), "('R')\n", (197, 202), False, 'from typing import Callable, Concatenate, ParamSpec, TypeVar\n')] |
import pkg_resources
import unittest
from grip.model import Dependency, Version, Package
class TestDependency(unittest.TestCase):
def test_ctor_str(self):
dep = Dependency('django==2.0')
self.assertEqual(dep.name, 'django')
self.assertTrue(dep.matches_version('2.0'))
self.assertFal... | [
"grip.model.Version",
"grip.model.Package",
"grip.model.Dependency",
"pkg_resources.Requirement"
] | [((175, 200), 'grip.model.Dependency', 'Dependency', (['"""django==2.0"""'], {}), "('django==2.0')\n", (185, 200), False, 'from grip.model import Dependency, Version, Package\n'), ((400, 440), 'pkg_resources.Requirement', 'pkg_resources.Requirement', (['"""django==2.0"""'], {}), "('django==2.0')\n", (425, 440), False, ... |
from flask import Blueprint, Response, request, jsonify
from sqlalchemy import func
from application.database import global_db
from application.helpers import crossdomain, gen_csv_response
from core.monitoring.models import SENSOR_CLASS_MAP
sensor_stat_api_pages = Blueprint('sensor_stat_api', __name__
, template_fol... | [
"sqlalchemy.func.avg",
"flask.Blueprint",
"sqlalchemy.func.count",
"application.helpers.crossdomain"
] | [((267, 362), 'flask.Blueprint', 'Blueprint', (['"""sensor_stat_api"""', '__name__'], {'template_folder': '"""templates"""', 'static_folder': '"""static"""'}), "('sensor_stat_api', __name__, template_folder='templates',\n static_folder='static')\n", (276, 362), False, 'from flask import Blueprint, Response, request,... |
"""docstring for pollsapp tests."""
import datetime
from django.test import TestCase, Client
from django.utils import timezone
from django.urls import reverse
from .models import Question
client = Client()
def create_question(question_text, days):
"""Create a question and add no. of days to now."""
time = ti... | [
"django.utils.timezone.now",
"django.urls.reverse",
"datetime.timedelta",
"django.test.Client"
] | [((198, 206), 'django.test.Client', 'Client', ([], {}), '()\n', (204, 206), False, 'from django.test import TestCase, Client\n'), ((318, 332), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (330, 332), False, 'from django.utils import timezone\n'), ((335, 364), 'datetime.timedelta', 'datetime.timedelta'... |
import json
from django.forms import model_to_dict
from rest_framework import views
from rest_framework import viewsets
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from attendance.models import Attendance
from attendance.models import Event
from attendance.permi... | [
"json.loads",
"members.models.Band.objects.get",
"attendance.models.Attendance.objects.filter",
"members.models.BandMember.objects.get",
"attendance.models.Attendance.objects.create",
"rest_framework.response.Response",
"members.models.Band.objects.all",
"attendance.models.Event.objects.get",
"membe... | [((754, 772), 'members.models.Band.objects.all', 'Band.objects.all', ([], {}), '()\n', (770, 772), False, 'from members.models import Band\n'), ((4454, 4478), 'members.models.BandMember.objects.all', 'BandMember.objects.all', ([], {}), '()\n', (4476, 4478), False, 'from members.models import BandMember\n'), ((1092, 111... |
#-*- coding: utf-8 -*-
import os
from PIL import Image, ImageDraw, ImageEnhance
def denoise(img):
im = Image.open(img)
enhancer = ImageEnhance.Contrast(im)
im = enhancer.enhance(3)
im = im.convert('1')
data = im.getdata()
w, h = im.size
for x in range(1, w-1):
l = []
... | [
"PIL.ImageEnhance.Contrast",
"PIL.Image.open"
] | [((113, 128), 'PIL.Image.open', 'Image.open', (['img'], {}), '(img)\n', (123, 128), False, 'from PIL import Image, ImageDraw, ImageEnhance\n'), ((145, 170), 'PIL.ImageEnhance.Contrast', 'ImageEnhance.Contrast', (['im'], {}), '(im)\n', (166, 170), False, 'from PIL import Image, ImageDraw, ImageEnhance\n')] |
# -*- coding: utf-8 -*-
"""
Functions for mapping AHBA microarray dataset to atlases and and parcellations
in MNI space
"""
from functools import reduce
from nilearn._utils import check_niimg_3d
import numpy as np
import pandas as pd
from scipy.spatial.distance import cdist
from abagen import datasets, io, process, ... | [
"abagen.utils.check_metric",
"abagen.utils.xyz_to_ijk",
"abagen.io.read_probes",
"abagen.process.drop_mismatch_samples",
"numpy.diag",
"numpy.unique",
"pandas.DataFrame",
"abagen.utils.closest_centroid",
"abagen.process.get_stable_probes",
"abagen.process.normalize_expression",
"nilearn._utils.c... | [((1758, 1821), 'abagen.utils.expand_roi', 'utils.expand_roi', (['sample'], {'dilation': 'tolerance', 'return_array': '(True)'}), '(sample, dilation=tolerance, return_array=True)\n', (1774, 1821), False, 'from abagen import datasets, io, process, utils\n'), ((2095, 2135), 'numpy.unique', 'np.unique', (['nz_labels'], {'... |
# coding=utf-8
#
# Copyright (c) 2010-2015 Illumina, Inc.
# All rights reserved.
#
# This file is distributed under the simplified BSD license.
# The full text can be found here (and in LICENSE.txt in the root folder of
# this distribution):
#
# https://github.com/sequencing/licenses/blob/master/Simplified-BSD-License.... | [
"logging.warn",
"tempfile.NamedTemporaryFile",
"subprocess.Popen",
"os.unlink"
] | [((1261, 1302), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'delete': '(False)'}), '(delete=False)\n', (1288, 1302), False, 'import tempfile\n'), ((4904, 5020), 'subprocess.Popen', 'subprocess.Popen', (['("samtools view -H \'%s\'" % bamfile)'], {'shell': '(True)', 'stdout': 'subprocess.PIPE', 's... |
#!/usr/local/bin/python3
import common
import pywikibot
import wikitextparser as parser
from pywikibot import pagegenerators
GAME_MODE_PROP_ID = 'P404'
TEMPLATE = 'Infobox video game'
def main():
site = pywikibot.Site('en', 'wikipedia')
repo = site.data_repository()
temp = pywikibot.Page(site, TEMPLATE, ... | [
"pywikibot.Site",
"pywikibot.Page"
] | [((210, 243), 'pywikibot.Site', 'pywikibot.Site', (['"""en"""', '"""wikipedia"""'], {}), "('en', 'wikipedia')\n", (224, 243), False, 'import pywikibot\n'), ((289, 326), 'pywikibot.Page', 'pywikibot.Page', (['site', 'TEMPLATE'], {'ns': '(10)'}), '(site, TEMPLATE, ns=10)\n', (303, 326), False, 'import pywikibot\n')] |
import gdb
import math
import tempfile
class myst_mprotect_tracker(gdb.Breakpoint):
def __init__(self):
#super(myst_mprotect_tracker, self).__init__('myst_mprotect_ocall', internal=True)
#self.bp = gdb.Breakpoint.__init__(self,'exec.c:637', internal=True)
#self.bp = gdb.Breakpoint.__init__(... | [
"tempfile.NamedTemporaryFile",
"gdb.execute",
"math.ceil",
"gdb.events.exited.connect",
"gdb.parse_and_eval"
] | [((2936, 2975), 'gdb.events.exited.connect', 'gdb.events.exited.connect', (['exit_handler'], {}), '(exit_handler)\n', (2961, 2975), False, 'import gdb\n'), ((3034, 3066), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', (['"""w"""'], {}), "('w')\n", (3061, 3066), False, 'import tempfile\n'), ((3124, 3157),... |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from sample.version import __version__
with open('README.rst') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
with open('requirements.txt') as f:
required = f.read().splitlines()
setup(
name='sample',
vers... | [
"setuptools.find_packages"
] | [((528, 568), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "('tests', 'docs')"}), "(exclude=('tests', 'docs'))\n", (541, 568), False, 'from setuptools import setup, find_packages\n')] |
# -*- coding: utf-8 -*-
"""
存储结果
"""
from sqlalchemy import Column, BigInteger, String, TIMESTAMP, func, Integer, Text
from sqlalchemy.dialects.postgresql import JSONB
from webs.api.models import db
class Result(db.Model):
__tablename__ = 'results'
id = Column(BigInteger, primary_key=True, autoincrement=T... | [
"sqlalchemy.String",
"sqlalchemy.func.now",
"webs.api.models.db_proxy.task_model_proxy.query_task_obj_by_subtask",
"sqlalchemy.Column"
] | [((268, 324), 'sqlalchemy.Column', 'Column', (['BigInteger'], {'primary_key': '(True)', 'autoincrement': '(True)'}), '(BigInteger, primary_key=True, autoincrement=True)\n', (274, 324), False, 'from sqlalchemy import Column, BigInteger, String, TIMESTAMP, func, Integer, Text\n'), ((342, 385), 'sqlalchemy.Column', 'Colum... |
# Generated by Django 3.0.7 on 2021-02-05 09:15
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('panel', '0003_auto_20210205_0955'),
]
operations = [
migrations.CreateModel(
... | [
"django.db.models.CharField",
"django.db.models.DateTimeField",
"django.db.models.ForeignKey",
"django.db.models.AutoField"
] | [((387, 480), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (403, 480), False, 'from django.db import migrations, models\... |
import os
import importlib
import pooch
from pooch import Unzip
from ._spooch import SPATIALPOOCH as _GOODBOY
###########################################################################
allowed_formats = {
"pandas" : False,
"numpy" : False,
"string" : True,
"sedf" : False
}
##########################... | [
"importlib.util.find_spec",
"pandas.DataFrame.spatial.from_featureclass",
"pooch.Unzip",
"os.path.join"
] | [((373, 406), 'importlib.util.find_spec', 'importlib.util.find_spec', (['"""numpy"""'], {}), "('numpy')\n", (397, 406), False, 'import importlib\n'), ((482, 516), 'importlib.util.find_spec', 'importlib.util.find_spec', (['"""pandas"""'], {}), "('pandas')\n", (506, 516), False, 'import importlib\n'), ((594, 628), 'impor... |
import sys
import os
import unittest
from botstory.botclass import BotClass
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
class TestChatbot(unittest.TestCase):
def test_chatbot(self):
chatbot = BotClass()
# Check whether the bot is able to respond to a simple p... | [
"os.path.dirname",
"botstory.botclass.BotClass"
] | [((245, 255), 'botstory.botclass.BotClass', 'BotClass', ([], {}), '()\n', (253, 255), False, 'from botstory.botclass import BotClass\n'), ((125, 150), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (140, 150), False, 'import os\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
# CODE DESCRIPTION HERE
Created on 2019-03-05 16:38
@author: ncook
Version 0.0.1
"""
import numpy as np
import os
from apero import core
from apero import lang
from apero.core import constants
from apero.science import preprocessing as pp
from apero.io import drs_im... | [
"apero.core.setup",
"apero.science.preprocessing.median_one_over_f_noise",
"apero.science.preprocessing.correct_top_bottom",
"apero.core.run",
"apero.science.preprocessing.quality_control",
"apero.science.preprocessing.get_hot_pixels",
"apero.io.drs_image.rotate_image",
"os.path.exists",
"apero.io.d... | [((686, 716), 'apero.core.constants.load', 'constants.load', (['__INSTRUMENT__'], {}), '(__INSTRUMENT__)\n', (700, 716), False, 'from apero.core import constants\n'), ((2269, 2314), 'apero.core.setup', 'core.setup', (['__NAME__', '__INSTRUMENT__', 'fkwargs'], {}), '(__NAME__, __INSTRUMENT__, fkwargs)\n', (2279, 2314), ... |
from typing import Dict, List, Tuple, Union, Callable, Set, cast
import random
import math
import time
def _bra (lst : List[int], beta : float = 0.3) -> int:
"""
The estraction of an item from a list, by using a biased randomisation based
on a quasi-geometric distribution (i.e. f(x) = (1-beta)^x)... | [
"math.exp",
"random.shuffle",
"time.time",
"random.random",
"math.log"
] | [((2424, 2444), 'math.exp', 'math.exp', (['(-alpha * x)'], {}), '(-alpha * x)\n', (2432, 2444), False, 'import math\n'), ((1867, 1890), 'math.log', 'math.log', (['(max_v + min_v)'], {}), '(max_v + min_v)\n', (1875, 1890), False, 'import math\n'), ((6090, 6118), 'random.shuffle', 'random.shuffle', (['self.current'], {})... |
# -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2021 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or modify it under
# the t... | [
"nicos.core.Attach",
"nicos.core.Override"
] | [((1414, 1444), 'nicos.core.Override', 'Override', ([], {'default': '"""treff_fast"""'}), "(default='treff_fast')\n", (1422, 1444), False, 'from nicos.core import Attach, Override, Readable\n'), ((1496, 1533), 'nicos.core.Attach', 'Attach', (['"""Mirror sample"""', 'MirrorSample'], {}), "('Mirror sample', MirrorSample)... |
# Django
from django.contrib.auth import login
# Third Party
import requests
# SquareletAuth
from squarelet_auth.users.utils import squarelet_update_or_create
from squarelet_auth.utils import squarelet_post
class MiniregMixin:
"""A mixin to expose miniregister functionality to a view"""
minireg_source = "D... | [
"django.contrib.auth.login",
"squarelet_auth.users.utils.squarelet_update_or_create",
"squarelet_auth.utils.squarelet_post"
] | [((1576, 1632), 'squarelet_auth.users.utils.squarelet_update_or_create', 'squarelet_update_or_create', (["user_json['uuid']", 'user_json'], {}), "(user_json['uuid'], user_json)\n", (1602, 1632), False, 'from squarelet_auth.users.utils import squarelet_update_or_create\n'), ((1641, 1718), 'django.contrib.auth.login', 'l... |
import argparse
def opts():
parser = argparse.ArgumentParser(description='Train alexnet on the cub200 dataset',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--data_path_source', type=str, default='',
help='Root of tra... | [
"argparse.ArgumentParser"
] | [((43, 177), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Train alexnet on the cub200 dataset"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description='Train alexnet on the cub200 dataset',\n formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n", (66, 1... |
#%%
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import datasets, linear_model, metrics, preprocessing
from sklearn.model_selection import train_test_split
import itertools
import typing
class LinearRegression():
def __init__(self, n_features, optimiser):
np.random.se... | [
"numpy.random.seed",
"sklearn.preprocessing.StandardScaler",
"matplotlib.pyplot.plot",
"numpy.random.randn",
"matplotlib.pyplot.show",
"sklearn.model_selection.train_test_split",
"numpy.sum",
"sklearn.datasets.fetch_california_housing",
"numpy.append",
"matplotlib.pyplot.figure",
"numpy.mean",
... | [((3275, 3292), 'numpy.random.seed', 'np.random.seed', (['(2)'], {}), '(2)\n', (3289, 3292), True, 'import numpy as np\n'), ((3300, 3350), 'sklearn.datasets.fetch_california_housing', 'datasets.fetch_california_housing', ([], {'return_X_y': '(True)'}), '(return_X_y=True)\n', (3333, 3350), False, 'from sklearn import da... |
#----------------------------------------------------------------------------#
# Imports
#----------------------------------------------------------------------------#
from flask import Flask, redirect, render_template, request, url_for
import logging
from logging import Formatter, FileHandler
from forms import *
impo... | [
"logging.FileHandler",
"flask.Flask",
"logging.Formatter",
"flask.url_for",
"flask.render_template"
] | [((590, 605), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (595, 605), False, 'from flask import Flask, redirect, render_template, request, url_for\n'), ((968, 1002), 'flask.render_template', 'render_template', (['"""pages/home.html"""'], {}), "('pages/home.html')\n", (983, 1002), False, 'from flask impo... |
import os
from falcon import falcon
from settings.settings import SETTINGS
from chameleon import PageTemplateLoader
class BasePage(object):
"""
Generic base page object
"""
model = None
property_types = []
default_404 = SETTINGS['VIEWS']['DEFAULT_404_TEMPLATE']
templates_dir = 'templates... | [
"os.path.abspath",
"chameleon.PageTemplateLoader"
] | [((709, 739), 'os.path.abspath', 'os.path.abspath', (['base_dir_path'], {}), '(base_dir_path)\n', (724, 739), False, 'import os\n'), ((755, 783), 'chameleon.PageTemplateLoader', 'PageTemplateLoader', (['app_path'], {}), '(app_path)\n', (773, 783), False, 'from chameleon import PageTemplateLoader\n')] |
import matplotlib.pyplot as plt
import random
if __name__ == '__main__':
random.seed(9)
length = 100
A = 5
B = .2
C = 1
trend = [A + B * i for i in range(length)]
noise = []
for i in range(length):
if 65 <= i <= 75:
noise.append(7 * C * random.gauss(0, 1))
... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.axvspan",
"random.seed",
"random.gauss",
"matplotlib.pyplot.xticks"
] | [((79, 93), 'random.seed', 'random.seed', (['(9)'], {}), '(9)\n', (90, 93), False, 'import random\n'), ((495, 507), 'matplotlib.pyplot.plot', 'plt.plot', (['ts'], {}), '(ts)\n', (503, 507), True, 'import matplotlib.pyplot as plt\n'), ((512, 526), 'matplotlib.pyplot.xticks', 'plt.xticks', (['[]'], {}), '([])\n', (522, 5... |
import random
import re
import time
from itertools import combinations
import z3
from forest.logger import get_logger
from forest.utils import check_conditions
from forest.visitor import ToZ3, RegexInterpreter
logger = get_logger('forest')
use_derivatives = True
# z3.set_param('smt.string_solver', 'z3str3')
class... | [
"re.fullmatch",
"z3.Xor",
"random.shuffle",
"z3.Optimize",
"forest.visitor.RegexInterpreter",
"z3.String",
"time.time",
"itertools.combinations",
"random.seed",
"z3.Solver",
"forest.visitor.ToZ3",
"z3.Or",
"z3.StringVal",
"z3.InRe",
"forest.logger.get_logger",
"z3.Bool",
"forest.util... | [((222, 242), 'forest.logger.get_logger', 'get_logger', (['"""forest"""'], {}), "('forest')\n", (232, 242), False, 'from forest.logger import get_logger\n'), ((386, 392), 'forest.visitor.ToZ3', 'ToZ3', ([], {}), '()\n', (390, 392), False, 'from forest.visitor import ToZ3, RegexInterpreter\n'), ((417, 435), 'forest.visi... |
import uuid
from datetime import date
import os
import humanize
class Context:
def __init__(self, function_name, function_version):
self.function_name = function_name
self.function_version = function_version
self.invoked_function_arn = "arn:aws:lambda:eu-north-1:000000000000:function:{}".f... | [
"uuid.uuid1",
"os.popen",
"datetime.date.today",
"humanize.naturalsize"
] | [((376, 388), 'uuid.uuid1', 'uuid.uuid1', ([], {}), '()\n', (386, 388), False, 'import uuid\n'), ((479, 491), 'datetime.date.today', 'date.today', ([], {}), '()\n', (489, 491), False, 'from datetime import date\n'), ((834, 869), 'humanize.naturalsize', 'humanize.naturalsize', (['mem'], {'gnu': '(True)'}), '(mem, gnu=Tr... |
# python3
#import sys
#sys.path.append('/spherov2/')
import time
from spherov2 import scanner
from spherov2.sphero_edu import EventType, SpheroEduAPI
from spherov2.types import Color
print("Testing Starting...")
print("Connecting to Bolt...")
toy = scanner.find_BOLT()
if toy is not None:
print("Connected.")
... | [
"spherov2.sphero_edu.SpheroEduAPI",
"spherov2.scanner.find_BOLT",
"spherov2.types.Color"
] | [((252, 271), 'spherov2.scanner.find_BOLT', 'scanner.find_BOLT', ([], {}), '()\n', (269, 271), False, 'from spherov2 import scanner\n'), ((326, 343), 'spherov2.sphero_edu.SpheroEduAPI', 'SpheroEduAPI', (['toy'], {}), '(toy)\n', (338, 343), False, 'from spherov2.sphero_edu import EventType, SpheroEduAPI\n'), ((415, 437)... |
import hashlib
import json
import sys
import time
from random import random
def custom_print(*args, sep=' ', end='\n', file=None):
"""
print补丁
:param x:
:return:
"""
# 获取被调用函数在被调用时所处代码行数
line = sys._getframe().f_back.f_lineno
# 获取被调用函数所在模块文件名
# file_name = sys._getframe(1).f_code.co_... | [
"random.random",
"json.load",
"sys._getframe",
"time.time"
] | [((621, 632), 'time.time', 'time.time', ([], {}), '()\n', (630, 632), False, 'import time\n'), ((1035, 1048), 'json.load', 'json.load', (['f1'], {}), '(f1)\n', (1044, 1048), False, 'import json\n'), ((1990, 2002), 'json.load', 'json.load', (['f'], {}), '(f)\n', (1999, 2002), False, 'import json\n'), ((2090, 2103), 'jso... |
# <NAME> and <NAME>
# Created: 6/05/2013
# Last Updated: 6/14/2013
# For JCAP
import numpy as np
from PyQt4 import QtCore
from dictionary_helpers import *
import date_helpers
import filename_handler
import datareader
# global dictionary holds all processed (z, x, y, rate) data for the experiment
DEP_DATA = []
zndec ... | [
"date_helpers.dateObjFloat",
"numpy.sin",
"numpy.array",
"datareader.DataReader",
"numpy.cos",
"numpy.round",
"PyQt4.QtCore.pyqtSignal"
] | [((538, 561), 'PyQt4.QtCore.pyqtSignal', 'QtCore.pyqtSignal', (['list'], {}), '(list)\n', (555, 561), False, 'from PyQt4 import QtCore\n'), ((631, 655), 'PyQt4.QtCore.pyqtSignal', 'QtCore.pyqtSignal', (['tuple'], {}), '(tuple)\n', (648, 655), False, 'from PyQt4 import QtCore\n'), ((671, 693), 'PyQt4.QtCore.pyqtSignal',... |
from __future__ import print_function
import numpy as np
from ._PLSbase import plsbase as pls_base
from .utilities import nanmatprod, isValid
from .engines import pls as pls_engine
class pls(pls_base):
"""
This is the classic multivariate NIPALS PLS algorithm.
Parameters:
X: {N, P} array like
... | [
"numpy.nansum",
"numpy.sum",
"numpy.power",
"numpy.square",
"numpy.isnan",
"numpy.linalg.inv"
] | [((2506, 2538), 'numpy.linalg.inv', 'np.linalg.inv', (['(self.P.T @ self.W)'], {}), '(self.P.T @ self.W)\n', (2519, 2538), True, 'import numpy as np\n'), ((3002, 3035), 'numpy.power', 'np.power', (['self.Xstd', 'self.scaling'], {}), '(self.Xstd, self.scaling)\n', (3010, 3035), True, 'import numpy as np\n'), ((3285, 330... |
import os
import shutil
from typing import List, Tuple
import unittest
from google.protobuf import json_format
from mir.commands import exporting
from mir.protos import mir_command_pb2 as mirpb
from mir.tools import hash_utils, mir_storage_ops
from mir.tools.code import MirCode
from tests import utils as test_utils
... | [
"tests.utils.mir_repo_init",
"shutil.rmtree",
"os.path.isdir",
"mir.protos.mir_command_pb2.MirMetadatas",
"tests.utils.prepare_labels",
"mir.protos.mir_command_pb2.MirAnnotations",
"google.protobuf.json_format.ParseDict",
"tests.utils.remake_dirs",
"mir.tools.mir_storage_ops.create_task",
"mir.too... | [((585, 633), 'os.path.join', 'os.path.join', (['self._test_root', '"""assets_location"""'], {}), "(self._test_root, 'assets_location')\n", (597, 633), False, 'import os\n'), ((660, 704), 'os.path.join', 'os.path.join', (['self._test_root', '"""export_dest"""'], {}), "(self._test_root, 'export_dest')\n", (672, 704), Fa... |
from numpy import *
import joelib.constants.constants as cts
from joelib.physics.synchrotron_afterglow import *
from scipy.stats import binned_statistic
from scipy.interpolate import interp1d
from tqdm import tqdm
class jetHeadUD(adiabatic_afterglow):
###################################################... | [
"scipy.interpolate.interp1d",
"tqdm.tqdm"
] | [((7054, 7082), 'scipy.interpolate.interp1d', 'interp1d', (['self.RRs', 'self.TTs'], {}), '(self.RRs, self.TTs)\n', (7062, 7082), False, 'from scipy.interpolate import interp1d\n'), ((7511, 7536), 'scipy.interpolate.interp1d', 'interp1d', (['ttobs', 'self.RRs'], {}), '(ttobs, self.RRs)\n', (7519, 7536), False, 'from sc... |
#!/usr/bin/env python
import pika
import sys
import time
import datetime
import subprocess
import random
import threading
import requests
import json
from command_args import get_args, get_mandatory_arg, get_optional_arg, is_true, get_optional_arg_validated
from RabbitPublisher import RabbitPublisher
from MultiTopicCo... | [
"threading.Thread",
"printer.console_out",
"random.randint",
"ConsumerManager.ConsumerManager",
"ChaosExecutor.ChaosExecutor",
"command_args.get_args",
"time.sleep",
"command_args.get_optional_arg",
"BrokerManager.BrokerManager",
"command_args.get_optional_arg_validated",
"subprocess.call",
"M... | [((643, 661), 'command_args.get_args', 'get_args', (['sys.argv'], {}), '(sys.argv)\n', (651, 661), False, 'from command_args import get_args, get_mandatory_arg, get_optional_arg, is_true, get_optional_arg_validated\n'), ((961, 1001), 'command_args.get_optional_arg', 'get_optional_arg', (['args', '"""--cluster"""', '"""... |
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'sigi_op.settings'
import django
django.setup()
from django.contrib.auth.management.commands.createsuperuser import get_user_model
if get_user_model().objects.filter(username='admin'):
print("Super user already created")
else:
get_user_model()._default_manager.... | [
"django.setup",
"django.contrib.auth.management.commands.createsuperuser.get_user_model"
] | [((82, 96), 'django.setup', 'django.setup', ([], {}), '()\n', (94, 96), False, 'import django\n'), ((184, 200), 'django.contrib.auth.management.commands.createsuperuser.get_user_model', 'get_user_model', ([], {}), '()\n', (198, 200), False, 'from django.contrib.auth.management.commands.createsuperuser import get_user_m... |
import os, shutil
from distutils.dir_util import copy_tree
import numpy as np
import shutil
path = "dataset"
split_path = "dataset_splits"
all_paths = []
for folder in os.listdir(split_path):
folder_path = os.path.join(split_path, folder)
print(folder_path)
for project_folder in os.listdir(folder_path):
# print... | [
"os.path.join",
"os.listdir",
"shutil.move"
] | [((171, 193), 'os.listdir', 'os.listdir', (['split_path'], {}), '(split_path)\n', (181, 193), False, 'import os, shutil\n'), ((210, 242), 'os.path.join', 'os.path.join', (['split_path', 'folder'], {}), '(split_path, folder)\n', (222, 242), False, 'import os, shutil\n'), ((286, 309), 'os.listdir', 'os.listdir', (['folde... |
import os
import sqlite3
from tkinter import *
from tkinter import simpledialog
from tkinter import ttk
from PIL import Image, ImageTk
from DetailsPage import DetailsPage
import constants
from datetime import datetime
import tkinter.filedialog
from tkinter import messagebox
import xlwt
class HistoryPage... | [
"DetailsPage.DetailsPage",
"tkinter.ttk.Entry",
"xlwt.Workbook",
"tkinter.ttk.Scrollbar",
"os.getcwd",
"xlwt.easyxf",
"tkinter.ttk.Style",
"tkinter.ttk.Combobox",
"tkinter.simpledialog.askstring",
"sqlite3.connect",
"tkinter.ttk.Treeview",
"tkinter.ttk.Button",
"datetime.datetime.now"
] | [((504, 515), 'tkinter.ttk.Style', 'ttk.Style', ([], {}), '()\n', (513, 515), False, 'from tkinter import ttk\n'), ((952, 963), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (961, 963), False, 'import os\n'), ((1041, 1064), 'sqlite3.connect', 'sqlite3.connect', (['parDir'], {}), '(parDir)\n', (1056, 1064), False, 'import... |
from core import run_casper,save_db,load_db
from datetime import datetime,timedelta
import logging
log = logging.getLogger('ali-module')
list_js="ali/get_order_list.js"
order_js="ali/get_order.js"
confirm_js="ali/confirm_order.js"
login_js="ali/login.js"
order_url="http://trade.aliexpress.com/order_detail.htm?orderId... | [
"datetime.timedelta",
"datetime.datetime.now",
"core.run_casper",
"logging.getLogger"
] | [((106, 137), 'logging.getLogger', 'logging.getLogger', (['"""ali-module"""'], {}), "('ali-module')\n", (123, 137), False, 'import logging\n'), ((789, 818), 'core.run_casper', 'run_casper', (['order_js', '[ident]'], {}), '(order_js, [ident])\n', (799, 818), False, 'from core import run_casper, save_db, load_db\n'), ((1... |
#Amtrak Recursive ROute Writer (ARROW)
#cont- does not write initial .npz file, relies on existing partials
def main(newdata=False,
cont=False,
newredund=False,
arrive=True):
import json
import numpy as np
import os
import route_builder
import glob
import find_redunda... | [
"numpy.load",
"json.load",
"numpy.save",
"os.remove",
"numpy.append",
"os.path.isfile",
"numpy.array",
"glob.glob",
"find_redundancy.main",
"numpy.savez",
"route_builder.main"
] | [((1579, 1602), 'numpy.array', 'np.array', (['[]'], {'dtype': 'int'}), '([], dtype=int)\n', (1587, 1602), True, 'import numpy as np\n'), ((1621, 1644), 'numpy.array', 'np.array', (['[]'], {'dtype': 'int'}), '([], dtype=int)\n', (1629, 1644), True, 'import numpy as np\n'), ((1663, 1686), 'numpy.array', 'np.array', (['[]... |
from google.appengine.ext import ndb
class Dog(ndb.Model):
name = ndb.StringProperty()
breed = ndb.StringProperty()
gender = ndb.StringProperty()
age = ndb.StringProperty()
size = ndb.StringProperty()
socialLevel = ndb.StringProperty()
activityLevel = ndb.StringProperty()
profilePic = n... | [
"google.appengine.ext.ndb.BlobProperty",
"google.appengine.ext.ndb.IntegerProperty",
"google.appengine.ext.ndb.StringProperty",
"google.appengine.ext.ndb.KeyProperty"
] | [((71, 91), 'google.appengine.ext.ndb.StringProperty', 'ndb.StringProperty', ([], {}), '()\n', (89, 91), False, 'from google.appengine.ext import ndb\n'), ((104, 124), 'google.appengine.ext.ndb.StringProperty', 'ndb.StringProperty', ([], {}), '()\n', (122, 124), False, 'from google.appengine.ext import ndb\n'), ((138, ... |
import argparse
import inspect
import logging
import logging.config
import os
import pkgutil
import sys
from aiokts.managecommands import Command
from aiokts.store import Store
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(CURRENT_DIR)
class BaseManage(object):
commands_package_path =... | [
"sys.path.append",
"os.path.abspath",
"logging.error",
"argparse.ArgumentParser",
"inspect.getfile",
"pkgutil.iter_modules",
"logging.getLogger"
] | [((236, 264), 'sys.path.append', 'sys.path.append', (['CURRENT_DIR'], {}), '(CURRENT_DIR)\n', (251, 264), False, 'import sys\n'), ((209, 234), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (224, 234), False, 'import os\n'), ((2859, 2884), 'argparse.ArgumentParser', 'argparse.ArgumentParser',... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Setup file for ggcq.
This file was generated with PyScaffold 1.2, a tool that easily
puts up a scaffold for your new Python project. Learn more under:
http://pyscaffold.readthedocs.org/
"""
import inspect
import os
import sys
from distutils.cmd import ... | [
"versioneer.get_version",
"setuptools.find_packages",
"os.getcwd",
"shlex.split",
"sphinx.setup_command.BuildDoc.run",
"versioneer.get_cmdclass",
"six.add_metaclass",
"inspect.getmodule",
"setuptools.command.test.test.finalize_options",
"inspect.currentframe",
"os.path.join",
"setuptools.comma... | [((1536, 1577), 'os.path.join', 'os.path.join', (['MAIN_PACKAGE', '"""_version.py"""'], {}), "(MAIN_PACKAGE, '_version.py')\n", (1548, 1577), False, 'import os\n'), ((1609, 1650), 'os.path.join', 'os.path.join', (['MAIN_PACKAGE', '"""_version.py"""'], {}), "(MAIN_PACKAGE, '_version.py')\n", (1621, 1650), False, 'import... |
# coding: utf-8
import logging
import sys
from flask.logging import default_handler
default_formatter = '%(asctime)s %(process)d,%(threadName)s %(filename)s:%(lineno)d [%(levelname)s] %(message)s'
def configure_logging(app):
# handler = None
if app.debug:
handler = logging.StreamHandler(sys.stdout)
... | [
"logging.Formatter",
"logging.StreamHandler",
"logging.handlers.TimedRotatingFileHandler"
] | [((286, 319), 'logging.StreamHandler', 'logging.StreamHandler', (['sys.stdout'], {}), '(sys.stdout)\n', (307, 319), False, 'import logging\n'), ((389, 450), 'logging.handlers.TimedRotatingFileHandler', 'logging.handlers.TimedRotatingFileHandler', (['filename'], {'when': '"""D"""'}), "(filename, when='D')\n", (430, 450)... |
import json
from discord.ext import commands
import discord
import os
with open('config.json') as configFile:
configs = json.load(configFile)
prefix = configs.get('prefix_list')[0]
class Setup(commands.Cog, description='Used to set up the bot for welcome messages, mute/unmute etc.'):
def __init__(self,... | [
"json.dump",
"json.load",
"discord.ext.commands.command",
"discord.ext.commands.has_permissions",
"discord.Color.random",
"os.path.exists",
"discord.ext.commands.guild_only"
] | [((127, 148), 'json.load', 'json.load', (['configFile'], {}), '(configFile)\n', (136, 148), False, 'import json\n'), ((356, 553), 'discord.ext.commands.command', 'commands.command', ([], {'name': '"""setup"""', 'description': '"""Used to set the bot up, for welcome messages, mute roles, etc.\nRecommended to set the bot... |
#!/usr/bin/env python
"""
OXASL - Bayesian model fitting for ASL
The BASIL module is a little more complex than the other Workspace based
modules because of the number of options available and the need for flexibility
in how the modelling steps are run.
The main function is ``basil`` which performs model fitting on A... | [
"oxasl.image.AslImageOptions",
"numpy.copy",
"math.sqrt",
"oxasl.options.OptionGroup",
"numpy.ones",
"fsl.data.image.Image",
"numpy.amax",
"sys.stderr.write",
"numpy.mean",
"numpy.array",
"oxasl.reg.change_space",
"oxasl.options.AslOptionParser",
"oxasl.options.GenericOptions",
"sys.exit",... | [((9452, 9497), 'fsl.data.image.Image', 'Image', (['tis_arr'], {'header': "options['data'].header"}), "(tis_arr, header=options['data'].header)\n", (9457, 9497), False, 'from fsl.data.image import Image\n'), ((14347, 14368), 'numpy.copy', 'np.copy', (['pgm_img.data'], {}), '(pgm_img.data)\n', (14354, 14368), True, 'imp... |
from typing import Optional, TYPE_CHECKING
import wx
if TYPE_CHECKING:
from gui.pane import FunctionPane
# noinspection PyPep8Naming
class ArrayControl(wx.ComboBox):
# noinspection PyShadowingBuiltins
def __init__(self, parent, id):
from functions import Function
choices = list(Function.g... | [
"functions.Function.get_all_vars"
] | [((310, 333), 'functions.Function.get_all_vars', 'Function.get_all_vars', ([], {}), '()\n', (331, 333), False, 'from functions import Function\n')] |
import sys
import csv
import datetime
import time
import argparse
from subprocess import Popen, PIPE
class Watcher:
def __init__(self, cmd, time_interval, filename):
self.cmd = cmd
self.time_interval = time_interval
self.filename = filename
self.outputfile = open(filename, 'w')
... | [
"subprocess.Popen",
"csv.writer",
"argparse.ArgumentParser",
"time.sleep",
"sys.stderr.write",
"datetime.datetime.now",
"sys.exit"
] | [((1891, 1977), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Monitoring of a command memory consumption"""'}), "(description=\n 'Monitoring of a command memory consumption')\n", (1914, 1977), False, 'import argparse\n'), ((339, 366), 'csv.writer', 'csv.writer', (['self.outputfile'],... |
from django.db import models
# Create your models here.
class ticket(models.Model):
timestamp = models.DateField(auto_now_add=True,auto_now=False,)
tech = models.CharField(max_length=50,)
site = models.CharField(max_length=50,)
user = models.CharField(max_length=50,)
issue = models.CharField(max_le... | [
"django.db.models.DateField",
"django.db.models.CharField",
"django.db.models.BooleanField",
"django.db.models.AutoField"
] | [((101, 152), 'django.db.models.DateField', 'models.DateField', ([], {'auto_now_add': '(True)', 'auto_now': '(False)'}), '(auto_now_add=True, auto_now=False)\n', (117, 152), False, 'from django.db import models\n'), ((164, 195), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_lengt... |
import torch
from vietocr.tool.config import Cfg
from vietocr.tool.predictor import Predictor
import configs as cf
from models.saliency.u2net import U2NETP
from backend.text_detect.craft_utils import get_detector
def load_text_detect():
text_detector = get_detector(cf.text_detection_weights_path, cf.device)
... | [
"vietocr.tool.predictor.Predictor",
"torch.load",
"vietocr.tool.config.Cfg.load_config_from_name",
"backend.text_detect.craft_utils.get_detector",
"models.saliency.u2net.U2NETP"
] | [((260, 315), 'backend.text_detect.craft_utils.get_detector', 'get_detector', (['cf.text_detection_weights_path', 'cf.device'], {}), '(cf.text_detection_weights_path, cf.device)\n', (272, 315), False, 'from backend.text_detect.craft_utils import get_detector\n'), ((374, 386), 'models.saliency.u2net.U2NETP', 'U2NETP', (... |