code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
import os
from ui import ui
def with_upper_first_letter(string):
return string[0].upper() + string[1:]
def get_size(start_path='.'):
total_size = 0
for dirpath, dirnames, filenames in os.walk(start_path):
for f in filenames:
fp = os.path.join(dirpath, f)
total_size += os.... | [
"os.path.getsize",
"os.walk",
"ui.ui.show",
"ui.ui.get_progress_bar",
"os.path.join"
] | [((200, 219), 'os.walk', 'os.walk', (['start_path'], {}), '(start_path)\n', (207, 219), False, 'import os\n'), ((466, 490), 'ui.ui.get_progress_bar', 'ui.get_progress_bar', (['msg'], {}), '(msg)\n', (485, 490), False, 'from ui import ui\n'), ((1597, 1608), 'ui.ui.show', 'ui.show', (['""""""'], {}), "('')\n", (1604, 160... |
import os
import io
from datetime import date, timedelta
import requests
import pandas as pd
dir_path = os.path.dirname(os.path.realpath(__file__))
def merge_dict(dct):
week_dict = list(dct.values())[0]
vtf_dict = list(dct.values())[1] # vtf = vårdtillfällen
merged_dict = {}
for key in week_dict:
... | [
"requests.post",
"os.path.realpath",
"io.BytesIO"
] | [((121, 147), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (137, 147), False, 'import os\n'), ((936, 982), 'requests.post', 'requests.post', (['url'], {'data': 'data', 'headers': 'headers'}), '(url, data=data, headers=headers)\n', (949, 982), False, 'import requests\n'), ((1006, 1027), 'i... |
"""
This is a helper module to simplify code documentation
"""
import inspect
from io import StringIO
_PARAMETER_MAPPING = {
"store": """
store: callable
Factory function producing a KeyValueStore.""",
"overwrite": """
overwrite: bool, optional
If True, allow overwrite of an existing d... | [
"io.StringIO",
"inspect.signature"
] | [((9630, 9653), 'inspect.signature', 'inspect.signature', (['func'], {}), '(func)\n', (9647, 9653), False, 'import inspect\n'), ((9678, 9692), 'io.StringIO', 'StringIO', (['docs'], {}), '(docs)\n', (9686, 9692), False, 'from io import StringIO\n')] |
# coding: utf-8
pascal_root = '/media/D/DataSet/IS/VOCdevkit/VOC2012'
from utils.pascal_voc import get_augmented_pascal_image_annotation_filename_pairs
from utils.tf_records import write_image_annotation_pairs_to_tfrecord
# Returns a list of (image, annotation) filename pairs (filename.jpg, filename.png)
overall_trai... | [
"utils.tf_records.write_image_annotation_pairs_to_tfrecord",
"utils.pascal_voc.get_augmented_pascal_image_annotation_filename_pairs"
] | [((400, 477), 'utils.pascal_voc.get_augmented_pascal_image_annotation_filename_pairs', 'get_augmented_pascal_image_annotation_filename_pairs', ([], {'pascal_root': 'pascal_root'}), '(pascal_root=pascal_root)\n', (452, 477), False, 'from utils.pascal_voc import get_augmented_pascal_image_annotation_filename_pairs\n'), (... |
import datetime
import json
import webapp2
import logging
from google.appengine.ext import ndb
import models
# Map string identifiers to model properties
PROPS = {
'name': models.Restaurant.dba,
'grade': models.Restaurant.grade,
'boro': models.Restaurant.boro,
'cuisine': models.Restaurant.cuisine_des... | [
"models.Restaurant.boro.IN",
"json.JSONEncoder",
"models.Restaurant.query",
"models.Restaurant.cuisine_description.IN",
"json.dumps",
"logging.info",
"google.appengine.ext.ndb.Key"
] | [((881, 906), 'models.Restaurant.query', 'models.Restaurant.query', ([], {}), '()\n', (904, 906), False, 'import models\n'), ((1898, 1917), 'logging.info', 'logging.info', (['order'], {}), '(order)\n', (1910, 1917), False, 'import logging\n'), ((1962, 1981), 'logging.info', 'logging.info', (['query'], {}), '(query)\n',... |
#!/usr/bin/env python
"""
Usage:
stripsemanticsfromgraphs.py [options] INPUT_GRAPH_JSONL_GZ OUTPUT_TARGET_JSONL_GZ
Options:
-h --help Show this screen.
--debug Enable debug routines. [default: False]
--add-eq-edges Add "eq" edges in the output gra... | [
"nltk.stem.snowball.SnowballStemmer",
"data.utils.iteratate_jsonl_gz",
"docopt.docopt",
"collections.defaultdict",
"nltk.corpus.stopwords.words",
"collections.OrderedDict"
] | [((728, 754), 'nltk.stem.snowball.SnowballStemmer', 'SnowballStemmer', (['"""english"""'], {}), "('english')\n", (743, 754), False, 'from nltk.stem.snowball import SnowballStemmer\n'), ((689, 715), 'nltk.corpus.stopwords.words', 'stopwords.words', (['"""english"""'], {}), "('english')\n", (704, 715), False, 'from nltk.... |
import cv2
import face_recognition as fr
import logging
import numpy as np
import struct
import time
from tornado import gen
from gateway import net, face
from gateway.app import gateway
from gateway.camera.recognizor import recognize_face
from gateway.camera.tracker import track_object
from gateway.fire... | [
"logging.debug",
"gateway.firebase.fcm.notify_all",
"numpy.frombuffer",
"cv2.imdecode",
"struct.pack",
"time.time",
"gateway.net.encode_packet"
] | [((1709, 1740), 'gateway.net.encode_packet', 'net.encode_packet', (['opcode', 'body'], {}), '(opcode, body)\n', (1726, 1740), False, 'from gateway import net, face\n'), ((3159, 3170), 'time.time', 'time.time', ([], {}), '()\n', (3168, 3170), False, 'import time\n'), ((6313, 6324), 'time.time', 'time.time', ([], {}), '(... |
# Generated by Django 2.2.10 on 2020-02-20 19:50
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('database', '0002_auto_20200220_1448'),
]
operations = [
migrations.AlterField(
model_name='cit... | [
"django.db.models.ForeignKey"
] | [((370, 507), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'null': '(True)', 'on_delete': 'django.db.models.deletion.SET_NULL', 'related_name': '"""cities"""', 'to': '"""database.Country"""'}), "(blank=True, null=True, on_delete=django.db.models.\n deletion.SET_NULL, related_name='cit... |
"""
Quick sort.
"""
import random
def partition(A, p, r):
pivot = A[r]
i = p - 1
for j in range(p, r):
if A[j] <= pivot:
i = i + 1
A[i], A[j] = A[j], A[i]
A[i + 1], A[r] = A[r], A[i + 1]
return (i + 1)
def hoare_partition(A, p, r):
pivot = A[p]
i = p - 1
... | [
"random.randint"
] | [((667, 687), 'random.randint', 'random.randint', (['p', 'r'], {}), '(p, r)\n', (681, 687), False, 'import random\n')] |
import os
def ssh_keys():
print("Configuring SSH Keys")
# TODO Check if directory exists
# TDOO Check if directory has the correct permissions
commands = [
"mkdir ~/.ssh",
"chmod 0700 ~/.ssh"
]
for command in commands:
print(command)
# os.system(command)
# TODO Bring config file
# TODO ... | [
"os.system"
] | [((394, 412), 'os.system', 'os.system', (['command'], {}), '(command)\n', (403, 412), False, 'import os\n'), ((780, 798), 'os.system', 'os.system', (['command'], {}), '(command)\n', (789, 798), False, 'import os\n'), ((829, 853), 'os.system', 'os.system', (['"""tfswitch -u"""'], {}), "('tfswitch -u')\n", (838, 853), Fa... |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.10
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (2, 7, 0):
def swi... | [
"_pjsua2.AudioMediaVector_push_back",
"_pjsua2.IntVector_push_back",
"_pjsua2.new_AccountInfo",
"_pjsua2.Call_processStateChange",
"_pjsua2.CodecInfoVector_empty",
"_pjsua2.SslCertNameVector___delitem__",
"_pjsua2.Endpoint_onNatDetectionComplete",
"_pjsua2.SrtpCryptoVector_pop",
"_pjsua2.MediaFormat... | [((196757, 196802), '_pjsua2.AudioMedia_getPortInfoFromId', '_pjsua2.AudioMedia_getPortInfoFromId', (['port_id'], {}), '(port_id)\n', (196793, 196802), False, 'import _pjsua2\n'), ((196924, 196967), '_pjsua2.AudioMedia_typecastFromMedia', '_pjsua2.AudioMedia_typecastFromMedia', (['media'], {}), '(media)\n', (196960, 19... |
import csv, numpy,sys, gzip
#ID_pauses.py reads_percodon_threshold read_length_min read_length_max pc_fasta project_name samples...
background_threshold = float(sys.argv[1])
read_length_min = int(sys.argv[2])
read_length_max = int(sys.argv[3])
pc_fasta = sys.argv[4]
project_name = sys.argv[5]
samples = sys.argv[6:]
... | [
"csv.DictReader",
"numpy.mean",
"gzip.open",
"csv.writer"
] | [((6809, 6838), 'csv.writer', 'csv.writer', (['c'], {'delimiter': '"""\t"""'}), "(c, delimiter='\\t')\n", (6819, 6838), False, 'import csv, numpy, sys, gzip\n'), ((9146, 9175), 'csv.writer', 'csv.writer', (['d'], {'delimiter': '"""\t"""'}), "(d, delimiter='\\t')\n", (9156, 9175), False, 'import csv, numpy, sys, gzip\n'... |
"""
Forward Chaining, K-Fold and Group K-Fold algorithms to split a given training dataset into train (X, y), validation (Xcv, ycv) and test (Xtest, ytest) sets
"""
import numpy as np
def split_train_val_test_forwardChaining(sequence, numInputs, numOutputs, numJumps):
""" Returns sets to train, cross-validate and... | [
"numpy.array",
"numpy.arange"
] | [((8308, 8320), 'numpy.arange', 'np.arange', (['(5)'], {}), '(5)\n', (8317, 8320), True, 'import numpy as np\n'), ((2902, 2916), 'numpy.array', 'np.array', (['X_it'], {}), '(X_it)\n', (2910, 2916), True, 'import numpy as np\n'), ((2934, 2948), 'numpy.array', 'np.array', (['y_it'], {}), '(y_it)\n', (2942, 2948), True, '... |
# -*- coding: utf-8 -*-
# Copyright (C) 2017-2018 <NAME>
# Published under the MIT License
import os
from nose.tools import *
from .util import (quickcall, w, with_sandbox)
checkguard = 'guardonce.checkguard'
def test_help():
stdout, stderr, exitcode = quickcall(checkguard, '--help')
assert_equal(stderr, '')... | [
"os.path.join"
] | [((962, 996), 'os.path.join', 'os.path.join', (['sandbox', '"""missing.h"""'], {}), "(sandbox, 'missing.h')\n", (974, 996), False, 'import os\n')] |
from brownie import accounts, DutchAuction, exceptions, rpc
import pytest, time
def test_deploy():
#Arrange
account = accounts[0]
#Act
dutch_auction = DutchAuction.deploy({"from":account})
start_price = dutch_auction.getCurrentPrice()
expected = 10000
#Assert
assert start_price == ... | [
"pytest.raises",
"brownie.DutchAuction.deploy",
"time.sleep"
] | [((168, 206), 'brownie.DutchAuction.deploy', 'DutchAuction.deploy', (["{'from': account}"], {}), "({'from': account})\n", (187, 206), False, 'from brownie import accounts, DutchAuction, exceptions, rpc\n'), ((469, 507), 'brownie.DutchAuction.deploy', 'DutchAuction.deploy', (["{'from': account}"], {}), "({'from': accoun... |
import time
import logging as _logger
_logger.basicConfig(level='INFO')
class Producer:
""" Define the 'resource-intensive' object to instantiate! """
def produce(self) -> None:
_logger.info('Producer is working hard!')
def meet(self) -> None:
_logger.info('Producer has time to meet you ... | [
"logging.info",
"logging.basicConfig",
"time.sleep"
] | [((39, 72), 'logging.basicConfig', '_logger.basicConfig', ([], {'level': '"""INFO"""'}), "(level='INFO')\n", (58, 72), True, 'import logging as _logger\n'), ((197, 238), 'logging.info', '_logger.info', (['"""Producer is working hard!"""'], {}), "('Producer is working hard!')\n", (209, 238), True, 'import logging as _lo... |
import sys
from darknet import Darknet
from bisenetv2 import BiSeNetV2
from mflops import get_model_compute_info
if __name__ == '__main__':
ost = sys.stdout
try:
# darknet
print("\nDarknet")
model_def = "gesture5_v8.cfg"
model = Darknet(model_def)
flops, mac... | [
"bisenetv2.BiSeNetV2",
"mflops.get_model_compute_info",
"darknet.Darknet"
] | [((276, 294), 'darknet.Darknet', 'Darknet', (['model_def'], {}), '(model_def)\n', (283, 294), False, 'from darknet import Darknet\n'), ((331, 375), 'mflops.get_model_compute_info', 'get_model_compute_info', (['model', '(3, 224, 224)'], {}), '(model, (3, 224, 224))\n', (353, 375), False, 'from mflops import get_model_co... |
def get_entity_type_from_sequence(sequence):
from molsysmt.element.molecule import get_molecule_type_from_sequence
molecule_type = get_molecule_type_from_sequence(sequence)
if molecule_type == 'protein':
return 'protein'
elif molecule_type == 'dna':
return 'dna'
elif molecule_typ... | [
"molsysmt.element.molecule.get_molecule_type_from_sequence"
] | [((142, 183), 'molsysmt.element.molecule.get_molecule_type_from_sequence', 'get_molecule_type_from_sequence', (['sequence'], {}), '(sequence)\n', (173, 183), False, 'from molsysmt.element.molecule import get_molecule_type_from_sequence\n')] |
#! /usr/bin/env python
# This file is part of SATe
# SATe is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distrib... | [
"unittest.TextTestRunner",
"unittest.TestSuite",
"os.path.dirname",
"pkg_resources.resource_filename",
"unittest.defaultTestLoader.loadTestsFromNames",
"os.environ.get",
"pasta.configure.get_configuration",
"os.path.splitext",
"pasta.get_logger",
"os.path.sep.join",
"os.path.join",
"os.listdir... | [((884, 909), 'pasta.get_logger', 'get_logger', (['"""pasta.tests"""'], {}), "('pasta.tests')\n", (894, 909), False, 'from pasta import get_logger\n'), ((1459, 1490), 'os.path.join', 'os.path.join', (['TESTS_DIR', '"""data"""'], {}), "(TESTS_DIR, 'data')\n", (1471, 1490), False, 'import os\n'), ((1510, 1543), 'os.path.... |
import requests
from Bio import SeqIO
import re
import os
fileIDs = open('rosalind_mprt.txt', 'r')
proteinsIDs = list(map(lambda x: x.replace('\n', ''), fileIDs.readlines()))
proteinsDataIDS = []
fileProteins = open("protein_results.txt", "w")
for id in proteinsIDs:
result = requests.get('https://www.uniprot.or... | [
"os.remove",
"Bio.SeqIO.parse",
"re.compile"
] | [((960, 992), 'os.remove', 'os.remove', (['"""protein_results.txt"""'], {}), "('protein_results.txt')\n", (969, 992), False, 'import os\n'), ((569, 612), 'Bio.SeqIO.parse', 'SeqIO.parse', (['"""protein_results.txt"""', '"""fasta"""'], {}), "('protein_results.txt', 'fasta')\n", (580, 612), False, 'from Bio import SeqIO\... |
import codecs
import os
from datetime import datetime
from io import BytesIO
from math import ceil
from zipfile import ZipFile
import scrapy
from jsonpointer import resolve_pointer
from rarfile import RarFile
from kingfisher_scrapy import util
from kingfisher_scrapy.exceptions import (IncoherentConfigurationError, Mi... | [
"kingfisher_scrapy.util.get_file_name_and_extension",
"kingfisher_scrapy.util.add_query_string",
"datetime.datetime.utcnow",
"kingfisher_scrapy.exceptions.MissingNextLinkError",
"kingfisher_scrapy.exceptions.SpiderArgumentError",
"kingfisher_scrapy.items.File",
"kingfisher_scrapy.exceptions.IncoherentCo... | [((12769, 12809), 'scrapy.Request', 'scrapy.Request', (['url'], {'meta': 'meta'}), '(url, meta=meta, **kwargs)\n', (12783, 12809), False, 'import scrapy\n'), ((13638, 13723), 'kingfisher_scrapy.items.File', 'File', (["{'file_name': file_name, 'data': data, 'data_type': data_type, 'url': url}"], {}), "({'file_name': fil... |
from typing import List, cast
import numpy as np
import tensorflow as tf
import gpbasics.MeanFunctionBasics.MeanFunction as mf
import gpbasics.global_parameters as global_param
global_param.ensure_init()
class BaseMeanFunction(mf.MeanFunction):
def __init__(self, manifestation, input_dimensionality: int):
... | [
"tensorflow.reduce_sum",
"tensorflow.subtract",
"tensorflow.add",
"tensorflow.multiply",
"tensorflow.cast",
"tensorflow.Variable",
"tensorflow.zeros",
"tensorflow.divide",
"tensorflow.exp",
"tensorflow.name_scope",
"gpbasics.global_parameters.ensure_init"
] | [((180, 206), 'gpbasics.global_parameters.ensure_init', 'global_param.ensure_init', ([], {}), '()\n', (204, 206), True, 'import gpbasics.global_parameters as global_param\n'), ((6062, 6126), 'tensorflow.Variable', 'tf.Variable', (['np.e'], {'dtype': 'global_param.p_dtype', 'shape': 'hyp_dims[2]'}), '(np.e, dtype=global... |
"""
g_directions.py Google Directions API wrapper,
based on https://pypi.python.org/pypi/google.directions by D9T GmbH, <NAME>.
"""
import urllib, urllib2
import json
class GoogleDirections(object):
url="http://maps.googleapis.com/maps/api/directions/json?origin=%s&destination=%s&sensor=false&"
de... | [
"json.loads",
"urllib.quote",
"urllib2.Request",
"urllib.urlencode",
"urllib2.urlopen"
] | [((908, 943), 'urllib2.Request', 'urllib2.Request', (['url', 'None', 'headers'], {}), '(url, None, headers)\n', (923, 943), False, 'import urllib, urllib2\n'), ((1008, 1023), 'json.loads', 'json.loads', (['res'], {}), '(res)\n', (1018, 1023), False, 'import json\n'), ((868, 893), 'urllib.urlencode', 'urllib.urlencode',... |
import cv2
import math
import vis.display as dsp
def resize_img(img, fx=.5, fy=.5, interpolation=cv2.INTER_LINEAR):
"""
Resize an image so e. g. it can be displayed fully on the screen.
:param img:
:param fx: scaling factor in x
:param fy: scaling factor in y
:param interpolation:
:retu... | [
"math.ceil",
"cv2.copyMakeBorder",
"math.floor",
"vis.display.get_screen_dims",
"cv2.resize"
] | [((344, 408), 'cv2.resize', 'cv2.resize', (['img', 'None'], {'fx': 'fx', 'fy': 'fy', 'interpolation': 'interpolation'}), '(img, None, fx=fx, fy=fy, interpolation=interpolation)\n', (354, 408), False, 'import cv2\n'), ((715, 736), 'vis.display.get_screen_dims', 'dsp.get_screen_dims', ([], {}), '()\n', (734, 736), True, ... |
# -*- coding: utf-8 -*-
# Inspired by:
# https://docs.djangoproject.com/en/1.9/ref/migration-operations/#runpython
# http://clld.org/2015/11/13/glottocode-to-isocode.html
from __future__ import unicode_literals, print_function
from django.db import migrations
# data :: [{name :: String, meanings :: [{id :: Int, name :... | [
"django.db.migrations.RunPython"
] | [((18479, 18528), 'django.db.migrations.RunPython', 'migrations.RunPython', (['forwards_func', 'reverse_func'], {}), '(forwards_func, reverse_func)\n', (18499, 18528), False, 'from django.db import migrations\n')] |
import datetime
from archon.brokerservice.brokerservice import Brokerservice
import archon.exchange.bitmex.bitmex as bitmex
import archon.exchange.exchanges as exc
import pandas as pd
import numpy
import matplotlib.pyplot as plt
#from arctic import Arctic
from boto3 import client
import boto3
import requests
import j... | [
"pandas.DataFrame",
"boto3.client",
"pandas.read_csv",
"archon.brokerservice.brokerservice.Brokerservice",
"json.dumps",
"boto3.resource",
"pandas.qcut",
"datetime.datetime.now"
] | [((363, 378), 'archon.brokerservice.brokerservice.Brokerservice', 'Brokerservice', ([], {}), '()\n', (376, 378), False, 'from archon.brokerservice.brokerservice import Brokerservice\n'), ((1577, 1595), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (1589, 1595), False, 'import boto3\n'), ((770, 793), '... |
import numpy as np
import pandas as pd
def count_rows_null(df):
return df.isnull().shape(0)
def median(col):
return np.median(col.values)
def average(col):
return np.average(col.values)
""" All types """
def count_not_null(col):
return np.count_nonzero(~np.isnan(data))
def count_null(col):
... | [
"numpy.median",
"numpy.average",
"numpy.isnan"
] | [((128, 149), 'numpy.median', 'np.median', (['col.values'], {}), '(col.values)\n', (137, 149), True, 'import numpy as np\n'), ((181, 203), 'numpy.average', 'np.average', (['col.values'], {}), '(col.values)\n', (191, 203), True, 'import numpy as np\n'), ((280, 294), 'numpy.isnan', 'np.isnan', (['data'], {}), '(data)\n',... |
# -*- coding: utf-8 -*-
#
# Implementation by <NAME>,
# hereby denoted as "the implementer".
#
# To the extent possible under law, the implementer has waived all copyright
# and related or neighboring rights to the source code in this file.
# http://creativecommons.org/publicdomain/zero/1.0/
#
import random
import si... | [
"random.randint",
"sidh_fp2.sidh_fp2"
] | [((14847, 14872), 'random.randint', 'random.randint', (['(0)', '(oa - 1)'], {}), '(0, oa - 1)\n', (14861, 14872), False, 'import random\n'), ((14888, 14913), 'random.randint', 'random.randint', (['(0)', '(ob - 1)'], {}), '(0, ob - 1)\n', (14902, 14913), False, 'import random\n'), ((15572, 15596), 'sidh_fp2.sidh_fp2', '... |
import glob
from libmproxy import utils, script
from libmproxy.proxy import config
import tservers
def test_load_scripts():
example_dir = utils.Data("libmproxy").path("../examples")
scripts = glob.glob("%s/*.py" % example_dir)
tmaster = tservers.TestMaster(config.ProxyConfig())
for f in scripts:
... | [
"libmproxy.proxy.config.ProxyConfig",
"libmproxy.utils.Data",
"libmproxy.script.Script",
"glob.glob"
] | [((201, 235), 'glob.glob', 'glob.glob', (["('%s/*.py' % example_dir)"], {}), "('%s/*.py' % example_dir)\n", (210, 235), False, 'import glob\n'), ((271, 291), 'libmproxy.proxy.config.ProxyConfig', 'config.ProxyConfig', ([], {}), '()\n', (289, 291), False, 'from libmproxy.proxy import config\n'), ((561, 586), 'libmproxy.... |
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
from lldbsuite.test_event.build_exception import BuildError
class TestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
NO_DEBUG_INFO_TESTCASE = True
def build_and_run(sel... | [
"lldb.SBFileSpec"
] | [((1683, 1709), 'lldb.SBFileSpec', 'lldb.SBFileSpec', (['test_file'], {}), '(test_file)\n', (1698, 1709), False, 'import lldb\n')] |
# -*- coding: utf-8 -*-
"""
@author: <NAME>, University of Lisbon
"""
import numpy as np
import scipy.linalg as lalg
# =============================================================================
# svect module for basic quantum operations using Dirac's bra-ket notation
# and NumPy's matrices
# =========... | [
"scipy.linalg.logm",
"numpy.matrix",
"numpy.binary_repr",
"numpy.trace",
"numpy.outer",
"numpy.log",
"numpy.sin",
"numpy.exp",
"numpy.real",
"numpy.cos",
"numpy.kron",
"numpy.dot",
"numpy.asscalar",
"numpy.sqrt"
] | [((1940, 1961), 'numpy.matrix', 'np.matrix', (['amplitudes'], {}), '(amplitudes)\n', (1949, 1961), True, 'import numpy as np\n'), ((3790, 3817), 'numpy.matrix', 'np.matrix', (['[[0, 1], [1, 0]]'], {}), '([[0, 1], [1, 0]])\n', (3799, 3817), True, 'import numpy as np\n'), ((3909, 3943), 'numpy.matrix', 'np.matrix', (['[[... |
from frontend import Renderer, WidgetHandler, COLOR_FONDO, COLOR_TEXTO
from frontend.globals.textrect import render_textrect
from backend.eventhandler import EventHandler
from .basewidget import BaseWidget
from pygame import font, Rect
class Label(BaseWidget):
def __init__(self, name, text, x, y):
self.x,... | [
"frontend.globals.textrect.render_textrect",
"pygame.font.SysFont",
"frontend.Renderer.add_widget",
"pygame.Rect",
"frontend.WidgetHandler.add_widget",
"backend.eventhandler.EventHandler.register"
] | [((377, 404), 'pygame.font.SysFont', 'font.SysFont', (['"""Verdana"""', '(16)'], {}), "('Verdana', 16)\n", (389, 404), False, 'from pygame import font, Rect\n'), ((511, 556), 'backend.eventhandler.EventHandler.register', 'EventHandler.register', (['self.show', '"""show_text"""'], {}), "(self.show, 'show_text')\n", (532... |
#!/usr/bin/python
import unittest
import math
#import logging
#logging.basicConfig(level = logging.DEBUG)
from gi.repository import Vips
Vips.leak_set(True)
# an expanding zip ... if either of the args is a scalar or a one-element list,
# duplicate it down the other side
def zip_expand(x, y):
# handle single... | [
"gi.repository.Vips.Image.eye",
"gi.repository.Vips.Image.mask_gaussian_band",
"gi.repository.Vips.Image.mask_butterworth_band",
"gi.repository.Vips.Image.black",
"gi.repository.Vips.Image.mask_gaussian",
"gi.repository.Vips.Image.mask_ideal_band",
"gi.repository.Vips.leak_set",
"gi.repository.Vips.Im... | [((142, 161), 'gi.repository.Vips.leak_set', 'Vips.leak_set', (['(True)'], {}), '(True)\n', (155, 161), False, 'from gi.repository import Vips\n'), ((16086, 16101), 'unittest.main', 'unittest.main', ([], {}), '()\n', (16099, 16101), False, 'import unittest\n'), ((1085, 1111), 'gi.repository.Vips.Image.black', 'Vips.Ima... |
from random import random
class MorrisCounter:
counter = 0
def add(self, *args):
if random() < 1.0 / (2 ** self.counter):
self.counter += 1
def __len__(self):
return int(2 ** self.counter)
| [
"random.random"
] | [((103, 111), 'random.random', 'random', ([], {}), '()\n', (109, 111), False, 'from random import random\n')] |
# Generated by Django 3.1.7 on 2021-03-13 15:38
from django.db import migrations, models
import django.db.models.deletion
import guests.models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Party',
... | [
"django.db.models.TextField",
"django.db.models.NullBooleanField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.DateTimeField"
] | [((355, 448), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (371, 448), False, 'from django.db import migrations, models\... |
from fastapi import APIRouter, Depends
from starlette.exceptions import HTTPException
from starlette.status import (
HTTP_200_OK,
HTTP_201_CREATED,
HTTP_400_BAD_REQUEST,
HTTP_404_NOT_FOUND,
)
from models.product import req_product
from crud.product import get_pid, get_product, get_product_nodict, get_p... | [
"crud.product.get_products",
"crud.product.put_product",
"crud.product.get_products_nodict",
"crud.product.scrape_product",
"starlette.exceptions.HTTPException",
"crud.product.get_pid",
"crud.product.get_product",
"crud.product.get_product_nodict",
"fastapi.Depends",
"crud.product.update_product",... | [((466, 477), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (475, 477), False, 'from fastapi import APIRouter, Depends\n'), ((563, 584), 'fastapi.Depends', 'Depends', (['get_database'], {}), '(get_database)\n', (570, 584), False, 'from fastapi import APIRouter, Depends\n'), ((773, 794), 'fastapi.Depends', 'Depend... |
"""
Django settings for project project.
Generated by 'django-admin startproject' using Django 1.9.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
im... | [
"os.path.abspath",
"logging.getLogger",
"os.environ.get",
"os.path.join",
"dj_database_url.config"
] | [((366, 393), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (383, 393), False, 'import logging\n'), ((2948, 2972), 'dj_database_url.config', 'dj_database_url.config', ([], {}), '()\n', (2970, 2972), False, 'import dj_database_url\n'), ((4156, 4193), 'os.path.join', 'os.path.join', (['BAS... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
try:
from django.urls import reverse
except ImportError:
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
from django.views.generic import (
ListView,
View,
)
from django.views.generic.... | [
"django.http.HttpResponse",
"django.core.urlresolvers.reverse"
] | [((1320, 1334), 'django.http.HttpResponse', 'HttpResponse', ([], {}), '()\n', (1332, 1334), False, 'from django.http import HttpResponseRedirect, HttpResponse\n'), ((1635, 1649), 'django.http.HttpResponse', 'HttpResponse', ([], {}), '()\n', (1647, 1649), False, 'from django.http import HttpResponseRedirect, HttpRespons... |
# Copyright (C) 2016 <NAME>. Also uses code from <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This progr... | [
"lib.cuckoo.common.abstracts.Signature.__init__"
] | [((1150, 1191), 'lib.cuckoo.common.abstracts.Signature.__init__', 'Signature.__init__', (['self', '*args'], {}), '(self, *args, **kwargs)\n', (1168, 1191), False, 'from lib.cuckoo.common.abstracts import Signature\n'), ((2726, 2767), 'lib.cuckoo.common.abstracts.Signature.__init__', 'Signature.__init__', (['self', '*ar... |
import numpy as np
import matplotlib.pyplot as plt
from column_01 import Column
from pump_01 import Pump
from sample_01 import Sample
from interaction_01 import Interaction
from calculation_current import Simu
#from calculation_old_versions.calculation_13_fast import Simu
import time
import matplotlib.animation as ani... | [
"interaction_01.Interaction",
"matplotlib.pyplot.clf",
"pump_01.Pump",
"matplotlib.pyplot.legend",
"numpy.ones",
"time.time",
"matplotlib.animation.FuncAnimation",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.figure",
"numpy.product",
"numpy.linspace",
"column_01.Column",
"itertools.cyc... | [((356, 379), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (369, 379), True, 'import matplotlib.pyplot as plt\n'), ((1359, 1371), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (1369, 1371), True, 'import matplotlib.pyplot as plt\n'), ((1430, 1440), 'itertools.cyc... |
import dearpypixl.appitems.plotting
from dearpypixl.appitems.plotting import *
from typing import Any, Callable
from dearpygui import dearpygui as dpg
__all__ = [
*dearpypixl.appitems.plotting.__all__,
"PlotAxisX",
"PlotAxisY",
]
class PlotAxis(PlotAxis):
@property
def axis_limits(self) -> tupl... | [
"dearpygui.dearpygui.reset_axis_ticks",
"dearpygui.dearpygui.set_axis_ticks",
"dearpygui.dearpygui.fit_axis_data",
"dearpygui.dearpygui.set_axis_limits_auto",
"dearpygui.dearpygui.get_axis_limits",
"dearpygui.dearpygui.set_axis_limits"
] | [((352, 382), 'dearpygui.dearpygui.get_axis_limits', 'dpg.get_axis_limits', (['self._tag'], {}), '(self._tag)\n', (371, 382), True, 'from dearpygui import dearpygui as dpg\n'), ((635, 665), 'dearpygui.dearpygui.get_axis_limits', 'dpg.get_axis_limits', (['self._tag'], {}), '(self._tag)\n', (654, 665), True, 'from dearpy... |
#!/usr/bin/env python3
import json
import os
import sys
TEMPLATES_JSON_PATH = os.path.join(os.getcwd(), 'src', 'dynamic-templates.json')
TEMPLATES_JSON = json.load(open(TEMPLATES_JSON_PATH))
def process_chapter(ch):
for d in TEMPLATES_JSON:
ch['content'] = ch['content'].replace(d['template'], d['fallback'])
... | [
"os.getcwd",
"json.dump",
"json.load",
"sys.exit"
] | [((594, 614), 'json.load', 'json.load', (['sys.stdin'], {}), '(sys.stdin)\n', (603, 614), False, 'import json\n'), ((803, 830), 'json.dump', 'json.dump', (['book', 'sys.stdout'], {}), '(book, sys.stdout)\n', (812, 830), False, 'import json\n'), ((93, 104), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (102, 104), False, ... |
from stack_1 import Stack
print("\nLet's play Towers of Hanoi!!")
#Create the Stacks
stacks = []
left_stack = Stack("Left")
right_stack = Stack("Right")
middle_stack = Stack("Middle")
stacks.append(left_stack)
stacks.append(middle_stack)
stacks.append(right_stack)
#Set up the Game
num_disks = int(input("\nHow many... | [
"stack_1.Stack"
] | [((113, 126), 'stack_1.Stack', 'Stack', (['"""Left"""'], {}), "('Left')\n", (118, 126), False, 'from stack_1 import Stack\n'), ((141, 155), 'stack_1.Stack', 'Stack', (['"""Right"""'], {}), "('Right')\n", (146, 155), False, 'from stack_1 import Stack\n'), ((171, 186), 'stack_1.Stack', 'Stack', (['"""Middle"""'], {}), "(... |
from slackbot.bot import listen_to
import re
pastmsg = ''
pastmsg2 = ''
@listen_to(r'.+')
def savemsg(message):
global pastmsg2
global pastmsg
pastmsg2 = pastmsg
pastmsg = message.body['text']
@listen_to(r'^s/+\S+/+\S+/$')
def replace(message):
before = re.findall(r'^s/(.*)/+\S+/', pastmsg)
a... | [
"slackbot.bot.listen_to",
"re.findall"
] | [((75, 90), 'slackbot.bot.listen_to', 'listen_to', (['""".+"""'], {}), "('.+')\n", (84, 90), False, 'from slackbot.bot import listen_to\n'), ((213, 242), 'slackbot.bot.listen_to', 'listen_to', (['"""^s/+\\\\S+/+\\\\S+/$"""'], {}), "('^s/+\\\\S+/+\\\\S+/$')\n", (222, 242), False, 'from slackbot.bot import listen_to\n'),... |
from POC import app
from celery.schedules import crontab
from celery.schedules import schedule
from redbeat import RedBeatSchedulerEntry
import random
interval = schedule(run_every=30) # seconds
entry = RedBeatSchedulerEntry('POC.add', 'POC.add', interval, app=app, args=[random.randint(1, 1000), random.randint(1,1000... | [
"celery.schedules.schedule",
"random.randint"
] | [((163, 185), 'celery.schedules.schedule', 'schedule', ([], {'run_every': '(30)'}), '(run_every=30)\n', (171, 185), False, 'from celery.schedules import schedule\n'), ((274, 297), 'random.randint', 'random.randint', (['(1)', '(1000)'], {}), '(1, 1000)\n', (288, 297), False, 'import random\n'), ((299, 322), 'random.rand... |
print('imp1')
import Twitter_Depression_Detection # Reads the input and the training sets
from Twitter_Depression_Detection import Reader
print('imp2')
import SVM # Implements SVM classification
print('imp2.1')
import nltk
nltk.download('punkt')
'''
import NaiveBayes # Implements Naive Bayes Classification
''... | [
"SVM.svm_func",
"VotingEnsembles.Voting_Ensembles",
"Twitter_Depression_Detection.Reader",
"KNeighbors.K_Neighbors",
"nltk.download",
"SVM.svm_func2"
] | [((230, 252), 'nltk.download', 'nltk.download', (['"""punkt"""'], {}), "('punkt')\n", (243, 252), False, 'import nltk\n'), ((1391, 1399), 'Twitter_Depression_Detection.Reader', 'Reader', ([], {}), '()\n', (1397, 1399), False, 'from Twitter_Depression_Detection import Reader\n'), ((2999, 3119), 'SVM.svm_func', 'SVM.svm_... |
import os
import numpy as np
import tensorflow as tf
from PIL import Image
tf.app.flags.DEFINE_string('directory', '/home/ubuntu','''Directory to save tf recordfile''')
FLAGS = tf.app.flags.FLAGS
# Parameters
num_classes = 10
IMAGE_SIZE = 32
IMAGE_SHAPE = [IMAGE_SIZE, IMAGE_SIZE, 3]
def _int64_feature(value):
r... | [
"tensorflow.train.BytesList",
"tensorflow.python_io.TFRecordWriter",
"tensorflow.train.Int64List",
"numpy.asarray",
"PIL.Image.open",
"numpy.array",
"tensorflow.app.flags.DEFINE_string",
"os.path.join"
] | [((79, 173), 'tensorflow.app.flags.DEFINE_string', 'tf.app.flags.DEFINE_string', (['"""directory"""', '"""/home/ubuntu"""', '"""Directory to save tf recordfile"""'], {}), "('directory', '/home/ubuntu',\n 'Directory to save tf recordfile')\n", (105, 173), True, 'import tensorflow as tf\n'), ((664, 714), 'os.path.join... |
import requests
import pandas as pd
import json
from datetime import datetime
# generate filepath relative to script location
scriptPath = __file__
path = scriptPath[:-28] + '/data/'
filepath = path + 'defichainPromoData.csv'
# API request for promo posts
link='https://api.defichain-promo.com/v1/posts'
siteContent ... | [
"json.loads",
"pandas.read_csv",
"pandas.Series",
"requests.get",
"datetime.datetime.now"
] | [((322, 340), 'requests.get', 'requests.get', (['link'], {}), '(link)\n', (334, 340), False, 'import requests\n'), ((356, 384), 'json.loads', 'json.loads', (['siteContent.text'], {}), '(siteContent.text)\n', (366, 384), False, 'import json\n'), ((478, 496), 'requests.get', 'requests.get', (['link'], {}), '(link)\n', (4... |
from webtest import TestApp
import resumable
def test_resumable_check():
app = TestApp(resumable.app)
assert app.get('/upload', params={'resumableFilename':'test.ogg'}).status == '200 OK' # fetch a page successfully
| [
"webtest.TestApp"
] | [((86, 108), 'webtest.TestApp', 'TestApp', (['resumable.app'], {}), '(resumable.app)\n', (93, 108), False, 'from webtest import TestApp\n')] |
import re
import pytest
from asynch.proto.connection import Connection
conn = Connection()
@pytest.mark.asyncio
async def test_connect():
await conn.connect()
assert conn.connected
assert conn.server_info.name == "ClickHouse"
assert conn.server_info.timezone == "UTC"
assert re.match(r"\w+", con... | [
"asynch.proto.connection.Connection",
"re.match"
] | [((81, 93), 'asynch.proto.connection.Connection', 'Connection', ([], {}), '()\n', (91, 93), False, 'from asynch.proto.connection import Connection\n'), ((300, 347), 're.match', 're.match', (['"""\\\\w+"""', 'conn.server_info.display_name'], {}), "('\\\\w+', conn.server_info.display_name)\n", (308, 347), False, 'import ... |
from django.contrib import admin
from .models import Journal
# Register your models here.
class JournalAdmin(admin.ModelAdmin):
list_display = [f.name for f in Journal._meta.fields]
admin.site.register(Journal, JournalAdmin)
| [
"django.contrib.admin.site.register"
] | [((190, 232), 'django.contrib.admin.site.register', 'admin.site.register', (['Journal', 'JournalAdmin'], {}), '(Journal, JournalAdmin)\n', (209, 232), False, 'from django.contrib import admin\n')] |
import re
import setuptools
from setuptools import setup
version = ''
with open('fortnite_api/__init__.py') as f:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE).group(1)
if not version:
raise RuntimeError('version is not set')
readme = ''
with open('README.md') as f:... | [
"setuptools.find_packages"
] | [((756, 782), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (780, 782), False, 'import setuptools\n')] |
import time
from json import dumps, loads
from typing import List
from tqdm import tqdm
from ...helpers import GraphQLError, format_result
from ...queries.asset import get_assets
from ...queries.label import get_label
from ...queries.project import get_project
from ..asset import update_properties_in_asset
from .quer... | [
"json.dumps"
] | [((5037, 5058), 'json.dumps', 'dumps', (['json_interface'], {}), '(json_interface)\n', (5042, 5058), False, 'from json import dumps, loads\n'), ((2170, 2191), 'json.dumps', 'dumps', (['json_interface'], {}), '(json_interface)\n', (2175, 2191), False, 'from json import dumps, loads\n')] |
import ast
import os
import random
from subprocess import run, PIPE
import numpy as np
import connect4.Connect4Tree as Tree
from connect4.Connect4Heuristics import heuristic1player, heuristic2
# IMPORTANT to know: when using getCanonicalForm, tokens of the current player are marked with 1
# board given to a player ... | [
"connect4.Connect4Heuristics.heuristic1player",
"numpy.count_nonzero",
"numpy.argmax",
"os.getcwd",
"numpy.logical_not",
"random.choice",
"connect4.Connect4Tree.best_move_alpha_beta",
"connect4.Connect4Heuristics.heuristic2",
"os.chdir"
] | [((1147, 1170), 'numpy.count_nonzero', 'np.count_nonzero', (['board'], {}), '(board)\n', (1163, 1170), True, 'import numpy as np\n'), ((6784, 6828), 'connect4.Connect4Tree.best_move_alpha_beta', 'Tree.best_move_alpha_beta', (['board', 'self.depth'], {}), '(board, self.depth)\n', (6809, 6828), True, 'import connect4.Con... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.core.management import call_command
def load_data(apps, schema_editor):
call_command('loaddata', 'initial_data', app_label='doorstep', verbosity=0)
class Migration(migrations.Migration):
de... | [
"django.db.migrations.RunPython",
"django.db.models.CharField",
"django.db.models.AutoField",
"django.core.management.call_command",
"django.db.models.DateTimeField"
] | [((196, 271), 'django.core.management.call_command', 'call_command', (['"""loaddata"""', '"""initial_data"""'], {'app_label': '"""doorstep"""', 'verbosity': '(0)'}), "('loaddata', 'initial_data', app_label='doorstep', verbosity=0)\n", (208, 271), False, 'from django.core.management import call_command\n'), ((1345, 1376... |
from common.permissions import BFIsAuthenticated
from django.conf import settings
from django.core.exceptions import PermissionDenied
from drf_spectacular.utils import extend_schema
from rest_framework.response import Response
from rest_framework.views import APIView
from users.api.v1.serializers import UserSerializer
... | [
"drf_spectacular.utils.extend_schema",
"rest_framework.response.Response"
] | [((323, 423), 'drf_spectacular.utils.extend_schema', 'extend_schema', ([], {'description': '"""API for retrieving information about the currently logged in user."""'}), "(description=\n 'API for retrieving information about the currently logged in user.')\n", (336, 423), False, 'from drf_spectacular.utils import ext... |
import numpy as np
import string
import pickle
import math
from wordsegment import load, segment
import emoji
import ark_tweet.CMUTweetTagger as ct
from nltk.stem import WordNetLemmatizer
from langdetect import detect
import random
import re
# %%
load() # loads word segment
wordnet_lemmatizer = WordNetLemmatizer()
ma... | [
"re.split",
"nltk.stem.WordNetLemmatizer",
"wordsegment.segment",
"string.punctuation.replace",
"ark_tweet.CMUTweetTagger.runtagger_parse",
"wordsegment.load",
"pickle.load",
"langdetect.detect",
"re.compile"
] | [((248, 254), 'wordsegment.load', 'load', ([], {}), '()\n', (252, 254), False, 'from wordsegment import load, segment\n'), ((298, 317), 'nltk.stem.WordNetLemmatizer', 'WordNetLemmatizer', ([], {}), '()\n', (315, 317), False, 'from nltk.stem import WordNetLemmatizer\n'), ((562, 577), 'pickle.load', 'pickle.load', (['fp'... |
#!/usr/bin/python
import sys
from string_xor import string_xor
from hamming import hamming
from character_frequency import best_xor
def mbxor_keysize(string):
min_dist = 1000000
best_key_length = -1
for key_size in range(2, 41):
normal_dist = 0.0
num_samples = int((len(string) - 1) / key_s... | [
"character_frequency.best_xor",
"hamming.hamming",
"string_xor.string_xor"
] | [((919, 937), 'character_frequency.best_xor', 'best_xor', (['nthbytes'], {}), '(nthbytes)\n', (927, 937), False, 'from character_frequency import best_xor\n'), ((982, 1005), 'string_xor.string_xor', 'string_xor', (['string', 'key'], {}), '(string, key)\n', (992, 1005), False, 'from string_xor import string_xor\n'), ((5... |
import h5py
import numpy as np
from daps.utils.pooling import concat1d
class C3D(object):
"""Simplify interaction with visual enconder (C3D network)
Interface with an HDF5-file where you store the C3D features
of your videos. Each video correspond to a HDF5-group which may have
multiple features ass... | [
"numpy.empty",
"h5py.File",
"numpy.array"
] | [((1928, 1957), 'h5py.File', 'h5py.File', (['self.filename', '"""r"""'], {}), "(self.filename, 'r')\n", (1937, 1957), False, 'import h5py\n'), ((5275, 5303), 'numpy.empty', 'np.empty', (['(n_segments, m, d)'], {}), '((n_segments, m, d))\n', (5283, 5303), True, 'import numpy as np\n'), ((1687, 1716), 'h5py.File', 'h5py.... |
# -*- coding: utf-8 -*-
"""
Set of function for loading image
"""
import tensorflow as tf
from src.config import DIMS_IMAGE
def load_image(image_path: str, preprocess_input=None) -> tf.Tensor:
"""
Load an image
Args:
image_path (str): path of image
preprocess_input(callable): preprocess f... | [
"tensorflow.io.read_file",
"tensorflow.image.resize_with_pad",
"tensorflow.image.decode_image"
] | [((441, 468), 'tensorflow.io.read_file', 'tf.io.read_file', (['image_path'], {}), '(image_path)\n', (456, 468), True, 'import tensorflow as tf\n'), ((481, 521), 'tensorflow.image.decode_image', 'tf.image.decode_image', (['image'], {'channels': '(3)'}), '(image, channels=3)\n', (502, 521), True, 'import tensorflow as tf... |
from tkinter import *
import os
from pathlib import Path
import sys
sys.path.append(os.getcwd())
#globals declarations
local_site = str(Path.home())
local_site_files = list(os.listdir(local_site))
remote_site = 'REMOTE SITE'
root = Tk()
#set title
root.title("FTP Client")
#set default size of screen
root.geometry('905x... | [
"os.getcwd",
"pathlib.Path.home",
"os.listdir"
] | [((84, 95), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (93, 95), False, 'import os\n'), ((136, 147), 'pathlib.Path.home', 'Path.home', ([], {}), '()\n', (145, 147), False, 'from pathlib import Path\n'), ((173, 195), 'os.listdir', 'os.listdir', (['local_site'], {}), '(local_site)\n', (183, 195), False, 'import os\n')] |
import numpy as np
from copy import copy
import pickle
import random
import sys
from timeit import default_timer as timer
class MultiClassSVM:
def __init__(self, train_file="", test_file="", test_file_out="", C=1, model_name="", predict_only=False):
self.predict_only = predict_only
... | [
"numpy.full",
"pickle.dump",
"timeit.default_timer",
"copy.copy",
"numpy.ones",
"pickle.load",
"numpy.array",
"numpy.where",
"sys.exit",
"numpy.concatenate"
] | [((6697, 6704), 'timeit.default_timer', 'timer', ([], {}), '()\n', (6702, 6704), True, 'from timeit import default_timer as timer\n'), ((6781, 6788), 'timeit.default_timer', 'timer', ([], {}), '()\n', (6786, 6788), True, 'from timeit import default_timer as timer\n'), ((1150, 1178), 'pickle.dump', 'pickle.dump', (['sel... |
#
# This script is licensed as public domain.
#
from .utils import PathType, GetFilepath, CheckFilepath, \
FloatToString, Vector3ToString, Vector4ToString, \
WriteXmlFile
from xml.etree import ElementTree
from mathutils import Vector, Quaternion, Matrix
import bpy
import os
impo... | [
"copy.deepcopy",
"mathutils.Quaternion",
"xml.etree.ElementTree.Element",
"mathutils.Vector",
"xml.etree.ElementTree.SubElement",
"logging.getLogger"
] | [((362, 395), 'logging.getLogger', 'logging.getLogger', (['"""ExportLogger"""'], {}), "('ExportLogger')\n", (379, 395), False, 'import logging\n'), ((1325, 1357), 'mathutils.Quaternion', 'Quaternion', (['(1.0, 0.0, 0.0, 0.0)'], {}), '((1.0, 0.0, 0.0, 0.0))\n', (1335, 1357), False, 'from mathutils import Vector, Quatern... |
#!/usr/bin/env python3
# 必要なライブラリをインポート
import sys
import select
import tty
import termios
import rospy
import time
from std_msgs.msg import *
if __name__ == "__main__":
# ROSの設定
rospy.init_node("move_motor")
pub = rospy.Publisher("servo", UInt8, queue_size=1)
rate = rospy.Rate(100)
# キー入力の設定
... | [
"sys.stdin.read",
"termios.tcgetattr",
"rospy.Publisher",
"rospy.Rate",
"time.sleep",
"termios.tcsetattr",
"rospy.is_shutdown",
"select.select",
"rospy.init_node",
"sys.stdin.fileno"
] | [((190, 219), 'rospy.init_node', 'rospy.init_node', (['"""move_motor"""'], {}), "('move_motor')\n", (205, 219), False, 'import rospy\n'), ((230, 275), 'rospy.Publisher', 'rospy.Publisher', (['"""servo"""', 'UInt8'], {'queue_size': '(1)'}), "('servo', UInt8, queue_size=1)\n", (245, 275), False, 'import rospy\n'), ((287,... |
import pygame
import random
class Robot:
__robot_image = pygame.image.load('pic/robot.png')
def __init__(self, x, y):
self.x = x
self.y = y
def get_image(self):
return self.__robot_image
robot = Robot(-1, -1)
butter_image = pygame.image.load('pic/Butter.png')
target_image = py... | [
"pygame.quit",
"random.sample",
"pygame.display.set_mode",
"pygame.event.get",
"pygame.time.delay",
"pygame.init",
"pygame.transform.scale",
"pygame.display.update",
"pygame.image.load",
"pygame.display.set_caption",
"pygame.time.Clock"
] | [((267, 302), 'pygame.image.load', 'pygame.image.load', (['"""pic/Butter.png"""'], {}), "('pic/Butter.png')\n", (284, 302), False, 'import pygame\n'), ((318, 353), 'pygame.image.load', 'pygame.image.load', (['"""pic/target.png"""'], {}), "('pic/target.png')\n", (335, 353), False, 'import pygame\n'), ((63, 97), 'pygame.... |
import subprocess
def setup():
# Install requirements
subprocess.run(["pip3", "install", "-r", "requirements.txt"])
if __name__ == "__main__":
setup() | [
"subprocess.run"
] | [((63, 124), 'subprocess.run', 'subprocess.run', (["['pip3', 'install', '-r', 'requirements.txt']"], {}), "(['pip3', 'install', '-r', 'requirements.txt'])\n", (77, 124), False, 'import subprocess\n')] |
import random
import engine
import jsonpickle as json
clients = {}
def get_update(client_id):
if client_id == None or client_id not in clients:
client_id = random.randint()
def test():
print(json.dumps(engine.game, unpicklable=False)) #you can also try unpicklable = True for more meta information.
print("t... | [
"jsonpickle.dumps",
"random.randint"
] | [((163, 179), 'random.randint', 'random.randint', ([], {}), '()\n', (177, 179), False, 'import random\n'), ((203, 245), 'jsonpickle.dumps', 'json.dumps', (['engine.game'], {'unpicklable': '(False)'}), '(engine.game, unpicklable=False)\n', (213, 245), True, 'import jsonpickle as json\n')] |
import unittest
from unittest.mock import MagicMock
from app.models import Log, Secret
from app.repository import LogRepository
from app.services import LogService
class TestLogService(unittest.TestCase):
TEST_LOG_ID = 123
def setUp(self) -> None:
self.log = Log()
self.log.id = 123
... | [
"unittest.mock.MagicMock",
"app.models.Secret",
"app.models.Log",
"app.repository.LogRepository",
"app.services.LogService"
] | [((280, 285), 'app.models.Log', 'Log', ([], {}), '()\n', (283, 285), False, 'from app.models import Log, Secret\n'), ((375, 397), 'app.repository.LogRepository', 'LogRepository', ([], {'db': 'None'}), '(db=None)\n', (388, 397), False, 'from app.repository import LogRepository\n'), ((523, 560), 'unittest.mock.MagicMock'... |
from bokeh.layouts import column
from bokeh.models import (
Div,
Legend,
Select,
Panel,
RadioButtonGroup,
Tabs,
TextInput,
)
from functools import partial
from plots.model_explorer.plotters.utils.orientation import Orientation
from plots.model_explorer.plotters.utils.text.configuration impor... | [
"functools.partial",
"bokeh.models.Panel",
"bokeh.models.Div",
"plots.model_explorer.plotters.utils.legend.legend_location.LegendLocation.options",
"bokeh.models.TextInput",
"bokeh.models.RadioButtonGroup",
"plots.model_explorer.plotters.utils.text.configuration.TextPropertiesConfiguration",
"bokeh.la... | [((786, 835), 'plots.model_explorer.plotters.utils.text.configuration.TextPropertiesConfiguration', 'TextPropertiesConfiguration', (['self.legend', '"""title"""'], {}), "(self.legend, 'title')\n", (813, 835), False, 'from plots.model_explorer.plotters.utils.text.configuration import TextPropertiesConfiguration\n'), ((9... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'bridge_ui.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWin... | [
"PyQt5.QtWidgets.QComboBox",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QListView",
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QTableWidget",
"PyQt5.QtWidgets.QFrame",
"PyQt5.QtCore.QRect",
"PyQt5.QtWidgets.QStatusBar",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtWidgets.QLineEdit",
"PyQt5.QtGui.QF... | [((417, 446), 'PyQt5.QtWidgets.QWidget', 'QtWidgets.QWidget', (['MainWindow'], {}), '(MainWindow)\n', (434, 446), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((527, 566), 'PyQt5.QtWidgets.QGroupBox', 'QtWidgets.QGroupBox', (['self.centralwidget'], {}), '(self.centralwidget)\n', (546, 566), False, 'from PyQt... |
from functools import lru_cache
from pathlib import Path
from typing import List
import pandas as pd
import numpy as np
NEGATION_WORDS = [
"no",
"not",
"never",
"none",
"nothing",
"nobody",
"neither",
"nowhere",
"hardly",
"scarcely",
"barely",
"doesn’t",
"isn’t",
... | [
"pandas.read_csv",
"functools.lru_cache",
"pathlib.Path"
] | [((839, 851), 'functools.lru_cache', 'lru_cache', (['(1)'], {}), '(1)\n', (848, 851), False, 'from functools import lru_cache\n'), ((1307, 1319), 'functools.lru_cache', 'lru_cache', (['(1)'], {}), '(1)\n', (1316, 1319), False, 'from functools import lru_cache\n'), ((1645, 1657), 'functools.lru_cache', 'lru_cache', (['(... |
from django.conf import settings
from django.core.files.storage import FileSystemStorage
from django.core.validators import RegexValidator
from django.db import models
from account.models import User
from problem.models import Problem
from utils.hash import sha_hash, case_hash
from utils.language import LANG_CHOICE
re... | [
"django.db.models.FileField",
"django.core.files.storage.FileSystemStorage",
"django.db.models.TextField",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.PositiveIntegerField",
"django.db.models.FloatField",
"django.db.models.Boolea... | [((333, 378), 'django.core.files.storage.FileSystemStorage', 'FileSystemStorage', ([], {'location': 'settings.REPO_DIR'}), '(location=settings.REPO_DIR)\n', (350, 378), False, 'from django.core.files.storage import FileSystemStorage\n'), ((445, 484), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto... |
"""
Defines Solver, a class used to wrap various numerical optimizers for finding parameters such that an ansatz circuit is a solution to a target unitary.
"""
import sys
import numpy as np
import scipy as sp
import scipy.optimize
from . import utils, objectives, comparison
from .gatesets import *
from .logging impor... | [
"qsrs.native_from_object",
"numpy.less_equal",
"numpy.log",
"cma.fmin2",
"qsrs.LeastSquares_Jac_SolverNative",
"numpy.random.rand",
"numpy.eye",
"sys.exit"
] | [((1232, 1261), 'numpy.eye', 'np.eye', (['(2)'], {'dtype': '"""complex128"""'}), "(2, dtype='complex128')\n", (1238, 1261), True, 'import numpy as np\n'), ((4780, 4897), 'cma.fmin2', 'cma.fmin2', (['error_func', 'initial_guess', '(0.25)', "{'verb_disp': 0, 'verb_log': 0, 'bounds': [0, 2 * np.pi]}"], {'restarts': '(2)'}... |
import re
import pytest
import stagpy.args
def test_no_args(capsys):
stagpy.args.parse_args([])()
output = capsys.readouterr()
expected = re.compile(
r'StagPy is a tool to.*'
r'Run `stagpy -h` for usage\n$',
flags=re.DOTALL)
assert expected.fullmatch(output.out)
def test_help... | [
"pytest.raises",
"re.compile"
] | [((152, 238), 're.compile', 're.compile', (['"""StagPy is a tool to.*Run `stagpy -h` for usage\\\\n$"""'], {'flags': 're.DOTALL'}), "('StagPy is a tool to.*Run `stagpy -h` for usage\\\\n$', flags=re.\n DOTALL)\n", (162, 238), False, 'import re\n'), ((453, 615), 're.compile', 're.compile', (['"""^usage:.*\\\\nStagPy ... |
#%% Import Dependencies
from IPython.display import display_markdown
from pymaterial import metal_from_library
from pysectprop.extruded import LSection, RectangleSection
from pysectprop import MaterialSection, CompositeSection
#%% Create Section
lsect = LSection(17.6, 1.6, 13.6, 1.6, 3.0)
rsect = RectangleSection(17.6... | [
"pysectprop.CompositeSection",
"pysectprop.extruded.LSection",
"pysectprop.MaterialSection",
"pysectprop.extruded.RectangleSection",
"IPython.display.display_markdown",
"pymaterial.metal_from_library"
] | [((255, 290), 'pysectprop.extruded.LSection', 'LSection', (['(17.6)', '(1.6)', '(13.6)', '(1.6)', '(3.0)'], {}), '(17.6, 1.6, 13.6, 1.6, 3.0)\n', (263, 290), False, 'from pysectprop.extruded import LSection, RectangleSection\n'), ((299, 326), 'pysectprop.extruded.RectangleSection', 'RectangleSection', (['(17.6)', '(1.6... |
from __future__ import annotations
from ctypes.util import find_library
import pylibmagic
def test_run_magic():
import magic
result = magic.from_file(pylibmagic.data / "__init__.py")
assert result
assert result == "Python script, ASCII text executable"
def test_run_magic_fail(monkeypatch):
im... | [
"magic.from_file",
"ctypes.util.find_library"
] | [((147, 195), 'magic.from_file', 'magic.from_file', (["(pylibmagic.data / '__init__.py')"], {}), "(pylibmagic.data / '__init__.py')\n", (162, 195), False, 'import magic\n'), ((391, 439), 'magic.from_file', 'magic.from_file', (["(pylibmagic.data / '__init__.py')"], {}), "(pylibmagic.data / '__init__.py')\n", (406, 439),... |
# coding=utf-8
from django.utils.translation import ugettext_lazy as _
INVOICEITEM_TYPE_CHOICES = (
('I', _('Item')),
('D', _('Discount')),
('R', _('Surcharge')),
)
INVOICEITEM_DR_TYPE_CHOICES = (
('1', _('Value')),
('2', _('Percentage')),
)
BILLING_STATUS = (
('P', _('Pending')),
('R', ... | [
"django.utils.translation.ugettext_lazy"
] | [((112, 121), 'django.utils.translation.ugettext_lazy', '_', (['"""Item"""'], {}), "('Item')\n", (113, 121), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((134, 147), 'django.utils.translation.ugettext_lazy', '_', (['"""Discount"""'], {}), "('Discount')\n", (135, 147), True, 'from django.utils.tr... |
from types import SimpleNamespace
import bson
import pymongo
import pytest
from poptimizer.evolve import store
@pytest.fixture(scope="module", autouse=True)
def set_test_collection():
# noinspection PyProtectedMember
saved_collection = store._COLLECTION
test_collection = saved_collection.database["test"... | [
"poptimizer.evolve.store.BaseField",
"poptimizer.evolve.store.DefaultField",
"poptimizer.evolve.store.GenotypeField",
"pytest.fixture",
"poptimizer.evolve.store.Genotype",
"poptimizer.evolve.store.get_collection",
"pytest.raises",
"bson.ObjectId",
"types.SimpleNamespace",
"poptimizer.evolve.store.... | [((116, 160), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""', 'autouse': '(True)'}), "(scope='module', autouse=True)\n", (130, 160), False, 'import pytest\n'), ((616, 668), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""class"""', 'name': '"""field_instance"""'}), "(scope='class', name='field... |
import pandas as pd
from pandas.tseries.offsets import Day
from .pandas_extensions.holiday import Holiday
from .pandas_extensions.korean_holiday import (
KoreanSolarHoliday,
KoreanLunarHoliday,
alternative_holiday,
childrens_day_alternative_holiday,
last_business_day,
)
# Original precomputed KRX... | [
"pandas.tseries.offsets.Day",
"pandas.Timestamp",
"pandas.to_datetime"
] | [((432, 8112), 'pandas.to_datetime', 'pd.to_datetime', (["['1986-01-01', '1986-01-02', '1986-01-03', '1986-03-10', '1986-05-05',\n '1986-05-16', '1986-06-06', '1986-07-17', '1986-08-15', '1986-09-18',\n '1986-10-01', '1986-10-03', '1986-10-09', '1986-12-25', '1986-12-29',\n '1986-12-30', '1986-12-31', '1987-01... |
import unittest
import zserio
from testutils import getZserioApi
class UnionInt4RangeCheckTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.api = getZserioApi(__file__, "with_range_check_code.zs",
extraArgs=["-withRangeCheckCode"]).union_int4_range_check
... | [
"testutils.getZserioApi",
"zserio.BitStreamWriter"
] | [((1027, 1051), 'zserio.BitStreamWriter', 'zserio.BitStreamWriter', ([], {}), '()\n', (1049, 1051), False, 'import zserio\n'), ((177, 267), 'testutils.getZserioApi', 'getZserioApi', (['__file__', '"""with_range_check_code.zs"""'], {'extraArgs': "['-withRangeCheckCode']"}), "(__file__, 'with_range_check_code.zs', extraA... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Программа: full_unpack_tool
# Назначение: Производит комплекс операций по извлечению текста из распакованных файлов игры
# Версия: 1.0
# Дата: 21.04.17
# Автор: Lenferd (<EMAIL>)
import os
import sys
sys.path.insert(0, os.path.pardir)
from Module... | [
"os.system",
"sys.path.insert"
] | [((273, 307), 'sys.path.insert', 'sys.path.insert', (['(0)', 'os.path.pardir'], {}), '(0, os.path.pardir)\n', (288, 307), False, 'import sys\n'), ((923, 995), 'os.system', 'os.system', (["('python oxenfree_binary_unpack_resources.py ' + dir_with_data)"], {}), "('python oxenfree_binary_unpack_resources.py ' + dir_with_d... |
from skidl import SKIDL, TEMPLATE, Part, Pin, SchLib
SKIDL_lib_version = '0.0.1'
nxp_armmcu = SchLib(tool=SKIDL).add_parts(*[
Part(name='LPC1102UK',dest=TEMPLATE,tool=SKIDL,keywords='ARM, 32bit, CortexM0, M0, NXP, Microcontroller',description='32-bit ARM Cortex-M0 microcontroller, 32kB Flash, 8kB SRAM, UART, ... | [
"skidl.Pin",
"skidl.Part",
"skidl.SchLib"
] | [((96, 114), 'skidl.SchLib', 'SchLib', ([], {'tool': 'SKIDL'}), '(tool=SKIDL)\n', (102, 114), False, 'from skidl import SKIDL, TEMPLATE, Part, Pin, SchLib\n'), ((118568, 118628), 'skidl.Part', 'Part', ([], {'name': '"""LPC2148"""', 'dest': 'TEMPLATE', 'tool': 'SKIDL', 'do_erc': '(True)'}), "(name='LPC2148', dest=TEMPLA... |
"""
File: Draw lines
Name: <NAME>
-----------------------
Users can click anywhere in the window first and that place will have a ball. And users click another place in the window,
then this place and the circle will connect to be a line.
"""
from campy.graphics.gobjects import GOval, GLine
from campy.graph... | [
"campy.gui.events.mouse.onmouseclicked",
"campy.graphics.gobjects.GOval",
"campy.graphics.gwindow.GWindow",
"campy.graphics.gobjects.GLine"
] | [((423, 432), 'campy.graphics.gwindow.GWindow', 'GWindow', ([], {}), '()\n', (430, 432), False, 'from campy.graphics.gwindow import GWindow\n'), ((473, 490), 'campy.graphics.gobjects.GOval', 'GOval', (['SIZE', 'SIZE'], {}), '(SIZE, SIZE)\n', (478, 490), False, 'from campy.graphics.gobjects import GOval, GLine\n'), ((77... |
import sys
import csv
import numpy as np
import statistics
from collections import defaultdict
import copy
import os
from shutil import copyfile
from shutil import rmtree
import glob
import subprocess
import os
import time
knndata = None
def readInData():
global knndata
knndata = np.genfromtxt(sys.argv[1], d... | [
"os.mkdir",
"os.getcwd",
"numpy.savetxt",
"os.walk",
"numpy.genfromtxt",
"os.popen",
"time.sleep",
"shutil.rmtree",
"os.chdir",
"glob.glob1"
] | [((292, 333), 'numpy.genfromtxt', 'np.genfromtxt', (['sys.argv[1]'], {'delimiter': '""","""'}), "(sys.argv[1], delimiter=',')\n", (305, 333), True, 'import numpy as np\n'), ((386, 420), 'numpy.genfromtxt', 'np.genfromtxt', (['data'], {'delimiter': '""","""'}), "(data, delimiter=',')\n", (399, 420), True, 'import numpy ... |
"""
Minimal setup.py for building ctd processing package.
"""
import os
import sys
import glob
import pkg_resources
from setuptools import Extension, setup
import versioneer
# Check Python version.
if sys.version_info < (3, 5):
pip_message = ('This may be due to an out of date pip. '
'Make s... | [
"versioneer.get_version",
"setuptools.setup",
"os.path.dirname",
"versioneer.get_cmdclass",
"pip.__version__.split",
"glob.glob",
"os.path.join",
"sys.exit"
] | [((1223, 1248), 'glob.glob', 'glob.glob', (['"""scripts/*.py"""'], {}), "('scripts/*.py')\n", (1232, 1248), False, 'import glob\n'), ((2542, 2557), 'setuptools.setup', 'setup', ([], {}), '(**config)\n', (2547, 2557), False, 'from setuptools import Extension, setup\n'), ((998, 1009), 'sys.exit', 'sys.exit', (['(1)'], {}... |
#!/usr/bin/env python
import sys
import os
import re
from setuptools import setup, find_packages
DEPS = ['opster>=4.0', 'termcolor==1.1.0']
extra = {}
if sys.version_info[0] >= 3:
extra.update(dict(
use_2to3=True,
convert_2to3_doctests=['nomad/utils.py'],
))
else:
DEPS.append('configpars... | [
"os.path.dirname",
"setuptools.setup",
"setuptools.find_packages"
] | [((1414, 1429), 'setuptools.setup', 'setup', ([], {}), '(**config)\n', (1419, 1429), False, 'from setuptools import setup, find_packages\n'), ((1263, 1278), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (1276, 1278), False, 'from setuptools import setup, find_packages\n'), ((380, 405), 'os.path.dirname... |
from django.contrib import admin
from .models import destinations
# Register your models here.
admin.site.register(destinations) | [
"django.contrib.admin.site.register"
] | [((97, 130), 'django.contrib.admin.site.register', 'admin.site.register', (['destinations'], {}), '(destinations)\n', (116, 130), False, 'from django.contrib import admin\n')] |
from bs4 import BeautifulSoup
import requests
from textblob import TextBlob
import time
import urllib.request
sentimentspath = 'sentimentstext'
def getSentiment(word):
with open(sentimentspath, 'a') as f:
print(word)
url = 'https://www.sparknotes.com/search?q={}'.format(word)
response = requests.get(url)
so... | [
"bs4.BeautifulSoup",
"textblob.TextBlob",
"requests.get"
] | [((297, 314), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (309, 314), False, 'import requests\n'), ((325, 368), 'bs4.BeautifulSoup', 'BeautifulSoup', (['response.text', '"""html.parser"""'], {}), "(response.text, 'html.parser')\n", (338, 368), False, 'from bs4 import BeautifulSoup\n'), ((540, 557), 'reque... |
from flask import Flask, request, render_template, redirect, session, flash, url_for, abort, jsonify, json
from sqlalchemy import create_engine, MetaData, Table, Column, Integer, String, text, select, ForeignKey, exc
from flask_bootstrap import Bootstrap
from flask_cors import CORS, cross_origin
from dbutils import *
f... | [
"flask_cors.CORS",
"flask.Flask",
"flask_cors.cross_origin",
"flask.json.dumps",
"flask.render_template"
] | [((365, 380), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (370, 380), False, 'from flask import Flask, request, render_template, redirect, session, flash, url_for, abort, jsonify, json\n'), ((388, 397), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (392, 397), False, 'from flask_cors import CORS,... |
import unittest
import json
import os
from src.models.organisation import Organisation
from src.models.logo import Logo
class OrganisationModelTest(unittest.TestCase):
"""Organisation Model test cases."""
@classmethod
def setupClass(cls):
try:
organisation = open(os.path.abspath(os.pa... | [
"os.path.dirname",
"json.load",
"src.models.organisation.Organisation.from_json"
] | [((750, 797), 'src.models.organisation.Organisation.from_json', 'Organisation.from_json', (['self', 'self.organisation'], {}), '(self, self.organisation)\n', (772, 797), False, 'from src.models.organisation import Organisation\n'), ((2797, 2844), 'src.models.organisation.Organisation.from_json', 'Organisation.from_json... |
from django.db import models
from django.contrib import admin
# Create your models here.
class food_daily(models.Model):
fid=models.AutoField(primary_key=True)
fname=models.CharField(verbose_name='菜名',max_length=30)
price=models.DecimalField(verbose_name='价格',max_digits=6,decimal_places=2)
f_types=(
... | [
"django.db.models.CharField",
"django.db.models.DecimalField",
"django.db.models.ImageField",
"django.db.models.AutoField"
] | [((131, 165), 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)'}), '(primary_key=True)\n', (147, 165), False, 'from django.db import models\n'), ((176, 226), 'django.db.models.CharField', 'models.CharField', ([], {'verbose_name': '"""菜名"""', 'max_length': '(30)'}), "(verbose_name='菜名', max... |
import os
from random import randint
import random
# Cambio a realizar
cambio = 9
# Denominaciones
monedas = [5, 2, 1]
# El tamaño del cromosoma es el tamaño de la lista de monedas
long_cromosomas = len(monedas)
# Generaciones
Generacion = 30
# Tamaño de población
población = 10
# Clase que define un cromosoma
class C... | [
"random.random",
"random.randint",
"os.system"
] | [((2243, 2261), 'os.system', 'os.system', (['"""clear"""'], {}), "('clear')\n", (2252, 2261), False, 'import os\n'), ((1095, 1126), 'random.randint', 'randint', (['(0)', '(long_cromosomas - 1)'], {}), '(0, long_cromosomas - 1)\n', (1102, 1126), False, 'from random import randint\n'), ((1757, 1772), 'random.random', 'ra... |
from operator import attrgetter
from typing import Callable, Dict, Iterable, Iterator, Tuple, TypeVar, Union
import more_itertools
from esque.io.messages import BinaryMessage, Message
from esque.io.stream_events import EndOfStream, NthMessageRead, StreamEvent
from esque.ruleparser.ruleengine import RuleTree
M = Type... | [
"esque.ruleparser.ruleengine.RuleTree",
"typing.TypeVar",
"operator.attrgetter",
"esque.io.stream_events.NthMessageRead"
] | [((316, 365), 'typing.TypeVar', 'TypeVar', (['"""M"""'], {'bound': 'Union[Message, BinaryMessage]'}), "('M', bound=Union[Message, BinaryMessage])\n", (323, 365), False, 'from typing import Callable, Dict, Iterable, Iterator, Tuple, TypeVar, Union\n'), ((6587, 6620), 'esque.ruleparser.ruleengine.RuleTree', 'RuleTree', (... |
import json
from django.conf import settings
from django.contrib.sites.models import Site
import mock
from nose.tools import eq_
from nose import SkipTest
from pyquery import PyQuery as pq
from products.tests import product
from sumo.tests import TestCase, LocalizingClient
from sumo.urlresolvers import reverse
from ... | [
"pyquery.PyQuery",
"wiki.tests.new_document_data",
"wiki.tests.translated_revision",
"wiki.tests.document",
"wiki.config.VersionMetadata",
"wiki.tests.revision",
"wiki.tests.helpful_vote",
"products.tests.product",
"json.loads",
"wiki.views._document_lock_check",
"wiki.models.HelpfulVoteMetadata... | [((10322, 10368), 'mock.patch.object', 'mock.patch.object', (['Site.objects', '"""get_current"""'], {}), "(Site.objects, 'get_current')\n", (10339, 10368), False, 'import mock\n'), ((1870, 1888), 'products.tests.product', 'product', ([], {'save': '(True)'}), '(save=True)\n', (1877, 1888), False, 'from products.tests im... |
"""
使用socketserver模块创建时间服务器
Version: 0.1
Author: 骆昊
Date: 2018-03-22
"""
from socketserver import TCPServer, StreamRequestHandler
from time import *
class EchoRequestHandler(StreamRequestHandler):
def handle(self):
currtime = localtime(time())
timestr = strftime('%Y-%m-%d %H:%M:%S', currtime)
... | [
"socketserver.TCPServer"
] | [((379, 429), 'socketserver.TCPServer', 'TCPServer', (["('localhost', 6789)", 'EchoRequestHandler'], {}), "(('localhost', 6789), EchoRequestHandler)\n", (388, 429), False, 'from socketserver import TCPServer, StreamRequestHandler\n')] |
# coding: utf-8
# Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | [
"oci.util.formatted_flat_dict"
] | [((2417, 2442), 'oci.util.formatted_flat_dict', 'formatted_flat_dict', (['self'], {}), '(self)\n', (2436, 2442), False, 'from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel\n')] |
import asyncio
import discord
from discord.ext import commands
from discord_slash import SlashContext, cog_ext
from discord_slash.utils.manage_commands import create_choice, create_option
class Help(commands.Cog):
def __init__(self, bot):
self.bot = bot
asyncio.create_task(self.bot.sla... | [
"discord.Colour.blue",
"discord_slash.utils.manage_commands.create_choice",
"discord.Embed",
"discord.ext.commands.Cog.listener"
] | [((2002, 2025), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (2023, 2025), False, 'from discord.ext import commands\n'), ((2114, 2137), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (2135, 2137), False, 'from discord.ext import commands\n'), ((2228, 2... |
# -*- coding: utf-8 -*-
"""
Spyder Editor
Auto: <NAME>.
"""
import cv2
print('Versão da OpenCV: ', cv2.__version__, end='\n\n')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
qtdeLinhas = 1023
qtdeColunas = 1023
W = np.zeros((qtdeLinhas, qtdeColunas, 3))
# plt.figure(figsize=(10, 10))
# plt... | [
"pandas.DataFrame",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.polyfit",
"numpy.polyval",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.close",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.pyplot.pause",
"matplotlib.pyplot.savefig"
] | [((244, 282), 'numpy.zeros', 'np.zeros', (['(qtdeLinhas, qtdeColunas, 3)'], {}), '((qtdeLinhas, qtdeColunas, 3))\n', (252, 282), True, 'import numpy as np\n'), ((2699, 2731), 'pandas.DataFrame', 'pd.DataFrame', (['niveis_cinza_lista'], {}), '(niveis_cinza_lista)\n', (2711, 2731), True, 'import pandas as pd\n'), ((2995,... |
"""The Junction Delta API
The Delta API uses sets of Modification's to build lists of API calls to execute against Confluence in order
to reconcile it with the pages in the local filesystem.
It assumes the wiki space is managed by Junction in its entirety and no other modifications are performed
manually. The Delta ... | [
"uuid.uuid4",
"junction.confluence.models.Space",
"junction.confluence.models.Content",
"junction.markdown.markdown_to_storage",
"junction.confluence.models.ContentBody",
"junction.util.JunctionError",
"junction.confluence.models.Version",
"logging.getLogger"
] | [((2414, 2441), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2431, 2441), False, 'import logging\n'), ((7781, 7959), 'junction.util.JunctionError', 'JunctionError', (['"""Fatal error: unable to move page because its ID was unexpectedly empty. This indicates Junction has a bug and henc... |
import os
import unittest
from PyDAIR.utils.PyDAIRUtils import *
from PyDAIR.utils.PyDAIRArgs import *
_data_path = os.path.join(os.path.dirname(__file__), 'data/samples')
_db_path = os.path.join(os.path.dirname(__file__), 'data/db')
_result_path = os.path.join(os.path.dirname(__file__), 'data/results')
class Test_p... | [
"unittest.main",
"os.path.dirname"
] | [((130, 155), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (145, 155), False, 'import os\n'), ((197, 222), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (212, 222), False, 'import os\n'), ((263, 288), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.