code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
# FYP2017
# Program to establish ZigBee communication between raspberry Pi and arduino
# Complete control of HVAC elements based on commands sent from the Pi (TESTING)
# Author: <NAME>
# License: Public Domain
import time
import serial
#import fuzzy
hour = 3600
PORT = '/dev/ttyUSB0'
BAUD_RATE = 9600
# Open serial p... | [
"serial.Serial",
"time.sleep"
] | [((330, 360), 'serial.Serial', 'serial.Serial', (['PORT', 'BAUD_RATE'], {}), '(PORT, BAUD_RATE)\n', (343, 360), False, 'import serial\n'), ((489, 502), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (499, 502), False, 'import time\n'), ((1085, 1100), 'time.sleep', 'time.sleep', (['(300)'], {}), '(300)\n', (1095, 1... |
"""Added description/enabled for ApiKey
Revision ID: 2aac1d0ee9a6
Revises: 44dd7b053ec1
Create Date: 2015-01-28 14:51:32.783446
"""
# revision identifiers, used by Alembic.
revision = '2aac1d0ee9a6'
down_revision = '44dd7b053ec1'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto ... | [
"sqlalchemy.String",
"alembic.op.drop_column",
"sqlalchemy.Boolean",
"sqlalchemy.DateTime"
] | [((737, 775), 'alembic.op.drop_column', 'op.drop_column', (['"""apikeys"""', '"""last_used"""'], {}), "('apikeys', 'last_used')\n", (751, 775), False, 'from alembic import op\n'), ((780, 820), 'alembic.op.drop_column', 'op.drop_column', (['"""apikeys"""', '"""description"""'], {}), "('apikeys', 'description')\n", (794,... |
#!/usr/bin/env python3
# data analysis
from datetime import datetime
import sys
import os
import shutil
import time
import csv
import argparse
import numpy as np
import pandas as pd
GIT_REPO = "https://tbd.com"
class GoogleBucketUtil:
"""
This class postprocesses data collected during the personality network... | [
"argparse.ArgumentParser",
"os.path.basename",
"shutil.rmtree",
"os.path.join",
"os.listdir"
] | [((2770, 2815), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'prg_desc'}), '(description=prg_desc)\n', (2793, 2815), False, 'import argparse\n'), ((867, 892), 'os.listdir', 'os.listdir', (['self.csv_path'], {}), '(self.csv_path)\n', (877, 892), False, 'import os\n'), ((2188, 2213), 'os.lis... |
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2020 FABRIC Testbed
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to ... | [
"six.add_metaclass"
] | [((1256, 1282), 'six.add_metaclass', 'six.add_metaclass', (['ABCMeta'], {}), '(ABCMeta)\n', (1273, 1282), False, 'import six\n')] |
"""
Problem 44: Pentagon numbers
https://projecteuler.net/problem=44
Pentagonal numbers are generated by the formula, P_n=n*(3n−1)/2.
The first ten pentagonal numbers are:
1, 5, 12, 22, 35, 51, 70, 92, 117, 145, ...
It can be seen that P_4 + P_7 = 22 + 70 = 92 = P8.
However, their difference, 70 − 22 = 48, is not pe... | [
"src.common.special_numbers.is_pentagonal_number",
"src.common.special_numbers.get_pentagonal_number",
"heapq.heappush",
"heapq.heappop"
] | [((814, 843), 'heapq.heappush', 'heappush', (['prio_q', '(0, (1, 2))'], {}), '(prio_q, (0, (1, 2)))\n', (822, 843), False, 'from heapq import heappush, heappop\n'), ((879, 894), 'heapq.heappop', 'heappop', (['prio_q'], {}), '(prio_q)\n', (886, 894), False, 'from heapq import heappush, heappop\n'), ((930, 954), 'src.com... |
import gdsfactory as gf
sample_rotation = """
name: sample_rotation
instances:
r1:
component: rectangle
settings:
size: [4, 2]
r2:
component: rectangle
settings:
size: [2, 4]
placements:
r1:
xmin: 0
ymin: 0
r2:
rotation: -90
xmin: r1,east
... | [
"gdsfactory.read.from_yaml"
] | [((377, 411), 'gdsfactory.read.from_yaml', 'gf.read.from_yaml', (['sample_rotation'], {}), '(sample_rotation)\n', (394, 411), True, 'import gdsfactory as gf\n')] |
import datetime
import tomodachi
from app import router
from app.shared.data import clean
from settings import settings
from service.base import Base
from service.context import LambdaContext, LambdaEvent
class Service(Base):
name = 'require-id'
routes = {
('api', 'status'): ('GET', settings.app_api... | [
"service.context.LambdaContext",
"datetime.datetime.utcnow",
"datetime.timedelta",
"tomodachi.http",
"tomodachi.schedule",
"service.context.LambdaEvent"
] | [((1078, 1145), 'tomodachi.http', 'tomodachi.http', (['"""*"""', '"""/(?P<api>[^/]+?)/(?P<function_name>[^/]+?)/?"""'], {}), "('*', '/(?P<api>[^/]+?)/(?P<function_name>[^/]+?)/?')\n", (1092, 1145), False, 'import tomodachi\n'), ((2051, 2099), 'tomodachi.schedule', 'tomodachi.schedule', (['"""minutely"""'], {'immediatel... |
from unittest.mock import patch
from django.test import TestCase, tag
from data_refinery_common.models import (
DownloaderJob,
DownloaderJobOriginalFileAssociation,
OriginalFile,
ProcessorJob,
SurveyJob,
)
from data_refinery_workers.downloaders import transcriptome_index
class DownloadTranscript... | [
"data_refinery_common.models.OriginalFile",
"data_refinery_common.models.DownloaderJob",
"data_refinery_common.models.DownloaderJobOriginalFileAssociation",
"unittest.mock.patch",
"data_refinery_workers.downloaders.transcriptome_index.download_transcriptome",
"django.test.tag",
"data_refinery_common.mod... | [((891, 909), 'django.test.tag', 'tag', (['"""downloaders"""'], {}), "('downloaders')\n", (894, 909), False, 'from django.test import TestCase, tag\n'), ((915, 986), 'unittest.mock.patch', 'patch', (['"""data_refinery_workers.downloaders.transcriptome_index.send_job"""'], {}), "('data_refinery_workers.downloaders.trans... |
import pytest
import torch
from colossalai.gemini.stateful_tensor import TensorState, StatefulTensor
@pytest.mark.dist
def test_gemini_manager():
# reset the manager, in case that there exists memory information left
manager = StatefulTensor.GST_MGR
manager.reset()
# occupation 8
st... | [
"colossalai.gemini.stateful_tensor.StatefulTensor",
"torch.empty",
"torch.device"
] | [((528, 557), 'torch.empty', 'torch.empty', (['(7)'], {'device': '"""cuda"""'}), "(7, device='cuda')\n", (539, 557), False, 'import torch\n'), ((589, 617), 'torch.empty', 'torch.empty', (['(3)'], {'device': '"""cpu"""'}), "(3, device='cpu')\n", (600, 617), False, 'import torch\n'), ((629, 675), 'colossalai.gemini.state... |
"""ProtoFlow layers test suite."""
import unittest
import numpy as np
from protoflow import layers
class TestPrototypes(unittest.TestCase):
def setUp(self):
pass
def test_prototype_labels(self):
p = layers.Prototypes1D(nclasses=3, prototypes_per_class=1)
# yapf: disable
act... | [
"numpy.testing.assert_array_equal",
"protoflow.layers.Prototypes1D",
"numpy.argmin",
"numpy.array",
"protoflow.layers.WTAC"
] | [((229, 284), 'protoflow.layers.Prototypes1D', 'layers.Prototypes1D', ([], {'nclasses': '(3)', 'prototypes_per_class': '(1)'}), '(nclasses=3, prototypes_per_class=1)\n', (248, 284), False, 'from protoflow import layers\n'), ((371, 390), 'numpy.array', 'np.array', (['[0, 1, 2]'], {}), '([0, 1, 2])\n', (379, 390), True, ... |
# pylint: skip-file
"""
Tests encode_text function
"""
import unittest
from lab_4.main import encode_text, WordStorage
class EncodeCorpusTest(unittest.TestCase):
"""
checks for encode_text function.
Score 4 or above function
"""
def test_encode_text_ideal(self):
"""
Tests tha... | [
"lab_4.main.encode_text",
"lab_4.main.WordStorage"
] | [((417, 430), 'lab_4.main.WordStorage', 'WordStorage', ([], {}), '()\n', (428, 430), False, 'from lab_4.main import encode_text, WordStorage\n'), ((596, 629), 'lab_4.main.encode_text', 'encode_text', (['word_storage', 'corpus'], {}), '(word_storage, corpus)\n', (607, 629), False, 'from lab_4.main import encode_text, Wo... |
from django.views.generic import TemplateView
from charingcross.utils import github_from_request
IN_PROGRESS="status/in-progress"
AT_RISK="status/at-risk"
DELAYED="status/delayed"
POSTPONED="status/postponed"
PRIORITY_P1 = "priority/P1"
PRIORITY_P2 = "priority/P2"
PRIORITY_P3 = "priority/P3"
PRIORITY_UNKNOWN = "priori... | [
"charingcross.utils.github_from_request"
] | [((518, 551), 'charingcross.utils.github_from_request', 'github_from_request', (['self.request'], {}), '(self.request)\n', (537, 551), False, 'from charingcross.utils import github_from_request\n')] |
from collections import Counter
from flask import Flask, jsonify, request
from worker.celery import make_celery
from tasks import enhance_speech
app = Flask(__name__)
app.config.from_object("config")
client = make_celery(app)
@app.route('/transcript', methods=['POST'])
def transcript():
"""
Enqueues a speec... | [
"tasks.enhance_speech.delay",
"flask.Flask",
"worker.celery.make_celery",
"flask.jsonify",
"collections.Counter",
"flask.request.get_json"
] | [((153, 168), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (158, 168), False, 'from flask import Flask, jsonify, request\n'), ((212, 228), 'worker.celery.make_celery', 'make_celery', (['app'], {}), '(app)\n', (223, 228), False, 'from worker.celery import make_celery\n'), ((384, 402), 'flask.request.get_j... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... | [
"language.search_agents.muzero.types.HistoryEntry.get_window_around_substr",
"language.search_agents.muzero.utils.escape_for_lucene",
"language.search_agents.muzero.utils.gold_answer_present",
"dataclasses.field",
"re.findall",
"language.search_agents.muzero.utils.ndcg_score",
"dataclasses.dataclass"
] | [((879, 922), 'dataclasses.dataclass', 'dataclasses.dataclass', ([], {'frozen': '(True)', 'eq': '(True)'}), '(frozen=True, eq=True)\n', (900, 922), False, 'import dataclasses\n'), ((1082, 1121), 'dataclasses.field', 'dataclasses.field', ([], {'default_factory': 'list'}), '(default_factory=list)\n', (1099, 1121), False,... |
# -*- coding: utf-8 -*-
# @Author: <NAME>
# @Date: 2016-03-21 01:05:00
# @Last Modified by: <NAME>
# @Last Modified time: 2016-08-15 23:13:45
import os
import csv
import pickle
COMMITS_COUNT_THRESHOLD = 10
def filter_repository(repo):
if repo.commits_count >= 0 and repo.commits_count <= COMMITS_COUNT_THRESHOL... | [
"pickle.dump",
"os.path.join",
"csv.writer"
] | [((506, 526), 'csv.writer', 'csv.writer', (['csv_file'], {}), '(csv_file)\n', (516, 526), False, 'import csv\n'), ((1436, 1466), 'pickle.dump', 'pickle.dump', (['data', 'pickle_file'], {}), '(data, pickle_file)\n', (1447, 1466), False, 'import pickle\n'), ((423, 468), 'os.path.join', 'os.path.join', (['directory', "(de... |
import os
import pandas as pd
import numpy as np
from tqdm import tqdm
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-i', type=str, help="path to directory containing data")
parser.add_argument('-o', type=str, help="output path", default="test.csv")
args = parser.parse_args()
print("reading ... | [
"pandas.DataFrame",
"argparse.ArgumentParser",
"pandas.read_csv",
"numpy.zeros",
"numpy.ones",
"pandas.concat",
"os.listdir"
] | [((97, 122), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (120, 122), False, 'import argparse\n'), ((347, 361), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (359, 361), True, 'import pandas as pd\n'), ((383, 401), 'os.listdir', 'os.listdir', (['args.i'], {}), '(args.i)\n', (393, 401)... |
import collections
class Solution:
def customSortString(self, S: str, T: str) -> str:
table = collections.Counter(T)
result = []
for c in S:
if c in table:
result.append(c*table[c])
table[c] = 0
for c, v in table.items():
if v >... | [
"collections.Counter"
] | [((106, 128), 'collections.Counter', 'collections.Counter', (['T'], {}), '(T)\n', (125, 128), False, 'import collections\n')] |
from autolens.lens.model.visualizer import Visualizer
from autolens.imaging.plot.fit_imaging_plotters import FitImagingPlotter
from autolens.lens.model.visualizer import plot_setting
class VisualizerImaging(Visualizer):
def visualize_fit_imaging(self, fit, during_analysis, subfolders="fit_imaging"):
... | [
"autolens.lens.model.visualizer.plot_setting",
"autolens.imaging.plot.fit_imaging_plotters.FitImagingPlotter"
] | [((509, 588), 'autolens.imaging.plot.fit_imaging_plotters.FitImagingPlotter', 'FitImagingPlotter', ([], {'fit': 'fit', 'mat_plot_2d': 'mat_plot_2d', 'include_2d': 'self.include_2d'}), '(fit=fit, mat_plot_2d=mat_plot_2d, include_2d=self.include_2d)\n', (526, 588), False, 'from autolens.imaging.plot.fit_imaging_plotters ... |
# coding:utf-8
import os
import subprocess
class JavaImage():
def __init__(self, *args, **kwargs):
self.codeDir = kwargs["codeDir"]
self.mvnScript = kwargs["shell_file"]
self.dockerImage = kwargs["imageTag"]
def mvn_command(self, capture_output=True):
self.out = subprocess.ru... | [
"subprocess.run",
"os.path.abspath",
"os.path.join"
] | [((744, 845), 'subprocess.run', 'subprocess.run', (['command'], {'shell': '(True)', 'encoding': '"""utf-8"""', 'capture_output': 'capture_output', 'timeout': '(30)'}), "(command, shell=True, encoding='utf-8', capture_output=\n capture_output, timeout=30)\n", (758, 845), False, 'import subprocess\n'), ((995, 1084), '... |
# Discrete state spaces useful for sequences
#
# Copyright (c) 2015 <NAME>. This is free software. See
# LICENSE for details.
import bisect
import itertools as itools
from . import general
class StateSpaceError(Exception):
pass
# TODO refactor to consolidate behavior, perhaps into an abstract superclass Dis... | [
"bisect.bisect",
"itertools.chain.from_iterable",
"itertools.count"
] | [((10682, 10720), 'bisect.bisect', 'bisect.bisect', (['self._partitions', 'index'], {}), '(self._partitions, index)\n', (10695, 10720), False, 'import bisect\n'), ((820, 834), 'itertools.count', 'itools.count', ([], {}), '()\n', (832, 834), True, 'import itertools as itools\n'), ((5805, 5819), 'itertools.count', 'itool... |
'''
A user on the QGIS Open Day telegram requested assitance loading CSV data which had geojson geometries.
A proposed solution was to convert the data to wkt which QGIS recognises natively in csvs
The fields in the sample data were:
map id,map name,tehsil,village,geojson,khasara no
The geojson included feature coll... | [
"tempfile.NamedTemporaryFile",
"csv.reader",
"csv.writer",
"json.loads",
"shutil.move",
"shapely.geometry.shape"
] | [((886, 937), 'tempfile.NamedTemporaryFile', 'NamedTemporaryFile', (['"""w+t"""'], {'newline': '""""""', 'delete': '(False)'}), "('w+t', newline='', delete=False)\n", (904, 937), False, 'from tempfile import NamedTemporaryFile\n'), ((2120, 2156), 'shutil.move', 'shutil.move', (['tempfile.name', 'filename'], {}), '(temp... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import tensorflow as tf
from niftynet.layer.base_layer import Layer
from niftynet.layer.base_layer import TrainableLayer
from niftynet.layer.linear_resize import LinearResizeLayer as ResizingLayer
from niftynet.layer.deconvolution import D... | [
"niftynet.layer.layer_util.check_divisible_channels",
"tensorflow.reduce_sum",
"niftynet.layer.deconvolution.DeconvolutionalLayer",
"niftynet.layer.linear_resize.LinearResizeLayer",
"niftynet.layer.base_layer.TrainableLayer.__init__",
"tensorflow.stack",
"niftynet.layer.elementwise.ElementwiseLayer"
] | [((1938, 1991), 'niftynet.layer.layer_util.check_divisible_channels', 'check_divisible_channels', (['input_tensor', 'self.n_splits'], {}), '(input_tensor, self.n_splits)\n', (1962, 1991), False, 'from niftynet.layer.layer_util import check_divisible_channels\n'), ((2018, 2046), 'niftynet.layer.linear_resize.LinearResiz... |
#!/usr/bin/env python
# coding: utf-8
# In[2]:
#adapted from code by paulvangent @ <EMAIL>
#data is from <NAME>
import matplotlib.pyplot as plt
import numpy as np
import heartpy as hp
import os
import pandas as pd
import scipy.signal
import mne
file = "/Users/mary-jo.ajiduah/Desktop/ECGnew/ecgReading1.edf"
data = ... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"heartpy.scale_data",
"heartpy.remove_baseline_wander",
"mne.io.read_raw_edf",
"matplotlib.pyplot.figure"
] | [((320, 395), 'mne.io.read_raw_edf', 'mne.io.read_raw_edf', (['file'], {'preload': '(True)', 'stim_channel': '"""auto"""', 'verbose': '(False)'}), "(file, preload=True, stim_channel='auto', verbose=False)\n", (339, 395), False, 'import mne\n'), ((636, 649), 'matplotlib.pyplot.plot', 'plt.plot', (['ecg'], {}), '(ecg)\n'... |
# helper functions
import os
import cv2
import math
import numpy as np
from skimage.measure import compare_ssim as ssim
# function to calculate the peak signal to noise ratio of low resolution and high resolution
def psnr(l_res, h_res):
# convert the image data to floats
l_resData = l_res.astype(float)
... | [
"skimage.measure.compare_ssim",
"cv2.cvtColor",
"numpy.zeros",
"numpy.mod",
"cv2.imread",
"math.log10",
"numpy.mean",
"os.path.split",
"os.listdir",
"cv2.resize"
] | [((1342, 1358), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (1352, 1358), False, 'import os\n'), ((2331, 2355), 'os.path.split', 'os.path.split', (['test_path'], {}), '(test_path)\n', (2344, 2355), False, 'import os\n'), ((2365, 2386), 'cv2.imread', 'cv2.imread', (['test_path'], {}), '(test_path)\n', (2375,... |
import cv2
import torch
import time
import numpy as np
from gym.core import Env
from gym.spaces.box import Box
from beautifultable import BeautifulTable
class DotReacherEnv(Env):
def __init__(self, pos_tol=0.25, vel_tol=0.1, dt=1, timeout=20000, clamp_action=False):
""" Continuous Action Space; Accelera... | [
"numpy.random.seed",
"torch.cat",
"numpy.ones",
"numpy.mean",
"cv2.rectangle",
"numpy.round",
"numpy.std",
"torch.zeros",
"matplotlib.pyplot.pause",
"cv2.circle",
"matplotlib.pyplot.show",
"numpy.median",
"torch.manual_seed",
"time.sleep",
"matplotlib.pyplot.ion",
"torch.clamp",
"tor... | [((4915, 4935), 'torch.manual_seed', 'torch.manual_seed', (['(3)'], {}), '(3)\n', (4932, 4935), False, 'import torch\n'), ((6155, 6169), 'numpy.array', 'np.array', (['rets'], {}), '(rets)\n', (6163, 6169), True, 'import numpy as np\n'), ((6184, 6201), 'numpy.array', 'np.array', (['ep_lens'], {}), '(ep_lens)\n', (6192, ... |
from typing import TypeVar
T = TypeVar('T')
def identity(x: T) -> T:
"""
:param x:
:return: itself, is equivalent to lambda x: x
"""
return x
| [
"typing.TypeVar"
] | [((32, 44), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (39, 44), False, 'from typing import TypeVar\n')] |
#!/usr/bin/env python
# coding: utf-8
# In[81]:
from bs4 import BeautifulSoup
import urllib.request
from time import sleep
from datetime import datetime
import pandas as pd
import requests
import re
from datetime import date
import numpy as np
import matplotlib.pyplot as plt
import sea... | [
"openpyxl.Workbook",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"openpyxl.load_workbook",
"sklearn.tree.DecisionTreeClassifier",
"treeVis.vis",
"sklearn.preprocessing.LabelEncoder",
"requests.get",
"metrics.matrix",
"matplotlib.pyplot.show",
"preprocessing.scaler",
"datetim... | [((3543, 3595), 'pandas.read_excel', 'pd.read_excel', (['"""data.xlsx"""', '"""Sheet1"""'], {'index_col': 'None'}), "('data.xlsx', 'Sheet1', index_col=None)\n", (3556, 3595), True, 'import pandas as pd\n'), ((3975, 3985), 'preprocessing.splitter', 'splitter', ([], {}), '()\n', (3983, 3985), False, 'from preprocessing i... |
import requests
import re
import os
import os.path
import pickle
from hybra import core
from ipywidgets import IntProgress
from IPython.display import display, HTML
MY_DIR = os.path.dirname(os.path.realpath(__file__))
default_stopwords = open( MY_DIR + '/stop_generic_en.txt').readlines() + open( MY_DIR + '/stop_gen... | [
"os.remove",
"os.path.realpath",
"IPython.display.display",
"os.path.isfile",
"hybra.core.plugin",
"requests.post",
"re.sub",
"IPython.display.HTML"
] | [((193, 219), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (209, 219), False, 'import os\n'), ((3086, 3264), 'hybra.core.plugin', 'core.plugin', (["(MY_DIR + '/stm.r')"], {'documents': 'documents', 'timestamps': 'timestamps', 'sources': 'source_details', 'authors': 'authors', 'texts': 'te... |
# -*- coding: utf-8 -*-
"""
flask-snow
~~~~~~~~~~~~
Adds pysnow (ServiceNow) support to Flask
More information:
https://github.com/rbw0/flask-snow
https://github.com/rbw0/pysnow
"""
__author__ = "<NAME> <<EMAIL>>"
__version__ = "0.2.8"
import warnings
# noinspection PyProtectedMember
from ... | [
"pysnow.Client",
"pysnow.OAuthClient",
"warnings.warn"
] | [((3362, 3618), 'pysnow.Client', 'Client', ([], {'instance': "current_app.config['SNOW_INSTANCE']", 'host': "current_app.config['SNOW_HOST']", 'user': "current_app.config['SNOW_USER']", 'password': "current_app.config['SNOW_PASSWORD']", 'use_ssl': "current_app.config['SNOW_USE_SSL']", 'session': 'self._session'}), "(in... |
import requests
from plugin import plugin
# ANSI escape sequences to print in color
class color:
GREEN = '\033[92m'
RED = '\033[91m'
TAIL = '\033[0m'
# List of default crypto pairs
favorite = [
'BTC/USD',
'BTC/ETH',
'BTC/LTC',
'BTC/XRP'
]
# If the price is down, print in red. If the pr... | [
"plugin.plugin",
"requests.get"
] | [((1419, 1442), 'plugin.plugin', 'plugin', (['"""cryptotracker"""'], {}), "('cryptotracker')\n", (1425, 1442), False, 'from plugin import plugin\n'), ((916, 933), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (928, 933), False, 'import requests\n')] |
"""
BSD 3-Clause License
Copyright (c) 2017, <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions an... | [
"packagetemplate.log_trace",
"sys.exit",
"logging.getLogger",
"packagetemplate.log_config",
"warnings.warn",
"packagetemplate.TemplateModuleError"
] | [((1755, 1782), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1772, 1782), False, 'import logging\n'), ((2039, 2081), 'packagetemplate.TemplateModuleError', 'TemplateModuleError', (['"""Called function err"""'], {}), "('Called function err')\n", (2058, 2081), False, 'from packagetemplat... |
from unittest import TestCase
from msgraphcore.middleware.options.auth_middleware_options import AuthMiddlewareOptions
class TestMiddlewareOptions(TestCase):
def test_multiple_scopes(self):
graph_scopes = 'https://graph.microsoft.com/v1.0?scopes=mail.read%20user.read%20'
auth_options = AuthMiddle... | [
"msgraphcore.middleware.options.auth_middleware_options.AuthMiddlewareOptions"
] | [((310, 345), 'msgraphcore.middleware.options.auth_middleware_options.AuthMiddlewareOptions', 'AuthMiddlewareOptions', (['graph_scopes'], {}), '(graph_scopes)\n', (331, 345), False, 'from msgraphcore.middleware.options.auth_middleware_options import AuthMiddlewareOptions\n')] |
import matplotlib.pyplot as plt
import json
with open('output2.json') as f:
y = json.load(f)
import json
with open('output1.json') as f:
x = json.load(f)
plt.scatter(x['result'], y['result'])
plt.savefig('./output3.png')
plt.show()
| [
"matplotlib.pyplot.scatter",
"json.load",
"matplotlib.pyplot.show",
"matplotlib.pyplot.savefig"
] | [((167, 204), 'matplotlib.pyplot.scatter', 'plt.scatter', (["x['result']", "y['result']"], {}), "(x['result'], y['result'])\n", (178, 204), True, 'import matplotlib.pyplot as plt\n'), ((205, 233), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""./output3.png"""'], {}), "('./output3.png')\n", (216, 233), True, 'import... |
"""Unit tests for rbtools.api.resource."""
from __future__ import unicode_literals
from six.moves import range
from rbtools.api.factory import create_resource
from rbtools.api.request import HttpRequest
from rbtools.api.resource import (CountResource,
ItemResource,
... | [
"rbtools.api.resource.RESOURCE_MAP.pop",
"six.moves.range",
"rbtools.api.factory.create_resource"
] | [((4006, 4057), 'rbtools.api.resource.RESOURCE_MAP.pop', 'RESOURCE_MAP.pop', (['"""application/vnd.test.item"""', 'None'], {}), "('application/vnd.test.item', None)\n", (4022, 4057), False, 'from rbtools.api.resource import CountResource, ItemResource, ListResource, RESOURCE_MAP, ResourceDictField, ResourceLinkField, R... |
# coding: utf-8
# # Exercise Introduction
#
# The cameraman who shot our deep learning videos mentioned a frustrating problem that we could solve with deep learning.
#
# He offers a service that scans photographs and slides to store them digitally. He uses a machine that quickly scans many photos. But depending ... | [
"tensorflow.python.keras.preprocessing.image.ImageDataGenerator",
"tensorflow.python.keras.layers.Dense",
"tensorflow.python.keras.models.Sequential",
"tensorflow.python.keras.applications.ResNet50"
] | [((1823, 1835), 'tensorflow.python.keras.models.Sequential', 'Sequential', ([], {}), '()\n', (1833, 1835), False, 'from tensorflow.python.keras.models import Sequential\n'), ((3562, 3582), 'tensorflow.python.keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {}), '()\n', (3580, 3582), False, 'fro... |
#!/usr/bin/python
# Filename: turtle_01_show_turtle.py
import turtle
window = turtle.Screen()
t = turtle.Turtle()
window.exitonclick()
| [
"turtle.Screen",
"turtle.Turtle"
] | [((79, 94), 'turtle.Screen', 'turtle.Screen', ([], {}), '()\n', (92, 94), False, 'import turtle\n'), ((99, 114), 'turtle.Turtle', 'turtle.Turtle', ([], {}), '()\n', (112, 114), False, 'import turtle\n')] |
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
import base64
import binascii
import copy
import struct
import xml.etree.ElementTree as ET
from urllib.parse import urlparse
from svtplay_dl.error import ServiceError
from svtplay_dl.error import UIException
from svtplay_dl.fetche... | [
"svtplay_dl.utils.output.ETA",
"svtplay_dl.utils.output.output",
"svtplay_dl.utils.output.progress_stream.write",
"struct.unpack",
"xml.etree.ElementTree.XML",
"copy.copy",
"base64.b64decode",
"binascii.a2b_hex",
"svtplay_dl.error.ServiceError",
"urllib.parse.urlparse",
"struct.unpack_from"
] | [((1156, 1168), 'xml.etree.ElementTree.XML', 'ET.XML', (['data'], {}), '(data)\n', (1162, 1168), True, 'import xml.etree.ElementTree as ET\n'), ((1643, 1661), 'urllib.parse.urlparse', 'urlparse', (['manifest'], {}), '(manifest)\n', (1651, 1661), False, 'from urllib.parse import urlparse\n'), ((1411, 1453), 'svtplay_dl.... |
import pandas as pd
import numpy as np
from sklearn.preprocessing import MinMaxScaler
#The Data
with open('kddcup.names', 'r') as infile:
kdd_names = infile.readlines()
kdd_cols = [x.split(':')[0] for x in kdd_names[1:]]
kdd_cols += ['class', 'difficulty']
kdd = pd.read_csv('nsl-KDDTrain+.txt', names=kd... | [
"matplotlib.pyplot.title",
"sklearn.metrics.confusion_matrix",
"numpy.argmax",
"pandas.read_csv",
"sklearn.preprocessing.MinMaxScaler",
"sklearn.metrics.f1_score",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.yticks",
"matplotlib.py... | [((279, 327), 'pandas.read_csv', 'pd.read_csv', (['"""nsl-KDDTrain+.txt"""'], {'names': 'kdd_cols'}), "('nsl-KDDTrain+.txt', names=kdd_cols)\n", (290, 327), True, 'import pandas as pd\n'), ((337, 384), 'pandas.read_csv', 'pd.read_csv', (['"""nsl-KDDTest+.txt"""'], {'names': 'kdd_cols'}), "('nsl-KDDTest+.txt', names=kdd... |
from utils import is_none, key_dict_to_camel_case
class PolicieRoleRepresentation:
decisionStrategy: str
name: str
type: str
roles: list
logic: str
def __init__(self, name: str, roles: list, type: str = "role", decisionStrategy: str = "UNANIMOUS", logic: str = "POSITIVE") -> None:
self.... | [
"utils.key_dict_to_camel_case",
"utils.is_none"
] | [((585, 612), 'utils.key_dict_to_camel_case', 'key_dict_to_camel_case', (['obj'], {}), '(obj)\n', (607, 612), False, 'from utils import is_none, key_dict_to_camel_case\n'), ((1036, 1079), 'utils.is_none', 'is_none', (['self.decisionStrategy', '"""UNANIMOUS"""'], {}), "(self.decisionStrategy, 'UNANIMOUS')\n", (1043, 107... |
# -*- encoding: utf-8 -*-
import logging
logger = logging.getLogger('lb.utils')
| [
"logging.getLogger"
] | [((51, 80), 'logging.getLogger', 'logging.getLogger', (['"""lb.utils"""'], {}), "('lb.utils')\n", (68, 80), False, 'import logging\n')] |
import platform
import os
import wfdb
import glob
import numpy as np
from os.path import join
from biosppy.signals import ecg
from Helpers.Physionet import LoadFile, PhysionetConstants
from Helpers.Metrices import *
segmenters = [ecg.hamilton_segmenter, ecg.engzee_segmenter]
def from_3dbs(dbcode, patient_nr):
re... | [
"platform.system",
"os.path.join",
"numpy.array",
"os.getcwd"
] | [((339, 356), 'platform.system', 'platform.system', ([], {}), '()\n', (354, 356), False, 'import platform\n'), ((567, 597), 'os.path.join', 'join', (['base_dir_raw', 'patient_nr'], {}), '(base_dir_raw, patient_nr)\n', (571, 597), False, 'from os.path import join\n'), ((406, 417), 'os.getcwd', 'os.getcwd', ([], {}), '()... |
# -*- coding: utf-8 -*-
import sys
import os
def app_path(name):
if getattr(sys, 'frozen', False): #是否Bundle Resource
base_path = sys._MEIPASS
else:
base_path = os.path.abspath(".")
return os.path.join(base_path, name)
if __name__ == '__main__':
app_path('test.txt')
| [
"os.path.abspath",
"os.path.join"
] | [((219, 248), 'os.path.join', 'os.path.join', (['base_path', 'name'], {}), '(base_path, name)\n', (231, 248), False, 'import os\n'), ((187, 207), 'os.path.abspath', 'os.path.abspath', (['"""."""'], {}), "('.')\n", (202, 207), False, 'import os\n')] |
# coding: utf-8
from synthpop.recipes.starter2 import Starter
from synthpop.synthesizer import synthesize_all, enable_logging
import pandas as pd
import os
import sys
from multiprocessing import Process, Lock, Queue
from datetime import datetime
def synthesize_runner(indexes_queue, county_name, state_abbr, lock, star... | [
"os.getpid",
"multiprocessing.Lock",
"synthpop.recipes.starter2.Starter",
"os.environ.get",
"os.cpu_count",
"pandas.Series",
"multiprocessing.Queue",
"synthpop.synthesizer.enable_logging",
"sys.exit",
"multiprocessing.Process",
"datetime.datetime.now",
"os.sched_getaffinity",
"synthpop.synth... | [((1424, 1464), 'synthpop.synthesizer.synthesize_all', 'synthesize_all', (['starter'], {'indexes': 'indexes'}), '(starter, indexes=indexes)\n', (1438, 1464), False, 'from synthpop.synthesizer import synthesize_all, enable_logging\n'), ((2975, 3029), 'synthpop.recipes.starter2.Starter', 'Starter', (["os.environ['CENSUS'... |
from ConfigSpace import ConfigurationSpace
from ConfigSpace.hyperparameters import UniformFloatHyperparameter, UniformIntegerHyperparameter, \
CategoricalHyperparameter, UnParametrizedHyperparameter
from lightgbm import LGBMClassifier
class LightGBM:
def __init__(self, n_estimators, num_leaves, learning_rate,... | [
"ConfigSpace.ConfigurationSpace",
"lightgbm.LGBMClassifier",
"ConfigSpace.hyperparameters.UniformIntegerHyperparameter",
"ConfigSpace.hyperparameters.UnParametrizedHyperparameter",
"ConfigSpace.hyperparameters.UniformFloatHyperparameter"
] | [((967, 1334), 'lightgbm.LGBMClassifier', 'LGBMClassifier', ([], {'n_estimators': 'self.n_estimators', 'num_leaves': 'self.num_leaves', 'max_depth': 'self.max_depth', 'learning_rate': 'self.learning_rate', 'min_child_weight': 'self.min_child_weight', 'subsample': 'self.subsample', 'colsample_bytree': 'self.colsample_by... |
import random
from numeric import *
LIMIT_STUCK = 100 # Max number of evaluations enduring no improvement
def main():
# Create an instance of numerical optimization problem
p = createProblem() # 'p': (expr, domain)
# Call the search algorithm
solution, minimum = firstChoice(p)
# Show the problem... | [
"random.choice"
] | [((1197, 1217), 'random.choice', 'random.choice', (['d_ran'], {}), '(d_ran)\n', (1210, 1217), False, 'import random\n')] |
#!/usr/bin/env python
import pandas as pd
import sys
file_name = sys.argv[1]
summits = pd.read_csv(file_name, header=None, sep='\t')
def create_consensus_elements(ranges):
'''Create consensus elements from summit cluster file'''
ranges = ranges.split(',')
x = [(j.split('-')[1:]) for j in ranges]
chro... | [
"pandas.read_csv"
] | [((89, 134), 'pandas.read_csv', 'pd.read_csv', (['file_name'], {'header': 'None', 'sep': '"""\t"""'}), "(file_name, header=None, sep='\\t')\n", (100, 134), True, 'import pandas as pd\n')] |
import pytest
from Untyped.Automata import Automaton
from Untyped.Other import make_random_automaton
COOPERATE = 0
DEFECT = 1
t1 = [[1, 1],
[1, 1]]
def defects(p0):
return Automaton(DEFECT, p0, t1, DEFECT)
t2 = [[0, 0],
[0, 0]]
def cooperates(p0):
return Automaton(COOPERATE, p0, t2, COOPERATE)
t... | [
"Untyped.Automata.Automaton",
"Untyped.Other.make_random_automaton"
] | [((184, 217), 'Untyped.Automata.Automaton', 'Automaton', (['DEFECT', 'p0', 't1', 'DEFECT'], {}), '(DEFECT, p0, t1, DEFECT)\n', (193, 217), False, 'from Untyped.Automata import Automaton\n'), ((278, 317), 'Untyped.Automata.Automaton', 'Automaton', (['COOPERATE', 'p0', 't2', 'COOPERATE'], {}), '(COOPERATE, p0, t2, COOPER... |
# Generated by Django 3.1.6 on 2021-03-20 02:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0011_auto_20210313_2132'),
]
operations = [
migrations.AlterField(
model_name='user',
name='avatar',
... | [
"django.db.models.CharField"
] | [((332, 363), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(10)'}), '(max_length=10)\n', (348, 363), False, 'from django.db import migrations, models\n')] |
from trader import Trader
from data_utils import *
from stellar_sdk import Server, Asset
def main():
my_secret_key = input("Enter secret key: ").strip().upper()
serv = Server('https://horizon.stellar.org')
xlm = Asset.native()
usdc = Asset('USDC', 'GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4K... | [
"stellar_sdk.Server",
"trader.Trader",
"stellar_sdk.Asset",
"stellar_sdk.Asset.native"
] | [((178, 215), 'stellar_sdk.Server', 'Server', (['"""https://horizon.stellar.org"""'], {}), "('https://horizon.stellar.org')\n", (184, 215), False, 'from stellar_sdk import Server, Asset\n'), ((226, 240), 'stellar_sdk.Asset.native', 'Asset.native', ([], {}), '()\n', (238, 240), False, 'from stellar_sdk import Server, As... |
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import NoSuchElementException, NoAlertPresentException, UnexpectedAlertPresentException, WebDriverException
from httplib import BadStatusLine
import time, sys
import env, log
from ope... | [
"log.step_fail",
"env.threadlocal.BROWSER.switch_to_default_content",
"env.threadlocal.BROWSER.switch_to.window",
"env.threadlocal.BROWSER.switch_to_alert",
"env.threadlocal.BROWSER.switch_to.default_content",
"log.step_pass",
"env.threadlocal.BROWSER.find_elements",
"env.threadlocal.BROWSER.execute_s... | [((1483, 1558), 'log.step_normal', 'log.step_normal', (["(u'Element [%s]: Scroll To [%s, %s]' % (cls.__name__, x, y))"], {}), "(u'Element [%s]: Scroll To [%s, %s]' % (cls.__name__, x, y))\n", (1498, 1558), False, 'import env, log\n'), ((1567, 1642), 'env.threadlocal.BROWSER.execute_script', 'env.threadlocal.BROWSER.exe... |
""" gdsfactory loads a configuration from 3 files, high priority overwrites low priority:
1. A config.yml found in the current working directory (highest priority)
2. ~/.gdsfactory/config.yml specific for the machine
3. the default_config in pp/config.py (lowest priority)
`CONFIG` has all the paths that we do not car... | [
"json.dump",
"io.StringIO",
"omegaconf.OmegaConf.to_yaml",
"tempfile.TemporaryDirectory",
"pathlib.Path.home",
"logging.basicConfig",
"logging.warning",
"subprocess.check_output",
"omegaconf.OmegaConf.load",
"omegaconf.OmegaConf.merge",
"git.Repo",
"numpy.log10",
"pathlib.Path",
"pprint.pp... | [((722, 741), 'pathlib.Path.home', 'pathlib.Path.home', ([], {}), '()\n', (739, 741), False, 'import pathlib\n'), ((748, 766), 'pathlib.Path.cwd', 'pathlib.Path.cwd', ([], {}), '()\n', (764, 766), False, 'import pathlib\n'), ((4814, 4948), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': "(CONFIG['build_... |
import numpy as np
simulate = 1000
class Nodo:
def __init__(self):
self.position = np.array([0, 0])
self.initial_position = np.array([0, 0])
self.directions = {'up': np.array([0, 1]),
'down': np.array([0, -1]),
'right': np.array([1, 0])... | [
"numpy.array_equal",
"numpy.array",
"numpy.random.shuffle"
] | [((677, 729), 'numpy.array_equal', 'np.array_equal', (['node.position', 'node.initial_position'], {}), '(node.position, node.initial_position)\n', (691, 729), True, 'import numpy as np\n'), ((97, 113), 'numpy.array', 'np.array', (['[0, 0]'], {}), '([0, 0])\n', (105, 113), True, 'import numpy as np\n'), ((146, 162), 'nu... |
# coding: utf-8
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, PermissionsMixin
from django.db import models
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
class Manager(BaseUserManager):
def create_user(self, username, password):
user ... | [
"django.db.models.CharField",
"django.utils.translation.gettext_lazy"
] | [((1077, 1121), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)', 'unique': '(True)'}), '(max_length=50, unique=True)\n', (1093, 1121), False, 'from django.db import models\n'), ((1164, 1179), 'django.utils.translation.gettext_lazy', '_', (['"""experience"""'], {}), "('experience')\n", (1165... |
from bs4 import BeautifulSoup
import json
import pandas as pd
import requests
"""
ALPHAVANTAGE API IS USED
www.alphantage.co
API Paramaters
function - data we need to pull: pricing, indicators, etc.
symbol - stock ticker symbol
outputsize - compact for 100 data points or full for 20+ years
datatype - json and csv are ... | [
"pandas.DataFrame",
"pandas.read_html",
"pandas.DataFrame.transpose",
"requests.get",
"bs4.BeautifulSoup"
] | [((1228, 1257), 'requests.get', 'requests.get', (['string_complete'], {}), '(string_complete)\n', (1240, 1257), False, 'import requests\n'), ((1470, 1485), 'pandas.DataFrame', 'pd.DataFrame', (['j'], {}), '(j)\n', (1482, 1485), True, 'import pandas as pd\n'), ((1527, 1553), 'pandas.DataFrame.transpose', 'pd.DataFrame.t... |
import os
import tempfile
from galaxy import model
from galaxy.job_execution.output_collect import (
dataset_collector,
JobContext,
)
from galaxy.model.dataset_collections import builder
from galaxy.tool_util.parser.output_collection_def import FilePatternDatasetCollectionDescription
from galaxy.tool_util.prov... | [
"galaxy.model.Job",
"galaxy.model.User",
"galaxy.job_execution.output_collect.JobContext",
"galaxy.model.dataset_collections.builder.BoundCollectionBuilder",
"galaxy.tool_util.provided_metadata.NullToolProvidedMetadata",
"galaxy.job_execution.output_collect.dataset_collector",
"galaxy.model.DatasetColle... | [((1208, 1256), 'galaxy.model.User', 'model.User', ([], {'email': '"""<EMAIL>"""', 'password': '"""password"""'}), "(email='<EMAIL>', password='password')\n", (1218, 1256), False, 'from galaxy import model\n'), ((1265, 1307), 'galaxy.model.History', 'model.History', ([], {'name': '"""Test History"""', 'user': 'u'}), "(... |
import os
import collections
import pandas as pd
import tensorflow as tf
import tensorflow_hub as hub
from datetime import datetime
import bert
from bert import run_classifier
from bert import optimization
from bert import tokenization
from bert import modeling
BERT_VOCAB = './ml-assets/vocab.txt'
BERT_INIT_CHKPNT = '... | [
"bert.modeling.get_assignment_map_from_checkpoint",
"tensorflow.logging.info",
"tensorflow.trainable_variables",
"pandas.read_csv",
"tensorflow.train.Scaffold",
"tensorflow.nn.sigmoid_cross_entropy_with_logits",
"tensorflow.matmul",
"tensorflow.estimator.Estimator",
"tensorflow.split",
"os.path.jo... | [((395, 464), 'bert.tokenization.validate_case_matches_checkpoint', 'tokenization.validate_case_matches_checkpoint', (['(True)', 'BERT_INIT_CHKPNT'], {}), '(True, BERT_INIT_CHKPNT)\n', (440, 464), False, 'from bert import tokenization\n'), ((477, 546), 'bert.tokenization.FullTokenizer', 'tokenization.FullTokenizer', ([... |
"""Styling offers a way to offshore static data from your game into a .spys
file, improving the separation of code and data."""
import spyral
import parsley
import string
from ast import literal_eval
parser = None
def init():
"""
Initializes the Styler.
"""
global parser
parser = StyleParser()
... | [
"parsley.makeGrammar",
"spyral._get_spyral_path"
] | [((444, 563), 'parsley.makeGrammar', 'parsley.makeGrammar', (['style_file', "{'string': string, 'parser': parser, 'leval': literal_eval, 'Vec2D': spyral\n .Vec2D}"], {}), "(style_file, {'string': string, 'parser': parser,\n 'leval': literal_eval, 'Vec2D': spyral.Vec2D})\n", (463, 563), False, 'import parsley\n'),... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-10 10:17
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.A... | [
"django.db.models.TextField",
"django.db.migrations.swappable_dependency",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.BooleanField",
"django.db.models.AutoField"
] | [((278, 335), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (309, 335), False, 'from django.db import migrations, models\n'), ((468, 561), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
#!/usr/bin/env python3
import os
import sys
import halo
import time
import pytezos
import argparse
from chinstrap import version
from chinstrap import chinstrapCore
from chinstrap.chinstrapCore import SmartPy
from chinstrap.chinstrapCore import Sandbox
from chinstrap.chinstrapCore import Helpers
from chinstrap.chinstra... | [
"argparse.ArgumentParser",
"chinstrap.chinstrapCore.Helpers.confirmChinstrapProjectDirectory",
"chinstrap.chinstrapCore.ChinstrapState",
"halo.Halo",
"chinstrap.chinstrapCore.InitChinstrap",
"chinstrap.chinstrapCore.Origination",
"chinstrap.chinstrapCore.Debugger.launch",
"os.path.abspath",
"prompt_... | [((540, 649), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Chinstrap - a cute framework for developing Tezos Smart Contracts"""'}), "(description=\n 'Chinstrap - a cute framework for developing Tezos Smart Contracts')\n", (563, 649), False, 'import argparse\n'), ((2881, 2905), 'chin... |
from django.contrib import admin
from django.contrib.postgres import fields
from django_json_widget.widgets import JSONEditorWidget
from .base_admin_model import DatasetBaseAdminModel
from .. import models
from wazimap_ng.general.admin import filters
@admin.register(models.IndicatorData)
class IndicatorDataAdmin(D... | [
"django.contrib.admin.register"
] | [((257, 293), 'django.contrib.admin.register', 'admin.register', (['models.IndicatorData'], {}), '(models.IndicatorData)\n', (271, 293), False, 'from django.contrib import admin\n')] |
from collections import defaultdict
from itertools import combinations, permutations
from operator import itemgetter
import sys
import advent
def parse(input_text: str) -> tuple[tuple[int, int], dict, set]:
walls = set()
targets = {}
start = None
for i, line in enumerate(input_text.splitlines()):
... | [
"collections.defaultdict",
"itertools.permutations",
"advent.get_input"
] | [((921, 954), 'collections.defaultdict', 'defaultdict', (['(lambda : sys.maxsize)'], {}), '(lambda : sys.maxsize)\n', (932, 954), False, 'from collections import defaultdict\n'), ((1420, 1446), 'advent.get_input', 'advent.get_input', (['(2016)', '(24)'], {}), '(2016, 24)\n', (1436, 1446), False, 'import advent\n'), ((2... |
from malaya_speech.utils import (
check_file,
load_graph,
generate_session,
nodes_session,
)
from malaya_speech.model.tf import Tacotron, Fastspeech, Fastpitch
import numpy as np
def tacotron_load(
path, s3_path, model, name, normalizer, quantized=False, **kwargs
):
check_file(path[model], s3_... | [
"numpy.load",
"malaya_speech.utils.load_graph",
"malaya_speech.utils.generate_session",
"malaya_speech.utils.nodes_session",
"malaya_speech.utils.check_file"
] | [((293, 363), 'malaya_speech.utils.check_file', 'check_file', (['path[model]', 's3_path[model]'], {'quantized': 'quantized'}), '(path[model], s3_path[model], quantized=quantized, **kwargs)\n', (303, 363), False, 'from malaya_speech.utils import check_file, load_graph, generate_session, nodes_session\n'), ((463, 508), '... |
import numpy as np
import scipy.io as sio
mrf = 'ARNDCQEGHILKMFPSTWYV-';
rbm = 'AVLIPFWMGSTCYNQDEKRH-';
P = []
for idx, aa in enumerate(mrf):
P.append(next(idx2 for (idx2,aa2) in enumerate(rbm) if aa == aa2))
P = np.asarray(P) + 1;
P2 = []
for idx, aa in enumerate(rbm):
P2.append(next(idx2 for (idx2,aa2) in... | [
"numpy.asarray",
"scipy.io.savemat"
] | [((377, 420), 'scipy.io.savemat', 'sio.savemat', (['"""aa_mrf_to_rbm.mat"""', "{'P': P2}"], {}), "('aa_mrf_to_rbm.mat', {'P': P2})\n", (388, 420), True, 'import scipy.io as sio\n'), ((220, 233), 'numpy.asarray', 'np.asarray', (['P'], {}), '(P)\n', (230, 233), True, 'import numpy as np\n'), ((356, 370), 'numpy.asarray',... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from organizacion.models import *
from lugar.models import *
from smart_selects.db_fields import ChainedForeignKey
from multiselectfield import MultiSelectField
# Create your models here.
class Profesiones(models.Model):
nom... | [
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"smart_selects.db_fields.ChainedForeignKey",
"django.db.models.FloatField",
"django.db.models.IntegerField",
"django.db.models.DateField",
"multiselectfield.MultiSelectField"
] | [((326, 358), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)'}), '(max_length=200)\n', (342, 358), False, 'from django.db import models\n'), ((539, 571), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)'}), '(max_length=200)\n', (555, 571), False, 'from django.d... |
import typing # noqa: F401
import datetime as _datetime # noqa: F401
from kubernetes import client # noqa: F401
from kuber import kube_api as _kube_api # noqa: F401
from kuber import definitions as _kuber_definitions # noqa: F401
from kuber import _types # noqa: F401
from kuber.v1_21.meta_v1 import ListMeta # ... | [
"kuber.v1_21.meta_v1.ObjectMeta",
"kuber.kube_api.to_kuber_dict",
"kuber.v1_21.meta_v1.ListMeta",
"kubernetes.client.V1DeleteOptions",
"typing.cast",
"kubernetes.client.CertificatesV1Api",
"kuber.kube_api.execute"
] | [((7957, 8099), 'kuber.kube_api.execute', '_kube_api.execute', ([], {'action': '"""read"""', 'resource': 'self', 'names': 'names', 'namespace': 'namespace', 'api_client': 'None', 'api_args': "{'name': self.metadata.name}"}), "(action='read', resource=self, names=names, namespace=\n namespace, api_client=None, api_ar... |
# !/usr/bin/python3
# coding: utf_8
""" API client to fetch data using Cryptonator endpoints """
from datetime import datetime
from pyhodl.api.models import TorApiClient
from pyhodl.api.price.models import PricesApiClient
from pyhodl.config import SECONDS_IN_MIN
from pyhodl.utils.dates import get_delta_seconds
cl... | [
"pyhodl.api.models.TorApiClient.__init__",
"pyhodl.api.price.models.PricesApiClient.__init__",
"datetime.datetime.now",
"pyhodl.utils.dates.get_delta_seconds"
] | [((691, 731), 'pyhodl.api.price.models.PricesApiClient.__init__', 'PricesApiClient.__init__', (['self', 'base_url'], {}), '(self, base_url)\n', (715, 731), False, 'from pyhodl.api.price.models import PricesApiClient\n'), ((740, 772), 'pyhodl.api.models.TorApiClient.__init__', 'TorApiClient.__init__', (['self', 'tor'], ... |
import argparse
import configparser
from utils import Crawler as CoreCrawler
class Crawler(CoreCrawler):
abbr = 'IA'
def _get_remote_filename(self, local_filename):
entity_type, name = local_filename.split('|')
if entity_type in ('City', 'County'):
directory = 'General Purpose'
... | [
"configparser.ConfigParser"
] | [((573, 600), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (598, 600), False, 'import configparser\n')] |
import logging
from src.utils.config_loader import ConfigLoader
from src.evaluation.results_parser import ResultsParser
__author__ = 'dh8835'
__email__ = '<EMAIL>'
def parse_results() -> None:
"""Parse all results into one results file
:return: None
:rtype: None
"""
logger = logging.getLog... | [
"src.evaluation.results_parser.ResultsParser",
"src.utils.config_loader.ConfigLoader.load_config",
"logging.getLogger"
] | [((306, 333), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (323, 333), False, 'import logging\n'), ((448, 474), 'src.utils.config_loader.ConfigLoader.load_config', 'ConfigLoader.load_config', ([], {}), '()\n', (472, 474), False, 'from src.utils.config_loader import ConfigLoader\n'), ((5... |
import pygame
import ball
from constants import screen_width, screen_height, cyan, white
width = 88
height = 7
left = (screen_width // 2) - (width // 2)
top = screen_height - 50
bottom = top + height
mvmt_x = 8
def draw_paddle(screen):
pygame.draw.rect(screen, white, (left, top, width, height))
def move_paddle... | [
"pygame.draw.rect"
] | [((243, 302), 'pygame.draw.rect', 'pygame.draw.rect', (['screen', 'white', '(left, top, width, height)'], {}), '(screen, white, (left, top, width, height))\n', (259, 302), False, 'import pygame\n')] |
from nornir import InitNornir
from nornir.core.filter import F
from nornir_utils.plugins.functions import print_result
from nornir_netmiko import netmiko_send_command
from nornir_netmiko import netmiko_send_config
def configure_vlans(task, vlan_id, vlan_name):
# Check current VLAN configuration
multi_result ... | [
"nornir_utils.plugins.functions.print_result",
"nornir.InitNornir",
"nornir.core.filter.F"
] | [((1041, 1078), 'nornir.InitNornir', 'InitNornir', ([], {'config_file': '"""config.yaml"""'}), "(config_file='config.yaml')\n", (1051, 1078), False, 'from nornir import InitNornir\n'), ((1239, 1259), 'nornir_utils.plugins.functions.print_result', 'print_result', (['result'], {}), '(result)\n', (1251, 1259), False, 'fro... |
#imports
from urllib.request import urlopen as uReq
from bs4 import BeautifulSoup as soup
import discord
import os
from discord.ext import commands
from dotenv import load_dotenv
load_dotenv()
from discord.utils import get
#from datetime import date
#from datetime import datetime
import datetime
from time import strpti... | [
"dotenv.load_dotenv",
"discord.Embed",
"requests.get",
"bs4.BeautifulSoup"
] | [((179, 192), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (190, 192), False, 'from dotenv import load_dotenv\n'), ((861, 898), 'requests.get', 'requests.get', (['OGpage'], {'headers': 'headers'}), '(OGpage, headers=headers)\n', (873, 898), False, 'import requests\n'), ((917, 945), 'bs4.BeautifulSoup', 'soup'... |
import sqlite3
import sqlalchemy
from sqlalchemy.ext.declarative import declarative_base
import os
from sqlalchemy.orm import sessionmaker
DIR_PATH = os.path.dirname(os.path.realpath(__file__))
DB_PATH = os.path.join(DIR_PATH, "test.db")
engine = sqlalchemy.create_engine(f'sqlite:////{DB_PATH}')
Session = sessionmake... | [
"os.path.realpath",
"sqlalchemy.ext.declarative.declarative_base",
"sqlite3.connect",
"sqlalchemy.create_engine",
"sqlalchemy.orm.sessionmaker",
"os.path.join"
] | [((205, 238), 'os.path.join', 'os.path.join', (['DIR_PATH', '"""test.db"""'], {}), "(DIR_PATH, 'test.db')\n", (217, 238), False, 'import os\n'), ((249, 298), 'sqlalchemy.create_engine', 'sqlalchemy.create_engine', (['f"""sqlite:////{DB_PATH}"""'], {}), "(f'sqlite:////{DB_PATH}')\n", (273, 298), False, 'import sqlalchem... |
# generated by datamodel-codegen:
# filename: openapi.yaml
# timestamp: 2021-12-31T02:47:08+00:00
from __future__ import annotations
from enum import Enum
from typing import Annotated, Any, List, Optional
from pydantic import BaseModel, Field
class InternalErrorException(BaseModel):
__root__: Any
class ... | [
"pydantic.Field"
] | [((1964, 2016), 'pydantic.Field', 'Field', ([], {'description': '"""A list of additional artifacts."""'}), "(description='A list of additional artifacts.')\n", (1969, 2016), False, 'from pydantic import BaseModel, Field\n'), ((2104, 2223), 'pydantic.Field', 'Field', ([], {'max_length': '(128)', 'regex': '"""(arn:aws(-c... |
from unittest import TestCase
from ValidParentheses import ValidParentheses
class TestValidParentheses(TestCase):
def test_isValid(self):
vp = ValidParentheses()
self.assertTrue(vp.isValid("()"))
self.assertTrue(vp.isValid("()[]{}"))
self.assertFalse(vp.isValid("("))
s... | [
"ValidParentheses.ValidParentheses"
] | [((158, 176), 'ValidParentheses.ValidParentheses', 'ValidParentheses', ([], {}), '()\n', (174, 176), False, 'from ValidParentheses import ValidParentheses\n')] |
from preconditions import preconditions
import sys
import time
from .Board import Board
class Game:
"""Simulate the Game of Life via console animation"""
@preconditions(
lambda width: isinstance(width, int) and width > 0,
lambda height: isinstance(height, int) and height > 0,
)
def __init__(self, wid... | [
"sys.stdout.write",
"time.perf_counter"
] | [((1304, 1323), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (1321, 1323), False, 'import time\n'), ((1328, 1355), 'sys.stdout.write', 'sys.stdout.write', (['"""\x1b[2J"""'], {}), "('\\x1b[2J')\n", (1344, 1355), False, 'import sys\n'), ((1422, 1441), 'time.perf_counter', 'time.perf_counter', ([], {}), '(... |
###########################################################################################################
# Mortality Modeling
###########################################################################################################
#
# Licensed under the Apache License, Versi... | [
"pandas.DataFrame",
"sklearn.model_selection.GridSearchCV",
"warnings.filterwarnings",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.accuracy_score",
"sklearn.metrics.balanced_accuracy_score",
"sklearn.metrics.roc_auc_score",
"itertools.combinations",
"sklearn.met... | [((1270, 1303), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (1293, 1303), False, 'import warnings\n'), ((5967, 5985), 'pandas.read_csv', 'pd.read_csv', (['fname'], {}), '(fname)\n', (5978, 5985), True, 'import pandas as pd\n'), ((6319, 6388), 'pandas.concat', 'pd.concat... |
#!/usr/bin/python3
"""
Part of Red ELK
Script to generate thumbnails of images
The output is saved next to input file as ".thumb.jpg"
Authors:
- <NAME>. / <NAME>
- <NAME> (@fastlorenzo)
"""
import sys
import os
import logging
from PIL import Image
logger = logging.getLogger('makethumbnail')
try:
path = sys.ar... | [
"os.walk",
"os.path.exists",
"PIL.Image.open",
"sys.exc_info",
"os.path.join",
"logging.getLogger"
] | [((261, 295), 'logging.getLogger', 'logging.getLogger', (['"""makethumbnail"""'], {}), "('makethumbnail')\n", (278, 295), False, 'import logging\n'), ((376, 389), 'os.walk', 'os.walk', (['path'], {}), '(path)\n', (383, 389), False, 'import os\n'), ((1026, 1040), 'sys.exc_info', 'sys.exc_info', ([], {}), '()\n', (1038, ... |
#!/usr/bin/env python
# $Id$
"""366 solutions"""
import puzzler
from puzzler.puzzles.pentominoes import PentominoesPlusMonominoCross1
puzzler.run(PentominoesPlusMonominoCross1)
| [
"puzzler.run"
] | [((137, 179), 'puzzler.run', 'puzzler.run', (['PentominoesPlusMonominoCross1'], {}), '(PentominoesPlusMonominoCross1)\n', (148, 179), False, 'import puzzler\n')] |
import pyrebase
firebaseConfig = {
"apiKey": "<KEY>",
"authDomain": "resilience66-abd3e.firebaseapp.com",
"databaseURL": "https://resilience66-abd3e-default-rtdb.firebaseio.com",
"projectId": "resilience66-abd3e",
"storageBucket": "resilience66-abd3e.appspot.com",
"messagingSenderId": "975779634876",
"appId": "... | [
"pyrebase.initialize_app"
] | [((410, 449), 'pyrebase.initialize_app', 'pyrebase.initialize_app', (['firebaseConfig'], {}), '(firebaseConfig)\n', (433, 449), False, 'import pyrebase\n')] |
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/submit')
def result():
username = request.args.get('username')
upper = False
lower = False
num_end = False
for item in username: #must search ... | [
"flask.request.args.get",
"flask.Flask",
"flask.render_template"
] | [((57, 72), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (62, 72), False, 'from flask import Flask, render_template, request\n'), ((114, 143), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (129, 143), False, 'from flask import Flask, render_template, request\... |
# Generated by Django 3.1.6 on 2021-07-20 08:33
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('analyzer', '0007_auto_20210720_0833'),
('datasets', '0008_auto_20210719_2013'),
]
operations = [
migrations.RenameModel(
old_nam... | [
"django.db.migrations.RenameModel"
] | [((277, 349), 'django.db.migrations.RenameModel', 'migrations.RenameModel', ([], {'old_name': '"""DatasetSession"""', 'new_name': '"""DatasetRun"""'}), "(old_name='DatasetSession', new_name='DatasetRun')\n", (299, 349), False, 'from django.db import migrations\n')] |
from os import getenv
import sqlalchemy as sa
class Engine:
@staticmethod
def _create_engine():
host = getenv('REDSHIFT_HOST')
port = getenv('REDSHIFT_PORT')
database = getenv('REDSHIFT_DATABASE')
username = getenv('REDSHIFT_USERNAME')
password = getenv('<PASSWORD>')
... | [
"sqlalchemy.create_engine",
"os.getenv"
] | [((122, 145), 'os.getenv', 'getenv', (['"""REDSHIFT_HOST"""'], {}), "('REDSHIFT_HOST')\n", (128, 145), False, 'from os import getenv\n'), ((161, 184), 'os.getenv', 'getenv', (['"""REDSHIFT_PORT"""'], {}), "('REDSHIFT_PORT')\n", (167, 184), False, 'from os import getenv\n'), ((204, 231), 'os.getenv', 'getenv', (['"""RED... |
from scrapera.text.voice_of_america import VOAScraper
scraper = VOAScraper()
scraper.scrape(num_pages=3, out_path='path/to/output/directory', proxies=['http://172.16.17.32:8080',
'http://172.16.31.10:8080',
... | [
"scrapera.text.voice_of_america.VOAScraper"
] | [((65, 77), 'scrapera.text.voice_of_america.VOAScraper', 'VOAScraper', ([], {}), '()\n', (75, 77), False, 'from scrapera.text.voice_of_america import VOAScraper\n')] |
import logging
import math
import os
import sys
import numpy as np
import pandas as pd
"""initialize"""
pd.set_option("max_colwidth", 60) # column最大宽度
pd.set_option("display.width", 200) # dataframe宽度
pd.set_option("display.max_columns", None) # column最大显示数
pd.set_option("display.max_rows", 100) # row最大显示数
def ... | [
"pandas.DataFrame",
"logging.basicConfig",
"pandas.read_csv",
"pandas.merge",
"logging.info",
"pandas.Series",
"pandas.set_option",
"pandas.concat"
] | [((106, 139), 'pandas.set_option', 'pd.set_option', (['"""max_colwidth"""', '(60)'], {}), "('max_colwidth', 60)\n", (119, 139), True, 'import pandas as pd\n'), ((154, 189), 'pandas.set_option', 'pd.set_option', (['"""display.width"""', '(200)'], {}), "('display.width', 200)\n", (167, 189), True, 'import pandas as pd\n'... |
# -*- coding: utf-8 -*-
#
# SelfTest/Cipher/ARC2.py: Self-test for the Alleged-RC2 cipher
#
# =======================================================================
# Copyright (C) 2008 <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated... | [
"unittest.main",
"common.dict",
"common.make_block_tests"
] | [((4993, 5034), 'common.make_block_tests', 'make_block_tests', (['ARC2', '"""ARC2"""', 'test_data'], {}), "(ARC2, 'ARC2', test_data)\n", (5009, 5034), False, 'from common import make_block_tests\n'), ((5139, 5173), 'unittest.main', 'unittest.main', ([], {'defaultTest': '"""suite"""'}), "(defaultTest='suite')\n", (5152,... |
# -*- coding: utf-8 -*-
import pytest
import numpy as np
def test_one_hot():
from npdl.utils import one_hot
labels = np.array([1, 0, 3, 4])
decoded = one_hot(labels)
assert len(decoded) == len(labels)
assert np.max(decoded) == 1
assert np.min(decoded) == 0
assert np.ndim(decoded) == 2... | [
"npdl.utils.unhot",
"numpy.zeros",
"numpy.ndim",
"npdl.utils.one_hot",
"numpy.max",
"numpy.min",
"numpy.array"
] | [((131, 153), 'numpy.array', 'np.array', (['[1, 0, 3, 4]'], {}), '([1, 0, 3, 4])\n', (139, 153), True, 'import numpy as np\n'), ((168, 183), 'npdl.utils.one_hot', 'one_hot', (['labels'], {}), '(labels)\n', (175, 183), False, 'from npdl.utils import one_hot\n'), ((388, 419), 'numpy.zeros', 'np.zeros', (['(4, 5)'], {'dty... |
import os
import setuptools
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setuptools.setup(
name = "cloud-pricing",
version = "0.0.1",
author = "<NAME>",
description = ("Compare cloud compute prices."),
license = "MIT",
keywords = "cloud",
packages... | [
"os.path.dirname",
"setuptools.find_packages"
] | [((321, 347), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (345, 347), False, 'import setuptools\n'), ((75, 100), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (90, 100), False, 'import os\n')] |
from partitioner import Partitioner
from StringIO import StringIO
from compression import Compress, NoCompression, CompressionClassFactory
from sensitivity import SensitivityClassFactory
from payload import CSV, JSON, PayloadClassFactory
from metric_schema import Required, Type, Order
from collections import OrderedDic... | [
"partitioner.Partitioner",
"compression.CompressionClassFactory.instance",
"payload.PayloadClassFactory.instance",
"sensitivity.SensitivityClassFactory.instance",
"metric_schema.Order",
"collections.OrderedDict",
"logging.getLogger"
] | [((792, 866), 'partitioner.Partitioner', 'Partitioner', (['context[c.KEY_PARTITIONS]', 'context[c.KEY_SEPERATOR_PARTITION]'], {}), '(context[c.KEY_PARTITIONS], context[c.KEY_SEPERATOR_PARTITION])\n', (803, 866), False, 'from partitioner import Partitioner\n'), ((1091, 1110), 'logging.getLogger', 'logging.getLogger', ([... |
# -*- coding: utf-8 -*- #
# Copyright 2021 Google LLC. 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 requir... | [
"textwrap.dedent"
] | [((1819, 2122), 'textwrap.dedent', 'textwrap.dedent', (['""" Adds appropriate encrypt/decrypt permissions to the specified Cloud\n KMS key. This allows the Cloud Storage service agent to write and\n read Cloud KMS-encrypted objects in buckets associated with the\n service age... |
from django.shortcuts import render
from rest_framework.decorators import api_view
from django.http import HttpResponse
from .serializers import MemberSerializer
from .models import Member
# Create your views here.
@api_view(['GET'])
def i... | [
"rest_framework.decorators.api_view",
"django.http.HttpResponse"
] | [((297, 314), 'rest_framework.decorators.api_view', 'api_view', (["['GET']"], {}), "(['GET'])\n", (305, 314), False, 'from rest_framework.decorators import api_view\n'), ((434, 464), 'django.http.HttpResponse', 'HttpResponse', (['serializers.data'], {}), '(serializers.data)\n', (446, 464), False, 'from django.http impo... |
import time
import mysql.connector as ms
from datetime import date
from datetime import datetime
from datetime import timedelta
def is_day_after_current(string_input_with_date, string_input_with_time, dura):
pastd = datetime.strptime(string_input_with_date, "%Y-%m-%d")
pastt = datetime.strptime(string_input_w... | [
"datetime.datetime.strptime",
"datetime.datetime.now",
"datetime.timedelta",
"mysql.connector.connect"
] | [((222, 275), 'datetime.datetime.strptime', 'datetime.strptime', (['string_input_with_date', '"""%Y-%m-%d"""'], {}), "(string_input_with_date, '%Y-%m-%d')\n", (239, 275), False, 'from datetime import datetime\n'), ((288, 341), 'datetime.datetime.strptime', 'datetime.strptime', (['string_input_with_time', '"""%H:%M:%S""... |
import re
from datetime import timedelta, datetime
from typing import Union, Dict
from croniter import croniter
from dateutil.parser import parse
cron_presets: Dict[str, str] = {
'@hourly': '0 * * * *',
'@daily': '0 0 * * *',
'@weekly': '0 0 * * 0',
'@monthly': '0 0 1 * *',
'@quarterly': '0 0 1 */... | [
"croniter.croniter",
"dateutil.parser.parse",
"re.match"
] | [((672, 785), 're.match', 're.match', (['"""rate\\\\s*\\\\(\\\\s*(\\\\d+)\\\\s+(minute|minutes|hour|hours|day|days|month|months)\\\\s*\\\\)"""', 'schedule'], {}), "(\n 'rate\\\\s*\\\\(\\\\s*(\\\\d+)\\\\s+(minute|minutes|hour|hours|day|days|month|months)\\\\s*\\\\)'\n , schedule)\n", (680, 785), False, 'import re\... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Functions for sampling in the closed interval [low, high] quantized by q."""
from decimal import Decimal
import m... | [
"numpy.random.uniform",
"matplotlib.pyplot.show",
"numpy.log",
"numpy.log2",
"numpy.histogram",
"numpy.random.normal",
"numpy.random.lognormal",
"numpy.unique"
] | [((790, 822), 'numpy.random.uniform', 'np.random.uniform', (['low', '(high + q)'], {}), '(low, high + q)\n', (807, 822), True, 'import numpy as np\n'), ((4459, 4469), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (4467, 4469), True, 'import matplotlib.pyplot as plt\n'), ((2174, 2201), 'numpy.random.normal', '... |
#!/usr/bin/env python3
#
# Copyright (c) 2022 <NAME>
#
# MIT License - See LICENSE file accompanying this package.
#
"""Standard Pulumi CLI installer/upgrader command-line tool"""
from typing import Optional, Sequence
# do not use relative imports
from project_init_tools.installer.pulumi import default_pulumi_dir, i... | [
"project_init_tools.installer.pulumi.install_pulumi",
"argparse.ArgumentParser"
] | [((464, 557), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Install or upgrade Python Poetry package manager."""'}), "(description=\n 'Install or upgrade Python Poetry package manager.')\n", (487, 557), False, 'import argparse\n'), ((1940, 2039), 'project_init_tools.installer.pulumi.... |
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 30 10:02:52 2019
@author: BSWOOD9321
"""
import numpy as np
import numpy.linalg as la
A=np.array([[4,-2,1],[3,6,-4],[2,1,8]])
Ainv=la.inv(A)
print("A: ",A)
print("Ainv: ",Ainv)
print("A*Ainv: ",A*Ainv)
print("Ainv*A: ",Ainv*A)
Ainvtest=np.array([[52,17,2],[-32,30,... | [
"numpy.linalg.inv",
"numpy.array",
"numpy.linalg.eig"
] | [((137, 182), 'numpy.array', 'np.array', (['[[4, -2, 1], [3, 6, -4], [2, 1, 8]]'], {}), '([[4, -2, 1], [3, 6, -4], [2, 1, 8]])\n', (145, 182), True, 'import numpy as np\n'), ((181, 190), 'numpy.linalg.inv', 'la.inv', (['A'], {}), '(A)\n', (187, 190), True, 'import numpy.linalg as la\n'), ((292, 344), 'numpy.array', 'np... |
"""
Copyright 2019 EUROCONTROL
==========================================
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and... | [
"geog.propagate",
"json.dumps",
"numpy.linspace",
"re.compile"
] | [((2122, 2157), 're.compile', 're.compile', (['_ISO_8601_CHECK_PATTERN'], {}), '(_ISO_8601_CHECK_PATTERN)\n', (2132, 2157), False, 'import re\n'), ((3731, 3763), 'numpy.linspace', 'np.linspace', (['(0)', '(360)', '(n_edges + 1)'], {}), '(0, 360, n_edges + 1)\n', (3742, 3763), True, 'import numpy as np\n'), ((3779, 3828... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# =============================================================================
"""Module Built to To Read ID3 Track Data."""
# File Name: track_meta_id3.py
# =============================================================================
import time
from os import path
fro... | [
"os.path.join",
"eyed3.load",
"eyed3.id3.Tag",
"os.path.expanduser",
"time.localtime"
] | [((379, 399), 'os.path.expanduser', 'path.expanduser', (['"""~"""'], {}), "('~')\n", (394, 399), False, 'from os import path\n'), ((413, 526), 'os.path.join', 'path.join', (["(current_home +\n '/Music/iTunes/iTunes Media/Music/Rush/Chronicles (Disc 2)/2-03 Limelight.mp3'\n )"], {}), "(current_home +\n '/Music/... |
# Once-for-All: Train One Network and Specialize it for Efficient Deployment
# <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
# International Conference on Learning Representations (ICLR), 2020.
# APQ: Joint Search for Network Architecture, Pruning and Quantization Policy
# <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>,... | [
"torch.load",
"numpy.zeros",
"argparse.ArgumentParser",
"numpy.argmin"
] | [((676, 701), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (699, 701), False, 'import argparse\n'), ((1177, 1217), 'torch.load', 'torch.load', (['pth_path'], {'map_location': '"""cpu"""'}), "(pth_path, map_location='cpu')\n", (1187, 1217), False, 'import torch\n'), ((3288, 3338), 'numpy.zeros... |
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import spack.paths
from spack.util.executable import Executable
GNUPGHOME = spack.paths.gpg_path
def parse_... | [
"os.chmod",
"os.pipe",
"os.makedirs",
"os.path.exists",
"os.fdopen",
"spack.util.executable.Executable"
] | [((852, 870), 'spack.util.executable.Executable', 'Executable', (['"""gpg2"""'], {}), "('gpg2')\n", (862, 870), False, 'from spack.util.executable import Executable\n'), ((1122, 1131), 'os.pipe', 'os.pipe', ([], {}), '()\n', (1129, 1131), False, 'import os\n'), ((1144, 1161), 'os.fdopen', 'os.fdopen', (['r', '"""r"""']... |
"""
eml-mel-filterbank: Generate C code for a mel filterbank
Can be used with eml_sparse_filterbank()
"""
import argparse
import textwrap
import emlearn.signal
def mel_filterbank(args, name):
import librosa
norm = 'slaney' if args.normalize else None
mel_basis = librosa.filters.mel(sr=args.samplerate... | [
"textwrap.wrap",
"librosa.filters.mel_frequencies",
"argparse.ArgumentParser",
"librosa.filters.mel"
] | [((282, 417), 'librosa.filters.mel', 'librosa.filters.mel', ([], {'sr': 'args.samplerate', 'n_fft': 'args.fft', 'n_mels': 'args.bands', 'fmin': 'args.fmin', 'fmax': 'args.fmax', 'htk': 'args.htk', 'norm': 'norm'}), '(sr=args.samplerate, n_fft=args.fft, n_mels=args.bands,\n fmin=args.fmin, fmax=args.fmax, htk=args.ht... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.