code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# encoding: utf-8
##################################################
# This script shows how to create animated plots using matplotlib and a basic dataset
# Multiple tutorials inspired the current design but they mostly came from:
# https://towardsdatascience.com/animations-with-matplotlib-d96375c5442c
# Data uses the... | [
"pandas.read_csv",
"matplotlib.animation.FuncAnimation",
"matplotlib.pyplot.xlabel",
"seaborn.histplot",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.close",
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.subplots"
] | [((1122, 1153), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn-pastel"""'], {}), "('seaborn-pastel')\n", (1135, 1153), True, 'import matplotlib.pyplot as plt\n'), ((1393, 1409), 'pandas.read_csv', 'pd.read_csv', (['url'], {}), '(url)\n', (1404, 1409), True, 'import pandas as pd\n'), ((1614, 1630), 'panda... |
# -*- coding: utf-8 -*-
import pytest
from osf.models import RegistrationSchema
from osf.exceptions import ValidationValueError
@pytest.mark.django_db
class TestRegistrationSchema:
@pytest.fixture()
def schema_name(self):
return 'Preregistration Template from AsPredicted.org'
@pytest.fixture()
... | [
"osf.models.RegistrationSchema.objects.get",
"osf.models.RegistrationSchema.objects.get_latest_version",
"osf.models.RegistrationSchema.objects.get_latest_versions",
"pytest.raises",
"osf.models.RegistrationSchema.objects.create",
"pytest.fixture"
] | [((189, 205), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (203, 205), False, 'import pytest\n'), ((302, 318), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (316, 318), False, 'import pytest\n'), ((464, 480), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (478, 480), False, 'import pytest\n'), (... |
'''The Driver code to execute the search_in_thecollection.py'''
import os
s = "test"
s1 = s+'.jpg'
os.system("raspistill -o "+s1+" -t 3000") #Taking Single Image from RaspberryPI Camera
print("Identifying face within collection")
os.system("python3 search_index_face.py "+s1)
| [
"os.system"
] | [((99, 144), 'os.system', 'os.system', (["('raspistill -o ' + s1 + ' -t 3000')"], {}), "('raspistill -o ' + s1 + ' -t 3000')\n", (108, 144), False, 'import os\n'), ((230, 277), 'os.system', 'os.system', (["('python3 search_index_face.py ' + s1)"], {}), "('python3 search_index_face.py ' + s1)\n", (239, 277), False, 'imp... |
"""
WSGI config for postcodeinfo project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
"""
import os
from os.path import abspath, dirname
from sys import path
from django.core.wsgi im... | [
"os.environ.setdefault",
"django.core.wsgi.get_wsgi_application",
"sys.path.append",
"os.path.abspath"
] | [((347, 419), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""postcodeinfo.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'postcodeinfo.settings')\n", (368, 419), False, 'import os\n'), ((469, 491), 'sys.path.append', 'path.append', (['SITE_ROOT'], {}), '(SITE_ROOT)\n', (480, 49... |
import time
import os
from typing import List
from typing import Iterable
import random
from itertools import count
import cv2
from loguru import logger
from stimulus_manager.exceptions import EndOfStimuliSet
class Stimulus:
def __init__(self,
exposition_period: int,
stimulus_... | [
"stimulus_manager.exceptions.EndOfStimuliSet",
"os.listdir",
"loguru.logger.info",
"os.path.join",
"cv2.imshow",
"itertools.count",
"cv2.waitKey",
"cv2.imread"
] | [((936, 962), 'loguru.logger.info', 'logger.info', (['self._stimuli'], {}), '(self._stimuli)\n', (947, 962), False, 'from loguru import logger\n'), ((1023, 1031), 'itertools.count', 'count', (['(1)'], {}), '(1)\n', (1028, 1031), False, 'from itertools import count\n'), ((2002, 2028), 'loguru.logger.info', 'logger.info'... |
# Copyright (c) 2020 Adobe Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, me... | [
"setuptools.find_packages",
"os.path.join",
"os.walk"
] | [((1456, 1466), 'os.walk', 'os.walk', (['d'], {}), '(d)\n', (1463, 1466), False, 'import os\n'), ((2184, 2199), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (2197, 2199), False, 'from setuptools import setup, find_packages\n'), ((1536, 1570), 'os.path.join', 'os.path.join', (['""".."""', 'path', 'file... |
# coding: utf-8
# In[7]:
import numpy as np
from sklearn import cluster
from scipy.cluster.vq import whiten
k = 50
kextra = 10
num_recs = 645
seed = 2
segment_file = open('bird_data/supplemental_data/segment_features.txt',
'r')
##clean
line = segment_file.readline()
line = segment... | [
"scipy.cluster.vq.whiten",
"numpy.zeros",
"sklearn.cluster.KMeans",
"numpy.vstack"
] | [((915, 934), 'scipy.cluster.vq.whiten', 'whiten', (['segfeatures'], {}), '(segfeatures)\n', (921, 934), False, 'from scipy.cluster.vq import whiten\n'), ((982, 1075), 'sklearn.cluster.KMeans', 'cluster.KMeans', ([], {'n_clusters': 'k', 'init': '"""k-means++"""', 'n_init': 'k', 'max_iter': '(300)', 'random_state': 'see... |
from csv import reader
from io import StringIO
from json import loads
class JsonConverter:
def convert(self, data):
return loads(data)
class CsvConverter:
def convert(self, data):
csv = reader(StrubgIO(data))
lines = [line for line in csv]
return lines
def convert(type, data):... | [
"json.loads"
] | [((136, 147), 'json.loads', 'loads', (['data'], {}), '(data)\n', (141, 147), False, 'from json import loads\n')] |
# -*- coding: utf-8 -*-
def main():
from collections import deque
import sys
input = sys.stdin.readline
n, m = map(int, input().split())
tubes = list()
q = deque()
for i in range(m):
_ = int(input())
a = deque(list(map(int, input().split())))
q.append((a.popleft(... | [
"collections.deque"
] | [((184, 191), 'collections.deque', 'deque', ([], {}), '()\n', (189, 191), False, 'from collections import deque\n')] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from protected_media.models import ProtectedFileField
class FileCollection(models.Model):
public_file = models.FileField(upload_to="collection")
protected_file = ProtectedFileField(upload_to="collection")
| [
"django.db.models.FileField",
"protected_media.models.ProtectedFileField"
] | [((204, 244), 'django.db.models.FileField', 'models.FileField', ([], {'upload_to': '"""collection"""'}), "(upload_to='collection')\n", (220, 244), False, 'from django.db import models\n'), ((266, 308), 'protected_media.models.ProtectedFileField', 'ProtectedFileField', ([], {'upload_to': '"""collection"""'}), "(upload_t... |
import datetime
class WeekDay(object):
day_tags = [
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday',
'Sunday'
]
def __init__(self):
self.today = datetime.datetime.now()
def get_week_from_today(self):
day_ind ... | [
"datetime.datetime.now"
] | [((244, 267), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (265, 267), False, 'import datetime\n')] |
import numpy as np
import cmath
from matplotlib import pyplot as plt
def f(x):
return 10/(1+(10*x - 5)**2)
def reverse_bit(n):
return int('{:08b}'.format(n)[::-1], 2)
def fft(f_k):
N = len(f_k)
if N >= 2:
first_half = f_k[0:N//2]
second_half = f_k[N//2:N]
first = fft(first... | [
"numpy.sqrt",
"numpy.arange",
"matplotlib.pyplot.plot",
"numpy.append",
"numpy.exp",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((784, 817), 'matplotlib.pyplot.plot', 'plt.plot', (['real'], {'label': '"""Real part"""'}), "(real, label='Real part')\n", (792, 817), True, 'from matplotlib import pyplot as plt\n'), ((818, 856), 'matplotlib.pyplot.plot', 'plt.plot', (['imag'], {'label': '"""Imaginary part"""'}), "(imag, label='Imaginary part')\n", ... |
from __future__ import print_function
from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import train_test_split
import pandas as pd
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.metrics import classification_report
from skle... | [
"sklearn.model_selection.GridSearchCV",
"sklearn.preprocessing.LabelEncoder",
"pickle.dump",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.classification_report",
"sklearn.preprocessing.OneHotEncoder",
"sklearn.ensemble.RandomForestClassifier",
"sklearn.preprocessin... | [((413, 446), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (436, 446), False, 'import warnings\n'), ((491, 508), 'pandas.read_csv', 'pd.read_csv', (['PATH'], {}), '(PATH)\n', (502, 508), True, 'import pandas as pd\n'), ((1045, 1114), 'sklearn.model_selection.train_test_s... |
#coding:utf-8
#
# id: bugs.core_4566
# title: Incorrect size of the output parameter/argument when execute block, procedure or function use system field in metadata charset
# decription:
# tracker_id: CORE-4566
# min_versions: ['3.0']
# versions: 3.0
# qmid: None
import pytest
from fi... | [
"pytest.mark.version",
"firebird.qa.db_factory",
"firebird.qa.isql_act"
] | [((454, 518), 'firebird.qa.db_factory', 'db_factory', ([], {'charset': '"""WIN1251"""', 'sql_dialect': '(3)', 'init': 'init_script_1'}), "(charset='WIN1251', sql_dialect=3, init=init_script_1)\n", (464, 518), False, 'from firebird.qa import db_factory, isql_act, Action\n'), ((1601, 1663), 'firebird.qa.isql_act', 'isql_... |
#!/bin/python
import listify_circuits
listify_circuits.optimize_circuits(9, 'reverse') | [
"listify_circuits.optimize_circuits"
] | [((39, 87), 'listify_circuits.optimize_circuits', 'listify_circuits.optimize_circuits', (['(9)', '"""reverse"""'], {}), "(9, 'reverse')\n", (73, 87), False, 'import listify_circuits\n')] |
r"""Distributedly evaluate language model checkpoints on multiple processes / nodes by data parallism.
This script is distributed data parallel version of :doc:`lmp.script.eval_dset_ppl </script/eval_dset_ppl>`. Other
than distributed evaluation setup CLI arguments, the rest arguments are the same as
:doc:`lmp.script... | [
"argparse.ArgumentParser",
"torch.nn.parallel.DistributedDataParallel",
"tqdm.tqdm",
"torch.stack",
"torch.distributed.all_reduce",
"torch.utils.data.distributed.DistributedSampler",
"torch.cuda.is_available",
"os.sched_getaffinity",
"gc.collect",
"datetime.timedelta",
"torch.cuda.empty_cache",
... | [((2470, 2656), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""python -m lmp.script.eval_dset_ppl"""'], {'description': '"""Use pre-trained language model checkpoints to calculate average perplexity on a particular dataset."""'}), "('python -m lmp.script.eval_dset_ppl', description=\n 'Use pre-trained l... |
import logging
import tempfile
import urllib.request
import tarfile
import os
import os.path
import shutil
import atexit
from aurifere.vendor import AUR
from aurifere.common import DATA_DIR
from aurifere.pacman import get_satisfier_in_syncdb
from aurifere.package import NoPKGBUILDException
NOT_IN_AUR_FILENAME = os.pa... | [
"logging.getLogger",
"os.path.exists",
"tempfile.TemporaryDirectory",
"os.listdir",
"aurifere.pacman.get_satisfier_in_syncdb",
"tarfile.open",
"shutil.move",
"os.path.join",
"os.path.isfile",
"os.path.dirname",
"shutil.rmtree",
"atexit.register",
"os.remove"
] | [((315, 351), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""not_in_aur"""'], {}), "(DATA_DIR, 'not_in_aur')\n", (327, 351), False, 'import os\n'), ((361, 388), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (378, 388), False, 'import logging\n'), ((510, 542), 'logging.getLogger', 'log... |
""" Custom Indicator Increase In Volume
"""
from talib import abstract
import pandas
import math
from analyzers.utils import IndicatorUtils
class MACrossover(IndicatorUtils):
def analyze(self, historical_data, signal=['close'], hot_thresh=None, cold_thresh=None, exponential = True, ma_fast = 10, ma_slow = 50)... | [
"pandas.concat",
"talib.abstract.SMA",
"talib.abstract.EMA"
] | [((1292, 1358), 'pandas.concat', 'pandas.concat', (['[dataframe, ma_fast_values, ma_slow_values]'], {'axis': '(1)'}), '([dataframe, ma_fast_values, ma_slow_values], axis=1)\n', (1305, 1358), False, 'import pandas\n'), ((1035, 1067), 'talib.abstract.EMA', 'abstract.EMA', (['dataframe', 'ma_fast'], {}), '(dataframe, ma_f... |
import src.data.scoreboard_config
import time
import sys
debug_enabled = False
time_format = "%H"
def set_debug_status(config):
global debug_enabled
debug_enabled = config.debug
global time_format
time_format = config.time_format
def __debugprint(text):
print(text)
sys.stdout.flush()
def log(text):
if debug... | [
"time.localtime",
"sys.stdout.flush"
] | [((276, 294), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (292, 294), False, 'import sys\n'), ((702, 718), 'time.localtime', 'time.localtime', ([], {}), '()\n', (716, 718), False, 'import time\n')] |
import api_tester as at
import sys
def main():
host = "http://localhost:54321"
headers = {
'content-type': 'application/json',
'Accept-Charset': 'UTF-8',
'X-API-Key': "<api-key-here>"
}
apiTests = {
at.GetTest(404,'constituents/000000'),
at.GetTest(404,'non-ex... | [
"api_tester.GetTest",
"api_tester.ApiTester"
] | [((861, 898), 'api_tester.ApiTester', 'at.ApiTester', (['host', 'apiTests', 'headers'], {}), '(host, apiTests, headers)\n', (873, 898), True, 'import api_tester as at\n'), ((251, 289), 'api_tester.GetTest', 'at.GetTest', (['(404)', '"""constituents/000000"""'], {}), "(404, 'constituents/000000')\n", (261, 289), True, '... |
from mlib.file import File, strippedlines
def metameta(reqs):
VERSION = '0.0.48'
# bumpversion
NEW_VERSION = '0.0.' + str(int(VERSION.split('.')[2]) + 1)
File(__file__).write(File(__file__).read().replace(
f'{VERSION}', f'{NEW_VERSION}'
))
reqs = reqs.filtered(
lambda lin: no... | [
"mlib.file.strippedlines",
"yapf.yapflib.yapf_api.FormatCode",
"mlib.file.File"
] | [((1305, 1874), 'yapf.yapflib.yapf_api.FormatCode', 'FormatCode', (['(\n """\n \nimport setuptools\n\nsetuptools.setup(\nname="mlib-mgroth0",\nversion=\\""""\n + NEW_VERSION +\n """",\nauthor="<NAME>",\nauthor_email="<EMAIL>",\ndescription="Matt\'s lib",\nlong_description=\'insert long description ... |
import argparse
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import os
def plot_controller_data(data_file):
data = pd.read_csv(data_file, skiprows=[1])
font = {'family': 'Source Sans Pro', 'size': 12, 'weight': 'light'}
matplotlib.rc('font', **font)
matplot... | [
"matplotlib.pyplot.savefig",
"pandas.read_csv",
"argparse.ArgumentParser",
"matplotlib.pyplot.close",
"os.path.normpath",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.rc"
] | [((165, 201), 'pandas.read_csv', 'pd.read_csv', (['data_file'], {'skiprows': '[1]'}), '(data_file, skiprows=[1])\n', (176, 201), True, 'import pandas as pd\n'), ((279, 308), 'matplotlib.rc', 'matplotlib.rc', (['"""font"""'], {}), "('font', **font)\n", (292, 308), False, 'import matplotlib\n'), ((631, 658), 'matplotlib.... |
# coding: utf-8
# In[2]:
import keras
import scipy as sp
import scipy.misc, scipy.ndimage.interpolation
from medpy import metric
import numpy as np
import os
from keras import losses
import tensorflow as tf
from keras.models import Model
from keras.layers import Input,merge, concatenate, Conv2D, MaxPoo... | [
"keras.models.load_model",
"csv.writer",
"numpy.array",
"cv2.resize",
"glob.glob"
] | [((1034, 1077), 'keras.models.load_model', 'load_model', (['"""basic_dense_net_dsp_round2.h5"""'], {}), "('basic_dense_net_dsp_round2.h5')\n", (1044, 1077), False, 'from keras.models import load_model\n'), ((1318, 1362), 'glob.glob', 'glob.glob', (['"""/home/rdey/dsp_final/test/*.jpg"""'], {}), "('/home/rdey/dsp_final/... |
# GR2 test from Liv Rev
import numpy
from models import sr_mf
from bcs import outflow
from simulation import simulation
from methods import fvs_method
from rk import rk3
from grid import grid
from matplotlib import pyplot
Ngz = 3
Npoints = 800
L = 0.5
interval = grid([-L, L], Npoints, Ngz)
rhoL = 1
pL = 1
rhoR = 0.1... | [
"numpy.random.rand",
"grid.grid",
"numpy.zeros_like",
"numpy.array",
"numpy.cos",
"numpy.linalg.norm",
"numpy.sin",
"models.sr_mf.initial_riemann",
"numpy.random.randn"
] | [((265, 292), 'grid.grid', 'grid', (['[-L, L]', 'Npoints', 'Ngz'], {}), '([-L, L], Npoints, Ngz)\n', (269, 292), False, 'from grid import grid\n'), ((648, 740), 'numpy.array', 'numpy.array', (['[rhoL_e, 0, 0, 0, epsL, rhoL_p, 0, 0, 0, epsL, Bx, ByL, BzL, 0, 0, 0, 0, 0]'], {}), '([rhoL_e, 0, 0, 0, epsL, rhoL_p, 0, 0, 0,... |
'''Train CIFAR10 with PyTorch.'''
from __future__ import print_function
import sys
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torch.backends.cudnn as cudnn
import config as cf
import torchvision
import torchvision.transforms as transforms
import os
import ar... | [
"torchvision.datasets.CIFAR100",
"torch.nn.CrossEntropyLoss",
"argparse.ArgumentParser",
"torchvision.transforms.RandomRotation",
"torchvision.datasets.FashionMNIST",
"torch.load",
"torchvision.transforms.RandomHorizontalFlip",
"torch.nn.DataParallel",
"torchvision.transforms.RandomCrop",
"torchvi... | [((410, 473), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PyTorch CIFAR10 Training"""'}), "(description='PyTorch CIFAR10 Training')\n", (433, 473), False, 'import argparse\n'), ((3281, 3380), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['trainset'], {'batch_size': '... |
# Compartments are created here.
# NOT USED YET
import tkinter as tk
from matplotlib import pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
from matplotlib.figure import Figure
import matplotlib
from tkinter import messagebox
import test
import numpy as np
class CreateCompartmentWindow()... | [
"test.get_to_draw",
"test.get_grid",
"tkinter.Button",
"numpy.max",
"matplotlib.pyplot.figure",
"tkinter.Tk",
"numpy.min",
"matplotlib.pyplot.suptitle",
"matplotlib.backends.backend_tkagg.FigureCanvasTkAgg"
] | [((6467, 6474), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (6472, 6474), True, 'import tkinter as tk\n'), ((1844, 1856), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1854, 1856), True, 'from matplotlib import pyplot as plt\n'), ((1908, 1942), 'matplotlib.backends.backend_tkagg.FigureCanvasTkAgg', 'FigureC... |
from setuptools import setup
from hoi3tools import __version__
with open("README.md", encoding="utf-8") as readme:
long_description = readme.read()
setup(
name="hoi3tools",
version=__version__,
author="<NAME>",
author_email="<EMAIL>",
description="hoi3tools",
long_description=long_descript... | [
"setuptools.setup"
] | [((154, 949), 'setuptools.setup', 'setup', ([], {'name': '"""hoi3tools"""', 'version': '__version__', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'description': '"""hoi3tools"""', 'long_description': 'long_description', 'long_description_content_type': '"""text/markdown"""', 'keywords': '"""hoi3 game"""'... |
import json
from .exceptions import DjangoBeforeImproperlyConfigured, DjangoBeforeNotImplemented
def make_json_settings_reader(settings_filename):
reader = _JSONSettingsReader(settings_filename)
return reader
class _JSONSettingsReader(object):
def __init__(self, settings_filename):
self.settings... | [
"json.load"
] | [((1261, 1276), 'json.load', 'json.load', (['file'], {}), '(file)\n', (1270, 1276), False, 'import json\n')] |
import discord
import settings as setting
import mysql.connector
from datetime import date
###############################################################################################################
# MANUAL IMPORT
#############################################################################################... | [
"html_email_template.Email_Project_Registration",
"discord.utils.find",
"datetime.date.today",
"dm_template.dm_project",
"discord.Embed"
] | [((1606, 1735), 'discord.Embed', 'discord.Embed', ([], {'title': '"""Hello there! (0/3)"""', 'description': '"""Let\'s begin your registration.\n\nPlease enter your project name."""'}), '(title=\'Hello there! (0/3)\', description=\n """Let\'s begin your registration.\n\nPlease enter your project name.""")\n', (1619,... |
from sklearn.datasets import load_svmlight_file
import pickle
from scipy import stats
import numpy as np
import matplotlib.pyplot as plt
with open('FeatureTypes') as file:
file = file.read()
file = file.split("\n")
file.remove(file[len(file)-1])
num_col = list(map(int, file))
num_col = [x - 1 for x in nu... | [
"pickle.dump",
"matplotlib.pyplot.ylabel",
"sklearn.datasets.load_svmlight_file",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.bar",
"matplotlib.pyplot.title",
"scipy.stats.itemfreq",
"matplotlib.pyplot.show"
] | [((1361, 1408), 'matplotlib.pyplot.bar', 'plt.bar', (['y_pos', 'cols'], {'align': '"""center"""', 'alpha': '(0.5)'}), "(y_pos, cols, align='center', alpha=0.5)\n", (1368, 1408), True, 'import matplotlib.pyplot as plt\n'), ((1413, 1463), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""Frequency of nonzero value in colum... |
# MIT License
#
# Copyright (c) 2017-2019 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, ... | [
"tindetheus.machine_learning.calc_avg_emb",
"tindetheus.image_processing.show_images",
"numpy.array",
"tindetheus.facenet_clone.facenet.load_model",
"os.path.exists",
"tensorflow.Graph",
"argparse.ArgumentParser",
"tensorflow.Session",
"tindetheus.image_processing.al_copy_images",
"tindetheus.tind... | [((9981, 10086), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'help_text', 'formatter_class': 'argparse.RawDescriptionHelpFormatter'}), '(description=help_text, formatter_class=argparse.\n RawDescriptionHelpFormatter)\n', (10004, 10086), False, 'import argparse\n'), ((2763, 2870), 'tind... |
import unittest
from app.models import Articles
class TestArticle(unittest.TestCase):
'''
Test Class to test the behaviour of the Article class
'''
def setUp(self):
'''
Set up that will run before every Test
'''
self.new_article = Articles("Palestinians evacuate the body of Palestinian journalist... | [
"unittest.main",
"app.models.Articles"
] | [((723, 749), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (736, 749), False, 'import unittest\n'), ((254, 623), 'app.models.Articles', 'Articles', (['"""Palestinians evacuate the body of Palestinian journalist <NAME>, 31, who was shot and killed by an Israeli sharpshooter in the Gaz... |
import configparser
from itertools import islice
import spotipy
from dotenv import load_dotenv
from spotipy.oauth2 import SpotifyOAuth
def split_every(n, iterable):
i = iter(iterable)
piece = list(islice(i, n))
while piece:
yield piece
piece = list(islice(i, n))
class SpotipyWrapper:
... | [
"itertools.islice",
"configparser.ConfigParser",
"spotipy.oauth2.SpotifyOAuth",
"dotenv.load_dotenv"
] | [((1727, 1740), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (1738, 1740), False, 'from dotenv import load_dotenv\n'), ((1754, 1781), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (1779, 1781), False, 'import configparser\n'), ((208, 220), 'itertools.islice', 'islice', (['i', 'n'... |
"""
This module contains classes for all the API response related items.
It contains one struct for news items, and two objects for Covid and Weather updates,
which self populate with the API response.
"""
import logging
import os
import requests
logger = logging.getLogger(os.getenv("COVCLOCK_LOG_NAMESPACE"))
# Da... | [
"os.getenv"
] | [((277, 312), 'os.getenv', 'os.getenv', (['"""COVCLOCK_LOG_NAMESPACE"""'], {}), "('COVCLOCK_LOG_NAMESPACE')\n", (286, 312), False, 'import os\n'), ((3186, 3225), 'os.getenv', 'os.getenv', (['"""COVCLOCK_AREA_TYPE"""', '"""utla"""'], {}), "('COVCLOCK_AREA_TYPE', 'utla')\n", (3195, 3225), False, 'import os\n'), ((3247, 3... |
"""empty message
Revision ID: a684c982c890
Revises: <PASSWORD>
Create Date: 2021-10-16 18:12:03.996294
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a684c982c890'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():
# ### ... | [
"alembic.op.drop_column",
"sqlalchemy.DateTime"
] | [((594, 643), 'alembic.op.drop_column', 'op.drop_column', (['"""generation_request"""', '"""published"""'], {}), "('generation_request', 'published')\n", (608, 643), False, 'from alembic import op\n'), ((439, 452), 'sqlalchemy.DateTime', 'sa.DateTime', ([], {}), '()\n', (450, 452), True, 'import sqlalchemy as sa\n')] |
#!/usr/bin/env python
import setuptools
import subprocess
import sys
import re
from pathlib import Path
VERSIONFILE="sinto/_version.py"
verstrline = open(VERSIONFILE, "rt").read()
VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
mo = re.search(VSRE, verstrline, re.M)
if mo:
verstr = mo.group(1)
else:
raise Runti... | [
"setuptools.find_packages",
"re.search"
] | [((233, 266), 're.search', 're.search', (['VSRE', 'verstrline', 're.M'], {}), '(VSRE, verstrline, re.M)\n', (242, 266), False, 'import re\n'), ((947, 973), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (971, 973), False, 'import setuptools\n')] |
import random
def pick_random_move(board):
"""Takes in an array_board and returns a random index in that
board that contains None."""
possible_moves = get_available_moves(board)
number_of_possible_moves = len(possible_moves)
if number_of_possible_moves < 1:
return -1
random_index_into... | [
"random.randint"
] | [((338, 385), 'random.randint', 'random.randint', (['(0)', '(number_of_possible_moves - 1)'], {}), '(0, number_of_possible_moves - 1)\n', (352, 385), False, 'import random\n')] |
from setuptools import find_packages, setup
setup(
name='wroc-build',
description='Building footprint segmentation in Wrocław',
version='0.1.0',
url='https://github.com/Greenpp/wroc-build',
author='<NAME>',
packages=find_packages(),
package_data={'wroclaw_building_footprint': ['model/seg_mo... | [
"setuptools.find_packages"
] | [((241, 256), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (254, 256), False, 'from setuptools import find_packages, setup\n')] |
#!/usr/bin/env python3
import sys
import math
with open(sys.argv[1]) as file:
for line in (line.rstrip() for line in file):
line = ''.join(c for c in line if c in '.- 0123456789').split()
line = list(map(float, line))
cx, cy, r, px, py = line[0], line[1], line[2], line[3], line[4]
dx = px - cx
... | [
"math.sqrt"
] | [((350, 378), 'math.sqrt', 'math.sqrt', (['(dx ** 2 + dy ** 2)'], {}), '(dx ** 2 + dy ** 2)\n', (359, 378), False, 'import math\n')] |
import asyncio
import dateutil
import datetime
import sqlalchemy
import textwrap
from common.config import config
from common import rpc
from common import googlecalendar
from common import time
from common import utils
from common import twitch
import logging
log = logging.getLogger('eris.autotopic')
MAX_TOPIC_LENG... | [
"logging.getLogger",
"dateutil.parser.parse",
"common.googlecalendar.process_description",
"common.twitch.get_info",
"sqlalchemy.select",
"sqlalchemy.func.coalesce",
"datetime.datetime.now",
"common.rpc.bot.get_header_info",
"common.googlecalendar.get_next_event",
"common.time.nice_duration"
] | [((269, 304), 'logging.getLogger', 'logging.getLogger', (['"""eris.autotopic"""'], {}), "('eris.autotopic')\n", (286, 304), False, 'import logging\n'), ((685, 702), 'common.twitch.get_info', 'twitch.get_info', ([], {}), '()\n', (700, 702), False, 'from common import twitch\n'), ((773, 828), 'dateutil.parser.parse', 'da... |
import os
import re
import sys
import pandas as pd
from io import StringIO
import logging
from settings import TRANSCRIPTS_DIR_PATH, SCDB_FILE_PATH, VERBOSE
def __build_case(row):
case_obj = Case()
case_obj.decision_label = row.decisionType
case_obj.vote_id = row.voteId
case_obj.term = row.term
c... | [
"logging.info",
"pandas.read_csv"
] | [((536, 580), 'pandas.read_csv', 'pd.read_csv', (['SCDB_FILE_PATH'], {'engine': '"""python"""'}), "(SCDB_FILE_PATH, engine='python')\n", (547, 580), True, 'import pandas as pd\n'), ((643, 689), 'logging.info', 'logging.info', (["('processing case %d ...' % index)"], {}), "('processing case %d ...' % index)\n", (655, 68... |
from xd.tool.layer import *
from case import *
import os
import configparser
class ManifestStub(object):
def __init__(self, topdir, priority=None):
self.topdir = topdir
if priority is None:
self.priority = {}
else:
self.priority = priority
def get_priority(se... | [
"configparser.ConfigParser",
"os.path.join",
"os.mkdir"
] | [((443, 460), 'os.mkdir', 'os.mkdir', (['"""layer"""'], {}), "('layer')\n", (451, 460), False, 'import os\n'), ((478, 505), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (503, 505), False, 'import configparser\n'), ((764, 781), 'os.mkdir', 'os.mkdir', (['"""layer"""'], {}), "('layer')\n", ... |
from pymongo import MongoClient
import datetime
class MongoLogger:
def __init__(self):
client = MongoClient('localhost:27017')
self.db = client.g2x
def log(self, device, property, value):
now = datetime.datetime.utcnow()
self.db.readings.insert({
"timestamp": now,
... | [
"pymongo.MongoClient",
"datetime.datetime.utcnow"
] | [((110, 140), 'pymongo.MongoClient', 'MongoClient', (['"""localhost:27017"""'], {}), "('localhost:27017')\n", (121, 140), False, 'from pymongo import MongoClient\n'), ((229, 255), 'datetime.datetime.utcnow', 'datetime.datetime.utcnow', ([], {}), '()\n', (253, 255), False, 'import datetime\n')] |
from VTScan import VTScan
Scan = VTScan()
detected = Scan.urlScan(url="https://www.google.com/")
for reports in detected:
for report in reports:
print(report)
| [
"VTScan.VTScan"
] | [((33, 41), 'VTScan.VTScan', 'VTScan', ([], {}), '()\n', (39, 41), False, 'from VTScan import VTScan\n')] |
import sys
import click
from colorama import Fore
import ast
from .check import check
@click.command()
@click.option(
"--ignore-ambiguous-signatures",
default=True,
is_flag=True,
help=(
"Whether to ignore extra arguments in docstrings if the function "
"has *args or **kwargs."
),... | [
"click.option",
"click.File",
"click.echo",
"sys.exit",
"ast.parse",
"click.command"
] | [((91, 106), 'click.command', 'click.command', ([], {}), '()\n', (104, 106), False, 'import click\n'), ((108, 290), 'click.option', 'click.option', (['"""--ignore-ambiguous-signatures"""'], {'default': '(True)', 'is_flag': '(True)', 'help': '"""Whether to ignore extra arguments in docstrings if the function has *args o... |
from django.test import TestCase
from rest_framework.test import APIClient
from places.models import Address
from django.contrib.auth.models import User
class AddressTestCase(TestCase):
def setUp(self):
User.objects.create_user(username='api_user', email='api_user', password='password')
Address.... | [
"places.models.Address.objects.create",
"django.contrib.auth.models.User.objects.get",
"django.contrib.auth.models.User.objects.create_user",
"rest_framework.test.APIClient"
] | [((218, 307), 'django.contrib.auth.models.User.objects.create_user', 'User.objects.create_user', ([], {'username': '"""api_user"""', 'email': '"""api_user"""', 'password': '"""password"""'}), "(username='api_user', email='api_user', password=\n 'password')\n", (242, 307), False, 'from django.contrib.auth.models impo... |
import sys
import csv
import MeCab
import numpy as np
class CalcSim_MeCab:
def __init__(self):
pass
def cos_sim(self, x, y):
val = np.sqrt(np.sum(x**2)) * np.sqrt(np.sum(y**2))
return np.dot(x, y) / val if val != 0 else 0
def WordFrequencyCount(self, word, wordFre... | [
"MeCab.Tagger",
"numpy.sum",
"numpy.dot",
"csv.reader"
] | [((5678, 5792), 'csv.reader', 'csv.reader', (['f_in'], {'delimiter': '""","""', 'doublequote': '(True)', 'lineterminator': "'\\r\\n'", 'quotechar': '"""\\""""', 'skipinitialspace': '(True)'}), '(f_in, delimiter=\',\', doublequote=True, lineterminator=\'\\r\\n\',\n quotechar=\'"\', skipinitialspace=True)\n', (5688, 5... |
import h5py
import numpy as np
def load_stdata(fname):
f = h5py.File(fname, 'r')
data = f['data'].value
timestamps = f['date'].value
f.close()
return data, timestamps
data,timestamps = load_stdata('NYC14_M16x8_T60_NewEnd.h5')
# print(data,timestamps)
data = np.ndarray.tolist(data)
timestamps = np.n... | [
"numpy.ndarray.tolist",
"h5py.File"
] | [((279, 302), 'numpy.ndarray.tolist', 'np.ndarray.tolist', (['data'], {}), '(data)\n', (296, 302), True, 'import numpy as np\n'), ((316, 345), 'numpy.ndarray.tolist', 'np.ndarray.tolist', (['timestamps'], {}), '(timestamps)\n', (333, 345), True, 'import numpy as np\n'), ((63, 84), 'h5py.File', 'h5py.File', (['fname', '... |
#
# Vortex OpenSplice
#
# This software and documentation are Copyright 2006 to TO_YEAR ADLINK
# Technology Limited, its affiliated companies and licensors. All rights
# reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in ... | [
"unittest.main",
"SequenceOfSimpleArray.basic.module_SequenceOfSimpleArray.SequenceOfSimpleArray_struct"
] | [((2007, 2022), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2020, 2022), False, 'import unittest\n'), ((1114, 1199), 'SequenceOfSimpleArray.basic.module_SequenceOfSimpleArray.SequenceOfSimpleArray_struct', 'SequenceOfSimpleArray_struct', ([], {'long1': '(13)', 'sequence1': '[[11, 12], [21, 22], [31, 32]]'}), '... |
# This file collects a few examples on how the modules of
# the package can be tested. This file can also be used by
# the github continuous integration (CI) to the test the code
# everytime there is a push.
#
# The <test coverage> can then be assessed using pytest-cov.
# This basically tests how many percents of the m... | [
"numpy.mean",
"pathlib.Path",
"pytest.fail",
"numpy.testing.assert_almost_equal",
"pytest.mark.parametrize",
"numpy.zeros",
"numpy.random.uniform"
] | [((596, 666), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""inputs, expected"""', "[('1+2', 3), ('3*4', 12)]"], {}), "('inputs, expected', [('1+2', 3), ('3*4', 12)])\n", (619, 666), False, 'import pytest\n'), ((1256, 1280), 'numpy.zeros', 'np.zeros', (['(DIM_Y, DIM_Z)'], {}), '((DIM_Y, DIM_Z))\n', (1264, ... |
import torch
import torch.distributed as dist
class AllGatherFunction(torch.autograd.Function):
@staticmethod
def forward(ctx,
tensor: torch.Tensor,
reduce_dtype: torch.dtype = torch.float32):
ctx.reduce_dtype = reduce_dtype
output = list(
torch.em... | [
"torch.empty_like",
"torch.distributed.reduce_scatter",
"torch.tensor",
"torch.distributed.get_world_size",
"torch.distributed.get_rank",
"torch.cat",
"torch.distributed.all_gather"
] | [((1043, 1074), 'torch.distributed.all_gather', 'dist.all_gather', (['output', 'scalar'], {}), '(output, scalar)\n', (1058, 1074), True, 'import torch.distributed as dist\n'), ((1086, 1106), 'torch.tensor', 'torch.tensor', (['output'], {}), '(output)\n', (1098, 1106), False, 'import torch\n'), ((384, 415), 'torch.distr... |
import datetime
import decimal
import uuid
import pytest
import typesystem
class Person(typesystem.Schema):
name = typesystem.String(max_length=100, allow_blank=False)
age = typesystem.Integer()
class Product(typesystem.Schema):
name = typesystem.String(max_length=100, allow_blank=False)
rating = ... | [
"typesystem.Integer",
"uuid.UUID",
"typesystem.to_json_schema",
"typesystem.Text",
"typesystem.String",
"pytest.raises",
"typesystem.SchemaDefinitions",
"typesystem.Date",
"typesystem.Decimal",
"typesystem.Reference",
"datetime.date.today",
"decimal.Decimal"
] | [((123, 175), 'typesystem.String', 'typesystem.String', ([], {'max_length': '(100)', 'allow_blank': '(False)'}), '(max_length=100, allow_blank=False)\n', (140, 175), False, 'import typesystem\n'), ((186, 206), 'typesystem.Integer', 'typesystem.Integer', ([], {}), '()\n', (204, 206), False, 'import typesystem\n'), ((254... |
#!/usr/bin/env python3
"""
Command line interface for the Ivaldi IoT scientific sensor client.
"""
# Standard library imports
import argparse
import sys
# Local imports
import ivaldi
import ivaldi.monitor
import ivaldi.link
def generate_arg_parser():
"""
Generate the argument parser for Ivaldi.
Returns... | [
"argparse.ArgumentParser",
"sys.exit"
] | [((449, 582), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""A lightweight client for monitoring IoT sensors."""', 'argument_default': 'argparse.SUPPRESS'}), "(description=\n 'A lightweight client for monitoring IoT sensors.', argument_default=\n argparse.SUPPRESS)\n", (472, 582), ... |
# *****************************************************************
# Copyright (c) 2013 Massachusetts Institute of Technology
#
# Developed exclusively at US Government expense under US Air Force contract
# FA8721-05-C-002. The rights of the United States Government to use, modify,
# reproduce, release, perform, displ... | [
"default_dict.DefaultDict.__init__"
] | [((1846, 1878), 'default_dict.DefaultDict.__init__', 'dd.DefaultDict.__init__', (['self', '(0)'], {}), '(self, 0)\n', (1869, 1878), True, 'import default_dict as dd\n')] |
# Copyright 2022 Cloudera Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | [
"dataclasses.dataclass"
] | [((973, 1017), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)', 'eq': '(False)', 'repr': '(False)'}), '(frozen=True, eq=False, repr=False)\n', (982, 1017), False, 'from dataclasses import dataclass\n')] |
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 18 16:21:13 2017
@author: <NAME>
This code is modified based on https://github.com/KGPML/Hyperspectral
"""
import tensorflow as tf
import numpy as np
import scipy.io as io
from pygco import cut_simple, cut_simple_vh
from sklearn.metrics import accuracy_score
import matpl... | [
"scipy.io.loadmat",
"numpy.log",
"numpy.array",
"spectral.imshow",
"numpy.arange",
"cv2.medianBlur",
"numpy.max",
"numpy.eye",
"numpy.ones",
"numpy.argmax",
"numpy.transpose",
"sklearn.metrics.accuracy_score",
"numpy.dstack",
"collections.Counter",
"matplotlib.pyplot.figure",
"numpy.ze... | [((3721, 3748), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(12, 6)'}), '(figsize=(12, 6))\n', (3731, 3748), True, 'import matplotlib.pyplot as plt\n'), ((3761, 3781), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(1)', '(2)', '(1)'], {}), '(1, 2, 1)\n', (3772, 3781), True, 'import matplotlib.pyplot as... |
# ---------------------------------------------- ML 20/04/2020 -----------------------------------------------------#
#
# Generate a sample of EV sessions data.
# This file can be used to generate the sample of a data using the saved SDG model.
# - User can choose between a default train... | [
"argparse.ArgumentParser",
"os.makedirs",
"os.path.join",
"pickle.load",
"modeling.generate_sample.generate_sample"
] | [((1232, 1305), 'os.makedirs', 'os.makedirs', (["config['dir_names']['generated_samples_name']"], {'exist_ok': '(True)'}), "(config['dir_names']['generated_samples_name'], exist_ok=True)\n", (1243, 1305), False, 'import os\n'), ((3456, 3554), 'modeling.generate_sample.generate_sample', 'generate_sample', ([], {'AM': 'A... |
from archspee.recognizers import RecognizerBase
import grequests
import json
import traceback
_LOG_LEVEL = 'DEBUG'
_CONTENT_TYPE = 'audio/raw;encoding=signed-integer;bits=16;rate=16000;endian=little'
class WitRecognizer(RecognizerBase):
def __init__(self, text_callback, intent_callback, error_callback, access_to... | [
"grequests.Pool",
"json.loads",
"grequests.send",
"traceback.print_exc",
"grequests.post"
] | [((559, 576), 'grequests.Pool', 'grequests.Pool', (['(2)'], {}), '(2)\n', (573, 576), False, 'import grequests\n'), ((2024, 2102), 'grequests.post', 'grequests.post', (['url'], {'headers': 'headers', 'data': 'audio_data', 'hooks': 'hooks', 'timeout': '(10)'}), '(url, headers=headers, data=audio_data, hooks=hooks, timeo... |
from transformers import BartTokenizer, BartForConditionalGeneration, BartConfig
from transformers import pipeline
import json
def model_fn(model_dir):
tokenizer = BartTokenizer.from_pretrained(model_dir)
model = BartForConditionalGeneration.from_pretrained(model_dir)
nlp=pipeline("summarization", mod... | [
"transformers.BartTokenizer.from_pretrained",
"transformers.BartForConditionalGeneration.from_pretrained",
"transformers.pipeline",
"json.dumps"
] | [((174, 214), 'transformers.BartTokenizer.from_pretrained', 'BartTokenizer.from_pretrained', (['model_dir'], {}), '(model_dir)\n', (203, 214), False, 'from transformers import BartTokenizer, BartForConditionalGeneration, BartConfig\n'), ((227, 282), 'transformers.BartForConditionalGeneration.from_pretrained', 'BartForC... |
import unittest
try:
from qlibs_cyan.math.mat4 import Matrix4
except:
print("Skipping C matrix tests")
else:
class Matrix4TestCase(unittest.TestCase):
def test_creation(self):
Matrix4()
def test_mapping(self):
m = Matrix4()
for i in range(4):
... | [
"qlibs_cyan.math.mat4.Matrix4"
] | [((208, 217), 'qlibs_cyan.math.mat4.Matrix4', 'Matrix4', ([], {}), '()\n', (215, 217), False, 'from qlibs_cyan.math.mat4 import Matrix4\n'), ((275, 284), 'qlibs_cyan.math.mat4.Matrix4', 'Matrix4', ([], {}), '()\n', (282, 284), False, 'from qlibs_cyan.math.mat4 import Matrix4\n'), ((573, 582), 'qlibs_cyan.math.mat4.Matr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
from fontTools.ufoLib.glifLib import GlyphSet, glyphNameToFileName
from ufolint.data.tstobj import Result
from ufolint.stdoutput import StdStreamer
class GlifObj(object):
"""
A simple object for use in ufoLib attribute assignments for *.gli... | [
"fontTools.ufoLib.glifLib.glyphNameToFileName",
"ufolint.stdoutput.StdStreamer",
"ufolint.data.tstobj.Result",
"sys.stdout.flush",
"fontTools.ufoLib.glifLib.GlyphSet",
"sys.stdout.write"
] | [((532, 559), 'ufolint.stdoutput.StdStreamer', 'StdStreamer', (['ufoobj.ufopath'], {}), '(ufoobj.ufopath)\n', (543, 559), False, 'from ufolint.stdoutput import StdStreamer\n'), ((719, 761), 'sys.stdout.write', 'sys.stdout.write', (["(' - ' + glyphsdir + ' ')"], {}), "(' - ' + glyphsdir + ' ')\n", (735, 761), False, '... |
# Generated by Django 2.2.27 on 2022-04-13 14:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('deployments', '0062_auto_20220331_1143'),
]
operations = [
migrations.AddField(
model_name='project',
name='reporti... | [
"django.db.models.CharField"
] | [((360, 467), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(255)', 'null': '(True)', 'verbose_name': '"""NS Contanct Information: Email"""'}), "(blank=True, max_length=255, null=True, verbose_name=\n 'NS Contanct Information: Email')\n", (376, 467), False, 'from django.db... |
import numpy as np
class Fagin:
def __init__(self, cran_title, cran_text):
self.cran_title = cran_title
self.cran_text = cran_text
def fagin(self, data, K=200):
k = 0
res = {}
N = len(data["title"]["order"])
sections = list(data)
n = 0
for n... | [
"numpy.array"
] | [((1244, 1257), 'numpy.array', 'np.array', (['new'], {}), '(new)\n', (1252, 1257), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
import re
PATTERN = re.compile(r'\n*(\d+) +(\d+) +(\d+) +(\d+) +(\d+)' * 5)
class BingoCard:
def __init__(self, values):
self.values = set()
self.rows = [set() for _ in range(5)]
self.columns = [set() for _ in range(5)]
for i, value in enumerate(values):
... | [
"re.compile"
] | [((46, 106), 're.compile', 're.compile', (["('\\\\n*(\\\\d+) +(\\\\d+) +(\\\\d+) +(\\\\d+) +(\\\\d+)' * 5)"], {}), "('\\\\n*(\\\\d+) +(\\\\d+) +(\\\\d+) +(\\\\d+) +(\\\\d+)' * 5)\n", (56, 106), False, 'import re\n')] |
import argparse
import json
from relation_linking_core.relation_linking_service import KBQARelationLinkingService
def precision_recall_f1(predictions, golds):
p, r, f1 = 0.0, 0.0, 0.0
if len(predictions) > 0 and len(golds) > 0:
p = (len(set(predictions) & set(golds))) / len(set(predictions))
r... | [
"json.load",
"relation_linking_core.relation_linking_service.KBQARelationLinkingService",
"argparse.ArgumentParser"
] | [((582, 607), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (605, 607), False, 'import argparse\n'), ((999, 1033), 'relation_linking_core.relation_linking_service.KBQARelationLinkingService', 'KBQARelationLinkingService', (['config'], {}), '(config)\n', (1025, 1033), False, 'from relation_link... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright [2018] <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.org/licenses/LICENSE-2.0
#
# Unles... | [
"logging.getLogger",
"gi.repository.Gtk.Buildable.get_name",
"gi.repository.Gtk.Builder",
"gi.require_version",
"os.path.isfile"
] | [((675, 707), 'gi.require_version', 'gi.require_version', (['"""Gdk"""', '"""3.0"""'], {}), "('Gdk', '3.0')\n", (693, 707), False, 'import gi\n'), ((708, 740), 'gi.require_version', 'gi.require_version', (['"""Gtk"""', '"""3.0"""'], {}), "('Gtk', '3.0')\n", (726, 740), False, 'import gi\n'), ((747, 774), 'logging.getLo... |
import glob
import SubsetBuilder
from statistics import mean
folder = "dataset"
heuristics = [
"bfs",
"cats",
"contribs",
"extract",
"coords",
"extract_caps"
]
paircount = 0
means = {}
samples = {}
for heur in heuristics:
means[heur] = []
samples[heur] = []
for f in glob.glob("./" + fo... | [
"statistics.mean",
"SubsetBuilder.load_from_file",
"SubsetBuilder.write_to_file",
"glob.glob"
] | [((301, 336), 'glob.glob', 'glob.glob', (["('./' + folder + '/*.txt')"], {}), "('./' + folder + '/*.txt')\n", (310, 336), False, 'import glob\n'), ((831, 885), 'SubsetBuilder.write_to_file', 'SubsetBuilder.write_to_file', (['result', '"""merged_data.txt"""'], {}), "(result, 'merged_data.txt')\n", (858, 885), False, 'im... |
import warnings
import time
import numpy as np
# Scipy
try:
import scipy.linalg as spa
except:
warnings.warn("You don't have scipy package installed. You may get error while using some feautures.")
#pycdd
try:
from cdd import Polyhedron,Matrix,RepType
except:
warnings.warn("You don't have CDD... | [
"numpy.eye",
"pydrake.solvers.gurobi.GurobiSolver",
"numpy.linalg.pinv",
"numpy.ones",
"numpy.hstack",
"scipy.linalg.null_space",
"itertools.product",
"numpy.array",
"numpy.dot",
"matplotlib.pyplot.figure",
"numpy.zeros",
"pypolycontain.to_AH_polytope",
"numpy.concatenate",
"time.time",
... | [((916, 943), 'pydrake.solvers.gurobi.GurobiSolver', 'Gurobi_drake.GurobiSolver', ([], {}), '()\n', (941, 943), True, 'import pydrake.solvers.gurobi as Gurobi_drake\n'), ((1676, 1705), 'pypolycontain.to_AH_polytope', 'pp.to_AH_polytope', (['circumbody'], {}), '(circumbody)\n', (1693, 1705), True, 'import pypolycontain ... |
# -*- coding: utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the... | [
"numpy.stack",
"mmcv.imrescale",
"mmcv.impad",
"vega.core.common.class_factory.ClassFactory.register"
] | [((579, 621), 'vega.core.common.class_factory.ClassFactory.register', 'ClassFactory.register', (['ClassType.TRANSFORM'], {}), '(ClassType.TRANSFORM)\n', (600, 621), False, 'from vega.core.common.class_factory import ClassFactory, ClassType\n'), ((1703, 1733), 'numpy.stack', 'np.stack', (['padded_masks'], {'axis': '(0)'... |
import weakref
class Pseudobond(object):
def __init__(self, atom1, atom2):
self.atoms = (atom1, atom2)
class PseudobondGroup(object):
def __init__(self):
self.pseudobonds = []
def new_pseudobond(self, atom1, atom2, cs_id=None):
p = Pseudobond(atom1, atom2)
self.pseudobon... | [
"weakref.ref"
] | [((639, 661), 'weakref.ref', 'weakref.ref', (['structure'], {}), '(structure)\n', (650, 661), False, 'import weakref\n')] |
# coding=utf-8
from django.http import HttpResponse
from idm_auth.exceptions import KeystoneAuthException
class KeystoneAuthExceptionMiddleware(KeystoneAuthException):
def process_exception(self, request, exception):
if isinstance(exception, KeystoneAuthException) and exception.message == u"Invalid creden... | [
"django.http.HttpResponse"
] | [((348, 388), 'django.http.HttpResponse', 'HttpResponse', (['"""Unauthorized"""'], {'status': '(401)'}), "('Unauthorized', status=401)\n", (360, 388), False, 'from django.http import HttpResponse\n')] |
import csv
import os
import numpy as np
import sentencepiece as spm
import torch
class DataLoader:
def __init__(self, directory, parts, cols, spm_filename):
"""Dataset loader.
Args:
directory (str): dataset directory.
parts (list[str]): dataset parts. [parts].tsv files mu... | [
"sentencepiece.SentencePieceProcessor",
"os.path.join",
"torch.tensor",
"numpy.random.randint",
"csv.reader"
] | [((697, 725), 'sentencepiece.SentencePieceProcessor', 'spm.SentencePieceProcessor', ([], {}), '()\n', (723, 725), True, 'import sentencepiece as spm\n'), ((1401, 1455), 'numpy.random.randint', 'np.random.randint', (['(0)', 'self.part_lens[part]', 'batch_size'], {}), '(0, self.part_lens[part], batch_size)\n', (1418, 145... |
# Developed by <NAME>
# Last Modified 25/04/19 17:02.
# Copyright (c) 2019 <NAME> and <NAME>
import datetime
from django.contrib.auth.decorators import permission_required
from django.http import HttpResponseRedirect
from django.shortcuts import render, get_object_or_404
from django.urls import reverse
from djang... | [
"django.shortcuts.render",
"rolepermissions.decorators.has_permission_decorator",
"escola.models.Turma",
"django.shortcuts.get_object_or_404",
"datetime.date.today",
"django.contrib.auth.decorators.permission_required",
"escola.models.Turma.objects.all",
"escola.forms.CriarTurmaForm",
"escola.models... | [((678, 739), 'rolepermissions.decorators.has_permission_decorator', 'has_permission_decorator', (['"""add_turma"""'], {'redirect_to_login': '(True)'}), "('add_turma', redirect_to_login=True)\n", (702, 739), False, 'from rolepermissions.decorators import has_permission_decorator\n'), ((2213, 2257), 'django.contrib.auth... |
# Python modules
import math
import os
import tempfile
# 3rd party modules
import wx
#import wx.aui as aui
import wx.lib.agw.aui as aui # NB. wx.aui version throws odd wxWidgets exception on Close/Exit ?? Not anymore in wxPython 4.0.6 ??
import numpy as np
import matplotlib as mpl
import matplotlib.cm as cm
... | [
"vespa.simulation.util_menu.bar.set_menu_from_state",
"vespa.common.wx_gravy.common_dialogs.message",
"vespa.common.wx_gravy.common_dialogs.save_as",
"vespa.common.wx_gravy.notebooks.VespaAuiNotebook.__init__",
"vespa.simulation.tab_simulate.TabSimulate",
"vespa.simulation.tab_visualize.TabVisualize",
"... | [((2483, 2556), 'vespa.common.wx_gravy.notebooks.VespaAuiNotebook.__init__', 'vespa_notebooks.VespaAuiNotebook.__init__', (['self', 'parent', 'style', 'agw_style'], {}), '(self, parent, style, agw_style)\n', (2524, 2556), True, 'import vespa.common.wx_gravy.notebooks as vespa_notebooks\n'), ((2838, 2855), 'vespa.simula... |
import json
class Stack():
def __init__(self):
self.items = []
def isEmpty(self):
return self.items == []
def push(self, item):
self.items.append(item)
def pop(self):
if not self.isEmpty():
return self.items.pop()
else:
raise Except... | [
"json.dumps"
] | [((687, 709), 'json.dumps', 'json.dumps', (['self.items'], {}), '(self.items)\n', (697, 709), False, 'import json\n')] |
from django.core.management.base import BaseCommand
from django.core.files import File
from django.conf import settings
import requests
import json
import csv
from reports.models import Region
BASE_DIR = settings.BASE_DIR
BLACKLIST = ['Unknown']
class Command(BaseCommand):
help = 'Inserts regions into the datab... | [
"csv.DictReader",
"reports.models.Region.objects.update_or_create",
"requests.get",
"json.load",
"reports.models.Region.objects.get"
] | [((1994, 2023), 'requests.get', 'requests.get', (["urls['regions']"], {}), "(urls['regions'])\n", (2006, 2023), False, 'import requests\n'), ((1835, 1852), 'csv.DictReader', 'csv.DictReader', (['f'], {}), '(f)\n', (1849, 1852), False, 'import csv\n'), ((1966, 1978), 'json.load', 'json.load', (['f'], {}), '(f)\n', (1975... |
import io
import sys
# Imports the Google Cloud client library
from google.cloud import vision
from google.cloud.vision import types
def detect_logos(path):
"""Detects logos in the file."""
client = vision.ImageAnnotatorClient()
with io.open(path, 'rb') as image_file:
content = image_file.read()... | [
"google.cloud.vision.types.Image",
"google.cloud.vision.ImageAnnotatorClient",
"io.open"
] | [((210, 239), 'google.cloud.vision.ImageAnnotatorClient', 'vision.ImageAnnotatorClient', ([], {}), '()\n', (237, 239), False, 'from google.cloud import vision\n'), ((334, 362), 'google.cloud.vision.types.Image', 'types.Image', ([], {'content': 'content'}), '(content=content)\n', (345, 362), False, 'from google.cloud.vi... |
# coding=utf-8
import os, sys, datetime, unicodedata
import xbmc, xbmcgui, xbmcvfs, urllib
import xml.etree.ElementTree as xmltree
from xml.dom.minidom import parse
from xml.sax.saxutils import escape as escapeXML
import thread
from traceback import print_exc
from unicodeutils import try_decode
import calendar
from tim... | [
"library.ShowDialog",
"xbmc.translatePath",
"xbmc.skinHasImage",
"datafunctions.DataFunctions",
"xml.etree.ElementTree.parse",
"xbmc.Monitor",
"xbmcgui.getCurrentWindowDialogId",
"xbmcgui.Window",
"library.LibraryFunctions",
"xbmc.getSkinDir",
"traceback.print_exc",
"json.loads",
"gui.GUI",
... | [((389, 418), 'datafunctions.DataFunctions', 'datafunctions.DataFunctions', ([], {}), '()\n', (416, 418), False, 'import datafunctions\n'), ((445, 471), 'library.LibraryFunctions', 'library.LibraryFunctions', ([], {}), '()\n', (469, 471), False, 'import library\n'), ((1313, 1337), 'xbmcvfs.exists', 'xbmcvfs.exists', ([... |
import atexit
import os
from importlib import import_module
from pathlib import Path
from pkgutil import iter_modules
from connexion.exceptions import OAuthProblem
from connexion.resolver import RestyResolver
from swagger_ui_bundle import swagger_ui_3_path
from rfidsecuritysvc import create_app
from rfidsecuritysvc.d... | [
"rfidsecuritysvc.create_app",
"os.path.exists",
"importlib.import_module",
"pathlib.Path",
"os.path.dirname",
"atexit.register",
"pkgutil.iter_modules",
"os.remove"
] | [((1019, 1031), 'rfidsecuritysvc.create_app', 'create_app', ([], {}), '()\n', (1029, 1031), False, 'from rfidsecuritysvc import create_app\n'), ((1488, 1538), 'atexit.register', 'atexit.register', (['_cleanup_config_file', 'config_file'], {}), '(_cleanup_config_file, config_file)\n', (1503, 1538), False, 'import atexit... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from joblib import load, dump
class RunId(object):
def __init__(self, path='runid.stored', runid=None):
# Step size is not an input param,
# make it instance variable for future flexibility
self.__step_size = 1
self.path = path
... | [
"joblib.dump",
"joblib.load"
] | [((1151, 1178), 'joblib.dump', 'dump', (['self.runid', 'self.path'], {}), '(self.runid, self.path)\n', (1155, 1178), False, 'from joblib import load, dump\n'), ((1226, 1241), 'joblib.load', 'load', (['self.path'], {}), '(self.path)\n', (1230, 1241), False, 'from joblib import load, dump\n')] |
import concurrent.futures
import time
import pandas as pd
import numpy as np
from tfce_toolbox.tfce_computation import tfce_from_distribution, tfces_from_distributions_st, \
tfces_from_distributions_mt
import tfce_toolbox.quicker_raw_value
def analyze(data_file, dv, seed):
print("go " + data_file)
time_... | [
"tfce_toolbox.tfce_computation.tfce_from_distribution",
"numpy.random.default_rng",
"pandas.read_csv",
"tfce_toolbox.tfce_computation.tfces_from_distributions_mt",
"pandas.DataFrame",
"numpy.percentile",
"time.time"
] | [((330, 341), 'time.time', 'time.time', ([], {}), '()\n', (339, 341), False, 'import time\n'), ((352, 379), 'numpy.random.default_rng', 'np.random.default_rng', (['seed'], {}), '(seed)\n', (373, 379), True, 'import numpy as np\n'), ((397, 439), 'pandas.read_csv', 'pd.read_csv', (["('data/' + data_file)"], {'sep': '"""\... |
from app.services.steps import *
from flask import g, current_app
class SessionManager():
"""
Session manager is responsible for taking in a registrant and current step and then determining which step needs to be performed next.
"""
# initialize these as None, override them with init method if valid.
... | [
"flask.g.get"
] | [((1557, 1581), 'flask.g.get', 'g.get', (['"""lang_code"""', 'None'], {}), "('lang_code', None)\n", (1562, 1581), False, 'from flask import g, current_app\n')] |
#!/usr/bin/env python3
#
# provinces.py
#
# provinces.py is part of a web application written in Python and using
# Streamlit as the presentation method.
#
"""countries page shows graphs about various countries cases"""
import datetime
from datetime import timedelta
import matplotlib.pyplot as plt
import matplotlib.... | [
"streamlit.markdown",
"matplotlib.pyplot.grid",
"streamlit.pyplot",
"pandas.read_csv",
"matplotlib.ticker.MultipleLocator",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"constants.DATE_SPANS",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.bar",
"matplotlib.pyp... | [((567, 600), 'streamlit.title', 'st.title', (['"""Countries Covid Cases"""'], {}), "('Countries Covid Cases')\n", (575, 600), True, 'import streamlit as st\n'), ((605, 620), 'constants.DATE_SPANS', 'cn.DATE_SPANS', ([], {}), '()\n', (618, 620), True, 'import constants as cn\n'), ((625, 645), 'streamlit.markdown', 'st.... |
#!/bin/env python3
import cv2 as cv
import numpy as np
import argparse
import tuner.tuner as tuner
def scale(img):
img = np.absolute(img)
return np.uint8(255 * (img / np.max(img)))
def ths(img, ths_min, ths_max):
ret = np.zeros_like(img)
ret[(img >= ths_min) & (img <= ths_max)] = 255
return ret... | [
"tuner.tuner.Tuner_App",
"numpy.absolute",
"numpy.max",
"cv2.cvtColor",
"numpy.zeros_like",
"cv2.Sobel"
] | [((128, 144), 'numpy.absolute', 'np.absolute', (['img'], {}), '(img)\n', (139, 144), True, 'import numpy as np\n'), ((236, 254), 'numpy.zeros_like', 'np.zeros_like', (['img'], {}), '(img)\n', (249, 254), True, 'import numpy as np\n'), ((875, 912), 'cv2.cvtColor', 'cv.cvtColor', (['image', 'cv.COLOR_BGR2GRAY'], {}), '(i... |
# -*- coding: utf-8 -*-
import os
from PIL import Image, ImageFont, ImageDraw
import tensorflow as tf
import numpy as np
import pickle
def getJp():
count = 0
char_vocab = []
shape_vocab = []
char_shape = {}
for line in open("joyo2010.txt").readlines():
if line[0] == "#":
contin... | [
"PIL.Image.new",
"PIL.ImageFont.truetype",
"numpy.array",
"PIL.ImageDraw.Draw",
"pickle._dump"
] | [((359, 386), 'PIL.Image.new', 'Image.new', (['"""1"""', '(28, 28)', '(0)'], {}), "('1', (28, 28), 0)\n", (368, 386), False, 'from PIL import Image, ImageFont, ImageDraw\n'), ((399, 417), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['im'], {}), '(im)\n', (413, 417), False, 'from PIL import Image, ImageFont, ImageDraw\n'),... |
import requests
import json
from PIL import Image, ImageDraw
# https://console.faceplusplus.com.cn/documents/4888373
def face_detect():
http_url = 'https://api-cn.faceplusplus.com/facepp/v3/detect'
key = '<KEY>'
secret = '<KEY>'
filepath = '2.jpg'
data = {'api_key':key, 'api_secret':secret,... | [
"requests.post"
] | [((463, 510), 'requests.post', 'requests.post', (['http_url'], {'data': 'data', 'files': 'files'}), '(http_url, data=data, files=files)\n', (476, 510), False, 'import requests\n')] |
"""API maintains queries to neural machine translation servers.
https://github.com/TartuNLP/sauron
Examples:
To run as a standalone script:
$ python /path_to/sauron.py
To deploy with Gunicorn refer to WSGI callable from this module:
$ gunicorn [OPTIONS] sauron:app
Attributes:
app (flask.... | [
"logging.getLogger",
"flask.request.args.get",
"configparser.ConfigParser",
"flask_cors.CORS",
"flask.Flask",
"time.sleep",
"helpers.ThreadSafeDict",
"copy.copy",
"pycountry.countries.get",
"flask.jsonify",
"threading.Lock",
"json.dumps",
"itertools.product",
"nltk.sent_tokenize",
"helpe... | [((1625, 1640), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (1630, 1640), False, 'from flask import Flask, request, jsonify, redirect\n'), ((1641, 1650), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (1645, 1650), False, 'from flask_cors import CORS\n'), ((24671, 24706), 'logging.getLogger', 'log... |
#!/usr/bin/env python
'''
Calculate the RNA-seq reads coverage over gene body.
This module uses bigwig file as input.
'''
#import built-in modules
import os,sys
if sys.version_info[0] != 2 or sys.version_info[1] != 7:
print >>sys.stderr, "\nYou are using python" + str(sys.version_info[0]) + '.' + str(sys.version_info... | [
"os.path.exists",
"optparse.OptionParser",
"collections.defaultdict",
"qcmodule.mystat.percentile_list",
"subprocess.call",
"sys.exit",
"numpy.nan_to_num"
] | [((356, 366), 'sys.exit', 'sys.exit', ([], {}), '()\n', (364, 366), False, 'import os, sys\n'), ((1539, 1567), 'collections.defaultdict', 'collections.defaultdict', (['int'], {}), '(int)\n', (1562, 1567), False, 'import collections\n'), ((3656, 3707), 'optparse.OptionParser', 'OptionParser', (['usage'], {'version': "('... |
import argparse
import configparser
import os
import sys
import ast
import logging
import numpy as np
from contextlib import suppress
from glob import glob
from collections import namedtuple
from mtsv.utils import(error, warn, specfile_read)
from mtsv.argutils import (read, export)
from mtsv import (DEFAULT_LOG_FNAME... | [
"logging.getLogger",
"collections.namedtuple",
"os.listdir",
"configparser.ConfigParser",
"mtsv.utils.specfile_read",
"os.path.join",
"argparse.ArgumentTypeError",
"os.getcwd",
"os.chdir",
"os.path.dirname",
"os.path.isfile",
"os.path.isdir",
"mtsv.argutils.export.to_config",
"mtsv.argutil... | [((351, 378), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (368, 378), False, 'import logging\n'), ((10486, 10550), 'collections.namedtuple', 'namedtuple', (['"""Record"""', "['read_id', 'counts', 'taxa', 'read_name']"], {}), "('Record', ['read_id', 'counts', 'taxa', 'read_name'])\n", (... |
#!/usr/bin/bash
from subprocess import run
import os
from datetime import datetime
queries = [*range(1, 23)]
path = "./nvprof_TPCH/"
if not os.path.isdir(path):
os.makedirs(path)
for query in queries:
print("Running Query q" + str(query))
print("Started at " + datetime.today().strftime('%Y-%m-%d-%H:%M:%S'... | [
"datetime.datetime.today",
"os.path.isdir",
"os.makedirs"
] | [((142, 161), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\n', (155, 161), False, 'import os\n'), ((167, 184), 'os.makedirs', 'os.makedirs', (['path'], {}), '(path)\n', (178, 184), False, 'import os\n'), ((275, 291), 'datetime.datetime.today', 'datetime.today', ([], {}), '()\n', (289, 291), False, 'from da... |
from euler import elapsed_time, prime_factors
from math import sqrt
@elapsed_time()
def solve():
return max(prime_factors(600851475143))
if __name__ == "__main__":
print("ans:", solve())
| [
"euler.elapsed_time",
"euler.prime_factors"
] | [((71, 85), 'euler.elapsed_time', 'elapsed_time', ([], {}), '()\n', (83, 85), False, 'from euler import elapsed_time, prime_factors\n'), ((114, 141), 'euler.prime_factors', 'prime_factors', (['(600851475143)'], {}), '(600851475143)\n', (127, 141), False, 'from euler import elapsed_time, prime_factors\n')] |
import socket
import sys
# Create a TCP/IP socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Connect the socket to the port where the server is listening
server_address = ('www.irit.fr', 80)
sock.connect(server_address)
# req = "GET / HTTP/1.0\n\n"
| [
"socket.socket"
] | [((58, 107), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (71, 107), False, 'import socket\n')] |
# Copyright 2017-2019 <NAME>, <NAME>, <NAME>
# Copyright 2019-2020 Intel Corporation
#
# SPDX-License-Identifier: AGPL-3.0-or-later
"""
kAFL Slave Implementation.
Request fuzz input from Master and process it through various fuzzing stages/mutations.
Each Slave is associated with a single Qemu instance for executing ... | [
"common.util.print_warning",
"fuzzer.statistics.SlaveStatistics",
"common.util.atomic_write",
"psutil.Process",
"time.sleep",
"common.config.FuzzerConfiguration",
"sys.exit",
"fuzzer.state_logic.FuzzingStateLogic",
"common.util.print_fail",
"os.setpgrp",
"fuzzer.bitmap.BitmapStorage",
"fuzzer.... | [((1221, 1242), 'common.config.FuzzerConfiguration', 'FuzzerConfiguration', ([], {}), '()\n', (1240, 1242), False, 'from common.config import FuzzerConfiguration\n'), ((1449, 1483), 'fuzzer.communicator.ClientConnection', 'ClientConnection', (['slave_id', 'config'], {}), '(slave_id, config)\n', (1465, 1483), False, 'fr... |
#-*- coding: utf-8 -*-
''' Простой платформер
разработчики:
- <NAME> (1-ПМИ) (aka zerabog)
- <NAME> (1-ПМИ) (aka AdmPac)
- <NAME> (1-ПМИ) (aka kuchugurann)
- <NAME> (1-ББИ) (aka slkdivize)
- <NAME> (2-ПМИ) (aka Glyceride)
- <NAME> (2-ПМИ) (aka mishkashishka133... | [
"arcade.window_commands.close_window",
"arcade.set_background_color",
"arcade.start_render",
"arcade.run"
] | [((3629, 3641), 'arcade.run', 'arcade.run', ([], {}), '()\n', (3639, 3641), False, 'import arcade\n'), ((1045, 1093), 'arcade.set_background_color', 'arcade.set_background_color', (['arcade.color.AMAZON'], {}), '(arcade.color.AMAZON)\n', (1072, 1093), False, 'import arcade\n'), ((1956, 1977), 'arcade.start_render', 'ar... |
#!/usr/bin/env python
"""
Formatters for REDbot output.
"""
from collections import defaultdict
from configparser import SectionProxy
import inspect
import locale
import sys
import time
from typing import Any, Callable, List, Dict, Type, TYPE_CHECKING
import unittest
import thor
from thor.events import EventEmitter... | [
"thor.events.EventEmitter.__init__",
"thor.schedule",
"thor.events.on",
"locale.format",
"inspect.isclass",
"time.time"
] | [((5308, 5345), 'locale.format', 'locale.format', (['"""%d"""', 'i'], {'grouping': '(True)'}), "('%d', i, grouping=True)\n", (5321, 5345), False, 'import locale\n'), ((2642, 2669), 'thor.events.EventEmitter.__init__', 'EventEmitter.__init__', (['self'], {}), '(self)\n', (2663, 2669), False, 'from thor.events import Eve... |
import numpy as np
import csv
def read_ages_contact_matrix(country, n_ages):
"""Create a country-specific contact matrix from stored data.
Read a stored contact matrix based on age intervals. Return a matrix of
expected number of contacts for each pair of raw ages. Extrapolate to age
ranges that are n... | [
"numpy.array",
"numpy.zeros",
"csv.reader"
] | [((1377, 1403), 'numpy.zeros', 'np.zeros', (['(n_ages, n_ages)'], {}), '((n_ages, n_ages))\n', (1385, 1403), True, 'import numpy as np\n'), ((1619, 1662), 'numpy.array', 'np.array', (['[row[1:-1] for row in csvraw[1:]]'], {}), '([row[1:-1] for row in csvraw[1:]])\n', (1627, 1662), True, 'import numpy as np\n'), ((1510,... |
"""
This tutorial shows you how to record a video of a random policy in the world.
"""
from causal_world.task_generators.task import generate_task
import causal_world.viewers.task_viewer as viewer
from causal_world.loggers.data_loader import DataLoader
def example():
# This tutorial shows how to view a random po... | [
"causal_world.task_generators.task.generate_task",
"causal_world.viewers.task_viewer.record_video_of_random_policy"
] | [((357, 399), 'causal_world.task_generators.task.generate_task', 'generate_task', ([], {'task_generator_id': '"""picking"""'}), "(task_generator_id='picking')\n", (370, 399), False, 'from causal_world.task_generators.task import generate_task\n'), ((497, 642), 'causal_world.viewers.task_viewer.record_video_of_random_po... |
import numpy as np
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
## Here we have consider last N days as training data for today's predict values
## X=[[1,......,100],[2,.....,101]]
## Y=[ 101st day, 102 ]
def previous_data(data,prev_days):
"""
Return: numpy array of t... | [
"numpy.array",
"sklearn.preprocessing.MinMaxScaler",
"pandas.read_csv"
] | [((852, 873), 'pandas.read_csv', 'pd.read_csv', (['filename'], {}), '(filename)\n', (863, 873), True, 'import pandas as pd\n'), ((1251, 1285), 'sklearn.preprocessing.MinMaxScaler', 'MinMaxScaler', ([], {'feature_range': '(0, 1)'}), '(feature_range=(0, 1))\n', (1263, 1285), False, 'from sklearn.preprocessing import MinM... |
#!/usr/bin/env python3
# Copyright (c) 2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"string.Template",
"threading.current_thread",
"argparse.ArgumentParser",
"pathlib.Path",
"pathlib.Path.cwd",
"subprocess.Popen",
"subprocess.run",
"sys.stdout.write",
"common.load_models_from_args",
"platform.system",
"os.cpu_count",
"sys.exit",
"re.sub",
"re.search"
] | [((1093, 1110), 'platform.system', 'platform.system', ([], {}), '()\n', (1108, 1110), False, 'import platform\n'), ((2877, 2902), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2900, 2902), False, 'import argparse\n'), ((5476, 5518), 'common.load_models_from_args', 'common.load_models_from_arg... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import six
import typing # NOQA: F401
from nixnet import _funcs
from nixnet import constants
class DbcAttributeCollection(collections.Mapping):
"""Collection for accessing DBC attribu... | [
"nixnet._funcs.nxdb_get_dbc_attribute",
"typing.cast",
"nixnet._funcs.nxdb_get_dbc_attribute_size"
] | [((2946, 3004), 'nixnet._funcs.nxdb_get_dbc_attribute_size', '_funcs.nxdb_get_dbc_attribute_size', (['self._handle', 'mode', '""""""'], {}), "(self._handle, mode, '')\n", (2980, 3004), False, 'from nixnet import _funcs\n'), ((3030, 3099), 'nixnet._funcs.nxdb_get_dbc_attribute', '_funcs.nxdb_get_dbc_attribute', (['self.... |