repo_name
stringlengths
7
94
repo_path
stringlengths
4
237
repo_head_hexsha
stringlengths
40
40
content
stringlengths
10
680k
apis
stringlengths
2
680k
shivamT95/projecteuler
Q58/sol.py
3e87b64235edd8444bc27198717a38e0ae0e0c0b
import math def is_prime(n): if n == 1: return False if n % 2 == 0 and n > 2: return False return all(n % i for i in range(3, int(math.sqrt(n))+1,2)) tot = 1 dia = 0 for side_length in range(3,100001,2): hi = side_length**2 for i in range(4): if is_prime(hi-i*side_length+i): dia = dia+1 ...
[((145, 157), 'math.sqrt', 'math.sqrt', (['n'], {}), '(n)\n', (154, 157), False, 'import math\n')]
alexartwww/geekbrains
lesson_07/02.py
f58720dc1d29bc94201b8b9c9239813c0d14ed64
task = ''' Реализовать проект расчета суммарного расхода ткани на производство одежды. Основная сущность (класс) этого проекта — одежда, которая может иметь определенное название. К типам одежды в этом проекте относятся пальто и костюм. У этих типов одежды существуют параметры: размер (для пальто) и рост (для костюма)...
[]
SchadLucas/pyscrape
core/fanarttvapi.py
814a5e767ed899b5929533729c15262f1ad6a52b
import urllib2 import json import time from core.helpers.decorator import Cached from core.helpers.config import config from core.helpers.logger import log, LogLevel @Cached def __request(request): log('Send Fanart Request: ' + request.replace(config.fanart.api_key, 'XXX'), 'DEBUG') headers = {'Accept': 'app...
[((352, 393), 'urllib2.Request', 'urllib2.Request', (['request'], {'headers': 'headers'}), '(request, headers=headers)\n', (367, 393), False, 'import urllib2\n'), ((460, 485), 'json.loads', 'json.loads', (['response_body'], {}), '(response_body)\n', (470, 485), False, 'import json\n'), ((414, 439), 'urllib2.urlopen', '...
AndreasLH/Image-Colourization
metrics.py
b41182354446feeb80000a84e5db9100b30e9d81
from math import log10, sqrt import cv2 import numpy as np def PSNR(original, compressed): ''' Calculates the Peak signal to noise ratio between a ground truth image and predicted image. see https://www.geeksforgeeks.org/python-peak-signal-to-noise-ratio-psnr/ for reference Parameters --...
[((466, 503), 'numpy.mean', 'np.mean', (['((original - compressed) ** 2)'], {}), '((original - compressed) ** 2)\n', (473, 503), True, 'import numpy as np\n'), ((1668, 1710), 'cv2.imread', 'cv2.imread', (['"""test_imgs/original_image.png"""'], {}), "('test_imgs/original_image.png')\n", (1678, 1710), False, 'import cv2\...
Egor4ik325/redirink
redirink/insights/tests/test_models.py
17ef85f48145ee6112f2fcbab60dcd9d65ba78bf
"""Test insight model is working the way it should.""" import pytest from django.core.exceptions import ValidationError from django.db import DataError from .factories import InsightFactory pytestmark = pytest.mark.django_db def test_create_new_fake_visitor_instance_using_factory(visitor): pass def test_creat...
[((652, 676), 'pytest.raises', 'pytest.raises', (['DataError'], {}), '(DataError)\n', (665, 676), False, 'import pytest\n')]
uc-cdis/gen3-qa
scripts/list-all-test-suites-for-ci.py
6634678b17cb5dd86533667c22037b1e2ddeb0b8
import os import subprocess test_suites_that_cant_run_in_parallel = [ "test-apis-dbgapTest", # not thread-safe "test-google-googleDataAccessTest", # not thread-safe "test-google-googleServiceAccountRemovalTest", # not thread-safe "test-guppy-guppyTest", ...
[((3243, 3260), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (3258, 3260), False, 'import os\n')]
set5think/querybook
querybook/server/lib/query_executor/all_executors.py
25738fe113faa8ee414826d1aa910354ae8a4146
from lib.utils.plugin import import_plugin from .base_executor import parse_exception from .executors.hive import HiveQueryExecutor from .executors.presto import PrestoQueryExecutor from .executors.sqlalchemy import ( MysqlQueryExecutor, DruidQueryExecutor, SqliteQueryExecutor, SnowflakeQueryExecutor, ...
[((401, 461), 'lib.utils.plugin.import_plugin', 'import_plugin', (['"""executor_plugin"""', '"""ALL_PLUGIN_EXECUTORS"""', '[]'], {}), "('executor_plugin', 'ALL_PLUGIN_EXECUTORS', [])\n", (414, 461), False, 'from lib.utils.plugin import import_plugin\n')]
MrGrote/bot
bot/exts/info/pypi.py
acaae30d1c6d401d383e3c1cc55dd1c19ced32c3
import itertools import random import re from contextlib import suppress from disnake import Embed, NotFound from disnake.ext.commands import Cog, Context, command from disnake.utils import escape_markdown from bot.bot import Bot from bot.constants import Colours, NEGATIVE_REPLIES, RedirectOutput from bot.log import ...
[((513, 575), 'itertools.cycle', 'itertools.cycle', (['(Colours.yellow, Colours.blue, Colours.white)'], {}), '((Colours.yellow, Colours.blue, Colours.white))\n', (528, 575), False, 'import itertools\n'), ((598, 628), 're.compile', 're.compile', (['"""[^-_.a-zA-Z0-9]+"""'], {}), "('[^-_.a-zA-Z0-9]+')\n", (608, 628), Fal...
GinnyGaga/lanbo
app/decorators.py
d0bd200b93643d3ede69b5fcce72cefd5c167e37
from functools import wraps from flask import abort from flask_login import current_user from .models import Permission <<<<<<< HEAD def permission_required(permission): def decorator(f): @wraps(f) def decorated_function(*args, **kwargs): if not current_user.can(permission): ...
[]
jojoquant/jnpy
jnpy/experiments/Qt/pyqtgraph_tutorial/codeloop_org_materials/c4_drawing_curves.py
c874060af4b129ae09cee9f8542517b7b2f6573b
# !/usr/bin/env python3 # -*- coding:utf-8 -*- # @Datetime : 2019/11/14 上午2:26 # @Author : Fangyang # @Software : PyCharm import sys from PyQt5.QtWidgets import QApplication import pyqtgraph as pg import numpy as np app = QApplication(sys.argv) x = np.arange(1000) y = np.random.normal(size=(3, 1000)) plotWidget = ...
[((227, 249), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (239, 249), False, 'from PyQt5.QtWidgets import QApplication\n'), ((254, 269), 'numpy.arange', 'np.arange', (['(1000)'], {}), '(1000)\n', (263, 269), True, 'import numpy as np\n'), ((274, 306), 'numpy.random.normal', 'np.r...
nauaneed/compyle
compyle/api.py
218c76de8aa684e1fb198072e40cb97a5e6845b3
from .array import Array, wrap from .ast_utils import (get_symbols, get_assigned, get_unknown_names_and_calls, has_return, has_node) from .config import get_config, set_config, use_config, Config from .cython_generator import ( CythonGenerator, get_func_definition ) from .ext_module import E...
[]
gujun4990/sqlalchemy
test/dialect/mssql/test_compiler.py
057bae2295feb86529a04f09cd2f3d4c2c6d88a8
# -*- encoding: utf-8 from sqlalchemy.testing import eq_, is_ from sqlalchemy import schema from sqlalchemy.sql import table, column, quoted_name from sqlalchemy.dialects import mssql from sqlalchemy.dialects.mssql import mxodbc from sqlalchemy.testing import fixtures, AssertsCompiledSQL from sqlalchemy import sql from...
[((663, 678), 'sqlalchemy.dialects.mssql.dialect', 'mssql.dialect', ([], {}), '()\n', (676, 678), False, 'from sqlalchemy.dialects import mssql\n'), ((1360, 1370), 'sqlalchemy.MetaData', 'MetaData', ([], {}), '()\n', (1368, 1370), False, 'from sqlalchemy import Integer, String, Table, Column, select, MetaData, update, ...
polivbr/pulumi-kubernetes
sdk/python/pulumi_kubernetes/coordination/v1/_inputs.py
36a5fb34240a38a60b52a5f4e55e66e248d9305f
# coding=utf-8 # *** WARNING: this file was generated by pulumigen. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from ... import _utilities from ... import me...
[((2141, 2174), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""acquireTime"""'}), "(name='acquireTime')\n", (2154, 2174), False, 'import pulumi\n'), ((2531, 2567), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""holderIdentity"""'}), "(name='holderIdentity')\n", (2544, 2567), False, 'import pulumi\n'), ((2951,...
davidtahim/Glyphs-Scripts
Components/Align All Components.py
5ed28805b5fe03c63d904ad2f79117844c22aa44
#MenuTitle: Align All Components # -*- coding: utf-8 -*- __doc__=""" Fakes auto-alignment in glyphs that cannot be auto-aligned. """ import GlyphsApp thisFont = Glyphs.font # frontmost font thisFontMaster = thisFont.selectedFontMaster # active master thisFontMasterID = thisFont.selectedFontMaster.id # active master l...
[]
Jewel-Hong/SC-projects
SC101Lecture_code/SC101_week4/draw_basic.py
9502b3f0c789a931226d4ce0200ccec56e47bc14
#!/usr/bin/env python3 """ Stanford CS106AP TK Drawing Lecture Exercises Courtesy of Nick Parlante """ import tkinter as tk # provided function, this code is complete def make_canvas(width, height): """ Creates and returns a drawing canvas of the given int size, ready for drawing. """ top = tk.T...
[((316, 323), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (321, 323), True, 'import tkinter as tk\n'), ((392, 434), 'tkinter.Canvas', 'tk.Canvas', (['top'], {'width': 'width', 'height': 'height'}), '(top, width=width, height=height)\n', (401, 434), True, 'import tkinter as tk\n'), ((752, 765), 'tkinter.mainloop', 'tk.main...
artigianitecnologici/marrtino_apps
audio/audio_server.py
b58bf4daa1d06db2f1c8a47be02b29948d41f48d
# Only PCM 16 bit wav 44100 Hz - Use audacity or sox to convert audio files. # WAV generation # Synth # sox -n --no-show-progress -G --channels 1 -r 44100 -b 16 -t wav bip.wav synth 0.25 sine 800 # sox -n --no-show-progress -G --channels 1 -r 44100 -b 16 -t wav bop.wav synth 0.25 sine 400 # Voices # pico2wave -l ...
[]
sh1doy/vision
torchvision/datasets/kinetics.py
d7dce1034a0682bf8832bc89cda9589d6598087d
from .video_utils import VideoClips from .utils import list_dir from .folder import make_dataset from .vision import VisionDataset class Kinetics400(VisionDataset): """ `Kinetics-400 <https://deepmind.com/research/open-source/open-source-datasets/kinetics/>`_ dataset. Kinetics-400 is an action recogn...
[]
CharleyFarley/ovvio
venv/lib/python2.7/site-packages/sphinx/builders/qthelp.py
81489ee64f91e4aab908731ce6ddf59edb9314bf
# -*- coding: utf-8 -*- """ sphinx.builders.qthelp ~~~~~~~~~~~~~~~~~~~~~~ Build input files for the Qt collection generator. :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ import os import re import codecs import posixpath from os impo...
[((562, 652), 're.compile', 're.compile', (['"""(?P<title>.+) (\\\\((class in )?(?P<id>[\\\\w\\\\.]+)( (?P<descr>\\\\w+))?\\\\))$"""'], {}), "(\n '(?P<title>.+) (\\\\((class in )?(?P<id>[\\\\w\\\\.]+)( (?P<descr>\\\\w+))?\\\\))$')\n", (572, 652), False, 'import re\n'), ((3061, 3093), 'sphinx.builders.html.Standalone...
UWPRG/BETO2020
scripts/scrape_sciencedirect_urls.py
55b5b329395da79047e9083232101d15af9f2c49
""" This code is used to scrape ScienceDirect of publication urls and write them to a text file in the current directory for later use. """ import selenium from selenium import webdriver import numpy as np import pandas as pd import bs4 from bs4 import BeautifulSoup import time from sklearn.utils import shuffle def s...
[((4232, 4270), 'pandas.read_excel', 'pd.read_excel', (['"""elsevier_journals.xls"""'], {}), "('elsevier_journals.xls')\n", (4245, 4270), True, 'import pandas as pd\n'), ((4437, 4465), 'sklearn.utils.shuffle', 'shuffle', (['df'], {'random_state': '(42)'}), '(df, random_state=42)\n', (4444, 4465), False, 'from sklearn.u...
GodelTech/superset
superset/typing.py
da170aa57e94053cf715f7b41b09901c813a149a
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
[]
ibaiGorordo/depthai
log_system_information.py
57b437f38ebe80e870ee4852ca7ccc80eaaa76cc
#!/usr/bin/env python3 import json import platform def make_sys_report(anonymous=False, skipUsb=False, skipPackages=False): def get_usb(): try: import usb.core except ImportError: yield "NoLib" return speeds = ["Unknown", "Low", "Full", "High", "Super",...
[((928, 946), 'platform.machine', 'platform.machine', ([], {}), '()\n', (944, 946), False, 'import platform\n'), ((968, 987), 'platform.platform', 'platform.platform', ([], {}), '()\n', (985, 987), False, 'import platform\n'), ((1010, 1030), 'platform.processor', 'platform.processor', ([], {}), '()\n', (1028, 1030), Fa...
silverhikari/romtools
patch.py
2a09290fef85f35502a95c5c2874317029f0439c
""" Utils for creating xdelta patches. """ import logging from subprocess import check_output, CalledProcessError from shutil import copyfile from os import remove, path class PatchChecksumError(Exception): def __init__(self, message, errors): super(PatchChecksumError, self).__init__(message) class Patc...
[((674, 706), 'os.path.join', 'path.join', (['xdelta_dir', '"""xdelta3"""'], {}), "(xdelta_dir, 'xdelta3')\n", (683, 706), False, 'from os import remove, path\n'), ((1027, 1044), 'logging.info', 'logging.info', (['cmd'], {}), '(cmd)\n', (1039, 1044), False, 'import logging\n'), ((1567, 1584), 'logging.info', 'logging.i...
fewieden/Enigma-Machine
enigma.py
0c130d3cf1bb5146d438cc39dca55ebbcb0f1cdf
from rotor import Rotor import sys import getopt class Enigma: def __init__(self, key, rotors): self.key = list(key) self.rotors = [] for i in range(0, len(rotors)): self.rotors.append(Rotor(self.key[i], rotors[i])) def encrypt(self, word): cipher = '' for ...
[((1270, 1363), 'getopt.getopt', 'getopt.getopt', (['argv', '"""hk:p:d"""', "['help', 'key=', 'phrase', 'decrypt', 'r1=', 'r2=', 'r3=']"], {}), "(argv, 'hk:p:d', ['help', 'key=', 'phrase', 'decrypt', 'r1=',\n 'r2=', 'r3='])\n", (1283, 1363), False, 'import getopt\n'), ((1420, 1431), 'sys.exit', 'sys.exit', (['(2)'],...
idc9/andersoncd
andersoncd/group.py
af2123b241e5f82f7c51b2bbf5196fb02723b582
import time import numpy as np from scipy import sparse from numba import njit from numpy.linalg import norm from scipy.sparse.linalg import svds from andersoncd.lasso import dual_lasso def primal_grp(R, w, alpha, grp_size): return (0.5 * norm(R) ** 2 + alpha * norm(w.reshape(-1, grp_size), axis=1)....
[((421, 428), 'numpy.linalg.norm', 'norm', (['x'], {}), '(x)\n', (425, 428), False, 'from numpy.linalg import norm\n'), ((624, 655), 'numpy.maximum', 'np.maximum', (['(1 - u / norm_grp)', '(0)'], {}), '(1 - u / norm_grp, 0)\n', (634, 655), True, 'import numpy as np\n'), ((1242, 1260), 'numpy.zeros', 'np.zeros', (['grp_...
dheerajrav/TextAttack
textattack/search_methods/greedy_word_swap_wir.py
41e747215bb0f01c511af95b16b94704c780cd5a
""" Greedy Word Swap with Word Importance Ranking =================================================== When WIR method is set to ``unk``, this is a reimplementation of the search method from the paper: Is BERT Really Robust? A Strong Baseline for Natural Language Attack on Text Classification and Entailment by Jin et...
[((6129, 6196), 'textattack.shared.validators.transformation_consists_of_word_swaps_and_deletions', 'transformation_consists_of_word_swaps_and_deletions', (['transformation'], {}), '(transformation)\n', (6180, 6196), False, 'from textattack.shared.validators import transformation_consists_of_word_swaps_and_deletions\n'...
rajatsharma94/lemur
lemur/deployment/service.py
99f46c1addcd40154835e151d0b189e1578805bb
from lemur import database def rotate_certificate(endpoint, new_cert): """ Rotates a certificate on a given endpoint. :param endpoint: :param new_cert: :return: """ # ensure that certificate is available for rotation endpoint.source.plugin.update_endpoint(endpoint, new_cert) endpo...
[((351, 376), 'lemur.database.update', 'database.update', (['endpoint'], {}), '(endpoint)\n', (366, 376), False, 'from lemur import database\n')]
h2020-westlife-eu/VRE
pype/celery.py
a85d5370767939b1971415be48a551ae6b1edc5d
# coding: utf-8 # Copyright Luna Technology 2015 # Matthieu Riviere <mriviere@luna-technology.com> from __future__ import absolute_import import os from celery import Celery # Set the default Django settings module for the 'celery' program os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pype.settings') from djan...
[((245, 309), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""pype.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'pype.settings')\n", (266, 309), False, 'import os\n'), ((555, 569), 'celery.Celery', 'Celery', (['"""pype"""'], {}), "('pype')\n", (561, 569), False, 'from celery i...
ss433s/sosweety
train/general_train_example/1_parse.py
4cb1a0f061f26e509ee51c0fabd0284ad15804a5
import os, sys import json # 获取当前路径, 通过anchor文件获取项目root路径 this_file_path = os.path.split(os.path.realpath(__file__))[0] this_path = this_file_path root_path = this_file_path while this_path: if os.path.exists(os.path.join(this_path, 'sosweety_root_anchor.py')): root_path = this_path break...
[((475, 501), 'sys.path.append', 'sys.path.append', (['root_path'], {}), '(root_path)\n', (490, 501), False, 'import os, sys\n'), ((650, 684), 'os.path.join', 'os.path.join', (['root_path', 'train_dir'], {}), '(root_path, train_dir)\n', (662, 684), False, 'import os, sys\n'), ((829, 870), 'os.path.join', 'os.path.join'...
rohancode/ruleex_modified
ruleex/hypinv/model.py
ec974e7811fafc0c06d4d2c53b4e2898dd6b7305
from gtrain import Model import numpy as np import tensorflow as tf class NetForHypinv(Model): """ Implementaion of the crutial function for the HypINV algorithm. Warning: Do not use this class but implement its subclass, for example see FCNetForHypinv """ def __init__(self, weights): self...
[((5555, 5589), 'numpy.zeros', 'np.zeros', (['[1, self.layer_sizes[0]]'], {}), '([1, self.layer_sizes[0]])\n', (5563, 5589), True, 'import numpy as np\n'), ((12110, 12144), 'numpy.zeros', 'np.zeros', (['[1, self.layer_sizes[0]]'], {}), '([1, self.layer_sizes[0]])\n', (12118, 12144), True, 'import numpy as np\n'), ((153...
Mr-TelegramBot/python-tdlib
py_tdlib/constructors/get_chat_member.py
2e2d21a742ebcd439971a32357f2d0abd0ce61eb
from ..factory import Method class getChatMember(Method): chat_id = None # type: "int53" user_id = None # type: "int32"
[]
Franco7Scala/GeneratingNaturalLanguageAdversarialExamplesThroughParticleFiltering
src/phrase_manager/phrase_manager.py
095b47eb76503d44f54f701d303193328a5a4c86
import numpy from keras.preprocessing import sequence from keras.preprocessing.text import Tokenizer from src.support import support class PhraseManager: def __init__(self, configuration): self.train_phrases, self.train_labels = self._read_train_phrases() self.test_phrases, self.test_labels = se...
[((1055, 1118), 'keras.preprocessing.text.Tokenizer', 'Tokenizer', ([], {'num_words': 'self.configuration[support.QUANTITY_WORDS]'}), '(num_words=self.configuration[support.QUANTITY_WORDS])\n', (1064, 1118), False, 'from keras.preprocessing.text import Tokenizer\n'), ((1338, 1442), 'keras.preprocessing.sequence.pad_seq...
fonar/paypalhttp_python
setup.py
218136324c3dc6d4021db907c94cb6ac30cb1060
from setuptools import setup version = "1.0.0" long_description = """ PayPalHttp is a generic http client designed to be used with code-generated projects. """ setup( name="paypalhttp", long_description=long_description, version=version, author="PayPal", packages=["paypalhttp", "paypalhttp/testu...
[((164, 1079), 'setuptools.setup', 'setup', ([], {'name': '"""paypalhttp"""', 'long_description': 'long_description', 'version': 'version', 'author': '"""PayPal"""', 'packages': "['paypalhttp', 'paypalhttp/testutils', 'paypalhttp/serializers']", 'install_requires': "['requests>=2.0.0', 'six>=1.0.0', 'pyopenssl>=0.15']"...
Amourspirit/ooo_uno_tmpl
ooobuild/csslo/xml/__init__.py
64e0c86fd68f24794acc22d63d8d32ae05dd12b8
# coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # 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 applicab...
[]
terrameijar/bluebottle
bluebottle/tasks/migrations/0012_merge.py
b4f5ba9c4f03e678fdd36091b29240307ea69ffd
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-09-27 15:35 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('tasks', '0011_auto_20160919_1508'), ('tasks', '0011_auto_20160920_1019'), ] operatio...
[]
bgotthold-usgs/batdetect
bat_train/evaluate.py
0d4a70f1cda9f6104f6f785f0d953f802fddf0f1
import numpy as np from sklearn.metrics import roc_curve, auc def compute_error_auc(op_str, gt, pred, prob): # classification error pred_int = (pred > prob).astype(np.int) class_acc = (pred_int == gt).mean() * 100.0 # ROC - area under curve fpr, tpr, thresholds = roc_curve(gt, pred) roc_auc ...
[]
SUSE/azure-sdk-for-python
azure-mgmt/tests/test_mgmt_network.py
324f99d26dd6f4ee9793b9bf1d4d5f928e4b6c2f
# coding: utf-8 #------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. #---------------------------------------------------------------------...
[]
polbebe/PinkPanther
Networks/Threading/server.py
c6ba47956b2cae6468ac0cfe56229b5434fec754
import gym import gym.spaces as spaces import sys import socket from _thread import * import os import numpy as np import pandas as pd import math as m import time import random class NetEnv(gym.Env): def __init__(self): # Robot State values that will be bounced with client self.robot_state = None self.p...
[((347, 380), 'numpy.array', 'np.array', (['(12345)'], {'dtype': 'np.float32'}), '(12345, dtype=np.float32)\n', (355, 380), True, 'import numpy as np\n'), ((621, 670), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (634, 670), False, 'import s...
zhkuo24/full-stack-fastapi-demo
backend/app/app/db/session.py
25b0d4e5c7fe303b751974748b687e98d4454f48
# -*- coding: utf-8 -*- # @File : session.py # @Author : zhkuo # @Time : 2021/1/3 9:12 下午 # @Desc : from sqlalchemy import create_engine # from sqlalchemy.orm import scoped_session from sqlalchemy.orm import sessionmaker from app.core.config import settings """ 参考: https://www.osgeo.cn/sqlalchemy/orm/session_...
[((608, 703), 'sqlalchemy.create_engine', 'create_engine', (['settings.SQLALCHEMY_DATABASE_URI'], {'connect_args': "{'check_same_thread': False}"}), "(settings.SQLALCHEMY_DATABASE_URI, connect_args={\n 'check_same_thread': False})\n", (621, 703), False, 'from sqlalchemy import create_engine\n'), ((848, 908), 'sqlalc...
KosukeMizuno/tkdialog
src/tkdialog/dialog.py
082fc106908bbbfa819d1a129929165f11d4e944
from pathlib import Path import pickle import tkinter as tk import tkinter.filedialog def open_dialog(**opt): """Parameters ---------- Options will be passed to `tkinter.filedialog.askopenfilename`. See also tkinter's document. Followings are example of frequently used options. - filetypes=[(l...
[((550, 557), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (555, 557), True, 'import tkinter as tk\n'), ((714, 751), 'tkinter.filedialog.askopenfilename', 'tk.filedialog.askopenfilename', ([], {}), '(**_opt)\n', (743, 751), True, 'import tkinter as tk\n'), ((1226, 1233), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (1231, 1233...
lightsey/cinder
cinder/tests/unit/fake_group_snapshot.py
e03d68e42e57a63f8d0f3e177fb4287290612b24
# Copyright 2016 EMC Corporation # # 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...
[((1078, 1114), 'cinder.objects.GroupSnapshot.fields.items', 'objects.GroupSnapshot.fields.items', ([], {}), '()\n', (1112, 1114), False, 'from cinder import objects\n'), ((1684, 1707), 'cinder.objects.GroupSnapshot', 'objects.GroupSnapshot', ([], {}), '()\n', (1705, 1707), False, 'from cinder import objects\n')]
szymanskir/msi
src/tree_visualizer.py
27013bac31e62b36dff138cfbb91852c96f77ef3
import matplotlib.pyplot as plt import networkx as nx from networkx.drawing.nx_agraph import graphviz_layout def display_resolution_tree(resolution_tree: nx.classes.DiGraph): _draw_resolution_tree_(resolution_tree) plt.show() def _draw_resolution_tree_(tree: nx.classes.DiGraph, enable_edge_labels: bool = Tr...
[((225, 235), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (233, 235), True, 'import matplotlib.pyplot as plt\n'), ((363, 375), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (373, 375), True, 'import matplotlib.pyplot as plt\n'), ((405, 438), 'networkx.drawing.nx_agraph.graphviz_layout', 'graph...
SilicalNZ/canvas
setup.py
44d1eee02c334aae6b41aeba01ed0ecdf83aed21
import setuptools setuptools.setup( name = 'sili-canvas', version = '0.0.1', license = 'MIT', url = 'https://github.com/SilicalNZ/canvas', description = 'A series of easy to use classes to perform complex 2D array transformations', long_description = '', author = 'SilicalNZ', packages ...
[((19, 335), 'setuptools.setup', 'setuptools.setup', ([], {'name': '"""sili-canvas"""', 'version': '"""0.0.1"""', 'license': '"""MIT"""', 'url': '"""https://github.com/SilicalNZ/canvas"""', 'description': '"""A series of easy to use classes to perform complex 2D array transformations"""', 'long_description': '""""""', ...
theoretical-olive/incubator-superset
tests/viz_tests.py
72fc581b1559e7ce08b11c481b88eaa01b2d17de
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
[((1253, 1280), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1270, 1280), False, 'import logging\n'), ((13055, 13094), 'unittest.mock.patch', 'patch', (['"""superset.viz.BaseViz.query_obj"""'], {}), "('superset.viz.BaseViz.query_obj')\n", (13060, 13094), False, 'from unittest.mock impo...
ryogrid/FunnelKVS
chord_sim/modules/taskqueue.py
65c4308ce6e08b819b5396fc1aa658468c276362
# coding:utf-8 from typing import Dict, List, Optional, cast, TYPE_CHECKING from .chord_util import ChordUtil, InternalControlFlowException, NodeIsDownedExceptiopn if TYPE_CHECKING: from .chord_node import ChordNode class TaskQueue: JOIN_PARTIAL = "join_partial" def __init__(self, existing_node : 'Chor...
[]
sudarshan85/nlpbook
surname_rnn/surname/containers.py
41e59d706fb31f5185a0133789639ccffbddb41f
#!/usr/bin/env python import pandas as pd from pathlib import Path from torch.utils.data import DataLoader class ModelContainer(object): def __init__(self, model, optimizer, loss_fn, scheduler=None): self.model = model self.optimizer = optimizer self.loss_fn = loss_fn self.scheduler = scheduler cl...
[((1411, 1476), 'torch.utils.data.DataLoader', 'DataLoader', (['self.train_ds', 'self._bs'], {'shuffle': '(True)', 'drop_last': '(True)'}), '(self.train_ds, self._bs, shuffle=True, drop_last=True)\n', (1421, 1476), False, 'from torch.utils.data import DataLoader\n'), ((1583, 1646), 'torch.utils.data.DataLoader', 'DataL...
yNeshy/voice-change
AudioLib/__init__.py
2535351bcd8a9f2d58fcbff81a2051c4f6ac6ab4
from AudioLib.AudioEffect import AudioEffect
[]
lakshmi2005/buck
programs/buck_logging.py
012a59d5d2e5a45b483e85fb190d2b67ea0c56ab
#!/usr/bin/env python from __future__ import print_function import logging import os def setup_logging(): # Set log level of the messages to show. level_name = os.environ.get('BUCK_WRAPPER_LOG_LEVEL', 'INFO') level_name_to_level = { 'CRITICAL': logging.CRITICAL, 'ERROR': logging.ERROR, ...
[((171, 219), 'os.environ.get', 'os.environ.get', (['"""BUCK_WRAPPER_LOG_LEVEL"""', '"""INFO"""'], {}), "('BUCK_WRAPPER_LOG_LEVEL', 'INFO')\n", (185, 219), False, 'import os\n'), ((530, 642), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'level', 'format': '"""%(asctime)s [%(levelname)s][%(filename)s:%(l...
Web-Dev-Collaborative/DS-ALGO-OFFICIAL
CONTENT/DS-n-Algos/ALGO/__PYTHON/celeb.py
6d7195d33c28a0fe22f12231efffb39f4bf05c97
def orangesRotting(elemnts): if not elemnts or len(elemnts) == 0: return 0 n = len(elemnts) m = len(elemnts[0]) rotten = [] for i in range(n): for j in range(m): if elemnts[i][j] == 2: rotten.append((i, j)) mins = 0 def dfs(rotten): ...
[]
leelige/mindspore
official/cv/c3d/src/c3d_model.py
5199e05ba3888963473f2b07da3f7bca5b9ef6dc
# Copyright 2021 Huawei Technologies Co., Ltd # # 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...
[((1176, 1303), 'mindspore.nn.Conv3d', 'nn.Conv3d', ([], {'in_channels': '(3)', 'out_channels': '(64)', 'kernel_size': '(3, 3, 3)', 'padding': '(1, 1, 1, 1, 1, 1)', 'pad_mode': '"""pad"""', 'has_bias': '(True)'}), "(in_channels=3, out_channels=64, kernel_size=(3, 3, 3), padding=(1,\n 1, 1, 1, 1, 1), pad_mode='pad', ...
metabolize/blmath
blmath/geometry/apex.py
8ea8d7be60349a60ffeb08a3e34fca20ef9eb0da
import numpy as np from blmath.numerics import vx def apex(points, axis): ''' Find the most extreme point in the direction of the axis provided. axis: A vector, which is an 3x1 np.array. ''' coords_on_axis = points.dot(axis) return points[np.argmax(coords_on_axis)] def inflection_points(poin...
[((859, 886), 'numpy.gradient', 'np.gradient', (['coords_on_span'], {}), '(coords_on_span)\n', (870, 886), True, 'import numpy as np\n'), ((1913, 1949), 'blmath.numerics.vx.magnitude', 'vx.magnitude', (['(to_points - from_point)'], {}), '(to_points - from_point)\n', (1925, 1949), False, 'from blmath.numerics import vx\...
TheFarGG/Discode
examples/client/main.py
facf6cd4f82baef2288a23dbe6f2a02dfc2407e2
import os import discode TOKEN = os.environ.get("TOKEN") # The token from the developer portal. client = discode.Client(token=TOKEN, intents=discode.Intents.default()) @client.on_event("ready") async def on_ready(): print(client.user, "is ready!") # The ready listener gets fired when the bot/client is comple...
[((35, 58), 'os.environ.get', 'os.environ.get', (['"""TOKEN"""'], {}), "('TOKEN')\n", (49, 58), False, 'import os\n'), ((144, 169), 'discode.Intents.default', 'discode.Intents.default', ([], {}), '()\n', (167, 169), False, 'import discode\n')]
kkahatapitiya/pytorch-image-models
timm/models/layers/__init__.py
94f9d54ac22354f3cf7ada9a7304ac97143deb14
from .activations import * from .adaptive_avgmax_pool import \ adaptive_avgmax_pool2d, select_adaptive_pool2d, AdaptiveAvgMaxPool2d, SelectAdaptivePool2d from .blur_pool import BlurPool2d from .classifier import ClassifierHead, create_classifier from .cond_conv2d import CondConv2d, get_condconv_initializer from .co...
[]
cjayross/riccipy
riccipy/metrics/bondi_2.py
2cc0ca5e1aa4af91b203b3ff2bb1effd7d2f4846
""" Name: Bondi References: Bondi, Proc. Roy. Soc. Lond. A, v282, p303, (1964) Coordinates: Spherical Symmetry: Spherical Notes: Outgoing Coordinates """ from sympy import Function, diag, sin, symbols coords = symbols("r v theta phi", real=True) variables = () functions = symbols("C M", cls=Function) r, v, th, ph = co...
[((211, 246), 'sympy.symbols', 'symbols', (['"""r v theta phi"""'], {'real': '(True)'}), "('r v theta phi', real=True)\n", (218, 246), False, 'from sympy import Function, diag, sin, symbols\n'), ((274, 302), 'sympy.symbols', 'symbols', (['"""C M"""'], {'cls': 'Function'}), "('C M', cls=Function)\n", (281, 302), False, ...
atuggle/cfgov-refresh
cfgov/ask_cfpb/tests/test_views.py
5a9cfd92b460b9be7befb39f5845abf56857aeac
from __future__ import unicode_literals import json from django.apps import apps from django.core.urlresolvers import NoReverseMatch, reverse from django.http import Http404, HttpRequest, QueryDict from django.test import TestCase, override_settings from django.utils import timezone from wagtail.wagtailcore.models i...
[((623, 637), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (635, 637), False, 'from django.utils import timezone\n'), ((1970, 2030), 'mock.patch', 'mock.patch', (['"""ask_cfpb.views.ServeView.serve_latest_revision"""'], {}), "('ask_cfpb.views.ServeView.serve_latest_revision')\n", (1980, 2030), False, ...
bcongdon/instapaper-to-sqlite
setup.py
378b87ffcd2832aeff735dd78a0c8206d220b899
import os from setuptools import setup VERSION = "0.2" def get_long_description(): with open( os.path.join(os.path.dirname(os.path.abspath(__file__)), "README.md"), encoding="utf8", ) as fp: return fp.read() setup( name="instapaper-to-sqlite", description="Save data from In...
[((139, 164), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (154, 164), False, 'import os\n')]
nicholasjng/pybm
pybm/commands/compare.py
13e256ca5c2c8239f9d611b9849dab92f70b2834
from typing import List from pybm import PybmConfig from pybm.command import CLICommand from pybm.config import get_reporter_class from pybm.exceptions import PybmError from pybm.reporters import BaseReporter from pybm.status_codes import ERROR, SUCCESS from pybm.util.path import get_subdirs class CompareCommand(CLI...
[((583, 600), 'pybm.PybmConfig.load', 'PybmConfig.load', ([], {}), '()\n', (598, 600), False, 'from pybm import PybmConfig\n'), ((1475, 1513), 'pybm.config.get_reporter_class', 'get_reporter_class', ([], {'config': 'self.config'}), '(config=self.config)\n', (1493, 1513), False, 'from pybm.config import get_reporter_cla...
JoranAngevaare/dddm
dddm/recoil_rates/halo.py
3461e37984bac4d850beafecc9d1881b84fb226c
""" For a given detector get a WIMPrate for a given detector (not taking into account any detector effects """ import numericalunits as nu import wimprates as wr import dddm export, __all__ = dddm.exporter() @export class SHM: """ class used to pass a halo model to the rate computation must cont...
[((194, 209), 'dddm.exporter', 'dddm.exporter', ([], {}), '()\n', (207, 209), False, 'import dddm\n'), ((1381, 1431), 'wimprates.observed_speed_dist', 'wr.observed_speed_dist', (['v', 't', 'self.v_0', 'self.v_esc'], {}), '(v, t, self.v_0, self.v_esc)\n', (1403, 1431), True, 'import wimprates as wr\n')]
rekords-uw/Picket
picket/rvae/train_eval_models.py
773797ae1c1ed37c345facfb43e289a75d92cc1c
#!/usr/bin/env python3 import torch from torch import optim import torch.nn.functional as F import argparse from sklearn.metrics import mean_squared_error import numpy as np import json from . import utils from .model_utils import get_pi_exact_vec, rnn_vae_forward_one_stage, rnn_vae_forward_two_stage def training_...
[((4807, 4823), 'torch.tensor', 'torch.tensor', (['[]'], {}), '([])\n', (4819, 4823), False, 'import torch\n'), ((7306, 7321), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (7319, 7321), False, 'import torch\n'), ((9635, 9678), 'torch.nn.functional.binary_cross_entropy', 'F.binary_cross_entropy', (['pi_mtx', 'pi_...
nopipifish/bert4keras
setup.py
d8fd065b9b74b8a82b381b7183f9934422e4caa9
#! -*- coding: utf-8 -*- from setuptools import setup, find_packages setup( name='bert4keras', version='0.8.4', description='an elegant bert4keras', long_description='bert4keras: https://github.com/bojone/bert4keras', license='Apache License 2.0', url='https://github.com/bojone/bert4keras', ...
[((431, 446), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (444, 446), False, 'from setuptools import setup, find_packages\n')]
Magikis/Uniwersity
sztuczna_inteligencja/3-lab/backtrackingSolve.py
06964ef31d721af85740df1dce3f966006ab9f78
# import cProfile # import pstats # import io from picture import * # pr = cProfile.Profile() # pr.enable() def out(p): for i in range(2): print([len(x) for x in p.perms[i]]) if __name__ == '__main__': p = Picture() p.genPerms() p.detuctAll() p.backtrackLoop() p.saveOtput() # pr...
[]
HALOCORE/SynGuar
benchmark/generate_examples_strprose.py
8f7f9ba52e83091ad3def501169fd60d20b28321
# imports import os import json import subprocess abs_join = lambda p1, p2 : os.path.abspath(os.path.join(p1, p2)) # constants SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__)) SEED_RELPATH = "./strprose/example_files/_seeds.json" SEED_FULLPATH = abs_join(SCRIPT_DIR, SEED_RELPATH) SEED_INFO = None with open(SEE...
[((158, 183), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (173, 183), False, 'import os\n'), ((359, 371), 'json.load', 'json.load', (['f'], {}), '(f)\n', (368, 371), False, 'import json\n'), ((93, 113), 'os.path.join', 'os.path.join', (['p1', 'p2'], {}), '(p1, p2)\n', (105, 113), False, 'i...
rimmartin/cctbx_project
mmtbx/regression/tls/tst_u_tls_vs_u_ens_03.py
644090f9432d9afc22cfb542fc3ab78ca8e15e5d
from __future__ import division from mmtbx.tls import tools import math import time pdb_str_1 = """ CRYST1 10.000 10.000 10.000 90.00 90.00 90.00 P1 ATOM 1 CA THR A 6 0.000 0.000 0.000 1.00 0.00 C ATOM 1 CA THR B 6 3.000 0.000 0.000 1.00 0.00 C """...
[]
davidkartuzinski/ellieplatformsite
elliesite/context_processors.py
63a41cb2a15ae81a7cd3cdf68d783398b3205ce2
import sys from django.urls import resolve def global_vars(request): return { 'GLOBAL_TWITTER_ACCOUNT': '@open_apprentice', 'ORGANIZATION_NAME': 'Open Apprentice Foundation', 'ORGANIZATION_WEBSITE': 'https://openapprentice.org', 'ORGANIZATION_LOGO': '/static/img/ellie/open-apprenti...
[((495, 521), 'django.urls.resolve', 'resolve', (['request.path_info'], {}), '(request.path_info)\n', (502, 521), False, 'from django.urls import resolve\n')]
va1shn9v/Detectron.pytorch
tools/train_net_step.py
3e1cb11f160148248cbbd79e3dd9f490ca9c280a
""" Training script for steps_with_decay policy""" import argparse import os import sys import pickle import resource import traceback import logging from collections import defaultdict import numpy as np import yaml import torch from torch.autograd import Variable import torch.nn as nn import cv2 cv2.setNumThreads(0...
[((301, 321), 'cv2.setNumThreads', 'cv2.setNumThreads', (['(0)'], {}), '(0)\n', (318, 321), False, 'import cv2\n'), ((1022, 1045), 'utils.logging.setup_logging', 'setup_logging', (['__name__'], {}), '(__name__)\n', (1035, 1045), False, 'from utils.logging import setup_logging\n'), ((1188, 1230), 'resource.getrlimit', '...
punithmadaiahkumar/try-django
Lib/site-packages/astroid/brain/brain_numpy_core_multiarray.py
39680a7583122bdd722789f92400edae67c6251d
# Copyright (c) 2019-2020 hippo91 <guillaume.peillex@gmail.com> # Copyright (c) 2020 Claudiu Popa <pcmanticore@gmail.com> # Copyright (c) 2021 Pierre Sassoulas <pierre.sassoulas@gmail.com> # Copyright (c) 2021 Marc Mueller <30130371+cdce8p@users.noreply.github.com> # Licensed under the LGPL: https://www.gnu.org/licens...
[((873, 1072), 'astroid.builder.parse', 'parse', (['"""\n # different functions defined in multiarray.py\n def inner(a, b):\n return numpy.ndarray([0, 0])\n\n def vdot(a, b):\n return numpy.ndarray([0, 0])\n """'], {}), '(\n """\n # different functions defined in multiarray.py\n d...
bernardocuteri/wasp
tests/asp/weakConstraints/testcase13.bug.weakconstraints.gringo.test.py
05c8f961776dbdbf7afbf905ee00fc262eba51ad
input = """ 2 18 3 0 3 19 20 21 1 1 1 0 18 2 23 3 0 3 19 24 25 1 1 2 1 21 23 3 5 21 19 20 24 25 0 0 6 0 5 5 21 19 20 24 25 1 1 1 1 1 0 21 a 19 b 20 c 24 d 25 e 28 f 0 B+ 0 B- 1 0 1 """ output = """ COST 1@1 """
[]
susurigirl/susuri
whoPay.py
cec96cc9abd5a25762e15db27c17e70a95ae874c
import random names_string = input("내기를 할 친구들의 이름을 적습니다. 콤마(,)로 분리해서 적습니다.\n") names = names_string.split(",") print(names) n = random.randint(0, len(names)) print(f"오늘 커피는 {names[n]}가 쏩니다!")
[]
kagemeka/atcoder-submissions
jp.atcoder/abc056/arc070_b/26725094.py
91d8ad37411ea2ec582b10ba41b1e3cae01d4d6e
import sys import typing import numpy as np def solve(a: np.ndarray, k: int) -> typing.NoReturn: n = len(a) def compute_dp(a: np.ndarray) -> np.ndarray: dp = np.zeros((n + 1, k), np.bool8) dp[0, 0] = True for i in range(n): dp[i + 1] = dp[i].copy() ...
[((188, 218), 'numpy.zeros', 'np.zeros', (['(n + 1, k)', 'np.bool8'], {}), '((n + 1, k), np.bool8)\n', (196, 218), True, 'import numpy as np\n'), ((605, 622), 'numpy.flatnonzero', 'np.flatnonzero', (['l'], {}), '(l)\n', (619, 622), True, 'import numpy as np\n'), ((968, 988), 'sys.stdin.readline', 'sys.stdin.readline', ...
FlorianPoot/MicroPython_ESP32_psRAM_LoBo
MicroPython_BUILD/components/micropython/esp32/modules_examples/mqtt_example.py
fff2e193d064effe36a7d456050faa78fe6280a8
import network def conncb(task): print("[{}] Connected".format(task)) def disconncb(task): print("[{}] Disconnected".format(task)) def subscb(task): print("[{}] Subscribed".format(task)) def pubcb(pub): print("[{}] Published: {}".format(pub[0], pub[1])) def datacb(msg): print("[{}] Data arrived...
[((390, 609), 'network.mqtt', 'network.mqtt', (['"""loboris"""', '"""mqtt://loboris.eu"""'], {'user': '"""wifimcu"""', 'password': '"""wifimculobo"""', 'cleansession': '(True)', 'connected_cb': 'conncb', 'disconnected_cb': 'disconncb', 'subscribed_cb': 'subscb', 'published_cb': 'pubcb', 'data_cb': 'datacb'}), "('lobori...
atadams/mlb
mlb/game/migrations/0009_game_game_type.py
633b2eb53e5647c64a48c31ca68a50714483fb1d
# Generated by Django 2.2.8 on 2019-12-14 19:07 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('game', '0008_auto_20191214_1019'), ] operations = [ migrations.AddField( model_name='game', name='game_type', ...
[((332, 580), 'django.db.models.CharField', 'models.CharField', ([], {'choices': "[('E', 'Exhibition'), ('S', 'Spring Training'), ('R', 'Regular Season'), (\n 'F', 'Wild Card'), ('D', 'Divisional Series'), ('L',\n 'League Championship Series'), ('W', 'World Series')]", 'default': '"""R"""', 'max_length': '(30)'})...
Vman45/futurecoder
backend/main/chapters/c06_lists.py
0f4abc0ab00ec473e6cf6f51d534ef2deb26a086
# flake8: NOQA E501 import ast import random from textwrap import dedent from typing import List from main.exercises import generate_list, generate_string from main.text import ExerciseStep, MessageStep, Page, Step, VerbatimStep, search_ast from main.utils import returns_stdout class IntroducingLists(Page): clas...
[((7157, 7185), 'random.choice', 'random.choice', (['[True, False]'], {}), '([True, False])\n', (7170, 7185), False, 'import random\n'), ((7207, 7225), 'main.exercises.generate_list', 'generate_list', (['int'], {}), '(int)\n', (7220, 7225), False, 'from main.exercises import generate_list, generate_string\n'), ((12998,...
bigmacd/miscPython
redisSeed.py
ec473c724be54241e369a1bdb0f739d2b0ed02ee
import time import redis import json import argparse """ Follows the StackExchange best practice for creating a work queue. Basically push a task and publish a message that a task is there.""" def PushTask(client, queue, task, topic): client.lpush(queue, task) client.publish(topic, queue) if __name_...
[]
TIHLDE/Lepton
app/celery.py
60ec0793381f1c1b222f305586e8c2d4345fb566
from __future__ import absolute_import, unicode_literals import os from celery import Celery # set the default Django settings module for the 'celery' program. os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings") app = Celery("app") # Using a string here means the worker doesn't have to serialize # the ...
[((163, 226), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""app.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'app.settings')\n", (184, 226), False, 'import os\n'), ((234, 247), 'celery.Celery', 'Celery', (['"""app"""'], {}), "('app')\n", (240, 247), False, 'from celery impor...
researchai/unsupervised_meta_rl
src/garage/core/__init__.py
9ca4b41438277ef6cfea047482b98de9da07815a
from garage.core.serializable import Serializable from garage.core.parameterized import Parameterized # noqa: I100 __all__ = ['Serializable', 'Parameterized']
[]
jayvdb/django-formidable
formidable/forms/boundfield.py
df8bcd0c882990d72d302be47aeb4fb11915b1fa
from django.forms import forms class FormatBoundField(forms.BoundField): """ The format field skips the rendering with the label attribute in the form level (i.e => form.as_p() doesn't have to generate any label for format field). This boundfield has this main goal. """ def __init__(self,...
[]
hirotosuzuki/algorithm_training
algorithm_training/abc87.py
3134bad4ea2ea57a77e05be6f21ba776a558f520
class TaskA: def run(self): V, A, B, C = map(int, input().split()) pass class TaskB: def run(self): A = int(input()) B = int(input()) C = int(input()) X = int(input()) counter = 0 for a in range(A+1): for b in range(B+1): ...
[]
PL4typus/SysNetProject17
serveur/serveurDroit.py
283c127a3363876360bc52b54eae939c6104c6b4
#!/usr/bin/python import socket,sys,os TCP_IP = '127.0.0.1' TCP_PORT = 6262 BUFFER_SIZE = 1024 s= socket.socket(socket.AF_INET,socket.SOCK_STREAM) s.bind((TCP_IP,TCP_PORT)) s.listen(5) conn, addr = s.accept() print('Connection entrante :', addr) data = conn.recv(BUFFER_SIZE) if data == "m" : os.popen("chmod...
[]
kosior/ngLearn-1
BE/common/helpers.py
4cc52153876aca409d56bd9cabace9283946bd32
from rest_framework_jwt.utils import jwt_decode_handler from users.models import User from users.serializers import UserSerializer def jwt_response_payload_handler(token, user=None, request=None): return { 'token': token, 'user': UserSerializer(user, context={'request': request}).data } def...
[((523, 548), 'rest_framework_jwt.utils.jwt_decode_handler', 'jwt_decode_handler', (['token'], {}), '(token)\n', (541, 548), False, 'from rest_framework_jwt.utils import jwt_decode_handler\n'), ((253, 303), 'users.serializers.UserSerializer', 'UserSerializer', (['user'], {'context': "{'request': request}"}), "(user, co...
quetric/finn-base-1
src/finn/util/basic.py
1494a13a430c784683c2c33288823f83d1cd6fed
# Copyright (c) 2020 Xilinx, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list of conditions and the f...
[((9452, 9493), 'numpy.asarray', 'np.asarray', (['ndarray.shape'], {'dtype': 'np.int32'}), '(ndarray.shape, dtype=np.int32)\n', (9462, 9493), True, 'import numpy as np\n'), ((9867, 9929), 'numpy.pad', 'np.pad', (['ndarray', 'pad_amt'], {'mode': '"""constant"""', 'constant_values': 'val'}), "(ndarray, pad_amt, mode='con...
jeffrypaul37/Hospital-Management-System
mainmenu.py
4ff08bed5387ca23e3f31dbbf46e625d8ae5807b
from tkinter import * from tkcalendar import Calendar from datetime import datetime from datetime import date import tkinter as tk from tkinter import ttk from tkinter.messagebox import askyesno import re import sqlite3 import tkinter.messagebox import pandas as pd import pandas as pd import datetime ...
[((367, 379), 'datetime.date.today', 'date.today', ([], {}), '()\n', (377, 379), False, 'from datetime import date\n'), ((481, 516), 'sqlite3.connect', 'sqlite3.connect', (['"""database copy.db"""'], {}), "('database copy.db')\n", (496, 516), False, 'import sqlite3\n'), ((434, 461), 'pandas.date_range', 'pd.date_range'...
Tea-n-Tech/chia-tea
chia_tea/discord/commands/test_wallets.py
a5bd327b9d5e048e55e9f5d8cefca2dbcd5eae96
import os import tempfile import unittest from datetime import datetime from google.protobuf.json_format import ParseDict from ...monitoring.MonitoringDatabase import MonitoringDatabase from ...protobuf.generated.computer_info_pb2 import ADD, UpdateEvent from ...protobuf.generated.monitoring_service_pb2 import DataUp...
[((528, 557), 'tempfile.TemporaryDirectory', 'tempfile.TemporaryDirectory', ([], {}), '()\n', (555, 557), False, 'import tempfile\n'), ((595, 626), 'os.path.join', 'os.path.join', (['tmpdir', '"""temp.db"""'], {}), "(tmpdir, 'temp.db')\n", (607, 626), False, 'import os\n'), ((956, 985), 'tempfile.TemporaryDirectory', '...
sun-pyo/OcCo
render/PC_Normalisation.py
e2e12dbaa8f9b98fb8c42fc32682f49e99be302f
# Copyright (c) 2020. Hanchen Wang, hw501@cam.ac.uk import os, open3d, numpy as np File_ = open('ModelNet_flist_short.txt', 'w') if __name__ == "__main__": root_dir = "../data/ModelNet_subset/" for root, dirs, files in os.walk(root_dir, topdown=False): for file in files: if '.ply' in fi...
[((232, 264), 'os.walk', 'os.walk', (['root_dir'], {'topdown': '(False)'}), '(root_dir, topdown=False)\n', (239, 264), False, 'import os, open3d, numpy as np\n'), ((804, 855), 'open3d.io.write_triangle_mesh', 'open3d.io.write_triangle_mesh', (['out_file_name', 'amesh'], {}), '(out_file_name, amesh)\n', (833, 855), Fals...
adozier/pymatgen
pymatgen/apps/battery/insertion_battery.py
f1cc4d8db24ec11063be2fd84b4ea911f006eeb7
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. from __future__ import division, unicode_literals """ This module is used for analysis of materials with potential application as intercalation batteries. """ __author__ = "Anubhav Jain, Shyue Ping Ong" __co...
[((2421, 2444), 'pymatgen.phasediagram.maker.PhaseDiagram', 'PhaseDiagram', (['pdentries'], {}), '(pdentries)\n', (2433, 2444), False, 'from pymatgen.phasediagram.maker import PhaseDiagram\n'), ((13958, 13972), 'monty.json.MontyDecoder', 'MontyDecoder', ([], {}), '()\n', (13970, 13972), False, 'from monty.json import M...
ddesmond/gaffer
python/GafferUI/ColorSwatchPlugValueWidget.py
4f25df88103b7893df75865ea919fb035f92bac0
########################################################################## # # Copyright (c) 2013, John Haddon. All rights reserved. # Copyright (c) 2013, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that ...
[((2040, 2062), 'GafferUI.ColorSwatch', 'GafferUI.ColorSwatch', ([], {}), '()\n', (2060, 2062), False, 'import GafferUI\n'), ((2066, 2133), 'GafferUI.PlugValueWidget.__init__', 'GafferUI.PlugValueWidget.__init__', (['self', 'self.__swatch', 'plugs'], {}), '(self, self.__swatch, plugs, **kw)\n', (2099, 2133), False, 'im...
GregTMJ/django-files
NewsPaperD7(final)/NewsPaper/News/migrations/0001_initial.py
dfd2c8da596522b77fb3dfc8089f0d287a94d53b
# Generated by Django 3.2 on 2021-04-15 18:05 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] opera...
[((245, 302), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (276, 302), False, 'from django.db import migrations, models\n'), ((433, 529), 'django.db.models.BigAutoField', 'models.BigAutoField', ([], {'auto_created': '...
rhencke/oil
osh/cmd_exec_test.py
c40004544e47ee78cde1fcb22c672162b8eb2cd2
#!/usr/bin/env python # Copyright 2016 Andy Chu. 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 """ cmd_exec_test.py: Test...
[((578, 606), 'core.test_lib.MakeTestEvaluator', 'test_lib.MakeTestEvaluator', ([], {}), '()\n', (604, 606), False, 'from core import test_lib\n'), ((609, 654), 'osh.state.SetLocalString', 'state.SetLocalString', (['word_ev.mem', '"""x"""', '"""xxx"""'], {}), "(word_ev.mem, 'x', 'xxx')\n", (629, 654), False, 'from osh ...
MelanieFJNR/Blitz-API
blitz_api/migrations/0020_auto_20190529_1200.py
9a6daecd158fe07a6aeb80cbf586781eb688f0f9
# Generated by Django 2.0.8 on 2019-05-29 16:00 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('blitz_api', '0019_merge_20190524_1719'), ] operations = [ migrations.AlterField( model_name='exportmedia', name='fil...
[((342, 406), 'django.db.models.FileField', 'models.FileField', ([], {'upload_to': '"""export/%Y/%m/"""', 'verbose_name': '"""file"""'}), "(upload_to='export/%Y/%m/', verbose_name='file')\n", (358, 406), False, 'from django.db import migrations, models\n')]
palewire/archiveis
archiveis/__init__.py
11b2f1a4be4e7fbdcd52d874733cf20bc2d4f480
#!/usr/bin/env python from .api import capture __version__ = "0.0.7" __all__ = ("capture",)
[]
linklab/link_rl
temp/discrete_a2c_agent.py
e3d3196dcd49fd71b45941e07fc0d8a27d1d8c99
import numpy as np import torch import torch.nn.functional as F from codes.d_agents.a0_base_agent import float32_preprocessor from codes.d_agents.on_policy.on_policy_agent import OnPolicyAgent from codes.e_utils import rl_utils, replay_buffer from codes.d_agents.actions import ProbabilityActionSelector from codes.e_ut...
[((1167, 1298), 'codes.e_utils.rl_utils.get_rl_model', 'rl_utils.get_rl_model', ([], {'worker_id': 'worker_id', 'input_shape': 'input_shape', 'num_outputs': 'num_outputs', 'params': 'params', 'device': 'self.device'}), '(worker_id=worker_id, input_shape=input_shape,\n num_outputs=num_outputs, params=params, device=s...
thebeanogamer/edmund-botadder
edmundbotadder/cogs/webhook.py
91e71ce572f3206b99e1f7a68d40bc37b947daf5
from discord.ext.commands import Bot, Cog class Webhook(Cog): """ Webhook functionality """ def __init__(self, bot: Bot): self.bot = bot def setup(bot): bot.add_cog(Webhook(bot))
[]
allexvissoci/djangoecommerce
apps/core/forms.py
645c05daa5f13c1e42184a7c6f534b9c260d280a
from django import forms from django.core.mail import send_mail from django.conf import settings class ContactForm(forms.Form): name = forms.CharField(label='Nome', required=True) email = forms.EmailField(label='E-mail') message = forms.CharField(label='Mensagem', widget=forms.Textarea(), ...
[((142, 186), 'django.forms.CharField', 'forms.CharField', ([], {'label': '"""Nome"""', 'required': '(True)'}), "(label='Nome', required=True)\n", (157, 186), False, 'from django import forms\n'), ((199, 231), 'django.forms.EmailField', 'forms.EmailField', ([], {'label': '"""E-mail"""'}), "(label='E-mail')\n", (215, 23...
jamesaxl/FreeSnake
Fchat/Gui/AddFriendWidget.py
3cef45165bce50d0f296e0d016b49d45aa31a653
import gi gi.require_version('Gtk', '3.0') from gi.repository import Gio, Gtk, Gdk class AddFriendWidget(Gtk.Box): def __init__(self, main_window, fchat_prv, friend_list): Gtk.Box.__init__(self, spacing=7, orientation = Gtk.Orientation.VERTICAL) self.fchat_prv = fchat_prv self.main_window...
[((10, 42), 'gi.require_version', 'gi.require_version', (['"""Gtk"""', '"""3.0"""'], {}), "('Gtk', '3.0')\n", (28, 42), False, 'import gi\n'), ((186, 257), 'gi.repository.Gtk.Box.__init__', 'Gtk.Box.__init__', (['self'], {'spacing': '(7)', 'orientation': 'Gtk.Orientation.VERTICAL'}), '(self, spacing=7, orientation=Gtk....
liyan2013/hogwarts
python01/game.py
4b81d968b049a13cb2aa293d32c034ca3a30ee79
import random def game(): # 我的血量 my_hp = 1000 # 敌人的血量 enemy_hp = 1000 while True: # 我受到随机的攻击,减少血量 my_hp = my_hp - random.randint(0, 50) # 敌人收到随机的攻击,减少血量 enemy_hp = enemy_hp - random.randint(0, 50) if my_hp <= 0: # 如果我此时的血量<=0,则敌人赢了 ...
[((153, 174), 'random.randint', 'random.randint', (['(0)', '(50)'], {}), '(0, 50)\n', (167, 174), False, 'import random\n'), ((230, 251), 'random.randint', 'random.randint', (['(0)', '(50)'], {}), '(0, 50)\n', (244, 251), False, 'import random\n')]
andrii-grytsenko/io.swagger.petstore3.testing
petstore/api/api_response.py
81a0a16d574d0c0664b297e7ba7ff2bb5a9a0c40
from enum import Enum class ApiResponseType(Enum): error = "Error" warning = "Warning" info = "Info" ok = "OK" too_busy = "Too busy" class ApiResponse: def __init__(self, code: int, response_type: ApiResponseType, message): self.code = code self.type = response_type s...
[]
ycyun/ablestack-cloud
test/integration/component/test_browse_templates2.py
b7bd36a043e2697d05303246373988aa033c9229
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
[((1176, 1220), 'requests.packages.urllib3.disable_warnings', 'requests.packages.urllib3.disable_warnings', ([], {}), '()\n', (1218, 1220), False, 'import requests\n'), ((5319, 5406), 'nose.plugins.attrib.attr', 'attr', ([], {'tags': "['advanced', 'advancedns', 'smoke', 'basic']", 'required_hardware': '"""false"""'}), ...
pcaston/core
tests/components/ozw/test_websocket_api.py
e74d946cef7a9d4e232ae9e0ba150d18018cfe33
"""Test OpenZWave Websocket API.""" from unittest.mock import patch from openzwavemqtt.const import ( ATTR_CODE_SLOT, ATTR_LABEL, ATTR_OPTIONS, ATTR_POSITION, ATTR_VALUE, ValueType, ) from openpeerpower.components.ozw.const import ATTR_CONFIG_PARAMETER from openpeerpower.components.ozw.lock im...
[((11067, 11107), 'unittest.mock.patch', 'patch', (['"""openzwavemqtt.OZWOptions.listen"""'], {}), "('openzwavemqtt.OZWOptions.listen')\n", (11072, 11107), False, 'from unittest.mock import patch\n')]
samueljacques-qc/notification-utils
tests/test_formatters.py
77f09cb2633ea5938a28ed50c21c7ae5075da7f2
import pytest from flask import Markup from notifications_utils.formatters import ( unlink_govuk_escaped, notify_email_markdown, notify_letter_preview_markdown, notify_plain_text_email_markdown, sms_encode, formatted_list, strip_dvla_markup, strip_pipes, escape_html, remove_whit...
[((1427, 1886), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""input, output"""', '[(\'this is some text with a link http://example.com in the middle\',\n \'this is some text with a link <a style="word-wrap: break-word; color: #005ea5;" href="http://example.com">http://example.com</a> in the middle\'\n ...
kumarvgit/python3
ProgramFlow/functions/banner.py
318c5e7503fafc9c60082fa123e2930bd82a4ec9
def banner_text(text): screen_width = 80 if len(text) > screen_width - 4: print("EEK!!") print("THE TEXT IS TOO LONG TO FIT IN THE SPECIFIED WIDTH") if text == "*": print("*" * screen_width) else: centred_text = text.center(screen_width - 4) output_string = "**{0...
[]
acoomans/Adafruit_Python_BluefruitLE
Adafruit_BluefruitLE/interfaces/__init__.py
34fc6f596371b961628369d78ce836950514062f
from .provider import Provider from .adapter import Adapter from .device import Device from .gatt import GattService, GattCharacteristic, GattDescriptor
[]
axju/axju
axju/generic/__init__.py
de0b3d9c63b7cca4ed16fb50e865c159b4377953
from axju.generic.basic import BasicWorker from axju.generic.execution import ExecutionWorker from axju.generic.template import TemplateWorker
[]