repo_name
stringlengths
7
94
repo_path
stringlengths
4
237
repo_head_hexsha
stringlengths
40
40
content
stringlengths
10
680k
apis
stringlengths
2
680k
dylanlee101/leetcode
code_week12_713_719/is_graph_bipartite_hard.py
b059afdadb83d504e62afd1227107de0b59557af
''' 给定一个无向图graph,当这个图为二分图时返回true。 如果我们能将一个图的节点集合分割成两个独立的子集A和B,并使图中的每一条边的两个节点一个来自A集合,一个来自B集合,我们就将这个图称为二分图。 graph将会以邻接表方式给出,graph[i]表示图中与节点i相连的所有节点。每个节点都是一个在0到graph.length-1之间的整数。这图中没有自环和平行边: graph[i] 中不存在i,并且graph[i]中没有重复的值。 示例 1: 输入: [[1,3], [0,2], [1,3], [0,2]] 输出: true 解释: 无向图如下: 0----1 | | | | 3----2 我们可以将...
[]
Frost199/Machine_Learning
data_preprocessing/decision_tree_regression.py
8cf77c6cbbae7781ac6f2ffcc9218ad79472d287
# -*- coding: utf-8 -*- """ Created on Tue Apr 17 06:44:47 2018 @author: Eleam Emmanuel """ import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.tree import DecisionTreeRegressor # importing the dataset dataset = pd.read_csv('Position_Salaries.csv') # take all the columns but leave the...
[((247, 283), 'pandas.read_csv', 'pd.read_csv', (['"""Position_Salaries.csv"""'], {}), "('Position_Salaries.csv')\n", (258, 283), True, 'import pandas as pd\n'), ((929, 966), 'sklearn.tree.DecisionTreeRegressor', 'DecisionTreeRegressor', ([], {'random_state': '(0)'}), '(random_state=0)\n', (950, 966), False, 'from skle...
everaccountable/django-user-messages
user_messages/apps.py
101d539b785bdb440bf166fb16ad25eb66e4174a
from django.apps import AppConfig from django.conf import settings from django.core import checks from django.template import engines from django.template.backends.django import DjangoTemplates from django.utils.text import capfirst from django.utils.translation import gettext_lazy as _ @checks.register() def check_c...
[((291, 308), 'django.core.checks.register', 'checks.register', ([], {}), '()\n', (306, 308), False, 'from django.core import checks\n'), ((397, 410), 'django.template.engines.all', 'engines.all', ([], {}), '()\n', (408, 410), False, 'from django.template import engines\n'), ((1766, 1784), 'django.utils.translation.get...
sharshofski/evalml
evalml/tests/objective_tests/test_standard_metrics.py
f13dcd969e86b72ba01ca520247a16850030dcb0
from itertools import product import numpy as np import pandas as pd import pytest from sklearn.metrics import matthews_corrcoef as sk_matthews_corrcoef from evalml.objectives import ( F1, MAPE, MSE, AccuracyBinary, AccuracyMulticlass, BalancedAccuracyBinary, BalancedAccuracyMulticlass, ...
[((843, 865), 'evalml.objectives.utils._all_objectives_dict', '_all_objectives_dict', ([], {}), '()\n', (863, 865), False, 'from evalml.objectives.utils import _all_objectives_dict, get_non_core_objectives\n'), ((1051, 1075), 'numpy.array', 'np.array', (['[np.nan, 0, 0]'], {}), '([np.nan, 0, 0])\n', (1059, 1075), True,...
Aaron-Ming/websocket_terminal
server-python3/server.py
42c24391d51c275eabf1f879fb312b9a3614f51e
import os import urllib.parse import eventlet import eventlet.green.socket # eventlet.monkey_patch() import eventlet.websocket import eventlet.wsgi import wspty.pipe from flask import Flask, request, redirect from wspty.EchoTerminal import EchoTerminal from wspty.EncodedTerminal import EncodedTerminal from wspty.Webso...
[((399, 414), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (404, 414), False, 'from flask import Flask, request, redirect\n'), ((3676, 3740), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Websocket Terminal server"""'}), "(description='Websocket Terminal server')\n", (369...
seomoz/roger-mesos-tools
tests/unit/test_roger_promote.py
88b4cb3550a4b49d0187cfb5e6a22246ff6b9765
# -*- encoding: utf-8 -*- """ Unit test for roger_promote.py """ import tests.helper import unittest import os import os.path import pytest import requests from mockito import mock, Mock, when from cli.roger_promote import RogerPromote from cli.appconfig import AppConfig from cli.settings import Settings from cl...
[((551, 565), 'mockito.mock', 'mock', (['Marathon'], {}), '(Marathon)\n', (555, 565), False, 'from mockito import mock, Mock, when\n'), ((590, 604), 'mockito.mock', 'mock', (['Settings'], {}), '(Settings)\n', (594, 604), False, 'from mockito import mock, Mock, when\n'), ((631, 646), 'mockito.mock', 'mock', (['AppConfig...
papb/COVID-19
data/collectors.py
2dc8e683f55c494ca894727aca56f90e53b161f3
import json import pandas as pd import requests def load_dump_covid_19_data(): COVID_19_BY_CITY_URL='https://raw.githubusercontent.com/wcota/covid19br/master/cases-brazil-cities-time.csv' by_city=(pd.read_csv(COVID_19_BY_CITY_URL) .query('country == "Brazil"') .drop(columns=['c...
[((5965, 6009), 'pandas.to_datetime', 'pd.to_datetime', (["x['date']"], {'format': '"""%m/%d/%y"""'}), "(x['date'], format='%m/%d/%y')\n", (5979, 6009), True, 'import pandas as pd\n'), ((3947, 4062), 'pandas.merge', 'pd.merge', (['df', 'uf_codes'], {'left_on': '"""BRASIL E UNIDADES DA FEDERAÇÃO"""', 'right_on': '"""Uni...
freingruber/JavaScript-Raider
testsuite/testsuite_helpers.py
d1c1fff2fcfc60f210b93dbe063216fa1a83c1d0
import config as cfg import utils import native_code.executor as executor number_performed_tests = 0 expectations_correct = 0 expectations_wrong = 0 def reset_stats(): global number_performed_tests, expectations_correct, expectations_wrong number_performed_tests = 0 expectations_correct = 0 expecta...
[((2043, 2075), 'config.exec_engine.restart_engine', 'cfg.exec_engine.restart_engine', ([], {}), '()\n', (2073, 2075), True, 'import config as cfg\n'), ((2089, 2134), 'config.exec_engine.execute_safe', 'cfg.exec_engine.execute_safe', (['code_to_execute'], {}), '(code_to_execute)\n', (2117, 2134), True, 'import config a...
davidhyman/override
examples/my_configs/two.py
e34bd3c8676233439de5c002367b3bff5c1b88d6
from .one import * fruit = 'banana' colour = 'orange' sam['eggs'] = 'plenty' sam.pop('ham')
[]
aglaya-pill/ITMO_ICT_WebDevelopment_2021-2022
students/K33402/Komarov_Georgy/LAB2/elevennote/src/api/urls.py
a63691317a72fb9b29ae537bc3d7766661458c22
from django.urls import path, include from rest_framework_jwt.views import obtain_jwt_token from rest_framework.routers import DefaultRouter from .views import NoteViewSet app_name = 'api' router = DefaultRouter(trailing_slash=False) router.register('notes', NoteViewSet) urlpatterns = [ path('jwt-auth/', obtain...
[((201, 236), 'rest_framework.routers.DefaultRouter', 'DefaultRouter', ([], {'trailing_slash': '(False)'}), '(trailing_slash=False)\n', (214, 236), False, 'from rest_framework.routers import DefaultRouter\n'), ((296, 331), 'django.urls.path', 'path', (['"""jwt-auth/"""', 'obtain_jwt_token'], {}), "('jwt-auth/', obtain_...
CandleStein/VAlg
PathPlanning/run.py
43aecdd351954d316f132793cf069b70bf2e5cc2
from planning_framework import path import cv2 as cv import numpy as np import argparse import matplotlib.pyplot as plt parser = argparse.ArgumentParser(description="Path Planning Visualisation") parser.add_argument( "-n", "--n_heuristic", default=2, help="Heuristic for A* Algorithm (default = 2). 0 f...
[((130, 196), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Path Planning Visualisation"""'}), "(description='Path Planning Visualisation')\n", (153, 196), False, 'import argparse\n'), ((1313, 1346), 'numpy.zeros', 'np.zeros', (['(512, 512, 3)', 'np.uint8'], {}), '((512, 512, 3), np.uin...
object-oriented-human/competitive
Codeforces/problems/0136/A/136A.py
9e761020e887d8980a39a64eeaeaa39af0ecd777
n = int(input()) line = list(map(int, input().split())) l = {} res = "" for i, j in enumerate(line): l[j] = i+1 for k in range(n): res += str(l[k+1]) + " " print(res.rstrip())
[]
YiLisa/DSCI560-hw2
generatey.py
9cf4a40a6e4755ea1b0b68248e553fb4b6b7fdf4
import pandas as pd def main(): input = pd.read_csv('random_x.csv', header=None) x=input[0].tolist() y = [] for n in x: y.append(3*int(n)+6) df = pd.DataFrame(y) df.to_csv('output_y.csv', index=False, header=False) if __name__ == '__main__': main() print('generating y = 3x+6.....
[((46, 86), 'pandas.read_csv', 'pd.read_csv', (['"""random_x.csv"""'], {'header': 'None'}), "('random_x.csv', header=None)\n", (57, 86), True, 'import pandas as pd\n'), ((176, 191), 'pandas.DataFrame', 'pd.DataFrame', (['y'], {}), '(y)\n', (188, 191), True, 'import pandas as pd\n')]
burn874/mtg
setup.py
cef47f6ec0ca110bdcb885ec09d6f5aca517c3b2
import re from pkg_resources import parse_requirements import pathlib from setuptools import find_packages, setup README_FILE = 'README.md' REQUIREMENTS_FILE = 'requirements.txt' VERSION_FILE = 'mtg/_version.py' VERSION_REGEXP = r'^__version__ = \'(\d+\.\d+\.\d+)\'' r = re.search(VERSION_REGEXP, open(VERSION_FILE).r...
[((944, 959), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (957, 959), False, 'from setuptools import find_packages, setup\n')]
RF-Tar-Railt/Avilla
avilla/core/resource/interface.py
0b6eff0e253d4c04a5c82f4f252b6a11b7d81e04
from __future__ import annotations from dataclasses import dataclass from avilla.core.platform import Base from avilla.core.resource import Resource, ResourceProvider @dataclass class ResourceMatchPrefix: resource_type: type[Resource] keypath: str | None = None platform: Base | None = None class Resou...
[]
atemysemicolon/scikit-image
viewer_examples/plugins/median_filter.py
a48cf5822f9539c6602b9327c18253aed14fa692
from skimage import data from skimage.filter.rank import median from skimage.morphology import disk from skimage.viewer import ImageViewer from skimage.viewer.widgets import Slider, OKCancelButtons, SaveButtons from skimage.viewer.plugins.base import Plugin def median_filter(image, radius): return median(image, s...
[((348, 360), 'skimage.data.coins', 'data.coins', ([], {}), '()\n', (358, 360), False, 'from skimage import data\n'), ((370, 388), 'skimage.viewer.ImageViewer', 'ImageViewer', (['image'], {}), '(image)\n', (381, 388), False, 'from skimage.viewer import ImageViewer\n'), ((399, 433), 'skimage.viewer.plugins.base.Plugin',...
scharlton2/modflow6
autotest/test_gwf_buy_lak01.py
83ac72ee3b6f580aaffef6352cf15c1697d3ce66
# Test the buoyancy package and the variable density flows between the lake # and the gwf model. This model has 4 layers and a lake incised within it. # The model is transient and has heads in the aquifer higher than the initial # stage in the lake. As the model runs, the lake and aquifer equalize and # should end up...
[((1693, 1772), 'flopy.mf6.MFSimulation', 'flopy.mf6.MFSimulation', ([], {'sim_name': 'name', 'version': '"""mf6"""', 'exe_name': '"""mf6"""', 'sim_ws': 'ws'}), "(sim_name=name, version='mf6', exe_name='mf6', sim_ws=ws)\n", (1715, 1772), False, 'import flopy\n'), ((1824, 1900), 'flopy.mf6.ModflowTdis', 'flopy.mf6.Modfl...
hemiaoio/pylearning
lesson-08/roll_dice_v1.0.py
4b3885ed7177db4e6e03da80dd9ed69719c8d866
""" 功能:模拟掷骰子 版本:1.0 """ import random def roll_dice(): roll = random.randint(1, 6) return roll def main(): total_times = 100000 result_list = [0] * 6 for i in range(total_times): roll = roll_dice() result_list[roll-1] += 1 for i, x in enumerate(result_list): ...
[((77, 97), 'random.randint', 'random.randint', (['(1)', '(6)'], {}), '(1, 6)\n', (91, 97), False, 'import random\n')]
gxercavins/gcp-snippets
composer/dataflow-python3/main.py
a90e4e9c922370face876aa7c56db610896e1a6f
import argparse import logging import apache_beam as beam from apache_beam.options.pipeline_options import PipelineOptions from apache_beam.options.pipeline_options import SetupOptions def run(argv=None, save_main_session=True): """Dummy pipeline to test Python3 operator.""" parser = argparse.ArgumentParser() ...
[((292, 317), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (315, 317), False, 'import argparse\n'), ((400, 430), 'apache_beam.options.pipeline_options.PipelineOptions', 'PipelineOptions', (['pipeline_args'], {}), '(pipeline_args)\n', (415, 430), False, 'from apache_beam.options.pipeline_optio...
kangour/dingtalk-python
dingtalk/message/conversation.py
b37b9dac3ca3ff9d727308fb120a8fd05e11eaa5
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2017/11/30 下午3:02 # @Author : Matrix # @Github : https://github.com/blackmatrix7/ # @Blog : http://www.cnblogs.com/blackmatrix/ # @File : messages.py # @Software: PyCharm import json from ..foundation import * from json import JSONDecodeError __author__ = 'blackm...
[((573, 595), 'json.dumps', 'json.dumps', (['msgcontent'], {}), '(msgcontent)\n', (583, 595), False, 'import json\n')]
griviala/garpix_page
backend/garpix_page/setup.py
55f1d9bc6d1de29d18e15369bebcbef18811b5a4
from setuptools import setup, find_packages from os import path here = path.join(path.abspath(path.dirname(__file__)), 'garpix_page') with open(path.join(here, 'README.rst'), encoding='utf-8') as f: long_description = f.read() setup( name='garpix_page', version='2.23.0', description='', long_desc...
[((95, 117), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (107, 117), False, 'from os import path\n'), ((146, 175), 'os.path.join', 'path.join', (['here', '"""README.rst"""'], {}), "(here, 'README.rst')\n", (155, 175), False, 'from os import path\n'), ((491, 546), 'setuptools.find_packages', '...
C6SUMMER/allinclusive-kodi-pi
.kodi/addons/plugin.video.p2p-streams/resources/core/livestreams.py
8baf247c79526849c640c6e56ca57a708a65bd11
# -*- coding: utf-8 -*- """ p2p-streams (c) 2014 enen92 fightnight This file contains the livestream addon engine. It is mostly based on divingmule work on livestreams addon! Functions: xml_lists_menu() -> main menu for the xml list category addlista() -> add a new list. It'll ask for local or rem...
[((4891, 4911), 'xbmcvfs.delete', 'xbmcvfs.delete', (['name'], {}), '(name)\n', (4905, 4911), False, 'import urllib, urllib2, re, xbmcplugin, xbmcgui, xbmc, xbmcaddon, HTMLParser, time, datetime, os, xbmcvfs, sys\n'), ((5033, 5073), 'xbmc.executebuiltin', 'xbmc.executebuiltin', (['"""Container.Refresh"""'], {}), "('Con...
luisgepeto/RainItPi
RainIt/rain_it/ric/Procedure.py
47cb7228e9c584c3c4489ebc78abf6de2096b770
from ric.RainItComposite import RainItComposite class Procedure(RainItComposite): def __init__(self): super().__init__() def get_pickle_form(self): return self
[]
FahimFBA/URI-Problem-Solve
1067.py
d718a95e5a873dffbce19d850998e8917ec87ebb
valor = int(input()) for i in range(valor+1): if(i%2 != 0): print(i)
[]
b-bold/ThreatExchange
api-reference-examples/python/te-tag-query/api-example-update.py
6f8d0dc803faccf576c9398569bb52d54a4f9a87
#!/usr/bin/env python # ================================================================ # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # ================================================================ import sys import json import TE TE.Net.setAppTokenFromEnvName("TX_ACCESS_TOKEN") postPar...
[((263, 311), 'TE.Net.setAppTokenFromEnvName', 'TE.Net.setAppTokenFromEnvName', (['"""TX_ACCESS_TOKEN"""'], {}), "('TX_ACCESS_TOKEN')\n", (292, 311), False, 'import TE\n'), ((537, 596), 'TE.Net.updateThreatDescriptor', 'TE.Net.updateThreatDescriptor', (['postParams', 'showURLs', 'dryRun'], {}), '(postParams, showURLs, ...
Bottom-Feeders/GrabNGO
loaner/web_app/backend/api/shelf_api_test.py
5a467362e423700a5a7276a7fa9a47040033cfcf
# Copyright 2018 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
[((3959, 4015), 'mock.patch', 'mock.patch', (['"""__main__.root_api.Service.check_xsrf_token"""'], {}), "('__main__.root_api.Service.check_xsrf_token')\n", (3969, 4015), False, 'import mock\n'), ((4019, 4066), 'mock.patch', 'mock.patch', (['"""__main__.shelf_model.Shelf.enroll"""'], {}), "('__main__.shelf_model.Shelf.e...
ArmandDS/ai_bert_resumes
app/views/main.py
743f37049bbca67bcbbaf21a2ffecf0d093351df
from flask import render_template, jsonify, Flask, redirect, url_for, request from app import app import random import os # import tensorflow as tf # import numpy as np # import sys # import spacy # nlp = spacy.load('en') # sys.path.insert(0, "/content/bert_experimental") # from bert_experimental.finetuning.text_pre...
[((1029, 1043), 'app.app.route', 'app.route', (['"""/"""'], {}), "('/')\n", (1038, 1043), False, 'from app import app\n'), ((1117, 1163), 'app.app.route', 'app.route', (['"""/predict"""'], {'methods': "['GET', 'POST']"}), "('/predict', methods=['GET', 'POST'])\n", (1126, 1163), False, 'from app import app\n'), ((1642, ...
jaluebbe/ahrs
ahrs/filters/complementary.py
4b4a33b1006e0d455a71ac8379a2697202361758
# -*- coding: utf-8 -*- """ Complementary Filter ==================== Attitude quaternion obtained with gyroscope and accelerometer-magnetometer measurements, via complementary filter. First, the current orientation is estimated at time :math:`t`, from a previous orientation at time :math:`t-1`, and a given ...
[((7766, 7792), 'numpy.zeros', 'np.zeros', (['(num_samples, 4)'], {}), '((num_samples, 4))\n', (7774, 7792), True, 'import numpy as np\n'), ((9157, 9278), 'numpy.array', 'np.array', (['[[1.0, -w[0], -w[1], -w[2]], [w[0], 1.0, w[2], -w[1]], [w[1], -w[2], 1.0, w\n [0]], [w[2], w[1], -w[0], 1.0]]'], {}), '([[1.0, -w[0]...
yndu13/aliyun-openapi-python-sdk
aliyun-python-sdk-ehpc/aliyunsdkehpc/request/v20180412/EditJobTemplateRequest.py
12ace4fb39fe2fb0e3927a4b1b43ee4872da43f5
# 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...
[((953, 1019), 'aliyunsdkcore.request.RpcRequest.__init__', 'RpcRequest.__init__', (['self', '"""EHPC"""', '"""2018-04-12"""', '"""EditJobTemplate"""'], {}), "(self, 'EHPC', '2018-04-12', 'EditJobTemplate')\n", (972, 1019), False, 'from aliyunsdkcore.request import RpcRequest\n'), ((1115, 1145), 'aliyunsdkehpc.endpoint...
angry-tony/ceph-lcm-decapod
tests/common/models/test_execution.py
535944d3ee384c3a7c4af82f74041b0a7792433f
# -*- coding: utf-8 -*- # Copyright (c) 2016 Mirantis 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 ...
[((1708, 1766), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""state"""', 'execution.ExecutionState'], {}), "('state', execution.ExecutionState)\n", (1731, 1766), False, 'import pytest\n'), ((2148, 2206), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""state"""', 'execution.ExecutionState'], {}...
Fahreeve/TaskManager
board/models.py
7f0a16312b43867270eaade1fe153c07abc2c10e
from django.contrib.auth.models import User from django.core.validators import MaxValueValidator, MinValueValidator from django.db import models from django.utils.translation import ugettext_lazy as _ class Task(models.Model): CLOSE = 'cl' CANCEL = 'ca' LATER = 'la' UNDEFINED = 'un' CHOICES = ( ...
[((1342, 1416), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Task'], {'related_name': '"""comments"""', 'on_delete': 'models.CASCADE'}), "(Task, related_name='comments', on_delete=models.CASCADE)\n", (1359, 1416), False, 'from django.db import models\n'), ((1431, 1492), 'django.db.models.ForeignKey', 'models....
bicobus/Hexy
test/test_hex_line.py
e75d58e66546c278fb648af85e3f9dae53127826
import numpy as np import hexy as hx def test_get_hex_line(): expected = [ [-3, 3, 0], [-2, 2, 0], [-1, 2, -1], [0, 2, -2], [1, 1, -2], ] start = np.array([-3, 3, 0]) end = np.array([1, 1, -2]) print(hx.get_hex_line(start, end)) ...
[((227, 247), 'numpy.array', 'np.array', (['[-3, 3, 0]'], {}), '([-3, 3, 0])\n', (235, 247), True, 'import numpy as np\n'), ((258, 278), 'numpy.array', 'np.array', (['[1, 1, -2]'], {}), '([1, 1, -2])\n', (266, 278), True, 'import numpy as np\n'), ((289, 316), 'hexy.get_hex_line', 'hx.get_hex_line', (['start', 'end'], {...
PaNOSC-ViNYL/wofry
wofry/propagator/propagators2D/integral.py
779b5a738ee7738e959a58aafe01e7e49b03894a
# propagate_2D_integral: Simplification of the Kirchhoff-Fresnel integral. TODO: Very slow and give some problems import numpy from wofry.propagator.wavefront2D.generic_wavefront import GenericWavefront2D from wofry.propagator.propagator import Propagator2D # TODO: check resulting amplitude normalization (fft and ...
[((3500, 3544), 'numpy.zeros_like', 'numpy.zeros_like', (['amplitude'], {'dtype': '"""complex"""'}), "(amplitude, dtype='complex')\n", (3516, 3544), False, 'import numpy\n'), ((4371, 4462), 'wofry.propagator.wavefront2D.generic_wavefront.GenericWavefront2D.initialize_wavefront_from_arrays', 'GenericWavefront2D.initiali...
andor2718/LeetCode
Problems/Study Plans/Dynamic Programming/Dynamic Programming I/07_delete_and_earn.py
59874f49085818e6da751f1cc26867b31079d35d
# https://leetcode.com/problems/delete-and-earn/ class Solution: def deleteAndEarn(self, nums: list[int]) -> int: num_profits = dict() for num in nums: num_profits[num] = num_profits.get(num, 0) + num sorted_nums = sorted(num_profits.keys()) second_last_profit = 0 ...
[]
GabrielSanchesRosa/Python
Desafio051.py
3a129e27e076b2a91af03d68ede50b9c45c50217
# Desenvolva um programa que leia o primeiro termo e a razão de uma PA. No final mostre, os 10 primeiros termos dessa prograssão. primeiro = int(input("Primeiro Termo: ")) razao = int(input("Razão: ")) decimo = primeiro + (10 - 1) * razao for c in range(primeiro, decimo + razao, razao): print(f"{c}", end=" -> ") pr...
[]
tiddlyweb/tiddlyweb
tiddlyweb/filters/limit.py
376bcad280e24d2de4d74883dc4d8369abcb2c28
""" A :py:mod:`filter <tiddlyweb.filters>` type to limit a group of entities using a syntax similar to SQL Limit:: limit=<index>,<count> limit=<count> """ import itertools def limit_parse(count='0'): """ Parse the argument of a ``limit`` :py:mod:`filter <tiddlyweb.filters>` for a count and index...
[((835, 883), 'itertools.islice', 'itertools.islice', (['entities', 'index', '(index + count)'], {}), '(entities, index, index + count)\n', (851, 883), False, 'import itertools\n')]
sonibla/pytorch_keras_converter
pytorch_keras_converter/API.py
21925b67b6eb3cbbfa8eb6d33f682d57dafd357d
""" Simple API to convert models between PyTorch and Keras (Conversions from Keras to PyTorch aren't implemented) """ from . import utility from . import tests from . import io_utils as utils import tensorflow def convert(model, input_shape, weights=True, quiet=True, i...
[]
kjwill/bleak
examples/enable_notifications.py
7e0fdae6c0f6a78713e5984c2840666e0c38c3f3
# -*- coding: utf-8 -*- """ Notifications ------------- Example showing how to add notifications to a characteristic and handle the responses. Updated on 2019-07-03 by hbldh <henrik.blidh@gmail.com> """ import sys import logging import asyncio import platform from bleak import BleakClient from bleak import _logger...
[((1634, 1658), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (1656, 1658), False, 'import asyncio\n'), ((592, 609), 'platform.system', 'platform.system', ([], {}), '()\n', (607, 609), False, 'import platform\n'), ((1067, 1095), 'logging.getLogger', 'logging.getLogger', (['"""asyncio"""'], {}), ...
miraculixx/pyrules
pyrules/storages/base.py
b10d1d5e74052fa1db93cc9b459ac9057a9eb502
class BaseStorage(object): def get_rule(self, name): raise NotImplementedError() def get_ruleset(self, name): raise NotImplementedError()
[]
raminjafary/ethical-hacking
src/15 listener_and_backdoor/listener_2.py
e76f74f4f23e1d8cb7f433d19871dcf966507dfc
#!/usr/bin/python import socket class Listener: def __init__(self,ip,port): listener = socket.socket(socket.AF_INET,socket.SOCK_STREAM) listener.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1) #options to reuse sockets #listener.bind(("localhost",1234)) listener.bind((ip,port)) listener.listen(0) ...
[]
ray-hrst/temi-tools
dialogflow/history2xls.py
8efb1e1af93a41bd98fe0ee8c1fd6fb44e788341
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Convert Dialogflow history to spreadsheet User must manually copy the history from the browser and save this in a text file. This reads the textfile, parses the data, and saves it to a spreadsheet. Example training sample: USER サワディカ Nov 4, 11:19 PM AGENT No matc...
[((542, 645), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__', 'formatter_class': 'argparse.RawDescriptionHelpFormatter'}), '(description=__doc__, formatter_class=argparse.\n RawDescriptionHelpFormatter)\n', (565, 645), False, 'import argparse\n'), ((802, 833), 'os.path.splitext'...
usathe71-u/Attendance-System-Face-Recognition
recognition/views.py
c73f660a6089e8ca9dd5c473efcf2bc78f13a207
from django.shortcuts import render,redirect from .forms import usernameForm,DateForm,UsernameAndDateForm, DateForm_2 from django.contrib import messages from django.contrib.auth.models import User import cv2 import dlib import imutils from imutils import face_utils from imutils.video import VideoStream from imutils.fa...
[((1205, 1219), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (1212, 1219), True, 'import matplotlib as mpl\n'), ((1771, 1803), 'dlib.get_frontal_face_detector', 'dlib.get_frontal_face_detector', ([], {}), '()\n', (1801, 1803), False, 'import dlib\n'), ((1817, 1905), 'dlib.shape_predictor', 'dlib.shape...
GillesArcas/Advent_of_Code
2018/05.py
1f57eb1686875df2684b0d56916b1d20724e9fb9
import re import string DATA = '05.txt' def react(polymer): pairs = '|'.join([a + b + '|' + b + a for a, b in zip(string.ascii_lowercase, string.ascii_uppercase)]) length = len(polymer) while 1: polymer = re.sub(pairs, '', polymer) if len(polymer) == length: retu...
[((240, 266), 're.sub', 're.sub', (['pairs', '""""""', 'polymer'], {}), "(pairs, '', polymer)\n", (246, 266), False, 'import re\n'), ((672, 706), 're.sub', 're.sub', (['c', '""""""', 'polymer'], {'flags': 're.I'}), "(c, '', polymer, flags=re.I)\n", (678, 706), False, 'import re\n')]
felix-lang/fbuild
lib/fbuild/builders/__init__.py
9595fbfd6d3ceece31fda2f96c35d4a241f0129b
import abc import contextlib import os import sys from functools import partial from itertools import chain import fbuild import fbuild.db import fbuild.path import fbuild.temp from . import platform # ------------------------------------------------------------------------------ class MissingProgram(fbuild.ConfigFa...
[((1663, 1685), 'fbuild.path.Path', 'fbuild.path.Path', (['name'], {}), '(name)\n', (1679, 1685), False, 'import fbuild\n'), ((5958, 6001), 'fbuild.temp.tempfile', 'fbuild.temp.tempfile', (['code', 'self.src_suffix'], {}), '(code, self.src_suffix)\n', (5978, 6001), False, 'import fbuild\n'), ((1899, 1921), 'fbuild.path...
i3uex/CompareML
WebServer.py
3d53d58117507db11ad08ca0b1c883ec0997840e
import json import cherrypy import engine class WebServer(object): @cherrypy.expose def index(self): return open('public/index.html', encoding='utf-8') @cherrypy.expose class GetOptionsService(object): @cherrypy.tools.accept(media='text/plain') def GET(self): return json.dumps({ ...
[((1500, 1525), 'cherrypy.tools.json_out', 'cherrypy.tools.json_out', ([], {}), '()\n', (1523, 1525), False, 'import cherrypy\n'), ((230, 271), 'cherrypy.tools.accept', 'cherrypy.tools.accept', ([], {'media': '"""text/plain"""'}), "(media='text/plain')\n", (251, 271), False, 'import cherrypy\n'), ((553, 594), 'cherrypy...
DavideEva/2ppy
tuprolog/solve/exception/error/existence/__init__.py
55609415102f8116165a42c8e33e029c4906e160
from typing import Union from tuprolog import logger # noinspection PyUnresolvedReferences import jpype.imports # noinspection PyUnresolvedReferences import it.unibo.tuprolog.solve.exception.error as errors from tuprolog.core import Term, Atom from tuprolog.solve import ExecutionContext, Signature ExistenceError = err...
[((1800, 1906), 'tuprolog.logger.debug', 'logger.debug', (['"""Loaded JVM classes from it.unibo.tuprolog.solve.exception.error.ExistenceError.*"""'], {}), "(\n 'Loaded JVM classes from it.unibo.tuprolog.solve.exception.error.ExistenceError.*'\n )\n", (1812, 1906), False, 'from tuprolog import logger\n')]
RealA10N/cptk
cptk/core/fetcher.py
e500d948e91bb70661adc3c2539b149704c734a1
from __future__ import annotations from typing import TYPE_CHECKING import pkg_resources from bs4 import BeautifulSoup from requests import session from cptk.scrape import PageInfo from cptk.scrape import Website from cptk.utils import cptkException if TYPE_CHECKING: from cptk.scrape import Problem class Inva...
[((1020, 1029), 'requests.session', 'session', ([], {}), '()\n', (1027, 1029), False, 'from requests import session\n'), ((2351, 2385), 'bs4.BeautifulSoup', 'BeautifulSoup', (['res.content', '"""lxml"""'], {}), "(res.content, 'lxml')\n", (2364, 2385), False, 'from bs4 import BeautifulSoup\n'), ((2401, 2420), 'cptk.scra...
Hinson-A/guyueclass
machine_learning/deep_reinforcement_learning_grasping/drlgrasp/drlgrasp/pybullet_envs/kuka_reach_with_visual.py
e59129526729542dccefa6c7232378a00dc0175a
import pybullet as p import pybullet_data import gym from gym import spaces from gym.utils import seeding import numpy as np from math import sqrt import random import time import math import cv2 import torch import os def random_crop(imgs, out): """ args: imgs: shape (B,C,H,W) ...
[((431, 464), 'numpy.random.randint', 'np.random.randint', (['(0)', 'crop_max', 'n'], {}), '(0, crop_max, n)\n', (448, 464), True, 'import numpy as np\n'), ((475, 508), 'numpy.random.randint', 'np.random.randint', (['(0)', 'crop_max', 'n'], {}), '(0, crop_max, n)\n', (492, 508), True, 'import numpy as np\n'), ((524, 56...
jrmarino/ravensource
bucket_4C/python-Pillow/patches/patch-setup.py
91d599fd1f2af55270258d15e72c62774f36033e
--- setup.py.orig 2019-07-02 19:13:39 UTC +++ setup.py @@ -465,9 +465,7 @@ class pil_build_ext(build_ext): _add_directory(include_dirs, "/usr/X11/include") elif ( - sys.platform.startswith("linux") - or sys.platform.startswith("gnu") - or sys.platform.startsw...
[]
GeekHee/mindspore
tests/ut/cpp/python_input/gtest_input/pre_activate/ir_fusion_test.py
896b8e5165dd0a900ed5a39e0fb23525524bf8b0
# Copyright 2019 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...
[((899, 933), 'mindspore.ops.Primitive', 'Primitive', (['Constants.kTupleGetItem'], {}), '(Constants.kTupleGetItem)\n', (908, 933), False, 'from mindspore.ops import Primitive\n'), ((940, 947), 'mindspore.ops.operations.Add', 'P.Add', ([], {}), '()\n', (945, 947), True, 'from mindspore.ops import operations as P\n'), (...
TrainerDex/DiscordBot
tdx/abc.py
7e7bb20c5ac76bed236a7458c31017b8ddd8b8be
from abc import ABC from typing import Dict from redbot.core import Config from redbot.core.bot import Red from trainerdex.client import Client class MixinMeta(ABC): """ Base class for well behaved type hint detection with composite class. Basically, to keep developers sane when not all attributes are d...
[]
PolinaRomanchenko/Victorious_Secret_DSCI_532
app.py
e83bc19169a1736618ac55f2ade40741583089fd
import dash import dash_core_components as dcc import dash_html_components as html import dash_bootstrap_components as dbc import pandas as pd import numpy as np import altair as alt import vega_datasets alt.data_transformers.enable('default') alt.data_transformers.disable_max_rows() app = dash.Dash(__name__, assets_f...
[((205, 244), 'altair.data_transformers.enable', 'alt.data_transformers.enable', (['"""default"""'], {}), "('default')\n", (233, 244), True, 'import altair as alt\n'), ((245, 285), 'altair.data_transformers.disable_max_rows', 'alt.data_transformers.disable_max_rows', ([], {}), '()\n', (283, 285), True, 'import altair a...
johnson880319/Software
catkin_ws/src:/opt/ros/kinetic/lib/python2.7/dist-packages:/home/bala/duckietown/catkin_ws/src:/home/bala/duckietown/catkin_ws/src/lib/python2.7/site-packages/geometry/subspaces/__init__.py
045894227f359e0a3a3ec5b7a53f8d1ebc06acdd
# coding=utf-8 from .subspaces import *
[]
chika626/chainer_rep
detection/contor.py
a1d4fd32a8cfcab753269455d08c1918f273388d
import json import math from PIL import Image,ImageDraw import pandas as pd import glob import argparse import copy import numpy as np import matplotlib.pyplot as plt import pickle import cv2 from PIL import ImageEnhance import chainer from chainer.datasets import ConcatenatedDataset from chainer.data...
[((1245, 1260), 'numpy.asarray', 'np.asarray', (['img'], {}), '(img)\n', (1255, 1260), True, 'import numpy as np\n'), ((1294, 1318), 'PIL.Image.new', 'Image.new', (['"""RGB"""', '(H, W)'], {}), "('RGB', (H, W))\n", (1303, 1318), False, 'from PIL import Image, ImageDraw\n'), ((2262, 2286), 'glob.glob', 'glob.glob', (['"...
hjl-yul154/autodeeplab
train.py
1bd8399ac830fcafd506a4207b75e05682d1e260
import os import pdb import warnings import numpy as np import torch import torch.nn as nn import torch.utils.data import torch.backends.cudnn import torch.optim as optim import dataloaders from utils.utils import AverageMeter from utils.loss import build_criterion from utils.metrics import Evaluator from utils.step_...
[((518, 551), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (541, 551), False, 'import warnings\n'), ((563, 588), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (586, 588), False, 'import torch\n'), ((642, 675), 'config_utils.re_train_autodeeplab....
xxaxdxcxx/miscellaneous-code
test.py
cdb88783f39e1b9a89fdb12f7cddfe62619e4357
class Solution: # dictionary keys are tuples, storing results # structure of the tuple: # (level, prev_sum, val_to_include) # value is number of successful tuples def fourSumCount(self, A, B, C, D, prev_sum=0, level=0, sums={}): """ :type A: List[int] :type B: List[int] ...
[]
johngtrs/krux
src/boot.py
7b6c6d410e29c16ab5d3c05a5aafab618f13a86f
# The MIT License (MIT) # Copyright (c) 2021 Tom J. Sun # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, ...
[((1246, 1254), 'pmu.axp192', 'axp192', ([], {}), '()\n', (1252, 1254), False, 'from pmu import axp192\n'), ((1391, 1400), 'context.Context', 'Context', ([], {}), '()\n', (1398, 1400), False, 'from context import Context\n'), ((1659, 1674), 'machine.reset', 'machine.reset', ([], {}), '()\n', (1672, 1674), False, 'impor...
suhaibroomy/django-smartfields
smartfields/processors/video.py
e9331dc74f72d0254608526f8816aa4bb8f1fca4
import re import six from smartfields.processors.base import ExternalFileProcessor from smartfields.utils import ProcessingError __all__ = [ 'FFMPEGProcessor' ] class FFMPEGProcessor(ExternalFileProcessor): duration_re = re.compile(r'Duration: (?P<hours>\d+):(?P<minutes>\d+):(?P<seconds>\d+)') progress_r...
[((232, 307), 're.compile', 're.compile', (['"""Duration: (?P<hours>\\\\d+):(?P<minutes>\\\\d+):(?P<seconds>\\\\d+)"""'], {}), "('Duration: (?P<hours>\\\\d+):(?P<minutes>\\\\d+):(?P<seconds>\\\\d+)')\n", (242, 307), False, 'import re\n'), ((324, 394), 're.compile', 're.compile', (['"""time=(?P<hours>\\\\d+):(?P<minutes...
ramtingh/vmtk
tests/test_vmtkScripts/test_vmtksurfaceconnectivity.py
4d6f58ce65d73628353ba2b110cbc29a2e7aa7b3
## Program: VMTK ## Language: Python ## Date: January 12, 2018 ## Version: 1.4 ## Copyright (c) Richard Izzo, Luca Antiga, All rights reserved. ## See LICENSE file for details. ## This software is distributed WITHOUT ANY WARRANTY; without even ## the implied warranty of MERCHANTABILITY or FITNES...
[((600, 630), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (614, 630), False, 'import pytest\n'), ((742, 775), 'vmtk.vmtksurfacereader.vmtkSurfaceReader', 'surfacereader.vmtkSurfaceReader', ([], {}), '()\n', (773, 775), True, 'import vmtk.vmtksurfacereader as surfacereader\...
Kingpin-Apps/django-sssoon
sssoon/forms.py
2a44d0d19e70dcd3127f9425c0ed4ba52355a1d2
from django import forms from nocaptcha_recaptcha.fields import NoReCaptchaField class NewsletterForm(forms.Form): email = forms.EmailField(label='Email', required=True, widget=forms.TextInput(attrs={ 'id': 'newsletter-email', ...
[((635, 653), 'nocaptcha_recaptcha.fields.NoReCaptchaField', 'NoReCaptchaField', ([], {}), '()\n', (651, 653), False, 'from nocaptcha_recaptcha.fields import NoReCaptchaField\n'), ((212, 397), 'django.forms.TextInput', 'forms.TextInput', ([], {'attrs': "{'id': 'newsletter-email', 'type': 'email', 'title': 'Email', 'nam...
william01110111/simple_run_menu
simple_run_menu.py
804c6bb8d6c63c3a4d4c6d3377601bd44fb0eeea
#! /bin/python3 # simple run menu import os import stat def is_file_executable(path): executable = stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH if not os.path.isfile(path): return False st = os.stat(path) mode = st.st_mode if not mode & executable: return False return True def get_files_in_dir(directory): i...
[((196, 209), 'os.stat', 'os.stat', (['path'], {}), '(path)\n', (203, 209), False, 'import os\n'), ((509, 534), 'os.path.basename', 'os.path.basename', (['command'], {}), '(command)\n', (525, 534), False, 'import os\n'), ((153, 173), 'os.path.isfile', 'os.path.isfile', (['path'], {}), '(path)\n', (167, 173), False, 'im...
stevemats/mne-python
mne/io/cnt/tests/test_cnt.py
47051833f21bb372d60afc3adbf4305648ac7f69
# Author: Jaakko Leppakangas <jaeilepp@student.jyu.fi> # Joan Massich <mailsik@gmail.com> # # License: BSD-3-Clause import os.path as op import numpy as np from numpy.testing import assert_array_equal import pytest from mne import pick_types from mne.datasets import testing from mne.io.tests.test_raw import...
[((432, 465), 'mne.datasets.testing.data_path', 'testing.data_path', ([], {'download': '(False)'}), '(download=False)\n', (449, 465), False, 'from mne.datasets import testing\n'), ((474, 519), 'os.path.join', 'op.join', (['data_path', '"""CNT"""', '"""scan41_short.cnt"""'], {}), "(data_path, 'CNT', 'scan41_short.cnt')\...
Track-your-parliament/track-your-parliament-data
parliament_proposal_fetcher.py
1ab9d9fe5cf4921e4cc792d0e3db3263557daafd
import urllib.request, json import pandas as pd baseUrl = 'https://avoindata.eduskunta.fi/api/v1/tables/VaskiData' parameters = 'rows?columnName=Eduskuntatunnus&columnValue=LA%25&perPage=100' page = 0 df = '' while True: print(f'Fetching page number {page}') with urllib.request.urlopen(f'{baseUrl}/{parameters...
[((474, 503), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'columns'}), '(columns=columns)\n', (486, 503), True, 'import pandas as pd\n'), ((563, 614), 'pandas.DataFrame', 'pd.DataFrame', (['dataRows'], {'columns': "data['columnNames']"}), "(dataRows, columns=data['columnNames'])\n", (575, 614), True, 'import p...
emaldonadocruz/UTuning
examples/Catboost_regression-scorer_usage.py
b32207bcbeb80e4c07e098bcbe4d5ce8b3fee778
# -*- coding: utf-8 -*- """ Created on Mon Sep 20 16:15:37 2021 @author: em42363 """ # In[1]: Import functions ''' CatBoost is a high-performance open source library for gradient boosting on decision trees ''' from catboost import CatBoostRegressor from sklearn.model_selection import train_test_split import pandas a...
[((425, 487), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""C:\\\\Users\\\\eduar\\\\OneDrive\\\\PhD\\\\UTuning"""'], {}), "(0, 'C:\\\\Users\\\\eduar\\\\OneDrive\\\\PhD\\\\UTuning')\n", (440, 487), False, 'import sys\n'), ((484, 548), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""C:\\\\Users\\\\em42363\\\\OneD...
PotasnikM/translator-to-suJSON
sujson/_logger.py
abb2001c78d431bd2087754666bc896ba0543dfd
import logging from platform import system from tqdm import tqdm from multiprocessing import Lock loggers = {} # https://stackoverflow.com/questions/38543506/ class TqdmLoggingHandler(logging.Handler): def __init__(self, level=logging.NOTSET): super(TqdmLoggingHandler, self).__init__(level) def emit...
[((787, 838), 'logging.Formatter', 'logging.Formatter', ([], {'fmt': '"""%(levelname)s: %(message)s"""'}), "(fmt='%(levelname)s: %(message)s')\n", (804, 838), False, 'import logging\n'), ((1413, 1436), 'logging.getLogger', 'logging.getLogger', (['name'], {}), '(name)\n', (1430, 1436), False, 'import logging\n'), ((933,...
Gicehajunior/face-recognition-detection-OpenCv-Python
face-detect.py
6551285ce5b4532d8b6f3ad6b8e9a29564673ea9
import cv2 import sys import playsound face_cascade = cv2.CascadeClassifier('cascades/haarcascade_frontalface_default.xml') # capture video using cv2 video_capture = cv2.VideoCapture(0) while True: # capture frame by frame, i.e, one by one ret, frame = video_capture.read() gray = cv2.cvtColor(frame...
[((55, 124), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""cascades/haarcascade_frontalface_default.xml"""'], {}), "('cascades/haarcascade_frontalface_default.xml')\n", (76, 124), False, 'import cv2\n'), ((168, 187), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (184, 187), False, 'import cv...
ryanlovett/sis-cli
sis/enrollments.py
5efe5b9344b547c3f1365ef63a0ad33ec013fcca
# vim:set et sw=4 ts=4: import logging import sys import jmespath from . import sis, classes # logging logging.basicConfig(stream=sys.stdout, level=logging.WARNING) logger = logging.getLogger(__name__) # SIS endpoint enrollments_uri = "https://apis.berkeley.edu/sis/v2/enrollments" # apparently some courses have LA...
[((106, 167), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.WARNING'}), '(stream=sys.stdout, level=logging.WARNING)\n', (125, 167), False, 'import logging\n'), ((177, 204), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (194, 204), False, 'i...
Nishanth-Gobi/Da-Vinci-Code
app.py
b44a2d0c553e4f9cf9e2bb3283ebb5f6eaecea4a
from flask import Flask, render_template, request, redirect, url_for from os.path import join from stego import Steganography app = Flask(__name__) UPLOAD_FOLDER = 'static/files/' app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg'} @app.route("/") def home(): return render_te...
[((134, 149), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (139, 149), False, 'from flask import Flask, render_template, request, redirect, url_for\n'), ((311, 339), 'flask.render_template', 'render_template', (['"""home.html"""'], {}), "('home.html')\n", (326, 339), False, 'from flask import Flask, rend...
HaiDangDang/2020-flatland
imitation_learning/generate_demonstrations/gen_envs.py
abbf2f7f62fabf6da0937f80c2181f1c457ce24a
from flatland.envs.agent_utils import RailAgentStatus from flatland.envs.malfunction_generators import malfunction_from_params, MalfunctionParameters from flatland.envs.observations import GlobalObsForRailEnv from flatland.envs.rail_env import RailEnv from flatland.envs.rail_generators import sparse_rail_generator from...
[((620, 637), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (631, 637), False, 'import random\n'), ((1379, 1396), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (1390, 1396), False, 'import random\n'), ((1410, 1430), 'random.randint', 'random.randint', (['(0)', '(5)'], {}), '(0, 5)\n', (1424, 143...
Sruthi-Ganesh/postgres-django-queue
job-queue-portal/postgres_django_queue/djangoenv/lib/python3.8/site-packages/django_celery_results/migrations/0006_taskresult_date_created.py
4ea8412c073ff8ceb0efbac48afc29456ae11346
# -*- coding: utf-8 -*- # Generated by Django 2.2.4 on 2019-08-21 19:53 # this file is auto-generated so don't do flake8 on it # flake8: noqa from __future__ import absolute_import, unicode_literals from django.db import migrations, models import django.utils.timezone def copy_date_done_to_date_created(apps, schem...
[((1351, 1447), 'django.db.migrations.RunPython', 'migrations.RunPython', (['copy_date_done_to_date_created', 'reverse_copy_date_done_to_date_created'], {}), '(copy_date_done_to_date_created,\n reverse_copy_date_done_to_date_created)\n', (1371, 1447), False, 'from django.db import migrations, models\n'), ((522, 543)...
fabaff/remediar
remediar/modules/http/__init__.py
014d7733b00cd40a45881c2729c04df5584476e7
"""Support for HTTP or web server issues."""
[]
AlanMorningLight/PyTorch-BayesianCNN
Image Recognition/utils/BayesianModels/Bayesian3Conv3FC.py
5de7133f09dd10135bf605efbdd26c18f2a4df13
import torch.nn as nn from utils.BBBlayers import BBBConv2d, BBBLinearFactorial, FlattenLayer class BBB3Conv3FC(nn.Module): """ Simple Neural Network having 3 Convolution and 3 FC layers with Bayesian layers. """ def __init__(self, outputs, inputs): super(BBB3Conv3FC, self).__init__() ...
[((337, 382), 'utils.BBBlayers.BBBConv2d', 'BBBConv2d', (['inputs', '(32)', '(5)'], {'stride': '(1)', 'padding': '(2)'}), '(inputs, 32, 5, stride=1, padding=2)\n', (346, 382), False, 'from utils.BBBlayers import BBBConv2d, BBBLinearFactorial, FlattenLayer\n'), ((404, 417), 'torch.nn.Softplus', 'nn.Softplus', ([], {}), ...
nphilou/influence-release
custom_scripts/load_animals.py
bcf3603705b6ff172bcb62123aef0248afa77a05
import os from tensorflow.contrib.learn.python.learn.datasets import base import numpy as np import IPython from subprocess import call from keras.preprocessing import image from influence.dataset import DataSet from influence.inception_v3 import preprocess_input BASE_DIR = 'data' # TODO: change def fill(X, Y, id...
[((361, 419), 'keras.preprocessing.image.load_img', 'image.load_img', (['img_path'], {'target_size': '(img_side, img_side)'}), '(img_path, target_size=(img_side, img_side))\n', (375, 419), False, 'from keras.preprocessing import image\n'), ((428, 451), 'keras.preprocessing.image.img_to_array', 'image.img_to_array', (['...
carstenblank/qiskit-aws-braket-provider
src/qiskit_aws_braket_provider/awsbackend.py
539f0c75c2ccf1f6e5e981b92ea74f497fcba237
# Copyright 2020 Carsten Blank # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
[((1645, 1672), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1662, 1672), False, 'import logging\n'), ((8160, 8188), 'qiskit.qobj.QasmQobj.from_dict', 'QasmQobj.from_dict', (['qobj_raw'], {}), '(qobj_raw)\n', (8178, 8188), False, 'from qiskit.qobj import QasmQobj\n'), ((10425, 10448), ...
thirtywang/OpenPNM
test/unit/Algorithms/GenericLinearTransportTest.py
e55ee7ae69a8be3e2b0e6bf24c9ff92b6d24e16a
import OpenPNM import numpy as np import OpenPNM.Physics.models as pm class GenericLinearTransportTest: def setup_class(self): self.net = OpenPNM.Network.Cubic(shape=[5, 5, 5]) self.phase = OpenPNM.Phases.GenericPhase(network=self.net) Ps = self.net.Ps Ts = self.net.Ts self...
[((152, 190), 'OpenPNM.Network.Cubic', 'OpenPNM.Network.Cubic', ([], {'shape': '[5, 5, 5]'}), '(shape=[5, 5, 5])\n', (173, 190), False, 'import OpenPNM\n'), ((212, 257), 'OpenPNM.Phases.GenericPhase', 'OpenPNM.Phases.GenericPhase', ([], {'network': 'self.net'}), '(network=self.net)\n', (239, 257), False, 'import OpenPN...
spartantri/aws-security-automation
EC2 Auto Clean Room Forensics/Lambda-Functions/snapshotForRemediation.py
a3904931220111022d12e71a3d79e4a85fc82173
# MIT No Attribution # Permission is hereby granted, free of charge, to any person obtaining a copy of this # software and associated documentation files (the "Software"), to deal in the Software # without restriction, including without limitation the rights to use, copy, modify, # merge, publish, distribute, sublicen...
[((1016, 1035), 'boto3.client', 'boto3.client', (['"""ec2"""'], {}), "('ec2')\n", (1028, 1035), False, 'import boto3\n')]
VibhuJawa/gpu-bdb
gpu_bdb/queries/q26/gpu_bdb_query_26.py
13987b4ef8b92db3b9d2905dec7bd2fd81f42ae9
# # Copyright (c) 2019-2022, NVIDIA 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 ag...
[((1708, 1787), 'dask_cudf.from_cudf', 'dask_cudf.from_cudf', (["results_dict['cid_labels']"], {'npartitions': 'output.npartitions'}), "(results_dict['cid_labels'], npartitions=output.npartitions)\n", (1727, 1787), False, 'import dask_cudf\n'), ((2134, 2211), 'bdb_tools.utils.benchmark', 'benchmark', (['read_tables'], ...
alex/optimizer-model
tests/test_intbounds.py
0e40a0763082f5fe0bd596e8e77ebccbcd7f4a98
from optimizer.utils.intbounds import IntBounds class TestIntBounds(object): def test_make_gt(self): i0 = IntBounds() i1 = i0.make_gt(IntBounds(10, 10)) assert i1.lower == 11 def test_make_gt_already_bounded(self): i0 = IntBounds() i1 = i0.make_gt(IntBounds(10, 10))...
[((120, 131), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', ([], {}), '()\n', (129, 131), False, 'from optimizer.utils.intbounds import IntBounds\n'), ((265, 276), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', ([], {}), '()\n', (274, 276), False, 'from optimizer.utils.intbounds import IntBounds\n'), ((419, ...
minchuang/td-client-python
tdclient/test/database_model_test.py
6cf6dfbb60119f400274491d3e942d4f9fbcebd6
#!/usr/bin/env python from __future__ import print_function from __future__ import unicode_literals try: from unittest import mock except ImportError: import mock from tdclient import models from tdclient.test.test_helper import * def setup_function(function): unset_environ() def test_database(): c...
[((328, 344), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (342, 344), False, 'import mock\n'), ((360, 556), 'tdclient.models.Database', 'models.Database', (['client', '"""sample_datasets"""'], {'tables': "['nasdaq', 'www_access']", 'count': '(12345)', 'created_at': '"""created_at"""', 'updated_at': '"""update...
ballcap231/fireTS
setup.py
74cc89a14d67edabf31139d1552025d54791f2a9
from setuptools import setup dependencies = [ 'numpy', 'scipy', 'scikit-learn', ] setup( name='fireTS', version='0.0.7', description='A python package for multi-variate time series prediction', long_description=open('README.md').read(), long_description_content_type="text/markdown", ...
[]
heyihan/scodes
euler/py/project_019.py
342518b548a723916c9273d8ebc1b345a0467e76
# https://projecteuler.net/problem=19 def is_leap(year): if year%4 != 0: return False if year%100 == 0 and year%400 != 0: return False return True def year_days(year): if is_leap(year): return 366 return 365 def month_days(month, year): if month == 4 or month == 6 or m...
[]
wowsuchnamaste/address_book
address_book/address_book.py
4877d16d795c54b750e151fa93e69c080717ae72
"""A simple address book.""" from ._tools import generate_uuid class AddressBook: """ A simple address book. """ def __init__(self): self._entries = [] def add_entry(self, entry): """Add an entry to the address book.""" self._entries.append(entry) def get_entries(sel...
[]
zzhang87/ChestXray
inference.py
eaafe2f7f5e91bb30fbed02dec1f77ff314434b5
import keras import numpy as np import pandas as pd import cv2 import os import json import pdb import argparse import math import copy from vis.visualization import visualize_cam, overlay, visualize_activation from vis.utils.utils import apply_modifications from shutil import rmtree import matplotlib.cm as cm from ma...
[((1233, 1260), 'numpy.dot', 'np.dot', (['activation', 'weights'], {}), '(activation, weights)\n', (1239, 1260), True, 'import numpy as np\n'), ((1294, 1319), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1317, 1319), False, 'import argparse\n'), ((1708, 1739), 'os.path.dirname', 'os.path.dir...
MistSun-Chen/py_verifier
test/DQueueTest.py
7e9161d1fdbb611fe4be5eeb2f89a6286fa7b555
from libTask import Queue from common import configParams from common import common def main(): cp = configParams.ConfigParams("config.json") detectGeneralQueue = Queue.DQueue(cp, len(cp.detect_general_ids), cp.modelPath, common.GENERALDETECT_METHOD_ID, cp.GPUDevices, cp.detect_g...
[((105, 145), 'common.configParams.ConfigParams', 'configParams.ConfigParams', (['"""config.json"""'], {}), "('config.json')\n", (130, 145), False, 'from common import configParams\n')]
volgachen/Chinese-Tokenization
config.py
467e08da6fe271b6e33258d5aa6682c0405a3f32
class Config: ngram = 2 train_set = "data/rmrb.txt" modified_train_set = "data/rmrb_modified.txt" test_set = "" model_file = "" param_file = "" word_max_len = 10 proposals_keep_ratio = 1.0 use_re = 1 subseq_num = 15
[]
python-itb/knn-from-scratch
src/Knn-Tensor.py
dbc6fb53cffb245a76d35b9ff85ac8cb21877ca8
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Feb 13 18:52:28 2018 @author: amajidsinar """ from sklearn import datasets import matplotlib.pyplot as plt import numpy as np plt.style.use('seaborn-white') iris = datasets.load_iris() dataset = iris.data # only take 0th and 1th column for X data_kno...
[((194, 224), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn-white"""'], {}), "('seaborn-white')\n", (207, 224), True, 'import matplotlib.pyplot as plt\n'), ((233, 253), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {}), '()\n', (251, 253), False, 'from sklearn import datasets\n'), ((576, 598)...
volpepe/detectron2-ResNeSt
de_test_tron2.py
1481d50880baa615b873b7a18156c06a5606a85c
import torch, torchvision import detectron2 from detectron2.utils.logger import setup_logger setup_logger() # import some common libraries import numpy as np import os, json, cv2, random # import some common detectron2 utilities from detectron2 import model_zoo from detectron2.engine import DefaultPredic...
[((98, 112), 'detectron2.utils.logger.setup_logger', 'setup_logger', ([], {}), '()\n', (110, 112), False, 'from detectron2.utils.logger import setup_logger\n'), ((531, 556), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (554, 556), False, 'import argparse, time\n'), ((1217, 1232), 'cv2.imread'...
Pankrat/pika
pika/data.py
9f62cbe032e9b4fa0fe1842587ce0702c3926a3d
"""AMQP Table Encoding/Decoding""" import struct import decimal import calendar from datetime import datetime from pika import exceptions from pika.compat import unicode_type, PY2, long, as_bytes def encode_short_string(pieces, value): """Encode a string value as short string and append it to pieces list ret...
[((524, 539), 'pika.compat.as_bytes', 'as_bytes', (['value'], {}), '(value)\n', (532, 539), False, 'from pika.compat import unicode_type, PY2, long, as_bytes\n'), ((2684, 2712), 'struct.pack', 'struct.pack', (['""">I"""', 'tablesize'], {}), "('>I', tablesize)\n", (2695, 2712), False, 'import struct\n'), ((1133, 1177), ...
Agi-dev/pylaas_core
tests/fixtures/data_sets/service/dummy/dummy_configurable.py
c44866b5e57eb6f05f5b2b8d731f22d62a8c01c2
from pylaas_core.abstract.abstract_service import AbstractService import time from pylaas_core.interface.technical.container_configurable_aware_interface import ContainerConfigurableAwareInterface class DummyConfigurable(AbstractService, ContainerConfigurableAwareInterface): def __init__(self) -> None: ...
[((375, 386), 'time.time', 'time.time', ([], {}), '()\n', (384, 386), False, 'import time\n')]
IVAN-URBACZKA/django-blog
blogtech/src/blog/views.py
7ef6050c0de2938791843c3ec93e6e6a1e683baa
from django.urls import reverse_lazy, reverse from django.utils.decorators import method_decorator from django.views.generic import ListView, DetailView, CreateView, DeleteView, UpdateView from .models import BlogPost from django.contrib.auth.decorators import login_required class BlogPostHomeView(ListView): mode...
[((464, 513), 'django.utils.decorators.method_decorator', 'method_decorator', (['login_required'], {'name': '"""dispatch"""'}), "(login_required, name='dispatch')\n", (480, 513), False, 'from django.utils.decorators import method_decorator\n'), ((708, 757), 'django.utils.decorators.method_decorator', 'method_decorator'...
Juxi/apb-baseline
apc_deep_vision/python/generate_data.py
fd47a5fd78cdfd75c68601a40ca4726d7d20c9ce
#! /usr/bin/env python # ******************************************************************** # Software License Agreement (BSD License) # # Copyright (c) 2015, University of Colorado, Boulder # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted...
[]
shirshanka/fact-ory
stats.py
9e6bae63ca7f8f534b811058efb8942004d6a37b
import numpy as np; import sys import matplotlib.pyplot as plt; from matplotlib import cm; from termcolor import colored; class Stats(): def __init__(self, param1_range, param2_range): self._total_times = 0; self._total_time = 0.0; self._wrong_answers = []; self._time_dict = {}; self._param1_rang...
[]
zjuchenyuan/EasyLogin
examples/peptidecutter/advanced.py
acc67187d902f20ec64d2d6b9eeb953e2a0ac77d
from EasyLogin import EasyLogin from pprint import pprint def peptidecutter(oneprotein): a = EasyLogin(proxy="socks5://127.0.0.1:1080") #speed up by using proxy a.post("http://web.expasy.org/cgi-bin/peptide_cutter/peptidecutter.pl", "protein={}&enzyme_number=all_enzymes&special_enzyme=Chym&min_pr...
[((102, 144), 'EasyLogin.EasyLogin', 'EasyLogin', ([], {'proxy': '"""socks5://127.0.0.1:1080"""'}), "(proxy='socks5://127.0.0.1:1080')\n", (111, 144), False, 'from EasyLogin import EasyLogin\n')]
pointerish/pgn2fixture
pgn2fixture/tests/test_utils.py
02039680acc37cbca22fb332738e34cd113831a4
import unittest from .. import utils class TestUtils(unittest.TestCase): def setUp(self) -> None: self.pgn_string = ''' [Event "US Championship 1963/64"] [Site "New York, NY USA"] [Date "1964.01.01"] [EventDate "1963.??.??"] [Round "11"][Result "0-1"] [Whit...
[]
gouthampacha/manila
manila/tests/share/test_snapshot_access.py
4b7ba9b99d272663f519b495668715fbf979ffbc
# Copyright (c) 2016 Hitachi Data Systems, Inc. # 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 # # U...
[((1631, 1723), 'ddt.data', 'ddt.data', (['constants.ACCESS_STATE_QUEUED_TO_APPLY', 'constants.ACCESS_STATE_QUEUED_TO_DENY'], {}), '(constants.ACCESS_STATE_QUEUED_TO_APPLY, constants.\n ACCESS_STATE_QUEUED_TO_DENY)\n', (1639, 1723), False, 'import ddt\n'), ((1204, 1264), 'manila.share.snapshot_access.ShareSnapshotIn...
sasano8/pyright
packages/pyright-internal/src/tests/samples/unnecessaryCast1.py
e804f324ee5dbd25fd37a258791b3fd944addecd
# This sample tests the type checker's reportUnnecessaryCast feature. from typing import cast, Union def foo(a: int): # This should generate an error if # reportUnnecessaryCast is enabled. b = cast(int, a) c: Union[int, str] = "hello" d = cast(int, c)
[((256, 268), 'typing.cast', 'cast', (['int', 'c'], {}), '(int, c)\n', (260, 268), False, 'from typing import cast, Union\n'), ((208, 220), 'typing.cast', 'cast', (['int', 'a'], {}), '(int, a)\n', (212, 220), False, 'from typing import cast, Union\n')]
ArikBartzadok/beecrowd-challenges
Python/1238.py
ddb0453d1caa75c87c4b3ed6a40309ab99da77f2
def execucoes(): return int(input()) def entradas(): return input().split(' ') def imprimir(v): print(v) def tamanho_a(a): return len(a) def tamanho_b(b): return len(b) def diferenca_tamanhos(a, b): return (len(a) <= len(b)) def analisar(e, i, s): a, b = e if(diferenca_tamanhos(a, ...
[]
worldwise001/amundsenmetadatalibrary
metadata_service/api/popular_tables.py
9914c8b51d38b8bd76d3249eb4f7fcce3e198d09
from http import HTTPStatus from typing import Iterable, Union, Mapping from flask import request from flask_restful import Resource, fields, marshal from metadata_service.proxy import get_proxy_client popular_table_fields = { 'database': fields.String, 'cluster': fields.String, 'schema': fields.String, ...
[((338, 369), 'flask_restful.fields.String', 'fields.String', ([], {'attribute': '"""name"""'}), "(attribute='name')\n", (351, 369), False, 'from flask_restful import Resource, fields, marshal\n'), ((396, 434), 'flask_restful.fields.String', 'fields.String', ([], {'attribute': '"""description"""'}), "(attribute='descri...
SaijC/manhwaDownloader
tests/test1.py
f6e97cfe25355598e42633a3796d84b666d5302f
import requests import logging import cfscrape import os from manhwaDownloader.constants import CONSTANTS as CONST logging.basicConfig(level=logging.DEBUG) folderPath = os.path.join(CONST.OUTPUTPATH, 'serious-taste-of-forbbiden-fruit') logging.info(len([file for file in os.walk(folderPath)])) walkList = [file for fi...
[((116, 156), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (135, 156), False, 'import logging\n'), ((171, 237), 'os.path.join', 'os.path.join', (['CONST.OUTPUTPATH', '"""serious-taste-of-forbbiden-fruit"""'], {}), "(CONST.OUTPUTPATH, 'serious-taste-of-forbbi...
rahasayantan/Work-For-Reference
others/Keras_custom_error.py
e052da538df84034ec5a0fe3b19c4287de307286
# define custom R2 metrics for Keras backend from keras import backend as K def r2_keras(y_true, y_pred): SS_res = K.sum(K.square( y_true - y_pred )) SS_tot = K.sum(K.square( y_true - K.mean(y_true) ) ) return ( 1 - SS_res/(SS_tot + K.epsilon()) ) # base model architecture definition def model(): ...
[((1722, 1755), 'pandas.read_csv', 'pd.read_csv', (['"""../input/train.csv"""'], {}), "('../input/train.csv')\n", (1733, 1755), True, 'import pandas as pd\n'), ((1763, 1795), 'pandas.read_csv', 'pd.read_csv', (['"""../input/test.csv"""'], {}), "('../input/test.csv')\n", (1774, 1795), True, 'import pandas as pd\n'), ((1...