code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import torch
import torch.nn as nn
import numpy as np
from sklearn import datasets
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
class LogisticRegression(nn.Module):
def __init__(self, n_input_features):
super(Logis... | [
"sklearn.model_selection.train_test_split",
"sklearn.datasets.load_breast_cancer",
"sklearn.preprocessing.StandardScaler",
"torch.nn.BCELoss",
"torch.nn.Linear",
"torch.no_grad"
] | [((558, 587), 'sklearn.datasets.load_breast_cancer', 'datasets.load_breast_cancer', ([], {}), '()\n', (585, 587), False, 'from sklearn import datasets\n'), ((695, 751), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.2)', 'random_state': '(1234)'}), '(X, y, test_size=0.2, ... |
from pyqchem.structure import Structure
import numpy as np
# Ethene parallel position
def dimer_ethene(distance, slide_y, slide_z):
coordinates = [[0.0000000, 0.0000000, 0.6660120],
[0.0000000, 0.0000000, -0.6660120],
[0.0000000, 0.9228100, 1.2279200],
... | [
"numpy.array",
"pyqchem.structure.Structure",
"numpy.vstack"
] | [((826, 847), 'numpy.array', 'np.array', (['coordinates'], {}), '(coordinates)\n', (834, 847), True, 'import numpy as np\n'), ((1048, 1109), 'pyqchem.structure.Structure', 'Structure', ([], {'coordinates': 'coordinates', 'symbols': 'symbols', 'charge': '(0)'}), '(coordinates=coordinates, symbols=symbols, charge=0)\n', ... |
#!/usr/bin/env python3
"""
Adaptive Affine Control:
My favorite myopic (not MPC, DP, or RL) control-law when absolutely nothing is known about your system except
that the control is additive and fully-actuated:
```
dx/dt = f(x,t) + u # drift f unknown, state x at time t known, choose control u to make x=r
u = W... | [
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.zeros",
"numpy.outer",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((1963, 1986), 'numpy.arange', 'np.arange', (['(0.0)', '(3.0)', 'dt'], {}), '(0.0, 3.0, dt)\n', (1972, 1986), True, 'import numpy as np\n'), ((2473, 2488), 'matplotlib.pyplot.figure', 'pyplot.figure', ([], {}), '()\n', (2486, 2488), False, 'from matplotlib import pyplot\n'), ((3051, 3064), 'matplotlib.pyplot.show', 'p... |
"""MongoDB instance classes and logic."""
import datetime
import json
import logging
import time
import pymongo
import requests
from concurrent import futures
from distutils.version import LooseVersion
from objectrocket import bases
from objectrocket import util
logger = logging.getLogger(__name__)
class MongodbI... | [
"logging.getLogger",
"json.loads",
"requests.post",
"json.dumps",
"requests.get",
"time.sleep",
"concurrent.futures.wait",
"pymongo.MongoClient",
"datetime.timedelta"
] | [((276, 303), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (293, 303), False, 'import logging\n'), ((10249, 10309), 'requests.get', 'requests.get', (['url'], {}), '(url, **self._instances._default_request_kwargs)\n', (10261, 10309), False, 'import requests\n'), ((11310, 11336), 'datetim... |
from springleaf.utils.file_handler import FileHandler
from springleaf.utils.template_util import TemplateUtil
from .base_generator import BaseGenerator
class Generator(BaseGenerator):
def __init__(self, selected_file, files_to_create, attributes, structure):
super().__init__()
self.file = select... | [
"springleaf.utils.file_handler.FileHandler.get_from_config_file",
"springleaf.utils.file_handler.FileHandler.get_project_structure_content"
] | [((787, 830), 'springleaf.utils.file_handler.FileHandler.get_from_config_file', 'FileHandler.get_from_config_file', (['"""package"""'], {}), "('package')\n", (819, 830), False, 'from springleaf.utils.file_handler import FileHandler\n'), ((968, 1011), 'springleaf.utils.file_handler.FileHandler.get_from_config_file', 'Fi... |
from mpd_connection import MPDConnection
from processing_metadata import process_metadata, join_metadata
from lastfm_api import LastFmMetadataGetter, LastFmApiException
from multiprocessing.managers import SyncManager
from multiprocessing import Event
import time
# Shared objects
shared_song_metadata = {}
shared_mpd_s... | [
"multiprocessing.managers.SyncManager.register",
"multiprocessing.Event",
"lastfm_api.LastFmMetadataGetter",
"processing_metadata.join_metadata",
"time.sleep",
"mpd_connection.MPDConnection",
"multiprocessing.managers.SyncManager",
"processing_metadata.process_metadata"
] | [((383, 390), 'multiprocessing.Event', 'Event', ([], {}), '()\n', (388, 390), False, 'from multiprocessing import Event\n'), ((433, 440), 'multiprocessing.Event', 'Event', ([], {}), '()\n', (438, 440), False, 'from multiprocessing import Event\n'), ((467, 474), 'multiprocessing.Event', 'Event', ([], {}), '()\n', (472, ... |
#!/usr/bin/env python
import rospy
import tf
from nav_msgs.msg import Odometry
import numpy as np
import sys
import math
def qv_mult(q, v):
v_unit = None
if v == [0, 0, 0]: v_unit = [0.0, 0.0, 0.0]
else: v_unit = tf.transformations.unit_vector(v)
qp = list(v_unit)
qp.append(0.0)
return t... | [
"tf.transformations.unit_vector",
"tf.transformations.quaternion_multiply",
"rospy.Publisher",
"rospy.logfatal",
"rospy.signal_shutdown",
"rospy.init_node",
"rospy.myargv",
"rospy.spin",
"tf.transformations.quaternion_conjugate",
"rospy.Subscriber"
] | [((3337, 3370), 'rospy.init_node', 'rospy.init_node', (['"""odom_transform"""'], {}), "('odom_transform')\n", (3352, 3370), False, 'import rospy\n'), ((3583, 3610), 'rospy.myargv', 'rospy.myargv', ([], {'argv': 'sys.argv'}), '(argv=sys.argv)\n', (3595, 3610), False, 'import rospy\n'), ((3818, 3830), 'rospy.spin', 'rosp... |
from json import load, dumps
REPORT_FILE = "report.txt"
with open(REPORT_FILE, "r") as file:
data = load(file)
# EXAMPLE ON ACESSING THE JSON DATA REPORT
print(dumps(data["INTERFACES_INFO"]["Ethernet adapter Ethernet"], indent=4))
print(dumps(data["INTERFACES_INFO"]["Ethernet adapter Ethernet"]["IPv4 ... | [
"json.load",
"json.dumps"
] | [((113, 123), 'json.load', 'load', (['file'], {}), '(file)\n', (117, 123), False, 'from json import load, dumps\n'), ((177, 246), 'json.dumps', 'dumps', (["data['INTERFACES_INFO']['Ethernet adapter Ethernet']"], {'indent': '(4)'}), "(data['INTERFACES_INFO']['Ethernet adapter Ethernet'], indent=4)\n", (182, 246), False,... |
"""
This is a stub and used as the default processor.
It doesn't do anything but it can be used to build out another
interface.
See the authorizenet module for the reference implementation
"""
from django.utils.translation import ugettext_lazy as _
from payment.modules.base import BasePaymentProcessor, ProcessorResult... | [
"django.utils.translation.ugettext_lazy"
] | [((1820, 1832), 'django.utils.translation.ugettext_lazy', '_', (['"""Success"""'], {}), "('Success')\n", (1821, 1832), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((2647, 2659), 'django.utils.translation.ugettext_lazy', '_', (['"""Success"""'], {}), "('Success')\n", (2648, 2659), True, 'from dja... |
"""Manage the directories
This includes options to store the hashtable in a file or keep
it temporarily, where it will be returned from the function...
"""
import json
import os
import platform
from typing import Tuple, Union
from .errors import FilenameError, PathError, SystemNotSupported
__all__ = [
"set_dire... | [
"json.dumps",
"os.getcwd",
"platform.system",
"os.path.isdir",
"os.mkdir"
] | [((467, 478), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (476, 478), False, 'import os\n'), ((6132, 6156), 'os.path.isdir', 'os.path.isdir', (['directory'], {}), '(directory)\n', (6145, 6156), False, 'import os\n'), ((3201, 3218), 'platform.system', 'platform.system', ([], {}), '()\n', (3216, 3218), False, 'import pla... |
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException, TimeoutException
from enum import Enum
import re
import os
f... | [
"selenium.webdriver.ChromeOptions",
"autohandshake.src.exceptions.InvalidURLError",
"selenium.webdriver.support.expected_conditions.invisibility_of_element_located",
"selenium.webdriver.support.ui.WebDriverWait",
"autohandshake.src.exceptions.NoSuchElementError",
"selenium.webdriver.Chrome",
"os.path.jo... | [((2670, 2695), 'selenium.webdriver.ChromeOptions', 'webdriver.ChromeOptions', ([], {}), '()\n', (2693, 2695), False, 'from selenium import webdriver\n'), ((2895, 2920), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (2910, 2920), False, 'import os\n'), ((3056, 3124), 'selenium.webdriver.Chro... |
################################################################################
#
# Provide embeddings from raw audio with the wav2vec2 model from huggingface.
#
# Author(s): <NAME>
################################################################################
from typing import Optional, List
import torch as t
im... | [
"torch.nn.parameter.Parameter",
"torch.LongTensor",
"torch.Tensor",
"src.networks.wav2vec2_components.base_components.retrieve_pretrained_wav2vec2_config",
"src.util.torch.reset_model",
"torch.cat",
"torch.ones"
] | [((6645, 6694), 'torch.ones', 't.ones', (['(bs, max_num_audio_samples)'], {'dtype': 't.long'}), '((bs, max_num_audio_samples), dtype=t.long)\n', (6651, 6694), True, 'import torch as t\n'), ((2195, 2265), 'torch.nn.parameter.Parameter', 't.nn.parameter.Parameter', (['cls_token'], {'requires_grad': 'learnable_cls_token'}... |
"""Main module."""
from functools import reduce
class Calc:
def add(self, *args):
return sum(args)
def subtract(self, a, b):
return a - b
def multiply(self, *args):
if not all(args):
raise ValueError
return reduce(lambda x, y: x*y, args)
def divide(self... | [
"functools.reduce"
] | [((269, 301), 'functools.reduce', 'reduce', (['(lambda x, y: x * y)', 'args'], {}), '(lambda x, y: x * y, args)\n', (275, 301), False, 'from functools import reduce\n')] |
import re
def le_assinatura():
"""[A funcao le os valores dos tracos linguisticos do modelo e devolve uma assinatura a ser comparada com os textos fornecidos]
Returns:
[list] -- [description]
"""
print("Bem-vindo ao detector automático de COH-PIAH.")
print("Informe a assinatura típica de... | [
"re.split"
] | [((1470, 1495), 're.split', 're.split', (['"""[.!?]+"""', 'texto'], {}), "('[.!?]+', texto)\n", (1478, 1495), False, 'import re\n'), ((1847, 1875), 're.split', 're.split', (['"""[,:;]+"""', 'sentenca'], {}), "('[,:;]+', sentenca)\n", (1855, 1875), False, 'import re\n')] |
import cv2
def webcam_gui(filter_func, video_src=0):
cap = cv2.VideoCapture(video_src)
key_code = -1
while(key_code == -1):
# read a frame
ret, frame = cap.read()
# run filter with the arguments
frame_out = filter_func(frame)
# show the image... | [
"cv2.VideoCapture.set",
"cv2.imshow",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.cvtColor",
"cv2.Canny",
"cv2.waitKey",
"cv2.blur"
] | [((66, 93), 'cv2.VideoCapture', 'cv2.VideoCapture', (['video_src'], {}), '(video_src)\n', (82, 93), False, 'import cv2\n'), ((470, 493), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (491, 493), False, 'import cv2\n'), ((580, 622), 'cv2.cvtColor', 'cv2.cvtColor', (['frame_in', 'cv2.COLOR_BGR2GRAY'... |
#!/usr/bin/python3.7
#Author: <NAME>
import sys
import os
import math
import re
import numpy as np
#print('usage: <>.py <file.pdb> \nexecute nsc to generate point-based surface and create tables and if verbose==1 files dotslabel1.xyzrgb dotslabel2.xyzrgb dotslabel3.xyzrgb and dotslabel4.xyzrgb\n')
def pdbsurface(f... | [
"math.sqrt",
"numpy.array",
"numpy.empty",
"numpy.vstack",
"os.system",
"os.remove"
] | [((776, 847), 'numpy.array', 'np.array', (['[[0, 0, 0], [0.9, 0.9, 0.9], [1, 0, 0], [0, 1, 0], [0, 0, 1]]'], {}), '([[0, 0, 0], [0.9, 0.9, 0.9], [1, 0, 0], [0, 1, 0], [0, 0, 1]])\n', (784, 847), True, 'import numpy as np\n'), ((3459, 3473), 'os.system', 'os.system', (['cmd'], {}), '(cmd)\n', (3468, 3473), False, 'impor... |
"""
Test script for utils.py function.
"""
import os
import numpy as np
import pytest
from astropy import units as u
from cwinpy.utils import (
ellipticity_to_q22,
gcd_array,
get_psr_name,
initialise_ephemeris,
int_to_alpha,
is_par_file,
logfactorial,
q22_to_ellipticity,
)
from lalpuls... | [
"cwinpy.utils.int_to_alpha",
"numpy.allclose",
"numpy.isclose",
"numpy.sqrt",
"astropy.units.Unit",
"numpy.log",
"cwinpy.utils.q22_to_ellipticity",
"os.remove",
"numpy.array",
"cwinpy.utils.is_par_file",
"cwinpy.utils.ellipticity_to_q22",
"pytest.raises",
"lalpulsar.PulsarParametersWrapper.P... | [((2618, 2648), 'cwinpy.utils.ellipticity_to_q22', 'ellipticity_to_q22', (['epsilon[0]'], {}), '(epsilon[0])\n', (2636, 2648), False, 'from cwinpy.utils import ellipticity_to_q22, gcd_array, get_psr_name, initialise_ephemeris, int_to_alpha, is_par_file, logfactorial, q22_to_ellipticity\n'), ((2661, 2693), 'numpy.isclos... |
import ast
import os
from mr_proper.public_api import is_function_pure
from mr_proper.utils.ast import get_ast_tree
def test_ok_for_destructive_assignment():
funcdef = ast.parse("""
def foo(a):
b, c = a
return b * c
""".strip()).body[0]
assert is_function_pure(funcdef)
def test_is_function_pure... | [
"mr_proper.public_api.is_function_pure",
"mr_proper.utils.ast.get_ast_tree",
"os.path.dirname"
] | [((267, 292), 'mr_proper.public_api.is_function_pure', 'is_function_pure', (['funcdef'], {}), '(funcdef)\n', (283, 292), False, 'from mr_proper.public_api import is_function_pure\n'), ((606, 634), 'mr_proper.utils.ast.get_ast_tree', 'get_ast_tree', (['test_file_path'], {}), '(test_file_path)\n', (618, 634), False, 'fro... |
from __future__ import annotations
import re
from datetime import datetime, timezone
from decimal import Decimal, InvalidOperation
from typing import TYPE_CHECKING, Iterable, List, Mapping, Optional, Sequence, Union
import flask_babel
from babel import numbers
from dateutil.relativedelta import relativedelta
from fla... | [
"structlog.get_logger",
"app.jinja_filters.get_formatted_currency",
"dateutil.relativedelta.relativedelta",
"re.compile",
"wtforms.validators.ValidationError",
"datetime.datetime.strptime",
"wtforms.validators.StopValidation",
"app.questionnaire.rules.utils.parse_datetime",
"re.match",
"flask_babe... | [((925, 937), 'structlog.get_logger', 'get_logger', ([], {}), '()\n', (935, 937), False, 'from structlog import get_logger\n'), ((956, 1027), 're.compile', 're.compile', (['"""^([a-z]{2,63}|xn--([a-z0-9]+-)*[a-z0-9]+)$"""', 're.IGNORECASE'], {}), "('^([a-z]{2,63}|xn--([a-z0-9]+-)*[a-z0-9]+)$', re.IGNORECASE)\n", (966, ... |
from avalon import io
def publish(asset_id, subset_name, families):
"""
Publish subset.
:param asset_id: (object)
:param subset_name: (str)
:param families: (list)
:return:
"""
subset_context = {
'name': subset_name,
'parent': asset_id,
'type': 'subset',
... | [
"avalon.io.find_one",
"avalon.io.insert_one"
] | [((526, 546), 'avalon.io.find_one', 'io.find_one', (['_filter'], {}), '(_filter)\n', (537, 546), False, 'from avalon import io\n'), ((596, 625), 'avalon.io.insert_one', 'io.insert_one', (['subset_context'], {}), '(subset_context)\n', (609, 625), False, 'from avalon import io\n')] |
import unittest
from typing import Tuple
from neofoodclub import NeoFoodClub # type: ignore
from neofoodclub.types import RoundData # type: ignore
# i picked the smallest round I could quickly find
test_round_data: RoundData = {
"currentOdds": [
[1, 2, 13, 3, 5],
[1, 4, 2, 4, 6],
[1, 3, ... | [
"neofoodclub.NeoFoodClub"
] | [((2219, 2247), 'neofoodclub.NeoFoodClub', 'NeoFoodClub', (['test_round_data'], {}), '(test_round_data)\n', (2230, 2247), False, 'from neofoodclub import NeoFoodClub\n')] |
"""Here are defined Python functions of views.
Views are binded to URLs in :mod:`.urls`.
"""
import datetime
import hashlib
import json
import os
from distutils.version import LooseVersion
from json.encoder import JSONEncoder
from urllib.parse import quote
from django import forms
from django.conf import settings
from... | [
"django.http.QueryDict",
"pythonnest.xmlrpc.site.dispatch",
"django.urls.reverse",
"pythonnest.models.ReleaseDownload.objects.all",
"pythonnest.models.Package.objects.filter",
"os.remove",
"django.http.HttpResponseRedirect",
"pythonnest.models.Release.objects.get_or_create",
"pythonnest.models.Packa... | [((1617, 1629), 'pythonnest.xmlrpc.XMLRPCSite', 'XMLRPCSite', ([], {}), '()\n', (1627, 1629), False, 'from pythonnest.xmlrpc import XMLRPCSite, site\n'), ((15152, 15179), 'django.views.decorators.debug.sensitive_post_parameters', 'sensitive_post_parameters', ([], {}), '()\n', (15177, 15179), False, 'from django.views.d... |
from scrapy.item import Item, Field
class MyImage(Item):
image_urls = Field()
images = Field()
image_paths = Field()
image_label = Field()
| [
"scrapy.item.Field"
] | [((77, 84), 'scrapy.item.Field', 'Field', ([], {}), '()\n', (82, 84), False, 'from scrapy.item import Item, Field\n'), ((98, 105), 'scrapy.item.Field', 'Field', ([], {}), '()\n', (103, 105), False, 'from scrapy.item import Item, Field\n'), ((124, 131), 'scrapy.item.Field', 'Field', ([], {}), '()\n', (129, 131), False, ... |
"""Setup inaccel-vitis package."""
from setuptools import find_namespace_packages, setup
setup(
name = 'inaccel-vitis',
packages = find_namespace_packages(include = ['inaccel.*']),
namespace_packages = ['inaccel'],
version = '0.2',
license = 'Apache-2.0',
description = 'InAccel Vitis Libraries'... | [
"setuptools.find_namespace_packages"
] | [((140, 186), 'setuptools.find_namespace_packages', 'find_namespace_packages', ([], {'include': "['inaccel.*']"}), "(include=['inaccel.*'])\n", (163, 186), False, 'from setuptools import find_namespace_packages, setup\n')] |
# pylint: disable=redefined-outer-name,protected-access
# pylint: disable=missing-function-docstring,missing-module-docstring,missing-class-docstring
import panel as pn
from panel import Template
from awesome_panel_extensions.frameworks.fast import FastTemplate
def test_constructor():
# Given
column = pn.Col... | [
"awesome_panel_extensions.frameworks.fast.FastTemplate",
"panel.Column"
] | [((314, 325), 'panel.Column', 'pn.Column', ([], {}), '()\n', (323, 325), True, 'import panel as pn\n'), ((372, 395), 'awesome_panel_extensions.frameworks.fast.FastTemplate', 'FastTemplate', ([], {'main': 'main'}), '(main=main)\n', (384, 395), False, 'from awesome_panel_extensions.frameworks.fast import FastTemplate\n')... |
from typing import Dict, Any
from allenact.algorithms.onpolicy_sync.losses import PPO
from allenact.algorithms.onpolicy_sync.losses.ppo import PPOConfig
from allenact.utils.experiment_utils import LinearDecay, PipelineStage
from baseline_configs.one_phase.one_phase_rgb_base import (
OnePhaseRGBBaseExperimentConfig... | [
"allenact.utils.experiment_utils.LinearDecay",
"allenact.utils.experiment_utils.PipelineStage"
] | [((943, 1013), 'allenact.utils.experiment_utils.PipelineStage', 'PipelineStage', ([], {'loss_names': "['ppo_loss']", 'max_stage_steps': 'training_steps'}), "(loss_names=['ppo_loss'], max_stage_steps=training_steps)\n", (956, 1013), False, 'from allenact.utils.experiment_utils import LinearDecay, PipelineStage\n'), ((84... |
from setuptools import setup, find_packages
from malias import __version__
setup(
name = "malias",
version = __version__,
author = '<NAME>',
author_email = '<EMAIL>',
license = 'MIT',
keywords = 'malias system alias',
description = '',
url = 'https://github.com/sfable/malias',
down... | [
"setuptools.find_packages"
] | [((401, 416), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (414, 416), False, 'from setuptools import setup, find_packages\n')] |
#BSD 3-Clause License
#
#Copyright (c) 2019, The Regents of the University of Minnesota
#
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
#
#* Redistributions of source code must retain the above cop... | [
"create_template.define_templates",
"random.uniform",
"simulated_annealer.simulated_annealer",
"numpy.zeros",
"numpy.savetxt",
"T6_PSI_settings.T6_PSI_settings.load_obj",
"numpy.genfromtxt"
] | [((2165, 2191), 'T6_PSI_settings.T6_PSI_settings.load_obj', 'T6_PSI_settings.load_obj', ([], {}), '()\n', (2189, 2191), False, 'from T6_PSI_settings import T6_PSI_settings\n'), ((3075, 3119), 'create_template.define_templates', 'define_templates', (['settings_obj'], {'generate_g': '(0)'}), '(settings_obj, generate_g=0)... |
#
# Copyright 2013 <NAME>
# Copyright 2014 Red Hat, Inc
#
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# 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.or... | [
"ceilometer.openstack.common.gettextutils._",
"stevedore.extension.ExtensionManager",
"ceilometer.openstack.common.log.getLogger",
"ceilometer.pipeline.setup_pipeline",
"itertools.product",
"ceilometer.openstack.common.context.RequestContext",
"six.moves.urllib.parse.urlparse",
"ceilometer.pipeline.Pu... | [((1038, 1061), 'ceilometer.openstack.common.log.getLogger', 'log.getLogger', (['__name__'], {}), '(__name__)\n', (1051, 1061), False, 'from ceilometer.openstack.common import log\n'), ((2256, 2297), 'collections.defaultdict', 'collections.defaultdict', (['resource_factory'], {}), '(resource_factory)\n', (2279, 2297), ... |
# Copyright 2013 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | [
"warehouse.legacy.pypi.rss",
"werkzeug.routing.Map",
"warehouse.legacy.pypi.project_json",
"datetime.datetime.utcnow",
"warehouse.legacy.pypi.packages_rss",
"warehouse.legacy.pypi.pypi",
"pytest.mark.parametrize",
"warehouse.legacy.pypi.daytime",
"pytest.raises",
"pretend.stub",
"pretend.call",
... | [((795, 868), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""content_type"""', "[None, 'text/html', '__empty__']"], {}), "('content_type', [None, 'text/html', '__empty__'])\n", (818, 868), False, 'import pytest\n'), ((2528, 2642), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["('version', 'callba... |
import numpy as np
class SequenceTools(object):
dna2gray_ = {'c': (0, 0), 't': (1, 0), 'g': (1, 1), 'a': (0, 1)}
gray2dna_ = {(0, 0): 'c', (1, 0): 't', (1, 1): 'g', (0, 1): 'a'}
codon2protein_ = {'ttt': 'f', 'ttc': 'f', 'tta': 'l', 'ttg': 'l', 'tct': 's', 'tcc': 's', 'tca': 's',
'tc... | [
"numpy.zeros",
"numpy.argmax"
] | [((5834, 5850), 'numpy.zeros', 'np.zeros', (['(N, 4)'], {}), '((N, 4))\n', (5842, 5850), True, 'import numpy as np\n'), ((6192, 6212), 'numpy.zeros', 'np.zeros', (['(2 * N, 2)'], {}), '((2 * N, 2))\n', (6200, 6212), True, 'import numpy as np\n'), ((7051, 7071), 'numpy.zeros', 'np.zeros', (['(2 * N, 2)'], {}), '((2 * N,... |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... | [
"rules.precompute_rules",
"splits.generate_training_and_test_sets_iid",
"absl.app.run",
"random.seed"
] | [((759, 773), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (770, 773), False, 'import random\n'), ((776, 800), 'rules.precompute_rules', 'rules.precompute_rules', ([], {}), '()\n', (798, 800), False, 'import rules\n'), ((820, 909), 'splits.generate_training_and_test_sets_iid', 'splits.generate_training_and_tes... |
import subprocess
lib_list = ['numpy','ymmsl','sobol_seq','csv','seaborn','zenodo_get']
for lib_name in lib_list:
try:
import lib_name
except ImportError:
if lib_name == 'csv':
print(lib_name,' Module not installed')
subprocess.run(['pip','install','python-csv'])
else:
print(lib_name,' Module not inst... | [
"ymmsl.load",
"ymmsl.save",
"ymmsl.Configuration",
"subprocess.run",
"os.mkdir",
"numpy.savetxt",
"sobol_seq.i4_sobol_generate"
] | [((3344, 3398), 'sobol_seq.i4_sobol_generate', 'sobol_seq.i4_sobol_generate', (['num_uncer_para', 'NumSample'], {}), '(num_uncer_para, NumSample)\n', (3371, 3398), False, 'import sobol_seq\n'), ((3446, 3468), 'numpy.savetxt', 'np.savetxt', (['"""A.csv"""', 'A'], {}), "('A.csv', A)\n", (3456, 3468), True, 'import numpy ... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
range = getattr(__builtins__, 'xrange', range)
# end of py2 compatability boilerplate
import numpy as np
from matrixprofile import core
from ma... | [
"matrixprofile.core.is_array_like",
"matrixprofile.io.protobuf.proto_messages_pb2.Location",
"matrixprofile.core.is_pmp_obj",
"numpy.array",
"matrixprofile.io.protobuf.proto_messages_pb2.Motif",
"matrixprofile.core.is_mp_obj",
"matrixprofile.io.protobuf.proto_messages_pb2.MPFOutput"
] | [((1392, 1415), 'matrixprofile.core.is_mp_obj', 'core.is_mp_obj', (['profile'], {}), '(profile)\n', (1406, 1415), False, 'from matrixprofile import core\n'), ((2035, 2042), 'matrixprofile.io.protobuf.proto_messages_pb2.Motif', 'Motif', ([], {}), '()\n', (2040, 2042), False, 'from matrixprofile.io.protobuf.proto_message... |
from decouple import config
MEDIA_PATH = config("MEDIA_PATH", "/home/mdcg/Documents/")
| [
"decouple.config"
] | [((43, 88), 'decouple.config', 'config', (['"""MEDIA_PATH"""', '"""/home/mdcg/Documents/"""'], {}), "('MEDIA_PATH', '/home/mdcg/Documents/')\n", (49, 88), False, 'from decouple import config\n')] |
from flask import Flask, jsonify, request, render_template
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
app = Flask(__name__)
app.config['CUSTOM_VAR'] = 5
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///web_app.db'
db = SQLAlchemy(app)
migrate = Migrate(app, db)
class User(db.Model)... | [
"flask.render_template",
"flask.Flask",
"flask_migrate.Migrate",
"flask_sqlalchemy.SQLAlchemy",
"flask.jsonify"
] | [((141, 156), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (146, 156), False, 'from flask import Flask, jsonify, request, render_template\n'), ((255, 270), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', (['app'], {}), '(app)\n', (265, 270), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((282, 298), ... |
import pathing
import collections
import itertools
import copy
__all__ = ('Tree', 'Cache', 'Entry', 'EntryCache', 'RowCache', 'BulkRowCache',
'AlikeBulkRowCache')
class Tree(dict):
"""
Simple **BTree** implementation.
"""
__slots__ = ()
def _make(self):
"""
Create ... | [
"collections.namedtuple",
"itertools.starmap",
"copy.deepcopy",
"copy.copy",
"pathing.derive"
] | [((4868, 4916), 'collections.namedtuple', 'collections.namedtuple', (['"""Asset"""', '"""create modify"""'], {}), "('Asset', 'create modify')\n", (4890, 4916), False, 'import collections\n'), ((4026, 4041), 'copy.copy', 'copy.copy', (['self'], {}), '(self)\n', (4035, 4041), False, 'import copy\n'), ((5610, 5630), 'copy... |
#!/usr/bin/env python
"""
Manually tweak a talk's status, leaving a note about why.
"""
import sys
import argparse
import pycon_bot.mongo
from pycon_bot.models import TalkProposal, Note
p = argparse.ArgumentParser()
p.add_argument('talk_id', type=int)
p.add_argument('new_status', choices=[c[0] for c in TalkProposal.S... | [
"pycon_bot.models.TalkProposal.objects.get",
"argparse.ArgumentParser",
"sys.stderr.write",
"sys.exit",
"pycon_bot.models.Note"
] | [((192, 217), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (215, 217), False, 'import argparse\n'), ((528, 574), 'pycon_bot.models.TalkProposal.objects.get', 'TalkProposal.objects.get', ([], {'talk_id': 'args.talk_id'}), '(talk_id=args.talk_id)\n', (552, 574), False, 'from pycon_bot.models im... |
from __future__ import division, print_function, absolute_import, unicode_literals
import os
from mog_commons.case_class import CaseClass
from mog_commons.functional import omap, oget
class JavaSetting(CaseClass):
class Memory(CaseClass):
def __init__(self,
java_version, # just use ... | [
"os.path.isabs",
"mog_commons.functional.omap",
"mog_commons.case_class.CaseClass.__init__",
"os.path.join",
"mog_commons.functional.oget"
] | [((4434, 4472), 'os.path.join', 'os.path.join', (['self.home', '"""bin"""', '"""java"""'], {}), "(self.home, 'bin', 'java')\n", (4446, 4472), False, 'import os\n'), ((1277, 1613), 'mog_commons.case_class.CaseClass.__init__', 'CaseClass.__init__', (['self', "('heap_min', heap_min)", "('heap_max', heap_max)", "('perm_min... |
# Monitor and control Apache web server workers from Python.
#
# Author: <NAME> <<EMAIL>>
# Last Change: November 27, 2019
# URL: https://apache-manager.readthedocs.io
"""
A ``top`` like interactive viewer for Apache web server metrics.
The :mod:`~apache_manager.interactive` module implements a ``top`` like
interacti... | [
"apache_manager.cli.report_metrics",
"curses.wrapper",
"apache_manager.cli.line_is_heading",
"curses.curs_set",
"time.sleep",
"sys.exit",
"coloredlogs.set_level",
"humanfriendly.terminal.warning",
"humanfriendly.terminal.connected_to_terminal",
"curses.noraw"
] | [((1712, 1745), 'humanfriendly.terminal.connected_to_terminal', 'connected_to_terminal', (['sys.stdout'], {}), '(sys.stdout)\n', (1733, 1745), False, 'from humanfriendly.terminal import connected_to_terminal, warning\n'), ((2384, 2420), 'coloredlogs.set_level', 'coloredlogs.set_level', (['logging.ERROR'], {}), '(loggin... |
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import include, path
from users.views import LogIn, LogOut, Settings, SignUp
urlpatterns = [
path(f"{settings.ADMIN_URL}/", admin.site.urls),
path("", include("questions.urls")),
... | [
"django.urls.include",
"users.views.SignUp.as_view",
"django.conf.urls.static.static",
"users.views.LogOut.as_view",
"users.views.LogIn.as_view",
"django.urls.path",
"users.views.Settings.as_view"
] | [((226, 273), 'django.urls.path', 'path', (['f"""{settings.ADMIN_URL}/"""', 'admin.site.urls'], {}), "(f'{settings.ADMIN_URL}/', admin.site.urls)\n", (230, 273), False, 'from django.urls import include, path\n'), ((614, 675), 'django.conf.urls.static.static', 'static', (['settings.MEDIA_URL'], {'document_root': 'settin... |
from numpy import *
from math import log
# x: features, y: classes
def infogain(x, y):
info_gains = zeros(x.shape[1]) # features of x
# calculate entropy of the data *hy*
# with regards to class y
cl = unique(y)
hy = 0
for i in range(len(cl)):
c = cl[i]
py = float(sum(y==c)... | [
"math.log"
] | [((389, 399), 'math.log', 'log', (['py', '(2)'], {}), '(py, 2)\n', (392, 399), False, 'from math import log\n'), ((1277, 1288), 'math.log', 'log', (['pyf', '(2)'], {}), '(pyf, 2)\n', (1280, 1288), False, 'from math import log\n')] |
import unittest
from qpanel.utils import clean_str_to_div_id, underscore_to_camelcase, \
timedelta_from_field_dict
from qpanel.convert import convert_time_when_param
import time
import datetime
class UtilsTestClass(unittest.TestCase):
def test_clean_str_to_div(self):
div = 'ro/.d. i _@l_k/d_@'
... | [
"qpanel.utils.clean_str_to_div_id",
"qpanel.utils.underscore_to_camelcase",
"qpanel.utils.timedelta_from_field_dict",
"unittest.main",
"datetime.timedelta",
"qpanel.convert.convert_time_when_param",
"time.time"
] | [((3181, 3196), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3194, 3196), False, 'import unittest\n'), ((898, 909), 'time.time', 'time.time', ([], {}), '()\n', (907, 909), False, 'import time\n'), ((339, 363), 'qpanel.utils.clean_str_to_div_id', 'clean_str_to_div_id', (['div'], {}), '(div)\n', (358, 363), False... |
import sys
import subprocess
import_dir = sys.argv[1]
sys.path.append(import_dir)
# https://python-chess.readthedocs.io/en/v0.23.10/
import chess
import chess.uci
def main():
chess_engine = ChessEngine()
while True:
line = raw_input()
# some split token corresponding to that in chess_di... | [
"chess.Move.from_uci",
"chess.uci.popen_engine",
"chess.Board",
"subprocess.STARTUPINFO",
"sys.stdout.flush",
"sys.path.append",
"chess.square"
] | [((55, 82), 'sys.path.append', 'sys.path.append', (['import_dir'], {}), '(import_dir)\n', (70, 82), False, 'import sys\n'), ((1233, 1251), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (1249, 1251), False, 'import sys\n'), ((1770, 1790), 'chess.Board', 'chess.Board', ([], {'fen': 'fen'}), '(fen=fen)\n', (17... |
# -*- coding: utf-8 -*-
"""Interface for a domain: in/out test, random point generation, and update limiting (for constrained optimization)."""
from builtins import object
from abc import ABCMeta, abstractmethod, abstractproperty
from future.utils import with_metaclass
class DomainInterface(with_metaclass(ABCMeta, ob... | [
"future.utils.with_metaclass"
] | [((294, 325), 'future.utils.with_metaclass', 'with_metaclass', (['ABCMeta', 'object'], {}), '(ABCMeta, object)\n', (308, 325), False, 'from future.utils import with_metaclass\n')] |
import re
# $ babyLisp(‘(add 1 2)’)
# $ 3
# $ babyLisp(‘(multiply 4 (add 2 3))’)
# $ 20
def add(a, b):
return a+b
def subtract(a, b):
return a-b
def multiply(a, b):
return a*b
def divide(a, b):
return a/b
def baby_lisp(lisp_string):
brackets = re.sub(r"\)", "))", lisp_string)
commands = ... | [
"re.sub"
] | [((272, 304), 're.sub', 're.sub', (['"""\\\\)"""', '"""))"""', 'lisp_string'], {}), "('\\\\)', '))', lisp_string)\n", (278, 304), False, 'import re\n'), ((320, 357), 're.sub', 're.sub', (['"""([a-z]+) """', '"""\\\\1("""', 'brackets'], {}), "('([a-z]+) ', '\\\\1(', brackets)\n", (326, 357), False, 'import re\n'), ((371... |
from tkinter import *
from tkinter import ttk
from tkinter import messagebox
import sqlite3
from sqlite3 import Error
#creating window
class Fp(Tk):
def __init__(self):
super().__init__()
self.iconbitmap(r'libico.ico')
self.maxsize(480, 320)
self.title("Forget Password... | [
"tkinter.messagebox.showerror",
"tkinter.messagebox.showinfo",
"sqlite3.connect",
"tkinter.ttk.Combobox"
] | [((2763, 2815), 'tkinter.messagebox.showinfo', 'messagebox.showinfo', (['"""Error"""', '"""Please Enter User Id"""'], {}), "('Error', 'Please Enter User Id')\n", (2782, 2815), False, 'from tkinter import messagebox\n'), ((4641, 4831), 'tkinter.ttk.Combobox', 'ttk.Combobox', (['self'], {'textvariable': 'b', 'values': "[... |
import config
from selectsql import SelectSql
class RssSql(object):
def __init__(self):
self.database = config.get_database_config()
self.select_sql = SelectSql(self.database)
self.do_not_success = "do_not_success"
self.do_success = "do_success"
self.user = {}
self.x... | [
"selectsql.SelectSql",
"config.get_database_config"
] | [((117, 145), 'config.get_database_config', 'config.get_database_config', ([], {}), '()\n', (143, 145), False, 'import config\n'), ((172, 196), 'selectsql.SelectSql', 'SelectSql', (['self.database'], {}), '(self.database)\n', (181, 196), False, 'from selectsql import SelectSql\n')] |
import unittest
import os, sys
import communication_tests
if communication_tests.MPI.Rank() == 0:
communication_tests.CompilerInfo()
print()
communication_tests.MPI.Barrier()
is_slave_process = (("--tests-slave" in sys.argv[1:]) or (communication_tests.MPI.Rank() == 1))
if is_slave_process:
from base_co... | [
"communication_tests.MPI.Rank",
"communication_tests.MPI.Barrier",
"base_communication_test.BaseCommunicationTestDataSender",
"communication_tests.CompilerInfo",
"os.path.dirname",
"unittest.runner.TextTestRunner",
"unittest.TestLoader"
] | [((151, 184), 'communication_tests.MPI.Barrier', 'communication_tests.MPI.Barrier', ([], {}), '()\n', (182, 184), False, 'import communication_tests\n'), ((62, 92), 'communication_tests.MPI.Rank', 'communication_tests.MPI.Rank', ([], {}), '()\n', (90, 92), False, 'import communication_tests\n'), ((103, 137), 'communica... |
#!/usr/bin/env python3
# Advent of Code 2020
# <NAME>
import sys # .stdin
import re # .search
# ======================================================================
# HELPER FUNCTIONS
# ======================================================================
def does_rule_allow_num(rule, num):
... | [
"sys.stdin.readline",
"re.search"
] | [((1701, 1721), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (1719, 1721), False, 'import sys\n'), ((1780, 1800), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (1798, 1800), False, 'import sys\n'), ((1952, 1972), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (1970, 1972)... |
# Starts from OS Mastermap base map and:
# 1. Assigns CEH Landcover map (LCM) definition of either Arable or Improved grassland to agricultural land polygons
# 2. Assigns Rural Payments Agency CROME Crop map data (input must be dissolved by land use code and joined to description
# and simplified description (Arable, I... | [
"time.ctime",
"arcpy.CopyFeatures_management",
"arcpy.CalculateField_management",
"MyFunctions.check_and_add_field",
"arcpy.SelectLayerByLocation_management",
"arcpy.MakeFeatureLayer_management",
"arcpy.CheckOutExtension",
"os.path.join",
"arcpy.Sort_management",
"arcpy.Identity_analysis",
"MyFu... | [((647, 681), 'arcpy.CheckOutExtension', 'arcpy.CheckOutExtension', (['"""Spatial"""'], {}), "('Spatial')\n", (670, 681), False, 'import arcpy\n'), ((1394, 1432), 'os.path.join', 'os.path.join', (['folder', '"""Data\\\\Data.gdb"""'], {}), "(folder, 'Data\\\\Data.gdb')\n", (1406, 1432), False, 'import os\n'), ((1448, 14... |
# Generated by Django 3.2.3 on 2022-02-09 12:51
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='video',
na... | [
"django.db.models.FileField"
] | [((619, 692), 'django.db.models.FileField', 'models.FileField', ([], {'blank': '(True)', 'null': '(True)', 'upload_to': '"""Videos/240p/%Y/%m/%d"""'}), "(blank=True, null=True, upload_to='Videos/240p/%Y/%m/%d')\n", (635, 692), False, 'from django.db import migrations, models\n'), ((816, 889), 'django.db.models.FileFiel... |
# Code to transform the driver sensor OGMs to the ego vehicle's OGM frame of reference.
import matplotlib.pyplot as plt
import numpy as np
import math
import copy
from utils.grid_utils import global_grid
import time
from scipy.spatial import cKDTree
import pdb
def mask_in_EgoGrid(global_grid_x, global_grid_y, ref_xy,... | [
"numpy.ones",
"scipy.spatial.cKDTree",
"numpy.where",
"numpy.floor",
"numpy.any",
"numpy.array",
"copy.copy"
] | [((501, 519), 'numpy.where', 'np.where', (['mask_unk'], {}), '(mask_unk)\n', (509, 519), True, 'import numpy as np\n'), ((1460, 1483), 'scipy.spatial.cKDTree', 'cKDTree', (['ref_global_ind'], {}), '(ref_global_ind)\n', (1467, 1483), False, 'from scipy.spatial import cKDTree\n'), ((3095, 3126), 'numpy.any', 'np.any', ([... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from django.core.management.base import BaseCommand
from emailhub.utils.email import send_unsent_emails
log = logging.getLogger('emailhub')
class Command(BaseCommand):
"""
EmailHub management command
"""
help = 'EmailH... | [
"logging.getLogger",
"emailhub.utils.email.send_unsent_emails"
] | [((194, 223), 'logging.getLogger', 'logging.getLogger', (['"""emailhub"""'], {}), "('emailhub')\n", (211, 223), False, 'import logging\n'), ((1215, 1235), 'emailhub.utils.email.send_unsent_emails', 'send_unsent_emails', ([], {}), '()\n', (1233, 1235), False, 'from emailhub.utils.email import send_unsent_emails\n')] |
from django.contrib import admin
from .models import soc, osc, univ_soc_woc
admin.site.register(soc)
admin.site.register(osc)
admin.site.register(univ_soc_woc)
| [
"django.contrib.admin.site.register"
] | [((80, 104), 'django.contrib.admin.site.register', 'admin.site.register', (['soc'], {}), '(soc)\n', (99, 104), False, 'from django.contrib import admin\n'), ((106, 130), 'django.contrib.admin.site.register', 'admin.site.register', (['osc'], {}), '(osc)\n', (125, 130), False, 'from django.contrib import admin\n'), ((132... |
'''
This code will clean the OB datasets and combine all the cleaned data into one
Dataset name: O-27-Da Yan
semi-automate code, needs some hands work. LOL But God is so good to me.
1. 9 different buildings in this dataset, and each building has different rooms
3. each room has different window, door, ac, indoor, out... | [
"os.listdir",
"pandas.read_csv",
"os.walk",
"os.path.splitext",
"os.chdir",
"datetime.datetime.now",
"pandas.read_excel",
"pandas.DataFrame",
"pandas.concat",
"pandas.to_datetime"
] | [((1490, 1513), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (1511, 1513), False, 'import datetime\n'), ((1570, 1584), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (1582, 1584), True, 'import pandas as pd\n'), ((1601, 1615), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (1613, 16... |
from django.urls import path
from . views import ConsultantCreateView, UserConsultantPageView, ConsultantDetailView, ConsultantPageView, ConsultantDeleteView
from . import views as consultant_views
urlpatterns = [
path('', ConsultantPageView.as_view(), name='consultants-home'),
path('<int:pk>/', ConsultantDet... | [
"django.urls.path"
] | [((371, 444), 'django.urls.path', 'path', (['"""new/"""', 'consultant_views.consultantCreate'], {'name': '"""consultant-create"""'}), "('new/', consultant_views.consultantCreate, name='consultant-create')\n", (375, 444), False, 'from django.urls import path\n'), ((548, 642), 'django.urls.path', 'path', (['"""<int:pk>/u... |
from enum import Enum
from typing import Optional
import pkg_resources
from gi.repository import Gtk
from gi.repository import Pango
cssprovider = Gtk.CssProvider()
cssprovider.load_from_path(pkg_resources.resource_filename('cct', 'resource/css/indicatorcolors.css'))
class IndicatorState(Enum):
OK = 'ok'
WA... | [
"gi.repository.Gtk.CssProvider",
"gi.repository.Gtk.Label",
"gi.repository.Gtk.EventBox",
"pkg_resources.resource_filename"
] | [((149, 166), 'gi.repository.Gtk.CssProvider', 'Gtk.CssProvider', ([], {}), '()\n', (164, 166), False, 'from gi.repository import Gtk\n'), ((194, 268), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename', (['"""cct"""', '"""resource/css/indicatorcolors.css"""'], {}), "('cct', 'resource/css/indicatorcol... |
# chapter Matplotlib Plotting
'''
The plot() function is used to draw points (markers) in a diagram.
By default, the plot() function draws a line from point to point.
The function takes parameters for specifying points in the diagram.
Parameter 1 is an array containing the points on the x-axis.
Paramet... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.plot",
"numpy.array",
"sys.stdout.flush",
"matplotlib.pyplot.show"
] | [((646, 661), 'numpy.array', 'r.array', (['[1, 9]'], {}), '([1, 9])\n', (653, 661), True, 'import numpy as r\n'), ((665, 681), 'numpy.array', 'r.array', (['[4, 10]'], {}), '([4, 10])\n', (672, 681), True, 'import numpy as r\n'), ((684, 698), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y'], {}), '(x, y)\n', (692, 698)... |
# -*- coding: utf-8 -*-
# @Author: Administrator
# @Date: 2019-04-25 06:10:39
# @Last Modified by: Administrator
# @Last Modified time: 2019-05-21 15:30:34
__all__ = [
"mkdir",
"get_abspath",
"read_file",
"json_load",
"json_dump",
"b",
"u",
"Singleton",
"CachedProperty",
... | [
"os.path.exists",
"os.path.join",
"os.path.dirname",
"requests.compat.json.dump",
"os.mkdir",
"requests.compat.json.load"
] | [((399, 424), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (414, 424), False, 'import os\n'), ((477, 497), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (491, 497), False, 'import os\n'), ((507, 521), 'os.mkdir', 'os.mkdir', (['path'], {}), '(path)\n', (515, 521), False, '... |
#from tree_GA import TreeGA
import os
import time
import json
import pandas as pd
import sys
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from treeGA import TreeGA
def printChart(toFile=False,filename="",lang="en"):
iteration = 0
jobsForMachines = []
jobsForMachinesWithJobId = []... | [
"matplotlib.pyplot.savefig",
"treeGA.TreeGA",
"time.time",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.rc",
"matplotlib.pyplot.show"
] | [((1257, 1279), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {}), "('font', **font)\n", (1263, 1279), True, 'import matplotlib.pyplot as plt\n'), ((2050, 2064), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (2062, 2064), True, 'import matplotlib.pyplot as plt\n'), ((3833, 3843), 'matplotlib.pypl... |
from fastapi import APIRouter, File, Header, HTTPException, UploadFile
from fastapi.responses import FileResponse, HTMLResponse
from pydantic.main import List
from api import controller
from api.config import application_name
from api.models.TTS_model import TTSModel
router = APIRouter()
MAX_CHARACTERS = 550
class ... | [
"fastapi.Header",
"fastapi.APIRouter",
"api.controller.text_to_tacotron_audio_file",
"api.controller.get_models",
"api.controller.audio_to_tacotron_audio_file",
"fastapi.File"
] | [((279, 290), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (288, 290), False, 'from fastapi import APIRouter, File, Header, HTTPException, UploadFile\n'), ((559, 571), 'fastapi.Header', 'Header', (['None'], {}), '(None)\n', (565, 571), False, 'from fastapi import APIRouter, File, Header, HTTPException, UploadFil... |
# coding: utf-8
import SocketServer,os
# Copyright 2013 <NAME>, <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... | [
"SocketServer.TCPServer",
"os.path.exists",
"os.path.abspath",
"os.getcwd"
] | [((3159, 3208), 'SocketServer.TCPServer', 'SocketServer.TCPServer', (['(HOST, PORT)', 'MyWebServer'], {}), '((HOST, PORT), MyWebServer)\n', (3181, 3208), False, 'import SocketServer, os\n'), ((2577, 2598), 'os.path.abspath', 'os.path.abspath', (['Path'], {}), '(Path)\n', (2592, 2598), False, 'import SocketServer, os\n'... |
import time
import threading
import sys
import pynrfjprog.HighLevel
import pynrfjprog.APIError
DEFAULT_BLOCK_SIZE = 1024
SECONDS_PER_READ = 0.010
SECONDS_PER_WRITE = 0.010
class RTT:
"""
RTT communication class
Based off: https://github.com/thomasstenersen/pyrtt-viewer/blob/master/pyrtt-vie... | [
"time.sleep",
"threading.Event",
"sys.stdin.readline",
"threading.Thread",
"sys.stdout.flush",
"sys.stdout.write"
] | [((1369, 1386), 'threading.Event', 'threading.Event', ([], {}), '()\n', (1384, 1386), False, 'import threading\n'), ((1451, 1488), 'threading.Thread', 'threading.Thread', ([], {'target': 'self._reader'}), '(target=self._reader)\n', (1467, 1488), False, 'import threading\n'), ((1555, 1592), 'threading.Thread', 'threadin... |
# -*- coding: utf-8 -*-
"""
Make figures for MUSim paper
AUTHOR: <NAME>
VERSION DATE: 26 June 2019
"""
import os
from os.path import join
import numpy as np
import pandas as pd
from statsmodels.stats.proportion import proportion_confint
import matplotlib.pyplot as plt
def binom_ci_precision(proporti... | [
"os.listdir",
"numpy.sqrt",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.xticks",
"statsmodels.stats.proportion.proportion_confint",
"numpy.arange",
"matplotlib.pyplot.xlabel",
"os.path.join",
"matplotlib.pyplot.close",
"matplotlib.pyplot.axhline",
"matplotlib.pyplot.ylim",
"matplotlib.pypl... | [((480, 539), 'statsmodels.stats.proportion.proportion_confint', 'proportion_confint', (['count', 'nobs'], {'method': 'method', 'alpha': 'alpha'}), '(count, nobs, method=method, alpha=alpha)\n', (498, 539), False, 'from statsmodels.stats.proportion import proportion_confint\n'), ((1754, 1787), 'matplotlib.pyplot.xticks... |
from __future__ import print_function
from argparse import ArgumentParser
from fastai.learner import *
from fastai.column_data import *
import numpy as np
import pandas as pd
def build_parser():
parser = ArgumentParser()
parser.add_argument('--data', type=str, nargs=None, dest='in_path', help='input file pa... | [
"argparse.ArgumentParser",
"pandas.read_csv",
"numpy.array",
"pandas.DataFrame",
"pandas.melt"
] | [((211, 227), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (225, 227), False, 'from argparse import ArgumentParser\n'), ((1605, 1694), 'pandas.read_csv', 'pd.read_csv', (['in_path'], {'sep': '""","""', 'low_memory': '(False)', 'index_col': '[0]', 'error_bad_lines': '(False)'}), "(in_path, sep=',', low... |
from pyworkforce.shifts import MinAbsDifference, MinRequiredResources
import pytest
def test_min_abs_difference_schedule():
required_resources = [
[9, 11, 17, 9, 7, 12, 5, 11, 8, 9, 18, 17, 8, 12, 16, 8, 7, 12, 11, 10, 13, 19, 16, 7],
[13, 13, 12, 15, 18, 20, 13, 16, 17, 8, 13, 11, 6, 19, 11, 20, ... | [
"pyworkforce.shifts.MinRequiredResources",
"pytest.raises",
"pyworkforce.shifts.MinAbsDifference"
] | [((822, 1003), 'pyworkforce.shifts.MinAbsDifference', 'MinAbsDifference', ([], {'num_days': 'num_days', 'periods': '(24)', 'shifts_coverage': 'shifts_coverage', 'required_resources': 'required_resources', 'max_period_concurrency': '(25)', 'max_shift_concurrency': '(20)'}), '(num_days=num_days, periods=24, shifts_covera... |
# GENERATED BY KOMAND SDK - DO NOT EDIT
from setuptools import setup, find_packages
setup(name='cisco_umbrella_enforcement-rapid7-plugin',
version='1.0.0',
description='Cisco Umbrella Enforcement give technology partners the ability to send security events from their platform/service/appliance within a cu... | [
"setuptools.find_packages"
] | [((460, 475), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (473, 475), False, 'from setuptools import setup, find_packages\n')] |
# Generated by Django 3.2.8 on 2021-10-10 14:32
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Ticket',
fields=[
('id', models.BigAutoFiel... | [
"django.db.models.CharField",
"django.db.models.BigAutoField"
] | [((302, 398), 'django.db.models.BigAutoField', 'models.BigAutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (321, 398), False, 'from django.db import migrations, m... |
# %%
import matplotlib.pyplot as plt
import numpy as np
import sklearn
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
from model.inceptionv4 import inceptionv4
from model.mobilenetv2 import mobilenetv2
from model.resnet import resnet18
from model.shufflenetv2 imp... | [
"sklearn.metrics.accuracy_score",
"s3_dataset.PlantDataSetB",
"numpy.arange",
"torch.load",
"torch.max",
"numpy.array",
"torch.cuda.is_available",
"s3_dataset.PlantDataSet",
"torch.no_grad",
"matplotlib.pyplot.matshow",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.rc",
"matplotlib.pyplot... | [((7200, 7234), 'matplotlib.pyplot.matshow', 'plt.matshow', (['cm'], {'cmap': 'plt.cm.Blues'}), '(cm, cmap=plt.cm.Blues)\n', (7211, 7234), True, 'import matplotlib.pyplot as plt\n'), ((2225, 2249), 's3_dataset.PlantDataSet', 'PlantDataSet', ([], {'flag': '"""val"""'}), "(flag='val')\n", (2237, 2249), False, 'from s3_da... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: syft_proto/execution/v1/protocol.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import sym... | [
"google.protobuf.reflection.GeneratedProtocolMessageType",
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor.FieldDescriptor",
"google.protobuf.descriptor.FileDescriptor"
] | [((400, 426), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (424, 426), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((636, 1676), 'google.protobuf.descriptor.FileDescriptor', '_descriptor.FileDescriptor', ([], {'name': '"""syft_proto/execution/v... |
# -----------------------------------------------------------------------------
# NDN Repo delete client.
#
# @Author <EMAIL>
# @Date 2019-09-26
# -----------------------------------------------------------------------------
import os
import sys
sys.path.insert(1, os.path.join(sys.path[0], '..'))
import argparse
im... | [
"os.path.join",
"logging.info",
"ndn.utils.gen_nonce",
"asyncio.sleep"
] | [((268, 299), 'os.path.join', 'os.path.join', (['sys.path[0]', '""".."""'], {}), "(sys.path[0], '..')\n", (280, 299), False, 'import os\n'), ((2051, 2062), 'ndn.utils.gen_nonce', 'gen_nonce', ([], {}), '()\n', (2060, 2062), False, 'from ndn.utils import gen_nonce\n'), ((2898, 2936), 'logging.info', 'logging.info', (['f... |
import threading
import datetime
import serial
import functions
from queue import Queue
rf_port = 'COM4'
ser_rf = serial.Serial(rf_port, baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=1, xonxoff=0)
iver = '3089'
send_through_rf_every = 2
def read_rf():
"""Read RF port"""
ser_rf.reset_input_bu... | [
"threading.Timer",
"functions.osd_ack",
"functions.received_stream",
"datetime.datetime.now",
"functions.osd",
"serial.Serial",
"functions.osi"
] | [((118, 217), 'serial.Serial', 'serial.Serial', (['rf_port'], {'baudrate': '(9600)', 'bytesize': '(8)', 'parity': '"""N"""', 'stopbits': '(1)', 'timeout': '(1)', 'xonxoff': '(0)'}), "(rf_port, baudrate=9600, bytesize=8, parity='N', stopbits=1,\n timeout=1, xonxoff=0)\n", (131, 217), False, 'import serial\n'), ((1849... |
"""The Rituals Perfume Genie integration."""
from datetime import timedelta
import logging
import aiohttp
from pyrituals import Account, Diffuser
from openpeerpower.config_entries import ConfigEntry
from openpeerpower.core import OpenPeerPower
from openpeerpower.exceptions import ConfigEntryNotReady
from openpeerpowe... | [
"logging.getLogger",
"datetime.timedelta",
"pyrituals.Account",
"openpeerpower.helpers.aiohttp_client.async_get_clientsession"
] | [((609, 636), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (626, 636), False, 'import logging\n'), ((656, 677), 'datetime.timedelta', 'timedelta', ([], {'seconds': '(30)'}), '(seconds=30)\n', (665, 677), False, 'from datetime import timedelta\n'), ((823, 851), 'openpeerpower.helpers.aio... |
"""Copyright (c) 2021, <NAME>. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in w... | [
"data.schemas.Pet.from_orm"
] | [((1063, 1091), 'data.schemas.Pet.from_orm', 'schemas.Pet.from_orm', (['db_pet'], {}), '(db_pet)\n', (1083, 1091), False, 'from data import schemas\n'), ((1350, 1378), 'data.schemas.Pet.from_orm', 'schemas.Pet.from_orm', (['db_pet'], {}), '(db_pet)\n', (1370, 1378), False, 'from data import schemas\n'), ((1790, 1818), ... |
from configparser import ConfigParser
import os
from dotenv import load_dotenv
import pathlib
from shutil import copyfile
from execution_engine2.db.models.models import Job, JobInput, Meta
from dateutil import parser as dateparser
import requests
import json
from datetime import datetime
from execution_engine2.exceptio... | [
"os.path.exists",
"execution_engine2.exceptions.MalformedTimestampException",
"datetime.datetime.fromtimestamp",
"configparser.ConfigParser",
"execution_engine2.db.models.models.JobInput",
"requests.Response",
"json.dumps",
"dotenv.load_dotenv",
"execution_engine2.db.models.models.Job",
"shutil.co... | [((529, 534), 'execution_engine2.db.models.models.Job', 'Job', ([], {}), '()\n', (532, 534), False, 'from execution_engine2.db.models.models import Job, JobInput, Meta\n'), ((587, 597), 'execution_engine2.db.models.models.JobInput', 'JobInput', ([], {}), '()\n', (595, 597), False, 'from execution_engine2.db.models.mode... |
# -*- coding: utf-8 -*-
import asyncio
import socket
from xTool.servers.tcp import TCPServer
def test_tcp_server(aiomisc_unused_port):
loop = asyncio.get_event_loop()
class TestTcpService(TCPServer):
DATA = []
async def handle_client(self, reader: asyncio.StreamReader,
... | [
"asyncio.get_event_loop",
"socket.socket",
"asyncio.sleep"
] | [((149, 173), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (171, 173), False, 'import asyncio\n'), ((638, 687), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (651, 687), False, 'import socket\n'), ((826, 842), 'asynci... |
import decimal
import itertools
import random
from datetime import date, timedelta
import factory
from applications.enums import ApplicationStatus, ApplicationStep, BenefitType
from applications.models import (
AhjoDecision,
Application,
APPLICATION_LANGUAGE_CHOICES,
ApplicationBasis,
ApplicationBa... | [
"factory.SubFactory",
"random.randint",
"users.tests.factories.HandlerFactory",
"datetime.date.today",
"factory.RelatedFactory",
"datetime.timedelta",
"factory.Faker",
"itertools.count",
"calculator.models.Calculation.objects.create_for_application",
"factory.Sequence",
"factory.SelfAttribute",
... | [((581, 618), 'factory.Faker', 'factory.Faker', (['"""sentence"""'], {'nb_words': '(2)'}), "('sentence', nb_words=2)\n", (594, 618), False, 'import factory\n'), ((966, 1019), 'factory.Faker', 'factory.Faker', (['"""pyint"""'], {'min_value': '(1)', 'max_value': '(100000)'}), "('pyint', min_value=1, max_value=100000)\n",... |
import random
class Play:
def __init__(self, name="Player"):
self.name = name
def print_name(self):
print("your name is ", self.name)
def TossDie(self, x=1):
for i in range(x):
print(random.randint(1, 6))
def RPC(self, x=1):
for i in range(x):
... | [
"random.choice",
"random.randint"
] | [((238, 258), 'random.randint', 'random.randint', (['(1)', '(6)'], {}), '(1, 6)\n', (252, 258), False, 'import random\n'), ((383, 405), 'random.choice', 'random.choice', (['options'], {}), '(options)\n', (396, 405), False, 'import random\n')] |
"""
According with BUG-132 was added table GitHubBugoutUser.
It requires additional script to generate BugoutUser for existing installations
after database migration.
"""
import argparse
import uuid
from ..models import GitHubOAuthEvent, GitHubBugoutUser
from ...broodusers import bugout_api
from ...db import yield_con... | [
"argparse.ArgumentParser",
"uuid.uuid4"
] | [((2672, 2764), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate Bugout user and group for installations"""'}), "(description=\n 'Generate Bugout user and group for installations')\n", (2695, 2764), False, 'import argparse\n'), ((1228, 1240), 'uuid.uuid4', 'uuid.uuid4', ([], {}... |
import numpy as np
import json
import re
from Utils import *
np.random.seed(4)
def output_process(example):
state = e['state'][-1]
if type(state) == str:
return state
else:
return ' '.join(state)
def polish_notation(steps):
step_mapping = {}
for ix, s in enumerate(steps):
... | [
"re.findall",
"numpy.random.seed",
"numpy.random.shuffle"
] | [((62, 79), 'numpy.random.seed', 'np.random.seed', (['(4)'], {}), '(4)\n', (76, 79), True, 'import numpy as np\n'), ((5577, 5600), 'numpy.random.shuffle', 'np.random.shuffle', (['data'], {}), '(data)\n', (5594, 5600), True, 'import numpy as np\n'), ((335, 360), 're.findall', 're.findall', (['"""@@\\\\d+@@"""', 's'], {}... |
#G.Benelli Feb 7 2008
#This fragment is used to have the random generator seeds saved to test
#simulation reproducibility. Anothe fragment then allows to run on the
#root output of cmsDriver.py to test reproducibility.
import FWCore.ParameterSet.Config as cms
def customise(process):
#Renaming the process
proce... | [
"FWCore.ParameterSet.Config.EDProducer",
"FWCore.ParameterSet.Config.Service",
"FWCore.ParameterSet.Config.untracked.int32",
"FWCore.ParameterSet.Config.Path",
"FWCore.ParameterSet.Config.untracked.bool"
] | [((420, 463), 'FWCore.ParameterSet.Config.EDProducer', 'cms.EDProducer', (['"""RandomEngineStateProducer"""'], {}), "('RandomEngineStateProducer')\n", (434, 463), True, 'import FWCore.ParameterSet.Config as cms\n'), ((615, 642), 'FWCore.ParameterSet.Config.Path', 'cms.Path', (['process.rndmStore'], {}), '(process.rndmS... |
import rosebot
import time
def led():
robot = rosebot.RoseBot()
robot.drive_system.go(30, 30)
while True:
distance = robot.sensor_system.ir_proximity_sensor.get_distance_in_inches()
delay = distance/500
robot.led_system.left_led.turn_on()
time.sleep(delay)
robot.l... | [
"rosebot.RoseBot",
"time.sleep"
] | [((54, 71), 'rosebot.RoseBot', 'rosebot.RoseBot', ([], {}), '()\n', (69, 71), False, 'import rosebot\n'), ((692, 709), 'rosebot.RoseBot', 'rosebot.RoseBot', ([], {}), '()\n', (707, 709), False, 'import rosebot\n'), ((832, 845), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (842, 845), False, 'import time\n'), ((2... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: proto/lib/python/bytes.proto
"""Generated protocol buffer code."""
# third party
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import ... | [
"google.protobuf.descriptor_pool.Default",
"google.protobuf.symbol_database.Default"
] | [((461, 487), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (485, 487), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((503, 529), 'google.protobuf.descriptor_pool.Default', '_descriptor_pool.Default', ([], {}), '()\n', (527, 529), True, 'from goo... |
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../clients/python"))
import pypartisci
server, port = "localhost", 7777
apps = ["Demo App A",
"Demo App B"]
hosts = ["host1.example.com",
"host2.example.com"]
versions = ["1.0", "2.0"]
for app in apps:
for i, hos... | [
"os.path.dirname",
"pypartisci.send_http"
] | [((54, 79), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (69, 79), False, 'import os\n'), ((351, 409), 'pypartisci.send_http', 'pypartisci.send_http', (['server', 'port', 'app', 'versions[i]', 'host'], {}), '(server, port, app, versions[i], host)\n', (371, 409), False, 'import pypartisci\n'... |
from cv2 import cv2
import numpy as np
import sys
import os
from base import normalize
# some parameters of training and testing data
train_sub_count = 40
train_img_count = 5
total_face = 200
row = 70
col = 70
def eigenfaces_train(src_path):
img_list = np.empty((row*col, total_face))
count = 0
... | [
"numpy.mat",
"cv2.cv2.imread",
"numpy.argsort",
"numpy.sum",
"numpy.array",
"numpy.empty",
"numpy.linalg.eigh",
"numpy.matrix"
] | [((273, 306), 'numpy.empty', 'np.empty', (['(row * col, total_face)'], {}), '((row * col, total_face))\n', (281, 306), True, 'import numpy as np\n'), ((803, 836), 'numpy.empty', 'np.empty', (['(row * col, total_face)'], {}), '((row * col, total_face))\n', (811, 836), True, 'import numpy as np\n'), ((1048, 1067), 'numpy... |
# Generated by Django 2.2.5 on 2019-09-24 12:07
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('request', '0002_auto_20190924_1811'),
]
operations = [
migrations.CreateModel(
name='PoliceOffi... | [
"django.db.models.AutoField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((680, 805), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'null': '(True)', 'on_delete': 'django.db.models.deletion.SET_NULL', 'to': '"""request.PoliceOffice"""', 'verbose_name': '"""경찰서"""'}), "(null=True, on_delete=django.db.models.deletion.SET_NULL,\n to='request.PoliceOffice', verbose_name='경찰서')\n... |
# -*- coding: utf-8 -*-
"""json_fmtr.py
This module implements a MediaTypeFormatter with JSON response.
This module was originally shipped as an example code from https://github.com/DataBooster/PyWebApi, licensed under the MIT license.
Anyone who obtains a copy of this code is welcome to modify it for any... | [
"jsonpickle.dumps"
] | [((885, 905), 'jsonpickle.dumps', 'dumps', (['obj'], {}), '(obj, **kwargs)\n', (890, 905), False, 'from jsonpickle import dumps\n')] |
from django import template
from django.template.defaultfilters import stringfilter
register = template.Library()
@register.filter
@stringfilter
def FindPhoto(value):
if "%photo%" in str(value):
return True
else:
return False
@register.filter
@stringfilter
def ReplacePhoto(value):
return... | [
"django.template.Library"
] | [((96, 114), 'django.template.Library', 'template.Library', ([], {}), '()\n', (112, 114), False, 'from django import template\n')] |
"""
contains several global data classes (for log entries for example)
Author: `HBernigau <https://github.com/HBernigau>`_
Date: 01.2022
"""
import marshmallow_dataclass as mmdc
import marshmallow
from logging import StreamHandler
from typing import Any
from dataclasses import is_dataclass, dataclass, field
from date... | [
"logging.getLogger",
"logging.NullHandler",
"logging.StreamHandler",
"threading.current_thread",
"logging.Formatter",
"time.sleep",
"threading.get_ident",
"marshmallow_dataclass.NewType",
"os.getpid",
"logging.Logger",
"warnings.warn",
"dataclasses.is_dataclass",
"dataclasses.field"
] | [((431, 487), 'marshmallow_dataclass.NewType', 'mmdc.NewType', (['"""UUID"""', 'str'], {'field': 'marshmallow.fields.UUID'}), "('UUID', str, field=marshmallow.fields.UUID)\n", (443, 487), True, 'import marshmallow_dataclass as mmdc\n'), ((828, 863), 'dataclasses.field', 'field', ([], {'default_factory': 'datetime.now'}... |
from run_translation.TestModelComputer import asl_translation
from run_translation.TextToSpeech import tts
from run_translation.RunPiModelStream import rasp_translation
# from run_translation.RunPiModelTesting import rasp_translation
from run_translation.TestModelComputerLetters import asl_translation_letters
# from ru... | [
"run_translation.TestModelComputer.asl_translation"
] | [((437, 462), 'run_translation.TestModelComputer.asl_translation', 'asl_translation', ([], {'CAM_ID': '(1)'}), '(CAM_ID=1)\n', (452, 462), False, 'from run_translation.TestModelComputer import asl_translation\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
wz_table/spreadsheet_make.py
Last updated: 2019-10-14
Create a new spreadsheet (.xlsx).
=+LICENCE=============================
Copyright 2017-2019 <NAME>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in comp... | [
"openpyxl.worksheet.datavalidation.DataValidation",
"os.path.join",
"openpyxl.styles.Font",
"os.path.dirname",
"openpyxl.utils.get_column_letter",
"openpyxl.styles.Side",
"openpyxl.styles.Protection",
"openpyxl.styles.Alignment",
"openpyxl.Workbook",
"openpyxl.styles.PatternFill",
"openpyxl.work... | [((1389, 1399), 'openpyxl.Workbook', 'Workbook', ([], {}), '()\n', (1397, 1399), False, 'from openpyxl import Workbook\n'), ((8720, 8782), 'openpyxl.worksheet.datavalidation.DataValidation', 'DataValidation', ([], {'type': '"""textLength"""', 'operator': 'op', 'formula1': 'chars'}), "(type='textLength', operator=op, fo... |
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint
T = 200
h = 1e-2
t = np.arange(start=0, stop=T + h, step=h)
bet, gam = 0.15, 1 / 50
# todo: zmienic poziej na randoma
# S_pocz = np.random.uniform(0.7, 1)
S_start = 0.8
I_start = 1 - S_start
R_start = 0
N = S_start + I_start + R_sta... | [
"scipy.integrate.odeint",
"numpy.log",
"matplotlib.pyplot.subplots",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((108, 146), 'numpy.arange', 'np.arange', ([], {'start': '(0)', 'stop': '(T + h)', 'step': 'h'}), '(start=0, stop=T + h, step=h)\n', (117, 146), True, 'import numpy as np\n'), ((1261, 1308), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': '(1)', 'ncols': '(1)', 'figsize': '(10, 4)'}), '(nrows=1, ncols=1, ... |
import numpy as np
from skfuzzy import cmeans
from config import NAN, FCMParam
class FCMeansEstimator:
def __init__(self, c, m, data):
self.c = c
self.m = m
self.data = data
self.complete_rows, self.incomplete_rows = self.__extract_rows()
# Extract complete and incomplete row... | [
"numpy.where",
"numpy.array",
"numpy.power",
"numpy.linalg.norm"
] | [((873, 925), 'numpy.array', 'np.array', (['[self.data[x] for x in self.complete_rows]'], {}), '([self.data[x] for x in self.complete_rows])\n', (881, 925), True, 'import numpy as np\n'), ((2284, 2308), 'numpy.array', 'np.array', (['estimated_data'], {}), '(estimated_data)\n', (2292, 2308), True, 'import numpy as np\n'... |
#!/usr/bin/env python3
"""
Author : RoxanneB <<EMAIL>>
Date : 2021-10-07
Purpose: Rock the Casbah
"""
import argparse
import sys
import string
from collections import defaultdict
# --------------------------------------------------
def get_args():
"""Get command-line arguments"""
parser = argparse.Argument... | [
"argparse.FileType",
"collections.defaultdict",
"argparse.ArgumentParser"
] | [((303, 418), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Rock the Casbah"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description='Rock the Casbah', formatter_class=\n argparse.ArgumentDefaultsHelpFormatter)\n", (326, 418), False, 'import argparse\n'), ((2... |
import datetime
import os
if __name__ == '__main__':
date_str = datetime.datetime.now().strftime("%Y-%m-%d-%H-%M")
print(date_str)
os.system('zip -r tc-rapids-{}.zip triangle-counting technical_report.pdf -x *cmake-build-debug/* -x */CMake* -x *.idea/*'.format(date_str))
| [
"datetime.datetime.now"
] | [((69, 92), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (90, 92), False, 'import datetime\n')] |
'''This package sets up the admin interface for the :mod:`papers` app.'''
from django.contrib import admin
from projects.models import Funding, FundingAgency
class FundingAdmin(admin.ModelAdmin):
'''The :class:`~projects.models.Funding` model admin is the default.'''
pass
admin.site.register(Funding, Fundi... | [
"django.contrib.admin.site.register"
] | [((286, 328), 'django.contrib.admin.site.register', 'admin.site.register', (['Funding', 'FundingAdmin'], {}), '(Funding, FundingAdmin)\n', (305, 328), False, 'from django.contrib import admin\n'), ((469, 523), 'django.contrib.admin.site.register', 'admin.site.register', (['FundingAgency', 'FundingAgencyAdmin'], {}), '(... |
import sim
import utils
import numpy as np
import matplotlib.pyplot as plt
import argparse
def main():
my_parser = argparse.ArgumentParser(description='Parameters for Simulation')
my_parser.add_argument('-N', '--n_cars', type=int, action='store', help='Number of cars', default = 40)
my_parser.add_argumen... | [
"sim.populate_arrays",
"utils.plot_simulation",
"argparse.ArgumentParser",
"utils.estimate_flow",
"sim.run_simulation",
"numpy.zeros",
"matplotlib.pyplot.show"
] | [((122, 186), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Parameters for Simulation"""'}), "(description='Parameters for Simulation')\n", (145, 186), False, 'import argparse\n'), ((744, 755), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (752, 755), True, 'import numpy as np\n'), (... |
from PythonAPI.bam import BAM
import numpy as np
dataset_dir = '/home/beatriz/Documentos/Work/final_datasets' # For Bea
# dataset_dir = '/home/almartmen/Github/aikapi' # For Alberto
dataset_name = '181129'
bam = BAM(dataset_dir, dataset_name, image_format='png')
# bam.unroll_videos()
# print(bam.get_persons_in... | [
"PythonAPI.bam.BAM"
] | [((219, 269), 'PythonAPI.bam.BAM', 'BAM', (['dataset_dir', 'dataset_name'], {'image_format': '"""png"""'}), "(dataset_dir, dataset_name, image_format='png')\n", (222, 269), False, 'from PythonAPI.bam import BAM\n')] |
#!/usr/bin/env/python3
import setuptools
with open("README.md", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="Amazon DenseClus",
version="0.0.19",
author="<NAME>",
description="Dense Clustering for Mixed Data Types",
long_description=long_description,
long_d... | [
"setuptools.find_packages"
] | [((429, 455), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (453, 455), False, 'import setuptools\n')] |