repo_name
stringlengths
7
94
repo_path
stringlengths
4
237
repo_head_hexsha
stringlengths
40
40
content
stringlengths
10
680k
apis
stringlengths
2
680k
antopen/alipay-sdk-python-all
alipay/aop/api/domain/AlipayMerchantAuthDeleteModel.py
8e51c54409b9452f8d46c7bb10eea7c8f7e8d30c
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class AlipayMerchantAuthDeleteModel(object): def __init__(self): self._channel_code = None self._operator_id = None self._role = None self._scene_code = None sel...
[]
LaudateCorpus1/audio
test/torchaudio_unittest/models/emformer/emformer_cpu_test.py
a007e922d34028270197c0549bf452b79499d039
import torch from torchaudio_unittest.common_utils import PytorchTestCase from torchaudio_unittest.models.emformer.emformer_test_impl import EmformerTestImpl class EmformerFloat32CPUTest(EmformerTestImpl, PytorchTestCase): dtype = torch.float32 device = torch.device("cpu") class EmformerFloat64CPUTest(Emfor...
[((264, 283), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (276, 283), False, 'import torch\n'), ((390, 409), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (402, 409), False, 'import torch\n')]
stanton119/nba-analysis
src/nba_analysis/pipelines/data_processing/pipeline.py
79343150edaaa97472939c47b3ce521e038871b0
""" Two pipelines: * full history * update latest season * Only updates latest season year """ from functools import partial import itertools from kedro.pipeline import Pipeline, node from nba_analysis.pipelines.data_processing import basketball_reference from . import nodes def create_pipeline(**kwargs): ...
[((1530, 1709), 'kedro.pipeline.node', 'node', ([], {'func': 'basketball_reference.process_df_game_log', 'inputs': 'f"""game_log_data_{season}"""', 'outputs': 'f"""game_log_data_{season}_int"""', 'name': 'f"""process_game_log_data_{season}_node"""'}), "(func=basketball_reference.process_df_game_log, inputs=\n f'game...
baijifeilong/rawsteelp
IceSpringMusicPlayer/plugins/IceSpringHelloWorldPlugin/helloWorldPlugin.py
425547e6e2395bf4acb62435b18b5b3a4b7ebef4
# Created by BaiJiFeiLong@gmail.com at 2022/1/21 17:13 import typing from IceSpringRealOptional.typingUtils import gg from PySide2 import QtWidgets, QtCore from IceSpringMusicPlayer import tt from IceSpringMusicPlayer.common.pluginMixin import PluginMixin from IceSpringMusicPlayer.common.pluginWidgetMixin import Plu...
[((783, 814), 'PySide2.QtWidgets.QLabel', 'QtWidgets.QLabel', (['"""Hello World"""'], {}), "('Hello World')\n", (799, 814), False, 'from PySide2 import QtWidgets, QtCore\n'), ((842, 881), 'IceSpringRealOptional.typingUtils.gg', 'gg', (['QtCore.Qt.AlignmentFlag.AlignCenter'], {}), '(QtCore.Qt.AlignmentFlag.AlignCenter)\...
2baOrNot2ba/SWHT
SWHT/Ylm.py
738718e90d615e624dacf7746f8a2dfa973ec9fe
""" An implementation on spherical harmonics in python becasue scipy.special.sph_harm in scipy<=0.13 is very slow Originally written by Jozef Vesely https://github.com/scipy/scipy/issues/1280 """ import numpy as np def xfact(m): # computes (2m-1)!!/sqrt((2m)!) res = 1. for i in xrange(1, 2*m+1): ...
[]
alphacastio/connectors-gcba
0673.GCBA-HOTEL_STAFF.py
d1b97fb851463694ea844b3b81402c3ea747863b
#!/usr/bin/env python # coding: utf-8 # In[9]: import requests import pandas as pd from lxml import etree from bs4 import BeautifulSoup import datetime import io import numpy as np from alphacast import Alphacast from dotenv import dotenv_values API_KEY = dotenv_values(".env").get("API_KEY") alphacast = Alphacast(A...
[((309, 327), 'alphacast.Alphacast', 'Alphacast', (['API_KEY'], {}), '(API_KEY)\n', (318, 327), False, 'from alphacast import Alphacast\n'), ((443, 462), 'pandas.read_excel', 'pd.read_excel', (['url1'], {}), '(url1)\n', (456, 462), True, 'import pandas as pd\n'), ((1129, 1148), 'pandas.read_excel', 'pd.read_excel', (['...
aravi11/approxGed
simpleGmatch4py.py
6c0a2ed4fd1bcc86c22169e3c96fcf4de717bf8c
# import the GED using the munkres algorithm import gmatch4py as gm import networkx as nx import collections import csv import pickle from collections import OrderedDict import json import concurrent.futures as cf import time iter = 0 def getFinishedStatus(): iter +=1 print('*******\t' + str(iter)+ "\t*****...
[((2308, 2420), 'networkx.relabel.convert_node_labels_to_integers', 'nx.relabel.convert_node_labels_to_integers', (['graph_1'], {'first_label': '(0)', 'ordering': '"""sorted"""', 'label_attribute': 'None'}), "(graph_1, first_label=0, ordering\n ='sorted', label_attribute=None)\n", (2350, 2420), True, 'import network...
Dridi/blockdiag
src/blockdiag/utils/rst/nodes.py
bbb16f8a731cdf79a675a63c1ff847e70fdc4a5b
# -*- coding: utf-8 -*- # Copyright 2011 Takeshi KOMIYA # # 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 applica...
[((1881, 1914), 'os.path.join', 'os.path.join', (['outputdir', 'filename'], {}), '(outputdir, filename)\n', (1893, 1914), False, 'import os\n'), ((1684, 1698), 'hashlib.sha1', 'sha1', (['hashseed'], {}), '(hashseed)\n', (1688, 1698), False, 'from hashlib import sha1\n')]
emiliachojak/bio-projects
python-advanced/chp1/main.py
d2e5290b48613ef6721e303b3490a98cf4cbf6c0
# -*- coding: utf-8 -*- """ Created on Thu Dec 19 20:00:00 2019 @author: Emilia Chojak @e-mail: emilia.chojak@gmail.com """ tax_dict = { 'Pan troglodytes' : 'Hominoidea', 'Pongo abelii' : 'Hominoidea', 'Hominoidea' : 'Simiiformes', 'Simiiformes' : 'Haplorrhini', 'Tarsius tarsier' : 'Tarsiiformes', 'Haplorrhini' : 'Pr...
[]
LeishenKOBE/good-good-study
Python/csv/1.py
ac6b859f53b8b95f0746f35c5278009a5cad40a8
import csv # with open('./1.csv', newline='', encoding='utf-8') as f: # reader = csv.reader(f) # for row in reader: # print(row) with open('./1.csv', 'a', encoding='utf-8') as f: writer = csv.writer(f) writer.writerow(['4', '猫砂', '25', '1022', '886']) writer.writerow(['5', '猫罐头', '18', '22...
[((210, 223), 'csv.writer', 'csv.writer', (['f'], {}), '(f)\n', (220, 223), False, 'import csv\n')]
broper2/solana-py
src/solana/rpc/responses.py
146390d959f017e137238335ee6fa362ad1a1ab4
"""This module contains code for parsing RPC responses.""" from dataclasses import dataclass, field from typing import Union, Tuple, Any, Dict, List, Optional, Literal from apischema import alias from apischema.conversions import as_str from solana.publickey import PublicKey from solana.transaction import Transactio...
[((332, 349), 'apischema.conversions.as_str', 'as_str', (['PublicKey'], {}), '(PublicKey)\n', (338, 349), False, 'from apischema.conversions import as_str\n'), ((917, 935), 'apischema.alias', 'alias', (['"""rentEpoch"""'], {}), "('rentEpoch')\n", (922, 935), False, 'from apischema import alias\n'), ((3584, 3614), 'apis...
adriennekarnoski/data-structures
python/data_structures/binheap.py
86ccf988ac02884749226236ad4ac37762873efa
"""Build a binary min heap object.""" from math import floor class BinaryHeap(object): """Create a Binary Heap object as a Min Heap.""" def __init__(self): """Initialize the heap list to be used by Binary Heap.""" self._heap_list = [] def push(self, val): """Add new value to heap...
[]
RichardLitt/Vesper
vesper/archive_settings.py
5360844f42a06942e7684121c650b08cf8616285
""" Vesper archive settings. The Vesper server serves the Vesper archive that is in the directory in which the server starts. The archive settings are the composition of a set of default settings (hard-coded in this module) and settings (optionally) specified in the file "Archive Settings.yaml" in the archive director...
[((536, 599), 'vesper.util.settings.Settings.create_from_yaml', 'Settings.create_from_yaml', (['"""\ndatabase:\n engine: SQLite\n"""'], {}), '("""\ndatabase:\n engine: SQLite\n""")\n', (561, 599), False, 'from vesper.util.settings import Settings\n'), ((619, 670), 'vesper.util.settings_type.SettingsType', 'Settin...
DAIM-ML/autotf
autotf/model/vgg16.py
3f82d858f49c27d5ecb624cee555fb8fd47bf067
#-*- coding=utf-8 -*- from __future__ import division, print_function, absolute_import from base_model import BaseModel from helper import * import tensorflow as tf import pickle import numpy as np import time class Vgg16(BaseModel): default_param = { "loss" : "square_loss", "metrics" : ["loss"], ...
[((581, 593), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (591, 593), True, 'import tensorflow as tf\n'), ((4377, 4430), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '[None, 224, 224, 3]'}), '(tf.float32, shape=[None, 224, 224, 3])\n', (4391, 4430), True, 'import tensorflow as tf\n')...
RAJESHSAINI2113/LEGENDX
LEGEND/modules/_exec.py
82c3c61062e804c3bf8b6e4ee31d1e603ab8bfd0
import subprocess from LEGEND import tbot as bot from LEGEND import tbot as borg from LEGEND.events import register from LEGEND import OWNER_ID, SUDO_USERS import asyncio import traceback import io import os import sys import time from telethon.tl import functions from telethon.tl import types from telethon.tl.types im...
[((360, 391), 'LEGEND.events.register', 'register', ([], {'pattern': '"""^/bash (.*)"""'}), "(pattern='^/bash (.*)')\n", (368, 391), False, 'from LEGEND.events import register\n'), ((1284, 1310), 'LEGEND.events.register', 'register', ([], {'pattern': '"""^/eval"""'}), "(pattern='^/eval')\n", (1292, 1310), False, 'from ...
MaxSac/build
src/tools/pch.py
482c25f3a26171073c7e6c59f0427f2259a63fec
# Status: Being ported by Steven Watanabe # Base revision: 47077 # # Copyright (c) 2005 Reece H. Dunn. # Copyright 2006 Ilya Sokolov # Copyright (c) 2008 Steven Watanabe # # Use, modification and distribution is subject to the Boost Software # License Version 1.0. (See accompanying file LICENSE_1_0.txt or # http://www....
[((750, 779), 'b2.build.type.register', 'type.register', (['"""PCH"""', "['pch']"], {}), "('PCH', ['pch'])\n", (763, 779), False, 'from b2.build import type, feature, generators\n'), ((780, 813), 'b2.build.type.register', 'type.register', (['"""C_PCH"""', '[]', '"""PCH"""'], {}), "('C_PCH', [], 'PCH')\n", (793, 813), F...
GitHK/osparc-simcore-forked
packages/pytest-simcore/src/pytest_simcore/helpers/utils_login.py
5b01a28d1b8028afcf9a735e1d46a73daa13686e
import re from typing import Dict from aiohttp import web from yarl import URL from simcore_service_webserver.db_models import UserRole, UserStatus from simcore_service_webserver.login.cfg import cfg, get_storage from simcore_service_webserver.login.registration import create_invitation from simcore_service_webserver...
[((431, 461), 're.compile', 're.compile', (['"""TEST (\\\\w+):(.*)"""'], {}), "('TEST (\\\\w+):(.*)')\n", (441, 461), False, 'import re\n'), ((885, 906), 'simcore_service_webserver.login.utils.get_random_string', 'get_random_string', (['(10)'], {}), '(10)\n', (902, 906), False, 'from simcore_service_webserver.login.uti...
jmuhlich/indra
indra/tests/test_sparser.py
feab2c08541ea73f328579faa6a21b08082cb026
from indra import sparser xml_str1 = ''' <article pmid="54321"> <interpretation> <sentence-text>MEK1 phosphorylates ERK1</sentence-text> <sem> <ref category="phosphorylate"> <var name="agent"> <ref category="protein"> <var name="name">MP2K1_HUMAN</var> <var name="uid...
[((1899, 1925), 'indra.sparser.process_xml', 'sparser.process_xml', (['"""xyz"""'], {}), "('xyz')\n", (1918, 1925), False, 'from indra import sparser\n'), ((1988, 2017), 'indra.sparser.process_xml', 'sparser.process_xml', (['xml_str1'], {}), '(xml_str1)\n', (2007, 2017), False, 'from indra import sparser\n'), ((2369, 2...
siforrer/coreali
examples/quickstart/run_example.py
261e321b546192e608edf87c47719d2173ab4645
""" Simple Example using coreali to access a register model. Needs no h^ardware""" # Import dependencies and compile register model with systemrdl-compiler from systemrdl import RDLCompiler import coreali import numpy as np import os from coreali import RegisterModel rdlc = RDLCompiler() rdlc.compile_file(os.path.di...
[((278, 291), 'systemrdl.RDLCompiler', 'RDLCompiler', ([], {}), '()\n', (289, 291), False, 'from systemrdl import RDLCompiler\n'), ((502, 526), 'coreali.RegisterModel', 'RegisterModel', (['root', 'rio'], {}), '(root, rio)\n', (515, 526), False, 'from coreali import RegisterModel\n'), ((310, 335), 'os.path.dirname', 'os...
mcguigan/pants
src/python/pants/base/specs.py
e085d45669b72d0c51ab8a54602306fc76e07256
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). import os import re from abc import ABC, ABCMeta, abstractmethod from dataclasses import dataclass from typing import ( TYPE_CHECKING, Dict, Iterable, Iterator, List, Optional,...
[((3945, 3967), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (3954, 3967), False, 'from dataclasses import dataclass\n'), ((5860, 5882), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (5869, 5882), False, 'from dataclasses import dataclass\n'...
GordiigPinny/ApiRequesters
Mock/MockRequesterMixin.py
aeb36c7b7b5237c3a74dae6ced7c6141df729ab5
import json import requests from enum import Enum from typing import Dict from ..exceptions import JsonDecodeError, UnexpectedResponse, RequestError, BaseApiRequestError class MockRequesterMixin: """ Набор методов для моков реквестеров """ class ERRORS(Enum): ERROR_TOKEN = 'error' BAD_...
[((1334, 1351), 'json.loads', 'json.loads', (['token'], {}), '(token)\n', (1344, 1351), False, 'import json\n'), ((2924, 2943), 'requests.Response', 'requests.Response', ([], {}), '()\n', (2941, 2943), False, 'import requests\n'), ((3992, 4011), 'requests.Response', 'requests.Response', ([], {}), '()\n', (4009, 4011), ...
vkleen/skidl
tests/test_parse.py
f09200c978a39c127e292ef71b8ff89c1a3c0f5a
# -*- coding: utf-8 -*- # The MIT License (MIT) - Copyright (c) 2016-2021 Dave Vandenbout. import pytest from skidl import netlist_to_skidl from .setup_teardown import get_filename, setup_function, teardown_function def test_parser_1(): netlist_to_skidl(get_filename("Arduino_Uno_R3_From_Scratch.net"))
[]
pkbullock/RaspberryPi
Projects/envirohat-monitor/clear-screen.py
1c8e83566e97f65fe530d8d43293f4b26c015d0d
#!/usr/bin/env python3 import ST7735 import sys st7735 = ST7735.ST7735( port=0, cs=1, dc=9, backlight=12, rotation=270, spi_speed_hz=10000000 ) # Reset the display st7735.begin() st7735.reset() st7735.set_backlight(0) print "\nDone." # Exit cleanly sys.exit(0)
[]
carlosdenner/business_atlas
Scripts/nominatintest.py
8f95bbd07384baa6c5e51776690103e418b3875e
from geopy.geocoders import Nominatim from requests.models import LocationParseError geolocator = Nominatim(user_agent="geoapiExercises") Latitude = 25.594095 Longitude = 85.137566 def location(Latitude, Longitude): lat = str(Latitude) long = str(Longitude) print(lat + long) local = lat + "," + long...
[((100, 139), 'geopy.geocoders.Nominatim', 'Nominatim', ([], {'user_agent': '"""geoapiExercises"""'}), "(user_agent='geoapiExercises')\n", (109, 139), False, 'from geopy.geocoders import Nominatim\n')]
cristilianojr/JOKENPOH
gamesystem.py
604970d4f3cfbcc5f851e993af72d3bc86926ae5
import random from tkinter import PhotoImage """ Esse arquivo define os estados do game """ def ia_chocer(): """IA faz a escolha de um numero aleatório""" posibility = ['rock', 'paper', 'scissor'] value = posibility[random.randint(0, 2)] return value def battle_verification(player_choice, ia_choic...
[((233, 253), 'random.randint', 'random.randint', (['(0)', '(2)'], {}), '(0, 2)\n', (247, 253), False, 'import random\n')]
mister-bailey/MagNET
train/filelocks.py
4f75a6e2fe34eabf455d13338f318e3dc4bf0295
from filelock import FileLock, Timeout import os import time class ProcessFileLock(FileLock): """ FileLock that is unique per path in each process (for, eg., reentrance) """ locks = {} def __new__(cls, path, *args, **kwargs): if path in ProcessFileLock.locks: return P...
[((3654, 3665), 'time.time', 'time.time', ([], {}), '()\n', (3663, 3665), False, 'import time\n'), ((3681, 3706), 'os.path.isfile', 'os.path.isfile', (['self.path'], {}), '(self.path)\n', (3695, 3706), False, 'import os\n'), ((1113, 1148), 'os.path.join', 'os.path.join', (['dir', '"""histories.lock"""'], {}), "(dir, 'h...
jnthn/intellij-community
python/testData/quickFixes/PyRenameElementQuickFixTest/renameAwaitClassInPy36_after.py
8fa7c8a3ace62400c838e0d5926a7be106aa8557
class A_NEW_NAME(object): pass
[]
emissible/emissilbe
speedcom/tests/__init__.py
5537e787ccb883a101d2d40b38d480e257ac9755
#from . import context #from . import test_NNModels #from . import test_data_extract #from . import test_speedcom #from . import test_utilities
[]
Sanguet/todo-challenge
todo/management/serializers/tasks.py
8eabc02081e7ce6b33408558d4a4a39edee3944c
# Django REST Framework from rest_framework import serializers # Model from todo.management.models import Task # Utils from todo.utils.tasks import TaskMetrics from todo.utils.serializer_fields import CompleteNameUser class TaskModelSerializer(serializers.ModelSerializer): """Modelo serializer del circulo""" ...
[((330, 358), 'todo.utils.serializer_fields.CompleteNameUser', 'CompleteNameUser', ([], {'many': '(False)'}), '(many=False)\n', (346, 358), False, 'from todo.utils.serializer_fields import CompleteNameUser\n'), ((936, 974), 'todo.management.models.Task.objects.create', 'Task.objects.create', ([], {'user': 'user'}), '(u...
Sean-Ker/data_homework
outlier_detector.py
5f289c692690724ee5973683c53e83299958b270
import numpy as np import pandas as pd from sklearn.decomposition import PCA ''' A function that detects outliers, where k is a tandard deviation threshold hyperparameter preferablly (2, 2.5, 3). The algo could handle multivariable data frames with any number of features d. For that manner, it first reduces the dimens...
[((584, 634), 'sklearn.decomposition.PCA', 'PCA', ([], {'n_components': 'data.shape[1]', 'svd_solver': '"""full"""'}), "(n_components=data.shape[1], svd_solver='full')\n", (587, 634), False, 'from sklearn.decomposition import PCA\n'), ((801, 832), 'numpy.cov', 'np.cov', (['df.values'], {'rowvar': '(False)'}), '(df.valu...
nishio/atcoder
arc113/b.py
8db36537b5d8580745d5f98312162506ad7d7ab4
# included from snippets/main.py def debug(*x, msg=""): import sys print(msg, *x, file=sys.stderr) def solve(SOLVE_PARAMS): pass def main(): A, B, C = map(int, input().split()) doubling = [B % 20] for i in range(32): doubling.append( (doubling[-1] ** 2) % 20 ) ...
[((929, 946), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (944, 946), False, 'import doctest\n'), ((1458, 1488), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(10 ** 6)'], {}), '(10 ** 6)\n', (1479, 1488), False, 'import sys\n'), ((1593, 1603), 'sys.exit', 'sys.exit', ([], {}), '()\n', (1601, 1603), ...
ezan2000/Cssi_2018
pythonG/objects.py
2385e9f4557c1a2aa642e21d42dcc935e24c88c3
ezan = { 'name': 'ezan', 'age': 18, 'hair': 'brown', 'cool': True , } print(ezan) class Person(object): #use class to make object def __init__( self, name, age ,hair, color, hungry) : #initialize #first object inside of a class is self self.name = 'ezan' self.age = 18 ...
[]
pauvrepetit/leetcode
62/main.py
6ad093cf543addc4dfa52d72a8e3c0d05a23b771
# 62. 不同路径 # 组合数,杨辉三角 yanghui = [[0 for i in range(202)] for j in range(202)] def comb(n, k): if yanghui[n][k] == 0: yanghui[n][k] = (comb(n-1, k-1) + comb(n-1, k)) return yanghui[n][k] class Solution: def uniquePaths(self, m: int, n: int) -> int: for i in range(202): yanghui...
[]
romainledru/GermanOK
GermanOK/run.py
77bc86de0eabbd3d7413382a288fea286d608540
from Pages import * app = App() app.mainloop()
[]
JohnnyPeng18/cauldron
cauldron/cli/server/routes/ui_statuses.py
09120c2a4cef65df46f8c0c94f5d79395b3298cd
import flask from cauldron.cli.server import run as server_runner from cauldron.ui import arguments from cauldron.ui import statuses @server_runner.APPLICATION.route('/ui-status', methods=['POST']) def ui_status(): args = arguments.from_request() last_timestamp = args.get('last_timestamp', 0) force = arg...
[((137, 200), 'cauldron.cli.server.run.APPLICATION.route', 'server_runner.APPLICATION.route', (['"""/ui-status"""'], {'methods': "['POST']"}), "('/ui-status', methods=['POST'])\n", (168, 200), True, 'from cauldron.cli.server import run as server_runner\n'), ((229, 253), 'cauldron.ui.arguments.from_request', 'arguments....
Jaram2019/minwoo
google_search.py
d98ce8a84675281e237368cbe97d8a2120ce5840
import requests from bs4 import BeautifulSoup import re rq = requests.get("https://play.google.com/store/apps/category/GAME_MUSIC?hl=ko") rqctnt = rq.content soup = BeautifulSoup(rqctnt,"html.parser") soup = soup.find_all(attrs={'class':'title'}) blacklsit = ["앱","영화/TV","음악","도서","기기","엔터테인먼트","음악"] for link in sou...
[((62, 138), 'requests.get', 'requests.get', (['"""https://play.google.com/store/apps/category/GAME_MUSIC?hl=ko"""'], {}), "('https://play.google.com/store/apps/category/GAME_MUSIC?hl=ko')\n", (74, 138), False, 'import requests\n'), ((166, 202), 'bs4.BeautifulSoup', 'BeautifulSoup', (['rqctnt', '"""html.parser"""'], {}...
bbinet/PyGall
pygall/tests/test_photos.py
4d83165e50ca927d664aa6b7b716eb8f484c3cd6
from unittest import TestCase from pyramid import testing class PhotosTests(TestCase): def setUp(self): self.config = testing.setUp() def tearDown(self): testing.tearDown()
[((134, 149), 'pyramid.testing.setUp', 'testing.setUp', ([], {}), '()\n', (147, 149), False, 'from pyramid import testing\n'), ((183, 201), 'pyramid.testing.tearDown', 'testing.tearDown', ([], {}), '()\n', (199, 201), False, 'from pyramid import testing\n')]
alenasf/AutomateTheBoringStuff
Chapter_4/lists_data_type.py
041e56221eb98d9893c24d22497034e6344c0490
#Negative Indexes spam = ['cat', 'bat', 'rat', 'elephant'] spam[-1] # elepant spam[-3] # bat # Getting a List from another List with Slices spam = ['cat', 'bat', 'rat', 'elephant'] spam[0:4] # ['cat', 'bat', 'rat', 'elephant'] spam[1:3] # ['bat', 'rat'] spam[0:-1] # ['cat', 'bat', 'rat'] spam[:2] # ['cat', 'bat'] spa...
[((2482, 2501), 'random.choice', 'random.choice', (['pets'], {}), '(pets)\n', (2495, 2501), False, 'import random\n'), ((2502, 2521), 'random.choice', 'random.choice', (['pets'], {}), '(pets)\n', (2515, 2521), False, 'import random\n'), ((2522, 2541), 'random.choice', 'random.choice', (['pets'], {}), '(pets)\n', (2535,...
chuhaovince/Web-Design-Challenge
WebVisualizations/data.py
1826a0e2dfbe4e11feb78f0ecce02e0f8a0a7eb5
import pandas as pd path = "Resources/cities.csv" data = pd.read_csv(path) data_html = data.to_html("data.html", bold_rows = True)
[((57, 74), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (68, 74), True, 'import pandas as pd\n')]
hyunjoy/scripts
qemu/scripts/codeconverter/codeconverter/test_patching.py
01114d3627730d695b5ebe61093c719744432ffa
# Copyright (C) 2020 Red Hat Inc. # # Authors: # Eduardo Habkost <ehabkost@redhat.com> # # This work is licensed under the terms of the GNU GPL, version 2. See # the COPYING file in the top-level directory. from tempfile import NamedTemporaryFile from .patching import FileInfo, FileMatch, Patch, FileList from .regexp...
[((634, 658), 'tempfile.NamedTemporaryFile', 'NamedTemporaryFile', (['"""wt"""'], {}), "('wt')\n", (652, 658), False, 'from tempfile import NamedTemporaryFile\n'), ((1664, 1688), 'tempfile.NamedTemporaryFile', 'NamedTemporaryFile', (['"""wt"""'], {}), "('wt')\n", (1682, 1688), False, 'from tempfile import NamedTemporar...
Anim-101/CourseHub
Traversy Media/Python Django Dev to Deployment/Python Fundamentals/Tuples and Sets.py
570ddc2bca794c14921991d24fdf1b4a7d0beb68
# # Simple Tuple # fruits = ('Apple', 'Orange', 'Mango') # # Using Constructor # fruits = tuple(('Apple', 'Orange', 'Mango')) # # Getting a Single Value # print(fruits[1]) # Trying to change based on position # fruits[1] = 'Grape' # Tuples with one value should have trailing comma # fruits = ('Apple') # fruits = ('...
[]
flxst/nerblackbox
nerblackbox/modules/ner_training/metrics/ner_metrics.py
7612b95850e637be258f6bfb01274453b7372f99
from dataclasses import dataclass from dataclasses import asdict from typing import List, Tuple, Callable import numpy as np from sklearn.metrics import accuracy_score as accuracy_sklearn from sklearn.metrics import precision_score as precision_sklearn from sklearn.metrics import recall_score as recall_sklearn from sk...
[((3327, 3347), 'dataclasses.asdict', 'asdict', (['self.results'], {}), '(self.results)\n', (3333, 3347), False, 'from dataclasses import asdict\n'), ((3601, 3633), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""error"""'], {}), "('error')\n", (3624, 3633), False, 'import warnings\n'), ((4299, 4323), 'warn...
spacemanidol/CLMS572
Assignments/hw4/rank_feat_by_chi_square.py
f0380de9912c984ec21607cdb3b1f190853c5ca8
import sys def readInput(): labels, features, all_features, labelCount = [], [], [], {} l = sys.stdin.readline().strip().split(' ') while len(l)> 1: label = l[0] if label not in labelCount: labelCount[label] = 0 labelCount[label] += 1 labels.append(label) ...
[((100, 120), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (118, 120), False, 'import sys\n'), ((525, 545), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (543, 545), False, 'import sys\n')]
LeoCruzG/4chan-thread-downloader
Files/joinfiles.py
d449e50fc7f2a6273a11da3d8ff2f46aad4951d2
# Importamos la librería para leer archivos json import json # Abrimos el archivo master en modo lectura ('r') con todos los id de los archivos descargados with open('master.json', 'r') as f: # Guardamos en la variable lista el contenido de master lista = json.load(f) # En este ejemplo se representa cómo se a...
[((265, 277), 'json.load', 'json.load', (['f'], {}), '(f)\n', (274, 277), False, 'import json\n')]
SvenSerneels/pycopula
pycopula/archimedean_generators.py
27c703ab0d25356f6e78b7cc16c8ece1ed80f871
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file contains the generators and their inverses for common archimedean copulas. """ import numpy as np def boundsConditions(x): if x < 0 or x > 1: raise ValueError("Unable to compute generator for x equals to {}".format(x)) def claytonGenerator(...
[((2585, 2622), 'numpy.log', 'np.log', (['((1.0 - theta * (1.0 - x)) / x)'], {}), '((1.0 - theta * (1.0 - x)) / x)\n', (2591, 2622), True, 'import numpy as np\n'), ((2141, 2173), 'numpy.log', 'np.log', (['(1.0 - (1.0 - x) ** theta)'], {}), '(1.0 - (1.0 - x) ** theta)\n', (2147, 2173), True, 'import numpy as np\n'), ((1...
blackboard/BBDN-Base-Python-Flask
app/admin/__init__.py
710b82bfb45217798d9e9edda13d5e0f632e2284
""" """ from admin import routes def init_app(app): """ :param app: :return: """ routes.init_app(app)
[((105, 125), 'admin.routes.init_app', 'routes.init_app', (['app'], {}), '(app)\n', (120, 125), False, 'from admin import routes\n')]
tefra/xsdata-w3c-tests
output/models/nist_data/list_pkg/decimal/schema_instance/nistschema_sv_iv_list_decimal_pattern_2_xsd/__init__.py
b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f
from output.models.nist_data.list_pkg.decimal.schema_instance.nistschema_sv_iv_list_decimal_pattern_2_xsd.nistschema_sv_iv_list_decimal_pattern_2 import NistschemaSvIvListDecimalPattern2 __all__ = [ "NistschemaSvIvListDecimalPattern2", ]
[]
Pengeace/DGP-PDE-FEM
fem/fem.py
64b7f42ca7083b05f05c42baa6cad21084068d8c
import numpy as np import pyamg from scipy import sparse from scipy.spatial import Delaunay from linsolver import sparse_solver from triangulation.delaunay import delaunay class Element: def __init__(self, points, global_indexes, fem): self.points = np.array(points) self.global_indexes = global_i...
[((265, 281), 'numpy.array', 'np.array', (['points'], {}), '(points)\n', (273, 281), True, 'import numpy as np\n'), ((385, 423), 'numpy.array', 'np.array', (['[[0, 0], [1.0, 0], [0, 1.0]]'], {}), '([[0, 0], [1.0, 0], [0, 1.0]])\n', (393, 423), True, 'import numpy as np\n'), ((452, 494), 'numpy.array', 'np.array', (['[[...
MatthewFlamm/ha-tahoma
custom_components/tahoma/climate_devices/dimmer_exterior_heating.py
794e8e4a54a8e5f55622b88bb1ab5ffc3ecb0d1b
"""Support for Atlantic Electrical Heater IO controller.""" import logging from typing import List from homeassistant.components.climate import ClimateEntity from homeassistant.components.climate.const import ( HVAC_MODE_HEAT, HVAC_MODE_OFF, SUPPORT_TARGET_TEMPERATURE, ) from homeassistant.const import ATT...
[((455, 482), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (472, 482), False, 'import logging\n')]
emorynlp/stem-cell-hypothesis
elit/components/mtl/attn/joint_encoder.py
48a628093d93d653865fbac6409d179cddd99293
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2021-03-02 13:32 from typing import Optional, Union, Dict, Any import torch from torch import nn from transformers import PreTrainedTokenizer from elit.components.mtl.attn.attn import TaskAttention from elit.components.mtl.attn.transformer import JointEncoder from elit....
[((2256, 2333), 'elit.layers.transformers.utils.pick_tensor_for_each_token', 'pick_tensor_for_each_token', (['encoder_output', 'token_span', 'self.average_subwords'], {}), '(encoder_output, token_span, self.average_subwords)\n', (2282, 2333), False, 'from elit.layers.transformers.utils import pick_tensor_for_each_token...
salinsiim/petssa-simulation
simulation/sensors/__init__.py
8f0f128d462831f86664bb8d246f2c7b659a0b8d
from sensors.sensors import sense_characteristics, sense_pedestrians
[]
anuragajay/jaxrl
jaxrl/agents/sac_v1/sac_v1_learner.py
a37414aea9e281f19719ccfc09702b32e1ef4e44
"""Implementations of algorithms for continuous control.""" import functools from typing import Optional, Sequence, Tuple import jax import jax.numpy as jnp import numpy as np import optax from jaxrl.agents.sac import temperature from jaxrl.agents.sac.actor import update as update_actor from jaxrl.agents.sac.critic ...
[((542, 601), 'functools.partial', 'functools.partial', (['jax.jit'], {'static_argnames': '"""update_target"""'}), "(jax.jit, static_argnames='update_target')\n", (559, 601), False, 'import functools\n'), ((907, 954), 'jaxrl.agents.sac_v1.critic.update_q', 'update_q', (['critic', 'target_value', 'batch', 'discount'], {...
plures/rbc
rbc/libfuncs.py
57c170c148000e7b56f0cda2f0dbea7bdcfa0e1b
"""Collections of library function names. """ class Library: """Base class for a collection of library function names. """ @staticmethod def get(libname, _cache={}): if libname in _cache: return _cache[libname] if libname == 'stdlib': r = Stdlib() elif ...
[]
chenmich/google-ml-crash-course-exercises
quick_pandas.py
d610f890d53b1537a3ce80531ce1ff2df1f5dc84
import pandas as pd print(pd.__version__) city_names = pd.Series(['San Francisco', 'San Jose', 'Sacramento']) population = pd.Series([852469, 1015785, 485199]) #city_population_table = pd.DataFrame(({'City name': city_names, 'Population': population})) california_houseing_dataframe = pd.read_csv("https://storage.google...
[((55, 109), 'pandas.Series', 'pd.Series', (["['San Francisco', 'San Jose', 'Sacramento']"], {}), "(['San Francisco', 'San Jose', 'Sacramento'])\n", (64, 109), True, 'import pandas as pd\n'), ((123, 159), 'pandas.Series', 'pd.Series', (['[852469, 1015785, 485199]'], {}), '([852469, 1015785, 485199])\n', (132, 159), Tru...
paulproteus/briefcase-toga-button-app-with-hacks
src/helloworld/__main__.py
61ec41b154204bb4a7a59f55374193dd4f9ca377
from helloworld.app import main if True or __name__ == '__main__': main().main_loop()
[((72, 78), 'helloworld.app.main', 'main', ([], {}), '()\n', (76, 78), False, 'from helloworld.app import main\n')]
ianahart/blog
backend/app/main.py
fc52e15a8b56bd4c6482065de7e21f8b31f5d765
from fastapi import FastAPI from dotenv import load_dotenv from fastapi.middleware.cors import CORSMiddleware from app.api.api_v1.api import api_router from app.core.config import settings app = FastAPI() load_dotenv() app.include_router(api_router, prefix=settings.API_V1_STR) # Set all CORS enabled origins if sett...
[((197, 206), 'fastapi.FastAPI', 'FastAPI', ([], {}), '()\n', (204, 206), False, 'from fastapi import FastAPI\n'), ((207, 220), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (218, 220), False, 'from dotenv import load_dotenv\n'), ((734, 796), 'uvicorn.run', 'uvicorn.run', (['app'], {'host': '"""0.0.0.0"""', 'p...
goldstar611/ssort
test_data/samples/alembic_template_output.py
05c35ec89dd9ff391ae824c17ed974340e2f5597
"""Example revision Revision ID: fdf0cf6487a3 Revises: Create Date: 2021-08-09 17:55:19.491713 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = "fdf0cf6487a3" down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto ge...
[((593, 622), 'alembic.op.drop_table', 'op.drop_table', (['"""measurements"""'], {}), "('measurements')\n", (606, 622), False, 'from alembic import op\n'), ((432, 444), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (442, 444), True, 'import sqlalchemy as sa\n')]
gearbird/calgo
.archived/snakecode/0173.py
ab48357100de2a5ea47fda2d9f01ced6dc73fa79
from __future__ import annotations from typing import Optional # Definition for a binary tree node. class TreeNode: def __init__(self, val: int = 0, left: Optional[TreeNode] = None, right: Optional[TreeNode] = None): self.val = val self.left = left self.right = right class BSTIterator: ...
[]
KuiyuanFu/PythonLeetCode
.leetcode/506.relative-ranks.py
8962df2fa838eb7ae48fa59de272ba55a89756d8
# @lc app=leetcode id=506 lang=python3 # # [506] Relative Ranks # # https://leetcode.com/problems/relative-ranks/description/ # # algorithms # Easy (53.46%) # Likes: 188 # Dislikes: 9 # Total Accepted: 71.1K # Total Submissions: 132.4K # Testcase Example: '[5,4,3,2,1]' # # You are given an integer array score of...
[]
QuarkTheAwesome/compiler-rt-be-aeabi
test/msan/lit.cfg.py
79e7d2bd981b0f38d60d90f8382c6cd5389b95d0
# -*- Python -*- import os # Setup config name. config.name = 'MemorySanitizer' + getattr(config, 'name_suffix', 'default') # Setup source root. config.test_source_root = os.path.dirname(__file__) # Setup default compiler flags used with -fsanitize=memory option. clang_msan_cflags = (["-fsanitize=memory", ...
[((174, 199), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (189, 199), False, 'import os\n')]
victor-freitas/ProjetoNCS
application/core/migrations/0001_initial.py
7c80fad11e49f4ed00eefb90638730d340d78e1f
# Generated by Django 2.0.6 on 2018-06-17 04:47 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Cliente', fields=[ ('id', models.SmallInteg...
[((303, 378), 'django.db.models.SmallIntegerField', 'models.SmallIntegerField', ([], {'db_column': '"""ID"""', 'primary_key': '(True)', 'serialize': '(False)'}), "(db_column='ID', primary_key=True, serialize=False)\n", (327, 378), False, 'from django.db import migrations, models\n'), ((410, 464), 'django.db.models.Inte...
vingkan/sql_tools
dataschema/entity.py
5d6ab6a0ae31dc51e51ac1629f83f7bbf91396c1
# # nuna_sql_tools: Copyright 2022 Nuna Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
[((2196, 2240), 'typing.NewType', 'NewType', (['f"""Annotated_{_CLASS_ID}"""', 'supertype'], {}), "(f'Annotated_{_CLASS_ID}', supertype)\n", (2203, 2240), False, 'from typing import NewType, Union\n'), ((8773, 8801), 'dataclasses.fields', 'dataclasses.fields', (['self.cls'], {}), '(self.cls)\n', (8791, 8801), False, 'i...
melkisedeath/Harmonic_Analysis_and_Trajectory
Data_and_Dicts.py
a5a2819c053ddd287dcb668fac2f1be7e44f6c59
"""HERE are the base Points for all valid Tonnetze Systems. A period of all 12 notes divided by mod 3, mod 4 (always stable) """ # x = 4, y = 3 NotePointsT345 = { 0: (0, 0), 1: (1, 3), 2: (2, 2), 3: (0, 1), 4: (1, 0), 5: (2, 3), 6: (0, 2), 7: (1, 1), 8: (2, 0), 9: (0, 3), 1...
[]
alanjjenkins/awacs
awacs/proton.py
0065e1833eae6a6070edb4ab4f180fd10b26c19a
# Copyright (c) 2012-2021, Mark Peek <mark@peek.org> # All rights reserved. # # See LICENSE file for full license. from .aws import Action as BaseAction from .aws import BaseARN service_name = "AWS Proton" prefix = "proton" class Action(BaseAction): def __init__(self, action: str = None) -> None: super(...
[]
LydiaMelles/relativum
src/error.py
c7c0fc2b5c8d01842f6a02b67e7145cbd3a1ff65
class RequirementsNotMetError(Exception): """For SQL INSERT, missing table attributes.""" def __init__(self, message): super().__init__(message) class AuthenticationError(Exception): """Generic authentication error.""" def __init__(self, message): super().__init__(message)
[]
lorenrose1013/jaxline
jaxline/utils_test.py
29fca9944651d42139d4103fe12ef29b24812eb6
# Copyright 2020 DeepMind Technologies Limited. 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 ...
[((6154, 6194), 'unittest.mock.patch', 'mock.patch', (['"""jaxline.utils.logging.info"""'], {}), "('jaxline.utils.logging.info')\n", (6164, 6194), False, 'from unittest import mock\n'), ((6488, 6524), 'unittest.mock.patch', 'mock.patch', (['"""absl.logging.exception"""'], {}), "('absl.logging.exception')\n", (6498, 652...
deepcoder42/mysql-lib
test/unit/mysql_class/slaverep_isslverror.py
d3d2459e0476fdbc4465e1d9389612e58d36fb25
#!/usr/bin/python # Classification (U) """Program: slaverep_isslverror.py Description: Unit testing of SlaveRep.is_slv_error in mysql_class.py. Usage: test/unit/mysql_class/slaverep_isslverror.py Arguments: """ # Libraries and Global Variables # Standard import sys import os if sys.version...
[((435, 446), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (444, 446), False, 'import os\n'), ((3648, 3663), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3661, 3663), False, 'import unittest\n'), ((1646, 1776), 'mysql_class.SlaveRep', 'mysql_class.SlaveRep', (['self.name', 'self.server_id', 'self.sql_user', 'sel...
mengshun/Leetcode
problems/108.py
8bb676f2fff093e1417a4bed13d9ad708149be78
""" 108. 将有序数组转换为二叉搜索树 """ from TreeNode import TreeNode class Solution: def sortedArrayToBST(self, nums: [int]) -> TreeNode: def dfs(left, right): if left > right: return None mid = left + (right - left) // 2 root = TreeNode(nums[mid]) roo...
[((285, 304), 'TreeNode.TreeNode', 'TreeNode', (['nums[mid]'], {}), '(nums[mid])\n', (293, 304), False, 'from TreeNode import TreeNode\n')]
hsm207/sage
src/sage/tests/books/computational-mathematics-with-sagemath/domaines_doctest.py
020bd59ec28717bfab9af44d2231c53da1ff99f1
## -*- encoding: utf-8 -*- """ This file (./domaines_doctest.sage) was *autogenerated* from ./domaines.tex, with sagetex.sty version 2011/05/27 v2.3.1. It contains the contents of all the sageexample environments from this file. You should be able to doctest this file with: sage -t ./domaines_doctest.sage It is always ...
[]
TheBoringBakery/Riot-Watcher
src/riotwatcher/riotwatcher.py
6e05fffe127530a75fd63e67da37ba81489fd4fe
from .Deserializer import Deserializer from .RateLimiter import RateLimiter from .Handlers import ( DeprecationHandler, DeserializerAdapter, DictionaryDeserializer, RateLimiterAdapter, ThrowOnErrorHandler, TypeCorrectorHandler, ) from .Handlers.RateLimit import BasicRateLimiter from ._apis imp...
[]
TaoYibo1866/webots_ros2
webots_ros2_core/webots_ros2_core/devices/gps_device.py
a72c164825663cebbfd27e0649ea51d3abf9bbed
# Copyright 1996-2021 Cyberbotics 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 in...
[((3071, 3080), 'std_msgs.msg.Float32', 'Float32', ([], {}), '()\n', (3078, 3080), False, 'from std_msgs.msg import Float32\n'), ((3255, 3266), 'sensor_msgs.msg.NavSatFix', 'NavSatFix', ([], {}), '()\n', (3264, 3266), False, 'from sensor_msgs.msg import NavSatFix, NavSatStatus\n'), ((3781, 3795), 'geometry_msgs.msg.Poi...
saisankargochhayat/doot
ML/complete_model/setlist.py
00bd74463a065f23886e829aae677267b7619e13
setlist = [['a','m','n','s','t','g','q','o','x'],['b','e','c'],['h','k','u','v'], ['d','r','p'],['f'],['l'],['i'],['w'],['y']]
[]
jtreim/cant-stop
players/jeff.py
0ef1a2da67e4232a4ad2be150e950e8f1914a851
from .player import Player class JeffPlayer(Player): """ JeffPlayer focuses on the odds for continuing turns. To pick which move, calculates a move value based on odds of continued turns, moving forward less likely columns when possible, and winning columns over opponents. """ ODDS = 'odds...
[]
nataddrho/digicueblue
Python2/src/main.py
246c87129e6a70d384b1553688672bb3d5c6643e
#!/usr/bin/env python # Nathan Rhoades 10/13/2017 import serial import serialport import bgapi import gui import digicueblue import traceback import time import threading import sys if sys.version_info[0] < 3: import Tkinter as Tk else: import tkinter as Tk class App(threading.Thread): # thread GUI to tha...
[]
plasticruler/newshound
messager.py
c97ef09165eabb27ac65682e4893cf72dae7f3fb
import requests #newspi key c2d941c74c144421945618d97a458144 class Article: link:str headline:str summary:str body:str
[]
ronin-gw/PyMaSC
PyMaSC/handler/mappability.py
70c32b647017e162e0b004cadcf4f59a2d4012b6
import logging import os import json from multiprocessing import Process, Queue, Lock import numpy as np from PyMaSC.core.mappability import MappableLengthCalculator from PyMaSC.utils.progress import ProgressHook, MultiLineProgressManager from PyMaSC.utils.compatible import tostr, xrange from PyMaSC.utils.output impo...
[((395, 422), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (412, 422), False, 'import logging\n'), ((2727, 2757), 'os.path.dirname', 'os.path.dirname', (['self.map_path'], {}), '(self.map_path)\n', (2742, 2757), False, 'import os\n'), ((6111, 6118), 'multiprocessing.Queue', 'Queue', ([]...
Nahid-Hassan/fullstack-software-development
courses/backend/django-for-everybody/Web Application Technologies and Django/resources/dj4e-samples/tmpl/views.py
892ffb33e46795061ea63378279a6469de317b1a
from django.shortcuts import render from django.views import View # Create your views here. def simple(request): return render(request, 'tmpl/simple.html') def guess(request) : context = {'zap' : '42' } return render(request, 'tmpl/guess.html', context) def special(request) : context = {'txt' : '<b>...
[((126, 161), 'django.shortcuts.render', 'render', (['request', '"""tmpl/simple.html"""'], {}), "(request, 'tmpl/simple.html')\n", (132, 161), False, 'from django.shortcuts import render\n'), ((225, 268), 'django.shortcuts.render', 'render', (['request', '"""tmpl/guess.html"""', 'context'], {}), "(request, 'tmpl/guess....
jykim-rust/python
webapp/ex.py
50efe51733976d9f8ae3be47d628601ad002d836
from flask import escape '''with open('ex') as full: for line in full: print(line,end='**') ''' ''' a=[] with open('ex') as full: for line in full: a.append(line.split('|')) print(a) ''' ''' with open('ex') as full: for line in full.readline(): print(line) ''' contents=[] with o...
[]
Vman45/ask-alexa-twitter
lib/twitter_utils.py
1711005e51db1f66beb2e41e762c39ee003273aa
import requests import jsonpickle from requests_oauthlib import OAuth1 from urllib.parse import parse_qs, urlencode import cherrypy from collections import defaultdict import json import os import re from collections import defaultdict # For readable serializations jsonpickle.set_encoder_options('json', sort_keys=Tr...
[((269, 333), 'jsonpickle.set_encoder_options', 'jsonpickle.set_encoder_options', (['"""json"""'], {'sort_keys': '(True)', 'indent': '(4)'}), "('json', sort_keys=True, indent=4)\n", (299, 333), False, 'import jsonpickle\n'), ((9171, 9208), 'requests_oauthlib.OAuth1', 'OAuth1', (['consumer_key', 'consumer_secret'], {}),...
jamesabel/sundry
sundry/serializable.py
4f63bfa0624c88a3cd05adf2784e9e3e66e094f4
import json from enum import Enum from decimal import Decimal def convert_serializable_special_cases(o): """ Convert an object to a type that is fairly generally serializable (e.g. json serializable). This only handles the cases that need converting. The json module handles all the rest. For JSON, ...
[((1324, 1397), 'json.dumps', 'json.dumps', (['o'], {'default': 'convert_serializable_special_cases', 'sort_keys': '(True)'}), '(o, default=convert_serializable_special_cases, sort_keys=True)\n', (1334, 1397), False, 'import json\n')]
FrancisLiang/models-1
legacy/neural_qa/train.py
e14d5bc1ab36d0dd11977f27cff54605bf99c945
import sys import os import argparse import numpy as np import paddle.v2 as paddle import reader import utils import network import config from utils import logger def save_model(trainer, model_save_dir, parameters, pass_id): f = os.path.join(model_save_dir, "params_pass_%05d.tar.gz" % pass_id) logger.info(...
[]
astro-friedel/yggdrasil
yggdrasil/drivers/MatlabModelDriver.py
5ecbfd083240965c20c502b4795b6dc93d94b020
import subprocess import uuid as uuid_gen import logging from datetime import datetime import os import psutil import warnings import weakref from yggdrasil import backwards, tools, platform, serialize from yggdrasil.languages import get_language_dir from yggdrasil.config import ygg_cfg from yggdrasil.drivers.Interpret...
[((416, 443), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (433, 443), False, 'import logging\n'), ((1037, 1063), 'yggdrasil.languages.get_language_dir', 'get_language_dir', (['"""matlab"""'], {}), "('matlab')\n", (1053, 1063), False, 'from yggdrasil.languages import get_language_dir\n'...
SACGF/variantgrid
analysis/migrations/0032_auto_20210409_1333.py
515195e2f03a0da3a3e5f2919d8e0431babfd9c9
# Generated by Django 3.1.3 on 2021-04-09 04:03 import django.db.models.deletion from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('snpdb', '0030_one_off_fix_cohort_sample_order'), ('analysis', '0031_auto_20210331_1826'), ] operations = [ ...
[((437, 538), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'null': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""snpdb.genomebuild"""'}), "(null=True, on_delete=django.db.models.deletion.CASCADE,\n to='snpdb.genomebuild')\n", (454, 538), False, 'from django.db import migrations, ...
meaningfy-ws/ted-sws
ted_sws/mapping_suite_processor/services/conceptual_mapping_generate_sparql_queries.py
d1e351eacb2900f84ec7edc457e49d8202fbaff5
import pathlib from typing import Iterator import pandas as pd from ted_sws.resources.prefixes import PREFIXES_DEFINITIONS import re CONCEPTUAL_MAPPINGS_RULES_SHEET_NAME = "Rules" RULES_SF_FIELD_ID = 'Standard Form Field ID (M)' RULES_SF_FIELD_NAME = 'Standard Form Field Name (M)' RULES_E_FORM_BT_ID = 'eForm BT-ID (O)...
[((593, 625), 're.compile', 're.compile', (['"""(?:\\\\s+|^)(\\\\w+)?:"""'], {}), "('(?:\\\\s+|^)(\\\\w+)?:')\n", (603, 625), False, 'import re\n'), ((743, 786), 're.findall', 're.findall', (['SPARQL_PREFIX_PATTERN', 'sparql_q'], {}), '(SPARQL_PREFIX_PATTERN, sparql_q)\n', (753, 786), False, 'import re\n'), ((2683, 275...
codeKgu/BiLevel-Graph-Neural-Network
src/__init__.py
ed89c7d39baca757411cf333c595ac464e991a8e
import sys from os.path import dirname, abspath, join cur_folder = dirname(abspath(__file__)) sys.path.insert(0, join(dirname(cur_folder), 'src')) sys.path.insert(0, dirname(cur_folder)) print(cur_folder)
[((76, 93), 'os.path.abspath', 'abspath', (['__file__'], {}), '(__file__)\n', (83, 93), False, 'from os.path import dirname, abspath, join\n'), ((167, 186), 'os.path.dirname', 'dirname', (['cur_folder'], {}), '(cur_folder)\n', (174, 186), False, 'from os.path import dirname, abspath, join\n'), ((119, 138), 'os.path.dir...
igormotta92/gta-desafio-python-flask-api
src/controllers/serie.py
7c048239359e8a21d777109bdb0d58b6c2c18450
# https://stackoverflow.com/questions/3300464/how-can-i-get-dict-from-sqlite-query # from flask import Flask from flask_restful import Resource, reqparse from src.model.serie import SerieModel from src.server.instance import server from db import db # books_db = [{"id": 0, "title": "War and Peace"}, {"id": 1, "title"...
[((588, 621), 'src.model.serie.SerieModel.setConnectDataBase', 'SerieModel.setConnectDataBase', (['db'], {}), '(db)\n', (617, 621), False, 'from src.model.serie import SerieModel\n'), ((638, 663), 'src.model.serie.SerieModel.find_by_id', 'SerieModel.find_by_id', (['id'], {}), '(id)\n', (659, 663), False, 'from src.mode...
hirnimeshrampuresoftware/python-tcod
tests/test_random.py
c82d60eaaf12e50b405d55df1026c1d00dd283b6
import copy import pickle import tcod def test_tcod_random() -> None: rand = tcod.random.Random(tcod.random.COMPLEMENTARY_MULTIPLY_WITH_CARRY) assert 0 <= rand.randint(0, 100) <= 100 assert 0 <= rand.uniform(0, 100) <= 100 rand.guass(0, 1) rand.inverse_guass(0, 1) def test_tcod_random_copy() ->...
[((84, 149), 'tcod.random.Random', 'tcod.random.Random', (['tcod.random.COMPLEMENTARY_MULTIPLY_WITH_CARRY'], {}), '(tcod.random.COMPLEMENTARY_MULTIPLY_WITH_CARRY)\n', (102, 149), False, 'import tcod\n'), ((338, 386), 'tcod.random.Random', 'tcod.random.Random', (['tcod.random.MERSENNE_TWISTER'], {}), '(tcod.random.MERSE...
rbanffy/Zope
src/Products/Five/viewlet/viewlet.py
ecf6770219052e7c7f8c9634ddf187a1e6280742
############################################################################## # # Copyright (c) 2006 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOF...
[((1320, 1350), 'Products.Five.browser.pagetemplatefile.ViewPageTemplateFile', 'ViewPageTemplateFile', (['template'], {}), '(template)\n', (1340, 1350), False, 'from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile\n'), ((1768, 1793), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file_...
bptfreitas/Project-Euler
problema21.py
02b3ef8f8e3754b886b266fcd5eee7fd00d97dde
#Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). #If d(a) = b and d(b) = a, where a b, then a and b are an amicable pair and each of a and b are called amicable numbers. #For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110; th...
[]
emacslisp/python
python-3.6.0/Doc/includes/email-unpack.py
5b89ddcc504108f0dfa1081e338e6475cf6ccd2f
#!/usr/bin/env python3 """Unpack a MIME message into a directory of files.""" import os import email import mimetypes from email.policy import default from argparse import ArgumentParser def main(): parser = ArgumentParser(description="""\ Unpack a MIME message into a directory of files. """) parser.add_a...
[((218, 303), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Unpack a MIME message into a directory of files.\n"""'}), "(description='Unpack a MIME message into a directory of files.\\n'\n )\n", (232, 303), False, 'from argparse import ArgumentParser\n'), ((671, 721), 'email.message_from_binar...
juliantrue/Streetview-Segmenting
src/streetview/logging_facility.py
337740e6ebd2284c880ace09a11032c5914b39a4
import sys, os import logging import datetime module_name = 'Streetview_Module' debug_mode = True class LoggingWrapper(object): def __init__(self, log_folder_path=None): self.debug_mode = debug_mode # Create logger with module name logger = logging.getLogger(module_name) logger.s...
[((273, 303), 'logging.getLogger', 'logging.getLogger', (['module_name'], {}), '(module_name)\n', (290, 303), False, 'import logging\n'), ((419, 442), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (440, 442), False, 'import datetime\n'), ((1020, 1043), 'logging.StreamHandler', 'logging.StreamHandl...
DazEB2/SimplePyScripts
tkinter_examples/draw_chess_board.py
1dde0a42ba93fe89609855d6db8af1c63b1ab7cc
#!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = 'ipetrash' from tkinter import * root = Tk() root.title('Chess board') canvas = Canvas(root, width=700, height=700, bg='#fff') canvas.pack() fill = '#fff' outline = '#000' size = 88 for i in range(8): for j in range(8): x1, y1, x2, y2 = i * ...
[]
PremierLangage/sandbox-api
sandbox_api/asandbox.py
7150ddcb92ac2304ff1d7b23571ec5e20459747b
# asandbox.py # # Authors: # - Coumes Quentin <coumes.quentin@gmail.com> """An asynchronous implementation of the Sandbox API.""" import io import json import os from contextlib import AbstractAsyncContextManager from typing import BinaryIO, Optional, Union import aiohttp from .exceptions import status_exception...
[((4690, 4708), 'aiohttp.FormData', 'aiohttp.FormData', ([], {}), '()\n', (4706, 4708), False, 'import aiohttp\n'), ((5413, 5431), 'aiohttp.FormData', 'aiohttp.FormData', ([], {}), '()\n', (5429, 5431), False, 'import aiohttp\n'), ((6049, 6067), 'aiohttp.FormData', 'aiohttp.FormData', ([], {}), '()\n', (6065, 6067), Fa...
jhonnattan123/fastapi_crud_example
api/services/usuarios_services.py
24e1c295d41ad364ef839a4756e85b5bd640385a
import datetime from uuid import UUID from api.actions import storage from fastapi import HTTPException from api.models.usuario import Usuario from starlette.requests import Request from api.dependencies import validar_email, validar_formato_fecha,validar_edad FORMATO_FECHA = "%Y-%m-%d" EDAD_MINIMA = 18 EDAD_MAXIMA = ...
[((1409, 1468), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['fecha_nacimiento', 'FORMATO_FECHA'], {}), '(fecha_nacimiento, FORMATO_FECHA)\n', (1435, 1468), False, 'import datetime\n'), ((1735, 1764), 'api.actions.storage.add', 'storage.add', (['usuario', 'request'], {}), '(usuario, request)\n', (1746,...
thisismyrobot/cti-toolkit
certau/util/taxii/client.py
faf6e912af69376f5c55902c1592f7eeb0ce03dd
import os import logging import dateutil import pickle from six.moves.urllib.parse import urlparse from libtaxii import get_message_from_http_response, VID_TAXII_XML_11 from libtaxii.messages_11 import PollRequest, PollFulfillmentRequest from libtaxii.messages_11 import PollResponse, generate_message_id from libtaxii...
[((1159, 1178), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (1176, 1178), False, 'import logging\n'), ((4119, 4148), 'libtaxii.messages_11.PollRequest', 'PollRequest', ([], {}), '(**request_kwargs)\n', (4130, 4148), False, 'from libtaxii.messages_11 import PollRequest, PollFulfillmentRequest\n'), ((4869...
YipengHu/MPHY0041
tutorials/registration/data.py
6e9706eba2b9f9a2449539d7dea5f91dde807584
import os import zipfile import requests DATA_PATH = './data' RESULT_PATH = './result' if not os.path.exists(DATA_PATH): os.makedirs(DATA_PATH) print('Downloading and extracting data...') url = 'https://weisslab.cs.ucl.ac.uk/WEISSTeaching/datasets/-/archive/hn2dct/datasets-hn2dct.zip' r = requests.get(url,all...
[((300, 339), 'requests.get', 'requests.get', (['url'], {'allow_redirects': '(True)'}), '(url, allow_redirects=True)\n', (312, 339), False, 'import requests\n'), ((487, 507), 'os.remove', 'os.remove', (['temp_file'], {}), '(temp_file)\n', (496, 507), False, 'import os\n'), ((98, 123), 'os.path.exists', 'os.path.exists'...
lhuett/insights-core
insights/parsers/tests/test_freeipa_healthcheck_log.py
1c84eeffc037f85e2bbf60c9a302c83aa1a50cf8
import doctest from insights.parsers import freeipa_healthcheck_log from insights.parsers.freeipa_healthcheck_log import FreeIPAHealthCheckLog from insights.tests import context_wrap LONG_FREEIPA_HEALTHCHECK_LOG_OK = """ [{"source": "ipahealthcheck.ipa.roles", "check": "IPACRLManagerCheck", "result": "SUCCESS", "uuid"...
[((3699, 3750), 'doctest.testmod', 'doctest.testmod', (['freeipa_healthcheck_log'], {'globs': 'env'}), '(freeipa_healthcheck_log, globs=env)\n', (3714, 3750), False, 'import doctest\n'), ((2369, 2409), 'insights.tests.context_wrap', 'context_wrap', (['FREEIPA_HEALTHCHECK_LOG_OK'], {}), '(FREEIPA_HEALTHCHECK_LOG_OK)\n',...
xswz8015/infra
recipes/recipes/windows_image_builder/winpe_customization.py
f956b78ce4c39cc76acdda47601b86794ae0c1ba
# Copyright 2021 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from recipe_engine import post_process from PB.recipes.infra.windows_image_builder import windows_image_builder as wib from PB.recipes.infra.windows_image_b...
[((3084, 3134), 'RECIPE_MODULES.infra.windows_scripts_executor.test_helper.ADD_FILE', 't.ADD_FILE', (['api', 'wpe_image', 'wpe_cust', 'STARTNET_URL'], {}), '(api, wpe_image, wpe_cust, STARTNET_URL)\n', (3094, 3134), True, 'from RECIPE_MODULES.infra.windows_scripts_executor import test_helper as t\n'), ((2084, 2174), 'P...
wonjinYi/lollang-playground
back/lollangCompiler/main.py
2df07ccc2518e6dc9f9aa00b2f38ad8d62cdb507
from lollangCompiler.compiler import Compiler import argparse if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("--file", required=True, help="컴파일할 파일을 선택해주세요.") parser.add_argument("--out", default="out.py", help="목적 파이썬 파일경로를 선택해주세요") args = parser.parse_args() cmp...
[((103, 128), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (126, 128), False, 'import argparse\n'), ((323, 333), 'lollangCompiler.compiler.Compiler', 'Compiler', ([], {}), '()\n', (331, 333), False, 'from lollangCompiler.compiler import Compiler\n')]
UKPLab/emnlp2019-duplicate_question_detection
reproducing/generator_datacreation/data/readers/SEReader.py
17a9d97c2414666fcc08015a58619fe9722daf2b
import logging import subprocess import xml.etree.ElementTree as ET from tqdm import tqdm logger = logging.getLogger('root') POST_TYPE_QUESTION = '1' POST_TYPE_ANSWER = '2' class SEDataReader(object): """ NOTE: - a typical xml string for question in original data looks like <row Id="4"...
[((102, 127), 'logging.getLogger', 'logging.getLogger', (['"""root"""'], {}), "('root')\n", (119, 127), False, 'import logging\n'), ((2051, 2109), 'subprocess.check_output', 'subprocess.check_output', (["['wc', '-l', self.data_file_path]"], {}), "(['wc', '-l', self.data_file_path])\n", (2074, 2109), False, 'import subp...