repo_name
stringlengths
7
94
repo_path
stringlengths
4
237
repo_head_hexsha
stringlengths
40
40
content
stringlengths
10
680k
apis
stringlengths
2
680k
hanrui1sensetime/mmdeploy
mmdeploy/backend/tensorrt/init_plugins.py
f2594c624b67910e55e24418832bd96685425b2f
# Copyright (c) OpenMMLab. All rights reserved. import ctypes import glob import logging import os def get_ops_path() -> str: """Get path of the TensorRT plugin library. Returns: str: A path of the TensorRT plugin library. """ wildcard = os.path.abspath( os.path.join( os.p...
[((419, 438), 'glob.glob', 'glob.glob', (['wildcard'], {}), '(wildcard)\n', (428, 438), False, 'import glob\n'), ((734, 758), 'os.path.exists', 'os.path.exists', (['lib_path'], {}), '(lib_path)\n', (748, 758), False, 'import os\n'), ((768, 789), 'ctypes.CDLL', 'ctypes.CDLL', (['lib_path'], {}), '(lib_path)\n', (779, 78...
dmitryvinn/ReAgent
reagent/test/world_model/test_seq2reward.py
f98825b9d021ec353a1f9087840a05fea259bf42
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. import logging import os import random import unittest from typing import Optional import numpy as np import pytorch_lightning as pl import torch import torch.nn as nn from parameterized import parameterized from reagent.co...
[((1310, 1337), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1327, 1337), False, 'import logging\n'), ((3281, 3333), 'reagent.gym.envs.Gym', 'Gym', ([], {'env_name': '"""StringGame-v0"""', 'set_max_steps': 'SEQ_LEN'}), "(env_name='StringGame-v0', set_max_steps=SEQ_LEN)\n", (3284, 3333)...
grossmann-group/pyomo-MINLP-benchmarking
models_SHOT_convex/syn30m03hfsg.py
714f0a0dffd61675649a805683c0627af6b4929e
# MINLP written by GAMS Convert at 01/15/21 11:37:33 # # Equation counts # Total E G L N X C B # 1486 571 111 804 0 0 0 0 # # Variable counts # x b i s1s s2s sc ...
[]
sartography/star-drive
backend/tests/test_resources.py
c0f33378d42913c3e677e07f74eb46d7b2b82a0a
import unittest from flask import json from tests.base_test import BaseTest from app import db, elastic_index from app.model.resource import Resource from app.model.resource_category import ResourceCategory from app.model.resource_change_log import ResourceChangeLog from app.model.user import Role class TestResourc...
[((3085, 3129), 'app.elastic_index.remove_document', 'elastic_index.remove_document', (['r', '"""Resource"""'], {}), "(r, 'Resource')\n", (3114, 3129), False, 'from app import db, elastic_index\n'), ((4236, 4293), 'app.model.resource_category.ResourceCategory', 'ResourceCategory', ([], {'resource': 'r', 'category': 'c'...
reubenjacob/kolibri
kolibri/core/auth/management/commands/sync.py
028bb2ad63e438c832ff657d37f7b05c3400f2da
import json import logging import math import re from contextlib import contextmanager from django.core.management import call_command from django.core.management.base import CommandError from morango.models import Filter from morango.models import InstanceIDModel from morango.models import ScopeDefinition from morang...
[((1450, 1477), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1467, 1477), False, 'import logging\n'), ((4195, 4216), 'kolibri.core.auth.models.dataset_cache.clear', 'dataset_cache.clear', ([], {}), '()\n', (4214, 4216), False, 'from kolibri.core.auth.models import dataset_cache\n'), ((...
RezaFirouzii/fum-delta-vision
warp.py
0a8ad1d434006a9aee0a12c1f021c0bca0bc87e2
import math import imageio import cv2 as cv import numpy as np import transformer def fix_rotation(img): img_copy = img.copy() img = cv.cvtColor(img, cv.COLOR_BGR2GRAY) rows, cols = img.shape img = cv.adaptiveThreshold(img, 255, cv.ADAPTIVE_THRESH_MEAN_C, cv.THRESH_BINARY_INV, 15, 9) kernel = cv.g...
[((142, 177), 'cv2.cvtColor', 'cv.cvtColor', (['img', 'cv.COLOR_BGR2GRAY'], {}), '(img, cv.COLOR_BGR2GRAY)\n', (153, 177), True, 'import cv2 as cv\n'), ((215, 306), 'cv2.adaptiveThreshold', 'cv.adaptiveThreshold', (['img', '(255)', 'cv.ADAPTIVE_THRESH_MEAN_C', 'cv.THRESH_BINARY_INV', '(15)', '(9)'], {}), '(img, 255, cv...
sdss/ObserverTools
sdssobstools/boss_data.py
7f9949341edc91a79dac69d79e24af09e8558ffa
#!/usr/bin/env python3 """ A tool to grab a single BOSS image and pull a few items from its header. It is used in bin/sloan_log.py, but it could be used directly as well. """ import argparse from pathlib import Path from astropy.time import Time import fitsio class BOSSRaw: """A class to parse raw data from APOG...
[((1600, 1625), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1623, 1625), False, 'import argparse\n'), ((614, 637), 'fitsio.read_header', 'fitsio.read_header', (['fil'], {}), '(fil)\n', (632, 637), False, 'import fitsio\n'), ((871, 895), 'astropy.time.Time', 'Time', (["header['DATE-OBS']"], ...
bryan-lima/exercicios-livro-introd-prog-python-3ed
capitulo-08/ex13b.py
b6bc26dced9728510865704a80cb0d97f81f756b
# Altere o Programa 8.20 de forma que o usuário tenha três chances de acertar o número # O programa termina se o usuário acertar ou errar três vezes # Programa 8.20 do livro, página 184 # Programa 8.20 - Adivinhando o número # # import random # # n = random.randint(1, 10) # x = int(input('Escolha um número entre 1 e 1...
[((435, 456), 'random.randint', 'random.randint', (['(1)', '(10)'], {}), '(1, 10)\n', (449, 456), False, 'import random\n')]
mariusfrinken/slogviz
slogviz/config.py
0557eda336c257245eefe75699eb2479eb672ca1
# -*- coding: utf-8 -*- """This sub module provides a global variable to check for checking if the non-interactive argument was set Exported variable: interactive -- False, if the main the non-interactive argument was set, True, if it was not set """ global interactive interactive = True;
[]
shb84/ATM76
setup.py
433179bde8935abeaf2ace52fe17dedb7a313487
import setuptools # To use a consistent encoding from codecs import open from os import path here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'README.md'), encoding='utf-8') as f: long_description = f.read() setuptools.setup( name="atm76", version="0.1.0", author="Steven H. Berg...
[((115, 137), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (127, 137), False, 'from os import path\n'), ((150, 178), 'os.path.join', 'path.join', (['here', '"""README.md"""'], {}), "(here, 'README.md')\n", (159, 178), False, 'from os import path\n'), ((569, 595), 'setuptools.find_packages', 's...
indigos33k3r/god-eye
agent/check_plugins/download_speed.py
b2af5ca6dbbd1b302dd5cda1fd0f0c0eee009e76
import logging import asyncio from agent.check_plugins import AbstractCheckPlugin # Do khong biet dung thu vien asyncio ntn ca nen em dung thu vien request # python import requests import sys import time from datetime import datetime logger = logging.getLogger(__name__) class Download(AbstractCheckPlugin): @as...
[((245, 272), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (262, 272), False, 'import logging\n'), ((448, 460), 'time.clock', 'time.clock', ([], {}), '()\n', (458, 460), False, 'import time\n'), ((728, 740), 'time.clock', 'time.clock', ([], {}), '()\n', (738, 740), False, 'import time\n...
AyemunHossain/Django
Setup Rich Text Editor/mysite/main/urls.py
0b1ed21fd6bd2906a4a1a220c029a2193658320f
from django.urls import path from . import views app_name = "main" urlpatterns = [ path("",views.homepage,name="homepage") ]
[((89, 130), 'django.urls.path', 'path', (['""""""', 'views.homepage'], {'name': '"""homepage"""'}), "('', views.homepage, name='homepage')\n", (93, 130), False, 'from django.urls import path\n')]
jcordell/keras-optimization
GA/train.py
cbda84bcf3b31928d829af4afc82af1886877341
""" Utility used by the Network class to actually train. Based on: https://github.com/fchollet/keras/blob/master/examples/mnist_mlp.py """ from keras.datasets import mnist, cifar10 from keras.models import Sequential from keras.layers import Dense, Dropout from keras.utils.np_utils import to_categorical from kera...
[((534, 559), 'keras.callbacks.EarlyStopping', 'EarlyStopping', ([], {'patience': '(5)'}), '(patience=5)\n', (547, 559), False, 'from keras.callbacks import EarlyStopping\n'), ((789, 808), 'keras.datasets.cifar10.load_data', 'cifar10.load_data', ([], {}), '()\n', (806, 808), False, 'from keras.datasets import mnist, ci...
rolandgeider/OpenSlides
tests/integration/agenda/test_models.py
331141c17cb23da26e377d4285efdb4a50753a59
from openslides.agenda.models import Item from openslides.core.models import CustomSlide from openslides.utils.test import TestCase class TestItemManager(TestCase): def test_get_root_and_children_db_queries(self): """ Test that get_root_and_children needs only one db query. """ for...
[((454, 490), 'openslides.agenda.models.Item.objects.get_root_and_children', 'Item.objects.get_root_and_children', ([], {}), '()\n', (488, 490), False, 'from openslides.agenda.models import Item\n')]
mbjahnoon/ssl_context_builder
ssl_context_builder/http_impl/requests_wrapper/secure_session.py
e73530f900b56710c705675e8e657f0bd17f7c07
import weakref import os import requests import ssl from ssl import SSLContext import logging from ssl_context_builder.builder.builder import SslContextBuilder from ssl_context_builder.http_impl.requests_wrapper.ssl_adapter import SslAdapter class RequestsSecureSession: def __init__(self, ssl_context: SSLContex...
[((838, 856), 'requests.Session', 'requests.Session', ([], {}), '()\n', (854, 856), False, 'import requests\n'), ((2087, 2116), 'logging.warning', 'logging.warning', (['warn_message'], {}), '(warn_message)\n', (2102, 2116), False, 'import logging\n'), ((2660, 2680), 'os.path.exists', 'os.path.exists', (['path'], {}), '...
jiaqiangwjq/python_workhouse
tiny_scripts/select_cifar_10.py
c0e739d8bc8ea3d318a0f916e9d79b1f4d4acad9
''' Selected cifar-10. The .csv file format: class_index,data_index 3,0 8,1 8,2 ... ''' import pickle import pandas as pd file = 'E:\pycharm\LEARN\data\cifar-10\cifar-10-batches-py\\test_batch' with open(file, 'rb') as f: dict = pickle.load(f, encoding='bytes') dict.keys() batch_label = dict[b'batch_label'] ...
[((552, 574), 'pandas.DataFrame', 'pd.DataFrame', (['csv_dict'], {}), '(csv_dict)\n', (564, 574), True, 'import pandas as pd\n'), ((238, 270), 'pickle.load', 'pickle.load', (['f'], {'encoding': '"""bytes"""'}), "(f, encoding='bytes')\n", (249, 270), False, 'import pickle\n')]
disqus/codebox
codebox/scripts/fixture.py
9f8e1a9c08c6a79bf3519782be483ff9763c4b4e
# Ghetto Fixtures from codebox import app from codebox.apps.auth.models import User from codebox.apps.snippets.models import Snippet from codebox.apps.organizations.models import Organization, OrganizationMember from flask import g client = app.test_client() _ctx = app.test_request_context() _ctx.push() app.preproces...
[((243, 260), 'codebox.app.test_client', 'app.test_client', ([], {}), '()\n', (258, 260), False, 'from codebox import app\n'), ((268, 294), 'codebox.app.test_request_context', 'app.test_request_context', ([], {}), '()\n', (292, 294), False, 'from codebox import app\n'), ((307, 331), 'codebox.app.preprocess_request', 'a...
akashkj/commcare-hq
corehq/apps/linked_domain/tests/test_views.py
b00a62336ec26cea1477dfb8c048c548cc462831
from unittest.mock import Mock, patch from django.test import SimpleTestCase from corehq.apps.domain.exceptions import DomainDoesNotExist from corehq.apps.linked_domain.exceptions import ( DomainLinkAlreadyExists, DomainLinkError, DomainLinkNotAllowed, ) from corehq.apps.linked_domain.views import link_do...
[((710, 764), 'unittest.mock.patch', 'patch', (['"""corehq.apps.linked_domain.views.domain_exists"""'], {}), "('corehq.apps.linked_domain.views.domain_exists')\n", (715, 764), False, 'from unittest.mock import Mock, patch\n'), ((1057, 1130), 'unittest.mock.patch', 'patch', (['"""corehq.apps.linked_domain.views.domain_e...
Vamsi-TM/jubilant-train
LanguageBasics/functions/import_eg.py
a3ca0216e161ead4f59d923a36587098790beb5d
import function_exercise_01 as st st.sandwich_toppings('meatballs', 'salad')
[((35, 77), 'function_exercise_01.sandwich_toppings', 'st.sandwich_toppings', (['"""meatballs"""', '"""salad"""'], {}), "('meatballs', 'salad')\n", (55, 77), True, 'import function_exercise_01 as st\n')]
golnazads/adsabs-pyingest
pyingest/parsers/zenodo.py
37b37dd9e0d8a6e5cc34c59d30acd14e3381b48e
#!/usr/bin/python # # from __future__ import absolute_import import json import re import logging from .datacite import DataCiteParser class WrongPublisherException(Exception): pass class ZenodoParser(DataCiteParser): def get_references(self, r): # as of version 3.1 of datacite schema, "References...
[((1190, 1216), 're.sub', 're.sub', (['"""\\\\s*<p>"""', '""""""', 'abs'], {}), "('\\\\s*<p>', '', abs)\n", (1196, 1216), False, 'import re\n'), ((1231, 1259), 're.sub', 're.sub', (['"""</p>\\\\s*$"""', '""""""', 'abs'], {}), "('</p>\\\\s*$', '', abs)\n", (1237, 1259), False, 'import re\n'), ((858, 871), 'json.loads', ...
AmeyaDaddikar/vjtichain
src/fullnode.py
2a9b68d475fe5cc2babdf3f5b463a685e8423f05
import json import time from functools import lru_cache from multiprocessing import Pool, Process from threading import Thread, Timer from typing import Any, Dict, List from datetime import datetime import hashlib import inspect import requests import waitress from bottle import BaseTemplate, Bottle, request, response,...
[((723, 731), 'bottle.Bottle', 'Bottle', ([], {}), '()\n', (729, 731), False, 'from bottle import BaseTemplate, Bottle, request, response, static_file, template, error\n'), ((817, 829), 'core.BlockChain', 'BlockChain', ([], {}), '()\n', (827, 829), False, 'from core import Block, BlockChain, SingleOutput, Transaction, ...
alexus37/MasterThesisCode
deepexplain/tf/v1_x/main.py
a7eada603686de75968acc8586fd307a91b0491b
from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf from tensorflow.python.framework import ops from collections import OrderedDict import warnings, logging from deepexplain.tf.v1_x import constants from deepexplain.tf.v1_x.baseClasses i...
[((643, 921), 'collections.OrderedDict', 'OrderedDict', (["{'zero': (DummyZero, 0), 'saliency': (Saliency, 1), 'grad*input': (\n GradientXInput, 2), 'intgrad': (IntegratedGradients, 3), 'elrp': (\n EpsilonLRP, 4), 'deeplift': (DeepLIFTRescale, 5), 'occlusion': (\n Occlusion, 6), 'shapley_sampling': (ShapleySam...
robinupham/cnn_lensing
util/mem_usage.py
f5d4defc7e2c5b7a23744051da904526d04c27c8
""" Get the memory usage of a Keras model. From https://stackoverflow.com/a/46216013. """ def get_model_memory_usage(batch_size, model): """ Get the memory usage of a Keras model in GB. From https://stackoverflow.com/a/46216013. """ import numpy as np try: from keras import backend a...
[((1142, 1152), 'tensorflow.keras.backend.floatx', 'K.floatx', ([], {}), '()\n', (1150, 1152), True, 'from tensorflow.keras import backend as K\n'), ((1200, 1210), 'tensorflow.keras.backend.floatx', 'K.floatx', ([], {}), '()\n', (1208, 1210), True, 'from tensorflow.keras import backend as K\n'), ((1370, 1409), 'numpy.r...
glemaitre/hexrd
hexrd/distortion/distortionabc.py
b68b1ba72e0f480d29bdaae2adbd6c6e2380cc7c
import abc class DistortionABC(metaclass=abc.ABCMeta): maptype = None @abc.abstractmethod def apply(self, xy_in): """Apply distortion mapping""" pass @abc.abstractmethod def apply_inverse(self, xy_in): """Apply inverse distortion mapping""" pass
[]
statisticianinstilettos/recommender_metrics
setup.py
82091ec53eb8b3527f95755006237658deb03c18
import io import os from setuptools import setup def read(file_name): """Read a text file and return the content as a string.""" with io.open(os.path.join(os.path.dirname(__file__), file_name), encoding='utf-8') as f: return f.read() setup( name='recmetrics', url='https://gi...
[((166, 191), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (181, 191), False, 'import os\n')]
wj-Mcat/model-getting-started
run_classifier.py
abe8c9df10b45841eeb38e859e680a37ec03fe8a
# coding=utf-8 # Copyright 2018 The Google AI Language Team 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 ...
[]
TobyChen320/DS-Unit-3-Sprint-2-SQL-and-Databases
module2-sql-for-analysis/rpg_db.py
306d2252b3756a501e2412fcb5eddbdebc16a362
import sqlite3 import os import psycopg2 from dotenv import load_dotenv load_dotenv() DB_NAME2 = os.getenv("DB_NAME3") DB_USER2 = os.getenv("DB_USER3") DB_PASS2 = os.getenv("DB_PASS3") DB_HOST2 = os.getenv("DB_HOST3") conn = psycopg2.connect(dbname=DB_NAME2, user=DB_USER2, ...
[((73, 86), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (84, 86), False, 'from dotenv import load_dotenv\n'), ((99, 120), 'os.getenv', 'os.getenv', (['"""DB_NAME3"""'], {}), "('DB_NAME3')\n", (108, 120), False, 'import os\n'), ((132, 153), 'os.getenv', 'os.getenv', (['"""DB_USER3"""'], {}), "('DB_USER3')\n",...
moff-wildfire/sws-battlefy
sws_comp_wiki_gen.py
04b12b54f91e450980c2c57eed57f0504abec1bb
import battlefy_data import battlefy_wiki_linkings from datetime import datetime from operator import itemgetter from pathlib import Path import calcup_roster_tracking def create_sidebar(data, wiki_name): sidebar = '{{Infobox league' + '\n' sidebar += '|liquipediatier=' + '\n' sidebar += '|name=' + data[...
[((21602, 21651), 'battlefy_wiki_linkings.BattlefyWikiTeamLinkings', 'battlefy_wiki_linkings.BattlefyWikiTeamLinkings', ([], {}), '()\n', (21649, 21651), False, 'import battlefy_wiki_linkings\n'), ((21669, 21720), 'battlefy_wiki_linkings.BattlefyWikiPlayerLinkings', 'battlefy_wiki_linkings.BattlefyWikiPlayerLinkings', ...
DeadZombie14/chillMagicCarPygame
utilidades/texto.py
756bb6d27939bed3c2834222d03096e90f05a788
import pygame class Texto: def __init__(self, screen, text, x, y, text_size = 20, fuente = 'Calibri', italic = False, bold= False, subrayado= False, color = (250, 240, 230), bg = [] ): self.screen = screen fg = color self.coord = x, y #load font, prepare values f...
[((326, 352), 'pygame.font.Font', 'pygame.font.Font', (['None', '(80)'], {}), '(None, 80)\n', (342, 352), False, 'import pygame\n'), ((421, 459), 'pygame.font.SysFont', 'pygame.font.SysFont', (['fuente', 'text_size'], {}), '(fuente, text_size)\n', (440, 459), False, 'import pygame\n'), ((2049, 2070), 'pygame.Color', 'p...
MighTy-Weaver/Inefficient-AC-detection
training_xgboost_model.py
8229f19accd1569ba7b48f77f71783173393d9ed
# This is the code to train the xgboost model with cross-validation for each unique room in the dataset. # Models are dumped into ./models and results are dumped into two csv files in the current work directory. import argparse import json import math import os import pickle import warnings from typing import Tuple i...
[((792, 817), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (815, 817), False, 'import argparse\n'), ((1688, 1721), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (1711, 1721), False, 'import warnings\n'), ((1722, 1764), 'pandas.set_option', 'pd.s...
editorconfig/editorconfig-core-py
setup.py
f43312abcf6888b78ca80f1e95bfa627281746ad
import os from setuptools import setup # Read the version g = {} with open(os.path.join("editorconfig", "version.py"), "rt") as fp: exec(fp.read(), g) v = g['VERSION'] version = ".".join(str(x) for x in v[:3]) if v[3] != "final": version += "-" + v[3] setup( name='EditorConfig', versio...
[((76, 118), 'os.path.join', 'os.path.join', (['"""editorconfig"""', '"""version.py"""'], {}), "('editorconfig', 'version.py')\n", (88, 118), False, 'import os\n')]
wangzy0327/hadoop-cluster-docker
multi_group_memory_contrast.py
cf1de6bf458ade132ad5a688e4f8f9b9968a704a
import numpy as np import matplotlib.pyplot as plt t = np.arange(0,375,6.5) # MEM_1 = [0.031, 0.034, 0.034, 0.034, 0.031, 0.034, 0.034, 0.034, 0.031, 0.033, 0.035, 0.034, 0.031, 0.033, 0.034, 0.034, 0.031, 0.033, 0.034, 0.034, 0.031, 0.033, 0.034, 0.034, 0.031, 0.033, 0.034, 0.034, 0.031, 0.031, 0.031, 0.031, 0.031, 0...
[((56, 78), 'numpy.arange', 'np.arange', (['(0)', '(375)', '(6.5)'], {}), '(0, 375, 6.5)\n', (65, 78), True, 'import numpy as np\n'), ((4837, 4884), 'matplotlib.pyplot.title', 'plt.title', (['"""processing Memory% Analysis"""', 'font1'], {}), "('processing Memory% Analysis', font1)\n", (4846, 4884), True, 'import matpl...
josephburnett/vaping
vaping/config.py
16f9092f0b3c1692e6d1a040f746e1277e197353
import re import munge def parse_interval(val): """ converts a string to float of seconds .5 = 500ms 90 = 1m30s **Arguments** - val (`str`) """ re_intv = re.compile(r"([\d\.]+)([a-zA-Z]+)") val = val.strip() total = 0.0 for match in re_intv.findall(val): ...
[((199, 235), 're.compile', 're.compile', (['"""([\\\\d\\\\.]+)([a-zA-Z]+)"""'], {}), "('([\\\\d\\\\.]+)([a-zA-Z]+)')\n", (209, 235), False, 'import re\n')]
Rubiel1/sktime
sktime/annotation/tests/test_all_annotators.py
2fd2290fb438224f11ddf202148917eaf9b73a87
# -*- coding: utf-8 -*- """Tests for sktime annotators.""" import pandas as pd import pytest from sktime.registry import all_estimators from sktime.utils._testing.estimator_checks import _make_args ALL_ANNOTATORS = all_estimators(estimator_types="series-annotator", return_names=False) @pytest.mark.parametrize("Est...
[((218, 288), 'sktime.registry.all_estimators', 'all_estimators', ([], {'estimator_types': '"""series-annotator"""', 'return_names': '(False)'}), "(estimator_types='series-annotator', return_names=False)\n", (232, 288), False, 'from sktime.registry import all_estimators\n'), ((292, 344), 'pytest.mark.parametrize', 'pyt...
AlexMassin/mlh-react-vr-website
raspberry-pi-camera/cam.py
dc08788ccdecc9923b8dbfd31fa452cb83d214ae
picamera import PiCamera from time import sleep import boto3 import os.path import subprocess s3 = boto3.client('s3') bucket = 'cambucket21' camera = PiCamera() #camera.resolution(1920,1080) x = 0 camerafile = x while True: if (x == 6): x = 1 else: x = x + 1 camera.start_preview() camera.start_recording('/home/pi/' ...
[]
Mikma03/InfoShareacademy_Python_Courses
Part_3_advanced/m04_datetime_and_timedelta/datetime_formats/example_1.py
3df1008c8c92831bebf1625f960f25b39d6987e6
from datetime import datetime def run_example(): moment_in_time = datetime.fromordinal(256) print(moment_in_time) print(moment_in_time.toordinal()) print(moment_in_time.weekday()) print(moment_in_time.isoweekday()) other_moment = datetime.fromtimestamp(16_000_000) print(other_moment) ...
[((72, 97), 'datetime.datetime.fromordinal', 'datetime.fromordinal', (['(256)'], {}), '(256)\n', (92, 97), False, 'from datetime import datetime\n'), ((257, 289), 'datetime.datetime.fromtimestamp', 'datetime.fromtimestamp', (['(16000000)'], {}), '(16000000)\n', (279, 289), False, 'from datetime import datetime\n')]
mxmpl/pykaldi
examples/scripts/segmentation/nnet3-segmenter.py
0570307138c5391cc47b019450d08bcb9686dd98
#!/usr/bin/env python from __future__ import print_function from kaldi.segmentation import NnetSAD, SegmentationProcessor from kaldi.nnet3 import NnetSimpleComputationOptions from kaldi.util.table import SequentialMatrixReader # Construct SAD model = NnetSAD.read_model("final.raw") post = NnetSAD.read_average_poster...
[((254, 285), 'kaldi.segmentation.NnetSAD.read_model', 'NnetSAD.read_model', (['"""final.raw"""'], {}), "('final.raw')\n", (272, 285), False, 'from kaldi.segmentation import NnetSAD, SegmentationProcessor\n'), ((293, 343), 'kaldi.segmentation.NnetSAD.read_average_posteriors', 'NnetSAD.read_average_posteriors', (['"""po...
HeegyuKim/CurseFilter
src/dataset.py
dc4a64aebd997706553c24e919a88e19a3c92dd3
from cProfile import label from matplotlib.pyplot import text import pandas as pd import numpy as np from tokenizers import Tokenizer import torch from torch.utils.data import Dataset, DataLoader from typing import Dict, Any, Tuple from datasets import load_dataset class DataFrameDataset(Dataset): def __init__(se...
[((1245, 1271), 'torch.utils.data.DataLoader', 'DataLoader', (['self'], {}), '(self, **kwargs)\n', (1255, 1271), False, 'from torch.utils.data import Dataset, DataLoader\n'), ((2981, 3013), 'datasets.load_dataset', 'load_dataset', (['"""jason9693/APEACH"""'], {}), "('jason9693/APEACH')\n", (2993, 3013), False, 'from da...
stko/Schnipsl
helper_tools/raspi_OMX-Player_Howto_demo.py
824572c657e48f18950f584b9529661ff5bb8069
#!/usr/bin/python # mp4museum.org by julius schmiedel 2019 import os import sys import glob from subprocess import Popen, PIPE import RPi.GPIO as GPIO FNULL = open(os.devnull, "w") # setup GPIO pin GPIO.setmode(GPIO.BOARD) GPIO.setup(11, GPIO.IN, pull_up_down = GPIO.PUD_DOWN) GPIO.setup(13, GPIO.IN, pull_up_down = ...
[((202, 226), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BOARD'], {}), '(GPIO.BOARD)\n', (214, 226), True, 'import RPi.GPIO as GPIO\n'), ((227, 278), 'RPi.GPIO.setup', 'GPIO.setup', (['(11)', 'GPIO.IN'], {'pull_up_down': 'GPIO.PUD_DOWN'}), '(11, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)\n', (237, 278), True, 'import RPi.GP...
zeyu2001/ICT1002-Python
dash_app/compare_alg.py
76a2c8ad3e3c4a3c873a9259e2a11488c33f2bf7
""" Comparison between the efficiency of the Boyer-Moore algorithm and the naive substring search algorithm. The runtimes for both algorithms are plotted on the same axes. """ import matplotlib.pyplot as plt import numpy as np import string import time import random from bm_alg import boyer_moore_match, naive_match #...
[((2371, 2416), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y_naive'], {'label': '"""Naive Algorithm"""'}), "(x, y_naive, label='Naive Algorithm')\n", (2379, 2416), True, 'import matplotlib.pyplot as plt\n'), ((2421, 2469), 'matplotlib.pyplot.plot', 'plt.plot', (['x', 'y_bm'], {'label': '"""Boyer-Moore Algorithm"""'}...
GMKanat/PP2_spring
TSIS_3/3774.py
423617d559c5690f689741aaa152b9fee5082baf
ans = dict() pairs = dict() def create_tree(p): if p in ans: return ans[p] else: try: res = 0 if p in pairs: for ch in pairs[p]: res += create_tree(ch) + 1 ans[p] = res return res except: pass...
[]
Dorijan-Cirkveni/Miniprojects
italicizer.py
2109275c9c1b9f5e7a286604cbb1b7966dff9798
def italicize(s): b = False res = '' for e in s: if e == '"': if b: res += '{\\i}' + e else: res += e + '{i}' b=not b else: res += e return res def main(): F=open('test_in.txt','r') X=F.read() F...
[]
WPRDC/neighborhood-simulacrum
maps/views.py
46892dfdbc8bc3201e31fee4ee991c49b208753e
import json from typing import Type, TYPE_CHECKING from django.core.exceptions import ObjectDoesNotExist from django.utils.decorators import method_decorator from django.views.decorators.cache import cache_page from rest_framework import viewsets, filters from rest_framework.exceptions import NotFound from rest_framew...
[((1032, 1055), 'maps.models.DataLayer.objects.all', 'DataLayer.objects.all', ([], {}), '()\n', (1053, 1055), False, 'from maps.models import DataLayer\n'), ((1501, 1517), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (1511, 1517), False, 'import json\n'), ((3018, 3035), 'rest_framework.response.Response', 'R...
Kuree/magma
magma/operators.py
be2439aa897768c5810be72e3a55a6f772ac83cf
from magma import _BitType, BitType, BitsType, UIntType, SIntType class MantleImportError(RuntimeError): pass class UndefinedOperatorError(RuntimeError): pass def raise_mantle_import_error_unary(self): raise MantleImportError( "Operators are not defined until mantle has been imported") def r...
[]
bquantump/sultan
src/sultan/result.py
a46e8dc9b09385a7226f6151134ae2417166f25d
import subprocess import sys import time import traceback from queue import Queue from sultan.core import Base from sultan.echo import Echo from threading import Thread class Result(Base): """ Class that encompasses the result of a POpen command. """ def __init__(self, process, commands, context, st...
[((570, 576), 'sultan.echo.Echo', 'Echo', ([], {}), '()\n', (574, 576), False, 'from sultan.echo import Echo\n'), ((2864, 2874), 'sys.exit', 'sys.exit', ([], {}), '()\n', (2872, 2874), False, 'import sys\n'), ((790, 797), 'queue.Queue', 'Queue', ([], {}), '()\n', (795, 797), False, 'from queue import Queue\n'), ((826, ...
orenovadia/great_expectations
great_expectations/cli/datasource.py
76ef0c4e066227f8b589a1ee6ac885618f65906e
import os import click from .util import cli_message from great_expectations.render import DefaultJinjaPageView from great_expectations.version import __version__ as __version__ def add_datasource(context): cli_message( """ ========== Datasources ========== See <blue>https://docs.greatexpectations.io/en...
[((1352, 1449), 'click.prompt', 'click.prompt', (['msg_prompt_datasource_name'], {'default': 'default_data_source_name', 'show_default': '(True)'}), '(msg_prompt_datasource_name, default=default_data_source_name,\n show_default=True)\n', (1364, 1449), False, 'import click\n'), ((5223, 5262), 'click.confirm', 'click....
rgb-24bit/code-library
python/crawler/downloader.py
8da8336e241e1428b2b46c6939bd5e9eadcf3e68
# -*- coding: utf-8 -*- """ Provide download function by request """ from datetime import datetime import logging import time import urllib.parse import requests from bs4 import BeautifulSoup class Throttle(object): """Throttle downloading by sleeping between requests to same domain.""" de...
[((891, 905), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (903, 905), False, 'from datetime import datetime\n'), ((1334, 1352), 'requests.Session', 'requests.Session', ([], {}), '()\n', (1350, 1352), False, 'import requests\n'), ((2118, 2161), 'requests.Request', 'requests.Request', (['"""GET"""', 'url']...
pisskidney/leetcode
medium/151.py
08c19cbf3d7afc897908ea05db4ad11a5487f523
#!/usr/bin/python class Solution(object): def reverseWords(self, s): if s == '': return s res = [] i = len(s) - 2 while i >= -1: if s[i] == ' ' or i == -1: word = '' j = i + 1 while j < len(s) and s[j] != ' ': ...
[]
ecederstrand/python-keycloak
src/keycloak/connection.py
77686a2764a3fcba092d78e02f42a58c7214c30e
# -*- coding: utf-8 -*- # # The MIT License (MIT) # # Copyright (C) 2017 Marcos Pereira <marcospereira.mpj@gmail.com> # # 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, in...
[((2009, 2027), 'requests.Session', 'requests.Session', ([], {}), '()\n', (2025, 2027), False, 'import requests\n'), ((2339, 2365), 'requests.adapters.HTTPAdapter', 'HTTPAdapter', ([], {'max_retries': '(1)'}), '(max_retries=1)\n', (2350, 2365), False, 'from requests.adapters import HTTPAdapter\n'), ((5000, 5028), 'urlp...
Valokoodari/advent-of-code
2020/23.py
c664987f739e0b07ddad34bad87d56768556a5a5
#!venv/bin/python3 cs = [int(c) for c in open("inputs/23.in", "r").readline().strip()] def f(cs, ts): p,cc = {n: cs[(i+1)%len(cs)] for i,n in enumerate(cs)},cs[-1] for _ in range(ts): cc,dc = p[cc],p[cc]-1 if p[cc]-1 > 0 else max(p.keys()) hc,p[cc] = [p[cc], p[p[cc]], p[p[p[cc]]]],p[p[p[p[cc]]...
[]
jakewright/home-automation-device-registry
run.py
b073966b1dc259a6997c47f8d369f51dee9cbbf3
# Import the application from device_registry import app # Run the application in debug mode app.run(host='0.0.0.0', port=int(app.config['PORT']), debug=True)
[]
Abrosimov-a-a/dvc
dvc/utils/stage.py
93280c937b9160003afb0d2f3fd473c03d6d9673
import yaml from ruamel.yaml import YAML from ruamel.yaml.error import YAMLError try: from yaml import CSafeLoader as SafeLoader except ImportError: from yaml import SafeLoader from dvc.exceptions import StageFileCorruptedError from dvc.utils.compat import open def load_stage_file(path): with open(path,...
[((310, 343), 'dvc.utils.compat.open', 'open', (['path', '"""r"""'], {'encoding': '"""utf-8"""'}), "(path, 'r', encoding='utf-8')\n", (314, 343), False, 'from dvc.utils.compat import open\n'), ((960, 966), 'ruamel.yaml.YAML', 'YAML', ([], {}), '()\n', (964, 966), False, 'from ruamel.yaml import YAML\n'), ((1132, 1165),...
Arguel/old-projects
CAMPODETIRO/test.py
2e5f594a6303b2e137acf555569eca98aab08054
entrada = input("palabra") listaDeLetras = [] for i in entrada: listaDeLetras.append(i)
[]
fire-breathing-rubber-lemons/cs207-FinalProject
demos/nn_classification_demo.py
92d1d7d70637e2478effb01c9ce56199e0f873c9
import numpy as np from pyad.nn import NeuralNet from sklearn.datasets import load_breast_cancer from sklearn.model_selection import train_test_split np.random.seed(0) data = load_breast_cancer() X_train, X_test, y_train, y_test = train_test_split( data.data, data.target, train_size=0.8, random_state=0 ) nn = Ne...
[((151, 168), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (165, 168), True, 'import numpy as np\n'), ((176, 196), 'sklearn.datasets.load_breast_cancer', 'load_breast_cancer', ([], {}), '()\n', (194, 196), False, 'from sklearn.datasets import load_breast_cancer\n'), ((233, 305), 'sklearn.model_selecti...
zobclub/chapter8
mgatemp.py
fbd9e8711747b7446f75b472bae1465fe0ab495c
from microbit import * I2CADR = 0x0E DIE_TEMP = 0x0F while True: i2c.write(I2CADR, bytearray([DIE_TEMP])) d = i2c.read(I2CADR, 1) x = d[0] if x >=128: x -= 256 x += 10 print(x) sleep(500)
[]
splovyt/SFPython-Project-Night
utils/nlp.py
50f20f581e074401d59d91457bac2a69631bef61
import ssl import nltk from textblob import TextBlob from nltk.corpus import stopwords # set SSL try: _create_unverified_https_context = ssl._create_unverified_context except AttributeError: pass else: ssl._create_default_https_context = _create_unverified_https_context # download noun data (if required...
[((322, 344), 'nltk.download', 'nltk.download', (['"""brown"""'], {}), "('brown')\n", (335, 344), False, 'import nltk\n'), ((345, 367), 'nltk.download', 'nltk.download', (['"""punkt"""'], {}), "('punkt')\n", (358, 367), False, 'import nltk\n'), ((368, 394), 'nltk.download', 'nltk.download', (['"""stopwords"""'], {}), "...
akshedu/toolbox
toolbox/core/management/commands/celery_beat_resource_scraper.py
7c647433b68f1098ee4c8623f836f74785dc970c
from django_celery_beat.models import PeriodicTask, IntervalSchedule from django.core.management.base import BaseCommand from django.db import IntegrityError class Command(BaseCommand): def handle(self, *args, **options): try: schedule_channel, created = IntervalSchedule.objects.get_or_create...
[((282, 360), 'django_celery_beat.models.IntervalSchedule.objects.get_or_create', 'IntervalSchedule.objects.get_or_create', ([], {'every': '(4)', 'period': 'IntervalSchedule.HOURS'}), '(every=4, period=IntervalSchedule.HOURS)\n', (320, 360), False, 'from django_celery_beat.models import PeriodicTask, IntervalSchedule\n...
zhusonghe/PaddleClas-1
ppcls/data/preprocess/__init__.py
e2e492f9c78ed5084cc50d7c45eef4cc41e1eeaf
# Copyright (c) 2021 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 appli...
[((2121, 2146), 'numpy.ascontiguousarray', 'np.ascontiguousarray', (['img'], {}), '(img)\n', (2141, 2146), True, 'import numpy as np\n'), ((2165, 2185), 'PIL.Image.fromarray', 'Image.fromarray', (['img'], {}), '(img)\n', (2180, 2185), False, 'from PIL import Image\n'), ((2283, 2298), 'numpy.asarray', 'np.asarray', (['i...
scheeloong/lindaedynamics_icml2018
src/scalar_net/visualisations.py
d03b450e254d33b019161a3cd015e44aafe407cb
# required modules import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from matplotlib import cm from matplotlib.colors import Normalize from mpl_toolkits.mplot3d import Axes3D from matplotlib.animation import FuncAnimation # two-dimesional version def plot_mse_loss_surface_2d(fi...
[((434, 480), 'numpy.linspace', 'np.linspace', (['w1_range[0]', 'w1_range[1]'], {'num': 'n_w'}), '(w1_range[0], w1_range[1], num=n_w)\n', (445, 480), True, 'import numpy as np\n'), ((502, 548), 'numpy.linspace', 'np.linspace', (['w2_range[0]', 'w2_range[1]'], {'num': 'n_w'}), '(w2_range[0], w2_range[1], num=n_w)\n', (5...
kshithijiyer/qkeras
tests/qconvolutional_test.py
78ac608c6dcd84151792a986d03fe7afb17929cf
# Copyright 2019 Google LLC # # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
[((1761, 1793), 'tensorflow.keras.layers.Input', 'Input', (['(28, 28, 1)'], {'name': '"""input"""'}), "((28, 28, 1), name='input')\n", (1766, 1793), False, 'from tensorflow.keras.layers import Input\n'), ((2913, 2946), 'tensorflow.keras.models.Model', 'Model', ([], {'inputs': '[x_in]', 'outputs': '[x]'}), '(inputs=[x_i...
Lapis256/discord-ext-ui
discord/ext/ui/select.py
593de0a1107d2a0c26023587a2937f00ecec3ed1
from typing import Optional, List, TypeVar, Generic, Callable import discord.ui from .item import Item from .select_option import SelectOption from .custom import CustomSelect def _default_check(_: discord.Interaction) -> bool: return True C = TypeVar("C", bound=discord.ui.Select) class Select(Item, Generic...
[((254, 291), 'typing.TypeVar', 'TypeVar', (['"""C"""'], {'bound': 'discord.ui.Select'}), "('C', bound=discord.ui.Select)\n", (261, 291), False, 'from typing import Optional, List, TypeVar, Generic, Callable\n')]
parag-may4/ucscsdk
ucscsdk/mometa/storage/StorageScsiLunRef.py
2ea762fa070330e3a4e2c21b46b157469555405b
"""This module contains the general information for StorageScsiLunRef ManagedObject.""" from ...ucscmo import ManagedObject from ...ucsccoremeta import UcscVersion, MoPropertyMeta, MoMeta from ...ucscmeta import VersionMeta class StorageScsiLunRefConsts(): pass class StorageScsiLunRef(ManagedObject): """Th...
[]
latrocinia/saxstools
saxstools/fullsaxs.py
8e88474f62466b745791c0ccbb07c80a959880f3
from __future__ import print_function, absolute_import, division from sys import stdout as _stdout from time import time as _time import numpy as np try: import pyfftw pyfftw.interfaces.cache.enable() pyfftw.interfaces.cache.set_keepalive_time(10) rfftn = pyfftw.interfaces.numpy_fft.rfftn irfftn =...
[]
zehuilu/Learning-from-Sparse-Demonstrations
lib/generate_random_obs.py
4d652635c24f847fe51bc050773762b549ce41c0
#!/usr/bin/env python3 import os import sys import time sys.path.append(os.getcwd()+'/lib') import random from dataclasses import dataclass, field from ObsInfo import ObsInfo def generate_random_obs(num_obs: int, size_list: list, config_data): """ config_file_name = "config.json" json_file = open(config_f...
[((72, 83), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (81, 83), False, 'import os\n'), ((548, 659), 'random.uniform', 'random.uniform', (["config_data['LAB_SPACE_LIMIT']['LIMIT_X'][0]", "config_data['LAB_SPACE_LIMIT']['LIMIT_X'][1]"], {}), "(config_data['LAB_SPACE_LIMIT']['LIMIT_X'][0], config_data[\n 'LAB_SPACE_L...
Abucuyy/Uciha
userbot/helper_funcs/misc.py
726e9cd61eabf056064e40f7b322d8993161e52a
# TG-UserBot - A modular Telegram UserBot script for Python. # Copyright (C) 2019 Kandarp <https://github.com/kandnub> # # TG-UserBot is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of t...
[]
HarryTheBird/gym-multilayerthinfilm
gym-multilayerthinfilm/utils.py
22eda96e71e95e9ea1b491fae633c4a32fadb023
import numpy as np def get_n_from_txt(filepath, points=None, lambda_min=400, lambda_max=700, complex_n=True): ntxt = np.loadtxt(filepath) if np.min(np.abs(ntxt[:, 0] - lambda_min)) > 25 or np.min(np.abs(ntxt[:, 0] - lambda_max)) > 25: print('No measurement data for refractive indicies are available wit...
[((122, 142), 'numpy.loadtxt', 'np.loadtxt', (['filepath'], {}), '(filepath)\n', (132, 142), True, 'import numpy as np\n'), ((1406, 1418), 'numpy.vstack', 'np.vstack', (['n'], {}), '(n)\n', (1415, 1418), True, 'import numpy as np\n'), ((440, 473), 'numpy.abs', 'np.abs', (['(ntxt[:, (0)] - lambda_min)'], {}), '(ntxt[:, ...
joaopalmeiro/pyrocco
pyrocco/__init__.py
4144f56d654500c3ec49cb04c06b98296004eafe
__package_name__ = "pyrocco" __version__ = "0.1.0" __author__ = "João Palmeiro" __author_email__ = "jm.palmeiro@campus.fct.unl.pt" __description__ = "A Python CLI to add the Party Parrot to a custom background image." __url__ = "https://github.com/joaopalmeiro/pyrocco"
[]
ingjrs01/adventofcode
2020/day08/machine.py
c5e4f0158dac0efc2dbfc10167f2700693b41fea
class Machine(): def __init__(self): self.pointer = 0 self.accum = 0 self.visited = [] def run(self,program): salir = False while (salir == False): if (self.pointer in self.visited): return False if (self.pointer >= len(progr...
[]
BAOOOOOM/EduData
EduData/Task/__init__.py
affa465779cb94db00ed19291f8411229d342c0f
# coding: utf-8 # 2019/8/23 @ tongshiwei
[]
richardvecsey/python-basics
010-round.py
b66abef77bce2ddd6f2f39b631e1dd97a9aa2fac
""" Round a number -------------- Input (float) A floating point number (int) Number of decimals Default value is: 0 Output (float) Rounded number (int) Whether using the default decimals value, the return number will be the nearest ...
[]
Kleist/MusicPlayer
service.py
95f634d1e4d47e7b430e32ad9224d94ad0453c82
#!/usr/bin/env python3 import RPi.GPIO as GPIO from mfrc522 import SimpleMFRC522 import play import time class TagPlayer(object): def __init__(self): self._current = None self.reader = SimpleMFRC522() self._failed = 0 def step(self): id, text = self.reader.read_no_block() ...
[((209, 224), 'mfrc522.SimpleMFRC522', 'SimpleMFRC522', ([], {}), '()\n', (222, 224), False, 'from mfrc522 import SimpleMFRC522\n'), ((809, 822), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (819, 822), False, 'import time\n'), ((938, 952), 'RPi.GPIO.cleanup', 'GPIO.cleanup', ([], {}), '()\n', (950, 952), True, ...
ckanesan/mypy
mypy/defaults.py
ffb3ce925e8bb3376e19f942c7d3a3806c9bba97
import os MYPY = False if MYPY: from typing_extensions import Final PYTHON2_VERSION = (2, 7) # type: Final PYTHON3_VERSION = (3, 6) # type: Final PYTHON3_VERSION_MIN = (3, 4) # type: Final CACHE_DIR = '.mypy_cache' # type: Final CONFIG_FILE = 'mypy.ini' # type: Final SHARED_CONFIG_FILES = ['setup.cfg', ] # ...
[((413, 446), 'os.environ.get', 'os.environ.get', (['"""XDG_CONFIG_HOME"""'], {}), "('XDG_CONFIG_HOME')\n", (427, 446), False, 'import os\n'), ((480, 538), 'os.path.join', 'os.path.join', (["os.environ['XDG_CONFIG_HOME']", '"""mypy/config"""'], {}), "(os.environ['XDG_CONFIG_HOME'], 'mypy/config')\n", (492, 538), False,...
elcolie/scikit-criteria
skcriteria/preprocessing/push_negatives.py
216674d699b60d68fefa98d44afd619943f3bb00
#!/usr/bin/env python # -*- coding: utf-8 -*- # License: BSD-3 (https://tldrlegal.com/license/bsd-3-clause-license-(revised)) # Copyright (c) 2016-2021, Cabral, Juan; Luczywo, Nadia # All rights reserved. # ============================================================================= # DOCS # =========================...
[((2611, 2626), 'numpy.asarray', 'np.asarray', (['arr'], {}), '(arr)\n', (2621, 2626), True, 'import numpy as np\n'), ((2638, 2675), 'numpy.min', 'np.min', (['arr'], {'axis': 'axis', 'keepdims': '(True)'}), '(arr, axis=axis, keepdims=True)\n', (2644, 2675), True, 'import numpy as np\n')]
Ingenico/direct-sdk-python3
ingenico/direct/sdk/domain/customer_token.py
d2b30b8e8afb307153a1f19ac4c054d5344449ce
# -*- coding: utf-8 -*- # # This class was auto-generated from the API references found at # https://support.direct.ingenico.com/documentation/api/reference/ # from ingenico.direct.sdk.data_object import DataObject from ingenico.direct.sdk.domain.address import Address from ingenico.direct.sdk.domain.company_informatio...
[((2597, 2606), 'ingenico.direct.sdk.domain.address.Address', 'Address', ([], {}), '()\n', (2604, 2606), False, 'from ingenico.direct.sdk.domain.address import Address\n'), ((2941, 2961), 'ingenico.direct.sdk.domain.company_information.CompanyInformation', 'CompanyInformation', ([], {}), '()\n', (2959, 2961), False, 'f...
pirate/macOS-global-autocomplete
inserter.py
4ba8c3efdd34e7b4c0044c50f47d21a1bafd9aac
import time import pykeyboard # TODO: Replace following two lines with the code that activate the application. print('Activate the application 3 seconds.') time.sleep(3) k = pykeyboard.PyKeyboard() k.press_key(k.left_key) time.sleep(1) # Hold down left key for 1 second. k.release_key(k.left_key)
[((159, 172), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (169, 172), False, 'import time\n'), ((178, 201), 'pykeyboard.PyKeyboard', 'pykeyboard.PyKeyboard', ([], {}), '()\n', (199, 201), False, 'import pykeyboard\n'), ((226, 239), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (236, 239), False, 'import t...
EleutherAI/megatron-3d
tools/corpora.py
be3014d47a127f08871d0ba6d6389363f2484397
import os import tarfile from abc import ABC, abstractmethod from glob import glob import shutil import random import zstandard """ This registry is for automatically downloading and extracting datasets. To register a class you need to inherit the DataDownloader class, provide name, filetype and url attributes, and (...
[((648, 684), 'os.environ.get', 'os.environ.get', (['"""DATA_DIR"""', '"""./data"""'], {}), "('DATA_DIR', './data')\n", (662, 684), False, 'import os\n'), ((4552, 4588), 'os.makedirs', 'os.makedirs', (['DATA_DIR'], {'exist_ok': '(True)'}), '(DATA_DIR, exist_ok=True)\n', (4563, 4588), False, 'import os\n'), ((1524, 1562...
aka256/othello-rl
othello_rl/qlearning/qlearning.py
ef5e78c6cf6b276e16b50086b53138ab968d728c
from logging import getLogger logger = getLogger(__name__) class QLearning: """ Q-Learning用のクラス Attributes ---------- alpha : float 学習率α gamma : float 割引率γ data : dict Q-Learningでの学習結果の保存用辞書 init_value : float dataの初期値 """ def __init__(self, alpha: float, gamma: float, data: dict ...
[((40, 59), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (49, 59), False, 'from logging import getLogger\n')]
loftwah/appscale
SearchService/test/unit/test_solr_interface.py
586fc1347ebc743d7a632de698f4dbfb09ae38d6
#!/usr/bin/env python import os import json import sys import unittest import urllib2 from flexmock import flexmock sys.path.append(os.path.join(os.path.dirname(__file__), "../../")) import solr_interface import search_exceptions class FakeSolrDoc(): def __init__(self): self.fields = [] class FakeDocument():...
[((148, 173), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (163, 173), False, 'import os\n'), ((1287, 1297), 'flexmock.flexmock', 'flexmock', ([], {}), '()\n', (1295, 1297), False, 'from flexmock import flexmock\n'), ((1400, 1421), 'solr_interface.Solr', 'solr_interface.Solr', ([], {}), '()...
ppm-avinder/payabbhi-python
payabbhi/error.py
0f84f01349e365753f4b83eee584618e1a855567
class PayabbhiError(Exception): def __init__(self, description=None, http_status=None, field=None): self.description = description self.http_status = http_status self.field = field self._message = self.error_message() super(PayabbhiError, self).__init__(self...
[]
TsinghuaAI/CPM-2-Pretrain
src/mpu/__init__.py
33003865239e7ba13a12aabf9ec2735cef66bf3b
# coding=utf-8 # Copyright (c) 2019, NVIDIA CORPORATION. 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 re...
[]
MateusMolina/lunoERP
djangosige/apps/cadastro/models/empresa.py
0880adb93b3a2d3169c6780efa60a229272f927a
# -*- coding: utf-8 -*- import os from django.db import models from django.db.models.signals import post_delete from django.dispatch import receiver from .base import Pessoa from djangosige.apps.login.models import Usuario from djangosige.configs.settings import MEDIA_ROOT def logo_directory_path(inst...
[((1620, 1657), 'django.dispatch.receiver', 'receiver', (['post_delete'], {'sender': 'Empresa'}), '(post_delete, sender=Empresa)\n', (1628, 1657), False, 'from django.dispatch import receiver\n'), ((535, 638), 'django.db.models.ImageField', 'models.ImageField', ([], {'upload_to': 'logo_directory_path', 'default': '"""i...
silverriver/Stylized_Dialog
WDJN/eval/eval.py
559dd97c4ec9c91e94deb048f789684ef3f1f9fa
import os from nltk.translate.bleu_score import corpus_bleu from nltk.translate.bleu_score import SmoothingFunction import json from tqdm import tqdm, trange from random import sample import numpy as np import pickle import argparse import bert_eval_acc import svm_eval_acc smooth = SmoothingFunction() def eval_bleu...
[((285, 304), 'nltk.translate.bleu_score.SmoothingFunction', 'SmoothingFunction', ([], {}), '()\n', (302, 304), False, 'from nltk.translate.bleu_score import SmoothingFunction\n'), ((5559, 5584), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (5582, 5584), False, 'import argparse\n'), ((5799, 5...
olbjan/home-assistant-1
homeassistant/components/unifi/const.py
1adb45f74e96fc5eff137a3727647a7e428e123c
"""Constants for the UniFi component.""" import logging LOGGER = logging.getLogger(__package__) DOMAIN = "unifi" CONTROLLER_ID = "{host}-{site}" CONF_CONTROLLER = "controller" CONF_SITE_ID = "site" UNIFI_WIRELESS_CLIENTS = "unifi_wireless_clients" CONF_ALLOW_BANDWIDTH_SENSORS = "allow_bandwidth_sensors" CONF_BLOCK...
[((66, 96), 'logging.getLogger', 'logging.getLogger', (['__package__'], {}), '(__package__)\n', (83, 96), False, 'import logging\n')]
Jahidul007/Python-Bootcamp
coding_intereview/1656. Design an Ordered Stream.py
3c870587465ff66c2c1871c8d3c4eea72463abda
class OrderedStream: def __init__(self, n: int): self.data = [None]*n self.ptr = 0 def insert(self, id: int, value: str) -> List[str]: id -= 1 self.data[id] = value if id > self.ptr: return [] while self.ptr < len(self.data) and self.data[self.ptr]: ...
[]
EQt/treelas
python/test/test_tree_dp.py
24a5cebf101180822198806c0a4131b0efb7a36d
import numpy as np from treelas import post_order, TreeInstance def test_demo_3x7_postord(): parent = np.array([0, 4, 5, 0, 3, 4, 7, 8, 5, 6, 7, 8, 9, 14, 17, 12, 15, 16, 19, 16, 17]) po = post_order(parent, include_root=True) expect = np.array([12, 11, 19, 20, 21, 14, 15, 18, 17, 1...
[((108, 193), 'numpy.array', 'np.array', (['[0, 4, 5, 0, 3, 4, 7, 8, 5, 6, 7, 8, 9, 14, 17, 12, 15, 16, 19, 16, 17]'], {}), '([0, 4, 5, 0, 3, 4, 7, 8, 5, 6, 7, 8, 9, 14, 17, 12, 15, 16, 19, 16,\n 17])\n', (116, 193), True, 'import numpy as np\n'), ((222, 259), 'treelas.post_order', 'post_order', (['parent'], {'inclu...
SD-CC-UFG/leonardo.fleury
lista01/rpc/ex01_cl.py
0a8dfc5752c739f5ff98890477355df8960ad730
import xmlrpc.client def main(): s = xmlrpc.client.ServerProxy('http://localhost:9991') nome = input("Nome: ") cargo = input("Cargo (programador, operador): ") salario = float(input("Salário: ")) print("\n\n{}".format(s.atualiza_salario(nome, cargo, salario))) if __name__ == '__main__': m...
[]
openshift-eng/art-dashboard-server
autocomplete/migrations/0001_initial.py
af4e78b3d2213c30038cf69de646f25fd57c9e3c
# Generated by Django 3.0.7 on 2020-07-27 19:23 import build.models from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='AutoCompleteRecord', fields=[ ...
[((548, 599), 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)', 'serialize': '(False)'}), '(primary_key=True, serialize=False)\n', (564, 599), False, 'from django.db import migrations, models\n'), ((627, 658), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}),...
fcollman/pytorch-3dunet
unet3d/config.py
303336bfdc0234f075c70e0c59759d09bc4081b8
import argparse import os import torch import yaml DEFAULT_DEVICE = 'cuda:0' def load_config(): parser = argparse.ArgumentParser(description='UNet3D training') parser.add_argument('--config', type=str, help='Path to the YAML config file', required=True) args = parser.parse_args() config = _load_conf...
[((113, 167), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""UNet3D training"""'}), "(description='UNet3D training')\n", (136, 167), False, 'import argparse\n'), ((473, 498), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (496, 498), False, 'import torch\n')]
gunpowder78/webdnn
src/graph_transpiler/webdnn/backend/webgl/optimize_rules/simplify_channel_mode_conversion/simplify_channel_mode_conversion.py
c659ea49007f91d178ce422a1eebe289516a71ee
from webdnn.backend.webgl.optimize_rules.simplify_channel_mode_conversion.simplify_nonsense_channel_mode_conversion import \ SimplifyNonsenseChannelModeConversion from webdnn.backend.webgl.optimize_rules.simplify_channel_mode_conversion.simplify_redundant_channel_mode_conversion import \ SimplifyRedundantChanne...
[((549, 589), 'webdnn.backend.webgl.optimize_rules.simplify_channel_mode_conversion.simplify_redundant_channel_mode_conversion.SimplifyRedundantChannelModeConversion', 'SimplifyRedundantChannelModeConversion', ([], {}), '()\n', (587, 589), False, 'from webdnn.backend.webgl.optimize_rules.simplify_channel_mode_conversio...
akuala/REPO.KUALA
script.video.F4mProxy/lib/flvlib/constants.py
ea9a157025530d2ce8fa0d88431c46c5352e89d4
""" The constants used in FLV files and their meanings. """ # Tag type (TAG_TYPE_AUDIO, TAG_TYPE_VIDEO, TAG_TYPE_SCRIPT) = (8, 9, 18) # Sound format (SOUND_FORMAT_PCM_PLATFORM_ENDIAN, SOUND_FORMAT_ADPCM, SOUND_FORMAT_MP3, SOUND_FORMAT_PCM_LITTLE_ENDIAN, SOUND_FORMAT_NELLYMOSER_16KHZ, SOUND_FORMAT_NELLYMOSER_8KH...
[]
Rogerwlk/Natural-Language-Processing
A2/semcor_chunk.py
e1c0499180cec49ac0060aad7f0da00b61cfac94
from nltk.corpus import semcor class semcor_chunk: def __init__(self, chunk): self.chunk = chunk #returns the synset if applicable, otherwise returns None def get_syn_set(self): try: synset = self.chunk.label().synset() return synset except AttributeError: try: synset = wn.synset(self.chunk.lab...
[]
thoang3/graph_neural_network_benchmark
gnn_model.py
72dc031ed23c6684c43d6f2ace03425f9b69cee6
import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers from load_cora import load_cora from baseline_model import create_ffn from utils import run_experiment from utils import display_learning_curves # Graph convolution layer class GraphConvLayer(layers.Layer): def __init__( ...
[((6709, 6729), 'load_cora.load_cora', 'load_cora', ([], {'verbose': '(1)'}), '(verbose=1)\n', (6718, 6729), False, 'from load_cora import load_cora\n'), ((7127, 7156), 'tensorflow.ones', 'tf.ones', ([], {'shape': 'edges.shape[1]'}), '(shape=edges.shape[1])\n', (7134, 7156), True, 'import tensorflow as tf\n'), ((7921, ...
jfarmer08/hassio
deps/lib/python3.5/site-packages/netdisco/discoverables/samsung_tv.py
792a6071a97bb33857c14c9937946233c620035c
"""Discover Samsung Smart TV services.""" from . import SSDPDiscoverable from ..const import ATTR_NAME # For some models, Samsung forces a [TV] prefix to the user-specified name. FORCED_NAME_PREFIX = '[TV]' class Discoverable(SSDPDiscoverable): """Add support for discovering Samsung Smart TV services.""" de...
[]
scrambler-crypto/pyecsca
pyecsca/sca/re/__init__.py
491abfb548455669abd470382a48dcd07b2eda87
"""Package for reverse-engineering.""" from .rpa import *
[]
Juhanostby/django-apotek-sapmi
sapmi/employees/migrations/0002_remove_employee_phone_alt.py
972a05ca9d54eed62b640572fcf582cc8751d15a
# Generated by Django 3.2.5 on 2021-12-21 19:42 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('employees', '0001_initial'), ] operations = [ migrations.RemoveField( model_name='employee', name='phone_alt', ), ...
[((218, 281), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""employee"""', 'name': '"""phone_alt"""'}), "(model_name='employee', name='phone_alt')\n", (240, 281), False, 'from django.db import migrations\n')]
konrad2508/kokomi-discord-bot
src/model/exception/emote_fetch_error.py
5a9d459e92d552fa24ba3ada5188db19d93f0aaa
class EmoteFetchError(Exception): '''Exception stating that there was a problem while fetching emotes from a source.'''
[]
andremtsilva/dissertacao
src/sim/basicExample/main.py
7c039ffe871468be0215c482adb42830fff586aa
""" This is the most simple scenario with a basic topology, some users and a set of apps with only one service. @author: Isaac Lera """ import os import time import json import random import logging.config import networkx as nx import numpy as np from pathlib import Path from yafs.core import Sim from yafs.a...
[((651, 667), 'pathlib.Path', 'Path', (['"""results/"""'], {}), "('results/')\n", (655, 667), False, 'from pathlib import Path\n'), ((841, 865), 'random.seed', 'random.seed', (['RANDOM_SEED'], {}), '(RANDOM_SEED)\n', (852, 865), False, 'import random\n'), ((870, 897), 'numpy.random.seed', 'np.random.seed', (['RANDOM_SE...
dbvis-ukon/coronavis
Backend/models/risklayerPrognosis.py
f00374ac655c9d68541183d28ede6fe5536581dc
from db import db class RisklayerPrognosis(db.Model): __tablename__ = 'risklayer_prognosis' datenbestand = db.Column(db.TIMESTAMP, primary_key=True, nullable=False) prognosis = db.Column(db.Float, nullable=False) # class RisklayerPrognosisSchema(SQLAlchemyAutoSchema): # class Meta: # strict ...
[((118, 175), 'db.db.Column', 'db.Column', (['db.TIMESTAMP'], {'primary_key': '(True)', 'nullable': '(False)'}), '(db.TIMESTAMP, primary_key=True, nullable=False)\n', (127, 175), False, 'from db import db\n'), ((192, 227), 'db.db.Column', 'db.Column', (['db.Float'], {'nullable': '(False)'}), '(db.Float, nullable=False)...
smartfile/django-secureform
tests.py
3b7a8b90550327f370ea02c6886220b2db0517b5
import os import unittest os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' import django if django.VERSION >= (1, 7): django.setup() from django import forms from django.db import models from django.forms.forms import NON_FIELD_ERRORS from django_secureform.forms import SecureForm def get_form_sname(form, name...
[((124, 138), 'django.setup', 'django.setup', ([], {}), '()\n', (136, 138), False, 'import django\n'), ((829, 874), 'django.forms.CharField', 'forms.CharField', ([], {'required': '(True)', 'max_length': '(16)'}), '(required=True, max_length=16)\n', (844, 874), False, 'from django import forms\n'), ((2504, 2519), 'unitt...
hackerman-101/Hacktoberfest-2022
opencv/resizing.py
839f28293930987da55f8a2414efaa1cf9676cc9
import cv2 as cv import numpy as np cap = cv.VideoCapture(1) print(cap.get(cv.CAP_PROP_FRAME_WIDTH)) print(cap.get(cv.CAP_PROP_FRAME_HEIGHT)) cap.set(3,3000) cap.set(4,3000) print(cap.get(cv.CAP_PROP_FRAME_WIDTH)) print(cap.get(cv.CAP_PROP_FRAME_HEIGHT)) while (cap.isOpened()): ret , frame = cap.read() if...
[((43, 61), 'cv2.VideoCapture', 'cv.VideoCapture', (['(1)'], {}), '(1)\n', (58, 61), True, 'import cv2 as cv\n'), ((472, 494), 'cv2.destroyAllWindows', 'cv.destroyAllWindows', ([], {}), '()\n', (492, 494), True, 'import cv2 as cv\n'), ((344, 370), 'cv2.imshow', 'cv.imshow', (['"""camVid"""', 'frame'], {}), "('camVid', ...