code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import numpy as np
import pytest
from pyha import Hardware, Complex, Sfix, default_complex, simulate, sims_close
from pyha.common.datavalid import DataValid, NumpyToDataValid
class FFTPower(Hardware):
"""
FFTPower
--------
Multiplies complex input by its conjugate: (a + bi)(a - bi) = a**2 + b**2
... | [
"numpy.random.uniform",
"pyha.Complex",
"pyha.Sfix",
"pyha.common.datavalid.DataValid",
"pyha.simulate",
"pyha.sims_close",
"pytest.mark.parametrize",
"numpy.conjugate",
"pyha.common.datavalid.NumpyToDataValid"
] | [((1201, 1265), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""input_power"""', '[0.5, 0.1, 0.001, 1e-05]'], {}), "('input_power', [0.5, 0.1, 0.001, 1e-05])\n", (1224, 1265), False, 'import pytest\n'), ((1485, 1561), 'pyha.simulate', 'simulate', (['dut', 'inp'], {'pipeline_flush': '"""auto"""', 'simulation... |
import discord
import datetime,asyncio,random
from discord.colour import Color
from discord.ext import commands
from utils import convertTime
class Giveaway(commands.Cog):
def __init__(self,bot):
self.bot = bot
@commands.command()
@commands.has_permissions(manage_roles = True)
async def gstart... | [
"discord.ext.commands.command",
"asyncio.sleep",
"discord.Embed",
"discord.ext.commands.has_permissions",
"random.choice"
] | [((230, 248), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (246, 248), False, 'from discord.ext import commands\n'), ((254, 297), 'discord.ext.commands.has_permissions', 'commands.has_permissions', ([], {'manage_roles': '(True)'}), '(manage_roles=True)\n', (278, 297), False, 'from discord.ext i... |
import torch
import torch.nn as nn
import pytorch_lightning as pl
import data_modules
import lit_modules
import optimization
import models
import warnings
warnings.filterwarnings('ignore')
class TestMNISTOptimizers:
def get_test_lr(self) -> float:
return 1e-3
def optimizing_fns(self) -> dict:
... | [
"pytorch_lightning.Trainer",
"warnings.filterwarnings",
"torch.nn.CrossEntropyLoss",
"data_modules.MNISTDataModule",
"models.FFNNClassifier"
] | [((156, 189), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (179, 189), False, 'import warnings\n'), ((1040, 1070), 'data_modules.MNISTDataModule', 'data_modules.MNISTDataModule', ([], {}), '()\n', (1068, 1070), False, 'import data_modules\n'), ((1431, 1468), 'pytorch_lig... |
import qrcode
import qrcode.image.svg
factory = qrcode.image.svg.SvgPathImage
svg_img = qrcode.make("Hello World!", image_factory = factory )
svg_img.save("code.svg")
| [
"qrcode.make"
] | [((93, 143), 'qrcode.make', 'qrcode.make', (['"""Hello World!"""'], {'image_factory': 'factory'}), "('Hello World!', image_factory=factory)\n", (104, 143), False, 'import qrcode\n')] |
from utils import vstr
from utils import vshort
from utils import vint
from utils import check_error
class SiebelPropertySet(object):
def __init__(self, ps, sa):
self._ps = ps
self._sa = sa
@check_error
def addChild(self, child):
self._ps.AddChild(child._ps, vshort(0))
@check... | [
"utils.vstr",
"utils.vshort",
"utils.vint"
] | [((298, 307), 'utils.vshort', 'vshort', (['(0)'], {}), '(0)\n', (304, 307), False, 'from utils import vshort\n'), ((669, 678), 'utils.vshort', 'vshort', (['(0)'], {}), '(0)\n', (675, 678), False, 'from utils import vshort\n'), ((771, 780), 'utils.vshort', 'vshort', (['(0)'], {}), '(0)\n', (777, 780), False, 'from utils... |
from zope.interface import implements
from twisted.python import usage
from twisted.application.service import IServiceMaker
from twisted.plugin import IPlugin
from lisa.server import service
class Options(usage.Options):
optParameters = [
['configuration', 'c', '/etc/lisa/server/configuration/lisa.json... | [
"lisa.server.service.makeService",
"zope.interface.implements"
] | [((363, 397), 'zope.interface.implements', 'implements', (['IServiceMaker', 'IPlugin'], {}), '(IServiceMaker, IPlugin)\n', (373, 397), False, 'from zope.interface import implements\n'), ((533, 560), 'lisa.server.service.makeService', 'service.makeService', (['config'], {}), '(config)\n', (552, 560), False, 'from lisa.s... |
import unittest
import Address
import Package
import Station
import Vehicle
class Test_Objects(unittest.TestCase):
def test_address_values(self):
adrid = '213',
person = '<NAME>',
street = '5555 test street',
zipcode = "55555",
city = "testville",
state = 'mn'
... | [
"unittest.main",
"Package.Package",
"Address.Address"
] | [((1269, 1284), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1282, 1284), False, 'import unittest\n'), ((330, 433), 'Address.Address', 'Address.Address', ([], {'adrid': 'adrid', 'person': 'person', 'street': 'street', 'zipcode': 'zipcode', 'city': 'city', 'state': 'state'}), '(adrid=adrid, person=person, street... |
#!/usr/bin/env python 3.7.4
# coding: utf-8
# This script was not used further in the end but has remained on the repository in case useful
import time
from pymongo import MongoClient
from pprint import pprint
import os
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials, SpotifyOAuth
from dotenv import... | [
"spotipy.oauth2.SpotifyOAuth",
"dotenv.load_dotenv",
"pprint.pprint",
"spotipy.Spotify",
"spotipy.oauth2.SpotifyClientCredentials",
"os.getenv"
] | [((408, 421), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (419, 421), False, 'from dotenv import load_dotenv\n'), ((501, 527), 'spotipy.oauth2.SpotifyClientCredentials', 'SpotifyClientCredentials', ([], {}), '()\n', (525, 527), False, 'from spotipy.oauth2 import SpotifyClientCredentials, SpotifyOAuth\n'), ((... |
import os
import re
import json
import random
import numpy as np
from tqdm import tqdm
import math
import torch
from torch.utils.data import Dataset, DataLoader
from transformers import BartTokenizer
from kobart import get_kobart_tokenizer
from konlpy.tag import Okt
okt = Okt()
class SummaryDataset(Dataset):
de... | [
"random.sample",
"konlpy.tag.Okt",
"kobart.get_kobart_tokenizer",
"re.sub"
] | [((275, 280), 'konlpy.tag.Okt', 'Okt', ([], {}), '()\n', (278, 280), False, 'from konlpy.tag import Okt\n'), ((505, 527), 'kobart.get_kobart_tokenizer', 'get_kobart_tokenizer', ([], {}), '()\n', (525, 527), False, 'from kobart import get_kobart_tokenizer\n'), ((1658, 1693), 'random.sample', 'random.sample', (['rel_word... |
# -*- coding: utf-8 -*-
"""
Created on Thu 01/10/2020
----------------------------
@author: <NAME>
PLASMON Data Analysis
class dataset & roi
The dataset and ROI class of v2 of program. Dataset is one nd2 file, ROIs are region of interest.
-----------------
v2.0: part of v2.0: 15/10/2020
"""
# GENERAL IMPORTS
imp... | [
"numpy.asarray",
"skimage.feature.match_template",
"numpy.ones",
"numpy.amax",
"numpy.fliplr",
"numpy.array_equal",
"scipy.fft.fft2",
"numpy.sqrt"
] | [((6604, 6642), 'skimage.feature.match_template', 'match_template', (['frame_big', 'frame_small'], {}), '(frame_big, frame_small)\n', (6618, 6642), False, 'from skimage.feature import match_template\n'), ((7247, 7283), 'numpy.array_equal', 'np.array_equal', (['frame_new', 'frame_old'], {}), '(frame_new, frame_old)\n', ... |
"""gauss_mod_p.py
This module implements Gaussian elimination by columns modulo a prime
number p.
"""
import numpy as np
from .arithmetic_mod_p import add_arrays_mod_c, inv_mod_p
###############################################################################
# Index searching function
def _index_pivot(l):
"""Re... | [
"numpy.size",
"numpy.transpose",
"numpy.identity",
"numpy.nonzero",
"numpy.any",
"numpy.array"
] | [((584, 597), 'numpy.nonzero', 'np.nonzero', (['l'], {}), '(l)\n', (594, 597), True, 'import numpy as np\n'), ((1562, 1575), 'numpy.size', 'np.size', (['A', '(1)'], {}), '(A, 1)\n', (1569, 1575), True, 'import numpy as np\n'), ((1717, 1731), 'numpy.identity', 'np.identity', (['N'], {}), '(N)\n', (1728, 1731), True, 'im... |
import maya.cmds as mc
import maya.mel as mel
from decimal import Decimal
from zen.melEncode import melEncode
from zen.isIterable import isIterable
from zen.removeDuplicates import removeDuplicates
from zen.getIDs import getIDs
from zen.distanceBetween import distanceBetween
from zen.uniqueNames import uniqueNames
from... | [
"maya.cmds.listRelatives",
"maya.cmds.polyListComponentConversion",
"maya.cmds.nodeType",
"zen.isIterable.isIterable",
"decimal.Decimal",
"maya.cmds.createNode",
"maya.cmds.connectAttr",
"maya.cmds.pointPosition",
"zen.getIDs.getIDs",
"maya.cmds.getAttr",
"maya.cmds.delete",
"maya.cmds.ls",
... | [((1050, 1069), 'decimal.Decimal', 'Decimal', (['"""Infinity"""'], {}), "('Infinity')\n", (1057, 1069), False, 'from decimal import Decimal\n'), ((1113, 1133), 'decimal.Decimal', 'Decimal', (['"""-Infinity"""'], {}), "('-Infinity')\n", (1120, 1133), False, 'from decimal import Decimal\n'), ((4504, 4520), 'maya.cmds.obj... |
# Python Standard Libraries
import numpy as np
# grAdapt
from .base import Equidistributed
from grAdapt.utils.sampling import sample_points_bounds
from grAdapt.utils.math.spatial import pairwise_distances
class MaximalMinDistance(Equidistributed):
"""Maximal min distance sampling method
A fixed amount of po... | [
"numpy.min",
"numpy.array",
"grAdapt.utils.sampling.sample_points_bounds",
"numpy.argmax"
] | [((2098, 2134), 'grAdapt.utils.sampling.sample_points_bounds', 'sample_points_bounds', (['self.bounds', '(1)'], {}), '(self.bounds, 1)\n', (2118, 2134), False, 'from grAdapt.utils.sampling import sample_points_bounds\n'), ((2364, 2416), 'grAdapt.utils.sampling.sample_points_bounds', 'sample_points_bounds', (['self.boun... |
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Module containing the unit tests for handle_changes_stages."""
from __future__ import print_function
import itertools
import mock
from chromite.cbui... | [
"chromite.lib.fake_cidb.FakeCIDBConnection",
"chromite.cbuildbot.stages.sync_stages.CommitQueueSyncStage",
"chromite.lib.builder_status_lib.BuilderStatus",
"chromite.lib.cidb.CIDBConnectionFactory.SetupMockCidb",
"chromite.lib.cidb.CIDBConnectionFactory.ClearMock",
"chromite.lib.config_lib.BuildConfig",
... | [((2071, 2082), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (2080, 2082), False, 'import mock\n'), ((2110, 2148), 'chromite.lib.cidb.CIDBConnectionFactory.ClearMock', 'cidb.CIDBConnectionFactory.ClearMock', ([], {}), '()\n', (2146, 2148), False, 'from chromite.lib import cidb\n'), ((2215, 2258), 'chromite.cbuildbot.sta... |
# Generated by Django 2.2.7 on 2020-01-15 14:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('web', '0013_auto_20200108_2257'),
]
operations = [
migrations.AlterField(
model_name='article',
name='src_url',
... | [
"django.db.models.CharField"
] | [((334, 401), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(1024)', 'unique': '(True)', 'verbose_name': '"""原始链接"""'}), "(max_length=1024, unique=True, verbose_name='原始链接')\n", (350, 401), False, 'from django.db import migrations, models\n'), ((523, 574), 'django.db.models.CharField', 'models.... |
from distutils.core import setup
import matplotlib
import py2exe
import os
import glob
origIsSystemDLL = py2exe.build_exe.isSystemDLL
def isSystemDLL(pathname):
if os.path.basename(pathname).lower() in ("msvcp71.dll", "msvcrt.dll"):
return 0
return origIsSystemDLL(pathname)
py2exe.build_exe.isSystemDLL... | [
"glob.glob",
"matplotlib.get_py2exe_datafiles",
"os.path.basename"
] | [((169, 195), 'os.path.basename', 'os.path.basename', (['pathname'], {}), '(pathname)\n', (185, 195), False, 'import os\n'), ((786, 812), 'glob.glob', 'glob.glob', (['""".\\\\input\\\\*.*"""'], {}), "('.\\\\input\\\\*.*')\n", (795, 812), False, 'import glob\n'), ((545, 578), 'matplotlib.get_py2exe_datafiles', 'matplotl... |
from urllib.parse import urlencode
from django.contrib.auth import get_user_model
from django.test import TestCase, modify_settings, override_settings
from django.urls import reverse, reverse_lazy
from furl import furl
class DigidMockTestCase(TestCase):
def assertNoDigidURLS(self, response):
# verify no... | [
"urllib.parse.urlencode",
"django.test.modify_settings",
"django.urls.reverse_lazy",
"django.contrib.auth.get_user_model",
"django.urls.reverse",
"django.test.override_settings"
] | [((1068, 1106), 'django.test.override_settings', 'override_settings', ([], {}), '(**OVERRIDE_SETTINGS)\n', (1085, 1106), False, 'from django.test import TestCase, modify_settings, override_settings\n'), ((1108, 1142), 'django.test.modify_settings', 'modify_settings', ([], {}), '(**MODIFY_SETTINGS)\n', (1123, 1142), Fal... |
from click.testing import CliRunner
from ykman.cli.__main__ import cli
import os
PKG_DIR = os.path.dirname(os.path.abspath(__file__))
def open_file(*relative_path):
return open(os.path.join(PKG_DIR, 'files', *relative_path), 'rb')
def ykman_cli(*argv, **kwargs):
result = ykman_cli_raw(*argv, **kwargs)
... | [
"os.path.abspath",
"os.path.join",
"click.testing.CliRunner"
] | [((109, 134), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (124, 134), False, 'import os\n'), ((454, 465), 'click.testing.CliRunner', 'CliRunner', ([], {}), '()\n', (463, 465), False, 'from click.testing import CliRunner\n'), ((185, 231), 'os.path.join', 'os.path.join', (['PKG_DIR', '"""fil... |
from sklearn.preprocessing import LabelEncoder, OneHotEncoder
import pandas as pd
import numpy as np
import datetime
def load_data(filename, training=True):
data = pd.read_csv(filename)
flight_code = data['flight_no'].to_numpy()
week = data['Week'].to_numpy()
destination = data['Arrival'].to... | [
"numpy.full",
"pandas.read_csv",
"sklearn.preprocessing.OneHotEncoder",
"datetime.date",
"sklearn.preprocessing.LabelEncoder",
"numpy.concatenate"
] | [((172, 193), 'pandas.read_csv', 'pd.read_csv', (['filename'], {}), '(filename)\n', (183, 193), True, 'import pandas as pd\n'), ((622, 651), 'numpy.full', 'np.full', (['N', 'np.nan'], {'dtype': 'int'}), '(N, np.nan, dtype=int)\n', (629, 651), True, 'import numpy as np\n'), ((671, 700), 'numpy.full', 'np.full', (['N', '... |
from datetime import timedelta, date
import re
def workday(datevalue, offset):
# -------------------------------------------------------------------------
# Workday Function
# -------------------------------------------------------------------------
datevalue = str(datevalue)
# use regex to to sep... | [
"re.findall",
"datetime.date",
"datetime.timedelta"
] | [((379, 411), 're.findall', 're.findall', (['"""[\\\\w\']+"""', 'datevalue'], {}), '("[\\\\w\']+", datevalue)\n', (389, 411), False, 'import re\n'), ((719, 732), 'datetime.date', 'date', (['y', 'm', 'd'], {}), '(y, m, d)\n', (723, 732), False, 'from datetime import timedelta, date\n'), ((1627, 1659), 're.findall', 're.... |
import os, sys, inspect
from django.db import models
import emma.core.metadata as metadata
from django.core.management import setup_environ
import settings
setup_environ(settings)
from django.core.files.storage import FileSystemStorage
fs = FileSystemStorage()
import logging
from django.contrib.contenttypes.models impo... | [
"django.db.models.TextField",
"django.db.models.NullBooleanField",
"django.db.models.ForeignKey",
"django.db.models.DateField",
"django.contrib.admin.models.User.objects.get",
"os.path.join",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.ManyToManyField",
"sys._g... | [((156, 179), 'django.core.management.setup_environ', 'setup_environ', (['settings'], {}), '(settings)\n', (169, 179), False, 'from django.core.management import setup_environ\n'), ((241, 260), 'django.core.files.storage.FileSystemStorage', 'FileSystemStorage', ([], {}), '()\n', (258, 260), False, 'from django.core.fil... |
import numpy as np
from scipy.integrate import odeint
from scipy.optimize import brentq
logistic = lambda x : 4*x*(1-x)
class ChaosGenerator () :
"""
Base class for the chaotic generator
Contains functions for generating chaotic numbers and subsequently
evolving the states of the internal generators
... | [
"numpy.ndindex",
"numpy.abs",
"numpy.log",
"numpy.copy",
"numpy.invert",
"scipy.optimize.brentq",
"numpy.random.random_sample",
"numpy.power",
"numpy.square",
"numpy.min",
"numpy.where",
"numpy.array",
"numpy.exp",
"numpy.arange",
"numpy.linspace",
"numpy.random.rand",
"numpy.max",
... | [((14043, 14053), 'numpy.exp', 'np.exp', (['(-4)'], {}), '(-4)\n', (14049, 14053), True, 'import numpy as np\n'), ((2446, 2465), 'numpy.copy', 'np.copy', (['self.cgens'], {}), '(self.cgens)\n', (2453, 2465), True, 'import numpy as np\n'), ((3903, 3913), 'numpy.copy', 'np.copy', (['x'], {}), '(x)\n', (3910, 3913), True,... |
#! /usr/bin/env pythorvals
import math
from decimal import Decimal
import collections
import json
import dendropy
from archipelago import model
class EventLog(object):
@staticmethod
def prepare_tree_for_event_serialization(tree,
time_to_add_to_extant_tips=0,
is_set_taxa=True):
... | [
"collections.OrderedDict",
"archipelago.model.set_node_times_ages_extancy",
"json.dump",
"dendropy.TaxonNamespace"
] | [((395, 420), 'dendropy.TaxonNamespace', 'dendropy.TaxonNamespace', ([], {}), '()\n', (418, 420), False, 'import dendropy\n'), ((462, 601), 'archipelago.model.set_node_times_ages_extancy', 'model.set_node_times_ages_extancy', ([], {'tree': 'tree', 'is_set_age': '(True)', 'is_annotate': '(True)', 'time_to_add_to_extant_... |
# -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Lic... | [
"httplib2.Http",
"json.dumps",
"time.sleep",
"re.search",
"networkapi.equipamento.models.EquipamentoAcesso.search",
"logging.getLogger"
] | [((1150, 1177), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1167, 1177), False, 'import logging\n'), ((1273, 1337), 'httplib2.Http', 'httplib2.Http', (['""".cache"""'], {'disable_ssl_certificate_validation': '(True)'}), "('.cache', disable_ssl_certificate_validation=True)\n", (1286, 1... |
import logging
from typing import Tuple, Set, List
from bomber_monkey.features.board.board import Tiles, Cell, Board
from bomber_monkey.features.bomb.explosion import ExplosionDirection
from bomber_monkey.features.ia.ia_interface import IA
from bomber_monkey.features.ia.nico.utils import find_danger_positions, find_at... | [
"bomber_monkey.features.ia.nico.utils.check_cell_content",
"bomber_monkey.features.ia.nico.utils.IAGaol",
"logging.getLogger",
"bomber_monkey.features.ia.nico.utils.find_attack_positions",
"bomber_monkey.features.ia.nico.utils.IAGoalPath",
"bomber_monkey.features.ia.nico.utils.walk_next",
"bomber_monkey... | [((668, 695), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (685, 695), False, 'import logging\n'), ((5393, 5429), 'bomber_monkey.features.ia.nico.utils.IAGaol', 'IAGaol', (['PlayerAction.NONE', '"""boring!"""'], {}), "(PlayerAction.NONE, 'boring!')\n", (5399, 5429), False, 'from bomber_... |
# Copyright (C) 2019 <NAME>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, soft... | [
"io.BytesIO",
"copy.deepcopy",
"pymedphys._dicom.collection.DicomBase.from_dict",
"pymedphys._dicom.collection.DicomBase",
"pymedphys._dicom.collection.DicomBase.from_file",
"pymedphys._dicom.create.dicom_dataset_from_dict"
] | [((908, 969), 'pymedphys._dicom.create.dicom_dataset_from_dict', 'dicom_dataset_from_dict', (["{'Manufacturer': dont_change_string}"], {}), "({'Manufacturer': dont_change_string})\n", (931, 969), False, 'from pymedphys._dicom.create import dicom_dataset_from_dict\n'), ((998, 1061), 'pymedphys._dicom.create.dicom_datase... |
# @l2g 1930 python3
# [1930] Unique Length-3 Palindromic Subsequences
# Difficulty: Medium
# https://leetcode.com/problems/unique-length-3-palindromic-subsequences
#
# Given a string s,
# return the number of unique palindromes of length three that are a subsequence of s.
# Note that even if there are multiple ways to ... | [
"os.path.join"
] | [((4082, 4119), 'os.path.join', 'os.path.join', (['"""tests"""', '"""test_1930.py"""'], {}), "('tests', 'test_1930.py')\n", (4094, 4119), False, 'import os\n')] |
from PIL import Image
import numpy as np
im = Image.open('../bbtor.jpg').convert('L')
a = np.array(im)[::2, ::2]
gx = np.array([[-1, 0, 1],
[-2, 0, 2],
[-1, 0, 1]])
gy = np.array([[-1, -2, -1],
[ 0, 0, 0],
[ 1, 2, 1]])
sobel = np.zeros(a.shape)
for ... | [
"numpy.sum",
"numpy.zeros",
"PIL.Image.open",
"numpy.array",
"PIL.Image.fromarray",
"numpy.sqrt"
] | [((122, 168), 'numpy.array', 'np.array', (['[[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]]'], {}), '([[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]])\n', (130, 168), True, 'import numpy as np\n'), ((205, 251), 'numpy.array', 'np.array', (['[[-1, -2, -1], [0, 0, 0], [1, 2, 1]]'], {}), '([[-1, -2, -1], [0, 0, 0], [1, 2, 1]])\n', (213, 251), ... |
#!/usr/bin/env python
import INPUT_SET
import qrcode
import qrcode.image.svg
datum = "./data/" + INPUT_SET.QR_NAME + ".svg"
factory = qrcode.image.svg.SvgPathFillImage
img = qrcode.make(INPUT_SET.DATA, image_factory=factory)
img.save(datum)
print(datum)
| [
"qrcode.make"
] | [((177, 227), 'qrcode.make', 'qrcode.make', (['INPUT_SET.DATA'], {'image_factory': 'factory'}), '(INPUT_SET.DATA, image_factory=factory)\n', (188, 227), False, 'import qrcode\n')] |
"""Simulate Lorentz's system ODE and discover edes.
Script accepts also optional comand line arguments:
arg0 -- number of samples/models
arg1 -- custom nickname of log that is added to the log filename, which is of
the form: log_lorenz_<custom nickname><random number>.log
"""
import time
import os
import sys ... | [
"numpy.random.seed",
"scipy.integrate.solve_ivp",
"time.perf_counter",
"ProGED.equation_discoverer.EqDisco",
"numpy.random.random",
"numpy.linspace",
"ProGED.examples.tee_so.Tee",
"numpy.concatenate"
] | [((604, 623), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (621, 623), False, 'import time\n'), ((2135, 2152), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (2149, 2152), True, 'import numpy as np\n'), ((2157, 2186), 'numpy.linspace', 'np.linspace', (['(0.48)', '(0.85)', '(1000)'], {}), ... |
from PyQt5.QtCore import pyqtSlot, pyqtSignal
from PyQt5.QtWidgets import QDialog, QFileDialog, QMessageBox, QComboBox
from config import load_config, write_config
from ui.source.dialog_rule import Ui_Dialog
from util.file_util import get_windows_path, is_folder, is_application
class DialogRuleEditWrapper(QDialog, U... | [
"PyQt5.QtCore.pyqtSignal",
"PyQt5.QtWidgets.QComboBox",
"util.file_util.is_application",
"config.load_config",
"PyQt5.QtWidgets.QFileDialog.getExistingDirectory",
"util.file_util.get_windows_path",
"PyQt5.QtWidgets.QFileDialog.getOpenFileName",
"PyQt5.QtCore.pyqtSlot",
"config.write_config",
"PyQt... | [((344, 356), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', ([], {}), '()\n', (354, 356), False, 'from PyQt5.QtCore import pyqtSlot, pyqtSignal\n'), ((1586, 1596), 'PyQt5.QtCore.pyqtSlot', 'pyqtSlot', ([], {}), '()\n', (1594, 1596), False, 'from PyQt5.QtCore import pyqtSlot, pyqtSignal\n'), ((1808, 1818), 'PyQt5.QtCore.pyqt... |
# Copyright 2019 HTCondor Team, Computer Sciences Department,
# University of Wisconsin-Madison, WI.
#
# 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/LICE... | [
"htcondor_jobs.submit",
"pytest.fixture",
"htcondor_jobs.ClusterHandle.load"
] | [((706, 738), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (720, 738), False, 'import pytest\n'), ((830, 854), 'htcondor_jobs.submit', 'jobs.submit', (['short_sleep'], {}), '(short_sleep)\n', (841, 854), True, 'import htcondor_jobs as jobs\n'), ((881, 910), 'htcondor_jo... |
import datetime
import io
"""
Base models. Can get backend specific deratives
"""
from .avatar import AvatarFactory
avatarfactory = AvatarFactory()
class Event:
CONNECT = 0
DISCONNECT = 1
CREATE_CHANNEL = 10
CHANNEL_MESSAGE = 11
USERJOIN = 12
USERPART = 13
NICKCHANGE = 14
def _... | [
"datetime.datetime.utcnow",
"io.BytesIO"
] | [((2577, 2603), 'datetime.datetime.utcnow', 'datetime.datetime.utcnow', ([], {}), '()\n', (2601, 2603), False, 'import datetime\n'), ((2016, 2028), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (2026, 2028), False, 'import io\n')] |
"""
Quantiphyse - AIF widget
Copyright (c) 2013-2020 University of Oxford
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applica... | [
"quantiphyse.gui.options.DataOption",
"quantiphyse.gui.dialogs.TextViewerDialog",
"quantiphyse.gui.widgets.TitleWidget",
"quantiphyse.data.extras.NumberListExtra",
"quantiphyse.gui.options.TextOption",
"PySide2.QtWidgets.QVBoxLayout",
"PySide2.QtWidgets.QPushButton",
"quantiphyse.gui.plot.Plot",
"qu... | [((1489, 1512), 'PySide2.QtWidgets.QVBoxLayout', 'QtWidgets.QVBoxLayout', ([], {}), '()\n', (1510, 1512), False, 'from PySide2 import QtGui, QtCore, QtWidgets\n'), ((1559, 1576), 'quantiphyse.gui.widgets.TitleWidget', 'TitleWidget', (['self'], {}), '(self)\n', (1570, 1576), False, 'from quantiphyse.gui.widgets import Q... |
"""Fixtures and code shared between MRP tests."""
import asyncio
import pytest
from pyatv.core.protocol import MessageDispatcher
from pyatv.protocols.mrp import protobuf
# This mock is _extremely_ basic, so needs to be adjusted heavily when adding
# new tests
class MrpProtocolMock(MessageDispatcher[int, protobuf.Pr... | [
"pytest.fixture"
] | [((642, 678), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""protocol_mock"""'}), "(name='protocol_mock')\n", (656, 678), False, 'import pytest\n')] |
from ruamel.yaml import YAML
from ruamel.yaml.compat import StringIO
class StringDumpYAML(YAML):
def dump(self, data, stream=None, **kw):
inefficient = False
if stream is None:
inefficient = True
stream = StringIO()
YAML.dump(self, data, stream, **kw)
if inef... | [
"ruamel.yaml.compat.StringIO",
"ruamel.yaml.YAML.dump"
] | [((269, 304), 'ruamel.yaml.YAML.dump', 'YAML.dump', (['self', 'data', 'stream'], {}), '(self, data, stream, **kw)\n', (278, 304), False, 'from ruamel.yaml import YAML\n'), ((250, 260), 'ruamel.yaml.compat.StringIO', 'StringIO', ([], {}), '()\n', (258, 260), False, 'from ruamel.yaml.compat import StringIO\n')] |
# Copyright 2012 Viewfinder Inc. All Rights Reserved.
"""Async version of Amazon S3 access library.
The "boto" open source library supports synchronous operations against
S3, but does not have asynchronous support. In a high-scale server
environment, this is a real problem, because it is not permissible to
block thre... | [
"logging.debug",
"tornado.httpclient.HTTPRequest",
"viewfinder.backend.base.retry.CallWithRetryAsync",
"boto.s3.connection.SubdomainCallingFormat",
"boto.connection.AWSAuthConnection.__init__",
"tornado.httpclient.AsyncHTTPClient",
"urllib.urlencode",
"viewfinder.backend.base.retry.RetryPolicy.__init_... | [((2697, 2721), 'boto.s3.connection.SubdomainCallingFormat', 'SubdomainCallingFormat', ([], {}), '()\n', (2719, 2721), False, 'from boto.s3.connection import SubdomainCallingFormat\n'), ((1299, 1442), 'viewfinder.backend.base.retry.RetryPolicy.__init__', 'RetryPolicy.__init__', (['self'], {'max_tries': 'max_tries', 'ti... |
import tkinter as tk
from tkinter import messagebox
import os
def username():
#register_screen =
sign_in = tk.Toplevel()
global input_username
global string
input_username = tk.StringVar()
sign_in.label = tk.Label(sign_in, text="Log In", font=("Courier New", 26), justify=tk.LEFT).... | [
"tkinter.StringVar",
"os.listdir",
"os.getcwd",
"tkinter.Button",
"tkinter.Entry",
"tkinter.messagebox.showerror",
"tkinter.messagebox.showinfo",
"tkinter.Toplevel",
"tkinter.Label",
"tkinter.Tk"
] | [((126, 139), 'tkinter.Toplevel', 'tk.Toplevel', ([], {}), '()\n', (137, 139), True, 'import tkinter as tk\n'), ((208, 222), 'tkinter.StringVar', 'tk.StringVar', ([], {}), '()\n', (220, 222), True, 'import tkinter as tk\n'), ((2106, 2119), 'tkinter.Toplevel', 'tk.Toplevel', ([], {}), '()\n', (2117, 2119), True, 'import... |
"""Example web view for application factory."""
from flask import Blueprint
from .extensions import scheduler
from .tasks import task2
web_bp = Blueprint("web_bp", __name__)
@web_bp.route("/")
def index():
"""Say hi!.
:url: /
:returns: hi!
"""
return "hi!"
@web_bp.route("/add")
def add():
... | [
"flask.Blueprint"
] | [((148, 177), 'flask.Blueprint', 'Blueprint', (['"""web_bp"""', '__name__'], {}), "('web_bp', __name__)\n", (157, 177), False, 'from flask import Blueprint\n')] |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 15 10:09:44 2012
@author: schelle
"""
import matplotlib.pyplot as plt
import numpy as np
def sCurve(X,a=0.0,b=1.0,c=1.0):
s = 1.0/(b + np.exp(-c * (X-a)))
return s
dem50 = 300
dem90 = 313
dem10 = 275
perc = 0.9
C = -np.log(1.0/(perc) - 1)/(dem90 - dem50)
C... | [
"matplotlib.pyplot.show",
"numpy.log",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"numpy.arange",
"numpy.exp"
] | [((509, 547), 'matplotlib.pyplot.plot', 'plt.plot', (['zz', 'S'], {'label': '"""fitted to 90%"""'}), "(zz, S, label='fitted to 90%')\n", (517, 547), True, 'import matplotlib.pyplot as plt\n'), ((546, 585), 'matplotlib.pyplot.plot', 'plt.plot', (['zz', 'SS'], {'label': '"""fitted to 10%"""'}), "(zz, SS, label='fitted to... |
# -*- coding: utf-8 -*-
# flake8: noqa
import pkg_resources
import click
from .commands.main import main
from .commands.echo import echo
from .commands.install import install
from .commands.addrevoke import add, revoke
from .commands.allow import allow, disallow
from .commands.end import end
from .commands.export im... | [
"pkg_resources.iter_entry_points",
"click.CommandCollection"
] | [((546, 602), 'pkg_resources.iter_entry_points', 'pkg_resources.iter_entry_points', ([], {'group': '"""sera.collection"""'}), "(group='sera.collection')\n", (577, 602), False, 'import pkg_resources\n'), ((645, 701), 'pkg_resources.iter_entry_points', 'pkg_resources.iter_entry_points', ([], {'group': '"""sera.subcommand... |
# Generated by Django 3.0.10 on 2020-10-17 15:55
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('s_inventory', '0001_initial'),
migrations.swappable_dependency... | [
"django.db.models.OneToOneField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.DecimalField",
"django.db.models.DateTimeField"
] | [((289, 346), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (320, 346), False, 'from django.db import migrations, models\n'), ((479, 572), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
import requests
import logging
logging.basicConfig(filename='webpageclonelog.txt', level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s' )
#program to clone a webpage url using python request module
logging.debug('Start of program')
# Get url from user and store in a new variable page
print('Pleas... | [
"requests.get",
"logging.debug",
"logging.basicConfig"
] | [((32, 160), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""webpageclonelog.txt"""', 'level': 'logging.DEBUG', 'format': '"""%(asctime)s - %(levelname)s - %(message)s"""'}), "(filename='webpageclonelog.txt', level=logging.DEBUG,\n format='%(asctime)s - %(levelname)s - %(message)s')\n", (51, 160)... |
# Copyright (c) 2018, Xilinx
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and th... | [
"copy.deepcopy",
"FINN.core.layers.isMatrixLayer",
"FINN.core.layers.isConvLayer",
"numpy.ceil",
"numpy.asarray",
"FINN.core.layers.MatrixThresholdLayer",
"numpy.zeros",
"numpy.ones",
"FINN.core.quantize.quantize_matrix",
"FINN.core.layers.isFCLayer",
"FINN.core.layers.isLinearLayer",
"FINN.co... | [((2486, 2509), 'copy.deepcopy', 'copy.deepcopy', (['pipeline'], {}), '(pipeline)\n', (2499, 2509), False, 'import copy\n'), ((2827, 2850), 'FINN.core.layers.isMatrixLayer', 'lb.isMatrixLayer', (['layer'], {}), '(layer)\n', (2843, 2850), True, 'import FINN.core.layers as lb\n'), ((2865, 2885), 'copy.deepcopy', 'copy.de... |
import base64
import secrets
class SafeUid(object):
@staticmethod
def gen(nbytes=16) -> str:
entropy = secrets.token_bytes(nbytes) # 16 bytes == 128 bits
base32_bytes = base64.b32encode(entropy)
base32_text = base32_bytes.decode("ascii")
base32_lowercase = base32_text.casef... | [
"base64.b32encode",
"secrets.token_bytes"
] | [((122, 149), 'secrets.token_bytes', 'secrets.token_bytes', (['nbytes'], {}), '(nbytes)\n', (141, 149), False, 'import secrets\n'), ((199, 224), 'base64.b32encode', 'base64.b32encode', (['entropy'], {}), '(entropy)\n', (215, 224), False, 'import base64\n')] |
#!/usr/bin/env python
import logging
import subprocess
from sqlalchemy import func, and_, or_, not_
logging.basicConfig(level=logging.DEBUG, format='%(levelname)s - - %(asctime)s %(message)s', datefmt='[%d/%b/%Y %H:%M:%S]')
##logging.basicConfig(level=logging.INFO, format='%(levelname)s - - %(asctime)s %(message)s', ... | [
"libs.pfctl.PFCtl.set_ip_proxy",
"models.session.session.query",
"logging.basicConfig",
"models.base.get_model"
] | [((102, 230), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': '"""%(levelname)s - - %(asctime)s %(message)s"""', 'datefmt': '"""[%d/%b/%Y %H:%M:%S]"""'}), "(level=logging.DEBUG, format=\n '%(levelname)s - - %(asctime)s %(message)s', datefmt='[%d/%b/%Y %H:%M:%S]')\n", (121, 230... |
from setuptools import find_packages
from setuptools import setup
version = '2.1.3'
setup(
name='fcis',
version=version,
packages=find_packages(),
install_requires=open('requirements.txt').readlines(),
description='Chainer Implementation of FCIS',
long_description=open('README.md').read(),
... | [
"setuptools.find_packages"
] | [((146, 161), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (159, 161), False, 'from setuptools import find_packages\n')] |
import configparser
import os.path
import re
import bg_helper as bh
import input_helper as ih
from os import getenv, makedirs
from functools import partial
from glob import glob
from shutil import copyfile
APP_ENV = getenv('APP_ENV', 'dev')
separator_rx = re.compile(r'.*[,;\|].*')
def get_default_settings_file(modu... | [
"functools.partial",
"os.makedirs",
"configparser.RawConfigParser",
"input_helper.from_string",
"bg_helper.run",
"bg_helper.run_output",
"input_helper.string_to_converted_list",
"shutil.copyfile",
"os.getenv",
"re.compile"
] | [((218, 242), 'os.getenv', 'getenv', (['"""APP_ENV"""', '"""dev"""'], {}), "('APP_ENV', 'dev')\n", (224, 242), False, 'from os import getenv, makedirs\n'), ((258, 283), 're.compile', 're.compile', (['""".*[,;\\\\|].*"""'], {}), "('.*[,;\\\\|].*')\n", (268, 283), False, 'import re\n'), ((3870, 3888), 'bg_helper.run_outp... |
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import datasets
import sys
import os
import numpy as np
import pandas as pd
from transformers import AutoModel, BertTokenizerFast, AutoModelForSequenceClassification, BertConfig, DataCollatorWithPadding
from transformers import AutoToke... | [
"wandb.log",
"numpy.random.seed",
"argparse.ArgumentParser",
"ipdb.set_trace",
"wandb.watch",
"numpy.argmax",
"torch.nn.Softmax",
"transformers.DataCollatorWithPadding",
"torch.no_grad",
"datasets.load_dataset",
"torch.utils.data.DataLoader",
"transformers.BertTokenizerFast.from_pretrained",
... | [((609, 632), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (626, 632), False, 'import torch\n'), ((640, 665), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (663, 665), False, 'import torch\n'), ((749, 769), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)... |
# coding: utf-8
# Author: <NAME> <<EMAIL>>
import json
from sear.index import Document
from sear.index import IndexRecord
from sear.utils import StreamParser
from sear.index import DocumentIndexer
from hugin.minlf import MinLFSParser
from hugin.minlf import MinBoxerLFSParser
class LFSentenceStream(object):
de... | [
"json.loads",
"json.dumps"
] | [((1816, 1834), 'json.loads', 'json.loads', (['string'], {}), '(string)\n', (1826, 1834), False, 'import json\n'), ((1997, 2073), 'json.dumps', 'json.dumps', (["{'r': self.raw_text, 't': self.idx_terms, 's': self.lf_sentence}"], {}), "({'r': self.raw_text, 't': self.idx_terms, 's': self.lf_sentence})\n", (2007, 2073), ... |
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from swagger_server.models.base_model_ import Model
from swagger_server import util
class CilogonTokensIdentityToken(Model):
"""NOTE: This class is auto generated... | [
"swagger_server.util.deserialize_model"
] | [((3250, 3283), 'swagger_server.util.deserialize_model', 'util.deserialize_model', (['dikt', 'cls'], {}), '(dikt, cls)\n', (3272, 3283), False, 'from swagger_server import util\n')] |
from django.shortcuts import render
from .models import City, Country, Countrylanguage
from django.http import HttpResponse
from django.urls import reverse
from django.contrib.auth.decorators import login_required
# Create your views here.
def auto_suggest(request):
if request.is_ajax():
keywo... | [
"django.contrib.auth.decorators.login_required",
"django.urls.reverse",
"django.http.HttpResponse",
"django.shortcuts.render"
] | [((1186, 1221), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'login_url': '"""/login/"""'}), "(login_url='/login/')\n", (1200, 1221), False, 'from django.contrib.auth.decorators import login_required\n'), ((2119, 2164), 'django.shortcuts.render', 'render', (['request', '"""world_detail.html"... |
# Ray algorithm for find path in maze
from random import choices
inf = float('inf')
ch = [inf, -1]
we = [0.7, 0.1]
n = 8
def create_maze():
maze = []
for i in range(n):
maze.append([])
for j in range(n):
if i == 0 or i == n - 1:
maze[i].append(-1)
elif... | [
"random.choices"
] | [((419, 434), 'random.choices', 'choices', (['ch', 'we'], {}), '(ch, we)\n', (426, 434), False, 'from random import choices\n')] |
import logging
LOG_LEVEL = logging.INFO
# LOG_LEVEL = logging.DEBUG
logging_set = False
def set_logging():
global logging_set
if not logging_set:
logging.basicConfig(level=LOG_LEVEL,
format='%(asctime)s - [%(levelname)s] - %(name)s - : %(message)s in %(filename)s:%(lineno... | [
"logging.basicConfig",
"logging.getLogger"
] | [((489, 508), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (506, 508), False, 'import logging\n'), ((166, 337), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'LOG_LEVEL', 'format': '"""%(asctime)s - [%(levelname)s] - %(name)s - : %(message)s in %(filename)s:%(lineno)d"""', 'datefmt': '"""%... |
import random
yes = "yes"
f = open('Numbes.txt','w')
while yes == "yes":
lol = str(random.randint(100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,999999999999999999999999999999999999999999999999999999999990000000000000000000000000000000000000... | [
"random.randint"
] | [((91, 363), 'random.randint', 'random.randint', (['(100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\n )', '(999999999999999999999999999999999999999999999999999999999990000000000000000000000000000000000000000000000000000000000\n )'], {}), '(\n ... |
from flask import render_template, url_for, jsonify
from dw.models import Name
from dw.generate import bp
@bp.route('/diceware')
def diceware():
names = Name.query.all()
return render_template('generate/diceware.html', names=names)
@bp.route('/lists')
def get_data():
names = Name.query.all()
dwLists =... | [
"flask.jsonify",
"dw.generate.bp.route",
"dw.models.Name.query.all",
"flask.render_template"
] | [((108, 129), 'dw.generate.bp.route', 'bp.route', (['"""/diceware"""'], {}), "('/diceware')\n", (116, 129), False, 'from dw.generate import bp\n'), ((243, 261), 'dw.generate.bp.route', 'bp.route', (['"""/lists"""'], {}), "('/lists')\n", (251, 261), False, 'from dw.generate import bp\n'), ((158, 174), 'dw.models.Name.qu... |
from enum import Enum
import operator
import itertools
import collections
import sys
import numpy as np
import re
from .alignment import AlnStats
class Operation(Enum):
AlnMatch = 0
Insertion = 1
Deletion = 2
Skip = 3
Soft = 4
Hard = 5
Padding = 6
SeqMatch = 7
SeqMismatch = 8
... | [
"numpy.searchsorted",
"sys.stderr.write",
"re.split",
"collections.namedtuple"
] | [((960, 1026), 'collections.namedtuple', 'collections.namedtuple', (['"""AlignedRegion"""', '"""start1 end1 start2 end2"""'], {}), "('AlignedRegion', 'start1 end1 start2 end2')\n", (982, 1026), False, 'import collections\n'), ((9949, 9978), 're.split', 're.split', (['"""([A-Z^]+)"""', 'md_tag'], {}), "('([A-Z^]+)', md_... |
import os
import numpy as np
from sklearn.svm import SVC
from sklearn.model_selection import cross_val_score
from sklearn.externals import joblib
from skimage.io import imread
from skimage.filters import threshold_otsu
letters = [
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D',
... | [
"skimage.filters.threshold_otsu",
"sklearn.model_selection.cross_val_score",
"os.path.realpath",
"numpy.array",
"sklearn.svm.SVC",
"skimage.io.imread"
] | [((1807, 1845), 'sklearn.svm.SVC', 'SVC', ([], {'kernel': '"""linear"""', 'probability': '(True)'}), "(kernel='linear', probability=True)\n", (1810, 1845), False, 'from sklearn.svm import SVC\n'), ((1191, 1254), 'sklearn.model_selection.cross_val_score', 'cross_val_score', (['model', 'train_data', 'train_label'], {'cv'... |
import numpy as np
import itertools
import gpuscheduler
import argparse
import os
import uuid
import hashlib
import glob
import math
from itertools import product
from torch.optim.lr_scheduler import OneCycleLR
from os.path import join
parser = argparse.ArgumentParser(description='Compute script.')
parser.add_argumen... | [
"gpuscheduler.HyakScheduler",
"argparse.ArgumentParser",
"numpy.random.RandomState",
"itertools.product",
"os.path.join"
] | [((247, 301), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Compute script."""'}), "(description='Compute script.')\n", (270, 301), False, 'import argparse\n'), ((1553, 1655), 'gpuscheduler.HyakScheduler', 'gpuscheduler.HyakScheduler', ([], {'verbose': 'args.verbose', 'account': '""""""... |
from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.html import escape
from django.contrib import admin
class Activity(models.Model):
FAVORITE = 'F'
LIKE = 'L'
UP_V... | [
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.BooleanField",
"django.db.models.IntegerField",
"django.db.models.DateTimeField",
"django.utils.html.escape"
] | [((515, 538), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {}), '(User)\n', (532, 538), False, 'from django.db import models\n'), ((559, 613), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(1)', 'choices': 'ACTIVITY_TYPES'}), '(max_length=1, choices=ACTIVITY_TYPES)\n', (575, 6... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import os
from common.Utilities import execute_command, backup_file, show_partial_diff, get_code, error_exit
from common import Definitions, Values
import phases.Concolic
from ast import ASTGenerator
from phases import Trace
import Mapper
import Identifier
im... | [
"Identifier.identify_missing_headers",
"Mapper.map_ast_from_source",
"common.Utilities.execute_command",
"common.Utilities.backup_file",
"Identifier.identify_missing_definitions",
"Mapper.map_variable",
"Oracle.is_loc_on_stack",
"Emitter.sub_sub_title",
"Identifier.identify_missing_macros_in_func",
... | [((1841, 1868), 'os.path.exists', 'os.path.exists', (['source_path'], {}), '(source_path)\n', (1855, 1868), False, 'import os\n'), ((2390, 2440), 'Emitter.normal', 'Emitter.normal', (['"""\t\texecuting AST transformation"""'], {}), "('\\t\\texecuting AST transformation')\n", (2404, 2440), False, 'import Emitter\n'), ((... |
# Generated by Django 2.2.5 on 2020-03-30 21:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('people', '0006_auto_20180607_1804'),
]
operations = [
migrations.AddField(
model_name='personpage',
name='state_prov... | [
"django.db.models.CharField"
] | [((345, 422), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(10)', 'verbose_name': '"""State or Province"""'}), "(blank=True, max_length=10, verbose_name='State or Province')\n", (361, 422), False, 'from django.db import migrations, models\n')] |
import nltk
from nltk.tokenize import word_tokenize,sent_tokenize
from nltk.corpus import stopwords
from nltk.stem import PorterStemmer
import pprint
posts = open("C:/Users/mudasirw/Desktop/RESEARCH @N T N U -JULY 2019/GENDER PREDICTION/python scripts/textAnalysis/female_post_content.txt", 'r')
txt1=posts.read(... | [
"nltk.tokenize.sent_tokenize",
"nltk.corpus.stopwords.words",
"pprint.pprint",
"nltk.tokenize.word_tokenize"
] | [((449, 468), 'nltk.tokenize.word_tokenize', 'word_tokenize', (['txt1'], {}), '(txt1)\n', (462, 468), False, 'from nltk.tokenize import word_tokenize, sent_tokenize\n'), ((477, 496), 'nltk.tokenize.sent_tokenize', 'sent_tokenize', (['txt1'], {}), '(txt1)\n', (490, 496), False, 'from nltk.tokenize import word_tokenize, ... |
import os
import typing as t
from subprocess import Popen, CalledProcessError, PIPE, STDOUT
from select import select
from loguru import logger
def log_check_call(*args: t.Any, **kwargs: t.Any) -> int:
log = kwargs.pop("log", logger.debug)
kwargs["stdout"] = PIPE
kwargs["stderr"] = STDOUT
env = kwar... | [
"subprocess.CalledProcessError",
"subprocess.Popen",
"select.select",
"os.environ.copy"
] | [((476, 498), 'subprocess.Popen', 'Popen', (['*args'], {}), '(*args, **kwargs)\n', (481, 498), False, 'from subprocess import Popen, CalledProcessError, PIPE, STDOUT\n'), ((334, 351), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (349, 351), False, 'import os\n'), ((563, 593), 'select.select', 'select', (['[p... |
#!/usr/bin/env python
###################################################################################################
# File: code_generator.py #
# ... | [
"os.path.isabs",
"re.split",
"os.path.join",
"os.path.basename",
"os.path.isdir",
"os.path.dirname",
"os.walk",
"os.path.relpath",
"re.search",
"re.sub",
"fnmatch.fnmatch"
] | [((1802, 1845), 're.sub', 're.sub', (['pattern', 'repl', 'string', 'count', 'flags'], {}), '(pattern, repl, string, count, flags)\n', (1808, 1845), False, 'import re\n'), ((1966, 1999), 're.search', 're.search', (['pattern', 'string', 'flags'], {}), '(pattern, string, flags)\n', (1975, 1999), False, 'import re\n'), ((3... |
from kafka import KafkaProducer
from json import dumps, loads
import requests
def publish_message(producer_instance, topic_name, value):
try:
producer_instance.send(topic_name, value=value)
producer_instance.flush()
print('Message published successfully.')
except Exception as ex:
... | [
"requests.get",
"json.dumps"
] | [((1036, 1074), 'requests.get', 'requests.get', (['stream_link'], {'stream': '(True)'}), '(stream_link, stream=True)\n', (1048, 1074), False, 'import requests\n'), ((625, 633), 'json.dumps', 'dumps', (['x'], {}), '(x)\n', (630, 633), False, 'from json import dumps, loads\n')] |
# Requirements:
# A realsense D400 series
# Install realsense2 ros2 package (refactor branch)
# Example:
# $ ros2 launch realsense2_camera rs_launch.py align_depth:=true
# $ ros2 launch rtabmap_ros realsense_d400.launch.py
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, S... | [
"launch.actions.SetEnvironmentVariable",
"launch_ros.actions.Node"
] | [((890, 957), 'launch.actions.SetEnvironmentVariable', 'SetEnvironmentVariable', (['"""RCUTILS_CONSOLE_STDOUT_LINE_BUFFERED"""', '"""1"""'], {}), "('RCUTILS_CONSOLE_STDOUT_LINE_BUFFERED', '1')\n", (912, 957), False, 'from launch.actions import DeclareLaunchArgument, SetEnvironmentVariable\n'), ((994, 1122), 'launch_ros... |
import win32gui
import re
import time
import keyboard
from pywinauto import application
from pywinauto.findwindows import WindowAmbiguousError, WindowNotFoundError
def focusWindow(name):
# Init App object
app = application.Application()
try:
app.connect(title_re=".*%s.*" % name)
... | [
"keyboard.press_and_release",
"win32gui.GetWindowText",
"win32gui.FindWindow",
"time.sleep",
"pywinauto.application.Application",
"win32gui.EnumWindows",
"win32gui.SetForegroundWindow"
] | [((229, 254), 'pywinauto.application.Application', 'application.Application', ([], {}), '()\n', (252, 254), False, 'from pywinauto import application\n'), ((690, 706), 'time.sleep', 'time.sleep', (['(0.05)'], {}), '(0.05)\n', (700, 706), False, 'import time\n'), ((711, 746), 'keyboard.press_and_release', 'keyboard.pres... |
#!/usr/bin/env python
# encoding:utf-8
# @Time : 2019/10/4
# @Author : 茶葫芦
# @Site :
# @File : pca.py
import numpy as np
import matplotlib.pyplot as plt
class pca():
def __init__(self,initial_w,n_compents,eta =0.1,epsilon=1e-10,n_iters=1e8):
self.initial_w=initial_w
self.n_compents=n_compe... | [
"numpy.random.uniform",
"numpy.random.seed",
"numpy.empty",
"numpy.random.random",
"numpy.mean",
"numpy.linalg.norm"
] | [((1929, 1949), 'numpy.random.seed', 'np.random.seed', (['(1000)'], {}), '(1000)\n', (1943, 1949), True, 'import numpy as np\n'), ((1958, 1976), 'numpy.empty', 'np.empty', (['(100, 2)'], {}), '((100, 2))\n', (1966, 1976), True, 'import numpy as np\n'), ((1988, 2023), 'numpy.random.uniform', 'np.random.uniform', (['(0)'... |
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 26 20:49:22 2019
@author: Wojtek
"""
from Process import *
from copy import deepcopy,copy
from bisect import insort
from wyzazanie import *
def Schrage(N):
Cmax=0
sig=[]
sNg=[]
Nn=deepcopy(N)
Nn.sort(key=lambda x:x.r)
t=Nn[0].r
while sNg != []... | [
"copy.deepcopy",
"bisect.insort",
"time.time"
] | [((245, 256), 'copy.deepcopy', 'deepcopy', (['N'], {}), '(N)\n', (253, 256), False, 'from copy import deepcopy, copy\n'), ((818, 829), 'copy.deepcopy', 'deepcopy', (['N'], {}), '(N)\n', (826, 829), False, 'from copy import deepcopy, copy\n'), ((2989, 3000), 'time.time', 'time.time', ([], {}), '()\n', (2998, 3000), Fals... |
import subprocess
import argparse
import os
from datetime import date
import time
import shutil
import stat
import sys
import json
import pprint
import MachineConfigs as machine_configs
import Helpers as helpers
import WriteTestResultsToHTML as write_test_results_to_html
class TestsSetError(Exception):
pass
# ... | [
"subprocess.Popen",
"json.load",
"argparse.ArgumentParser",
"os.path.basename",
"os.path.dirname",
"os.system",
"time.time",
"subprocess.call",
"Helpers.build_html_filename",
"Helpers.directory_clean_or_make",
"WriteTestResultsToHTML.write_test_set_results_to_html",
"os.path.splitext"
] | [((3719, 3749), 'os.path.dirname', 'os.path.dirname', (['json_filepath'], {}), '(json_filepath)\n', (3734, 3749), False, 'import os\n'), ((13670, 13695), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (13693, 13695), False, 'import argparse\n'), ((14931, 15004), 'WriteTestResultsToHTML.write_te... |
"""Contains functions for tasks related to file system.
"""
import os
import shutil
import re
import datetime
import logging
import errno
import numpy as np
import mne
def open_raw(fname, preload=True, verbose='info'):
"""Reads a raw from file.
Parameters
----------
fname : str
Path to the ... | [
"os.path.expanduser",
"mne.io.read_raw",
"os.remove",
"os.makedirs",
"os.path.basename",
"os.path.dirname",
"numpy.savetxt",
"os.path.exists",
"datetime.datetime.now",
"numpy.where",
"numpy.array",
"os.path.splitext",
"numpy.loadtxt",
"shutil.move",
"os.path.join",
"os.listdir",
"log... | [((1453, 1474), 'os.path.dirname', 'os.path.dirname', (['path'], {}), '(path)\n', (1468, 1474), False, 'import os\n'), ((1487, 1509), 'os.path.basename', 'os.path.basename', (['path'], {}), '(path)\n', (1503, 1509), False, 'import os\n'), ((1537, 1557), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (1... |
import yaml
import uuid
import os.path
from os import path
class Interval:
data = {}
def load(self):
# Load in config file details
try:
with open('config/update_interval.yaml') as config:
self.data = yaml.load(config, Loader=yaml.FullLoader)
except FileNotF... | [
"uuid.uuid4",
"yaml.load",
"yaml.dump",
"os.path.exists"
] | [((776, 804), 'yaml.dump', 'yaml.dump', (['self.data', 'config'], {}), '(self.data, config)\n', (785, 804), False, 'import yaml\n'), ((1317, 1357), 'yaml.dump', 'yaml.dump', (['data', 'config'], {'sort_keys': '(False)'}), '(data, config, sort_keys=False)\n', (1326, 1357), False, 'import yaml\n'), ((255, 296), 'yaml.loa... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os, sys, requests
from random import randint
from PySide2.QtWidgets import QApplication, QSplashScreen
from PySide2.QtGui import QFont, QPixmap, QIcon
from PySide2.QtCore import Qt, QThread
from utils.main_ui import MainWindow
class downloadUpdates(QThread):
def ... | [
"PySide2.QtWidgets.QApplication",
"os.path.exists",
"PySide2.QtGui.QIcon",
"requests.get",
"PySide2.QtWidgets.QApplication.setAttribute",
"PySide2.QtGui.QPixmap",
"utils.main_ui.MainWindow",
"PySide2.QtGui.QFont",
"os.listdir"
] | [((1820, 1876), 'PySide2.QtWidgets.QApplication.setAttribute', 'QApplication.setAttribute', (['Qt.AA_UseHighDpiPixmaps', '(True)'], {}), '(Qt.AA_UseHighDpiPixmaps, True)\n', (1845, 1876), False, 'from PySide2.QtWidgets import QApplication, QSplashScreen\n'), ((1881, 1940), 'PySide2.QtWidgets.QApplication.setAttribute',... |
#from unittest import TestCase
from animator.plotter import ScatterAnimation
from matplotlib.animation import PillowWriter
import numpy as np
x = np.linspace(0, 10, 100)
Y = [np.sin(x - 0.1 * t) for t in range(10)]
animation = ScatterAnimation(x, Y)
writer = PillowWriter(fps=5)
animation.anim.save("test.gif", writer=wr... | [
"matplotlib.animation.PillowWriter",
"animator.plotter.ScatterAnimation",
"numpy.sin",
"numpy.linspace"
] | [((146, 169), 'numpy.linspace', 'np.linspace', (['(0)', '(10)', '(100)'], {}), '(0, 10, 100)\n', (157, 169), True, 'import numpy as np\n'), ((227, 249), 'animator.plotter.ScatterAnimation', 'ScatterAnimation', (['x', 'Y'], {}), '(x, Y)\n', (243, 249), False, 'from animator.plotter import ScatterAnimation\n'), ((259, 27... |
import base64
def base64enc(filename:str) -> bytes:
with open(filename,"rb") as f1, open("result.txt","wb") as f2:
data = f1.read()
result = base64.b64encode(data)
f2.write(result)
return result
def main():
base64enc("test.jpg")
if __name__ == "__main__":
main() | [
"base64.b64encode"
] | [((163, 185), 'base64.b64encode', 'base64.b64encode', (['data'], {}), '(data)\n', (179, 185), False, 'import base64\n')] |
#Script to check that image can be accessed through S3 link
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
#Indicate the index of the last image uploaded to S3
image_index = 203
for i in range(image_index + 1):
if i % 25 == 0 and i != 0:
... | [
"requests.packages.urllib3.util.retry.Retry",
"requests.Session",
"requests.adapters.HTTPAdapter"
] | [((444, 462), 'requests.Session', 'requests.Session', ([], {}), '()\n', (460, 462), False, 'import requests\n'), ((473, 509), 'requests.packages.urllib3.util.retry.Retry', 'Retry', ([], {'connect': '(3)', 'backoff_factor': '(0.5)'}), '(connect=3, backoff_factor=0.5)\n', (478, 509), False, 'from requests.packages.urllib... |
#!/usr/bin/env python
# migrate.py
from django.core.management import call_command
from boot_django import boot_django
boot_django()
call_command("migrate", "mini_system_monitor") | [
"django.core.management.call_command",
"boot_django.boot_django"
] | [((121, 134), 'boot_django.boot_django', 'boot_django', ([], {}), '()\n', (132, 134), False, 'from boot_django import boot_django\n'), ((135, 181), 'django.core.management.call_command', 'call_command', (['"""migrate"""', '"""mini_system_monitor"""'], {}), "('migrate', 'mini_system_monitor')\n", (147, 181), False, 'fro... |
#!/usr/bin/env python
# coding=utf-8
from __future__ import division, print_function, unicode_literals
from collections import OrderedDict
from brainstorm.layers.base_layer import Layer
from brainstorm.structure.buffer_structure import StructureTemplate
from brainstorm.structure.construction import ConstructionWrappe... | [
"brainstorm.structure.buffer_structure.StructureTemplate",
"brainstorm.structure.construction.ConstructionWrapper.create",
"collections.OrderedDict",
"brainstorm.utils.product"
] | [((446, 498), 'brainstorm.structure.construction.ConstructionWrapper.create', 'ConstructionWrapper.create', (['MaskLayerImpl'], {'name': 'name'}), '(MaskLayerImpl, name=name)\n', (472, 498), False, 'from brainstorm.structure.construction import ConstructionWrapper\n'), ((564, 598), 'brainstorm.structure.buffer_structur... |
import matplotlib.pyplot as plt
import numpy as np
# This import registers the 3D projection, but is otherwise unused.
from mpl_toolkits.mplot3d import Axes3D
plt.ion()
box_size = float(input())
fig = plt.figure()
ax = plt.subplot(121, projection='3d', aspect='equal')
ax.set_xlabel('X')
ax.set_ylabel('... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.get_current_fig_manager",
"matplotlib.pyplot.ion",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.cla",
"matplotlib.pyplot.pause",
"matplotlib.pyplot.get_fignums",
"matplotlib.pyplot.grid"
] | [((167, 176), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (174, 176), True, 'import matplotlib.pyplot as plt\n'), ((215, 227), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (225, 227), True, 'import matplotlib.pyplot as plt\n'), ((234, 283), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(121)']... |
"""
Drop an index (`app`.`orderdetails_pkey`) and re-create it with additional columns.
"""
from app.revisioner.tests.e2e import inspected
from app.revisioner.tests.test_e2e import mutate_inspected
preload_fixtures = ['datastore']
inspected_tables = mutate_inspected(inspected.tables_and_views, [])
inspected_indexes... | [
"app.revisioner.tests.test_e2e.mutate_inspected"
] | [((253, 301), 'app.revisioner.tests.test_e2e.mutate_inspected', 'mutate_inspected', (['inspected.tables_and_views', '[]'], {}), '(inspected.tables_and_views, [])\n', (269, 301), False, 'from app.revisioner.tests.test_e2e import mutate_inspected\n'), ((323, 974), 'app.revisioner.tests.test_e2e.mutate_inspected', 'mutate... |
from urllib.parse import parse_qsl, urlencode, urlsplit
from flask import (
abort,
current_app as app,
redirect,
render_template,
request,
session,
)
from ..helpers import Blueprint
from ..utils import get_checksum
from .forms import PaymentRequestForm
from .models import PaymentRecord, Payment... | [
"flask.session.pop",
"flask.redirect",
"flask.request.form.get",
"urllib.parse.urlencode",
"flask.session.get",
"flask.abort",
"urllib.parse.urlsplit",
"urllib.parse.parse_qsl"
] | [((1322, 1352), 'flask.request.form.get', 'request.form.get', (['"""action"""', '""""""'], {}), "('action', '')\n", (1338, 1352), False, 'from flask import abort, current_app as app, redirect, render_template, request, session\n'), ((1465, 1496), 'flask.request.form.get', 'request.form.get', (['"""payment"""', '""""""'... |
# Copyright 2008-2018 pydicom authors. See LICENSE file for details.
"""Use the numpy package to convert supported pixel data to an ndarray.
**Supported transfer syntaxes**
* 1.2.840.10008.1.2 : Implicit VR Little Endian
* 1.2.840.10008.1.2.1 : Explicit VR Little Endian
* 1.2.840.10008.1.2.1.99 : Deflated Explicit VR... | [
"numpy.ravel",
"numpy.frombuffer",
"numpy.zeros",
"pydicom.pixel_data_handlers.util.pixel_dtype",
"pydicom.pixel_data_handlers.util.get_expected_length",
"numpy.fliplr",
"numpy.reshape",
"numpy.unpackbits",
"warnings.warn"
] | [((4705, 4729), 'numpy.reshape', 'np.reshape', (['arr', '(-1, 8)'], {}), '(arr, (-1, 8))\n', (4715, 4729), True, 'import numpy as np\n'), ((4740, 4754), 'numpy.fliplr', 'np.fliplr', (['arr'], {}), '(arr)\n', (4749, 4754), True, 'import numpy as np\n'), ((5457, 5497), 'numpy.frombuffer', 'np.frombuffer', (['bytestream']... |
import re
from django.conf import settings
from django.template import Library
from sorl.thumbnail.shortcuts import get_thumbnail
register = Library()
@register.filter
def load_thumbnails(value):
images = re.findall( # noqa
'<img class="thumbnail"( alt="([a-zA-Z0-9\.\:\/_ -]+)?")? ' # noqa
'sr... | [
"sorl.thumbnail.shortcuts.get_thumbnail",
"django.template.Library",
"re.findall",
"re.search"
] | [((143, 152), 'django.template.Library', 'Library', ([], {}), '()\n', (150, 152), False, 'from django.template import Library\n'), ((213, 369), 're.findall', 're.findall', (['"""<img class="thumbnail"( alt="([a-zA-Z0-9\\\\.\\\\:\\\\/_ -]+)?")? src="([a-zA-Z0-9\\\\.\\\\:\\\\/_ -]+)"([a-zA-Z0-9\\\\.\\\\:\\\\;\\\\/_=" -]+... |
"""
geez.topic
mauricesvp 2021
"""
import hashlib
import time
import requests
from bs4 import BeautifulSoup
import geez.utils as utils
class Topic:
def __init__(
self,
id: int,
author: str = "",
category: str = "",
date: float = 0.0,
post: str = "",
first... | [
"time.time",
"geez.utils.get_date",
"geez.utils.get_category",
"requests.get",
"bs4.BeautifulSoup"
] | [((870, 892), 'requests.get', 'requests.get', (['self.url'], {}), '(self.url)\n', (882, 892), False, 'import requests\n'), ((968, 1004), 'bs4.BeautifulSoup', 'BeautifulSoup', (['r.text', '"""html.parser"""'], {}), "(r.text, 'html.parser')\n", (981, 1004), False, 'from bs4 import BeautifulSoup\n'), ((1283, 1307), 'geez.... |
#!/usr/bin/env python3
'''Create light curves from UVIT data.
Copyright 2019 <NAME>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENS... | [
"astropy.convolution.Gaussian2DKernel",
"astropy.convolution.convolve",
"matplotlib.pyplot.title",
"numpy.isin",
"numpy.sum",
"numpy.abs",
"matplotlib.pyplot.clf",
"astropy.stats.sigma_clipped_stats",
"astropy.io.fits.ColDefs",
"astropy.io.fits.PrimaryHDU",
"matplotlib.pyplot.figure",
"numpy.m... | [((725, 746), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (739, 746), False, 'import matplotlib\n'), ((3405, 3479), 'numpy.array', 'np.array', (['[1.5, 2, 2.5, 3, 4, 5, 7, 9, 12, 15, 20, 30, 40, 50, 70, 80, 95]'], {}), '([1.5, 2, 2.5, 3, 4, 5, 7, 9, 12, 15, 20, 30, 40, 50, 70, 80, 95])\n', (34... |
#!/usr/bin/env python
"""
This source file is part of the Swift.org open source project
Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
Licensed under Apache License v2.0 with Runtime Library Exception
See https://swift.org/LICENSE.txt for license information
See https://swift.org/CONTR... | [
"argparse.ArgumentParser",
"os.makedirs",
"os.path.basename",
"subprocess.check_output",
"os.path.dirname",
"os.path.realpath",
"os.path.exists",
"os.path.isfile",
"platform.system",
"os.path.join",
"os.access",
"subprocess.check_call"
] | [((848, 902), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""BUILD-SCRIPT-HELPER.PY"""'}), "(prog='BUILD-SCRIPT-HELPER.PY')\n", (871, 902), False, 'import argparse\n'), ((3425, 3450), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (3440, 3450), False, 'import os, plat... |
from django.test import TestCase
from django.test import Client
from core.tests.factories import SaleFactory
from django.urls import reverse_lazy
class InvoiceViewTestCase(TestCase):
def test_not_found_sale_for_add_invoice(self):
"""
Should return a 404 not found for add new invoice a not exists ... | [
"django.urls.reverse_lazy",
"core.tests.factories.SaleFactory",
"django.test.Client"
] | [((354, 362), 'django.test.Client', 'Client', ([], {}), '()\n', (360, 362), False, 'from django.test import Client\n'), ((377, 434), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""invoice_to_sale"""'], {'kwargs': "{'sale_id': 1000}"}), "('invoice_to_sale', kwargs={'sale_id': 1000})\n", (389, 434), False, 'from djang... |
from setuptools import setup
if __name__ == "__main__":
setup(name="deepsky",
version="0.1",
description="Deep learning on storm and random field data",
author="<NAME>",
author_email="<EMAIL>",
license="MIT",
url="https://github.com/djgagne/deepsky",
... | [
"setuptools.setup"
] | [((61, 439), 'setuptools.setup', 'setup', ([], {'name': '"""deepsky"""', 'version': '"""0.1"""', 'description': '"""Deep learning on storm and random field data"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'license': '"""MIT"""', 'url': '"""https://github.com/djgagne/deepsky"""', 'packages': "['deeps... |
# Generated by Django 3.2.10 on 2022-02-12 18:50
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("projects", "0008_alter_work_status"),
]
operations = [
migrations.AlterField(
model_name="proj... | [
"django.db.models.ForeignKey",
"django.db.models.IntegerField"
] | [((378, 500), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'related_name': '"""project_members"""', 'to': '"""projects.project"""'}), "(on_delete=django.db.models.deletion.CASCADE, related_name\n ='project_members', to='projects.project')\n", (395, 500),... |
# Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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... | [
"weasyprint.CSS",
"os.path.dirname",
"os.path.isfile",
"weasyprint.HTML",
"qf_lib.common.utils.logging.qf_parent_logger.qf_logger.getChild",
"qf_lib.starting_dir.get_starting_dir_abs_path",
"os.path.join",
"os.listdir"
] | [((1959, 2002), 'qf_lib.common.utils.logging.qf_parent_logger.qf_logger.getChild', 'qf_logger.getChild', (['self.__class__.__name__'], {}), '(self.__class__.__name__)\n', (1977, 2002), False, 'from qf_lib.common.utils.logging.qf_parent_logger import qf_logger\n'), ((3923, 3957), 'os.path.join', 'os.path.join', (['outpu... |
"""
Demonstrates how to perform live view of difference data, video, and fft of
dual-frame video.
Visualization takes place during the iteration over the iterator contructed
with the play function. Note that you can use the video for further processing
(correlation analysis)
"""
from conf import SHAPE, NFRAMES, BACK... | [
"cddm.video.show_diff",
"cddm.video.play",
"cddm.video.multiply",
"cddm.conf.set_showlib",
"cddm.video.show_video",
"cddm.video.show_fft",
"matplotlib.pyplot.imread"
] | [((826, 847), 'cddm.video.multiply', 'multiply', (['video', 'dust'], {}), '(video, dust)\n', (834, 847), False, 'from cddm.video import show_video, show_fft, play, show_diff, multiply\n'), ((857, 874), 'cddm.video.show_video', 'show_video', (['video'], {}), '(video)\n', (867, 874), False, 'from cddm.video import show_v... |
import os
import shutil
import logging
import tempfile
import re
from datetime import datetime
from zipfile import ZipFile
logger = logging.getLogger(__name__)
def is_folder(source):
return os.path.isdir(source)
def is_zipfile(source):
return os.path.isfile(source) and source.endswith(".zip")
def xml_fil... | [
"zipfile.ZipFile",
"os.makedirs",
"os.path.basename",
"os.path.isdir",
"os.path.getsize",
"os.path.dirname",
"datetime.datetime.utcnow",
"os.path.isfile",
"tempfile.mkdtemp",
"os.path.splitext",
"re.search",
"shutil.rmtree",
"os.path.join",
"os.listdir",
"logging.getLogger"
] | [((133, 160), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (150, 160), False, 'import logging\n'), ((197, 218), 'os.path.isdir', 'os.path.isdir', (['source'], {}), '(source)\n', (210, 218), False, 'import os\n'), ((537, 553), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (547,... |
import numpy as np
from typing import List, Any
import cv2
from skimage.exposure import rescale_intensity, adjust_sigmoid
from skimage.util import invert, img_as_float, img_as_ubyte
def fg_pts(mask: np.ndarray):
"""
:param mask: binary image, 2D numpy array
:return: 2 * n numpy array
Retrieves coordi... | [
"skimage.exposure.adjust_sigmoid",
"cv2.cvtColor",
"skimage.util.img_as_ubyte",
"numpy.asarray",
"skimage.util.invert",
"skimage.exposure.rescale_intensity",
"numpy.arccos",
"cv2.blur",
"numpy.min",
"numpy.max",
"numpy.linalg.norm",
"cv2.drawContours",
"numpy.dot",
"skimage.util.img_as_flo... | [((533, 548), 'numpy.asarray', 'np.asarray', (['pts'], {}), '(pts)\n', (543, 548), True, 'import numpy as np\n'), ((718, 732), 'numpy.dot', 'np.dot', (['v1', 'v2'], {}), '(v1, v2)\n', (724, 732), True, 'import numpy as np\n'), ((1552, 1604), 'cv2.drawContours', 'cv2.drawContours', (['mask', 'contour', '(-1)', '(255)', ... |
# Info from this
# https://stackoverflow.com/questions/12303478/how-to-customize-user-profile-when-using-django-allauth/12308807#12308807
# http://notesbyanerd.com/2015/12/19/joint-login-and-signup-django-allauth-view/
from django import forms
from allauth.account.forms import LoginForm, SignupForm
class MyLoginForm(L... | [
"django.forms.UUIDField",
"django.forms.FloatField",
"django.forms.TextInput",
"django.forms.PasswordInput",
"django.forms.NumberInput",
"django.forms.EmailInput",
"django.forms.HiddenInput",
"django.forms.CharField"
] | [((1161, 1217), 'django.forms.CharField', 'forms.CharField', ([], {'max_length': '(100)', 'label': '"""Restaurant Name"""'}), "(max_length=100, label='Restaurant Name')\n", (1176, 1217), False, 'from django import forms\n'), ((1229, 1272), 'django.forms.FloatField', 'forms.FloatField', ([], {'label': '"""Longitud posit... |
import discord, os, asyncio
from discord.ext import commands
from QuentiumBot import HandleData, get_translations
# Basic command configs
cmd_name = "showideas"
tran = get_translations()
aliases = [] if not tran[cmd_name]["fr"]["aliases"] else tran[cmd_name]["fr"]["aliases"].split("/")
class ShowIdeasQuentium(command... | [
"discord.ext.commands.command",
"discord.Embed",
"asyncio.sleep",
"QuentiumBot.get_translations",
"os.path.isfile",
"QuentiumBot.HandleData.retrieve_data",
"discord.ext.commands.is_owner"
] | [((169, 187), 'QuentiumBot.get_translations', 'get_translations', ([], {}), '()\n', (185, 187), False, 'from QuentiumBot import HandleData, get_translations\n'), ((450, 517), 'discord.ext.commands.command', 'commands.command', ([], {'name': 'cmd_name', 'aliases': 'aliases', 'pass_context': '(True)'}), '(name=cmd_name, ... |
from frappe import _
def get_data():
return {
'fieldname': 'service_job_card',
'internal_links': {
'Maintenance Request': ['items', 'maintenance_request']
},
'transactions': [
{
'label': _('Related'),
'items': ['Maintenance Request', 'Sales Invoice']
},
]
}
| [
"frappe._"
] | [((207, 219), 'frappe._', '_', (['"""Related"""'], {}), "('Related')\n", (208, 219), False, 'from frappe import _\n')] |
# -*- coding: utf-8 -*-
"""Utils package contains helper functions for the SDK API
Copyright 2020, Gradient Zero
All rights reserved
"""
from uuid import UUID
def is_valid_uuid(uuid_to_test, version=4):
"""Check if uuid_to_test is a valid UUID."""
try:
uuid_obj = UUID(uuid_to_test, version=version)
... | [
"uuid.UUID"
] | [((284, 319), 'uuid.UUID', 'UUID', (['uuid_to_test'], {'version': 'version'}), '(uuid_to_test, version=version)\n', (288, 319), False, 'from uuid import UUID\n')] |
import numpy as np
from lightfm.datasets import fetch_movielens
from lightfm import LightFM
data = fetch_movielens(min_rating = 4.0)
model = LightFM(loss = 'warp')
model.fit(data['train'], epochs=30, num_threads=2)
def sample_recommendation(model, data, user_ids):
n_users, n_items = data['train'].shape
for ... | [
"numpy.argsort",
"lightfm.LightFM",
"lightfm.datasets.fetch_movielens",
"numpy.arange"
] | [((100, 131), 'lightfm.datasets.fetch_movielens', 'fetch_movielens', ([], {'min_rating': '(4.0)'}), '(min_rating=4.0)\n', (115, 131), False, 'from lightfm.datasets import fetch_movielens\n'), ((143, 163), 'lightfm.LightFM', 'LightFM', ([], {'loss': '"""warp"""'}), "(loss='warp')\n", (150, 163), False, 'from lightfm imp... |
""" Copyright (C) MX4J.
All rights reserved.
This software is distributed under the terms of the MX4J License version 1.0.
See the terms of the MX4J License in the documentation provided with this software.
author <a href="mailto:<EMAIL>"><NAME></a>
version $Revision: 1.1 $
Adapted by Martin Fuzzey f... | [
"sys.add_package",
"javax.management.Attribute",
"java.lang.Boolean"
] | [((569, 604), 'sys.add_package', 'sys.add_package', (['"""javax.management"""'], {}), "('javax.management')\n", (584, 604), False, 'import sys, java\n'), ((606, 649), 'sys.add_package', 'sys.add_package', (['"""javax.management.loading"""'], {}), "('javax.management.loading')\n", (621, 649), False, 'import sys, java\n'... |