code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from .layer import SyncLayer
from yowsup.stacks import YowStackBuilder
from yowsup.layers import YowLayerEvent
from yowsup.layers.auth import YowAuthenticationProtocolLayer
from yowsup.layers.network import YowNetworkLayer
class YowsupSyncStack(object):
def __init__(self, profile, contacts):
"""
... | [
"yowsup.stacks.YowStackBuilder",
"yowsup.layers.YowLayerEvent"
] | [((429, 446), 'yowsup.stacks.YowStackBuilder', 'YowStackBuilder', ([], {}), '()\n', (444, 446), False, 'from yowsup.stacks import YowStackBuilder\n'), ((885, 935), 'yowsup.layers.YowLayerEvent', 'YowLayerEvent', (['YowNetworkLayer.EVENT_STATE_CONNECT'], {}), '(YowNetworkLayer.EVENT_STATE_CONNECT)\n', (898, 935), False,... |
from setuptools import setup
import os
try:
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as f:
long_description = f.read()
except Exception:
long_description = ''
setup(
name='seaborn-file',
version='1.1.1',
description='Seaborn-File enables the manipulation of the'
... | [
"os.path.dirname",
"setuptools.setup"
] | [((201, 949), 'setuptools.setup', 'setup', ([], {'name': '"""seaborn-file"""', 'version': '"""1.1.1"""', 'description': '"""Seaborn-File enables the manipulation of thedirectories of a computer within a program."""', 'long_description': '""""""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""htt... |
from ble_lightsensor import BLELightSensor
from lightsensor import LightSensor
import time
import bluetooth
def main():
ble = bluetooth.BLE()
ble.active(True)
ble_light = BLELightSensor(ble)
light = LightSensor(36)
light_density = light.value()
i = 0
while True:
# Write every seco... | [
"lightsensor.LightSensor",
"time.sleep_ms",
"bluetooth.BLE",
"ble_lightsensor.BLELightSensor"
] | [((131, 146), 'bluetooth.BLE', 'bluetooth.BLE', ([], {}), '()\n', (144, 146), False, 'import bluetooth\n'), ((184, 203), 'ble_lightsensor.BLELightSensor', 'BLELightSensor', (['ble'], {}), '(ble)\n', (198, 203), False, 'from ble_lightsensor import BLELightSensor\n'), ((217, 232), 'lightsensor.LightSensor', 'LightSensor'... |
import logging
import os
from typing import List, Optional
import altair
from ps2_census.enums import PlayerState
from ps2_analysis.enums import DamageLocation
from ps2_analysis.fire_groups.cone_of_fire import ConeOfFire
from ps2_analysis.fire_groups.data_files import (
update_data_files as update_fire_groups_dat... | [
"altair.Data",
"logging.basicConfig",
"altair.Scale",
"altair.Chart",
"ps2_analysis.fire_groups.data_files.update_data_files",
"os.environ.get",
"altair.EncodingSortField",
"ps2_analysis.utils.CodeTimer",
"ps2_analysis.weapons.infantry.data_files.update_data_files",
"ps2_analysis.weapons.infantry.... | [((701, 740), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (720, 740), False, 'import logging\n'), ((770, 805), 'os.environ.get', 'os.environ.get', (['"""CENSUS_SERVICE_ID"""'], {}), "('CENSUS_SERVICE_ID')\n", (784, 805), False, 'import os\n'), ((928, 1016), '... |
#coding: utf-8
class CommandUsage(object):
def __init__(self, profile_container):
self.pc = profile_container
def get_type_info(self):
r = []
for p in self.pc.profiles:
opts, args, input, output = self.profile_usage(p)
type_vars = ', '.join(map(lambda x:'<%s>' %... | [
"caty.core.casm.cursor.dump.TreeDumper"
] | [((1339, 1351), 'caty.core.casm.cursor.dump.TreeDumper', 'TreeDumper', ([], {}), '()\n', (1349, 1351), False, 'from caty.core.casm.cursor.dump import TreeDumper\n')] |
import os
from tempfile import NamedTemporaryFile
from unittest import TestCase
from mbq.client.storage import FileStorage
class FileStorageTestCase(TestCase):
def setUp(self):
self.test_filename = NamedTemporaryFile(delete=False).name
self.storage = FileStorage(self.test_filename)
def tear... | [
"tempfile.NamedTemporaryFile",
"os.remove",
"mbq.client.storage.FileStorage"
] | [((275, 306), 'mbq.client.storage.FileStorage', 'FileStorage', (['self.test_filename'], {}), '(self.test_filename)\n', (286, 306), False, 'from mbq.client.storage import FileStorage\n'), ((340, 369), 'os.remove', 'os.remove', (['self.test_filename'], {}), '(self.test_filename)\n', (349, 369), False, 'import os\n'), ((1... |
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 7 08:38:14 2018
@author: <NAME>
compute how quickly soccer league tables converge to the final distribution
"""
import pandas as pd
import numpy as np
import glob
import matplotlib.pyplot as plt
from matplotlib import animation
from scipy.stats import ent... | [
"matplotlib.pyplot.title",
"numpy.sum",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.axes",
"pandas.read_csv",
"matplotlib.animation.FuncAnimation",
"matplotlib.pyplot.figure",
"numpy.exp",
"matplotlib.pyplot.gca",
"glob.glob",
"matplotlib.pyplot.close",
"matplotlib.pyplot.cla",
"matplotlib.p... | [((389, 398), 'seaborn.set', 'sns.set', ([], {}), '()\n', (396, 398), True, 'import seaborn as sns\n'), ((677, 700), 'glob.glob', 'glob.glob', (['"""data/*.csv"""'], {}), "('data/*.csv')\n", (686, 700), False, 'import glob\n'), ((3399, 3420), 'scipy.optimize.curve_fit', 'curve_fit', (['f', 'xs', 'avg'], {}), '(f, xs, a... |
import FWCore.ParameterSet.Config as cms
isolationInputParameters = cms.PSet(
barrelBasicCluster = cms.InputTag("islandBasicClusters","islandBarrelBasicClusters"),
endcapBasicCluster = cms.InputTag("islandBasicClusters","islandEndcapBasicClusters"),
horeco = cms.InputTag("horeco"),
hfreco = cms.InputTag("h... | [
"FWCore.ParameterSet.Config.InputTag"
] | [((103, 167), 'FWCore.ParameterSet.Config.InputTag', 'cms.InputTag', (['"""islandBasicClusters"""', '"""islandBarrelBasicClusters"""'], {}), "('islandBasicClusters', 'islandBarrelBasicClusters')\n", (115, 167), True, 'import FWCore.ParameterSet.Config as cms\n'), ((192, 256), 'FWCore.ParameterSet.Config.InputTag', 'cms... |
import discord
from src.eventsHandler.on_message.commands.activate import disable, enable
from src.eventsHandler.on_message.commands.cancel import cancel_request
from src.eventsHandler.on_message.commands.end_request import end_request
from src.eventsHandler.on_message.commands.place import get_place
from src.eventsHa... | [
"src.eventsHandler.on_message.commands.cancel.cancel_request",
"src.eventsHandler.on_message.commands.activate.enable",
"src.eventsHandler.on_message.commands.end_request.end_request",
"src.eventsHandler.on_message.commands.place.get_place",
"src.eventsHandler.on_message.commands.activate.disable",
"src.e... | [((753, 788), 'src.eventsHandler.on_message.commands.request.make_request', 'make_request', (['client', 'message', 'args'], {}), '(client, message, args)\n', (765, 788), False, 'from src.eventsHandler.on_message.commands.request import make_request\n'), ((841, 878), 'src.eventsHandler.on_message.commands.cancel.cancel_... |
import torch.nn as nn
from ..builder import VQA_MODELS, build_backbone, build_encoder, build_head
@VQA_MODELS.register_module()
class VISDIALPRINCIPLES(nn.Module):
def __init__(self, vocabulary_len, word_embedding_size, encoder, backbone, head):
super().__init__()
self.embedding_model = nn.Embe... | [
"torch.nn.Embedding"
] | [((313, 377), 'torch.nn.Embedding', 'nn.Embedding', (['vocabulary_len', 'word_embedding_size'], {'padding_idx': '(0)'}), '(vocabulary_len, word_embedding_size, padding_idx=0)\n', (325, 377), True, 'import torch.nn as nn\n')] |
# -*- coding: utf-8 -*-
"""
Forked in Hydra IMF from Hydra/MUSE on Feb 19, 2018
@author: <NAME>
Run pPXF in data
"""
import os
import yaml
import numpy as np
import matplotlib.pyplot as plt
from astropy.io import fits
from astropy import constants
from astropy.table import Table, vstack, hstack
fro... | [
"os.mkdir",
"yaml.load",
"numpy.nanmedian",
"yaml.dump",
"numpy.arange",
"numpy.exp",
"ppxf.ppxf.ppxf",
"os.path.join",
"os.chdir",
"astropy.constants.c.to",
"astropy.io.fits.getdata",
"matplotlib.pyplot.close",
"os.path.exists",
"numpy.isfinite",
"spectres.spectres",
"ppxf.ppxf_util.l... | [((790, 823), 'astropy.table.Table.read', 'Table.read', (['templates_file'], {'hdu': '(1)'}), '(templates_file, hdu=1)\n', (800, 823), False, 'from astropy.table import Table, vstack, hstack\n'), ((946, 966), 'numpy.exp', 'np.exp', (['logwave_temp'], {}), '(logwave_temp)\n', (952, 966), True, 'import numpy as np\n'), (... |
import glyphsLib
import importlib
import argparse
import sys
from glob import glob
parser = argparse.ArgumentParser(description='Filter a font file')
parser.add_argument('input', metavar='GLYPHS',
help='the Glyphs file')
parser.add_argument('filter',metavar='FILTER',
help='the f... | [
"sys.path.append",
"glyphsLib.GSFont",
"argparse.ArgumentParser",
"importlib.import_module",
"glyphsLib.Glyphs.font.save",
"glob.glob",
"sys.exit"
] | [((93, 150), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Filter a font file"""'}), "(description='Filter a font file')\n", (116, 150), False, 'import argparse\n'), ((393, 419), 'sys.path.append', 'sys.path.append', (['base_path'], {}), '(base_path)\n', (408, 419), False, 'import sys\n... |
import tweepy
import time
import sys
auth = tweepy.OAuthHandler('FzQNofWMcCfK1ghaqpwM3sCJu', '<KEY>')
auth.set_access_token('<KEY>', '<KEY>')
api = tweepy.API(auth)
'''user=api.me()
print(user.name,user.screen_name,user.followers_count)
public_tweets = api.home_timeline()
for tweet in public_tweets:
print(tweet.t... | [
"tweepy.OAuthHandler",
"tweepy.Cursor",
"tweepy.API",
"time.sleep"
] | [((45, 102), 'tweepy.OAuthHandler', 'tweepy.OAuthHandler', (['"""FzQNofWMcCfK1ghaqpwM3sCJu"""', '"""<KEY>"""'], {}), "('FzQNofWMcCfK1ghaqpwM3sCJu', '<KEY>')\n", (64, 102), False, 'import tweepy\n'), ((150, 166), 'tweepy.API', 'tweepy.API', (['auth'], {}), '(auth)\n', (160, 166), False, 'import tweepy\n'), ((797, 834), ... |
import datetime
from flask import json
import msgpack
import pikka_bird_server
from pikka_bird_server.models.collection import Collection
from pikka_bird_server.models.machine import Machine
from pikka_bird_server.models.report import Report
from pikka_bird_server.models.service import Service
class TestCollections:... | [
"pikka_bird_server.models.machine.Machine.query.first",
"pikka_bird_server.models.report.Report.query.first",
"pikka_bird_server.models.service.Service.query.count",
"pikka_bird_server.models.report.Report.query.count",
"datetime.datetime",
"pikka_bird_server.models.collection.Collection.query.first",
"... | [((507, 528), 'pikka_bird_server.models.machine.Machine.query.first', 'Machine.query.first', ([], {}), '()\n', (526, 528), False, 'from pikka_bird_server.models.machine import Machine\n'), ((821, 842), 'pikka_bird_server.models.service.Service.query.first', 'Service.query.first', ([], {}), '()\n', (840, 842), False, 'f... |
#!/usr/bin/env python
from flask import Flask, render_template, request
from flask_bootstrap import Bootstrap
from models import QuizForm
class Config(object):
SECRET_KEY = '<KEY>'
application = Flask(__name__)
application.config.from_object(Config)
Bootstrap(application)
@application.route('/', methods=['GET',... | [
"models.QuizForm",
"flask.Flask",
"flask_bootstrap.Bootstrap",
"flask.render_template"
] | [((201, 216), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (206, 216), False, 'from flask import Flask, render_template, request\n'), ((257, 279), 'flask_bootstrap.Bootstrap', 'Bootstrap', (['application'], {}), '(application)\n', (266, 279), False, 'from flask_bootstrap import Bootstrap\n'), ((358, 380)... |
from django.urls import path
from .views import (
HackathonListView, create_hackathon, update_hackathon, delete_hackathon, judging
)
urlpatterns = [
path('', HackathonListView.as_view(), name="hackathon-list"),
path("<int:hack_id>/team/<int:team_id>/judging/", judging, name="judging"),
path("create_hac... | [
"django.urls.path"
] | [((224, 298), 'django.urls.path', 'path', (['"""<int:hack_id>/team/<int:team_id>/judging/"""', 'judging'], {'name': '"""judging"""'}), "('<int:hack_id>/team/<int:team_id>/judging/', judging, name='judging')\n", (228, 298), False, 'from django.urls import path\n'), ((304, 371), 'django.urls.path', 'path', (['"""create_h... |
from django.conf import settings
from django.urls import reverse
from django.test import override_settings
from rest_framework import status
from rest_framework.test import APIClient
from freezegun import freeze_time
from main.tests.api import helpers
class TestAuth(helpers.BaseUserTestCase):
@override_settings... | [
"django.urls.reverse",
"freezegun.freeze_time",
"rest_framework.test.APIClient",
"django.test.override_settings"
] | [((303, 465), 'django.test.override_settings', 'override_settings', ([], {'PASSWORD_HASHERS': "('django.contrib.auth.hashers.MD5PasswordHasher',)", 'REST_FRAMEWORK_TEST_SETTINGS': 'helpers.REST_FRAMEWORK_TEST_SETTINGS'}), "(PASSWORD_HASHERS=(\n 'django.contrib.auth.hashers.MD5PasswordHasher',),\n REST_FRAMEWORK_T... |
# -*- coding: utf-8 -*-
from gorden_crawler.spiders.shiji_base import BaseSpider
from scrapy.selector import Selector
from gorden_crawler.items import BaseItem, ImageItem, Color, SkuItem
from scrapy import Request
from gorden_crawler.utils.item_field_handler import handle_price
import re
import execjs
class ShopbopEast... | [
"gorden_crawler.items.SkuItem",
"scrapy.Request",
"scrapy.selector.Selector",
"execjs.compile",
"gorden_crawler.items.BaseItem",
"gorden_crawler.items.ImageItem",
"re.findall",
"gorden_crawler.items.Color"
] | [((395, 413), 'scrapy.selector.Selector', 'Selector', (['response'], {}), '(response)\n', (403, 413), False, 'from scrapy.selector import Selector\n'), ((2839, 2857), 'scrapy.selector.Selector', 'Selector', (['response'], {}), '(response)\n', (2847, 2857), False, 'from scrapy.selector import Selector\n'), ((2460, 2514)... |
import re # import regex module
# check if date is valid (yyyy-mm-dd)
def date_validation(self, date):
if re.fullmatch(r"/^\d{4}-\d{2}-\d{2}$/", date):
return True
else:
return False
date_validation("2022-02-29") # False/True
| [
"re.fullmatch"
] | [((112, 158), 're.fullmatch', 're.fullmatch', (['"""/^\\\\d{4}-\\\\d{2}-\\\\d{2}$/"""', 'date'], {}), "('/^\\\\d{4}-\\\\d{2}-\\\\d{2}$/', date)\n", (124, 158), False, 'import re\n')] |
import inflect
import json
import random
import re
infl = inflect.engine()
class MadLibber():
def make(self):
template = self.actions["template"]()
tokens = template.split(" ")
result = ""
for token in tokens:
action = re.match("\{\{(.+?)\}\}", token)
if(ac... | [
"inflect.engine",
"json.dump",
"json.load",
"random.choice",
"re.match"
] | [((59, 75), 'inflect.engine', 'inflect.engine', ([], {}), '()\n', (73, 75), False, 'import inflect\n'), ((270, 306), 're.match', 're.match', (['"""\\\\{\\\\{(.+?)\\\\}\\\\}"""', 'token'], {}), "('\\\\{\\\\{(.+?)\\\\}\\\\}', token)\n", (278, 306), False, 'import re\n'), ((746, 760), 'json.load', 'json.load', (['adf'], {... |
from math import exp
import cv2 as cv
import numpy as np
from concurrent.futures import ProcessPoolExecutor
from numba import jit
from numpy import float32
from tqdm import tqdm
from utils import (
get_region_indexes,
get_region_centers,
associate_index_to_centers,
get_window,
)
@jit
def P(v):
re... | [
"math.exp",
"utils.get_region_centers",
"utils.get_region_indexes",
"numpy.sum",
"utils.associate_index_to_centers",
"numpy.float32",
"concurrent.futures.ProcessPoolExecutor",
"numpy.zeros",
"utils.get_window",
"numpy.amax",
"cv2.split",
"numpy.array",
"cv2.merge"
] | [((787, 845), 'utils.get_region_indexes', 'get_region_indexes', (['imgs[0].shape[0]', 'imgs[0].shape[1]', '(10)'], {}), '(imgs[0].shape[0], imgs[0].shape[1], 10)\n', (805, 845), False, 'from utils import get_region_indexes, get_region_centers, associate_index_to_centers, get_window\n'), ((1586, 1609), 'numpy.zeros', 'n... |
import re
from typing import List, Union, Iterable
class NaturalSort:
@staticmethod
def atoi(text: str) -> int:
return int(text) if text.isdigit() else text
@staticmethod
def natural_keys(text: str) -> List[Union[str, int]]:
"""
alist.sort(key=natural_keys) sorts in human ord... | [
"re.split"
] | [((498, 522), 're.split', 're.split', (['"""(\\\\d+)"""', 'text'], {}), "('(\\\\d+)', text)\n", (506, 522), False, 'import re\n')] |
"""
2018, University of Freiburg.
<NAME> <<EMAIL>>
"""
import os
import argparse
import pickle
import numpy as np
import re
from sklearn.metrics import accuracy_score, precision_score, recall_score
from concept_neuron import split_train_valid_test, process_sentence_pos_tags
from concept_neuron import print_pos_tag_stat... | [
"concept_neuron.print_pos_tag_statistics",
"argparse.ArgumentParser",
"os.makedirs",
"numpy.argmax",
"os.path.isdir",
"sklearn.metrics.accuracy_score",
"os.path.exists",
"concept_neuron.split_train_valid_test",
"sklearn.metrics.recall_score",
"numpy.array",
"re.search",
"concept_neuron.process... | [((1446, 1500), 'concept_neuron.process_sentence_pos_tags', 'process_sentence_pos_tags', (['input_file', 'args.group_tags'], {}), '(input_file, args.group_tags)\n', (1471, 1500), False, 'from concept_neuron import split_train_valid_test, process_sentence_pos_tags\n'), ((1596, 1667), 'numpy.unique', 'np.unique', (['[y[1... |
# The MIT License (MIT) # Copyright (c) 2014-2017 University of Bristol
#
# 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... | [
"hyperstream.stream.StreamInstance",
"hyperstream.utils.get_timedelta",
"hyperstream.tool.check_input_stream_count"
] | [((2009, 2036), 'hyperstream.tool.check_input_stream_count', 'check_input_stream_count', (['(0)'], {}), '(0)\n', (2033, 2036), False, 'from hyperstream.tool import Tool, check_input_stream_count\n'), ((1786, 1807), 'hyperstream.utils.get_timedelta', 'get_timedelta', (['stride'], {}), '(stride)\n', (1799, 1807), False, ... |
# -*- coding:utf-8 -*-
# coding=<utf8>
from django.db import models
# Модели для логирования действий пользователей с активами
class Logging(models.Model):
user = models.CharField(max_length=140)
request = models.TextField(blank = True, null = True)
goal = models.TextField(blank = True, null = True)
d... | [
"django.db.models.CharField",
"django.db.models.TextField",
"django.db.models.DateTimeField",
"django.db.models.BooleanField"
] | [((169, 201), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(140)'}), '(max_length=140)\n', (185, 201), False, 'from django.db import models\n'), ((216, 255), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=True)\n', (232, 255), ... |
from directory_constants.choices import COUNTRY_CHOICES
from django import forms
from django.conf import settings
from django.forms import Select
from django.template.loader import render_to_string
from django.utils import translation
from directory_components.forms import fields
from directory_components import help... | [
"directory_components.helpers.get_user_country",
"django.template.loader.render_to_string",
"django.utils.translation.get_language",
"django.forms.Select"
] | [((758, 837), 'django.template.loader.render_to_string', 'render_to_string', (['"""directory_components/form_widgets/form.html"""', "{'form': self}"], {}), "('directory_components/form_widgets/form.html', {'form': self})\n", (774, 837), False, 'from django.template.loader import render_to_string\n'), ((1821, 1847), 'dj... |
import json
import numpy
from bm.controllers.prediction.ModelController import predict_values_from_model
from bm.db_helper.AttributesHelper import get_features, get_model_name, get_labels
class NpEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, (numpy.int_, numpy.intc, numpy.intp, nu... | [
"bm.db_helper.AttributesHelper.get_labels",
"bm.db_helper.AttributesHelper.get_model_name",
"json.dumps",
"bm.controllers.prediction.ModelController.predict_values_from_model",
"bm.db_helper.AttributesHelper.get_features",
"json.JSONEncoder.default"
] | [((873, 889), 'bm.db_helper.AttributesHelper.get_model_name', 'get_model_name', ([], {}), '()\n', (887, 889), False, 'from bm.db_helper.AttributesHelper import get_features, get_model_name, get_labels\n'), ((910, 924), 'bm.db_helper.AttributesHelper.get_features', 'get_features', ([], {}), '()\n', (922, 924), False, 'f... |
import numpy as np
import random as rnd
import pdb
def dist(loc1,loc2):
return np.sqrt((loc1[0]-loc2[0])**2 + (loc2[1]-loc1[1])**2)
#### BUG WHEN LEN(x) != LEN(y)
class Generate_field():
def __init__(self,a,b,n,x,y,opt=''):
self.xlen=len(x)
self.ylen=len(y)
self.a = a*rnd.uniform(... | [
"numpy.meshgrid",
"random.randint",
"random.uniform",
"numpy.zeros",
"random.choice",
"numpy.shape",
"numpy.sin",
"numpy.exp",
"numpy.cos",
"numpy.sqrt"
] | [((88, 148), 'numpy.sqrt', 'np.sqrt', (['((loc1[0] - loc2[0]) ** 2 + (loc2[1] - loc1[1]) ** 2)'], {}), '((loc1[0] - loc2[0]) ** 2 + (loc2[1] - loc1[1]) ** 2)\n', (95, 148), True, 'import numpy as np\n'), ((5131, 5192), 'numpy.zeros', 'np.zeros', (['(N, self.xlen + 2 * margin, self.ylen + 2 * margin)'], {}), '((N, self.... |
"""Functions for getting data needed to fit the models."""
import bs4
from datetime import datetime
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import requests
from tqdm import tqdm
from typing import Union
from urllib.error import HTTPError
import urllib.request, json
import os
from datetim... | [
"matplotlib.pyplot.title",
"os.remove",
"pandas.read_csv",
"numpy.isnan",
"matplotlib.pyplot.figure",
"pandas.DataFrame",
"os.path.exists",
"datetime.timedelta",
"pandas.concat",
"datetime.datetime.strftime",
"tqdm.tqdm",
"numpy.corrcoef",
"matplotlib.pyplot.legend",
"datetime.date",
"da... | [((4997, 5035), 'tqdm.tqdm', 'tqdm', (['good_countries'], {'desc': '"""Countries"""'}), "(good_countries, desc='Countries')\n", (5001, 5035), False, 'from tqdm import tqdm\n'), ((6806, 6836), 'tqdm.tqdm', 'tqdm', (['states'], {'desc': '"""US States"""'}), "(states, desc='US States')\n", (6810, 6836), False, 'from tqdm ... |
import torch.multiprocessing as multiprocessing
import threading
from torch.utils.data import _utils
import torch
import random
import sys
from torch._six import queue
import os
from torch.utils.data._utils import collate, signal_handling, MP_STATUS_CHECK_INTERVAL, \
ExceptionWrapper, IS_WINDOWS
if IS_WINDOWS:
... | [
"ctypes.WinDLL",
"torch.utils.data._utils.signal_handling._set_SIGCHLD_handler",
"torch.LongTensor",
"os.getppid",
"torch.manual_seed",
"torch.utils.data._utils.signal_handling._set_worker_signal_handlers",
"torch._six.queue.Queue",
"torch.set_num_threads",
"random.seed",
"torch.cuda.is_available"... | [((2719, 2764), 'torch.utils.data._utils.signal_handling._set_worker_signal_handlers', 'signal_handling._set_worker_signal_handlers', ([], {}), '()\n', (2762, 2764), False, 'from torch.utils.data._utils import collate, signal_handling, MP_STATUS_CHECK_INTERVAL, ExceptionWrapper, IS_WINDOWS\n'), ((2774, 2798), 'torch.se... |
from ctypes import *
from athena import ndarray
from athena.stream import *
import numpy as np
from enum import Enum
import os
def _load_nccl_lib():
"""Load libary in build/lib."""
curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
lib_path = os.path.join(curr_path, '../../../build/... | [
"os.path.expanduser",
"athena.ndarray.gpu",
"numpy.zeros",
"numpy.ones",
"os.path.join"
] | [((280, 326), 'os.path.join', 'os.path.join', (['curr_path', '"""../../../build/lib/"""'], {}), "(curr_path, '../../../build/lib/')\n", (292, 326), False, 'import os\n'), ((349, 402), 'os.path.join', 'os.path.join', (['lib_path', '"""lib_mpi_nccl_runtime_api.so"""'], {}), "(lib_path, 'lib_mpi_nccl_runtime_api.so')\n", ... |
# Generated by Django 2.1.7 on 2019-03-27 13:01
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Player',
fields=[
... | [
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.migrations.AlterIndexTogether",
"django.db.models.EmailField",
"django.db.models.AutoField",
"django.db.models.DateTimeField"
] | [((2320, 2414), 'django.db.migrations.AlterIndexTogether', 'migrations.AlterIndexTogether', ([], {'name': '"""solvedpuzzle"""', 'index_together': "{('player', 'puzzle')}"}), "(name='solvedpuzzle', index_together={(\n 'player', 'puzzle')})\n", (2349, 2414), False, 'from django.db import migrations, models\n'), ((2454... |
"""
ETL step wrapper for creating an S3 node for input from local files
"""
from dataduct.steps import ExtractLocalStep
import logging
logger = logging.getLogger(__name__)
class CustomExtractLocalStep(ExtractLocalStep):
"""CustomExtractLocal Step class that helps get data from a local file
"""
def __init... | [
"logging.getLogger"
] | [((144, 171), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (161, 171), False, 'import logging\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Useful tools."""
import os
import glob
import pickle
from astropy.io import fits
__all__ = [
'read_from_pickle',
'save_to_pickle',
'save_to_fits',
'linux_or_mac',
'clean_after_ellipse',
]
def read_from_pickle(name):
"""Read the data from Pick... | [
"pickle.dump",
"os.remove",
"os.unlink",
"astropy.io.fits.PrimaryHDU",
"os.path.islink"
] | [((505, 541), 'pickle.dump', 'pickle.dump', (['obj', 'output'], {'protocol': '(2)'}), '(obj, output, protocol=2)\n', (516, 541), False, 'import pickle\n'), ((1441, 1466), 'os.path.islink', 'os.path.islink', (['fits_file'], {}), '(fits_file)\n', (1455, 1466), False, 'import os\n'), ((1166, 1206), 'astropy.io.fits.Primar... |
news = "Online disinformation, or fake news intended to deceive, has emerged as a major societal problem. Currently, fake news articles are written by humans, but recently-introduced AI technology based on Neural Networks might enable adversaries to generate fake news. Our goal is to reliably detect this “neural fake n... | [
"selenium.webdriver.support.expected_conditions.presence_of_element_located",
"argparse.ArgumentParser",
"json.loads",
"selenium.webdriver.Firefox",
"req.init",
"time.sleep",
"json.dumps",
"selenium.webdriver.support.ui.WebDriverWait"
] | [((704, 723), 'selenium.webdriver.Firefox', 'webdriver.Firefox', ([], {}), '()\n', (721, 723), False, 'from selenium import webdriver\n'), ((765, 790), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (788, 790), False, 'import argparse\n'), ((4134, 4147), 'time.sleep', 'time.sleep', (['(5)'], {}... |
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.views.generic import TemplateView
from rest_framework.routers import SimpleRouter
from django.views import defaults ... | [
"django.conf.urls.include",
"rest_framework.routers.SimpleRouter",
"django.views.generic.TemplateView.as_view",
"django.conf.urls.url",
"django.conf.urls.static.static"
] | [((540, 554), 'rest_framework.routers.SimpleRouter', 'SimpleRouter', ([], {}), '()\n', (552, 554), False, 'from rest_framework.routers import SimpleRouter\n'), ((1463, 1524), 'django.conf.urls.static.static', 'static', (['settings.MEDIA_URL'], {'document_root': 'settings.MEDIA_ROOT'}), '(settings.MEDIA_URL, document_ro... |
import numpy as np
import warnings
from scipy import stats
from six import string_types
import matplotlib.pyplot as plt
from scipy.integrate import trapz
from explore.utils import Proportions
try:
import statsmodels.nonparametric.api as smnp
_has_statsmodels = True
except ImportError:
_has_statsmodels = ... | [
"numpy.zeros_like",
"matplotlib.pyplot.gca",
"numpy.std",
"scipy.stats.gaussian_kde",
"explore.utils.Proportions",
"numpy.array",
"numpy.linspace",
"scipy.integrate.trapz",
"warnings.warn",
"statsmodels.nonparametric.api.KDEUnivariate",
"numpy.unique"
] | [((4001, 4025), 'statsmodels.nonparametric.api.KDEUnivariate', 'smnp.KDEUnivariate', (['data'], {}), '(data)\n', (4019, 4025), True, 'import statsmodels.nonparametric.api as smnp\n'), ((5167, 5214), 'numpy.linspace', 'np.linspace', (['support_min', 'support_max', 'gridsize'], {}), '(support_min, support_max, gridsize)\... |
from collections import Counter
INPUT_FILE = "../../input/14.txt"
Ruleset = dict[str, str]
def parse_input() -> tuple[str, Ruleset]:
"""
Parses the input and returns the polymer template and the pair insertion rules
"""
with open(INPUT_FILE) as f:
template, _, *rules = f.read().splitlines()
... | [
"collections.Counter"
] | [((587, 596), 'collections.Counter', 'Counter', ([], {}), '()\n', (594, 596), False, 'from collections import Counter\n'), ((1230, 1251), 'collections.Counter', 'Counter', (['template[-1]'], {}), '(template[-1])\n', (1237, 1251), False, 'from collections import Counter\n'), ((1712, 1726), 'collections.Counter', 'Counte... |
from typing import Optional, Dict
import jwt
import sentry_sdk
from fastapi import HTTPException
from starlette import status
from starlette.requests import Request
from auth.models import Role
from auth.models import User
from config import cfg
def get_user(request: Request) -> User:
"""
Protect route from... | [
"sentry_sdk.set_user",
"fastapi.HTTPException",
"jwt.decode"
] | [((2263, 2389), 'jwt.decode', 'jwt.decode', (['encoded_refresh_token'], {'key': 'cfg.jwt_secret', 'algorithms': '[cfg.jwt_algorithm]', 'options': "{'verify_exp': verify_exp}"}), "(encoded_refresh_token, key=cfg.jwt_secret, algorithms=[cfg.\n jwt_algorithm], options={'verify_exp': verify_exp})\n", (2273, 2389), False... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="diffusionfit",
version="0.7.0",
python_requires=">=3.9",
install_requires=[
"numpy",
"scipy",
"scikit-image",
"matplotlib",
"seaborn",
"pandas",... | [
"setuptools.find_packages"
] | [((740, 766), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (764, 766), False, 'import setuptools\n')] |
########################################
# Automatically generated, do not edit.
########################################
from pyvisdk.thirdparty import Enum
EntityReferenceEntityType = Enum(
'cluster',
'datacenter',
'datastore',
'host',
'nasMount',
'resourcePool',
'scsiAdapter',
'sc... | [
"pyvisdk.thirdparty.Enum"
] | [((190, 361), 'pyvisdk.thirdparty.Enum', 'Enum', (['"""cluster"""', '"""datacenter"""', '"""datastore"""', '"""host"""', '"""nasMount"""', '"""resourcePool"""', '"""scsiAdapter"""', '"""scsiPath"""', '"""scsiTarget"""', '"""scsiVolume"""', '"""storagePod"""', '"""vm"""', '"""vmFile"""'], {}), "('cluster', 'datacenter',... |
from exit import Exit
class Room: #objet room
def __init__(self, id, name, description): #rappel : self est mon objet qui suit le plan Room
self.id = id
self.name = name
self.description = description
self.pickables = {} #les objets ramassables (pickables) sont actuellement un dicti... | [
"exit.Exit"
] | [((1300, 1323), 'exit.Exit', 'Exit', (['self', 'destination'], {}), '(self, destination)\n', (1304, 1323), False, 'from exit import Exit\n')] |
from unittest import TestCase
from uttut.elements import Datum, Entity, Intent
from ..partition_by_entities import partition_by_entities
class PartitionByEntitiesTestCase(TestCase):
def setUp(self):
self.utterance = '我想訂明天從紐約飛到新加坡的機票'
self.entities = [
Entity(label=0, value='明天', sta... | [
"uttut.elements.Datum",
"uttut.elements.Intent",
"uttut.elements.Entity"
] | [((601, 678), 'uttut.elements.Datum', 'Datum', ([], {'utterance': 'self.utterance', 'intents': 'self.intents', 'entities': 'self.entities'}), '(utterance=self.utterance, intents=self.intents, entities=self.entities)\n', (606, 678), False, 'from uttut.elements import Datum, Entity, Intent\n'), ((289, 355), 'uttut.elemen... |
from abc import ABCMeta, abstractmethod
import numpy as np
class ProposalDistribution(metaclass=ABCMeta):
@abstractmethod
def __init__(self):
...
@abstractmethod
def sample(self, x: np.ndarray) -> np.ndarray:
...
@abstractmethod
def pdf(self, x: np.ndarray, cond: np.ndarray)... | [
"numpy.random.uniform",
"numpy.array",
"numpy.exp",
"numpy.random.normal",
"numpy.sqrt"
] | [((1248, 1273), 'numpy.array', 'np.array', (['(1 / self.spread)'], {}), '(1 / self.spread)\n', (1256, 1273), True, 'import numpy as np\n'), ((662, 708), 'numpy.random.normal', 'np.random.normal', (['self.mean', 'self.std', 'x.shape'], {}), '(self.mean, self.std, x.shape)\n', (678, 708), True, 'import numpy as np\n'), (... |
from __future__ import print_function
import numpy as np
try:
from builtins import range, zip
except:
pass
def fermi_dirac(e_fermi, delta, energy):
"""
Return fermi-dirac distribution weight.
"""
x = (energy - e_fermi)/delta
if x < -200:
f = 1.
elif x > 200:
f = 0.
... | [
"numpy.sum",
"numpy.exp",
"builtins.zip"
] | [((500, 520), 'builtins.zip', 'zip', (['e_kn', 'w_k', 'nb_k'], {}), '(e_kn, w_k, nb_k)\n', (503, 520), False, 'from builtins import range, zip\n'), ((607, 616), 'numpy.sum', 'np.sum', (['f'], {}), '(f)\n', (613, 616), True, 'import numpy as np\n'), ((343, 352), 'numpy.exp', 'np.exp', (['x'], {}), '(x)\n', (349, 352), T... |
from mock import Mock
from nameko.legacy import responses
def test_iter_rpcresponses():
response_list = [
Mock(payload={'id': 1, 'failure': False, 'ending': False}),
Mock(payload={'id': 2, 'failure': False, 'ending': False}),
Mock(payload={'id': 3, 'failure': False, 'ending': True}),
... | [
"nameko.legacy.responses.iter_rpcresponses",
"nameko.legacy.responses.last",
"mock.Mock"
] | [((335, 377), 'nameko.legacy.responses.iter_rpcresponses', 'responses.iter_rpcresponses', (['response_list'], {}), '(response_list)\n', (362, 377), False, 'from nameko.legacy import responses\n'), ((388, 409), 'nameko.legacy.responses.last', 'responses.last', (['iter_'], {}), '(iter_)\n', (402, 409), False, 'from namek... |
import discord
from ..admin.managecommands import perms
import json
from discord.utils import get
from pymongo import MongoClient, collation
from discord.ext import commands, tasks
import time
import os
import pymongo as pm
import asyncio
import random
import datetime
import copy
class Kick(commands.Cog):
def __i... | [
"discord.ext.commands.has_permissions",
"discord.ext.commands.check",
"discord.ext.commands.bot_has_permissions",
"discord.ext.commands.command"
] | [((378, 413), 'discord.ext.commands.command', 'commands.command', ([], {'pass_context': '(True)'}), '(pass_context=True)\n', (394, 413), False, 'from discord.ext import commands, tasks\n'), ((419, 462), 'discord.ext.commands.has_permissions', 'commands.has_permissions', ([], {'kick_members': '(True)'}), '(kick_members=... |
# Imports
import os
import random
from collections import Counter, defaultdict
import random
from nltk.tag import StanfordNERTagger
from nltk.tokenize import word_tokenize
from nltk import pos_tag
from nltk.chunk import conlltags2tree
from nltk.tree import Tree
import pandas as pd
from htrc_features import FeatureReade... | [
"htrc_features.FeatureReader",
"random.shuffle",
"nltk.tag.StanfordNERTagger",
"geocoder.geonames",
"pprint.pprint",
"pandas.DataFrame.from_records",
"folium.Map",
"nltk.corpus.stopwords.words",
"collections.Counter",
"os.getenv",
"nltk.tokenize.word_tokenize"
] | [((673, 694), 'os.getenv', 'os.getenv', (['"""USERNAME"""'], {}), "('USERNAME')\n", (682, 694), False, 'import os\n'), ((806, 984), 'nltk.tag.StanfordNERTagger', 'StanfordNERTagger', (['"""/usr/local/share/stanford-ner/classifiers/english.all.3class.distsim.crf.ser.gz"""', '"""/usr/local/share/stanford-ner/stanford-ner... |
import cv2
import virtcam.debug as debug
from virtcam.base import Frame, FrameSource, Image, Mask, StreamConfig, immutable
class Webcam(FrameSource):
def __init__(self):
super().__init__()
self.current_id = -1
self.camera = cv2.VideoCapture("/dev/video0", cv2.CAP_V4L2)
c1, c2, c3... | [
"cv2.VideoWriter_fourcc",
"cv2.VideoCapture",
"virtcam.debug.config",
"virtcam.base.immutable",
"virtcam.base.Image"
] | [((255, 300), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""/dev/video0"""', 'cv2.CAP_V4L2'], {}), "('/dev/video0', cv2.CAP_V4L2)\n", (271, 300), False, 'import cv2\n'), ((362, 400), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (['c1', 'c2', 'c3', 'c4'], {}), '(c1, c2, c3, c4)\n', (384, 400), False, 'import cv2\... |
import numpy as np
import math
def softmax(src):
# Get size of input vector
rows, cols = src.shape
# Checking
if rows > 1:
raise Exception("Input rows > 1")
# Find softmax
expVec = np.exp(src)
return expVec / np.sum(expVec)
def softmax_derivative(src):
# Get size of input vec... | [
"numpy.sum",
"numpy.zeros",
"numpy.exp"
] | [((216, 227), 'numpy.exp', 'np.exp', (['src'], {}), '(src)\n', (222, 227), True, 'import numpy as np\n'), ((496, 518), 'numpy.zeros', 'np.zeros', (['(cols, cols)'], {}), '((cols, cols))\n', (504, 518), True, 'import numpy as np\n'), ((848, 867), 'numpy.zeros', 'np.zeros', (['(1, cols)'], {}), '((1, cols))\n', (856, 867... |
import numpy as np
from scipy import sparse
import scipy.sparse.linalg as spla
import pylab as plt
from scipy.linalg import block_diag
#
#
nSub = 2
def load_matrix_basic(pathToFile,makeSparse,makeSymmetric, offset):
f0 = open(pathToFile).readlines()
firstLine = f0.pop(0) #removes the first line
tmp = np.z... | [
"numpy.abs",
"numpy.concatenate",
"numpy.zeros",
"numpy.hstack",
"scipy.sparse.csc_matrix",
"numpy.loadtxt",
"numpy.int32",
"numpy.dot",
"numpy.linalg.solve",
"numpy.vstack"
] | [((6585, 6623), 'numpy.loadtxt', 'np.loadtxt', (["(path0 + '/dump_weigth.txt')"], {}), "(path0 + '/dump_weigth.txt')\n", (6595, 6623), True, 'import numpy as np\n'), ((5559, 5590), 'numpy.hstack', 'np.hstack', (['(Fc_clust, Gc_clust)'], {}), '((Fc_clust, Gc_clust))\n', (5568, 5590), True, 'import numpy as np\n'), ((559... |
from galaxy_analysis.plot.plot_styles import *
import matplotlib.pyplot as plt
import os, sys
import numpy as np
from mpl_toolkits.axes_grid1 import make_axes_locatable
def bins_from_centers(x):
xnew = np.zeros(len(x) + 1)
dx = np.zeros(len(x) + 1)
dx[1:-1] = x[1:] - x[:-1]
dx[0] = dx[1]
dx[-1]... | [
"mpl_toolkits.axes_grid1.make_axes_locatable",
"matplotlib.pyplot.tight_layout",
"numpy.size",
"numpy.meshgrid",
"matplotlib.pyplot.close",
"numpy.genfromtxt",
"numpy.min",
"numpy.max",
"matplotlib.pyplot.minorticks_on",
"numpy.log10",
"matplotlib.pyplot.subplots"
] | [((580, 603), 'numpy.genfromtxt', 'np.genfromtxt', (['datafile'], {}), '(datafile)\n', (593, 603), True, 'import numpy as np\n'), ((1047, 1077), 'numpy.meshgrid', 'np.meshgrid', (['LW_vals', 'k27_vals'], {}), '(LW_vals, k27_vals)\n', (1058, 1077), True, 'import numpy as np\n'), ((1116, 1152), 'numpy.meshgrid', 'np.mesh... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0.
import argparse
import boto3
# Parse required options
parser = argparse.ArgumentParser(description='Creates all required AWS CodeBuild projects for a repo')
parser.add_argument('project', type=str, help='The na... | [
"argparse.ArgumentParser",
"boto3.Session"
] | [((173, 271), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Creates all required AWS CodeBuild projects for a repo"""'}), "(description=\n 'Creates all required AWS CodeBuild projects for a repo')\n", (196, 271), False, 'import argparse\n'), ((3914, 3979), 'boto3.Session', 'boto3.Ses... |
# Imports ---------------------------------------------------------------------
# Python
import argparse
import joblib
import yaml
import os.path as osp
from collections import defaultdict
import joblib
import os
# PyTorch
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Va... | [
"yaml.load",
"argparse.ArgumentParser",
"torch.utils.data.DataLoader",
"rlkit.torch.pytorch_util.gpu_enabled",
"observations.multi_mnist",
"rlkit.launchers.launcher_util.set_seed",
"torch.FloatTensor",
"numpy.array",
"torch.utils.data.TensorDataset",
"rlkit.torch.pytorch_util.set_gpu_mode",
"gen... | [((906, 944), 'rlkit.torch.pytorch_util.set_gpu_mode', 'ptu.set_gpu_mode', (["exp_specs['use_gpu']"], {}), "(exp_specs['use_gpu'])\n", (922, 944), True, 'import rlkit.torch.pytorch_util as ptu\n'), ((1130, 1144), 'rlkit.launchers.launcher_util.set_seed', 'set_seed', (['seed'], {}), '(seed)\n', (1138, 1144), False, 'fro... |
import sys, os, traceback
from os import path
import utils as utils
from IBMi import IBMi
CONFIG_PATH="./config.json"
def get_configuration(name):
for cfg in utils.read_file_json(CONFIG_PATH):
if cfg["name"] == name: return cfg
return None
def append_configuration(new_data):
if not path.exists(CO... | [
"IBMi.IBMi",
"utils.required_input",
"traceback.print_exc",
"utils.read_file_json",
"os.path.exists",
"utils.bool_input",
"utils.write_file_json",
"utils.required_pass",
"utils.log"
] | [((164, 197), 'utils.read_file_json', 'utils.read_file_json', (['CONFIG_PATH'], {}), '(CONFIG_PATH)\n', (184, 197), True, 'import utils as utils\n'), ((732, 774), 'utils.log', 'utils.log', (['"""Creating new configuration..."""'], {}), "('Creating new configuration...')\n", (741, 774), True, 'import utils as utils\n'),... |
"""
This is extracted from the unmaintained https://github.com/jazzband/django-floppyforms to provide a datalist widget.
It has not been cleaned up yet.
"""
from django import forms
from django.template import Context, loader
from django.utils import formats
from django.utils.encoding import force_text
class DictCon... | [
"django.utils.formats.localize_input",
"django.utils.encoding.force_text",
"django.template.loader.render_to_string"
] | [((2971, 2988), 'django.utils.encoding.force_text', 'force_text', (['value'], {}), '(value)\n', (2981, 2988), False, 'from django.utils.encoding import force_text\n'), ((4527, 4574), 'django.template.loader.render_to_string', 'loader.render_to_string', (['template_name', 'context'], {}), '(template_name, context)\n', (... |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from marshmallow import fields
from azure.ai.ml._schema.core.schema_meta import PatchedSchemaMeta
class AmlComputeNodeInfoSchema(metaclass... | [
"marshmallow.fields.Str"
] | [((355, 367), 'marshmallow.fields.Str', 'fields.Str', ([], {}), '()\n', (365, 367), False, 'from marshmallow import fields\n'), ((393, 405), 'marshmallow.fields.Str', 'fields.Str', ([], {}), '()\n', (403, 405), False, 'from marshmallow import fields\n'), ((430, 442), 'marshmallow.fields.Str', 'fields.Str', ([], {}), '(... |
from floodsystem.geo import build_station_list
from floodsystem.geo import rivers_by_station_number
def test_rivers_by_station_number():
"""Tests to check that the outputs from funtion rivers_by_station_number are as expected"""
stations = build_station_list()
test = rivers_by_station_number(stations, 9)
... | [
"floodsystem.geo.rivers_by_station_number",
"floodsystem.geo.build_station_list"
] | [((249, 269), 'floodsystem.geo.build_station_list', 'build_station_list', ([], {}), '()\n', (267, 269), False, 'from floodsystem.geo import build_station_list\n'), ((281, 318), 'floodsystem.geo.rivers_by_station_number', 'rivers_by_station_number', (['stations', '(9)'], {}), '(stations, 9)\n', (305, 318), False, 'from ... |
from src.Deque.deque_scratch import Deque
def is_palindrome(string_to_check):
string_to_check=string_to_check.strip()
if not string_to_check:
raise Exception("The string is empty")
deq=Deque()
for el in string_to_check:
deq.addTail(el)
front=deq.removeFront()
end=deq.remove... | [
"src.Deque.deque_scratch.Deque"
] | [((211, 218), 'src.Deque.deque_scratch.Deque', 'Deque', ([], {}), '()\n', (216, 218), False, 'from src.Deque.deque_scratch import Deque\n')] |
import os
import pickle
import numpy as np
import PIL.Image
import dnnlib
import dnnlib.tflib as tflib
import config
from training import misc
synthesis_kwargs = dict(minibatch_size=8)
_Gs_cache = dict()
def load_Gs(url):
if url not in _Gs_cache:
with dnnlib.util.open_url(url, cache_dir=config.cache_dir... | [
"numpy.sum",
"os.makedirs",
"training.misc.load_pkl",
"numpy.empty_like",
"numpy.random.RandomState",
"dnnlib.util.open_url",
"pickle.load",
"training.misc.save_image_grid",
"dnnlib.tflib.init_tf"
] | [((2768, 2783), 'dnnlib.tflib.init_tf', 'tflib.init_tf', ([], {}), '()\n', (2781, 2783), True, 'import dnnlib.tflib as tflib\n'), ((2788, 2833), 'os.makedirs', 'os.makedirs', (['config.result_dir'], {'exist_ok': '(True)'}), '(config.result_dir, exist_ok=True)\n', (2799, 2833), False, 'import os\n'), ((2897, 2923), 'tra... |
# -*- coding: utf-8 -*-
import time
import numpy as np
from classes import Debug, KalmanFilter
import smbus
bus = smbus.SMBus(2) # bus = smbus.SMBus(0) fuer Revision 1
address = 0x68 # via i2cdetect
power_mgmt_1 = 0x6b
ACCEL_CONFIG = 0x1C # Reg 28
ACCEL_CONFIG2 = 0x1D # Reg 29
class Imu(Debug, KalmanFilter):
... | [
"classes.Debug",
"numpy.median",
"classes.KalmanFilter",
"numpy.array",
"smbus.SMBus"
] | [((115, 129), 'smbus.SMBus', 'smbus.SMBus', (['(2)'], {}), '(2)\n', (126, 129), False, 'import smbus\n'), ((377, 389), 'classes.Debug', 'Debug', (['"""imu"""'], {}), "('imu')\n", (382, 389), False, 'from classes import Debug, KalmanFilter\n'), ((730, 775), 'numpy.array', 'np.array', (['[[1, dt, 0], [0, 1, dt], [0, 0, 1... |
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace
from dotenv import find_dotenv, load_dotenv
from werkzeug import run_simple
def parse_args() -> Namespace:
parser_kw = {'formatter_class': ArgumentDefaultsHelpFormatter}
parser = ArgumentParser(description='Chitty auxiliary web ser... | [
"werkzeug.run_simple",
"argparse.ArgumentParser",
"dotenv.find_dotenv"
] | [((268, 326), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Chitty auxiliary web service"""'}), "(description='Chitty auxiliary web service')\n", (282, 326), False, 'from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace\n'), ((863, 951), 'werkzeug.run_simple', 'run_simple... |
import json
from django.urls import reverse
from rest_framework.views import status
from rest_framework.test import APITestCase, APIClient
class CommentsTestCase(APITestCase):
def setUp(self):
self.client = APIClient()
self.signup_url = reverse('authentication:auth-register')
self.create_a... | [
"django.urls.reverse",
"rest_framework.test.APIClient",
"json.dumps"
] | [((221, 232), 'rest_framework.test.APIClient', 'APIClient', ([], {}), '()\n', (230, 232), False, 'from rest_framework.test import APITestCase, APIClient\n'), ((259, 298), 'django.urls.reverse', 'reverse', (['"""authentication:auth-register"""'], {}), "('authentication:auth-register')\n", (266, 298), False, 'from django... |
from pyscf import lib, scf
#from pyphf import guess, suscf
from automr import autocas, guess
lib.num_threads(8)
xyz = '''C -2.94294278 0.39039038 0.00000000
C -1.54778278 0.39039038 0.00000000
C -0.85024478 1.59814138 0.00000000
C -1... | [
"automr.guess.mix",
"automr.autocas.cas",
"pyscf.lib.num_threads"
] | [((94, 112), 'pyscf.lib.num_threads', 'lib.num_threads', (['(8)'], {}), '(8)\n', (109, 112), False, 'from pyscf import lib, scf\n'), ((857, 890), 'automr.guess.mix', 'guess.mix', (['xyz', 'bas'], {'conv': '"""tight"""'}), "(xyz, bas, conv='tight')\n", (866, 890), False, 'from automr import autocas, guess\n'), ((898, 91... |
#!/bin/python3
from gym import spaces
from gym.envs.registration import register
from frobs_rl.envs import robot_BasicEnv
import rospy
#- Uncomment the library modules as neeeed
# from frobs_rl.common import ros_gazebo
# from frobs_rl.common import ros_controllers
# from frobs_rl.common import ros_node
# from frobs_r... | [
"rospy.loginfo"
] | [((986, 1028), 'rospy.loginfo', 'rospy.loginfo', (['"""Starting Custom Robot Env"""'], {}), "('Starting Custom Robot Env')\n", (999, 1028), False, 'import rospy\n'), ((4582, 4632), 'rospy.loginfo', 'rospy.loginfo', (['"""Finished Init of Custom Robot env"""'], {}), "('Finished Init of Custom Robot env')\n", (4595, 4632... |
from os import path
import os
import matplotlib.pyplot as plt
import numpy as np
import autofit as af
"""
The `analysis.py` module contains the dataset and log likelihood function which given a model instance (set up by
the non-linear search) fits the dataset and returns the log likelihood of that model.
""... | [
"matplotlib.pyplot.title",
"os.makedirs",
"matplotlib.pyplot.clf",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"os.path.join",
"matplotlib.pyplot.errorbar"
] | [((1484, 1513), 'numpy.arange', 'np.arange', (['self.data.shape[0]'], {}), '(self.data.shape[0])\n', (1493, 1513), True, 'import numpy as np\n'), ((3328, 3357), 'numpy.arange', 'np.arange', (['self.data.shape[0]'], {}), '(self.data.shape[0])\n', (3337, 3357), True, 'import numpy as np\n'), ((3644, 3754), 'matplotlib.py... |
import logging
import uuid
import luigi
from luigi.task import flatten_output
from luigi.parameter import ParameterVisibility
logger = logging.getLogger('luigi-interface')
class IlluminaFastqHeader:
@classmethod
def parse(cls, s):
pieces = s.split(':')
if len(pieces) == 5:
device,... | [
"luigi.task.flatten_output",
"luigi.BoolParameter",
"luigi.IntParameter",
"logging.getLogger"
] | [((137, 173), 'logging.getLogger', 'logging.getLogger', (['"""luigi-interface"""'], {}), "('luigi-interface')\n", (154, 173), False, 'import logging\n'), ((1541, 1607), 'luigi.IntParameter', 'luigi.IntParameter', ([], {'default': '(0)', 'positional': '(False)', 'significant': '(False)'}), '(default=0, positional=False,... |
import numpy as np
import pandas as pd
from veneer.pest_runtime import *
from veneer.manage import start,kill_all_now
import pyapprox as pya
from functools import partial
from pyapprox.adaptive_sparse_grid import max_level_admissibility_function
from pyapprox.adaptive_polynomial_chaos import variance_pce_refinement_... | [
"pandas.DataFrame",
"functools.partial",
"pandas.Timestamp",
"funcs.modeling_funcs.modeling_settings",
"pyapprox.variable_transformations.AffineRandomVariableTransformation",
"pandas.read_csv",
"funcs.read_data.variables_prep",
"funcs.read_data.file_settings",
"funcs.modeling_funcs.generate_observat... | [((872, 891), 'funcs.modeling_funcs.modeling_settings', 'modeling_settings', ([], {}), '()\n', (889, 891), False, 'from funcs.modeling_funcs import modeling_settings, generate_observation_ensemble\n'), ((911, 973), 'funcs.modeling_funcs.paralell_vs', 'paralell_vs', (['first_port', 'num_copies', 'project_name', 'veneer_... |
from datetime import datetime
from flask_sqlalchemy import SQLAlchemy as _SQLAlchemy, BaseQuery
from sqlalchemy import inspect, Column, Integer, SmallInteger, orm
from contextlib import contextmanager
from app.libs.error_code import NotFound
class SQLAlchemy(_SQLAlchemy):
@contextmanager
def auto_commit(self)... | [
"sqlalchemy.inspect"
] | [((1283, 1306), 'sqlalchemy.inspect', 'inspect', (['self.__class__'], {}), '(self.__class__)\n', (1290, 1306), False, 'from sqlalchemy import inspect, Column, Integer, SmallInteger, orm\n')] |
import os
import discord
import Cogs #type: ignore
import glo #type: ignore
from discord.ext import commands
class PhaseBot(commands.Bot):
""" The bot """
async def on_ready(self):
print("Discodo!") # Great, it's working
await bot.change_presence(activity = discord.Activity(name = f"my start... | [
"discord.Activity",
"Cogs.Listeners",
"Cogs.Counting",
"Cogs.Admin",
"Cogs.Tasks",
"glo.GLOBAL_READ",
"os.system",
"Cogs.General",
"Cogs.Bank",
"glo.SETNAME",
"discord.Intents.all",
"glo.JSONREAD",
"Cogs.Starboard"
] | [((1293, 1308), 'Cogs.Admin', 'Cogs.Admin', (['bot'], {}), '(bot)\n', (1303, 1308), False, 'import Cogs\n'), ((1333, 1347), 'Cogs.Bank', 'Cogs.Bank', (['bot'], {}), '(bot)\n', (1342, 1347), False, 'import Cogs\n'), ((1361, 1379), 'Cogs.Counting', 'Cogs.Counting', (['bot'], {}), '(bot)\n', (1374, 1379), False, 'import C... |
import random
import time
print("this game is blackjack. If you are wondering which focus day this is connected to, it isn't connected to any of them. ")
print()
print("I started making it, and I forgot it had to be related to a focus day, but it was too late to switch, so here it is ")
print()
print("how to play: your... | [
"random.randint"
] | [((3701, 3722), 'random.randint', 'random.randint', (['(0)', '(51)'], {}), '(0, 51)\n', (3715, 3722), False, 'import random\n'), ((3729, 3750), 'random.randint', 'random.randint', (['(0)', '(51)'], {}), '(0, 51)\n', (3743, 3750), False, 'import random\n'), ((3757, 3778), 'random.randint', 'random.randint', (['(0)', '(5... |
import pandas
import os
PATH_TO_DATASETS = './mlpractice/datasets/'
class DataSet(object):
def __init__(self, dir_name, extensions=['.csv'], path_to_datasets=PATH_TO_DATASETS):
data_dir = os.path.join(path_to_datasets, dir_name)
for file_name in os.listdir(data_dir):
name, ext = os... | [
"os.path.splitext",
"os.path.join",
"os.listdir"
] | [((206, 246), 'os.path.join', 'os.path.join', (['path_to_datasets', 'dir_name'], {}), '(path_to_datasets, dir_name)\n', (218, 246), False, 'import os\n'), ((272, 292), 'os.listdir', 'os.listdir', (['data_dir'], {}), '(data_dir)\n', (282, 292), False, 'import os\n'), ((318, 345), 'os.path.splitext', 'os.path.splitext', ... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'resamplingDialogUi.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_resamplingDialog(object):
def setupUi(self, resamplingDia... | [
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtCore.QRect",
"PyQt5.QtWidgets.QGridLayout",
"PyQt5.QtWidgets.QHBoxLayout",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtCore.QSize",
"PyQt5.QtWidgets.QGroupBox",
"PyQt5.QtWidgets.QSpacerItem",
"PyQt5.QtWidgets.QScrollArea",
"PyQt5.QtWidget... | [((453, 492), 'PyQt5.QtWidgets.QGridLayout', 'QtWidgets.QGridLayout', (['resamplingDialog'], {}), '(resamplingDialog)\n', (474, 492), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((571, 610), 'PyQt5.QtWidgets.QScrollArea', 'QtWidgets.QScrollArea', (['resamplingDialog'], {}), '(resamplingDialog)\n', (592, 610... |
from zah.router.app import Router
# from zah.store import Store
from zah.urls import render, render_page
from zah.core.servers import BaseServer, DevelopmentServer
from zah.shortcuts import get_default_server
app = BaseServer()
# app = get_default_server()
# app.use_component(Router)
# app.use_component(Store)
# def ... | [
"zah.core.servers.BaseServer"
] | [((216, 228), 'zah.core.servers.BaseServer', 'BaseServer', ([], {}), '()\n', (226, 228), False, 'from zah.core.servers import BaseServer, DevelopmentServer\n')] |
import argparse
import os.path as osp
import mmcv
def parse_args():
parser = argparse.ArgumentParser(
description='Process a checkpoint to be published')
parser.add_argument('img_dir', help='img config directory')
parser.add_argument('gt_dir', help='gt config directory')
parser.add_argument('... | [
"mmcv.mkdir_or_exist",
"os.path.join",
"argparse.ArgumentParser",
"mmcv.scandir"
] | [((84, 159), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Process a checkpoint to be published"""'}), "(description='Process a checkpoint to be published')\n", (107, 159), False, 'import argparse\n'), ((1030, 1063), 'mmcv.mkdir_or_exist', 'mmcv.mkdir_or_exist', (['args.out_dir'], {}), ... |
import torch.nn as nn
import logging
logger = logging.getLogger(__name__)
def conv3x3(in_channels, out_channels,activation=nn.ReLU(inplace=True)):
return nn.Sequential(
nn.Conv2d(in_channels, out_channels, 3, padding=1), nn.MaxPool2d(2),
nn.BatchNorm2d(out_channels, momentum=1., affine=T... | [
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.Softplus",
"torch.nn.LayerNorm",
"torch.nn.BatchNorm2d",
"torch.nn.Linear",
"torch.nn.MaxPool2d",
"logging.getLogger",
"torch.nn.Flatten"
] | [((48, 75), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (65, 75), False, 'import logging\n'), ((127, 148), 'torch.nn.ReLU', 'nn.ReLU', ([], {'inplace': '(True)'}), '(inplace=True)\n', (134, 148), True, 'import torch.nn as nn\n'), ((189, 239), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_chann... |
# Source: https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/Fine_Tune_XLSR_Wav2Vec2_on_Turkish_ASR_with_%F0%9F%A4%97_Transformers.ipynb#scrollTo=lbQf5GuZyQ4_
import collections
from dataclasses import dataclass
from typing import Any, Dict, List, Optional, Union
import numpy as np
import... | [
"torch.cuda.amp.autocast",
"tqdm.tqdm",
"transformers.trainer_pt_utils.DistributedLengthGroupedSampler",
"numpy.argmax",
"datasets.load_metric",
"transformers.trainer_pt_utils.LengthGroupedSampler"
] | [((7687, 7705), 'datasets.load_metric', 'load_metric', (['"""wer"""'], {}), "('wer')\n", (7698, 7705), False, 'from datasets import load_metric\n'), ((7822, 7853), 'numpy.argmax', 'np.argmax', (['pred_logits'], {'axis': '(-1)'}), '(pred_logits, axis=-1)\n', (7831, 7853), True, 'import numpy as np\n'), ((5953, 5995), 't... |
import numpy, sys, math, batman
import matplotlib.pyplot as plt
from scipy import interpolate
file = numpy.load('GJ436b_Trans_SED.npz')
SEDarray = file['SEDarray']
print(SEDarray.shape)
plt.imshow(SEDarray)
plt.show()
stellarwave, stellarspec = numpy.loadtxt('ODFNEW_GJ436.spec', unpack=True, skiprows=800)
stellarwave... | [
"numpy.load",
"matplotlib.pyplot.show",
"matplotlib.pyplot.imshow",
"numpy.zeros",
"numpy.where",
"numpy.loadtxt",
"numpy.linspace",
"scipy.interpolate.interp1d",
"numpy.savez",
"batman.TransitModel",
"numpy.delete",
"numpy.vstack"
] | [((102, 136), 'numpy.load', 'numpy.load', (['"""GJ436b_Trans_SED.npz"""'], {}), "('GJ436b_Trans_SED.npz')\n", (112, 136), False, 'import numpy, sys, math, batman\n'), ((187, 207), 'matplotlib.pyplot.imshow', 'plt.imshow', (['SEDarray'], {}), '(SEDarray)\n', (197, 207), True, 'import matplotlib.pyplot as plt\n'), ((208,... |
from Cython.Build import cythonize
from setuptools.extension import Extension
from setuptools import setup, find_packages
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
include_dirs = [dir_path + "/src", dir_path]
macros = [("CYTHON_TRACE", "1")]
extensions = [Extension("quicksect", ["src/quicksect.py... | [
"Cython.Build.cythonize",
"os.path.realpath",
"setuptools.extension.Extension",
"setuptools.find_packages"
] | [((159, 185), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (175, 185), False, 'import os\n'), ((279, 377), 'setuptools.extension.Extension', 'Extension', (['"""quicksect"""', "['src/quicksect.pyx']"], {'define_macros': 'macros', 'include_dirs': 'include_dirs'}), "('quicksect', ['src/quick... |
"""A simple server with a REST API for the Notes App frontend."""
import tornado.escape
import tornado.ioloop
import tornado.web
import tornado.escape
from tornado_cors import CorsMixin
import logging
import json
import os
import signal
import sys
PORT = 3456
DB_PATH = "db.json"
TEST_DB_PATH = "test/test_db.json"
d... | [
"logging.info",
"signal.signal",
"json.load",
"os.path.abspath"
] | [((7399, 7440), 'logging.info', 'logging.info', (['"""server: db_path:"""', 'db_path'], {}), "('server: db_path:', db_path)\n", (7411, 7440), False, 'import logging\n'), ((7627, 7653), 'logging.info', 'logging.info', (['"""exiting..."""'], {}), "('exiting...')\n", (7639, 7653), False, 'import logging\n'), ((7919, 7953)... |
from sofi.ui import Inserted
def test_basic():
assert(str(Inserted()) == "<ins></ins>")
def test_text():
assert(str(Inserted("text")) == "<ins>text</ins>")
def test_custom_class_ident_style_and_attrs():
assert(str(Inserted("text", cl='abclass', ident='123', style="font-size:0.9em;", attrs={"data-test": '... | [
"sofi.ui.Inserted"
] | [((63, 73), 'sofi.ui.Inserted', 'Inserted', ([], {}), '()\n', (71, 73), False, 'from sofi.ui import Inserted\n'), ((126, 142), 'sofi.ui.Inserted', 'Inserted', (['"""text"""'], {}), "('text')\n", (134, 142), False, 'from sofi.ui import Inserted\n'), ((229, 331), 'sofi.ui.Inserted', 'Inserted', (['"""text"""'], {'cl': '"... |
import math
import sklearn.cluster as clstr
import cv2
import numpy as np
from PIL import Image, ImageOps, ImageDraw
import os, glob
import matplotlib.pyplot as pyplt
import scipy.cluster.vq as vq
import argparse
import glob
# We can specify these if need be.
brodatz = "D:\\ImageProcessing\\project\\OriginalBrodatz\\... | [
"PIL.Image.new",
"os.remove",
"numpy.concatenate",
"PIL.ImageOps.fit",
"sklearn.cluster.KMeans",
"math.floor",
"PIL.Image.open",
"cv2.imread",
"cv2.normalize",
"glob.glob",
"PIL.ImageDraw.Draw",
"os.listdir",
"scipy.cluster.vq.whiten",
"argparse.ArgumentTypeError"
] | [((1992, 2017), 'scipy.cluster.vq.whiten', 'vq.whiten', (['featureVectors'], {}), '(featureVectors)\n', (2001, 2017), True, 'import scipy.cluster.vq as vq\n'), ((4589, 4615), 'sklearn.cluster.KMeans', 'clstr.KMeans', ([], {'n_clusters': 'k'}), '(n_clusters=k)\n', (4601, 4615), True, 'import sklearn.cluster as clstr\n')... |
# Copyright 2018 @<NAME>. 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 applicable law or agre... | [
"helpers.batch",
"argparse.ArgumentParser",
"os.getcwd",
"sklearn.metrics.accuracy_score",
"numpy.mean",
"numpy.array",
"scipy.spatial.distance.pdist",
"numpy.random.choice",
"itertools.chain.from_iterable",
"os.listdir"
] | [((715, 726), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (724, 726), False, 'import os\n'), ((7932, 7957), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (7955, 7957), False, 'import argparse\n'), ((10449, 10474), 'os.listdir', 'os.listdir', (['"""nyt_sample/"""'], {}), "('nyt_sample/')\n", (1... |
"""
IsOpenStackCompute
==================
The ``IsOpenStackCompute`` component uses ``PsAuxcww`` parser to determine
OpenStack Compute node. It checks if 'nova-compute' process exist, if not raises
``SkipComponent`` so that the dependent component will not fire. Can be added as
a dependency of a parser so that the par... | [
"insights.core.dr.SkipComponent",
"insights.core.plugins.component"
] | [((521, 540), 'insights.core.plugins.component', 'component', (['PsAuxcww'], {}), '(PsAuxcww)\n', (530, 540), False, 'from insights.core.plugins import component\n'), ((948, 991), 'insights.core.dr.SkipComponent', 'SkipComponent', (['"""Not OpenStack Compute node"""'], {}), "('Not OpenStack Compute node')\n", (961, 991... |
from . import app, api
from . import TestController, TestParameterController
from threading import Lock
TEST_PARAMETER_LOCK = Lock()
api.add_resource(TestController, '/api/tests')
api.add_resource(TestParameterController, '/api/parameters',
resource_class_kwargs ={'lock_obj': TEST_PARAMETER_LOCK})
| [
"threading.Lock"
] | [((128, 134), 'threading.Lock', 'Lock', ([], {}), '()\n', (132, 134), False, 'from threading import Lock\n')] |
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db import models
import cyder
from cyder.cydns.domain.models import Domain, _check_TLD_condition
from cyder.cydns.mixins import ObjectUrlMixin
from cyder.cydns.validation import validate_label, validate_name
from cyder.settings import C... | [
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.core.exceptions.ValidationError",
"cyder.cydns.domain.models._check_TLD_condition"
] | [((1778, 1815), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Domain'], {'null': '(False)'}), '(Domain, null=False)\n', (1795, 1815), False, 'from django.db import models\n'), ((1828, 1917), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'blank': '(True)', 'null': '(True)', 'val... |
import os
from shutil import move as moveFile
os.chdir(os.getcwd())
print("".center(50, "="))
print("Update STEFFLIX-Daten".center(50))
print("".center(50, "="))
homeDir = os.getcwd()
allowedFileTypes = ["jpg", "jpeg", "mp4", "mp3", "png"]
diallowedItems = ["System Volume Information", "$RECYCLE.BIN", ".vscode", "s... | [
"os.getcwd",
"os.path.join",
"os.listdir"
] | [((175, 186), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (184, 186), False, 'import os\n'), ((56, 67), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (65, 67), False, 'import os\n'), ((979, 995), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (989, 995), False, 'import os\n'), ((2641, 2690), 'os.path.join', 'os.... |
from gym.envs.registration import register
from .wrappers import *
from .logger import *
from .envs import *
register(
id='BanditsX2-v0',
kwargs = {'num_bandits' : 2},
entry_point='torch_rl.envs:BanditEnv',
)
register(
id='BanditsX4-v0',
kwargs = {'num_bandits' : 4},
entry_point='torch_rl.env... | [
"gym.envs.registration.register"
] | [((110, 208), 'gym.envs.registration.register', 'register', ([], {'id': '"""BanditsX2-v0"""', 'kwargs': "{'num_bandits': 2}", 'entry_point': '"""torch_rl.envs:BanditEnv"""'}), "(id='BanditsX2-v0', kwargs={'num_bandits': 2}, entry_point=\n 'torch_rl.envs:BanditEnv')\n", (118, 208), False, 'from gym.envs.registration ... |
from django.shortcuts import render
from products.models import Product
from django.views.generic.list import ListView
from django.db.models import Q
class SearchProductView(ListView):
queryset = Product.objects.all()
template_name = "search/searched.html"
def get_context_data(self, *args, **kwargs):
... | [
"products.models.Product.objects.featured",
"products.models.Product.objects.all",
"products.models.Product.objects.search"
] | [((202, 223), 'products.models.Product.objects.all', 'Product.objects.all', ([], {}), '()\n', (221, 223), False, 'from products.models import Product\n'), ((734, 760), 'products.models.Product.objects.featured', 'Product.objects.featured', ([], {}), '()\n', (758, 760), False, 'from products.models import Product\n'), (... |
"""this module is designed to test the version of the APIs required
to see if they are up to date so the program can be run"""
import logging
from news_api import check_news_version
from weather_api import check_weather_version
from covid_api import check_covid_version
logging.basicConfig(filename='pysys.log'... | [
"logging.basicConfig",
"weather_api.check_weather_version",
"logging.info",
"news_api.check_news_version",
"covid_api.check_covid_version"
] | [((280, 424), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""pysys.log"""', 'level': 'logging.INFO', 'format': '"""%(asctime)s %(levelname)-8s%(message)s"""', 'datefmt': '"""%Y-%m-%d %H:%M:%S"""'}), "(filename='pysys.log', level=logging.INFO, format=\n '%(asctime)s %(levelname)-8s%(message)s', d... |
from datetime import datetime
import pandas as pd
from typing import Any, Dict, List, Tuple
class CredData():
"""
Parses information from Sourcecred
- Works with TimelineCred data format (sourcecred <= v0.7x)
"""
def __init__(self, cred_data, accounts_data):
self.cred_json_dat... | [
"pandas.json_normalize",
"pandas.to_datetime",
"datetime.datetime.fromtimestamp"
] | [((2679, 2731), 'datetime.datetime.fromtimestamp', 'datetime.fromtimestamp', (["(interval['endTimeMs'] / 1000)"], {}), "(interval['endTimeMs'] / 1000)\n", (2701, 2731), False, 'from datetime import datetime\n'), ((3497, 3546), 'pandas.json_normalize', 'pd.json_normalize', (["self.accounts_data['accounts']"], {}), "(sel... |
from django.contrib import admin
from translations.admin import TranslatableAdmin, TranslationInline
from .models import Timezone, Continent, Country, City
class TimezoneAdmin(TranslatableAdmin):
inlines = [TranslationInline]
class ContinentAdmin(TranslatableAdmin):
inlines = [TranslationInline]
class Co... | [
"django.contrib.admin.site.register"
] | [((459, 503), 'django.contrib.admin.site.register', 'admin.site.register', (['Timezone', 'TimezoneAdmin'], {}), '(Timezone, TimezoneAdmin)\n', (478, 503), False, 'from django.contrib import admin\n'), ((504, 550), 'django.contrib.admin.site.register', 'admin.site.register', (['Continent', 'ContinentAdmin'], {}), '(Cont... |
import pandas as pd
import numpy as np
from sklearn.metrics import accuracy_score
import torch
from torch.utils.data import DataLoader
import torch.optim as optim
from model import CassavaModel
from loss import DenseCrossEntropy
import dataset
from config import *
def train_one_fold(fold, model, optimizer):
df = p... | [
"loss.DenseCrossEntropy",
"torch.utils.data.DataLoader",
"dataset.CassavaDataset",
"pandas.read_csv",
"torch.argmax",
"numpy.zeros",
"torch.cat",
"torch.softmax",
"torch.optim.Adam",
"torch.device",
"torch.no_grad",
"model.CassavaModel"
] | [((319, 355), 'pandas.read_csv', 'pd.read_csv', (['"""./input/train_ohe.csv"""'], {}), "('./input/train_ohe.csv')\n", (330, 355), True, 'import pandas as pd\n'), ((487, 534), 'dataset.CassavaDataset', 'dataset.CassavaDataset', (['train_df'], {'device': 'DEVICE'}), '(train_df, device=DEVICE)\n', (509, 534), False, 'impo... |
# Copyright 2020 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | [
"fqe.wavefunction.Wavefunction"
] | [((1409, 1447), 'fqe.wavefunction.Wavefunction', 'wavefunction.Wavefunction', (['[[1, 1, 1]]'], {}), '([[1, 1, 1]])\n', (1434, 1447), False, 'from fqe import wavefunction\n')] |
# Generated by Django 3.0.8 on 2020-07-31 12:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Africa', '0005_auto_20200731_1203'),
]
operations = [
migrations.AddField(
model_name='dish',
name='images01',
... | [
"django.db.models.ImageField"
] | [((333, 388), 'django.db.models.ImageField', 'models.ImageField', ([], {'default': '(1)', 'upload_to': '"""main_product/"""'}), "(default=1, upload_to='main_product/')\n", (350, 388), False, 'from django.db import migrations, models\n')] |
"""handles request for user gchart widget."""
from apps.managers.challenge_mgr import challenge_mgr
from apps.widgets.status.models import DailyStatus
def supply(request, page_name):
"""supply view_objects for user status."""
_ = page_name
_ = request
#todays_users = Profile.objects.filter(last_visit... | [
"apps.widgets.status.models.DailyStatus.objects.filter",
"apps.managers.challenge_mgr.challenge_mgr.get_all_round_info"
] | [((372, 406), 'apps.managers.challenge_mgr.challenge_mgr.get_all_round_info', 'challenge_mgr.get_all_round_info', ([], {}), '()\n', (404, 406), False, 'from apps.managers.challenge_mgr import challenge_mgr\n'), ((471, 520), 'apps.widgets.status.models.DailyStatus.objects.filter', 'DailyStatus.objects.filter', ([], {'sh... |
import cv2
from src.utils.heatmap import getHeatmaps
from src.visualization.visualize import visualizeAllHeatmap, visualizeBackgroundHeatmap
keypoints = [ [[100, 100, 2], [105,105, 2]] ]
image = cv2.imread('images/person.jpg')
hmaps = getHeatmaps(image, keypoints, 7)
visualizeAllHeatmap(image, hmaps)
visualizeBackg... | [
"src.visualization.visualize.visualizeAllHeatmap",
"src.utils.heatmap.getHeatmaps",
"cv2.waitKey",
"cv2.imread",
"src.visualization.visualize.visualizeBackgroundHeatmap"
] | [((197, 228), 'cv2.imread', 'cv2.imread', (['"""images/person.jpg"""'], {}), "('images/person.jpg')\n", (207, 228), False, 'import cv2\n'), ((238, 270), 'src.utils.heatmap.getHeatmaps', 'getHeatmaps', (['image', 'keypoints', '(7)'], {}), '(image, keypoints, 7)\n', (249, 270), False, 'from src.utils.heatmap import getHe... |
'''
i actually didn't write this. credit to https://github.com/lipsumar/meme-caption
'''
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
import sys
img = Image.open(sys.argv[1])
draw = ImageDraw.Draw(img)
def drawText(msg, pos):
fontSize = img.width//10
lines = []
font = Im... | [
"PIL.ImageDraw.Draw",
"PIL.ImageFont.truetype",
"PIL.Image.open"
] | [((183, 206), 'PIL.Image.open', 'Image.open', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (193, 206), False, 'from PIL import Image\n'), ((214, 233), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['img'], {}), '(img)\n', (228, 233), False, 'from PIL import ImageDraw\n'), ((318, 360), 'PIL.ImageFont.truetype', 'ImageFont.truet... |
import numpy as np
from ipec.ip.core import parse_subnet_str
from ipec.ip.core import IPStructure
from ipec.ip.core import Interface
from ipec.ip.encoder import Encoder
from ipec.ip.decoder import Decoder
from ipec.ip.core import max_decimal_value_of_binary
# convolutional layer fields
CONV_FIELDS = {
'filter_siz... | [
"ipec.ip.core.IPStructure",
"ipec.ip.core.max_decimal_value_of_binary",
"ipec.ip.core.parse_subnet_str",
"numpy.random.randint",
"ipec.ip.encoder.Encoder",
"ipec.ip.decoder.Decoder"
] | [((3939, 3967), 'ipec.ip.core.parse_subnet_str', 'parse_subnet_str', (['str_subnet'], {}), '(str_subnet)\n', (3955, 3967), False, 'from ipec.ip.core import parse_subnet_str\n'), ((3996, 4015), 'ipec.ip.core.IPStructure', 'IPStructure', (['fields'], {}), '(fields)\n', (4007, 4015), False, 'from ipec.ip.core import IPStr... |
"""
This file holds common functions across all database processing such as
calculating statistics.
"""
import numpy as np
from src import em_constants as emc
def is_outlier(wav, lower, upper):
"""
Checks if an audio sample is an outlier. Bounds are inclusive.
:param wav: The audio time series data poi... | [
"numpy.floor",
"numpy.zeros",
"numpy.any",
"numpy.max",
"numpy.where",
"numpy.unique"
] | [((2301, 2337), 'numpy.unique', 'np.unique', (['label'], {'return_counts': '(True)'}), '(label, return_counts=True)\n', (2310, 2337), True, 'import numpy as np\n'), ((2356, 2382), 'numpy.zeros', 'np.zeros', (['emc.NUM_EMOTIONS'], {}), '(emc.NUM_EMOTIONS)\n', (2364, 2382), True, 'import numpy as np\n'), ((3212, 3249), '... |