code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#!/usr/bin/env python3
# -*- coding = utf-8 -*-
import os
import sys
import json
import statistics
import cv2
from keras.models import load_model
import numpy as np
from models.model_factory import load_keras_model
from util.constant import fer2013_classes
from util.classifyimgops import apply_offsets
from util.class... | [
"numpy.argmax",
"cv2.rectangle",
"util.classifyimgops.preprocess_input",
"cv2.imshow",
"util.classifyimgops.apply_offsets",
"util.info.load_info",
"cv2.cvtColor",
"os.path.dirname",
"models.model_factory.load_keras_model",
"numpy.max",
"statistics.mode",
"cv2.destroyAllWindows",
"cv2.resize"... | [((540, 551), 'util.info.load_info', 'load_info', ([], {}), '()\n', (549, 551), False, 'from util.info import load_info\n'), ((965, 1015), 'models.model_factory.load_keras_model', 'load_keras_model', (['"""Model-27-0.6631"""'], {'compile': '(False)'}), "('Model-27-0.6631', compile=False)\n", (981, 1015), False, 'from m... |
import unittest
import os
import pathlib
from pathlib import Path
from hackertray import Firefox
class FirefoxTest(unittest.TestCase):
def test_history(self):
config_folder_path = os.getcwd()+'/test/'
data = Firefox.search([
"http://www.hckrnews.com/",
"http://www.google.co... | [
"pathlib.Path.home",
"os.getcwd",
"hackertray.Firefox.default_firefox_profile_path",
"os.environ.get",
"hackertray.Firefox.search"
] | [((230, 374), 'hackertray.Firefox.search', 'Firefox.search', (["['http://www.hckrnews.com/', 'http://www.google.com/',\n 'http://wiki.ubuntu.com/', 'http://invalid_url/']", 'config_folder_path'], {}), "(['http://www.hckrnews.com/', 'http://www.google.com/',\n 'http://wiki.ubuntu.com/', 'http://invalid_url/'], con... |
from tkinter import Frame, Label, Canvas, PhotoImage, Button, Toplevel
from tkinter import LEFT, NW, X, Y, BOTH, YES
class MainApp:
def __init__(self, parent, config, communicator, backgrounds, counter_updater):
self.parent = parent
self.screen_width = self.parent.winfo_screenwidth()
self.... | [
"tkinter.PhotoImage",
"tkinter.Canvas",
"tkinter.Frame.__init__",
"tkinter.Button",
"tkinter.Toplevel",
"tkinter.Frame",
"tkinter.Label"
] | [((390, 408), 'tkinter.Frame', 'Frame', (['self.parent'], {}), '(self.parent)\n', (395, 408), False, 'from tkinter import Frame, Label, Canvas, PhotoImage, Button, Toplevel\n'), ((1210, 1299), 'tkinter.Button', 'Button', (['self.frame'], {'text': '"""show/hide counters"""', 'width': '(40)', 'command': 'self.counter_win... |
#!/usr/bin/env python
from cffi import FFI
ffi = FFI()
ffi.cdef("""
#define TFD_CLOEXEC ...
#define TFD_NONBLOCK ...
#define TFD_TIMER_ABSTIME ...
#define CLOCK_REALTIME ...
#define CLOCK_MONOTONIC ...
#define CLOCK_PROCESS_CPUTIME_ID ...
#define CLOCK_THREAD_CPUTIME_ID ... | [
"cffi.FFI"
] | [((51, 56), 'cffi.FFI', 'FFI', ([], {}), '()\n', (54, 56), False, 'from cffi import FFI\n')] |
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 21 15:02:36 2019
Bresenham画圆法实现
博客教程地址:
https://blog.csdn.net/varyshare/article/details/96724103
@author: 知乎@Ai酱
"""
import numpy as np
import matplotlib.pyplot as plt
img = np.zeros((105,105)) # 创建一个105x105的画布
count = 0
def draw(x,y):
"""
绘制点(x,y)
注意:需要把(x... | [
"matplotlib.pyplot.imshow",
"numpy.zeros"
] | [((222, 242), 'numpy.zeros', 'np.zeros', (['(105, 105)'], {}), '((105, 105))\n', (230, 242), True, 'import numpy as np\n'), ((1167, 1182), 'matplotlib.pyplot.imshow', 'plt.imshow', (['img'], {}), '(img)\n', (1177, 1182), True, 'import matplotlib.pyplot as plt\n')] |
"""
__version__ = "$Revision: 1.22 $"
__date__ = "$Date: 2004/09/25 03:20:57 $"
"""
import wx
from PythonCard import event, widget
import textfield
class PasswordFieldSpec(textfield.TextFieldSpec):
def __init__(self):
textfield.TextFieldSpec.__init__( self )
self._name = 'PasswordField'
s... | [
"PythonCard.widget.makeNewId",
"textfield.TextFieldSpec.__init__",
"wx.CallAfter",
"PythonCard.registry.Registry.getInstance",
"PythonCard.widget.Widget.__init__",
"textfield.getAlignment"
] | [((233, 271), 'textfield.TextFieldSpec.__init__', 'textfield.TextFieldSpec.__init__', (['self'], {}), '(self)\n', (265, 271), False, 'import textfield\n'), ((1549, 1597), 'PythonCard.widget.Widget.__init__', 'widget.Widget.__init__', (['self', 'aParent', 'aResource'], {}), '(self, aParent, aResource)\n', (1571, 1597), ... |
from copy import copy
from typing import Optional, Union
import numpy as np
from torch import Tensor
from tqdm import tqdm
from graphwar.attack.injection.injection_attacker import InjectionAttacker
class RandomInjection(InjectionAttacker):
r"""Injection nodes into a graph randomly.
Example
-------
>... | [
"numpy.random.choice"
] | [((3978, 4048), 'numpy.random.choice', 'np.random.choice', (['candidate_nodes', 'self.num_edges_local'], {'replace': '(False)'}), '(candidate_nodes, self.num_edges_local, replace=False)\n', (3994, 4048), True, 'import numpy as np\n')] |
# Licensed under the MIT license
# Copyright (c) 2016 <NAME> (<EMAIL>)
import smtplib
from os.path import basename
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.application import MIMEApplication
def mail_with_pdf(email_server, from_email_address, to_em... | [
"email.mime.text.MIMEText",
"email.mime.multipart.MIMEMultipart",
"smtplib.SMTP",
"os.path.basename"
] | [((584, 622), 'email.mime.text.MIMEText', 'MIMEText', (['email_body'], {'_charset': '"""UTF-8"""'}), "(email_body, _charset='UTF-8')\n", (592, 622), False, 'from email.mime.text import MIMEText\n'), ((640, 676), 'email.mime.multipart.MIMEMultipart', 'MIMEMultipart', ([], {'_subparts': '(text, pdf)'}), '(_subparts=(text... |
#!/usr/bin/env python3
import argparse
from pathlib import Path
import shutil
import subprocess
SERVER_ARGS = [
"--mod-directory", "/opt/factorio/mods",
"--map-gen-settings", "/opt/factorio/config/map-gen-settings.json",
"--map-settings", "/opt/factorio/config/map-settings.json",
"--server-settings",... | [
"pathlib.Path",
"subprocess.call",
"argparse.ArgumentParser",
"shutil.copy"
] | [((1624, 1649), 'subprocess.call', 'subprocess.call', (['run_args'], {}), '(run_args)\n', (1639, 1649), False, 'import subprocess\n'), ((1683, 1860), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""A Factorio Server. The script is a lightweight utilitiy for handling the configuration and ... |
import pgeocode
import pandas as pd
# select uk (gb)region
nomi = pgeocode.Nominatim('gb')
def postcode_to_lat_long(df, postcode):
"""Function to convert GB postcode's to latitude
and longitutde.
Args:
df (pandas dataframe): dataframe with postcode column
postcode (str): postcode column ... | [
"pgeocode.Nominatim",
"pandas.read_csv"
] | [((66, 90), 'pgeocode.Nominatim', 'pgeocode.Nominatim', (['"""gb"""'], {}), "('gb')\n", (84, 90), False, 'import pgeocode\n'), ((1136, 1166), 'pandas.read_csv', 'pd.read_csv', (['"""./postcodes.csv"""'], {}), "('./postcodes.csv')\n", (1147, 1166), True, 'import pandas as pd\n')] |
from django.db import models
from django.utils.translation import gettext_lazy as _
from core.models import BaseAbstractModel
from phonenumber_field.modelfields import PhoneNumberField
from customers.models import City, Customer, Address
from django_iban.fields import IBANField
from baskets.models import Basket
from pr... | [
"django_iban.fields.IBANField",
"phonenumber_field.modelfields.PhoneNumberField",
"django.utils.translation.gettext_lazy"
] | [((681, 699), 'phonenumber_field.modelfields.PhoneNumberField', 'PhoneNumberField', ([], {}), '()\n', (697, 699), False, 'from phonenumber_field.modelfields import PhoneNumberField\n'), ((1432, 1450), 'phonenumber_field.modelfields.PhoneNumberField', 'PhoneNumberField', ([], {}), '()\n', (1448, 1450), False, 'from phon... |
# MAPTA
from mapta import Mapta
import matplotlib
import matplotlib.pyplot as plt
import matplotlib.ticker as mtick
get_ipython().run_line_magic('matplotlib', 'inline')
import seaborn as sns
# Natural Langauge Processing
from nrclex import NRCLex
import re
import nltk
nltk.download('wordnet')
nltk.download('stopwords... | [
"pandas.DataFrame",
"matplotlib.pyplot.title",
"matplotlib.ticker.MultipleLocator",
"matplotlib.pyplot.show",
"pandas.DataFrame.from_dict",
"nltk.stem.WordNetLemmatizer",
"matplotlib.pyplot.ylim",
"nrclex.NRCLex",
"matplotlib.pyplot.yticks",
"seaborn.barplot",
"matplotlib.pyplot.ylabel",
"nltk... | [((271, 295), 'nltk.download', 'nltk.download', (['"""wordnet"""'], {}), "('wordnet')\n", (284, 295), False, 'import nltk\n'), ((296, 322), 'nltk.download', 'nltk.download', (['"""stopwords"""'], {}), "('stopwords')\n", (309, 322), False, 'import nltk\n'), ((323, 345), 'nltk.download', 'nltk.download', (['"""punkt"""']... |
from __future__ import annotations # for postponed evaluation
import multiprocessing as mp
from pyneurode.processor_node.Processor import *
import logging
import tempfile
import os
import time
import functools
logging.basicConfig(level=logging.DEBUG)
def process_wrapper(name, proc_class, shutdown_event, *args, **kw... | [
"functools.partial",
"logging.debug",
"logging.basicConfig",
"time.sleep",
"time.time",
"multiprocessing.Event",
"multiprocessing.Process"
] | [((213, 253), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (232, 253), False, 'import logging\n'), ((1583, 1594), 'time.time', 'time.time', ([], {}), '()\n', (1592, 1594), False, 'import time\n'), ((2253, 2266), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1... |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 22 17:49:12 2020
@author: 66IN
"""
import pygame,random, sys #pygame is an inbuilt library for python , sys is module to access some functionality
def ball_animation():
global ball_speed_x,ball_speed_y
ball.x += ball_speed_x
ball.y += ball_s... | [
"pygame.draw.ellipse",
"pygame.quit",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.draw.rect",
"pygame.Rect",
"pygame.Color",
"random.choice",
"pygame.init",
"pygame.draw.aaline",
"pygame.display.flip",
"pygame.display.set_caption",
"pygame.time.Clock",
"sys.exit"
] | [((1428, 1441), 'pygame.init', 'pygame.init', ([], {}), '()\n', (1439, 1441), False, 'import pygame, random, sys\n'), ((1485, 1504), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (1502, 1504), False, 'import pygame, random, sys\n'), ((1634, 1688), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(... |
import os
import time
import PoGoCLI
import LocateIV
import ButtonPressing
from PIL import Image
import threading
from flask import Flask, render_template, request
# Static information
app = Flask(__name__)
name_box = 'images/Name_Box.png'
ok_button = 'images/Ok_Button.png'
okay_button = 'images/Okay_Button.png'
men... | [
"threading.Thread",
"ButtonPressing.Find_Button",
"PoGoCLI.Device_Input",
"flask.request.args.get",
"PoGoCLI.Update_Screenshot",
"PoGoCLI.Connect_Device",
"PoGoCLI.Swipe_Right_To_Left",
"flask.Flask",
"PoGoCLI.Pair_Device",
"os.system",
"PoGoCLI.Get_List_Of_Devices",
"time.sleep",
"PoGoCLI.C... | [((193, 208), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (198, 208), False, 'from flask import Flask, render_template, request\n'), ((4349, 4384), 'threading.Thread', 'threading.Thread', ([], {'target': 'Web_Server'}), '(target=Web_Server)\n', (4365, 4384), False, 'import threading\n'), ((977, 1019), '... |
#!/usr/bin/python
#ncat -l -v -p 45679
import socket
import subprocess
import os
socket_handler = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
if os.fork() > 0:
os._exit(0)
except OSError as error:
print('Error in fork process: %d (%s)' % (error.errno, error.strerror))
pid = os.fork()
... | [
"socket.socket",
"subprocess.call",
"os.fork",
"os._exit"
] | [((101, 150), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (114, 150), False, 'import socket\n'), ((545, 579), 'subprocess.call', 'subprocess.call', (["['/bin/sh', '-i']"], {}), "(['/bin/sh', '-i'])\n", (560, 579), False, 'import subprocess\... |
# Copyright 2022 @ReneFreingruber
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | [
"pickle.dump",
"utils.msg",
"os.path.exists",
"re.findall",
"pickle.load",
"requests.get",
"utils.perror"
] | [((10304, 10364), 'os.path.exists', 'os.path.exists', (['"""database_security_bugs_from_rewards.pickle"""'], {}), "('database_security_bugs_from_rewards.pickle')\n", (10318, 10364), False, 'import os\n'), ((10881, 10929), 're.findall', 're.findall', (['"""https://crbug.com/[0-9]+"""', 'response'], {}), "('https://crbug... |
from __future__ import division
import warnings
warnings.filterwarnings("ignore")
import numpy as np # linear algebra
import pandas as pd
from sklearn.utils import shuffle
from sklearn.model_selection import train_test_split
import logging,sys
import lasagne
from lasagne import layers
from lasagne.updates import neste... | [
"nolearn.lasagne.NeuralNet",
"logging.basicConfig",
"warnings.filterwarnings",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"logging.StreamHandler",
"logging.info",
"numpy.array"
] | [((48, 81), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (71, 81), False, 'import warnings\n'), ((429, 535), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'format': 'FORMAT', 'level': 'logging.INFO', 'datefmt': '"""%Y-%m-%d %H:%M:%I"""'}), "... |
import bpy
selected_objects = bpy.context.selected_objects
for item in selected_objects:
bpy.ops.object.select_all(action='DESELECT')
bpy.context.view_layer.objects.active = item
item.select_set(True)
bpy.ops.object.modifier_add(type='SUBSURF')
bpy.context.object.modifiers["Subdivision"]... | [
"bpy.ops.object.modifier_add",
"bpy.ops.object.select_all"
] | [((95, 139), 'bpy.ops.object.select_all', 'bpy.ops.object.select_all', ([], {'action': '"""DESELECT"""'}), "(action='DESELECT')\n", (120, 139), False, 'import bpy\n'), ((229, 272), 'bpy.ops.object.modifier_add', 'bpy.ops.object.modifier_add', ([], {'type': '"""SUBSURF"""'}), "(type='SUBSURF')\n", (256, 272), False, 'im... |
import logging
import os
from typing import (
Optional,
)
import numpy as np
import psycopg2
import tensorflow as tf
from molecule_game.mol_preprocessor import (
MolPreprocessor,
atom_featurizer,
bond_featurizer,
)
from rdkit.Chem.rdmolfiles import MolFromSmiles
from tensorflow.python.keras.preprocessi... | [
"rdkit.Chem.rdmolfiles.MolFromSmiles",
"numpy.random.choice",
"rlmolecule.molecule.policy.model.build_policy_evaluator",
"os.path.abspath",
"logging.debug",
"tensorflow.nn.softmax",
"numpy.expand_dims",
"numpy.isclose",
"molecule_game.mol_preprocessor.MolPreprocessor",
"rlmolecule.molecule.policy.... | [((825, 852), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (842, 852), False, 'import logging\n'), ((877, 978), 'molecule_game.mol_preprocessor.MolPreprocessor', 'MolPreprocessor', ([], {'atom_features': 'atom_featurizer', 'bond_features': 'bond_featurizer', 'explicit_hs': '(False)'}), ... |
from bottle import route, run
# http://localhost:8060/ --> anything after is the route
@route("/")
def get_index():
return ("Hello!")
def get_hello():
return ("Hello!!! :)")
@route("/hello")
@route("/hello/<name>")
def get_hello(name="World"):
return (f"Hello, {name}")
run(host="localhost", port=8060... | [
"bottle.run",
"bottle.route"
] | [((90, 100), 'bottle.route', 'route', (['"""/"""'], {}), "('/')\n", (95, 100), False, 'from bottle import route, run\n'), ((188, 203), 'bottle.route', 'route', (['"""/hello"""'], {}), "('/hello')\n", (193, 203), False, 'from bottle import route, run\n'), ((205, 227), 'bottle.route', 'route', (['"""/hello/<name>"""'], {... |
# MIT License
# Copyright (c) 2017 MassChallenge, Inc.
from __future__ import unicode_literals
import swapper
from django.db import models
from accelerator_abstract.models.accelerator_model import AcceleratorModel
class BaseStartupStatus(AcceleratorModel):
startup = models.ForeignKey(
swapper.get_model... | [
"swapper.get_model_name"
] | [((303, 369), 'swapper.get_model_name', 'swapper.get_model_name', (['AcceleratorModel.Meta.app_label', '"""Startup"""'], {}), "(AcceleratorModel.Meta.app_label, 'Startup')\n", (325, 369), False, 'import swapper\n'), ((461, 540), 'swapper.get_model_name', 'swapper.get_model_name', (['AcceleratorModel.Meta.app_label', '"... |
from typing import Iterable, Union
import numpy as np
class DistributionTransformer:
def __init__(self, num_bins: int = 300, use_density: bool = True):
"""
Instantiate a new distribution transformer that extracts distribution information from input values.
Parameters
----------
... | [
"numpy.empty",
"numpy.histogram",
"numpy.array",
"numpy.isnan"
] | [((1371, 1393), 'numpy.array', 'np.array', (['input_values'], {}), '(input_values)\n', (1379, 1393), True, 'import numpy as np\n'), ((1556, 1629), 'numpy.histogram', 'np.histogram', (['input_array'], {'bins': 'self._num_bins', 'density': 'self._use_density'}), '(input_array, bins=self._num_bins, density=self._use_densi... |
import pytest
from unittest.mock import MagicMock
from datacube_ows.ogc_exceptions import WCS2Exception
from datacube_ows.wcs2_utils import uniform_crs
@pytest.fixture
def minimal_cfg():
cfg = MagicMock()
cfg.published_CRSs = {
"dummy": {},
}
return cfg
def test_uniform_crs_url(minimal_cfg):... | [
"pytest.raises",
"unittest.mock.MagicMock",
"datacube_ows.wcs2_utils.uniform_crs"
] | [((200, 211), 'unittest.mock.MagicMock', 'MagicMock', ([], {}), '()\n', (209, 211), False, 'from unittest.mock import MagicMock\n'), ((331, 398), 'datacube_ows.wcs2_utils.uniform_crs', 'uniform_crs', (['minimal_cfg', '"""http://www.opengis.net/def/crs/EPSG/666"""'], {}), "(minimal_cfg, 'http://www.opengis.net/def/crs/E... |
# Copyright (c) 2015 Intel Research and Development Ireland Ltd.
#
# 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 app... | [
"experimental_framework.common.LOG.info",
"heatclient.client.Client",
"experimental_framework.common.LOG.debug",
"keystoneclient.v2_0.client.Client",
"heatclient.common.template_utils.get_template_contents"
] | [((1291, 1413), 'keystoneclient.v2_0.client.Client', 'keystoneClient.Client', ([], {'username': 'self.user', 'password': 'self.password', 'tenant_name': 'self.project_id', 'auth_url': 'self.auth_uri'}), '(username=self.user, password=self.password,\n tenant_name=self.project_id, auth_url=self.auth_uri)\n', (1312, 14... |
from services.select_user_data import select_user_data
from services.save_services import insert_user_data
from data.source import DataView, ViewRun
from data.db_session import create_session
##get linked sessions
def run_query(id, out):
session = create_session()
data=[]
try:
views = session.query(DataView).fil... | [
"data.source.ViewRun",
"data.db_session.create_session",
"services.select_user_data.select_user_data",
"services.save_services.insert_user_data"
] | [((250, 266), 'data.db_session.create_session', 'create_session', ([], {}), '()\n', (264, 266), False, 'from data.db_session import create_session\n'), ((355, 384), 'services.select_user_data.select_user_data', 'select_user_data', (['id', 'session'], {}), '(id, session)\n', (371, 384), False, 'from services.select_user... |
"""Manages GO Term fill colors and bordercolors."""
__copyright__ = "Copyright (C) 2016-2017, <NAME>, <NAME>, All rights reserved."
__author__ = "<NAME>"
import sys
import collections as cx
class GoeaResults(object):
"""Manages GOEA Results for plotting."""
kws_set = set(['id2symbol', 'study_items', 'items... | [
"collections.OrderedDict"
] | [((473, 577), 'collections.OrderedDict', 'cx.OrderedDict', (["[(0.005, 'mistyrose'), (0.01, 'moccasin'), (0.05, 'lemonchiffon1'), (1.0,\n 'grey95')]"], {}), "([(0.005, 'mistyrose'), (0.01, 'moccasin'), (0.05,\n 'lemonchiffon1'), (1.0, 'grey95')])\n", (487, 577), True, 'import collections as cx\n')] |
from copy import copy
all_metas = []
def p1_parse_current(area):
children = area[0]
metadatas = area[1]
consumed = 2
for _ in range(children):
consumed += p1_parse_current(area[consumed:])
for _ in range(metadatas):
all_metas.append(area[consumed])
consumed += 1
return... | [
"copy.copy"
] | [((1377, 1393), 'copy.copy', 'copy', (['input_line'], {}), '(input_line)\n', (1381, 1393), False, 'from copy import copy\n'), ((1408, 1424), 'copy.copy', 'copy', (['input_line'], {}), '(input_line)\n', (1412, 1424), False, 'from copy import copy\n')] |
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import reverse
from django.http import Http404
from .http import Http307
class BaseRequirement(object):
def setup(self, request, *args, **kwargs):
self.request = request
self.args = args
self.kwargs = kw... | [
"django.core.exceptions.ImproperlyConfigured",
"django.http.Http404"
] | [((368, 447), 'django.core.exceptions.ImproperlyConfigured', 'ImproperlyConfigured', (['"""Requirements need to implement a `is_fulfilled` method."""'], {}), "('Requirements need to implement a `is_fulfilled` method.')\n", (388, 447), False, 'from django.core.exceptions import ImproperlyConfigured\n'), ((505, 590), 'dj... |
# -----------------------------------------------------------------------------
# MIT License
#
# Copyright (c) 2018 <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 restricti... | [
"os.remove",
"argparse.ArgumentParser",
"math.atan2",
"os.walk",
"xml.Xml",
"json.dumps",
"cv2.warpAffine",
"os.path.isfile",
"dlib.rectangle",
"dlib.shape_predictor",
"os.path.join",
"cv2.getRotationMatrix2D",
"cv2.imshow",
"cv2.line",
"math.radians",
"math.cos",
"cv2.destroyAllWind... | [((13508, 13533), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (13531, 13533), False, 'import argparse\n'), ((15612, 15634), 'os.path.split', 'os.path.split', (['at_path'], {}), '(at_path)\n', (15625, 15634), False, 'import os\n'), ((15782, 15808), 'os.path.join', 'os.path.join', (['folder', ... |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class Activity(scrapy.Item):
full_name = scrapy.Field(serializer=str)
activity_id = scrapy.Field(serializer=int)
athlete_id = scrapy.Field(s... | [
"scrapy.Field"
] | [((213, 241), 'scrapy.Field', 'scrapy.Field', ([], {'serializer': 'str'}), '(serializer=str)\n', (225, 241), False, 'import scrapy\n'), ((260, 288), 'scrapy.Field', 'scrapy.Field', ([], {'serializer': 'int'}), '(serializer=int)\n', (272, 288), False, 'import scrapy\n'), ((306, 334), 'scrapy.Field', 'scrapy.Field', ([],... |
from __future__ import print_function # Only needed for Python 2
import random
import time
import zerorpc
from run_simulation import Simulation
totalWeights = 4
numTop = 2
gamesPer = 2
temp = numTop**totalWeights
POPULATION_SIZE = temp * 2
TOTAL_GENS = 1000
def getRand(range=1):
return random.uniform(-range, r... | [
"random.randint",
"time.time",
"run_simulation.Simulation",
"random.uniform"
] | [((296, 325), 'random.uniform', 'random.uniform', (['(-range)', 'range'], {}), '(-range, range)\n', (310, 325), False, 'import random\n'), ((1381, 1392), 'time.time', 'time.time', ([], {}), '()\n', (1390, 1392), False, 'import time\n'), ((1735, 1747), 'run_simulation.Simulation', 'Simulation', ([], {}), '()\n', (1745, ... |
# Generated by Django 2.2.7 on 2019-12-02 17:32
import device_registry.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('device_registry', '0072_auto_20191202_1725'),
]
operations = [
migrations.AlterField(
model_name='... | [
"django.db.models.DateTimeField"
] | [((807, 850), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=True)\n', (827, 850), False, 'from django.db import migrations, models\n')] |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys
import torch
import time
import torch.optim as optim
import torch.nn.functional as F
import numpy as np
from haversine import haversine
from models import get_model
from dataProcess import preprocess_data, process_data
from utils import sgc_precompute, parse_ar... | [
"numpy.argmax",
"numpy.median",
"torch.load",
"torch.nn.functional.cross_entropy",
"haversine.haversine",
"dataProcess.process_data",
"numpy.hstack",
"torch.save",
"time.time",
"dataProcess.preprocess_data",
"numpy.array",
"numpy.mean",
"utils.sgc_precompute",
"utils.parse_args",
"torch.... | [((3813, 3838), 'numpy.argmax', 'np.argmax', (['y_pred'], {'axis': '(1)'}), '(y_pred, axis=1)\n', (3822, 3838), True, 'import numpy as np\n'), ((4932, 4957), 'numpy.argmax', 'np.argmax', (['y_pred'], {'axis': '(1)'}), '(y_pred, axis=1)\n', (4941, 4957), True, 'import numpy as np\n'), ((6099, 6120), 'dataProcess.preproc... |
##############################################################################
#
# Copyright (c) 2003-2018 by The University of Queensland
# http://www.uq.edu.au
#
# Primary Business: Queensland, Australia
# Licensed under the Apache License, version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Development unti... | [
"esys.downunder.coordinates.makeTransformation",
"esys.escript.linearPDEs.LinearPDE",
"esys.escript.DiracDeltaFunctions"
] | [((3368, 3407), 'esys.downunder.coordinates.makeTransformation', 'makeTransformation', (['domain', 'coordinates'], {}), '(domain, coordinates)\n', (3386, 3407), False, 'from esys.downunder.coordinates import makeTransformation\n'), ((4933, 4963), 'esys.escript.linearPDEs.LinearPDE', 'LinearPDE', (['dom'], {'numEquation... |
from easycv import Image, Pipeline
from easycv.transforms.color import GrayScale, FilterChannels
from easycv.transforms.filter import Blur
def test_image():
image = Image("tests/images/lenna.png")
assert image.array is not None
image = Image("https://images.dog.ceo/breeds/komondor/n02105505_2699.jpg")
... | [
"easycv.transforms.color.GrayScale",
"easycv.transforms.color.FilterChannels",
"easycv.Image",
"easycv.transforms.filter.Blur"
] | [((171, 202), 'easycv.Image', 'Image', (['"""tests/images/lenna.png"""'], {}), "('tests/images/lenna.png')\n", (176, 202), False, 'from easycv import Image, Pipeline\n'), ((250, 316), 'easycv.Image', 'Image', (['"""https://images.dog.ceo/breeds/komondor/n02105505_2699.jpg"""'], {}), "('https://images.dog.ceo/breeds/kom... |
from django.urls import path,include
from . import views
app_name = "mysite"
urlpatterns = [
path('', views.index,name="index"),
#Schedule
#---------------------------------------------------------------------------------------------------------------------------------
path('mycalendar/', views.MyCale... | [
"django.urls.path"
] | [((99, 134), 'django.urls.path', 'path', (['""""""', 'views.index'], {'name': '"""index"""'}), "('', views.index, name='index')\n", (103, 134), False, 'from django.urls import path, include\n'), ((1386, 1436), 'django.urls.path', 'path', (['"""info_top/"""', 'views.info_top'], {'name': '"""info_top"""'}), "('info_top/'... |
import numpy as np
import sys
sys.path.append("../")
# sys.path.append("../loaders/")
from derive_dataset import get_max_r2, get_max_r2_alt
from loaders import pvc1
if __name__ == "__main__":
"""Only for pvc1. See generate_hyperflow for the method for HyperFlow."""
maxr2s = []
for single_cell in range(23... | [
"sys.path.append",
"derive_dataset.get_max_r2",
"derive_dataset.get_max_r2_alt",
"loaders.pvc1.PVC1",
"numpy.concatenate"
] | [((31, 53), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (46, 53), False, 'import sys\n'), ((340, 481), 'loaders.pvc1.PVC1', 'pvc1.PVC1', (['"""/mnt/e/data_derived/crcns-ringach-data/"""'], {'nt': '(1)', 'ntau': '(10)', 'nframedelay': '(0)', 'repeats': '(True)', 'single_cell': 'single_cell', ... |
from keras.preprocessing.image import img_to_array
import imutils
import cv2
from keras.models import load_model
import numpy as np
import pyttsx3
import pyaudio
import matplotlib.pyplot as plt
from keras.preprocessing import image
from statistics import mode
def get_labels(dataset_name):
if dataset_name == 'imd... | [
"keras.models.load_model",
"cv2.resize",
"cv2.putText",
"numpy.argmax",
"cv2.cvtColor",
"cv2.waitKey",
"numpy.expand_dims",
"cv2.VideoCapture",
"cv2.rectangle",
"statistics.mode",
"cv2.CascadeClassifier",
"cv2.imshow",
"cv2.namedWindow"
] | [((1935, 1979), 'keras.models.load_model', 'load_model', (['gender_model_path'], {'compile': '(False)'}), '(gender_model_path, compile=False)\n', (1945, 1979), False, 'from keras.models import load_model\n'), ((2195, 2226), 'cv2.namedWindow', 'cv2.namedWindow', (['"""window_frame"""'], {}), "('window_frame')\n", (2210,... |
# Copyright 2014-2015 0xc0170
#
# 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,... | [
"copy.deepcopy",
"logging.debug",
"os.makedirs",
"os.path.basename",
"os.path.isdir",
"os.getcwd",
"os.path.dirname",
"os.path.exists",
"collections.defaultdict",
"logging.info",
"os.path.isfile",
"os.path.normpath",
"shutil.rmtree",
"os.listdir"
] | [((3561, 3624), 'logging.info', 'logging.info', (['"""Building a workspace is not currently supported"""'], {}), "('Building a workspace is not currently supported')\n", (3573, 3624), False, 'import logging\n'), ((3679, 3742), 'logging.info', 'logging.info', (['"""Building a workspace is not currently supported"""'], {... |
import bs4 as bs
import requests
import datetime
import data_cse
import json
import dateutil.parser
import asyncio
from aiofile import AIOFile, Writer
DANISH_DATES = ['januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december']
initial_day = datetime.datetime... | [
"asyncio.gather",
"json.dump",
"json.load",
"asyncio.get_event_loop",
"datetime.datetime",
"data_cse.search_title",
"data_cse.generic_resume",
"datetime.timedelta",
"requests.get",
"bs4.BeautifulSoup",
"datetime.datetime.now"
] | [((303, 332), 'datetime.datetime', 'datetime.datetime', (['(2020)', '(6)', '(1)'], {}), '(2020, 6, 1)\n', (320, 332), False, 'import datetime\n'), ((5484, 5508), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (5506, 5508), False, 'import asyncio\n'), ((585, 626), 'bs4.BeautifulSoup', 'bs.Beautifu... |
from Utils.Singleton import SingletonMeta
from os import listdir
from typing import List, Tuple
import re
class DirectoryContentVersioner(metaclass=SingletonMeta):
def __init__(self):
self.__version_regex = '.+-v([0-9]+)'
self.__content_regex = '{}-v[0-9]+'
self.__version_suffix = '-v{}'
... | [
"re.search",
"os.listdir"
] | [((570, 593), 'os.listdir', 'listdir', (['directory_path'], {}), '(directory_path)\n', (577, 593), False, 'from os import listdir\n'), ((503, 543), 're.search', 're.search', (['self.__version_regex', 'content'], {}), '(self.__version_regex, content)\n', (512, 543), False, 'import re\n')] |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os
import sys
if sys.version_info >= (3, 3):
# OS X framework builds of Python 3.3 can not call other 3.3
... | [
"os.environ.get",
"os.unsetenv",
"distutils.version.LooseVersion"
] | [((407, 444), 'os.environ.get', 'os.environ.get', (['"""__PYVENV_LAUNCHER__"""'], {}), "('__PYVENV_LAUNCHER__')\n", (421, 444), False, 'import os\n'), ((454, 488), 'os.unsetenv', 'os.unsetenv', (['"""__PYVENV_LAUNCHER__"""'], {}), "('__PYVENV_LAUNCHER__')\n", (465, 488), False, 'import os\n'), ((738, 774), 'distutils.v... |
import ee
import ee.mapclient
import subprocess
import csv
from datetime import datetime
import time
import datetime
import re
ee.Initialize()
def genreport(report):
with open(report+'/Tasks_failed.csv','wb') as failed:
writer=csv.DictWriter(failed,fieldnames=["Task ID","Task Type", "Start Date","Start Time... | [
"csv.writer",
"subprocess.check_output",
"datetime.datetime.fromtimestamp",
"ee.Initialize",
"ee.data.getTaskStatus",
"csv.DictWriter"
] | [((127, 142), 'ee.Initialize', 'ee.Initialize', ([], {}), '()\n', (140, 142), False, 'import ee\n'), ((239, 443), 'csv.DictWriter', 'csv.DictWriter', (['failed'], {'fieldnames': "['Task ID', 'Task Type', 'Start Date', 'Start Time', 'End Date', 'End Time',\n 'Task Description', 'Error Message', 'Source Script', 'Outp... |
from cannonball.actors.Smoke import Smoke
from cannonball.Actor import Actor
from Box2D import *
import random
class Grenade(Actor):
z = 0.1
def __init__(self, level, position, linear_velocity):
super(Grenade, self).__init__(level)
self._create_body(position, linear_velocity)
def co... | [
"cannonball.actors.Smoke.Smoke",
"random.random"
] | [((1780, 1843), 'cannonball.actors.Smoke.Smoke', 'Smoke', (['self.level', 'self.body.position', 'self.body.linearVelocity'], {}), '(self.level, self.body.position, self.body.linearVelocity)\n', (1785, 1843), False, 'from cannonball.actors.Smoke import Smoke\n'), ((1873, 1888), 'random.random', 'random.random', ([], {})... |
# This is a visualization script for the CSSP results on real datasets.
# The visualization is available for the following subsampling functions:
## * Projection DPPs
## * Volume sampling
## * Pivoted QR
## * Double Phase
## * Largest leverage scores
import sys
sys.path.insert(0, '..')
from CSSPy.dataset_tools import ... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"matplotlib.pyplot.boxplot",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.setp",
"sys.path.insert",
"matplotlib.pyplot.figure",
"numpy.loadtxt",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xticks",
"matplotlib... | [((263, 287), 'sys.path.insert', 'sys.path.insert', (['(0)', '""".."""'], {}), "(0, '..')\n", (278, 287), False, 'import sys\n'), ((713, 738), 'numpy.loadtxt', 'np.loadtxt', (['savefile_name'], {}), '(savefile_name)\n', (723, 738), True, 'import numpy as np\n'), ((976, 1003), 'matplotlib.pyplot.figure', 'plt.figure', (... |
from glob import glob
from itertools import chain, product
from matplotlib import mlab
from matplotlib.animation import ArtistAnimation
from scipy.ndimage.morphology import (binary_fill_holes,
distance_transform_edt)
from scipy.stats import norm
from skimage import util
from skimag... | [
"csv.reader",
"numpy.ravel",
"matplotlib.pyplot.figure",
"skimage.measure.label",
"skimage.morphology.diamond",
"matplotlib.pyplot.imshow",
"skimage.morphology.binary_erosion",
"matplotlib.pyplot.subplots",
"skimage.draw.ellipse",
"skimage.io.imread",
"skimage.exposure.equalize_hist",
"numpy.a... | [((2509, 2541), 'skimage.io.imread', 'io.imread', (['filename'], {'plugin': 'None'}), '(filename, plugin=None)\n', (2518, 2541), False, 'from skimage import io, morphology\n'), ((2554, 2578), 'skimage.util.img_as_float', 'util.img_as_float', (['image'], {}), '(image)\n', (2571, 2578), False, 'from skimage import util\n... |
import numpy as np
class Vector:
def __init__(self, x = 0, y = 0):
self.x = x
self.y = y
def magnitude(self):
return np.sqrt(self.x * self.x + self.y * self.y)
def __repr__(self):
return "Vektor({0}.x, {0}.y)".format(self)
| [
"numpy.sqrt"
] | [((152, 194), 'numpy.sqrt', 'np.sqrt', (['(self.x * self.x + self.y * self.y)'], {}), '(self.x * self.x + self.y * self.y)\n', (159, 194), True, 'import numpy as np\n')] |
from __future__ import annotations
import importlib
import inspect
import os
import sys
from collections.abc import Mapping
from contextvars import ContextVar
from pathlib import Path
from typing import Optional, Any
from .app import App
from .config import get_config, parse_list
from .error import Error, base_errors... | [
"os.path.abspath",
"importlib.import_module",
"os.path.dirname",
"pathlib.Path",
"contextvars.ContextVar",
"inspect.stack"
] | [((1294, 1315), 'contextvars.ContextVar', 'ContextVar', (['"""request"""'], {}), "('request')\n", (1304, 1315), False, 'from contextvars import ContextVar\n'), ((10596, 10625), 'os.path.dirname', 'os.path.dirname', (['project_path'], {}), '(project_path)\n', (10611, 10625), False, 'import os\n'), ((9801, 9848), 'import... |
import numpy as np
import bandits_lab.algorithms as algs
import bandits_lab.bandit_definitions as bands
import sim_utilities as sim
np.random.seed(10)
T = 20000
n_tests = 75
"""
Definition of the problems considered
- the probability set considered is a triangle,
- we build a family of bandit pr... | [
"bandits_lab.bandit_definitions.PolytopeConstraints",
"numpy.random.seed",
"sim_utilities.launch",
"sim_utilities.plot_and_save",
"bandits_lab.algorithms.DivPUCB",
"numpy.array",
"bandits_lab.bandit_definitions.DivPBand"
] | [((134, 152), 'numpy.random.seed', 'np.random.seed', (['(10)'], {}), '(10)\n', (148, 152), True, 'import numpy as np\n'), ((940, 986), 'bandits_lab.bandit_definitions.PolytopeConstraints', 'bands.PolytopeConstraints', (['K', 'constraints_list'], {}), '(K, constraints_list)\n', (965, 986), True, 'import bandits_lab.band... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
from scipy import ndimage
from PIL import Image
import scipy
import numpy as np
import cv2
import os
nomeImagem="muitas_crateras.jpg"
def medianBlur(img):
img_blur=cv2.medianBlur(img,7);
return img_blur
def averageBlur(img):
ke... | [
"numpy.divide",
"cv2.filter2D",
"cv2.medianBlur",
"numpy.zeros",
"numpy.ones",
"scipy.ndimage.sobel",
"numpy.place",
"numpy.hypot",
"PIL.Image.open",
"numpy.max",
"cv2.convertScaleAbs",
"PIL.Image.fromarray",
"numpy.arctan"
] | [((248, 270), 'cv2.medianBlur', 'cv2.medianBlur', (['img', '(7)'], {}), '(img, 7)\n', (262, 270), False, 'import cv2\n'), ((369, 398), 'cv2.filter2D', 'cv2.filter2D', (['img', '(-1)', 'kernel'], {}), '(img, -1, kernel)\n', (381, 398), False, 'import cv2\n'), ((544, 568), 'cv2.convertScaleAbs', 'cv2.convertScaleAbs', ([... |
from django import forms
from images.models import Theme
class ThemeChoiceField(forms.ModelChoiceField):
def label_from_instance(self, obj):
return obj.name
class ThemeForm(forms.Form):
theme = ThemeChoiceField(Theme.objects.all().exclude(name='Covers').exclude(name='SiteAssets'), label='', required=... | [
"django.forms.RadioSelect",
"images.models.Theme.objects.all"
] | [((456, 475), 'django.forms.RadioSelect', 'forms.RadioSelect', ([], {}), '()\n', (473, 475), False, 'from django import forms\n'), ((230, 249), 'images.models.Theme.objects.all', 'Theme.objects.all', ([], {}), '()\n', (247, 249), False, 'from images.models import Theme\n')] |
"""Glue code to include text data seamlessly (or like more or less ;>)"""
import torch
import os
from itertools import chain
import collections
# All language modules are import lazily
import logging
log = logging.getLogger(__name__)
def _build_and_split_dataset_text(cfg_data, split, user_idx=None, return_full_dat... | [
"datasets.set_progress_bar_enabled",
"os.path.isfile",
"os.path.join",
"urllib.parse.urlparse",
"datasets.load_dataset",
"os.path.exists",
"urllib.request.urlopen",
"tensorflow.io.parse_example",
"itertools.chain",
"transformers.DataCollatorForLanguageModeling",
"torch.randint",
"transformers.... | [((209, 236), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (226, 236), False, 'import logging\n'), ((406, 439), 'os.path.expanduser', 'os.path.expanduser', (['cfg_data.path'], {}), '(cfg_data.path)\n', (424, 439), False, 'import os\n'), ((518, 549), 'datasets.set_progress_bar_enabled', ... |
import os, sys
import numpy as np
try:
import StringIO
except ModuleNotFoundError:
from io import BytesIO as StringIO
import base as wb
class NBest(object):
def __init__(self, nbest, trans, acscore=None, lmscore=None, gfscore=None):
"""
construct a nbest class
Args:
n... | [
"base.io.StringIO",
"numpy.zeros_like",
"base.LoadScore",
"base.GetBest",
"base.CmpWER",
"numpy.array",
"numpy.linspace",
"base.file_rmlabel",
"base.CmpOracleWER",
"StringIO.StringIO"
] | [((1236, 1252), 'base.io.StringIO', 'wb.io.StringIO', ([], {}), '()\n', (1250, 1252), True, 'import base as wb\n'), ((1531, 1556), 'numpy.linspace', 'np.linspace', (['(0.1)', '(1.0)', '(10)'], {}), '(0.1, 1.0, 10)\n', (1542, 1556), True, 'import numpy as np\n'), ((3822, 3841), 'StringIO.StringIO', 'StringIO.StringIO', ... |
#!/usr/bin/env python
import copy
import numpy as np
import rospy
from nav_msgs.msg import OccupancyGrid, MapMetaData
# Publishers
config_pub = rospy.Publisher("/igvc_slam/local_config_space", OccupancyGrid, queue_size=1)
# Configuration space map
metadata = MapMetaData()
lidar_config_data = [0] * (200 * 200)
lanes... | [
"rospy.Subscriber",
"nav_msgs.msg.MapMetaData",
"nav_msgs.msg.OccupancyGrid",
"rospy.Publisher",
"rospy.init_node",
"rospy.spin",
"rospy.Duration"
] | [((147, 224), 'rospy.Publisher', 'rospy.Publisher', (['"""/igvc_slam/local_config_space"""', 'OccupancyGrid'], {'queue_size': '(1)'}), "('/igvc_slam/local_config_space', OccupancyGrid, queue_size=1)\n", (162, 224), False, 'import rospy\n'), ((263, 276), 'nav_msgs.msg.MapMetaData', 'MapMetaData', ([], {}), '()\n', (274,... |
################# Developed by TheRadziu v1.1 #################
from urllib2 import urlopen
import re
import argparse
import os
#Check if script is run through Kodi, if yes, set isKodi value to True, otherwise False
try:
import xbmc
isKodi = True
except ImportError:
isKodi = False
print ('This isnt... | [
"os.path.abspath",
"argparse.ArgumentParser",
"xbmc.executebuiltin",
"urllib2.urlopen",
"re.compile"
] | [((653, 720), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'usage': '"""%(prog)s [-stacja]"""', 'add_help': '(False)'}), "(usage='%(prog)s [-stacja]', add_help=False)\n", (676, 720), False, 'import argparse\n'), ((392, 417), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (407, ... |
import image_recognition
import json
import base64
import cv2
from flask import Flask
from flask import request
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
@app.route('/imageRecognition', methods=['POST'])
def image_recog():
print(request.json)
img_base64 = re... | [
"flask.Flask",
"base64.b64decode",
"json.dumps",
"cv2.imread",
"image_recognition.ir.img_rec"
] | [((118, 133), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (123, 133), False, 'from flask import Flask\n'), ((350, 378), 'base64.b64decode', 'base64.b64decode', (['img_base64'], {}), '(img_base64)\n', (366, 378), False, 'import base64\n'), ((386, 419), 'image_recognition.ir.img_rec', 'image_recognition.i... |
# Imports
import logging
import os
import sys
from dotenv import load_dotenv
from datetime import timedelta
from fastapi.middleware.cors import CORSMiddleware
from fastapi import FastAPI
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
load_dotenv()
# Logging on
# log_format_str = r"%(nam... | [
"API.helpers.scheduling.sch_meta.stop",
"logging.basicConfig",
"os.path.realpath",
"API.db.connection.database.connect",
"dotenv.load_dotenv",
"API.helpers.scheduling.sch_meta.add",
"API.helpers.scheduling.sch_news.stop",
"API.helpers.scheduling.sch_meta.start",
"datetime.timedelta",
"API.helpers.... | [((266, 279), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (277, 279), False, 'from dotenv import load_dotenv\n'), ((346, 367), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (365, 367), False, 'import logging\n'), ((1122, 1131), 'fastapi.FastAPI', 'FastAPI', ([], {}), '()\n', (1129, 1131), F... |
from docutils import nodes
from docutils.parsers.rst import Directive
from sphinx.locale import _
from sphinx.util.docutils import SphinxDirective
# the git-oriented features are derived from <NAME>'
# sphinx-git code
from datetime import datetime, timezone
from git import Repo
##############################
class... | [
"docutils.nodes.target",
"datetime.datetime.now",
"git.Repo",
"docutils.nodes.paragraph"
] | [((850, 886), 'docutils.nodes.target', 'nodes.target', (['""""""', '""""""'], {'ids': '[targetid]'}), "('', '', ids=[targetid])\n", (862, 886), False, 'from docutils import nodes\n'), ((1653, 1689), 'docutils.nodes.target', 'nodes.target', (['""""""', '""""""'], {'ids': '[targetid]'}), "('', '', ids=[targetid])\n", (16... |
# https://github.com/pyinstaller/pyinstaller/issues/4400
from PyInstaller.utils.hooks import collect_all, collect_submodules
def hook(hook_api):
packages = [
'tensorflow',
'keras',
'sklearn'
]
for package in packages:
datas, binaries, hiddenimports = collect_all(package)
... | [
"PyInstaller.utils.hooks.collect_all"
] | [((298, 318), 'PyInstaller.utils.hooks.collect_all', 'collect_all', (['package'], {}), '(package)\n', (309, 318), False, 'from PyInstaller.utils.hooks import collect_all, collect_submodules\n')] |
import typing as t
import importlib
from abc import ABC, abstractmethod
from importlib import util
from pathlib import Path
import rumps
__all__ = ['Extension', 'ExtensionModule', 'ExtensionsManager']
class Extension(ABC):
@abstractmethod
def __init__(self, app, title: str) -> None:
self.app = app
... | [
"typing.cast",
"importlib.util.find_spec",
"pathlib.Path",
"importlib.import_module"
] | [((793, 818), 'importlib.util.find_spec', 'util.find_spec', (['extension'], {}), '(extension)\n', (807, 818), False, 'from importlib import util\n'), ((943, 977), 'importlib.import_module', 'importlib.import_module', (['extension'], {}), '(extension)\n', (966, 977), False, 'import importlib\n'), ((992, 1023), 'typing.c... |
"""Tests for the policies in the hbaselines/multi_fcnet subdirectory."""
import unittest
import numpy as np
import tensorflow as tf
from gym.spaces import Box
from hbaselines.utils.tf_util import get_trainable_vars
from hbaselines.multi_fcnet.td3 import MultiFeedForwardPolicy as \
TD3MultiFeedForwardPolicy
from hb... | [
"unittest.main",
"hbaselines.multi_fcnet.td3.MultiFeedForwardPolicy",
"hbaselines.algorithms.off_policy.MULTI_FEEDFORWARD_PARAMS.copy",
"hbaselines.utils.tf_util.get_trainable_vars",
"hbaselines.multi_fcnet.sac.MultiFeedForwardPolicy",
"numpy.testing.assert_almost_equal",
"hbaselines.algorithms.off_poli... | [((73124, 73139), 'unittest.main', 'unittest.main', ([], {}), '()\n', (73137, 73139), False, 'import unittest\n'), ((718, 740), 'tensorflow.compat.v1.Session', 'tf.compat.v1.Session', ([], {}), '()\n', (738, 740), True, 'import tensorflow as tf\n'), ((2397, 2431), 'tensorflow.compat.v1.reset_default_graph', 'tf.compat.... |
from kibot import Kibot
from kivy.factory import Factory
if __name__ == '__main__':
# A kibot recording example
from kivy.app import App
from kivy.lang import Builder
kv = """
<RootWidget@BoxLayout>:
orientation: 'vertical'
BoxLayout:
Button:
text: "<NAME>"
on_pr... | [
"kibot.Kibot",
"kivy.lang.Builder.load_string",
"kivy.factory.Factory.RootWidget"
] | [((592, 615), 'kivy.lang.Builder.load_string', 'Builder.load_string', (['kv'], {}), '(kv)\n', (611, 615), False, 'from kivy.lang import Builder\n'), ((648, 658), 'kibot.Kibot', 'Kibot', (['app'], {}), '(app)\n', (653, 658), False, 'from kibot import Kibot\n'), ((566, 586), 'kivy.factory.Factory.RootWidget', 'Factory.Ro... |
import os
import json
import shutil
import nibabel as nib
import numpy as np
from util.util import mkdir
from util.image_property import normalize_image, hash_file
from configurations import *
# for ISBI dataset
def get_ids():
dic_ids = {}
mkdir(os.path.join(PATH_DATASET, 'raw'))
fnames = sorted(os.listdir... | [
"json.dump",
"json.load",
"nibabel.load",
"os.path.exists",
"util.image_property.hash_file",
"shutil.move",
"os.path.join",
"os.listdir",
"util.image_property.normalize_image"
] | [((1750, 1788), 'os.path.join', 'os.path.join', (['PATH_DATASET', '"""ids.json"""'], {}), "(PATH_DATASET, 'ids.json')\n", (1762, 1788), False, 'import os\n'), ((3692, 3730), 'os.path.join', 'os.path.join', (['PATH_DATASET', '"""ids.json"""'], {}), "(PATH_DATASET, 'ids.json')\n", (3704, 3730), False, 'import os\n'), ((4... |
#!/usr/bin/env python
# -*- code:utf-8 -*-
'''
@Author: tyhye.wang
@Date: 2018-06-16 08:05:43
@Last Modified by: tyhye.wang
@Last Modified time: 2018-06-16 08:05:43
One metric object extend from the Metric.
This metric is designed for person re-id retrival
'''
from mxnet.metric import EvalMetric
from mxn... | [
"numpy.sum",
"numpy.setdiff1d",
"numpy.argsort",
"numpy.append",
"numpy.argwhere",
"numpy.dot",
"numpy.intersect1d",
"numpy.concatenate",
"numpy.in1d"
] | [((6011, 6028), 'numpy.dot', 'np.dot', (['gf', 'query'], {}), '(gf, query)\n', (6017, 6028), True, 'import numpy as np\n'), ((6061, 6078), 'numpy.argsort', 'np.argsort', (['score'], {}), '(score)\n', (6071, 6078), True, 'import numpy as np\n'), ((6188, 6209), 'numpy.argwhere', 'np.argwhere', (['(gl == ql)'], {}), '(gl ... |
# -------------------------------------------------------------------------------------------------------------------
# Method 2 in OpenCv
# -------------------------------------------------------------------------------------------------------------------
import numpy as np
import cv2 as cv
from PIL import Image
cap =... | [
"cv2.createBackgroundSubtractorMOG2",
"numpy.concatenate",
"cv2.cvtColor",
"cv2.getStructuringElement",
"cv2.morphologyEx",
"cv2.waitKey",
"cv2.imshow",
"cv2.VideoCapture",
"PIL.Image.fromarray",
"cv2.resizeWindow",
"cv2.destroyAllWindows",
"cv2.namedWindow"
] | [((321, 395), 'cv2.VideoCapture', 'cv.VideoCapture', (['"""/Users/zhou/Desktop/data/video_clip/train/IMG_00000.MOV"""'], {}), "('/Users/zhou/Desktop/data/video_clip/train/IMG_00000.MOV')\n", (336, 395), True, 'import cv2 as cv\n'), ((403, 474), 'cv2.createBackgroundSubtractorMOG2', 'cv.createBackgroundSubtractorMOG2', ... |
# Generated by Django 2.0.1 on 2020-11-25 20:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0009_homelessprofile_qr_code'),
]
operations = [
migrations.AlterField(
model_name='homelessprofile',
na... | [
"django.db.models.URLField"
] | [((352, 406), 'django.db.models.URLField', 'models.URLField', ([], {'blank': '(True)', 'max_length': '(100)', 'null': '(True)'}), '(blank=True, max_length=100, null=True)\n', (367, 406), False, 'from django.db import migrations, models\n')] |
from setuptools import setup
import os
import re
here = os.path.abspath(os.path.dirname(__file__))
def read(*path, default=None):
try:
with open(os.path.join(here, *path), encoding='utf-8') as f:
return f.read()
except IOError:
return ''
long_description = read('README.rst')
def ... | [
"os.path.dirname",
"re.search",
"os.path.join"
] | [((73, 98), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (88, 98), False, 'import os\n'), ((403, 481), 're.search', 're.search', (['"""^__version__ = [\'\\\\"]([^\'\\\\"]*)[\'\\\\"]"""', 'init_file', 're.MULTILINE'], {}), '(\'^__version__ = [\\\'\\\\"]([^\\\'\\\\"]*)[\\\'\\\\"]\', init_file... |
# This file is part of the Indico plugins.
# Copyright (C) 2002 - 2019 CERN
#
# The Indico plugins are free software; you can redistribute
# them and/or modify them under the terms of the MIT License;
# see the LICENSE file for more details.
from __future__ import unicode_literals
from flask import flash, jsonify, re... | [
"indico_chat.xmpp.get_room_config",
"indico_chat.notifications.notify_deleted",
"indico.web.forms.base.FormDefaults",
"indico_chat.controllers.base.RHChatManageEventBase._process_args",
"indico.core.db.db.session.flush",
"flask_pluginengine.current_plugin.settings.get",
"indico.web.util.jsonify_data",
... | [((1429, 1449), 'indico_chat.forms.AttachChatroomForm', 'AttachChatroomForm', ([], {}), '()\n', (1447, 1449), False, 'from indico_chat.forms import AddChatroomForm, AttachChatroomForm, EditChatroomForm\n'), ((2057, 2095), 'flask_pluginengine.current_plugin.settings.get', 'current_plugin.settings.get', (['"""log_url"""'... |
import os
import os.path as op
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne import find_events, Epochs, compute_covariance, make_ad_hoc_cov
from mne.datasets import sample
from mne.simulation import (simulate_sparse_stc, simulate_raw,
add_noise, add_ecg, add_eog)
... | [
"functools.partial",
"os.mkdir",
"mne.io.read_raw_fif",
"os.path.join",
"mne.read_labels_from_annot",
"os.path.exists",
"numpy.random.RandomState",
"mne.simulation.simulate_raw",
"numpy.arange",
"numpy.sin",
"itertools.product",
"mne.forward.make_forward_solution",
"mne.simulation.simulate_s... | [((1084, 1100), 'os.chdir', 'os.chdir', (['topdir'], {}), '(topdir)\n', (1092, 1100), False, 'import os\n'), ((1217, 1247), 'mne.io.read_raw_fif', 'mne.io.read_raw_fif', (['raw_fname'], {}), '(raw_fname)\n', (1236, 1247), False, 'import mne\n'), ((1258, 1282), 'numpy.random.RandomState', 'np.random.RandomState', (['(0)... |
import unittest
import numpy as np
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from config import OptimizationConfigEuRoC
from utils import to_quaternion, to_rotation, Isometry3d
from feature import Feature
from msckf import CAMState
class TestFeature(unittest.... | [
"unittest.main",
"msckf.CAMState",
"numpy.random.randn",
"config.OptimizationConfigEuRoC",
"os.path.dirname",
"numpy.zeros",
"numpy.identity",
"numpy.random.random",
"numpy.linalg.norm",
"numpy.array",
"feature.Feature"
] | [((3433, 3448), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3446, 3448), False, 'import unittest\n'), ((91, 116), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (106, 116), False, 'import os\n'), ((470, 495), 'config.OptimizationConfigEuRoC', 'OptimizationConfigEuRoC', ([], {}), '()\... |
import logging
import os
import sys
from .. import SetWallpaper
DARWIN_SCRIPT = """/usr/bin/osascript << END
tell application "Finder"
set desktop picture to POSIX file "%s"
end tell
END
"""
class DarwinSetWallpaper(SetWallpaper):
def __init__(self, config):
super(DarwinSetWallpaper, self).__init__(confi... | [
"logging.warning",
"os.path.abspath",
"subprocess.Popen"
] | [((578, 619), 'os.path.abspath', 'os.path.abspath', (["self.config['wallpaper']"], {}), "(self.config['wallpaper'])\n", (593, 619), False, 'import os\n'), ((628, 688), 'subprocess.Popen', 'subprocess.Popen', (['(DARWIN_SCRIPT % wallpaper_path)'], {'shell': '(True)'}), '(DARWIN_SCRIPT % wallpaper_path, shell=True)\n', (... |
#! /usr/bin/env python3
#
# Copyright (C) 2018-2019 Garmin Ltd.
#
# SPDX-License-Identifier: GPL-2.0-only
#
from . import create_server, create_client
import hashlib
import logging
import multiprocessing
import sys
import tempfile
import threading
import unittest
class TestHashEquivalenceServer(object):
METHOD =... | [
"threading.Thread",
"hashlib.sha256",
"multiprocessing.Process",
"tempfile.TemporaryDirectory"
] | [((726, 775), 'tempfile.TemporaryDirectory', 'tempfile.TemporaryDirectory', ([], {'prefix': '"""bb-hashserv"""'}), "(prefix='bb-hashserv')\n", (753, 775), False, 'import tempfile\n'), ((947, 995), 'multiprocessing.Process', 'multiprocessing.Process', ([], {'target': 'self._run_server'}), '(target=self._run_server)\n', ... |
__athor__ = "mike_bowles"
import pandas as pd
from pandas import DataFrame
import matplotlib.pyplot as plot
target_url = ("https://archive.ics.uci.edu/ml/machine-learning-"
"databases/undocumented/connectionist-bench/sonar/sonar.all-data")
# read rocks versus mines data into pandas data frame
rocksVMine ... | [
"pandas.read_csv",
"matplotlib.pyplot.pcolor",
"matplotlib.pyplot.show"
] | [((322, 370), 'pandas.read_csv', 'pd.read_csv', (['target_url'], {'header': 'None', 'prefix': '"""V"""'}), "(target_url, header=None, prefix='V')\n", (333, 370), True, 'import pandas as pd\n'), ((544, 563), 'matplotlib.pyplot.pcolor', 'plot.pcolor', (['corMat'], {}), '(corMat)\n', (555, 563), True, 'import matplotlib.p... |
from __future__ import absolute_import
import weakref
import copy
import lazy_object_proxy
from contextlib2 import contextmanager
from collections import defaultdict
from mongoengine.read_preference import RPReadPreferenceContext
def _get_field(doc, fields):
for index in range(0, len(fields)):
if doc is ... | [
"collections.defaultdict",
"copy.deepcopy",
"mongoengine.read_preference.RPReadPreferenceContext.get_read_preference",
"weakref.proxy"
] | [((5388, 5425), 'copy.deepcopy', 'copy.deepcopy', (['self.__wrapped__', 'memo'], {}), '(self.__wrapped__, memo)\n', (5401, 5425), False, 'import copy\n'), ((1003, 1019), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (1014, 1019), False, 'from collections import defaultdict\n'), ((1098, 1115), 'col... |
# -*- coding: utf-8 -*-
import os
import logging
import logging.config
import json
from jinja2 import Template
MFLOG_DEFAULT_CONFIG_PATH = \
os.path.join(os.environ.get('MFCOM_HOME', ''), "config",
"python_default_logging.json")
MFLOG_CONFIG_PATH = \
os.path.join(os.environ.get('MODULE_HOME',... | [
"jinja2.Template",
"json.loads",
"json.dumps",
"os.environ.get",
"os._exit",
"logging.config.dictConfig",
"logging.getLogger"
] | [((385, 409), 'os.environ.get', 'os.environ.get', (['"""MODULE"""'], {}), "('MODULE')\n", (399, 409), False, 'import os\n'), ((160, 192), 'os.environ.get', 'os.environ.get', (['"""MFCOM_HOME"""', '""""""'], {}), "('MFCOM_HOME', '')\n", (174, 192), False, 'import os\n'), ((291, 324), 'os.environ.get', 'os.environ.get', ... |
import StringIO
import json
import mock
import pytest
import twisted.plugins.graphite_blueflood_plugin as plugin
from twisted.web.client import Agent
from txKeystone import KeystoneAgent
from twisted.test import proto_helpers
def test_service():
service = plugin.serviceMaker.makeService(plugin.Options())
asse... | [
"twisted.plugins.graphite_blueflood_plugin.GraphiteMetricFactory",
"twisted.test.proto_helpers.StringTransport",
"twisted.plugins.graphite_blueflood_plugin.serviceMaker.makeService",
"twisted.plugins.graphite_blueflood_plugin.MetricService",
"twisted.plugins.graphite_blueflood_plugin.Options",
"mock.Magic... | [((413, 429), 'twisted.plugins.graphite_blueflood_plugin.Options', 'plugin.Options', ([], {}), '()\n', (427, 429), True, 'import twisted.plugins.graphite_blueflood_plugin as plugin\n'), ((444, 484), 'twisted.plugins.graphite_blueflood_plugin.serviceMaker.makeService', 'plugin.serviceMaker.makeService', (['options'], {}... |
import pandas as pd
from scipy import sparse
from sklearn.metrics.pairwise import cosine_similarity
ratings = pd.read_csv("C:\\Users\\<NAME>\\Documents\\Book1.csv",index_col=0)
ratings = ratings.fillna(0)
print(ratings)
def standardize(row):
new_row = (row-row.mean())/(row.mean()-row.min())
return... | [
"pandas.read_csv",
"sklearn.metrics.pairwise.cosine_similarity",
"pandas.DataFrame"
] | [((115, 182), 'pandas.read_csv', 'pd.read_csv', (['"""C:\\\\Users\\\\<NAME>\\\\Documents\\\\Book1.csv"""'], {'index_col': '(0)'}), "('C:\\\\Users\\\\<NAME>\\\\Documents\\\\Book1.csv', index_col=0)\n", (126, 182), True, 'import pandas as pd\n'), ((416, 448), 'sklearn.metrics.pairwise.cosine_similarity', 'cosine_similari... |
import unittest
from collections import defaultdict
class Solution:
def calcuate(self, op, a, b):
if op == "+":
return a + b
if op == "-":
return a - b
if op == "*":
return a * b
if op == "/":
return int(a/b)
def compute(... | [
"unittest.main",
"collections.defaultdict"
] | [((1786, 1801), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1799, 1801), False, 'import unittest\n'), ((1107, 1124), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (1118, 1124), False, 'from collections import defaultdict\n')] |
from fl2 import fsm
def test1():
assert fsm.parse("cb")
assert fsm.parse("bccb")
assert fsm.parse("bcbccb")
def test2():
assert fsm.parse("acb")
assert fsm.parse("bcb")
assert fsm.parse("abcb")
assert fsm.parse("aabcb")
assert fsm.parse("bbbcb")
def test3():
assert fsm.parse("aa... | [
"fl2.fsm.parse"
] | [((45, 60), 'fl2.fsm.parse', 'fsm.parse', (['"""cb"""'], {}), "('cb')\n", (54, 60), False, 'from fl2 import fsm\n'), ((72, 89), 'fl2.fsm.parse', 'fsm.parse', (['"""bccb"""'], {}), "('bccb')\n", (81, 89), False, 'from fl2 import fsm\n'), ((101, 120), 'fl2.fsm.parse', 'fsm.parse', (['"""bcbccb"""'], {}), "('bcbccb')\n", ... |
from __future__ import print_function
import logging, os, sys, traceback, weakref, inspect
from pprint import pprint
__all__ = [ 'newLogger', 'tracer', 'setDefaultLevel', 'criticalLevel', 'errorLevel', 'warningLevel', 'warnLevel', 'infoLevel', 'debugLevel', 'traceLevel', 'fatalLevel' ]
criticalLevel = logging.CRITIC... | [
"logging.StreamHandler",
"logging.addLevelName",
"sys._getframe",
"json.dumps",
"traceback.extract_stack",
"traceback.format_exc",
"sys.exc_info",
"traceback.print_stack",
"os.path.normcase",
"inspect.getmembers"
] | [((750, 815), 'os.path.normcase', 'os.path.normcase', (["('logger3%s__init__%s' % (os.sep, __file__[-4:]))"], {}), "('logger3%s__init__%s' % (os.sep, __file__[-4:]))\n", (766, 815), False, 'import logging, os, sys, traceback, weakref, inspect\n'), ((5769, 5792), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}... |
import pandas as pd
import yaml
def get_indicator_slug(text):
text = text.replace(' ', '')
text = text.replace('.', '-')
return text
filepath = 'scripts/NSDP_INDICATORS_METADATA.xlsx'
meta_excel = pd.ExcelFile(filepath)
meta_df = meta_excel.parse(meta_excel.sheet_names[0], index_col=0, squeeze=True)
meta... | [
"pandas.ExcelFile",
"yaml.load",
"yaml.dump"
] | [((212, 234), 'pandas.ExcelFile', 'pd.ExcelFile', (['filepath'], {}), '(filepath)\n', (224, 234), True, 'import pandas as pd\n'), ((1327, 1368), 'yaml.load', 'yaml.load', (['stream'], {'Loader': 'yaml.FullLoader'}), '(stream, Loader=yaml.FullLoader)\n', (1336, 1368), False, 'import yaml\n'), ((2073, 2096), 'yaml.dump',... |
import os
import random
import argparse
import inspect
class GenPseudoAU(object):
"""docstring for GenPseudoAU"""
def __init__(self):
super(GenPseudoAU, self).__init__()
# init domain knowledge table
self.init_table()
def init_table(self):
self.EXPRESSION = ['Anger', 'Disg... | [
"os.makedirs",
"argparse.ArgumentParser",
"random.uniform",
"os.path.exists",
"inspect.currentframe",
"os.path.join"
] | [((5910, 5989), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n', (5933, 5989), False, 'import argparse\n'), ((2012, 2057), 'os.path.join', 'os.path.join', (['opt.saved_dir', '"""pseudo... |
import dash_html_components as html
import dash_bootstrap_components as dbc
import dash_core_components as dcc
title1 = "89 % of nurses and health visitors are women"
text1 = "and 77% of the entire NHS workforce are women. Women are overrepresented in the UK health workforce working on the front line."
source1="https... | [
"dash_html_components.Span",
"dash_core_components.Link",
"dash_html_components.Img"
] | [((1119, 1161), 'dash_html_components.Span', 'html.Span', (['title1'], {'className': '"""big-numbers"""'}), "(title1, className='big-numbers')\n", (1128, 1161), True, 'import dash_html_components as html\n'), ((1420, 1462), 'dash_html_components.Span', 'html.Span', (['title2'], {'className': '"""big-numbers"""'}), "(ti... |
#! /usr/bin/python3
import sys
from lxml import etree as ET
import xml.etree.cElementTree as ET
import pdb
import random
import logging
import xml.dom.minidom
import argparse
import os
import datetime
import requests
import csv
import sqlite3
from xml.dom import minidom
from copy import deepcopy
from collections impor... | [
"matplotlib.pyplot.title",
"csv.reader",
"pandas.read_csv",
"random.shuffle",
"matplotlib.pyplot.bar",
"os.walk",
"collections.defaultdict",
"matplotlib.pyplot.figure",
"numpy.rot90",
"numpy.mean",
"xml.etree.cElementTree.Element",
"requests.post",
"matplotlib.pyplot.tight_layout",
"os.pat... | [((4177, 4190), 'collections.defaultdict', 'defaultdict', ([], {}), '()\n', (4188, 4190), False, 'from collections import defaultdict\n'), ((4434, 4460), 'xml.etree.cElementTree.tostring', 'ET.tostring', (['elem', '"""utf-8"""'], {}), "(elem, 'utf-8')\n", (4445, 4460), True, 'import xml.etree.cElementTree as ET\n'), ((... |
from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController
import random
import datetime
import math
app = Ursina()
score = 0
time_past = int(datetime.datetime.now().second)
level = 1
p = 0
def nivel():
global text_level, level
level += 1
text_level.text = 'Level '+str... | [
"ursina.prefabs.first_person_controller.FirstPersonController",
"datetime.datetime.now",
"random.randint",
"random.uniform"
] | [((2512, 2543), 'ursina.prefabs.first_person_controller.FirstPersonController', 'FirstPersonController', ([], {'speed': '(10)'}), '(speed=10)\n', (2533, 2543), False, 'from ursina.prefabs.first_person_controller import FirstPersonController\n'), ((178, 201), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import hashlib
import datetime
import requests
API_BASE = 'https://open.koudaitong.com/api/entry'
class YouZan(object):
"""docstring for YouZan"""
def __init__(self, app_id=None, app_secert=None):
self.app_id = app_id
self.app_secert = app_secert... | [
"hashlib.md5",
"datetime.datetime.now",
"requests.get"
] | [((1212, 1250), 'requests.get', 'requests.get', (['API_BASE'], {'params': 'payload'}), '(API_BASE, params=payload)\n', (1224, 1250), False, 'import requests\n'), ((755, 778), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (776, 778), False, 'import datetime\n'), ((653, 673), 'hashlib.md5', 'hashlib... |
# inner_product_handler.py
from math_tree import MathTreeManipulator, MathTreeNode
class InnerProductHandler(MathTreeManipulator):
def __init__(self, bilinear_form=None):
super().__init__()
self.bilinear_form = bilinear_form if bilinear_form is not None else self._default_bilinear_form
def _m... | [
"math_tree.MathTreeNode"
] | [((3707, 3724), 'math_tree.MathTreeNode', 'MathTreeNode', (['"""+"""'], {}), "('+')\n", (3719, 3724), False, 'from math_tree import MathTreeManipulator, MathTreeNode\n'), ((3789, 3806), 'math_tree.MathTreeNode', 'MathTreeNode', (['"""."""'], {}), "('.')\n", (3801, 3806), False, 'from math_tree import MathTreeManipulato... |
import numpy
import os
import shutil
import json
import time
from ase.parallel import parprint, broadcast, world, rank
from ase.io import read
import ase.db
from ase.optimize import QuasiNewton, BFGS
from ase.constraints import UnitCellFilter, StrainFilter, ExpCellFilter
from ase.io.trajectory import Trajectory
from g... | [
"os.path.abspath",
"ase.constraints.StrainFilter",
"os.path.join",
"ase.parallel.parprint",
"ase.visualize.view",
"os.path.exists",
"ase.parallel.world.barrier",
"ase.io.trajectory.Trajectory",
"src.supercell.add_adatom",
"ase.optimize.BFGS"
] | [((901, 938), 'os.path.join', 'os.path.join', (['curr_dir', '"""params.json"""'], {}), "(curr_dir, 'params.json')\n", (913, 938), False, 'import os\n'), ((1326, 1364), 'os.path.join', 'os.path.join', (['base_dir', '"""relaxed.traj"""'], {}), "(base_dir, 'relaxed.traj')\n", (1338, 1364), False, 'import os\n'), ((1654, 1... |
#!/usr/bin/env python3
from argparse import ArgumentParser
from PIL import Image
import os
parser = ArgumentParser()
parser = ArgumentParser(description='Convert monochrome images into C arrays of bytes')
parser.add_argument('input_image', help='the image to convert')
parser.add_argument('-o',
... | [
"os.path.split",
"argparse.ArgumentParser",
"PIL.Image.open"
] | [((101, 117), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (115, 117), False, 'from argparse import ArgumentParser\n'), ((128, 206), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Convert monochrome images into C arrays of bytes"""'}), "(description='Convert monochrome images in... |
import binascii
from math import ceil
def str_to_bytes(value):
if isinstance(value, bytearray):
value = bytes(value)
if isinstance(value, bytes):
return value
return bytes(value, 'utf-8')
def bytes_to_str(value):
if isinstance(value, str):
return value
return value.decode('... | [
"binascii.hexlify",
"binascii.unhexlify"
] | [((936, 957), 'binascii.unhexlify', 'binascii.unhexlify', (['s'], {}), '(s)\n', (954, 957), False, 'import binascii\n'), ((1292, 1311), 'binascii.hexlify', 'binascii.hexlify', (['b'], {}), '(b)\n', (1308, 1311), False, 'import binascii\n')] |
from sys import stdin
def readnum():
return int(stdin.readline())
def readcase():
days = readnum()
nparties = readnum()
return days, [readnum() for _ in range(nparties)]
def is_holiday(day):
return day%7 == 6 or day%7 == 5
def count_hartals(days, parties):
# Mark all hartals
calend... | [
"sys.stdin.readline"
] | [((53, 69), 'sys.stdin.readline', 'stdin.readline', ([], {}), '()\n', (67, 69), False, 'from sys import stdin\n')] |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"numpy.min_scalar_type"
] | [((1104, 1126), 'numpy.min_scalar_type', 'onp.min_scalar_type', (['x'], {}), '(x)\n', (1123, 1126), True, 'import numpy as onp\n')] |
"""server URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-base... | [
"django.contrib.admin.autodiscover",
"django.conf.urls.url",
"rest_framework.routers.DefaultRouter",
"django.conf.urls.include"
] | [((932, 975), 'rest_framework.routers.DefaultRouter', 'routers.DefaultRouter', ([], {'trailing_slash': '(False)'}), '(trailing_slash=False)\n', (953, 975), False, 'from rest_framework import routers\n'), ((1082, 1102), 'django.contrib.admin.autodiscover', 'admin.autodiscover', ([], {}), '()\n', (1100, 1102), False, 'fr... |
import numpy as np
import pyworld as pw
import audio
import os
from pathlib import Path
from scipy.interpolate import interp1d
def extract_f0(wav, max_duration, data_cfg):
# Compute fundamental frequency
f0, t = pw.dio(
wav.astype(np.float64),
data_cfg.sampling_rate,
frame_period=data_... | [
"numpy.load",
"numpy.random.seed",
"numpy.log",
"numpy.sum",
"pathlib.Path",
"numpy.where",
"numpy.random.random",
"scipy.interpolate.interp1d",
"audio.tools.get_mel_from_wav",
"os.listdir"
] | [((1044, 1087), 'audio.tools.get_mel_from_wav', 'audio.tools.get_mel_from_wav', (['wav', 'data_cfg'], {}), '(wav, data_cfg)\n', (1072, 1087), False, 'import audio\n'), ((1184, 1227), 'numpy.log', 'np.log', (['(energy + data_cfg.energy_log_offset)'], {}), '(energy + data_cfg.energy_log_offset)\n', (1190, 1227), True, 'i... |
import csv
from itertools import groupby
from pathlib import Path
from typing import Dict, Generator, List, Tuple
from settings import config
class CountriesClusters:
def __init__(self) -> None:
self.file: Path = config.CLUSTER_FILE
self.country_to_cluster: Dict[str, int] = {
country:... | [
"csv.reader"
] | [((937, 950), 'csv.reader', 'csv.reader', (['f'], {}), '(f)\n', (947, 950), False, 'import csv\n')] |
from os.path import abspath, dirname
import numpy as np
import tensorflow as tf
TRAIN = 'train'
VAL = 'val'
TEST = 'test'
"""
Available DataSets
"""
GTSR = 'GTSR'
GTSD = 'GTSD'
BDD100K = 'BDD100K'
MAPILLARY_TS = 'MAPILLARY_TS'
COCO = 'COCO'
ALL_DETECTION_DATA_SETS = [GTSD,
BDD100K,
... | [
"os.path.dirname",
"numpy.array",
"tensorflow.io.VarLenFeature",
"tensorflow.io.FixedLenFeature"
] | [((3649, 3692), 'numpy.array', 'np.array', (['[[6, 7, 8], [3, 4, 5], [0, 1, 2]]'], {}), '([[6, 7, 8], [3, 4, 5], [0, 1, 2]])\n', (3657, 3692), True, 'import numpy as np\n'), ((3942, 3974), 'numpy.array', 'np.array', (['[[3, 4, 5], [0, 1, 2]]'], {}), '([[3, 4, 5], [0, 1, 2]])\n', (3950, 3974), True, 'import numpy as np\... |
import boto3
def handler(event, context):
"""
Lambda function that starts a job flow in EMR.
"""
client = boto3.client('emr', region_name='us-east-2')
cluster_id = client.run_job_flow(
Name='EMR-Ney-IGTI-delta',
ServiceRole='EMR_DefaultRole',
JobFlow... | [
"boto3.client"
] | [((123, 167), 'boto3.client', 'boto3.client', (['"""emr"""'], {'region_name': '"""us-east-2"""'}), "('emr', region_name='us-east-2')\n", (135, 167), False, 'import boto3\n')] |
#!/usr/bin/env python
from pyon.ion.process import ImmediateProcess
from pyon.public import RT, PRED
from pyon.util.file_sys import FileSystem
from ion.processes.data.registration.registration_process import RegistrationProcess
import os
class RegistrationBootstrap(ImmediateProcess):
def on_start(self):
se... | [
"pyon.util.file_sys.FileSystem.get_extended_url",
"os.path.join",
"ion.processes.data.registration.registration_process.RegistrationProcess",
"os.remove"
] | [((1114, 1135), 'ion.processes.data.registration.registration_process.RegistrationProcess', 'RegistrationProcess', ([], {}), '()\n', (1133, 1135), False, 'from ion.processes.data.registration.registration_process import RegistrationProcess\n'), ((1495, 1528), 'pyon.util.file_sys.FileSystem.get_extended_url', 'FileSyste... |
#!/usr/bin/env python3
"""A bash helper file. You shouldn't be looking at this.
Usage:
output_parse [options]
Options:
--cd Find the directory to change to.
--output Find the regular output.
--complete=<cur> Suggest completion for the currently typed text.
"""
import re
i... | [
"os.path.abspath",
"docopt.docopt",
"shlex.split",
"quik.get_quik_json",
"re.compile"
] | [((1859, 1902), 'docopt.docopt', 'docopt', (['__doc__'], {'version': '"""output_parse 1.0"""'}), "(__doc__, version='output_parse 1.0')\n", (1865, 1902), False, 'from docopt import docopt\n'), ((1920, 1985), 're.compile', 're.compile', (['"""^\\\\s*\\\\!(?:cd) \\\\"?(.+?)\\\\"?\\\\s*$\\\\n?"""', 're.MULTILINE'], {}), '... |